[5] | 1 | /* The copyright in this software is being made available under the BSD |
---|
| 2 | * License, included below. This software may be subject to other third party |
---|
| 3 | * and contributor rights, including patent rights, and no such rights are |
---|
[56] | 4 | * granted under this license. |
---|
[5] | 5 | * |
---|
[56] | 6 | * Copyright (c) 2010-2012, ITU/ISO/IEC |
---|
[5] | 7 | * All rights reserved. |
---|
| 8 | * |
---|
| 9 | * Redistribution and use in source and binary forms, with or without |
---|
| 10 | * modification, are permitted provided that the following conditions are met: |
---|
| 11 | * |
---|
| 12 | * * Redistributions of source code must retain the above copyright notice, |
---|
| 13 | * this list of conditions and the following disclaimer. |
---|
| 14 | * * Redistributions in binary form must reproduce the above copyright notice, |
---|
| 15 | * this list of conditions and the following disclaimer in the documentation |
---|
| 16 | * and/or other materials provided with the distribution. |
---|
[56] | 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may |
---|
[5] | 18 | * be used to endorse or promote products derived from this software without |
---|
| 19 | * specific prior written permission. |
---|
| 20 | * |
---|
| 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
| 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
| 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
| 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS |
---|
| 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
| 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
| 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
| 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
| 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
| 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
---|
| 31 | * THE POSSIBILITY OF SUCH DAMAGE. |
---|
| 32 | */ |
---|
[2] | 33 | |
---|
| 34 | /** \file TAppEncCfg.cpp |
---|
| 35 | \brief Handle encoder configuration parameters |
---|
| 36 | */ |
---|
| 37 | |
---|
| 38 | #include <stdlib.h> |
---|
| 39 | #include <cassert> |
---|
| 40 | #include <cstring> |
---|
| 41 | #include <string> |
---|
[56] | 42 | #include "TLibCommon/TComRom.h" |
---|
[2] | 43 | #include "TAppEncCfg.h" |
---|
[56] | 44 | #include "TAppCommon/program_options_lite.h" |
---|
[2] | 45 | |
---|
[56] | 46 | #ifdef WIN32 |
---|
| 47 | #define strdup _strdup |
---|
| 48 | #endif |
---|
[2] | 49 | |
---|
| 50 | using namespace std; |
---|
| 51 | namespace po = df::program_options_lite; |
---|
| 52 | |
---|
[56] | 53 | //! \ingroup TAppEncoder |
---|
| 54 | //! \{ |
---|
| 55 | |
---|
[2] | 56 | /* configuration helper funcs */ |
---|
| 57 | void doOldStyleCmdlineOn(po::Options& opts, const std::string& arg); |
---|
| 58 | void doOldStyleCmdlineOff(po::Options& opts, const std::string& arg); |
---|
| 59 | |
---|
| 60 | // ==================================================================================================================== |
---|
| 61 | // Local constants |
---|
| 62 | // ==================================================================================================================== |
---|
| 63 | |
---|
| 64 | /// max value of source padding size |
---|
| 65 | /** \todo replace it by command line option |
---|
| 66 | */ |
---|
| 67 | #define MAX_PAD_SIZE 16 |
---|
| 68 | |
---|
| 69 | // ==================================================================================================================== |
---|
| 70 | // Constructor / destructor / initialization / destroy |
---|
| 71 | // ==================================================================================================================== |
---|
| 72 | |
---|
| 73 | TAppEncCfg::TAppEncCfg() |
---|
| 74 | { |
---|
| 75 | m_aidQP = NULL; |
---|
[100] | 76 | m_aidQPdepth = NULL; |
---|
[2] | 77 | } |
---|
| 78 | |
---|
| 79 | TAppEncCfg::~TAppEncCfg() |
---|
| 80 | { |
---|
| 81 | if ( m_aidQP ) |
---|
| 82 | { |
---|
| 83 | delete[] m_aidQP; m_aidQP = NULL; |
---|
| 84 | } |
---|
[100] | 85 | |
---|
| 86 | if ( m_aidQPdepth ) |
---|
| 87 | { |
---|
| 88 | delete[] m_aidQPdepth; m_aidQPdepth = NULL; |
---|
| 89 | } |
---|
| 90 | |
---|
[2] | 91 | for(Int i = 0; i< m_pchInputFileList.size(); i++ ) |
---|
| 92 | { |
---|
| 93 | if ( m_pchInputFileList[i] != NULL ) |
---|
| 94 | free (m_pchInputFileList[i]); |
---|
| 95 | } |
---|
| 96 | for(Int i = 0; i< m_pchDepthInputFileList.size(); i++ ) |
---|
| 97 | { |
---|
| 98 | if ( m_pchDepthInputFileList[i] != NULL ) |
---|
| 99 | free (m_pchDepthInputFileList[i]); |
---|
| 100 | } |
---|
| 101 | for(Int i = 0; i< m_pchReconFileList.size(); i++ ) |
---|
| 102 | { |
---|
| 103 | if ( m_pchReconFileList[i] != NULL ) |
---|
| 104 | free (m_pchReconFileList[i]); |
---|
| 105 | } |
---|
| 106 | for(Int i = 0; i< m_pchDepthReconFileList.size(); i++ ) |
---|
| 107 | { |
---|
| 108 | if ( m_pchDepthReconFileList[i] != NULL ) |
---|
| 109 | free (m_pchDepthReconFileList[i]); |
---|
| 110 | } |
---|
[56] | 111 | if (m_pchBitstreamFile != NULL) |
---|
| 112 | free (m_pchBitstreamFile) ; |
---|
[5] | 113 | #if HHI_VSO |
---|
[2] | 114 | if ( m_pchVSOConfig != NULL) |
---|
| 115 | free ( m_pchVSOConfig ); |
---|
[5] | 116 | #endif |
---|
[2] | 117 | |
---|
[121] | 118 | if ( m_pchCameraParameterFile != NULL ) |
---|
| 119 | free ( m_pchCameraParameterFile ); |
---|
| 120 | |
---|
| 121 | if ( m_pchBaseViewCameraNumbers != NULL ) |
---|
| 122 | free ( m_pchBaseViewCameraNumbers ); |
---|
| 123 | |
---|
| 124 | if ( m_pchdQPFile != NULL ) |
---|
| 125 | free ( m_pchdQPFile ); |
---|
| 126 | |
---|
| 127 | if ( m_pchColumnWidth != NULL ) |
---|
| 128 | free ( m_pchColumnWidth ); |
---|
| 129 | |
---|
| 130 | if ( m_pchRowHeight != NULL ) |
---|
| 131 | free ( m_pchRowHeight ); |
---|
| 132 | |
---|
| 133 | if ( m_scalingListFile != NULL ) |
---|
| 134 | free ( m_scalingListFile ); |
---|
| 135 | |
---|
| 136 | |
---|
[2] | 137 | } |
---|
| 138 | |
---|
| 139 | Void TAppEncCfg::create() |
---|
| 140 | { |
---|
| 141 | } |
---|
| 142 | |
---|
| 143 | Void TAppEncCfg::destroy() |
---|
| 144 | { |
---|
| 145 | } |
---|
| 146 | |
---|
[56] | 147 | std::istringstream &operator>>( std::istringstream &in, GOPEntryMvc &entry ) //input |
---|
| 148 | { |
---|
| 149 | in>>entry.m_sliceType; |
---|
| 150 | in>>entry.m_POC; |
---|
| 151 | in>>entry.m_QPOffset; |
---|
| 152 | in>>entry.m_QPFactor; |
---|
| 153 | in>>entry.m_temporalId; |
---|
| 154 | in>>entry.m_numRefPicsActive; |
---|
| 155 | in>>entry.m_refPic; |
---|
| 156 | in>>entry.m_numRefPics; |
---|
| 157 | for ( Int i = 0; i < entry.m_numRefPics; i++ ) |
---|
| 158 | { |
---|
| 159 | in>>entry.m_referencePics[i]; |
---|
| 160 | } |
---|
| 161 | in>>entry.m_interRPSPrediction; |
---|
| 162 | if (entry.m_interRPSPrediction) |
---|
| 163 | { |
---|
| 164 | in>>entry.m_deltaRIdxMinus1; |
---|
| 165 | in>>entry.m_deltaRPS; |
---|
| 166 | in>>entry.m_numRefIdc; |
---|
| 167 | for ( Int i = 0; i < entry.m_numRefIdc; i++ ) |
---|
| 168 | { |
---|
| 169 | in>>entry.m_refIdc[i]; |
---|
| 170 | } |
---|
| 171 | } |
---|
| 172 | in>>entry.m_numInterViewRefPics; |
---|
| 173 | for( Int i = 0; i < entry.m_numInterViewRefPics; i++ ) |
---|
| 174 | { |
---|
| 175 | in>>entry.m_interViewRefs[i]; |
---|
| 176 | } |
---|
| 177 | for( Int i = 0; i < entry.m_numInterViewRefPics; i++ ) |
---|
| 178 | { |
---|
| 179 | in>>entry.m_interViewRefPosL0[i]; |
---|
| 180 | } |
---|
| 181 | for( Int i = 0; i < entry.m_numInterViewRefPics; i++ ) |
---|
| 182 | { |
---|
| 183 | in>>entry.m_interViewRefPosL1[i]; |
---|
| 184 | } |
---|
| 185 | return in; |
---|
| 186 | } |
---|
| 187 | |
---|
[2] | 188 | // ==================================================================================================================== |
---|
| 189 | // Public member functions |
---|
| 190 | // ==================================================================================================================== |
---|
| 191 | |
---|
| 192 | /** \param argc number of arguments |
---|
| 193 | \param argv array of arguments |
---|
| 194 | \retval true when success |
---|
| 195 | */ |
---|
| 196 | Bool TAppEncCfg::parseCfg( Int argc, Char* argv[] ) |
---|
| 197 | { |
---|
| 198 | bool do_help = false; |
---|
[56] | 199 | |
---|
[2] | 200 | string cfg_BitstreamFile; |
---|
| 201 | string cfg_dQPFile; |
---|
[56] | 202 | string cfg_ColumnWidth; |
---|
| 203 | string cfg_RowHeight; |
---|
| 204 | string cfg_ScalingListFile; |
---|
[2] | 205 | po::Options opts; |
---|
| 206 | opts.addOptions() |
---|
| 207 | ("help", do_help, false, "this help text") |
---|
| 208 | ("c", po::parseConfigFile, "configuration file name") |
---|
[56] | 209 | |
---|
[2] | 210 | /* File, I/O and source parameters */ |
---|
[56] | 211 | ("InputFile_%d,i_%d", m_pchInputFileList, (char *) 0 , MAX_VIEW_NUM , "original Yuv input file name %d") |
---|
| 212 | ("DepthInputFile_%d,di_%d", m_pchDepthInputFileList, (char *) 0 , MAX_VIEW_NUM , "original Yuv depth input file name %d") |
---|
| 213 | ("ReconFile_%d,o_%d", m_pchReconFileList, (char *) 0 , MAX_VIEW_NUM , "reconstructed Yuv output file name %d") |
---|
| 214 | ("DepthReconFile_%d,do_%d", m_pchDepthReconFileList, (char *) 0 , MAX_VIEW_NUM , "reconstructed Yuv depth output file name %d") |
---|
[2] | 215 | ("BitstreamFile,b", cfg_BitstreamFile, string(""), "bitstream output file name") |
---|
| 216 | ("CodeDepthMaps", m_bUsingDepthMaps, false, "Encode depth maps" ) |
---|
| 217 | ("CodedCamParsPrecision", m_iCodedCamParPrecision, STD_CAM_PARAMETERS_PRECISION, "precision for coding of camera parameters (in units of 2^(-x) luma samples)" ) |
---|
[56] | 218 | ("LambdaModifier0,-LM0", m_adLambdaModifier[ 0 ], ( double )1.0, "Lambda modifier for temporal layer 0") |
---|
| 219 | ("LambdaModifier1,-LM1", m_adLambdaModifier[ 1 ], ( double )1.0, "Lambda modifier for temporal layer 1") |
---|
| 220 | ("LambdaModifier2,-LM2", m_adLambdaModifier[ 2 ], ( double )1.0, "Lambda modifier for temporal layer 2") |
---|
| 221 | ("LambdaModifier3,-LM3", m_adLambdaModifier[ 3 ], ( double )1.0, "Lambda modifier for temporal layer 3") |
---|
[2] | 222 | ("SourceWidth,-wdt", m_iSourceWidth, 0, "Source picture width") |
---|
| 223 | ("SourceHeight,-hgt", m_iSourceHeight, 0, "Source picture height") |
---|
[56] | 224 | #if PIC_CROPPING |
---|
| 225 | ("CroppingMode", m_croppingMode, 0, "Cropping mode (0: no cropping, 1:automatic padding, 2: padding, 3:cropping") |
---|
| 226 | ("CropLeft", m_cropLeft, 0, "Left cropping/padding for cropping mode 3") |
---|
| 227 | ("CropRight", m_cropRight, 0, "Right cropping/padding for cropping mode 3") |
---|
| 228 | ("CropTop", m_cropTop, 0, "Top cropping/padding for cropping mode 3") |
---|
| 229 | ("CropBottom", m_cropBottom, 0, "Bottom cropping/padding for cropping mode 3") |
---|
| 230 | ("HorizontalPadding,-pdx",m_aiPad[0], 0, "horizontal source padding for cropping mode 2") |
---|
| 231 | ("VerticalPadding,-pdy", m_aiPad[1], 0, "vertical source padding for cropping mode 2") |
---|
| 232 | #endif |
---|
[2] | 233 | ("InputBitDepth", m_uiInputBitDepth, 8u, "bit-depth of input file") |
---|
| 234 | ("BitDepth", m_uiInputBitDepth, 8u, "deprecated alias of InputBitDepth") |
---|
| 235 | ("OutputBitDepth", m_uiOutputBitDepth, 0u, "bit-depth of output file") |
---|
| 236 | ("InternalBitDepth", m_uiInternalBitDepth, 0u, "Internal bit-depth (BitDepth+BitIncrement)") |
---|
[56] | 237 | #if !PIC_CROPPING |
---|
[2] | 238 | ("HorizontalPadding,-pdx",m_aiPad[0], 0, "horizontal source padding size") |
---|
| 239 | ("VerticalPadding,-pdy", m_aiPad[1], 0, "vertical source padding size") |
---|
| 240 | ("PAD", m_bUsePAD, false, "automatic source padding of multiple of 16" ) |
---|
[56] | 241 | #endif |
---|
[2] | 242 | ("FrameRate,-fr", m_iFrameRate, 0, "Frame rate") |
---|
| 243 | ("FrameSkip,-fs", m_FrameSkip, 0u, "Number of frames to skip at start of input YUV") |
---|
| 244 | ("FramesToBeEncoded,f", m_iFrameToBeEncoded, 0, "number of frames to be encoded (default=all)") |
---|
[121] | 245 | ("FrameToBeEncoded", m_iFrameToBeEncoded, 0, "deprecated alias of FramesToBeEncoded") |
---|
[56] | 246 | |
---|
[2] | 247 | ("NumberOfViews", m_iNumberOfViews, 0, "Number of views") |
---|
| 248 | /* Unit definition parameters */ |
---|
| 249 | ("MaxCUWidth", m_uiMaxCUWidth, 64u) |
---|
| 250 | ("MaxCUHeight", m_uiMaxCUHeight, 64u) |
---|
| 251 | /* todo: remove defaults from MaxCUSize */ |
---|
| 252 | ("MaxCUSize,s", m_uiMaxCUWidth, 64u, "max CU size") |
---|
| 253 | ("MaxCUSize,s", m_uiMaxCUHeight, 64u, "max CU size") |
---|
| 254 | ("MaxPartitionDepth,h", m_uiMaxCUDepth, 4u, "CU depth") |
---|
[56] | 255 | |
---|
[2] | 256 | ("QuadtreeTULog2MaxSize", m_uiQuadtreeTULog2MaxSize, 6u) |
---|
| 257 | ("QuadtreeTULog2MinSize", m_uiQuadtreeTULog2MinSize, 2u) |
---|
[56] | 258 | |
---|
[2] | 259 | ("QuadtreeTUMaxDepthIntra", m_uiQuadtreeTUMaxDepthIntra, 1u) |
---|
| 260 | ("QuadtreeTUMaxDepthInter", m_uiQuadtreeTUMaxDepthInter, 2u) |
---|
[56] | 261 | |
---|
[2] | 262 | /* Coding structure paramters */ |
---|
[56] | 263 | ("IntraPeriod,-ip",m_iIntraPeriod, -1, "intra period in frames, (-1: only first frame)") |
---|
| 264 | ("DecodingRefreshType,-dr",m_iDecodingRefreshType, 0, "intra refresh, (0:none 1:CRA 2:IDR)") |
---|
[2] | 265 | ("GOPSize,g", m_iGOPSize, 1, "GOP size of temporal structure") |
---|
[56] | 266 | #if !H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER |
---|
| 267 | ("MaxNumberOfReorderPictures", m_numReorderFrames, -1, "Max. number of reorder pictures: -1: encoder determines value, >=0: set explicitly") |
---|
| 268 | ("MaxNumberOfReferencePictures", m_maxNumberOfReferencePictures, 6, "Max. number of reference pictures") |
---|
[2] | 269 | #endif |
---|
[56] | 270 | ("ListCombination,-lc", m_bUseLComb, true, "combined reference list flag for uni-prediction in B-slices") |
---|
[2] | 271 | ("LCModification", m_bLCMod, false, "enables signalling of combined reference list derivation") |
---|
[56] | 272 | ("DisableInter4x4", m_bDisInter4x4, true, "Disable Inter 4x4") |
---|
| 273 | ("NSQT", m_enableNSQT, true, "Enable non-square transforms") |
---|
| 274 | ("AMP", m_enableAMP, true, "Enable asymmetric motion partitions") |
---|
[2] | 275 | /* motion options */ |
---|
| 276 | ("FastSearch", m_iFastSearch, 1, "0:Full search 1:Diamond 2:PMVFAST") |
---|
| 277 | ("SearchRange,-sr",m_iSearchRange, 96, "motion search range") |
---|
[197] | 278 | #if DV_V_RESTRICTION_B0037 |
---|
| 279 | ("DisparitySearchRangeRestriction",m_bUseDisparitySearchRangeRestriction, false, "restrict disparity search range") |
---|
| 280 | ("VerticalDisparitySearchRange",m_iVerticalDisparitySearchRange, 56, "vertical disparity search range") |
---|
| 281 | #endif |
---|
[2] | 282 | ("BipredSearchRange", m_bipredSearchRange, 4, "motion search range for bipred refinement") |
---|
| 283 | ("HadamardME", m_bUseHADME, true, "hadamard ME for fractional-pel") |
---|
| 284 | ("ASR", m_bUseASR, false, "adaptive motion search range") |
---|
[56] | 285 | |
---|
[2] | 286 | /* Quantization parameters */ |
---|
| 287 | ("QP,q", m_adQP, std::vector<double>(1,32), "Qp value, if value is float, QP is switched once during encoding, if two values are given the second is used for depth") |
---|
| 288 | ("DeltaQpRD,-dqr",m_uiDeltaQpRD, 0u, "max dQp offset for slice") |
---|
| 289 | ("MaxDeltaQP,d", m_iMaxDeltaQP, 0, "max dQp offset for block") |
---|
[56] | 290 | ("MaxCuDQPDepth,-dqd", m_iMaxCuDQPDepth, 0, "max depth for a minimum CuDQP") |
---|
| 291 | |
---|
| 292 | ("ChromaQpOffset, -cqo", m_iChromaQpOffset, 0, "ChromaQpOffset") |
---|
| 293 | ("ChromaQpOffset2nd,-cqo2", m_iChromaQpOffset2nd, 0, "ChromaQpOffset2nd") |
---|
| 294 | |
---|
| 295 | #if ADAPTIVE_QP_SELECTION |
---|
| 296 | ("AdaptiveQpSelection,-aqps", m_bUseAdaptQpSelect, false, "AdaptiveQpSelection") |
---|
| 297 | #endif |
---|
| 298 | |
---|
| 299 | ("AdaptiveQP,-aq", m_bUseAdaptiveQP, false, "QP adaptation based on a psycho-visual model") |
---|
| 300 | ("MaxQPAdaptationRange,-aqr", m_iQPAdaptationRange, 6, "QP adaptation range") |
---|
| 301 | ("dQPFile,m", cfg_dQPFile, string(""), "dQP file name") |
---|
[2] | 302 | ("RDOQ", m_abUseRDOQ, std::vector<Bool>(1,true), "Enable RDOQ") |
---|
[56] | 303 | ("TemporalLayerQPOffset_L0,-tq0", m_aiTLayerQPOffset[0], MAX_QP + 1, "QP offset of temporal layer 0") |
---|
| 304 | ("TemporalLayerQPOffset_L1,-tq1", m_aiTLayerQPOffset[1], MAX_QP + 1, "QP offset of temporal layer 1") |
---|
| 305 | ("TemporalLayerQPOffset_L2,-tq2", m_aiTLayerQPOffset[2], MAX_QP + 1, "QP offset of temporal layer 2") |
---|
| 306 | ("TemporalLayerQPOffset_L3,-tq3", m_aiTLayerQPOffset[3], MAX_QP + 1, "QP offset of temporal layer 3") |
---|
| 307 | |
---|
| 308 | #if !H0566_TLA |
---|
| 309 | ("TLayeringBasedOnCodingStruct,-tl", m_bTLayering, false, "Temporal ID is set based on the hierarchical coding structure") |
---|
| 310 | |
---|
| 311 | ("TLayerSwitchingFlag_L0,-ts0", m_abTLayerSwitchingFlag[0], false, "Switching flag for temporal layer 0") |
---|
| 312 | ("TLayerSwitchingFlag_L1,-ts1", m_abTLayerSwitchingFlag[1], false, "Switching flag for temporal layer 1") |
---|
| 313 | ("TLayerSwitchingFlag_L2,-ts2", m_abTLayerSwitchingFlag[2], false, "Switching flag for temporal layer 2") |
---|
| 314 | ("TLayerSwitchingFlag_L3,-ts3", m_abTLayerSwitchingFlag[3], false, "Switching flag for temporal layer 3") |
---|
| 315 | #endif |
---|
[2] | 316 | |
---|
| 317 | /* Entropy coding parameters */ |
---|
| 318 | ("SBACRD", m_bUseSBACRD, true, "SBAC based RD estimation") |
---|
[56] | 319 | |
---|
[2] | 320 | /* Deblocking filter parameters */ |
---|
| 321 | ("LoopFilterDisable", m_abLoopFilterDisable, std::vector<Bool>(1,false), "Disables LoopFilter") |
---|
| 322 | |
---|
[56] | 323 | ("LoopFilterOffsetInAPS", m_loopFilterOffsetInAPS, false) |
---|
| 324 | ("LoopFilterBetaOffset_div2", m_loopFilterBetaOffsetDiv2, 0 ) |
---|
| 325 | ("LoopFilterTcOffset_div2", m_loopFilterTcOffsetDiv2, 0 ) |
---|
[189] | 326 | #if LGE_ILLUCOMP_B0045 |
---|
| 327 | ("IlluCompEnable", m_bUseIC , true , "Use illumination compensation for inter-view prediction" ) |
---|
| 328 | #endif |
---|
[56] | 329 | #if DBL_CONTROL |
---|
[128] | 330 | ("DeblockingFilterControlPresent", m_DeblockingFilterControlPresent, true) |
---|
[56] | 331 | #endif |
---|
| 332 | |
---|
[5] | 333 | /* Camera Paremetes */ |
---|
[2] | 334 | ("CameraParameterFile,cpf", m_pchCameraParameterFile, (Char *) 0, "Camera Parameter File Name") |
---|
[195] | 335 | #if QC_MVHEVC_B0046 |
---|
[194] | 336 | ("BaseViewCameraNumbers" , m_aiVId, std::vector<Int>(1, MAX_VIEW_NUM), "Numbers of base views") |
---|
| 337 | #endif |
---|
[2] | 338 | ("BaseViewCameraNumbers" , m_pchBaseViewCameraNumbers, (Char *) 0, "Numbers of base views") |
---|
| 339 | |
---|
[56] | 340 | /* View Synthesis Optimization */ |
---|
[5] | 341 | |
---|
| 342 | #if HHI_VSO |
---|
[2] | 343 | ("VSOConfig", m_pchVSOConfig , (Char *) 0 , "VSO configuration") |
---|
[100] | 344 | ("VSO", m_bUseVSO , false , "Use VSO" ) |
---|
[2] | 345 | ("VSOMode", m_uiVSOMode , (UInt) 4 , "VSO Mode") |
---|
[100] | 346 | ("LambdaScaleVSO", m_dLambdaScaleVSO , (Double) 1 , "Lambda Scaling for VSO") |
---|
| 347 | |
---|
[189] | 348 | #if HHI_VSO_LS_TABLE_M23714 |
---|
[100] | 349 | ("VSOLSTable", m_bVSOLSTable , true , "Depth QP dependent video/depth rate allocation by Lagrange multiplier" ) |
---|
[21] | 350 | #endif |
---|
[100] | 351 | |
---|
| 352 | #if SAIT_VSO_EST_A0033 |
---|
| 353 | ("UseEstimatedVSD", m_bUseEstimatedVSD , true , "Model based VSD estimation instead of rendering based for some encoder decisions" ) |
---|
| 354 | #endif |
---|
| 355 | #if LGE_VSO_EARLY_SKIP_A0093 |
---|
| 356 | ("VSOEarlySkip", m_bVSOEarlySkip , true , "Early skip of VSO computation if synthesis error assumed to be zero" ) |
---|
| 357 | #endif |
---|
| 358 | ("ForceLambdaScaleVSO", m_bForceLambdaScaleVSO , false , "Force using Lambda Scale VSO also in non-VSO-Mode") |
---|
[5] | 359 | #if HHI_VSO_DIST_INT |
---|
[100] | 360 | ("AllowNegDist", m_bAllowNegDist , true , "Allow negative Distortion in VSO") |
---|
[2] | 361 | #endif |
---|
[115] | 362 | #if LGE_WVSO_A0119 |
---|
[189] | 363 | ("WVSO", m_bUseWVSO , true , "Use depth fidelity term for VSO" ) |
---|
[120] | 364 | ("VSOWeight", m_iVSOWeight , 10 , "Synthesized View Distortion Change weight" ) |
---|
| 365 | ("VSDWeight", m_iVSDWeight , 1 , "View Synthesis Distortion estimate weight" ) |
---|
| 366 | ("DWeight", m_iDWeight , 1 , "Depth Distortion weight" ) |
---|
[115] | 367 | #endif |
---|
[2] | 368 | |
---|
[189] | 369 | #if OL_QTLIMIT_PREDCODING_B0068 |
---|
| 370 | ("QTLPC", m_bUseQTLPC , true , "Use depth Quadtree Limitation + Predictive Coding" ) |
---|
[5] | 371 | #endif |
---|
[2] | 372 | |
---|
[115] | 373 | #endif |
---|
| 374 | |
---|
[56] | 375 | #if DEPTH_MAP_GENERATION |
---|
| 376 | ("PredDepthMapGen", m_uiPredDepthMapGeneration, (UInt)0, "generation of prediction depth maps for motion data prediction" ) |
---|
| 377 | #endif |
---|
| 378 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
| 379 | ("MultiviewMvPred", m_uiMultiviewMvPredMode, (UInt)0, "usage of predicted depth maps" ) |
---|
| 380 | ("MultiviewMvRegMode", m_uiMultiviewMvRegMode, (UInt)0, "regularization mode for multiview motion vectors" ) |
---|
| 381 | ("MultiviewMvRegLambdaScale", m_dMultiviewMvRegLambdaScale, (Double)0, "lambda scale for multiview motion vector regularization" ) |
---|
| 382 | #endif |
---|
| 383 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
| 384 | ("MultiviewResPred", m_uiMultiviewResPredMode, (UInt)0, "usage of inter-view residual prediction" ) |
---|
| 385 | #endif |
---|
| 386 | |
---|
[2] | 387 | /* Coding tools */ |
---|
| 388 | ("LMChroma", m_bUseLMChroma, true, "intra chroma prediction based on recontructed luma") |
---|
| 389 | |
---|
| 390 | ("ALF", m_abUseALF, std::vector<Bool>(1,true), "Enables ALF") |
---|
| 391 | ("SAO", m_abUseSAO, std::vector<Bool>(1, true), "SAO") |
---|
[56] | 392 | #if SAO_UNIT_INTERLEAVING |
---|
| 393 | ("MaxNumOffsetsPerPic", m_maxNumOffsetsPerPic, 2048, "2048: default") |
---|
| 394 | ("SAOInterleaving", m_saoInterleavingFlag, false, "0: SAO Picture Mode, 1: SAO Interleaving ") |
---|
[2] | 395 | #endif |
---|
| 396 | |
---|
| 397 | ("ALFEncodePassReduction", m_iALFEncodePassReduction, 0, "0:Original 16-pass, 1: 1-pass, 2: 2-pass encoding") |
---|
[56] | 398 | |
---|
| 399 | ("ALFMaxNumFilter,-ALFMNF", m_iALFMaxNumberFilters, 16, "16: No Constrained, 1-15: Constrained max number of filter") |
---|
| 400 | #if LCU_SYNTAX_ALF |
---|
| 401 | ("ALFParamInSlice", m_bALFParamInSlice, false, "ALF parameters in 0: APS, 1: slice header") |
---|
| 402 | ("ALFPicBasedEncode", m_bALFPicBasedEncode, true, "ALF picture-based encoding 0: false, 1: true") |
---|
[2] | 403 | #endif |
---|
[56] | 404 | |
---|
[2] | 405 | ("SliceMode", m_iSliceMode, 0, "0: Disable all Recon slice limits, 1: Enforce max # of LCUs, 2: Enforce max # of bytes") |
---|
| 406 | ("SliceArgument", m_iSliceArgument, 0, "if SliceMode==1 SliceArgument represents max # of LCUs. if SliceMode==2 SliceArgument represents max # of bytes.") |
---|
| 407 | ("EntropySliceMode", m_iEntropySliceMode, 0, "0: Disable all entropy slice limits, 1: Enforce max # of LCUs, 2: Enforce constraint based entropy slices") |
---|
| 408 | ("EntropySliceArgument", m_iEntropySliceArgument,0, "if EntropySliceMode==1 SliceArgument represents max # of LCUs. if EntropySliceMode==2 EntropySliceArgument represents max # of bins.") |
---|
[56] | 409 | ("SliceGranularity", m_iSliceGranularity, 0, "0: Slices always end at LCU borders. 1-3: slices may end at a depth of 1-3 below LCU level.") |
---|
[2] | 410 | ("LFCrossSliceBoundaryFlag", m_bLFCrossSliceBoundaryFlag, true) |
---|
[56] | 411 | |
---|
| 412 | ("ConstrainedIntraPred", m_bUseConstrainedIntraPred, false, "Constrained Intra Prediction") |
---|
| 413 | ("PCMEnabledFlag", m_usePCM , false) |
---|
| 414 | ("PCMLog2MaxSize", m_pcmLog2MaxSize, 5u) |
---|
| 415 | ("PCMLog2MinSize", m_uiPCMLog2MinSize, 3u) |
---|
| 416 | |
---|
| 417 | ("PCMInputBitDepthFlag", m_bPCMInputBitDepthFlag, true) |
---|
| 418 | ("PCMFilterDisableFlag", m_bPCMFilterDisableFlag, false) |
---|
| 419 | #if LOSSLESS_CODING |
---|
| 420 | ("LosslessCuEnabled", m_useLossless, false) |
---|
[2] | 421 | #endif |
---|
[56] | 422 | ("weighted_pred_flag,-wpP", m_bUseWeightPred, false, "weighted prediction flag (P-Slices)") |
---|
| 423 | ("weighted_bipred_idc,-wpBidc", m_uiBiPredIdc, 0u, "weighted bipred idc (B-Slices)") |
---|
| 424 | ("TileInfoPresentFlag", m_iColumnRowInfoPresent, 1, "0: tiles parameters are NOT present in the PPS. 1: tiles parameters are present in the PPS") |
---|
| 425 | ("UniformSpacingIdc", m_iUniformSpacingIdr, 0, "Indicates if the column and row boundaries are distributed uniformly") |
---|
| 426 | #if !REMOVE_TILE_DEPENDENCE |
---|
| 427 | ("TileBoundaryIndependenceIdc", m_iTileBoundaryIndependenceIdr, 1, "Indicates if the column and row boundaries break the prediction") |
---|
[2] | 428 | #endif |
---|
[56] | 429 | ("NumTileColumnsMinus1", m_iNumColumnsMinus1, 0, "Number of columns in a picture minus 1") |
---|
| 430 | ("ColumnWidthArray", cfg_ColumnWidth, string(""), "Array containing ColumnWidth values in units of LCU") |
---|
| 431 | ("NumTileRowsMinus1", m_iNumRowsMinus1, 0, "Number of rows in a picture minus 1") |
---|
| 432 | ("RowHeightArray", cfg_RowHeight, string(""), "Array containing RowHeight values in units of LCU") |
---|
| 433 | ("TileLocationInSliceHeaderFlag", m_iTileLocationInSliceHeaderFlag, 0, "0: Disable transmission of tile location in slice header. 1: Transmit tile locations in slice header.") |
---|
| 434 | ("TileMarkerFlag", m_iTileMarkerFlag, 0, "0: Disable transmission of lightweight tile marker. 1: Transmit light weight tile marker.") |
---|
| 435 | ("MaxTileMarkerEntryPoints", m_iMaxTileMarkerEntryPoints, 4, "Maximum number of uniformly-spaced tile entry points (using light weigh tile markers). Default=4. If number of tiles < MaxTileMarkerEntryPoints then all tiles have entry points.") |
---|
| 436 | ("TileControlPresentFlag", m_iTileBehaviorControlPresentFlag, 1, "0: tiles behavior control parameters are NOT present in the PPS. 1: tiles behavior control parameters are present in the PPS") |
---|
| 437 | ("LFCrossTileBoundaryFlag", m_bLFCrossTileBoundaryFlag, true, "1: cross-tile-boundary loop filtering. 0:non-cross-tile-boundary loop filtering") |
---|
| 438 | ("WaveFrontSynchro", m_iWaveFrontSynchro, 0, "0: no synchro; 1 synchro with TR; 2 TRR etc") |
---|
| 439 | ("WaveFrontFlush", m_iWaveFrontFlush, 0, "Flush and terminate CABAC coding for each LCU line") |
---|
| 440 | ("WaveFrontSubstreams", m_iWaveFrontSubstreams, 1, "# coded substreams wanted; per tile if TileBoundaryIndependenceIdc is 1, otherwise per frame") |
---|
| 441 | ("ScalingList", m_useScalingListId, 0, "0: no scaling list, 1: default scaling lists, 2: scaling lists specified in ScalingListFile") |
---|
| 442 | ("ScalingListFile", cfg_ScalingListFile, string(""), "Scaling list file name") |
---|
| 443 | #if MULTIBITS_DATA_HIDING |
---|
| 444 | ("SignHideFlag,-SBH", m_signHideFlag, 1) |
---|
| 445 | ("SignHideThreshold,-TSIG", m_signHidingThreshold, 4) |
---|
| 446 | #endif |
---|
| 447 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
| 448 | ("DMM", m_bUseDMM, false, "depth model modes flag") |
---|
| 449 | #endif |
---|
| 450 | |
---|
[2] | 451 | /* Misc. */ |
---|
[56] | 452 | ("SEIpictureDigest", m_pictureDigestEnabled, true, "Control generation of picture_digest SEI messages\n" |
---|
[2] | 453 | "\t1: use MD5\n" |
---|
| 454 | "\t0: disable") |
---|
| 455 | |
---|
[189] | 456 | #if TMVP_DEPTH_SWITCH |
---|
| 457 | ("TMVP", m_enableTMVP, std::vector<Bool>(1,true), "Enable TMVP" ) |
---|
| 458 | #else |
---|
[56] | 459 | ("TMVP", m_enableTMVP, true, "Enable TMVP" ) |
---|
[189] | 460 | #endif |
---|
[2] | 461 | |
---|
[56] | 462 | ("FEN", m_bUseFastEnc, false, "fast encoder setting") |
---|
| 463 | ("ECU", m_bUseEarlyCU, false, "Early CU setting") |
---|
| 464 | #if FAST_DECISION_FOR_MRG_RD_COST |
---|
| 465 | ("FDM", m_useFastDecisionForMerge, true, "Fast decision for Merge RD Cost") |
---|
[5] | 466 | #endif |
---|
[56] | 467 | ("CFM", m_bUseCbfFastMode, false, "Cbf fast mode setting") |
---|
[5] | 468 | #if HHI_INTERVIEW_SKIP |
---|
[56] | 469 | ("InterViewSkip", m_bInterViewSkip, false, "usage of interview skip" ) |
---|
[5] | 470 | #if HHI_INTERVIEW_SKIP_LAMBDA_SCALE |
---|
[2] | 471 | ("InterViewSkipLambdaScale", m_dInterViewSkipLambdaScale, (Double)8, "lambda scale for interview skip" ) |
---|
| 472 | #endif |
---|
| 473 | #endif |
---|
| 474 | /* Compatability with old style -1 FOO or -0 FOO options. */ |
---|
| 475 | ("1", doOldStyleCmdlineOn, "turn option <name> on") |
---|
| 476 | ("0", doOldStyleCmdlineOff, "turn option <name> off") |
---|
[56] | 477 | #if HHI_MPI |
---|
| 478 | ("MVI", m_bUseMVI, false, "use motion vector inheritance for depth map coding") |
---|
| 479 | #endif |
---|
[189] | 480 | #if RWTH_SDC_DLT_B0036 |
---|
| 481 | ("DLT", m_bUseDLT, true, "use depth lookup table for depth map coding") |
---|
| 482 | ("SDC", m_bUseSDC, true, "use simplified depth coding tree") |
---|
| 483 | #endif |
---|
[2] | 484 | ; |
---|
[56] | 485 | |
---|
| 486 | // parse coding structure |
---|
| 487 | for( Int k = 0; k < MAX_VIEW_NUM; k++ ) |
---|
| 488 | { |
---|
| 489 | if( k == 0 ) |
---|
| 490 | { |
---|
| 491 | for( Int i = 1; i < MAX_GOP + 1; i++ ) |
---|
| 492 | { |
---|
| 493 | std::ostringstream cOSS; |
---|
| 494 | cOSS<<"Frame"<<i; |
---|
| 495 | opts.addOptions()( cOSS.str(), m_GOPListsMvc[k][i-1], GOPEntryMvc() ); |
---|
| 496 | } |
---|
| 497 | } |
---|
| 498 | else |
---|
| 499 | { |
---|
| 500 | std::ostringstream cOSS1; |
---|
| 501 | cOSS1<<"FrameI"<<"_v"<<k; |
---|
| 502 | opts.addOptions()(cOSS1.str(), m_GOPListsMvc[k][MAX_GOP], GOPEntryMvc()); |
---|
[2] | 503 | |
---|
[56] | 504 | for( Int i = 1; i < MAX_GOP + 1; i++ ) |
---|
| 505 | { |
---|
| 506 | std::ostringstream cOSS2; |
---|
| 507 | cOSS2<<"Frame"<<i<<"_v"<<k; |
---|
| 508 | opts.addOptions()(cOSS2.str(), m_GOPListsMvc[k][i-1], GOPEntryMvc()); |
---|
| 509 | } |
---|
| 510 | } |
---|
| 511 | } |
---|
| 512 | |
---|
[2] | 513 | po::setDefaults(opts); |
---|
| 514 | const list<const char*>& argv_unhandled = po::scanArgv(opts, argc, (const char**) argv); |
---|
| 515 | |
---|
| 516 | for (list<const char*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++) |
---|
| 517 | { |
---|
| 518 | fprintf(stderr, "Unhandled argument ignored: `%s'\n", *it); |
---|
| 519 | } |
---|
[56] | 520 | |
---|
[2] | 521 | if (argc == 1 || do_help) |
---|
| 522 | { |
---|
| 523 | /* argc == 1: no options have been specified */ |
---|
| 524 | po::doHelp(cout, opts); |
---|
| 525 | xPrintUsage(); |
---|
| 526 | return false; |
---|
| 527 | } |
---|
[56] | 528 | |
---|
[2] | 529 | /* |
---|
| 530 | * Set any derived parameters |
---|
| 531 | */ |
---|
| 532 | /* convert std::string to c string for compatability */ |
---|
| 533 | m_pchBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str()); |
---|
| 534 | m_pchdQPFile = cfg_dQPFile.empty() ? NULL : strdup(cfg_dQPFile.c_str()); |
---|
[56] | 535 | |
---|
| 536 | m_pchColumnWidth = cfg_ColumnWidth.empty() ? NULL: strdup(cfg_ColumnWidth.c_str()); |
---|
| 537 | m_pchRowHeight = cfg_RowHeight.empty() ? NULL : strdup(cfg_RowHeight.c_str()); |
---|
| 538 | m_scalingListFile = cfg_ScalingListFile.empty() ? NULL : strdup(cfg_ScalingListFile.c_str()); |
---|
| 539 | |
---|
[2] | 540 | if ( m_bUsingDepthMaps ) |
---|
| 541 | { |
---|
| 542 | for(Int i = 0; i < m_pchDepthReconFileList.size() ; i++) |
---|
| 543 | { |
---|
| 544 | if ((m_pchDepthInputFileList[i] != NULL) && (m_pchReconFileList[i] != NULL) && (i < m_iNumberOfViews) ) |
---|
| 545 | { |
---|
| 546 | if (m_pchDepthReconFileList[i] == NULL ) |
---|
| 547 | { |
---|
| 548 | xAppendToFileNameEnd( m_pchReconFileList[i], "_depth", m_pchDepthReconFileList[i] ); |
---|
| 549 | } |
---|
| 550 | } |
---|
| 551 | else |
---|
| 552 | { |
---|
| 553 | m_pchDepthReconFileList[i] = NULL; |
---|
| 554 | } |
---|
| 555 | }; |
---|
| 556 | } |
---|
[56] | 557 | if ( m_adQP.size() < 2 ) |
---|
| 558 | { |
---|
| 559 | m_adQP.push_back( m_adQP[0] ); |
---|
| 560 | }; |
---|
| 561 | for (UInt uiK = 0; uiK < m_adQP.size(); uiK++) |
---|
| 562 | { |
---|
| 563 | m_aiQP.push_back( (Int)( m_adQP[uiK] ) ); |
---|
| 564 | } |
---|
[2] | 565 | |
---|
[56] | 566 | #if PIC_CROPPING |
---|
| 567 | switch (m_croppingMode) |
---|
[2] | 568 | { |
---|
[56] | 569 | case 0: |
---|
| 570 | { |
---|
| 571 | // no cropping or padding |
---|
| 572 | m_cropLeft = m_cropRight = m_cropTop = m_cropBottom = 0; |
---|
| 573 | m_aiPad[1] = m_aiPad[0] = 0; |
---|
| 574 | break; |
---|
| 575 | } |
---|
| 576 | case 1: |
---|
| 577 | { |
---|
| 578 | // automatic padding to minimum CU size |
---|
| 579 | Int minCuSize = m_uiMaxCUHeight >> (m_uiMaxCUDepth - 1); |
---|
| 580 | if (m_iSourceWidth % minCuSize) |
---|
| 581 | { |
---|
| 582 | m_aiPad[0] = m_cropRight = ((m_iSourceWidth / minCuSize) + 1) * minCuSize - m_iSourceWidth; |
---|
| 583 | m_iSourceWidth += m_cropRight; |
---|
| 584 | } |
---|
| 585 | if (m_iSourceHeight % minCuSize) |
---|
| 586 | { |
---|
| 587 | m_aiPad[1] = m_cropBottom = ((m_iSourceHeight / minCuSize) + 1) * minCuSize - m_iSourceHeight; |
---|
| 588 | m_iSourceHeight += m_cropBottom; |
---|
| 589 | } |
---|
| 590 | break; |
---|
| 591 | } |
---|
| 592 | case 2: |
---|
| 593 | { |
---|
| 594 | //padding |
---|
| 595 | m_iSourceWidth += m_aiPad[0]; |
---|
| 596 | m_iSourceHeight += m_aiPad[1]; |
---|
| 597 | m_cropRight = m_aiPad[0]; |
---|
| 598 | m_cropBottom = m_aiPad[1]; |
---|
| 599 | break; |
---|
| 600 | } |
---|
| 601 | case 3: |
---|
| 602 | { |
---|
| 603 | // cropping |
---|
| 604 | if ((m_cropLeft == 0) && (m_cropRight == 0) && (m_cropTop == 0) && (m_cropBottom == 0)) |
---|
| 605 | { |
---|
| 606 | fprintf(stderr, "Warning: Cropping enabled, but all cropping parameters set to zero\n"); |
---|
| 607 | } |
---|
| 608 | if ((m_aiPad[1] != 0) || (m_aiPad[0]!=0)) |
---|
| 609 | { |
---|
| 610 | fprintf(stderr, "Warning: Cropping enabled, padding parameters will be ignored\n"); |
---|
| 611 | } |
---|
| 612 | m_aiPad[1] = m_aiPad[0] = 0; |
---|
| 613 | break; |
---|
| 614 | } |
---|
[2] | 615 | } |
---|
[56] | 616 | #else |
---|
[2] | 617 | |
---|
| 618 | // compute source padding size |
---|
| 619 | if ( m_bUsePAD ) |
---|
| 620 | { |
---|
| 621 | if ( m_iSourceWidth%MAX_PAD_SIZE ) |
---|
| 622 | { |
---|
| 623 | m_aiPad[0] = (m_iSourceWidth/MAX_PAD_SIZE+1)*MAX_PAD_SIZE - m_iSourceWidth; |
---|
| 624 | } |
---|
[56] | 625 | |
---|
[2] | 626 | if ( m_iSourceHeight%MAX_PAD_SIZE ) |
---|
| 627 | { |
---|
| 628 | m_aiPad[1] = (m_iSourceHeight/MAX_PAD_SIZE+1)*MAX_PAD_SIZE - m_iSourceHeight; |
---|
| 629 | } |
---|
| 630 | } |
---|
| 631 | m_iSourceWidth += m_aiPad[0]; |
---|
| 632 | m_iSourceHeight += m_aiPad[1]; |
---|
[56] | 633 | #endif |
---|
| 634 | |
---|
| 635 | // allocate slice-based dQP values |
---|
| 636 | m_aidQP = new Int[ m_iFrameToBeEncoded + m_iGOPSize + 1 ]; |
---|
| 637 | m_aidQPdepth = new Int[ m_iFrameToBeEncoded + m_iGOPSize + 1 ]; |
---|
| 638 | ::memset( m_aidQP, 0, sizeof(Int)*( m_iFrameToBeEncoded + m_iGOPSize + 1 ) ); |
---|
| 639 | ::memset( m_aidQPdepth, 0, sizeof(Int)*( m_iFrameToBeEncoded + m_iGOPSize + 1 ) ); |
---|
| 640 | |
---|
| 641 | // handling of floating-point QP values |
---|
| 642 | // if QP is not integer, sequence is split into two sections having QP and QP+1 |
---|
| 643 | m_aiQP[0] = (Int)( m_adQP[0] ); |
---|
| 644 | if ( m_aiQP[0] < m_adQP[0] ) |
---|
| 645 | { |
---|
| 646 | Int iSwitchPOC = (Int)( m_iFrameToBeEncoded - (m_adQP[0] - m_aiQP[0])*m_iFrameToBeEncoded + 0.5 ); |
---|
| 647 | |
---|
| 648 | iSwitchPOC = (Int)( (Double)iSwitchPOC / m_iGOPSize + 0.5 )*m_iGOPSize; |
---|
| 649 | for ( Int i=iSwitchPOC; i<m_iFrameToBeEncoded + m_iGOPSize + 1; i++ ) |
---|
| 650 | { |
---|
| 651 | m_aidQP[i] = 1; |
---|
| 652 | } |
---|
| 653 | } |
---|
[2] | 654 | |
---|
[56] | 655 | m_aiQP[1] = (Int)( m_adQP[1] ); |
---|
| 656 | if ( m_aiQP[1] < m_adQP[1] ) |
---|
[2] | 657 | { |
---|
[56] | 658 | Int iSwitchPOC = (Int)( m_iFrameToBeEncoded - (m_adQP[1] - m_aiQP[1])*m_iFrameToBeEncoded + 0.5 ); |
---|
| 659 | |
---|
| 660 | iSwitchPOC = (Int)( (Double)iSwitchPOC / m_iGOPSize + 0.5 )*m_iGOPSize; |
---|
| 661 | for ( Int i=iSwitchPOC; i<m_iFrameToBeEncoded + m_iGOPSize + 1; i++ ) |
---|
| 662 | { |
---|
| 663 | m_aidQPdepth[i] = 1; |
---|
| 664 | } |
---|
| 665 | } |
---|
| 666 | |
---|
| 667 | // reading external dQP description from file |
---|
| 668 | if ( m_pchdQPFile ) |
---|
[2] | 669 | { |
---|
[56] | 670 | FILE* fpt=fopen( m_pchdQPFile, "r" ); |
---|
| 671 | if ( fpt ) |
---|
| 672 | { |
---|
| 673 | Int iValue; |
---|
| 674 | Int iPOC = 0; |
---|
| 675 | while ( iPOC < m_iFrameToBeEncoded ) |
---|
| 676 | { |
---|
| 677 | if ( fscanf(fpt, "%d", &iValue ) == EOF ) break; |
---|
| 678 | m_aidQP[ iPOC ] = iValue; |
---|
| 679 | iPOC++; |
---|
| 680 | } |
---|
| 681 | fclose(fpt); |
---|
| 682 | } |
---|
[2] | 683 | } |
---|
| 684 | |
---|
[5] | 685 | #if HHI_VSO |
---|
[2] | 686 | m_bUseVSO = m_bUseVSO && m_bUsingDepthMaps && (m_uiVSOMode != 0); |
---|
[5] | 687 | #endif |
---|
[2] | 688 | |
---|
[115] | 689 | #if LGE_WVSO_A0119 |
---|
[120] | 690 | m_bUseWVSO = m_bUseVSO && m_bUseWVSO && m_bUsingDepthMaps; |
---|
[115] | 691 | #endif |
---|
[2] | 692 | xCleanUpVectors(); |
---|
| 693 | |
---|
[189] | 694 | |
---|
| 695 | #if TMVP_DEPTH_SWITCH |
---|
| 696 | if ( m_enableTMVP.size() < 2) |
---|
| 697 | { |
---|
| 698 | m_enableTMVP.push_back( m_enableTMVP[0] ); |
---|
| 699 | } |
---|
| 700 | #endif |
---|
| 701 | |
---|
| 702 | |
---|
[5] | 703 | #if HHI_VSO |
---|
[2] | 704 | if ( m_abUseALF .size() < 2) |
---|
| 705 | m_abUseALF .push_back( m_bUseVSO ? false : m_abUseALF[0] ); |
---|
| 706 | |
---|
| 707 | if ( m_abUseRDOQ.size() < 2) |
---|
[5] | 708 | m_abUseRDOQ.push_back( m_bUseVSO ? true : m_abUseRDOQ[0] ); |
---|
[2] | 709 | |
---|
| 710 | if ( m_abLoopFilterDisable.size() < 2) |
---|
| 711 | m_abLoopFilterDisable.push_back( m_bUseVSO ? true : m_abLoopFilterDisable[0] ); |
---|
| 712 | |
---|
| 713 | if (m_abUseSAO.size() < 2) |
---|
| 714 | m_abUseSAO.push_back ( m_bUseVSO ? false : m_abUseSAO[0] ); |
---|
[5] | 715 | #else |
---|
| 716 | if ( m_abUseALF .size() < 2) |
---|
| 717 | m_abUseALF .push_back( m_abUseALF[0] ); |
---|
[2] | 718 | |
---|
[5] | 719 | if ( m_abUseRDOQ.size() < 2) |
---|
| 720 | m_abUseRDOQ.push_back( m_abUseRDOQ[0] ); |
---|
| 721 | |
---|
| 722 | if ( m_abLoopFilterDisable.size() < 2) |
---|
| 723 | m_abLoopFilterDisable.push_back( m_abLoopFilterDisable[0] ); |
---|
| 724 | |
---|
| 725 | if (m_abUseSAO.size() < 2) |
---|
| 726 | m_abUseSAO.push_back ( m_abUseSAO[0] ); |
---|
| 727 | #endif |
---|
| 728 | |
---|
| 729 | #if HHI_VSO |
---|
[21] | 730 | |
---|
[189] | 731 | #if HHI_VSO_LS_TABLE_M23714 |
---|
[21] | 732 | // Q&D |
---|
| 733 | Double adLambdaScaleTable[] = |
---|
| 734 | { 0.031250, 0.031639, 0.032029, 0.032418, 0.032808, 0.033197, 0.033586, 0.033976, 0.034365, 0.034755, |
---|
| 735 | 0.035144, 0.035533, 0.035923, 0.036312, 0.036702, 0.037091, 0.037480, 0.037870, 0.038259, 0.038648, |
---|
| 736 | 0.039038, 0.039427, 0.039817, 0.040206, 0.040595, 0.040985, 0.041374, 0.041764, 0.042153, 0.042542, |
---|
| 737 | 0.042932, 0.043321, 0.043711, 0.044100, 0.044194, 0.053033, 0.061872, 0.070711, 0.079550, 0.088388, |
---|
| 738 | 0.117851, 0.147314, 0.176777, 0.235702, 0.294628, 0.353553, 0.471405, 0.589256, 0.707107, 0.707100, |
---|
| 739 | 0.753550, 0.800000 |
---|
| 740 | }; |
---|
[100] | 741 | if ( m_bVSOLSTable ) |
---|
| 742 | { |
---|
| 743 | AOT( (m_aiQP[1] < 0) || (m_aiQP[1] > 51)); |
---|
| 744 | m_dLambdaScaleVSO *= adLambdaScaleTable[m_aiQP[1]]; |
---|
| 745 | } |
---|
[5] | 746 | #endif |
---|
[21] | 747 | #endif |
---|
[2] | 748 | |
---|
[56] | 749 | // set global variables |
---|
[2] | 750 | xSetGlobal(); |
---|
| 751 | |
---|
| 752 | // read and check camera parameters |
---|
[5] | 753 | #if HHI_VSO |
---|
[2] | 754 | if ( m_bUseVSO && m_uiVSOMode == 4) |
---|
| 755 | { |
---|
| 756 | m_cRenModStrParser.setString( m_iNumberOfViews, m_pchVSOConfig ); |
---|
| 757 | m_cCameraData .init ( (UInt)m_iNumberOfViews, |
---|
| 758 | m_uiInputBitDepth, |
---|
| 759 | (UInt)m_iCodedCamParPrecision, |
---|
| 760 | m_FrameSkip, |
---|
| 761 | (UInt)m_iFrameToBeEncoded, |
---|
| 762 | m_pchCameraParameterFile, |
---|
| 763 | m_pchBaseViewCameraNumbers, |
---|
| 764 | NULL, |
---|
| 765 | m_cRenModStrParser.getSynthViews(), |
---|
| 766 | LOG2_DISP_PREC_LUT ); |
---|
| 767 | } |
---|
| 768 | else if ( m_bUseVSO && m_uiVSOMode != 4 ) |
---|
| 769 | { |
---|
| 770 | m_cCameraData .init ( (UInt)m_iNumberOfViews, |
---|
| 771 | m_uiInputBitDepth, |
---|
| 772 | (UInt)m_iCodedCamParPrecision, |
---|
| 773 | m_FrameSkip, |
---|
| 774 | (UInt)m_iFrameToBeEncoded, |
---|
| 775 | m_pchCameraParameterFile, |
---|
| 776 | m_pchBaseViewCameraNumbers, |
---|
| 777 | m_pchVSOConfig, |
---|
| 778 | NULL, |
---|
| 779 | LOG2_DISP_PREC_LUT ); |
---|
| 780 | } |
---|
| 781 | else |
---|
| 782 | { |
---|
| 783 | m_cCameraData .init ( (UInt)m_iNumberOfViews, |
---|
| 784 | m_uiInputBitDepth, |
---|
| 785 | (UInt)m_iCodedCamParPrecision, |
---|
| 786 | m_FrameSkip, |
---|
| 787 | (UInt)m_iFrameToBeEncoded, |
---|
| 788 | m_pchCameraParameterFile, |
---|
| 789 | m_pchBaseViewCameraNumbers, |
---|
| 790 | NULL, |
---|
| 791 | NULL, |
---|
| 792 | LOG2_DISP_PREC_LUT ); |
---|
[5] | 793 | } |
---|
| 794 | #else |
---|
[195] | 795 | #if !QC_MVHEVC_B0046 |
---|
[5] | 796 | m_cCameraData .init ( (UInt)m_iNumberOfViews, |
---|
| 797 | m_uiInputBitDepth, |
---|
| 798 | (UInt)m_iCodedCamParPrecision, |
---|
| 799 | m_FrameSkip, |
---|
| 800 | (UInt)m_iFrameToBeEncoded, |
---|
| 801 | m_pchCameraParameterFile, |
---|
| 802 | m_pchBaseViewCameraNumbers, |
---|
| 803 | NULL, |
---|
| 804 | NULL, |
---|
| 805 | LOG2_DISP_PREC_LUT ); |
---|
| 806 | #endif |
---|
[194] | 807 | #endif |
---|
[2] | 808 | |
---|
[5] | 809 | |
---|
[2] | 810 | // check validity of input parameters |
---|
| 811 | xCheckParameter(); |
---|
[195] | 812 | #if !QC_MVHEVC_B0046 |
---|
[2] | 813 | m_cCameraData.check( false, true ); |
---|
[194] | 814 | #endif |
---|
[2] | 815 | // print-out parameters |
---|
| 816 | xPrintParameter(); |
---|
[56] | 817 | |
---|
[2] | 818 | return true; |
---|
| 819 | } |
---|
| 820 | |
---|
| 821 | // ==================================================================================================================== |
---|
| 822 | // Private member functions |
---|
| 823 | // ==================================================================================================================== |
---|
| 824 | |
---|
| 825 | Bool confirmPara(Bool bflag, const char* message); |
---|
| 826 | |
---|
| 827 | Void TAppEncCfg::xCheckParameter() |
---|
| 828 | { |
---|
| 829 | bool check_failed = false; /* abort if there is a fatal configuration problem */ |
---|
| 830 | #define xConfirmPara(a,b) check_failed |= confirmPara(a,b) |
---|
| 831 | // check range of parameters |
---|
| 832 | xConfirmPara( m_uiInputBitDepth < 8, "InputBitDepth must be at least 8" ); |
---|
| 833 | xConfirmPara( m_iFrameRate <= 0, "Frame rate must be more than 1" ); |
---|
[56] | 834 | xConfirmPara( m_iFrameToBeEncoded <= 0, "Total Number Of Frames encoded must be more than 0" ); |
---|
| 835 | xConfirmPara( m_iGOPSize < 1 , "GOP Size must be greater or equal to 1" ); |
---|
| 836 | xConfirmPara( m_iGOPSize > 1 && m_iGOPSize % 2, "GOP Size must be a multiple of 2, if GOP Size is greater than 1" ); |
---|
| 837 | xConfirmPara( (m_iIntraPeriod > 0 && m_iIntraPeriod < m_iGOPSize) || m_iIntraPeriod == 0, "Intra period must be more than GOP size, or -1 , not 0" ); |
---|
[2] | 838 | xConfirmPara( m_iDecodingRefreshType < 0 || m_iDecodingRefreshType > 2, "Decoding Refresh Type must be equal to 0, 1 or 2" ); |
---|
[56] | 839 | #if H0736_AVC_STYLE_QP_RANGE |
---|
| 840 | xConfirmPara( m_aiQP[0] < -6 * ((Int)m_uiInternalBitDepth - 8) || m_aiQP[0] > 51, "QP exceeds supported range (-QpBDOffsety to 51)" ); |
---|
| 841 | if ( m_aiQP.size() >= 2 ) |
---|
| 842 | { |
---|
| 843 | xConfirmPara( m_aiQP[1] < -6 * ((Int)m_uiInternalBitDepth - 8) || m_aiQP[1] > 51, "QP depth exceeds supported range (-QpBDOffsety to 51)" ); |
---|
| 844 | } |
---|
| 845 | #else |
---|
[2] | 846 | xConfirmPara( m_aiQP[0] < 0 || m_aiQP[0] > 51, "QP exceeds supported range (0 to 51)" ); |
---|
| 847 | if ( m_aiQP.size() >= 2 ) |
---|
| 848 | { |
---|
| 849 | xConfirmPara( m_aiQP[1] < 0 || m_aiQP[1] > 51, "QP Depth exceeds supported range (0 to 51)" ); |
---|
| 850 | } |
---|
[56] | 851 | #endif |
---|
[2] | 852 | xConfirmPara( m_iALFEncodePassReduction < 0 || m_iALFEncodePassReduction > 2, "ALFEncodePassReduction must be equal to 0, 1 or 2"); |
---|
[56] | 853 | #if LCU_SYNTAX_ALF |
---|
| 854 | xConfirmPara( m_iALFMaxNumberFilters < 1, "ALFMaxNumFilter should be larger than 1"); |
---|
| 855 | #else |
---|
| 856 | xConfirmPara( m_iALFMaxNumberFilters < 1 || m_iALFMaxNumberFilters > 16, "ALFMaxNumFilter exceeds supported range (1 to 16)"); |
---|
[2] | 857 | #endif |
---|
[56] | 858 | xConfirmPara( m_loopFilterBetaOffsetDiv2 < -13 || m_loopFilterBetaOffsetDiv2 > 13, "Loop Filter Beta Offset div. 2 exceeds supported range (-13 to 13)"); |
---|
| 859 | xConfirmPara( m_loopFilterTcOffsetDiv2 < -13 || m_loopFilterTcOffsetDiv2 > 13, "Loop Filter Tc Offset div. 2 exceeds supported range (-13 to 13)"); |
---|
[2] | 860 | xConfirmPara( m_iFastSearch < 0 || m_iFastSearch > 2, "Fast Search Mode is not supported value (0:Full search 1:Diamond 2:PMVFAST)" ); |
---|
| 861 | xConfirmPara( m_iSearchRange < 0 , "Search Range must be more than 0" ); |
---|
[197] | 862 | #if DV_V_RESTRICTION_B0037 |
---|
| 863 | xConfirmPara( m_iVerticalDisparitySearchRange <= 0 , "Vertical Disparity Search Range must be more than 0" ); |
---|
| 864 | #endif |
---|
[2] | 865 | xConfirmPara( m_bipredSearchRange < 0 , "Search Range must be more than 0" ); |
---|
| 866 | xConfirmPara( m_iMaxDeltaQP > 7, "Absolute Delta QP exceeds supported range (0 to 7)" ); |
---|
[56] | 867 | xConfirmPara( m_iMaxCuDQPDepth > m_uiMaxCUDepth - 1, "Absolute depth for a minimum CuDQP exceeds maximum coding unit depth" ); |
---|
| 868 | |
---|
| 869 | xConfirmPara( m_iChromaQpOffset < -12, "Min. Chroma Qp Offset is -12" ); |
---|
| 870 | xConfirmPara( m_iChromaQpOffset > 12, "Max. Chroma Qp Offset is 12" ); |
---|
| 871 | xConfirmPara( m_iChromaQpOffset2nd < -12, "Min. Chroma Qp Offset 2nd is -12" ); |
---|
| 872 | xConfirmPara( m_iChromaQpOffset2nd > 12, "Max. Chroma Qp Offset 2nd is 12" ); |
---|
| 873 | |
---|
| 874 | xConfirmPara( m_iQPAdaptationRange <= 0, "QP Adaptation Range must be more than 0" ); |
---|
| 875 | if (m_iDecodingRefreshType == 2) |
---|
| 876 | { |
---|
| 877 | xConfirmPara( m_iIntraPeriod > 0 && m_iIntraPeriod <= m_iGOPSize , "Intra period must be larger than GOP size for periodic IDR pictures"); |
---|
| 878 | } |
---|
[2] | 879 | xConfirmPara( (m_uiMaxCUWidth >> m_uiMaxCUDepth) < 4, "Minimum partition width size should be larger than or equal to 8"); |
---|
| 880 | xConfirmPara( (m_uiMaxCUHeight >> m_uiMaxCUDepth) < 4, "Minimum partition height size should be larger than or equal to 8"); |
---|
| 881 | xConfirmPara( m_uiMaxCUWidth < 16, "Maximum partition width size should be larger than or equal to 16"); |
---|
| 882 | xConfirmPara( m_uiMaxCUHeight < 16, "Maximum partition height size should be larger than or equal to 16"); |
---|
[56] | 883 | #if PIC_CROPPING |
---|
| 884 | xConfirmPara( (m_iSourceWidth % (m_uiMaxCUWidth >> (m_uiMaxCUDepth-1)))!=0, "Resulting coded frame width must be a multiple of the minimum CU size"); |
---|
| 885 | xConfirmPara( (m_iSourceHeight % (m_uiMaxCUHeight >> (m_uiMaxCUDepth-1)))!=0, "Resulting coded frame height must be a multiple of the minimum CU size"); |
---|
| 886 | #else |
---|
[2] | 887 | xConfirmPara( (m_iSourceWidth % (m_uiMaxCUWidth >> (m_uiMaxCUDepth-1)))!=0, "Frame width should be multiple of minimum CU size"); |
---|
| 888 | xConfirmPara( (m_iSourceHeight % (m_uiMaxCUHeight >> (m_uiMaxCUDepth-1)))!=0, "Frame height should be multiple of minimum CU size"); |
---|
[56] | 889 | #endif |
---|
| 890 | |
---|
[2] | 891 | xConfirmPara( m_uiQuadtreeTULog2MinSize < 2, "QuadtreeTULog2MinSize must be 2 or greater."); |
---|
| 892 | xConfirmPara( m_uiQuadtreeTULog2MinSize > 5, "QuadtreeTULog2MinSize must be 5 or smaller."); |
---|
| 893 | xConfirmPara( m_uiQuadtreeTULog2MaxSize < 2, "QuadtreeTULog2MaxSize must be 2 or greater."); |
---|
| 894 | xConfirmPara( m_uiQuadtreeTULog2MaxSize > 5, "QuadtreeTULog2MaxSize must be 5 or smaller."); |
---|
| 895 | xConfirmPara( m_uiQuadtreeTULog2MaxSize < m_uiQuadtreeTULog2MinSize, "QuadtreeTULog2MaxSize must be greater than or equal to m_uiQuadtreeTULog2MinSize."); |
---|
| 896 | xConfirmPara( (1<<m_uiQuadtreeTULog2MinSize)>(m_uiMaxCUWidth >>(m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than minimum CU size" ); // HS |
---|
| 897 | xConfirmPara( (1<<m_uiQuadtreeTULog2MinSize)>(m_uiMaxCUHeight>>(m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than minimum CU size" ); // HS |
---|
| 898 | xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) > ( m_uiMaxCUWidth >> m_uiMaxCUDepth ), "Minimum CU width must be greater than minimum transform size." ); |
---|
| 899 | xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) > ( m_uiMaxCUHeight >> m_uiMaxCUDepth ), "Minimum CU height must be greater than minimum transform size." ); |
---|
| 900 | xConfirmPara( m_uiQuadtreeTUMaxDepthInter < 1, "QuadtreeTUMaxDepthInter must be greater than or equal to 1" ); |
---|
| 901 | xConfirmPara( m_uiQuadtreeTUMaxDepthInter > m_uiQuadtreeTULog2MaxSize - m_uiQuadtreeTULog2MinSize + 1, "QuadtreeTUMaxDepthInter must be less than or equal to the difference between QuadtreeTULog2MaxSize and QuadtreeTULog2MinSize plus 1" ); |
---|
| 902 | xConfirmPara( m_uiQuadtreeTUMaxDepthIntra < 1, "QuadtreeTUMaxDepthIntra must be greater than or equal to 1" ); |
---|
| 903 | xConfirmPara( m_uiQuadtreeTUMaxDepthIntra > m_uiQuadtreeTULog2MaxSize - m_uiQuadtreeTULog2MinSize + 1, "QuadtreeTUMaxDepthIntra must be less than or equal to the difference between QuadtreeTULog2MaxSize and QuadtreeTULog2MinSize plus 1" ); |
---|
| 904 | |
---|
[56] | 905 | xConfirmPara( m_iNumberOfViews > MAX_VIEW_NUM , "NumberOfViews must be less than or equal to MAX_VIEW_NUM"); |
---|
[2] | 906 | xConfirmPara ( Int( m_pchInputFileList.size() ) < m_iNumberOfViews, "Number of InputFiles must be greater than or equal to NumberOfViews" ); |
---|
| 907 | xConfirmPara ( Int( m_pchReconFileList.size() ) < m_iNumberOfViews, "Number of ReconFiles must be greater than or equal to NumberOfViews" ); |
---|
| 908 | xConfirmPara ( m_iCodedCamParPrecision < 0 || m_iCodedCamParPrecision > 5, "CodedCamParsPrecision must be in range of 0..5" ); |
---|
[56] | 909 | #if HHI_INTERVIEW_SKIP |
---|
| 910 | xConfirmPara ( m_bInterViewSkip && !m_bUsingDepthMaps, "RenderingSkipMode requires CodeDepthMaps = 1" ); |
---|
| 911 | #endif |
---|
[5] | 912 | #if DEPTH_MAP_GENERATION |
---|
[21] | 913 | xConfirmPara ( m_uiPredDepthMapGeneration > 2, "PredDepthMapGen must be less than or equal to 2" ); |
---|
[2] | 914 | xConfirmPara ( m_uiPredDepthMapGeneration >= 2 && !m_bUsingDepthMaps, "PredDepthMapGen >= 2 requires CodeDepthMaps = 1" ); |
---|
[5] | 915 | #endif |
---|
| 916 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
[2] | 917 | xConfirmPara ( m_uiMultiviewMvPredMode > 7, "MultiviewMvPred must be less than or equal to 7" ); |
---|
| 918 | xConfirmPara ( m_uiMultiviewMvPredMode > 0 && m_uiPredDepthMapGeneration == 0 , "MultiviewMvPred > 0 requires PredDepthMapGen > 0" ); |
---|
| 919 | xConfirmPara ( m_uiMultiviewMvRegMode > 1, "MultiviewMvRegMode must be less than or equal to 1" ); |
---|
| 920 | xConfirmPara ( m_dMultiviewMvRegLambdaScale < 0.0, "MultiviewMvRegLambdaScale must not be negative" ); |
---|
| 921 | if( m_uiMultiviewMvRegMode ) |
---|
| 922 | { |
---|
| 923 | xConfirmPara ( Int( m_pchDepthInputFileList.size() ) < m_iNumberOfViews, "MultiviewMvRegMode > 0 requires the presence of input depth maps" ); |
---|
| 924 | } |
---|
[5] | 925 | #endif |
---|
| 926 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
[2] | 927 | xConfirmPara ( m_uiMultiviewResPredMode > 1, "MultiviewResPred must be less than or equal to 1" ); |
---|
| 928 | xConfirmPara ( m_uiMultiviewResPredMode > 0 && m_uiPredDepthMapGeneration == 0 , "MultiviewResPred > 0 requires PredDepthMapGen > 0" ); |
---|
[5] | 929 | #endif |
---|
[2] | 930 | if( m_bUsingDepthMaps ) |
---|
| 931 | { |
---|
| 932 | xConfirmPara ( Int( m_pchDepthInputFileList.size() ) < m_iNumberOfViews, "Number of DepthInputFiles must be greater than or equal to NumberOfViews" ); |
---|
| 933 | xConfirmPara ( Int( m_pchDepthReconFileList.size() ) < m_iNumberOfViews, "Number of DepthReconFiles must be greater than or equal to NumberOfViews" ); |
---|
| 934 | |
---|
[5] | 935 | #if HHI_VSO |
---|
[2] | 936 | if( m_bUseVSO ) |
---|
| 937 | { |
---|
| 938 | xConfirmPara( m_pchCameraParameterFile == 0 , "CameraParameterFile must be given"); |
---|
| 939 | xConfirmPara( m_pchVSOConfig == 0 , "VSO Setup string must be given"); |
---|
| 940 | xConfirmPara( m_pchBaseViewCameraNumbers == 0 , "BaseViewCameraNumbers must be given" ); |
---|
| 941 | xConfirmPara( m_iNumberOfViews != m_cCameraData.getBaseViewNumbers().size(), "Number of Views in BaseViewCameraNumbers must be equal to NumberOfViews" ); |
---|
[58] | 942 | xConfirmPara( m_uiVSOMode > 4 , "VSO Mode must be less than 5"); |
---|
[2] | 943 | } |
---|
[5] | 944 | #endif |
---|
[2] | 945 | } |
---|
[56] | 946 | #if ADAPTIVE_QP_SELECTION |
---|
| 947 | #if H0736_AVC_STYLE_QP_RANGE |
---|
| 948 | xConfirmPara( m_bUseAdaptQpSelect == true && m_aiQP[0] < 0, "AdaptiveQpSelection must be disabled when QP < 0."); |
---|
| 949 | xConfirmPara( m_bUseAdaptQpSelect == true && m_aiQP[1] < 0, "AdaptiveQpSelection must be disabled when QP < 0."); |
---|
| 950 | xConfirmPara( m_bUseAdaptQpSelect == true && (m_iChromaQpOffset !=0 || m_iChromaQpOffset2nd != 0 ), "AdaptiveQpSelection must be disabled when ChromaQpOffset is not equal to 0."); |
---|
| 951 | #endif |
---|
| 952 | #endif |
---|
[2] | 953 | |
---|
[56] | 954 | if( m_usePCM) |
---|
| 955 | { |
---|
| 956 | xConfirmPara( m_uiPCMLog2MinSize < 3, "PCMLog2MinSize must be 3 or greater."); |
---|
| 957 | xConfirmPara( m_uiPCMLog2MinSize > 5, "PCMLog2MinSize must be 5 or smaller."); |
---|
| 958 | xConfirmPara( m_pcmLog2MaxSize > 5, "PCMLog2MaxSize must be 5 or smaller."); |
---|
| 959 | xConfirmPara( m_pcmLog2MaxSize < m_uiPCMLog2MinSize, "PCMLog2MaxSize must be equal to or greater than m_uiPCMLog2MinSize."); |
---|
| 960 | } |
---|
| 961 | |
---|
| 962 | #if FIXED_NUMBER_OF_TILES_SLICE_MODE |
---|
| 963 | xConfirmPara( m_iSliceMode < 0 || m_iSliceMode > 3, "SliceMode exceeds supported range (0 to 3)" ); |
---|
[2] | 964 | #endif |
---|
[56] | 965 | if (m_iSliceMode!=0) |
---|
| 966 | { |
---|
| 967 | xConfirmPara( m_iSliceArgument < 1 , "SliceArgument should be larger than or equal to 1" ); |
---|
| 968 | } |
---|
| 969 | #if FIXED_NUMBER_OF_TILES_SLICE_MODE |
---|
| 970 | if (m_iSliceMode==3) |
---|
| 971 | { |
---|
| 972 | xConfirmPara( m_iSliceGranularity > 0 , "When SliceMode == 3 is chosen, the SliceGranularity must be 0" ); |
---|
| 973 | } |
---|
[2] | 974 | #endif |
---|
[56] | 975 | xConfirmPara( m_iEntropySliceMode < 0 || m_iEntropySliceMode > 2, "EntropySliceMode exceeds supported range (0 to 2)" ); |
---|
| 976 | if (m_iEntropySliceMode!=0) |
---|
| 977 | { |
---|
| 978 | xConfirmPara( m_iEntropySliceArgument < 1 , "EntropySliceArgument should be larger than or equal to 1" ); |
---|
| 979 | } |
---|
| 980 | xConfirmPara( m_iSliceGranularity >= m_uiMaxCUDepth, "SliceGranularity must be smaller than maximum cu depth"); |
---|
| 981 | xConfirmPara( m_iSliceGranularity <0 || m_iSliceGranularity > 3, "SliceGranularity exceeds supported range (0 to 3)" ); |
---|
| 982 | xConfirmPara( m_iSliceGranularity > m_iMaxCuDQPDepth, "SliceGranularity must be smaller smaller than or equal to maximum dqp depth" ); |
---|
[2] | 983 | |
---|
[56] | 984 | #if NO_COMBINED_PARALLEL |
---|
| 985 | bool tileFlag = (m_iNumColumnsMinus1 > 0 || m_iNumRowsMinus1 > 0 ); |
---|
| 986 | xConfirmPara( tileFlag && m_iEntropySliceMode, "Tile and Entropy Slice can not be applied together"); |
---|
| 987 | xConfirmPara( tileFlag && m_iWaveFrontSynchro, "Tile and Wavefront can not be applied together"); |
---|
| 988 | xConfirmPara( m_iWaveFrontSynchro && m_iEntropySliceMode, "Wavefront and Entropy Slice can not be applied together"); |
---|
| 989 | #endif |
---|
| 990 | |
---|
[2] | 991 | // max CU width and height should be power of 2 |
---|
| 992 | UInt ui = m_uiMaxCUWidth; |
---|
| 993 | while(ui) |
---|
| 994 | { |
---|
| 995 | ui >>= 1; |
---|
| 996 | if( (ui & 1) == 1) |
---|
| 997 | xConfirmPara( ui != 1 , "Width should be 2^n"); |
---|
| 998 | } |
---|
| 999 | ui = m_uiMaxCUHeight; |
---|
| 1000 | while(ui) |
---|
| 1001 | { |
---|
| 1002 | ui >>= 1; |
---|
| 1003 | if( (ui & 1) == 1) |
---|
| 1004 | xConfirmPara( ui != 1 , "Height should be 2^n"); |
---|
| 1005 | } |
---|
[56] | 1006 | |
---|
| 1007 | xConfirmPara( m_iWaveFrontSynchro < 0, "WaveFrontSynchro cannot be negative" ); |
---|
| 1008 | xConfirmPara( m_iWaveFrontFlush < 0, "WaveFrontFlush cannot be negative" ); |
---|
| 1009 | xConfirmPara( m_iWaveFrontSubstreams <= 0, "WaveFrontSubstreams must be positive" ); |
---|
| 1010 | xConfirmPara( m_iWaveFrontSubstreams > 1 && !m_iWaveFrontSynchro, "Must have WaveFrontSynchro > 0 in order to have WaveFrontSubstreams > 1" ); |
---|
[2] | 1011 | |
---|
[56] | 1012 | #undef xConfirmPara |
---|
| 1013 | if (check_failed) |
---|
[2] | 1014 | { |
---|
[56] | 1015 | exit(EXIT_FAILURE); |
---|
[2] | 1016 | } |
---|
| 1017 | |
---|
[56] | 1018 | xCheckCodingStructureMvc(); |
---|
| 1019 | } |
---|
| 1020 | |
---|
| 1021 | Void TAppEncCfg::xCheckCodingStructureMvc() |
---|
| 1022 | { |
---|
| 1023 | bool check_failed = false; /* abort if there is a fatal configuration problem */ |
---|
| 1024 | #define xConfirmPara(a,b) check_failed |= confirmPara(a,b) |
---|
| 1025 | |
---|
| 1026 | // validate that POC of same frame is identical across multiple views |
---|
| 1027 | Bool bErrorMvePoc = false; |
---|
| 1028 | if( m_iNumberOfViews > 1 ) |
---|
| 1029 | { |
---|
| 1030 | for( Int k = 1; k < m_iNumberOfViews; k++ ) |
---|
| 1031 | { |
---|
| 1032 | for( Int i = 0; i < MAX_GOP; i++ ) |
---|
| 1033 | { |
---|
| 1034 | if( m_GOPListsMvc[k][i].m_POC != m_GOPListsMvc[0][i].m_POC ) |
---|
| 1035 | { |
---|
| 1036 | printf( "\nError: Frame%d_v%d POC %d is not identical to Frame%d POC\n", i, k, m_GOPListsMvc[k][i].m_POC, i ); |
---|
| 1037 | bErrorMvePoc = true; |
---|
| 1038 | } |
---|
| 1039 | } |
---|
| 1040 | } |
---|
| 1041 | } |
---|
| 1042 | xConfirmPara( bErrorMvePoc, "Invalid inter-view POC structure given" ); |
---|
| 1043 | |
---|
| 1044 | // validate that baseview has no inter-view refs |
---|
| 1045 | Bool bErrorIvpBase = false; |
---|
| 1046 | for( Int i = 0; i < MAX_GOP; i++ ) |
---|
| 1047 | { |
---|
| 1048 | if( m_GOPListsMvc[0][i].m_numInterViewRefPics != 0 ) |
---|
| 1049 | { |
---|
| 1050 | printf( "\nError: Frame%d inter_view refs not available in view 0\n", i ); |
---|
| 1051 | bErrorIvpBase = true; |
---|
| 1052 | } |
---|
| 1053 | } |
---|
| 1054 | xConfirmPara( bErrorIvpBase, "Inter-view refs not possible in base view" ); |
---|
| 1055 | |
---|
| 1056 | // validate inter-view refs |
---|
| 1057 | Bool bErrorIvpEnhV = false; |
---|
| 1058 | if( m_iNumberOfViews > 1 ) |
---|
| 1059 | { |
---|
| 1060 | for( Int k = 1; k < m_iNumberOfViews; k++ ) |
---|
| 1061 | { |
---|
| 1062 | for( Int i = 0; i < MAX_GOP+1; i++ ) |
---|
| 1063 | { |
---|
| 1064 | for( Int j = 0; j < m_GOPListsMvc[k][i].m_numInterViewRefPics; j++ ) |
---|
| 1065 | { |
---|
| 1066 | Int iAbsViewId = m_GOPListsMvc[k][i].m_interViewRefs[j] + k; |
---|
| 1067 | if( iAbsViewId < 0 || iAbsViewId >= k ) |
---|
| 1068 | { |
---|
| 1069 | printf( "\nError: inter-view ref pic %d is not available for Frame%d_v%d\n", m_GOPListsMvc[k][i].m_interViewRefs[j], i, k ); |
---|
| 1070 | bErrorIvpEnhV = true; |
---|
| 1071 | } |
---|
| 1072 | if( m_GOPListsMvc[k][i].m_interViewRefPosL0[j] < 0 || m_GOPListsMvc[k][i].m_interViewRefPosL0[j] > m_GOPListsMvc[k][i].m_numRefPicsActive ) |
---|
| 1073 | { |
---|
| 1074 | printf( "\nError: inter-view ref pos %d on L0 is not available for Frame%d_v%d\n", m_GOPListsMvc[k][i].m_interViewRefPosL0[j], i, k ); |
---|
| 1075 | bErrorIvpEnhV = true; |
---|
| 1076 | } |
---|
| 1077 | if( m_GOPListsMvc[k][i].m_interViewRefPosL1[j] < 0 || m_GOPListsMvc[k][i].m_interViewRefPosL1[j] > m_GOPListsMvc[k][i].m_numRefPicsActive ) |
---|
| 1078 | { |
---|
| 1079 | printf( "\nError: inter-view ref pos %d on L1 is not available for Frame%d_v%d\n", m_GOPListsMvc[k][i].m_interViewRefPosL1[j], i, k ); |
---|
| 1080 | bErrorIvpEnhV = true; |
---|
| 1081 | } |
---|
| 1082 | } |
---|
| 1083 | if( i == MAX_GOP ) // inter-view refs at I pic position in base view |
---|
| 1084 | { |
---|
| 1085 | if( m_GOPListsMvc[k][MAX_GOP].m_sliceType != 'B' && m_GOPListsMvc[k][MAX_GOP].m_sliceType != 'P' && m_GOPListsMvc[k][MAX_GOP].m_sliceType != 'I' ) |
---|
| 1086 | { |
---|
| 1087 | printf( "\nError: slice type of FrameI_v%d must be equal to B or P or I\n", k ); |
---|
| 1088 | bErrorIvpEnhV = true; |
---|
| 1089 | } |
---|
| 1090 | |
---|
| 1091 | if( m_GOPListsMvc[k][MAX_GOP].m_POC != 0 ) |
---|
| 1092 | { |
---|
| 1093 | printf( "\nError: POC %d not possible for FrameI_v%d, must be 0\n", m_GOPListsMvc[k][MAX_GOP].m_POC, k ); |
---|
| 1094 | bErrorIvpEnhV = true; |
---|
| 1095 | } |
---|
| 1096 | |
---|
| 1097 | if( m_GOPListsMvc[k][MAX_GOP].m_temporalId != 0 ) |
---|
| 1098 | { |
---|
| 1099 | printf( "\nWarning: Temporal id of FrameI_v%d must be 0 (cp. I-frame in base view)\n", k ); |
---|
| 1100 | m_GOPListsMvc[k][MAX_GOP].m_temporalId = 0; |
---|
| 1101 | } |
---|
| 1102 | |
---|
| 1103 | if( !(m_GOPListsMvc[k][MAX_GOP].m_refPic) ) |
---|
| 1104 | { |
---|
| 1105 | printf( "\nWarning: FrameI_v%d must be ref pic (cp. I-frame in base view)\n", k ); |
---|
| 1106 | m_GOPListsMvc[k][MAX_GOP].m_refPic = true; |
---|
| 1107 | } |
---|
| 1108 | |
---|
| 1109 | if( m_GOPListsMvc[k][MAX_GOP].m_numRefPics != 0 ) |
---|
| 1110 | { |
---|
| 1111 | printf( "\nWarning: temporal references not possible for FrameI_v%d\n", k ); |
---|
| 1112 | for( Int j = 0; j < m_GOPListsMvc[k][MAX_GOP].m_numRefPics; j++ ) |
---|
| 1113 | { |
---|
| 1114 | m_GOPListsMvc[k][MAX_GOP].m_referencePics[j] = 0; |
---|
| 1115 | } |
---|
| 1116 | m_GOPListsMvc[k][MAX_GOP].m_numRefPics = 0; |
---|
| 1117 | } |
---|
| 1118 | |
---|
| 1119 | if( m_GOPListsMvc[k][MAX_GOP].m_interRPSPrediction ) |
---|
| 1120 | { |
---|
| 1121 | printf( "\nError: inter RPS prediction not possible for FrameI_v%d, must be 0\n", k ); |
---|
| 1122 | bErrorIvpEnhV = true; |
---|
| 1123 | } |
---|
| 1124 | |
---|
| 1125 | if( m_GOPListsMvc[k][MAX_GOP].m_sliceType == 'I' && m_GOPListsMvc[k][MAX_GOP].m_numInterViewRefPics != 0 ) |
---|
| 1126 | { |
---|
| 1127 | printf( "\nError: inter-view prediction not possible for FrameI_v%d with slice type I, #IV_ref_pics must be 0\n", k ); |
---|
| 1128 | bErrorIvpEnhV = true; |
---|
| 1129 | } |
---|
| 1130 | |
---|
| 1131 | if( m_GOPListsMvc[k][MAX_GOP].m_numRefPicsActive > m_GOPListsMvc[k][MAX_GOP].m_numInterViewRefPics ) |
---|
| 1132 | { |
---|
| 1133 | m_GOPListsMvc[k][MAX_GOP].m_numRefPicsActive = m_GOPListsMvc[k][MAX_GOP].m_numInterViewRefPics; |
---|
| 1134 | } |
---|
| 1135 | |
---|
| 1136 | if( m_GOPListsMvc[k][MAX_GOP].m_sliceType == 'P' ) |
---|
| 1137 | { |
---|
| 1138 | if( m_GOPListsMvc[k][MAX_GOP].m_numInterViewRefPics < 1 ) |
---|
| 1139 | { |
---|
| 1140 | printf( "\nError: #IV_ref_pics must be at least one for FrameI_v%d with slice type P\n", k ); |
---|
| 1141 | bErrorIvpEnhV = true; |
---|
| 1142 | } |
---|
| 1143 | else |
---|
| 1144 | { |
---|
| 1145 | for( Int j = 0; j < m_GOPListsMvc[k][MAX_GOP].m_numInterViewRefPics; j++ ) |
---|
| 1146 | { |
---|
| 1147 | if( m_GOPListsMvc[k][MAX_GOP].m_interViewRefPosL1[j] != 0 ) |
---|
| 1148 | { |
---|
| 1149 | printf( "\nError: inter-view ref pos %d on L1 not possible for FrameI_v%d with slice type P\n", m_GOPListsMvc[k][MAX_GOP].m_interViewRefPosL1[j], k ); |
---|
| 1150 | bErrorIvpEnhV = true; |
---|
| 1151 | } |
---|
| 1152 | } |
---|
| 1153 | } |
---|
| 1154 | } |
---|
| 1155 | |
---|
| 1156 | if( m_GOPListsMvc[k][MAX_GOP].m_sliceType == 'B' && m_GOPListsMvc[k][MAX_GOP].m_numInterViewRefPics < 1 ) |
---|
| 1157 | { |
---|
| 1158 | printf( "\nError: #IV_ref_pics must be at least one for FrameI_v%d with slice type B\n", k ); |
---|
| 1159 | bErrorIvpEnhV = true; |
---|
| 1160 | } |
---|
| 1161 | } |
---|
| 1162 | } |
---|
| 1163 | } |
---|
| 1164 | } |
---|
| 1165 | xConfirmPara( bErrorIvpEnhV, "Invalid inter-view coding structure for enhancement views given" ); |
---|
| 1166 | |
---|
| 1167 | // validate temporal coding structure |
---|
| 1168 | if( !bErrorMvePoc && !bErrorIvpBase && !bErrorIvpEnhV ) |
---|
| 1169 | { |
---|
| 1170 | for( Int viewId = 0; viewId < m_iNumberOfViews; viewId++ ) |
---|
| 1171 | { |
---|
| 1172 | Bool verifiedGOP = false; |
---|
| 1173 | Bool errorGOP = false; |
---|
| 1174 | Int checkGOP = 1; |
---|
| 1175 | Int numRefs = 1; |
---|
| 1176 | Int refList[MAX_NUM_REF_PICS+1]; |
---|
| 1177 | refList[0] = 0; |
---|
| 1178 | Bool isOK[MAX_GOP]; |
---|
| 1179 | for( Int i = 0; i < MAX_GOP; i++ ) { isOK[i] = false; } |
---|
| 1180 | Int numOK = 0; |
---|
| 1181 | #if !H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER |
---|
| 1182 | Int numReorderFramesRequired=0; |
---|
| 1183 | m_maxNumberOfReferencePictures=0; |
---|
| 1184 | Int lastDisp = -1; |
---|
| 1185 | #endif |
---|
| 1186 | m_extraRPSs[viewId] = 0; |
---|
| 1187 | //start looping through frames in coding order until we can verify that the GOP structure is correct. |
---|
| 1188 | while( !verifiedGOP && !errorGOP ) |
---|
| 1189 | { |
---|
| 1190 | Int curGOP = (checkGOP-1)%m_iGOPSize; |
---|
| 1191 | Int curPOC = ((checkGOP-1)/m_iGOPSize)*m_iGOPSize + m_GOPListsMvc[viewId][curGOP].m_POC; |
---|
| 1192 | if( m_GOPListsMvc[viewId][curGOP].m_POC < 0 ) |
---|
| 1193 | { |
---|
| 1194 | printf( "\nError: found fewer Reference Picture Sets than GOPSize for view %d\n", viewId ); |
---|
| 1195 | errorGOP = true; |
---|
| 1196 | } |
---|
| 1197 | else |
---|
| 1198 | { |
---|
| 1199 | //check that all reference pictures are available, or have a POC < 0 meaning they might be available in the next GOP. |
---|
| 1200 | Bool beforeI = false; |
---|
| 1201 | for( Int i = 0; i < m_GOPListsMvc[viewId][curGOP].m_numRefPics; i++ ) |
---|
| 1202 | { |
---|
| 1203 | Int absPOC = curPOC + m_GOPListsMvc[viewId][curGOP].m_referencePics[i]; |
---|
| 1204 | if( absPOC < 0 ) |
---|
| 1205 | { |
---|
| 1206 | beforeI = true; |
---|
| 1207 | } |
---|
| 1208 | else |
---|
| 1209 | { |
---|
| 1210 | Bool found = false; |
---|
| 1211 | for( Int j = 0; j < numRefs; j++ ) |
---|
| 1212 | { |
---|
| 1213 | if( refList[j] == absPOC ) |
---|
| 1214 | { |
---|
| 1215 | found = true; |
---|
| 1216 | for( Int k = 0; k < m_iGOPSize; k++ ) |
---|
| 1217 | { |
---|
| 1218 | if( absPOC%m_iGOPSize == m_GOPListsMvc[viewId][k].m_POC%m_iGOPSize ) |
---|
| 1219 | { |
---|
| 1220 | m_GOPListsMvc[viewId][curGOP].m_usedByCurrPic[i] = (m_GOPListsMvc[viewId][k].m_temporalId <= m_GOPListsMvc[viewId][curGOP].m_temporalId); |
---|
| 1221 | } |
---|
| 1222 | } |
---|
| 1223 | } |
---|
| 1224 | } |
---|
| 1225 | if( !found ) |
---|
| 1226 | { |
---|
| 1227 | printf("\nError: ref pic %d is not available for GOP frame %d of view %d\n", m_GOPListsMvc[viewId][curGOP].m_referencePics[i], curGOP+1, viewId ); |
---|
| 1228 | errorGOP = true; |
---|
| 1229 | } |
---|
| 1230 | } |
---|
| 1231 | } |
---|
| 1232 | if( !beforeI && !errorGOP ) |
---|
| 1233 | { |
---|
| 1234 | //all ref frames were present |
---|
| 1235 | if( !isOK[curGOP] ) |
---|
| 1236 | { |
---|
| 1237 | numOK++; |
---|
| 1238 | isOK[curGOP] = true; |
---|
| 1239 | if( numOK == m_iGOPSize ) |
---|
| 1240 | { |
---|
| 1241 | verifiedGOP = true; |
---|
| 1242 | } |
---|
| 1243 | } |
---|
| 1244 | } |
---|
| 1245 | else |
---|
| 1246 | { |
---|
| 1247 | //create a new GOPEntry for this frame containing all the reference pictures that were available (POC > 0) |
---|
| 1248 | m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]] = m_GOPListsMvc[viewId][curGOP]; |
---|
| 1249 | Int newRefs = 0; |
---|
| 1250 | for( Int i = 0; i < m_GOPListsMvc[viewId][curGOP].m_numRefPics; i++ ) |
---|
| 1251 | { |
---|
| 1252 | Int absPOC = curPOC + m_GOPListsMvc[viewId][curGOP].m_referencePics[i]; |
---|
| 1253 | if( absPOC >= 0 ) |
---|
| 1254 | { |
---|
| 1255 | m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_referencePics[newRefs] = m_GOPListsMvc[viewId][curGOP].m_referencePics[i]; |
---|
| 1256 | m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_usedByCurrPic[newRefs] = m_GOPListsMvc[viewId][curGOP].m_usedByCurrPic[i]; |
---|
| 1257 | newRefs++; |
---|
| 1258 | } |
---|
| 1259 | } |
---|
| 1260 | Int numPrefRefs = m_GOPListsMvc[viewId][curGOP].m_numRefPicsActive; |
---|
| 1261 | |
---|
| 1262 | for( Int offset = -1; offset > -checkGOP; offset-- ) |
---|
| 1263 | { |
---|
| 1264 | //step backwards in coding order and include any extra available pictures we might find useful to replace the ones with POC < 0. |
---|
| 1265 | Int offGOP = (checkGOP - 1 + offset)%m_iGOPSize; |
---|
| 1266 | Int offPOC = ((checkGOP - 1 + offset)/m_iGOPSize) * m_iGOPSize + m_GOPListsMvc[viewId][offGOP].m_POC; |
---|
| 1267 | if( offPOC >= 0 && m_GOPListsMvc[viewId][offGOP].m_refPic && m_GOPListsMvc[viewId][offGOP].m_temporalId <= m_GOPListsMvc[viewId][curGOP].m_temporalId ) |
---|
| 1268 | { |
---|
| 1269 | Bool newRef = false; |
---|
| 1270 | for( Int i = 0; i < numRefs; i++ ) |
---|
| 1271 | { |
---|
| 1272 | if( refList[i] == offPOC ) |
---|
| 1273 | { |
---|
| 1274 | newRef = true; |
---|
| 1275 | } |
---|
| 1276 | } |
---|
| 1277 | for( Int i = 0; i < newRefs; i++ ) |
---|
| 1278 | { |
---|
| 1279 | if( m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_referencePics[i] == (offPOC - curPOC) ) |
---|
| 1280 | { |
---|
| 1281 | newRef = false; |
---|
| 1282 | } |
---|
| 1283 | } |
---|
| 1284 | if( newRef ) |
---|
| 1285 | { |
---|
| 1286 | Int insertPoint = newRefs; |
---|
| 1287 | //this picture can be added, find appropriate place in list and insert it. |
---|
| 1288 | for( Int j = 0; j < newRefs; j++ ) |
---|
| 1289 | { |
---|
| 1290 | if( m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_referencePics[j] < (offPOC - curPOC) || |
---|
| 1291 | m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_referencePics[j] > 0 ) |
---|
| 1292 | { |
---|
| 1293 | insertPoint = j; |
---|
| 1294 | break; |
---|
| 1295 | } |
---|
| 1296 | } |
---|
| 1297 | Int prev = offPOC - curPOC; |
---|
| 1298 | Int prevUsed = (m_GOPListsMvc[viewId][offGOP].m_temporalId <= m_GOPListsMvc[viewId][curGOP].m_temporalId); |
---|
| 1299 | for( Int j = insertPoint; j < newRefs+1; j++ ) |
---|
| 1300 | { |
---|
| 1301 | Int newPrev = m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_referencePics[j]; |
---|
| 1302 | Int newUsed = m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_usedByCurrPic[j]; |
---|
| 1303 | m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_referencePics[j] = prev; |
---|
| 1304 | m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_usedByCurrPic[j] = prevUsed; |
---|
| 1305 | prevUsed = newUsed; |
---|
| 1306 | prev = newPrev; |
---|
| 1307 | } |
---|
| 1308 | newRefs++; |
---|
| 1309 | } |
---|
| 1310 | } |
---|
| 1311 | if( newRefs >= numPrefRefs ) |
---|
| 1312 | { |
---|
| 1313 | break; |
---|
| 1314 | } |
---|
| 1315 | } |
---|
| 1316 | m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_numRefPics = newRefs; |
---|
| 1317 | m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_POC = curPOC; |
---|
| 1318 | if( m_extraRPSs[viewId] == 0 ) |
---|
| 1319 | { |
---|
| 1320 | m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_interRPSPrediction = 0; |
---|
| 1321 | m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_numRefIdc = 0; |
---|
| 1322 | } |
---|
| 1323 | else |
---|
| 1324 | { |
---|
| 1325 | Int rIdx = m_iGOPSize + m_extraRPSs[viewId] - 1; |
---|
| 1326 | Int refPOC = m_GOPListsMvc[viewId][rIdx].m_POC; |
---|
| 1327 | Int refPics = m_GOPListsMvc[viewId][rIdx].m_numRefPics; |
---|
| 1328 | Int newIdc = 0; |
---|
| 1329 | for( Int i = 0; i <= refPics; i++ ) |
---|
| 1330 | { |
---|
| 1331 | Int deltaPOC = ((i != refPics)? m_GOPListsMvc[viewId][rIdx].m_referencePics[i] : 0); // check if the reference abs POC is >= 0 |
---|
| 1332 | Int absPOCref = refPOC + deltaPOC; |
---|
| 1333 | Int refIdc = 0; |
---|
| 1334 | for( Int j = 0; j < m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_numRefPics; j++ ) |
---|
| 1335 | { |
---|
| 1336 | if( (absPOCref - curPOC) == m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_referencePics[j] ) |
---|
| 1337 | { |
---|
| 1338 | if( m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_usedByCurrPic[j] ) |
---|
| 1339 | { |
---|
| 1340 | refIdc = 1; |
---|
| 1341 | } |
---|
| 1342 | else |
---|
| 1343 | { |
---|
| 1344 | refIdc = 2; |
---|
| 1345 | } |
---|
| 1346 | } |
---|
| 1347 | } |
---|
| 1348 | m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_refIdc[newIdc] = refIdc; |
---|
| 1349 | newIdc++; |
---|
| 1350 | } |
---|
| 1351 | m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_interRPSPrediction = 1; |
---|
| 1352 | m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_numRefIdc = newIdc; |
---|
| 1353 | m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_deltaRPS = refPOC - m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_POC; |
---|
| 1354 | m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_deltaRIdxMinus1 = 0; |
---|
| 1355 | } |
---|
| 1356 | curGOP = m_iGOPSize + m_extraRPSs[viewId]; |
---|
| 1357 | m_extraRPSs[viewId]++; |
---|
| 1358 | } |
---|
| 1359 | numRefs = 0; |
---|
| 1360 | for( Int i = 0; i < m_GOPListsMvc[viewId][curGOP].m_numRefPics; i++ ) |
---|
| 1361 | { |
---|
| 1362 | Int absPOC = curPOC + m_GOPListsMvc[viewId][curGOP].m_referencePics[i]; |
---|
| 1363 | if( absPOC >= 0 ) |
---|
| 1364 | { |
---|
| 1365 | refList[numRefs] = absPOC; |
---|
| 1366 | numRefs++; |
---|
| 1367 | } |
---|
| 1368 | } |
---|
| 1369 | #if !H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER |
---|
| 1370 | if(m_maxNumberOfReferencePictures<numRefs) |
---|
| 1371 | { |
---|
| 1372 | m_maxNumberOfReferencePictures=numRefs; |
---|
| 1373 | } |
---|
| 1374 | #endif |
---|
| 1375 | refList[numRefs] = curPOC; |
---|
| 1376 | numRefs++; |
---|
| 1377 | #if !H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER |
---|
| 1378 | Int nonDisplayed=0; |
---|
| 1379 | for(Int i=0; i<numRefs; i++) |
---|
| 1380 | { |
---|
| 1381 | if(refList[i]==lastDisp+1) |
---|
| 1382 | { |
---|
| 1383 | lastDisp=refList[i]; |
---|
| 1384 | i=0; |
---|
| 1385 | } |
---|
| 1386 | } |
---|
| 1387 | for(Int i=0; i<numRefs; i++) |
---|
| 1388 | { |
---|
| 1389 | if(refList[i]>lastDisp) |
---|
| 1390 | { |
---|
| 1391 | nonDisplayed++; |
---|
| 1392 | } |
---|
| 1393 | } |
---|
| 1394 | if(nonDisplayed>numReorderFramesRequired) |
---|
| 1395 | { |
---|
| 1396 | numReorderFramesRequired=nonDisplayed; |
---|
| 1397 | } |
---|
| 1398 | #endif |
---|
| 1399 | } |
---|
| 1400 | checkGOP++; |
---|
| 1401 | } |
---|
| 1402 | #if !H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER |
---|
| 1403 | if (m_numReorderFrames == -1) |
---|
| 1404 | { |
---|
| 1405 | m_numReorderFrames = numReorderFramesRequired; |
---|
| 1406 | } |
---|
| 1407 | #endif |
---|
| 1408 | xConfirmPara( errorGOP, "Invalid GOP structure given" ); |
---|
| 1409 | #if H0566_TLA |
---|
| 1410 | m_maxTempLayer[viewId] = 1; |
---|
| 1411 | #endif |
---|
| 1412 | for( Int i = 0; i < m_iGOPSize; i++ ) |
---|
| 1413 | { |
---|
| 1414 | #if H0566_TLA |
---|
| 1415 | if( m_GOPListsMvc[viewId][i].m_temporalId >= m_maxTempLayer[viewId] ) |
---|
| 1416 | { |
---|
| 1417 | m_maxTempLayer[viewId] = m_GOPListsMvc[viewId][i].m_temporalId + 1; |
---|
| 1418 | } |
---|
| 1419 | #endif |
---|
| 1420 | xConfirmPara( m_GOPListsMvc[viewId][i].m_sliceType != 'B' && m_GOPListsMvc[viewId][i].m_sliceType != 'P', "Slice type must be equal to B or P" ); |
---|
| 1421 | } |
---|
| 1422 | |
---|
| 1423 | #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER |
---|
| 1424 | for( Int i = 0; i < MAX_TLAYER; i++ ) |
---|
| 1425 | { |
---|
| 1426 | m_numReorderPics[viewId][i] = 0; |
---|
| 1427 | m_maxDecPicBuffering[viewId][i] = 0; |
---|
| 1428 | } |
---|
| 1429 | for( Int i = 0; i < m_iGOPSize; i++ ) |
---|
| 1430 | { |
---|
| 1431 | if( m_GOPListsMvc[viewId][i].m_numRefPics > m_maxDecPicBuffering[viewId][m_GOPListsMvc[viewId][i].m_temporalId] ) |
---|
| 1432 | { |
---|
| 1433 | m_maxDecPicBuffering[viewId][m_GOPListsMvc[viewId][i].m_temporalId] = m_GOPListsMvc[viewId][i].m_numRefPics; |
---|
| 1434 | } |
---|
| 1435 | Int highestDecodingNumberWithLowerPOC = 0; |
---|
| 1436 | for( Int j = 0; j < m_iGOPSize; j++ ) |
---|
| 1437 | { |
---|
| 1438 | if( m_GOPListsMvc[viewId][j].m_POC <= m_GOPListsMvc[viewId][i].m_POC ) |
---|
| 1439 | { |
---|
| 1440 | highestDecodingNumberWithLowerPOC = j; |
---|
| 1441 | } |
---|
| 1442 | } |
---|
| 1443 | Int numReorder = 0; |
---|
| 1444 | for( Int j = 0; j < highestDecodingNumberWithLowerPOC; j++ ) |
---|
| 1445 | { |
---|
| 1446 | if( m_GOPListsMvc[viewId][j].m_temporalId <= m_GOPListsMvc[viewId][i].m_temporalId && |
---|
| 1447 | m_GOPListsMvc[viewId][j].m_POC > m_GOPListsMvc[viewId][i].m_POC ) |
---|
| 1448 | { |
---|
| 1449 | numReorder++; |
---|
| 1450 | } |
---|
| 1451 | } |
---|
| 1452 | if( numReorder > m_numReorderPics[viewId][m_GOPListsMvc[viewId][i].m_temporalId] ) |
---|
| 1453 | { |
---|
| 1454 | m_numReorderPics[viewId][m_GOPListsMvc[viewId][i].m_temporalId] = numReorder; |
---|
| 1455 | } |
---|
| 1456 | } |
---|
| 1457 | for( Int i = 0; i < MAX_TLAYER-1; i++ ) |
---|
| 1458 | { |
---|
| 1459 | // a lower layer can not have higher value of m_numReorderPics than a higher layer |
---|
| 1460 | if( m_numReorderPics[viewId][i+1] < m_numReorderPics[viewId][i] ) |
---|
| 1461 | { |
---|
| 1462 | m_numReorderPics[viewId][i+1] = m_numReorderPics[viewId][i]; |
---|
| 1463 | } |
---|
| 1464 | // the value of num_reorder_pics[ i ] shall be in the range of 0 to max_dec_pic_buffering[ i ], inclusive |
---|
| 1465 | if( m_numReorderPics[viewId][i] > m_maxDecPicBuffering[viewId][i] ) |
---|
| 1466 | { |
---|
| 1467 | m_maxDecPicBuffering[viewId][i] = m_numReorderPics[viewId][i]; |
---|
| 1468 | } |
---|
| 1469 | // a lower layer can not have higher value of m_uiMaxDecPicBuffering than a higher layer |
---|
| 1470 | if( m_maxDecPicBuffering[viewId][i+1] < m_maxDecPicBuffering[viewId][i] ) |
---|
| 1471 | { |
---|
| 1472 | m_maxDecPicBuffering[viewId][i+1] = m_maxDecPicBuffering[viewId][i]; |
---|
| 1473 | } |
---|
| 1474 | } |
---|
| 1475 | // the value of num_reorder_pics[ i ] shall be in the range of 0 to max_dec_pic_buffering[ i ], inclusive |
---|
| 1476 | if( m_numReorderPics[viewId][MAX_TLAYER-1] > m_maxDecPicBuffering[viewId][MAX_TLAYER-1] ) |
---|
| 1477 | { |
---|
| 1478 | m_maxDecPicBuffering[viewId][MAX_TLAYER-1] = m_numReorderPics[viewId][MAX_TLAYER-1]; |
---|
| 1479 | } |
---|
| 1480 | #endif |
---|
| 1481 | |
---|
| 1482 | #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER |
---|
| 1483 | xConfirmPara( m_bUseLComb == false && m_numReorderPics[viewId][MAX_TLAYER-1] != 0, "ListCombination can only be 0 in low delay coding (more precisely when L0 and L1 are identical)" ); // Note however this is not the full necessary condition as ref_pic_list_combination_flag can only be 0 if L0 == L1. |
---|
| 1484 | #else |
---|
| 1485 | xConfirmPara( m_bUseLComb==false && m_numReorderFrames!=0, "ListCombination can only be 0 in low delay coding (more precisely when L0 and L1 are identical)" ); // Note however this is not the full necessary condition as ref_pic_list_combination_flag can only be 0 if L0 == L1. |
---|
| 1486 | xConfirmPara( m_numReorderFrames < numReorderFramesRequired, "For the used GOP the encoder requires more pictures for reordering than specified in MaxNumberOfReorderPictures" ); |
---|
| 1487 | #endif |
---|
| 1488 | } |
---|
| 1489 | } |
---|
[2] | 1490 | #undef xConfirmPara |
---|
[56] | 1491 | if( check_failed ) |
---|
[2] | 1492 | { |
---|
| 1493 | exit(EXIT_FAILURE); |
---|
| 1494 | } |
---|
| 1495 | } |
---|
| 1496 | |
---|
| 1497 | template <class T> |
---|
| 1498 | Void |
---|
| 1499 | TAppEncCfg::xCleanUpVector( std::vector<T>& rcVec, const T& rcInvalid ) |
---|
| 1500 | { |
---|
| 1501 | Int iFirstInv = (Int)rcVec.size(); |
---|
| 1502 | for( Int iIdx = 0; iIdx < (Int)rcVec.size(); iIdx++ ) |
---|
| 1503 | { |
---|
| 1504 | if( rcVec[ iIdx ] == rcInvalid ) |
---|
| 1505 | { |
---|
| 1506 | iFirstInv = iIdx; |
---|
| 1507 | break; |
---|
| 1508 | } |
---|
| 1509 | } |
---|
| 1510 | while( (Int)rcVec.size() > iFirstInv ) |
---|
| 1511 | { |
---|
| 1512 | rcVec.pop_back(); |
---|
| 1513 | } |
---|
| 1514 | } |
---|
| 1515 | |
---|
| 1516 | Void |
---|
| 1517 | TAppEncCfg::xCleanUpVectors() |
---|
| 1518 | { |
---|
| 1519 | xCleanUpVector( m_pchInputFileList, (char*)0 ); |
---|
| 1520 | xCleanUpVector( m_pchDepthInputFileList, (char*)0 ); |
---|
| 1521 | xCleanUpVector( m_pchReconFileList, (char*)0 ); |
---|
| 1522 | xCleanUpVector( m_pchDepthReconFileList, (char*)0 ); |
---|
| 1523 | } |
---|
| 1524 | |
---|
| 1525 | /** \todo use of global variables should be removed later |
---|
| 1526 | */ |
---|
| 1527 | Void TAppEncCfg::xSetGlobal() |
---|
| 1528 | { |
---|
| 1529 | // set max CU width & height |
---|
| 1530 | g_uiMaxCUWidth = m_uiMaxCUWidth; |
---|
| 1531 | g_uiMaxCUHeight = m_uiMaxCUHeight; |
---|
[56] | 1532 | |
---|
[2] | 1533 | // compute actual CU depth with respect to config depth and max transform size |
---|
| 1534 | g_uiAddCUDepth = 0; |
---|
| 1535 | while( (m_uiMaxCUWidth>>m_uiMaxCUDepth) > ( 1 << ( m_uiQuadtreeTULog2MinSize + g_uiAddCUDepth ) ) ) g_uiAddCUDepth++; |
---|
[56] | 1536 | |
---|
[2] | 1537 | m_uiMaxCUDepth += g_uiAddCUDepth; |
---|
| 1538 | g_uiAddCUDepth++; |
---|
| 1539 | g_uiMaxCUDepth = m_uiMaxCUDepth; |
---|
[56] | 1540 | |
---|
[2] | 1541 | // set internal bit-depth and constants |
---|
| 1542 | #if FULL_NBIT |
---|
| 1543 | g_uiBitDepth = m_uiInternalBitDepth; |
---|
| 1544 | g_uiBitIncrement = 0; |
---|
| 1545 | #else |
---|
| 1546 | g_uiBitDepth = 8; |
---|
| 1547 | g_uiBitIncrement = m_uiInternalBitDepth - g_uiBitDepth; |
---|
| 1548 | #endif |
---|
[56] | 1549 | |
---|
[17] | 1550 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
[56] | 1551 | g_iDeltaDCsQuantOffset = g_uiBitIncrement - 2; |
---|
[17] | 1552 | #endif |
---|
[2] | 1553 | |
---|
| 1554 | g_uiBASE_MAX = ((1<<(g_uiBitDepth))-1); |
---|
[56] | 1555 | |
---|
[2] | 1556 | #if IBDI_NOCLIP_RANGE |
---|
| 1557 | g_uiIBDI_MAX = g_uiBASE_MAX << g_uiBitIncrement; |
---|
| 1558 | #else |
---|
| 1559 | g_uiIBDI_MAX = ((1<<(g_uiBitDepth+g_uiBitIncrement))-1); |
---|
| 1560 | #endif |
---|
[56] | 1561 | |
---|
[2] | 1562 | if (m_uiOutputBitDepth == 0) |
---|
| 1563 | { |
---|
| 1564 | m_uiOutputBitDepth = m_uiInternalBitDepth; |
---|
| 1565 | } |
---|
[56] | 1566 | |
---|
| 1567 | g_uiPCMBitDepthLuma = m_uiPCMBitDepthLuma = ((m_bPCMInputBitDepthFlag)? m_uiInputBitDepth : m_uiInternalBitDepth); |
---|
| 1568 | g_uiPCMBitDepthChroma = ((m_bPCMInputBitDepthFlag)? m_uiInputBitDepth : m_uiInternalBitDepth); |
---|
[2] | 1569 | } |
---|
| 1570 | |
---|
| 1571 | Void TAppEncCfg::xPrintParameter() |
---|
| 1572 | { |
---|
| 1573 | printf("\n"); |
---|
[56] | 1574 | for( Int iCounter = 0; iCounter< m_iNumberOfViews; iCounter++) |
---|
[2] | 1575 | { |
---|
[56] | 1576 | printf("Texture Input File %i : %s\n", iCounter, m_pchInputFileList[iCounter]); |
---|
[2] | 1577 | } |
---|
[56] | 1578 | if( m_bUsingDepthMaps ) |
---|
[2] | 1579 | { |
---|
[56] | 1580 | for( Int iCounter = 0; iCounter < m_iNumberOfViews; iCounter++) |
---|
| 1581 | { |
---|
| 1582 | printf("Depth Input File %i : %s\n", iCounter, m_pchDepthInputFileList[iCounter]); |
---|
| 1583 | } |
---|
[2] | 1584 | } |
---|
[56] | 1585 | printf("Bitstream File : %s\n", m_pchBitstreamFile ); |
---|
| 1586 | for( Int iCounter = 0; iCounter< m_iNumberOfViews; iCounter++) |
---|
[2] | 1587 | { |
---|
[56] | 1588 | printf("Texture Reconstruction File %i : %s\n", iCounter, m_pchReconFileList[iCounter]); |
---|
[2] | 1589 | } |
---|
[56] | 1590 | if( m_bUsingDepthMaps ) |
---|
[2] | 1591 | { |
---|
[56] | 1592 | for( Int iCounter = 0; iCounter< m_iNumberOfViews; iCounter++) |
---|
| 1593 | { |
---|
| 1594 | printf("Depth Reconstruction File %i : %s\n", iCounter, m_pchDepthReconFileList[iCounter]); |
---|
| 1595 | } |
---|
[2] | 1596 | } |
---|
[56] | 1597 | #if PIC_CROPPING |
---|
| 1598 | printf("Real Format : %dx%d %dHz\n", m_iSourceWidth - m_cropLeft - m_cropRight, m_iSourceHeight - m_cropTop - m_cropBottom, m_iFrameRate ); |
---|
| 1599 | #else |
---|
[2] | 1600 | printf("Real Format : %dx%d %dHz\n", m_iSourceWidth - m_aiPad[0], m_iSourceHeight-m_aiPad[1], m_iFrameRate ); |
---|
[56] | 1601 | #endif |
---|
[2] | 1602 | printf("Internal Format : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate ); |
---|
| 1603 | printf("Frame index : %u - %d (%d frames)\n", m_FrameSkip, m_FrameSkip+m_iFrameToBeEncoded-1, m_iFrameToBeEncoded ); |
---|
| 1604 | printf("CU size / depth : %d / %d\n", m_uiMaxCUWidth, m_uiMaxCUDepth ); |
---|
| 1605 | printf("RQT trans. size (min / max) : %d / %d\n", 1 << m_uiQuadtreeTULog2MinSize, 1 << m_uiQuadtreeTULog2MaxSize ); |
---|
| 1606 | printf("Max RQT depth inter : %d\n", m_uiQuadtreeTUMaxDepthInter); |
---|
| 1607 | printf("Max RQT depth intra : %d\n", m_uiQuadtreeTUMaxDepthIntra); |
---|
[56] | 1608 | printf("Min PCM size : %d\n", 1 << m_uiPCMLog2MinSize); |
---|
[2] | 1609 | printf("Motion search range : %d\n", m_iSearchRange ); |
---|
[197] | 1610 | #if DV_V_RESTRICTION_B0037 |
---|
| 1611 | printf("Disp search range restriction: %d\n", m_bUseDisparitySearchRangeRestriction ); |
---|
| 1612 | printf("Vertical disp search range : %d\n", m_iVerticalDisparitySearchRange ); |
---|
| 1613 | #endif |
---|
[56] | 1614 | printf("Intra period : %d\n", m_iIntraPeriod ); |
---|
[2] | 1615 | printf("Decoding refresh type : %d\n", m_iDecodingRefreshType ); |
---|
[56] | 1616 | printf("QP Texture : %5.2f\n", m_adQP[0] ); |
---|
| 1617 | if( m_bUsingDepthMaps ) |
---|
| 1618 | { |
---|
| 1619 | printf("QP Depth : %5.2f\n", m_adQP[ m_adQP.size() < 2 ? 0 : 1] ); |
---|
| 1620 | } |
---|
| 1621 | printf("Max dQP signaling depth : %d\n", m_iMaxCuDQPDepth); |
---|
| 1622 | |
---|
| 1623 | printf("Chroma Qp Offset : %d\n", m_iChromaQpOffset ); |
---|
| 1624 | printf("Chroma Qp Offset 2nd : %d\n", m_iChromaQpOffset2nd); |
---|
| 1625 | |
---|
| 1626 | printf("QP adaptation : %d (range=%d)\n", m_bUseAdaptiveQP, (m_bUseAdaptiveQP ? m_iQPAdaptationRange : 0) ); |
---|
[2] | 1627 | printf("GOP size : %d\n", m_iGOPSize ); |
---|
| 1628 | printf("Internal bit depth : %d\n", m_uiInternalBitDepth ); |
---|
[56] | 1629 | printf("PCM sample bit depth : %d\n", m_uiPCMBitDepthLuma ); |
---|
| 1630 | if((m_uiMaxCUWidth >> m_uiMaxCUDepth) == 4) |
---|
[2] | 1631 | { |
---|
[56] | 1632 | printf("DisableInter4x4 : %d\n", m_bDisInter4x4); |
---|
[2] | 1633 | } |
---|
| 1634 | |
---|
[56] | 1635 | printf("Loop Filter Disabled : %d %d\n", m_abLoopFilterDisable[0] ? 1 : 0, m_abLoopFilterDisable[1] ? 1 : 0 ); |
---|
[2] | 1636 | printf("Coded Camera Param. Precision: %d\n", m_iCodedCamParPrecision); |
---|
| 1637 | |
---|
[5] | 1638 | #if HHI_VSO |
---|
[2] | 1639 | printf("Force use of Lambda Scale : %d\n", m_bForceLambdaScaleVSO ); |
---|
| 1640 | |
---|
| 1641 | if ( m_bUseVSO ) |
---|
| 1642 | { |
---|
| 1643 | printf("VSO Lambda Scale : %5.2f\n", m_dLambdaScaleVSO ); |
---|
| 1644 | printf("VSO Mode : %d\n", m_uiVSOMode ); |
---|
| 1645 | printf("VSO Config : %s\n", m_pchVSOConfig ); |
---|
[5] | 1646 | #if HHI_VSO_DIST_INT |
---|
[2] | 1647 | printf("VSO Negative Distortion : %d\n", m_bAllowNegDist ? 1 : 0); |
---|
| 1648 | #endif |
---|
[189] | 1649 | #if HHI_VSO_LS_TABLE_M23714 |
---|
[100] | 1650 | printf("VSO LS Table : %d\n", m_bVSOLSTable ? 1 : 0); |
---|
| 1651 | #endif |
---|
| 1652 | #if SAIT_VSO_EST_A0033 |
---|
| 1653 | printf("VSO Estimated VSD : %d\n", m_bUseEstimatedVSD ? 1 : 0); |
---|
| 1654 | #endif |
---|
| 1655 | #if LGE_VSO_EARLY_SKIP_A0093 |
---|
| 1656 | printf("VSO Early Skip : %d\n", m_bVSOEarlySkip ? 1 : 0); |
---|
| 1657 | #endif |
---|
| 1658 | |
---|
[2] | 1659 | } |
---|
[5] | 1660 | #endif |
---|
[56] | 1661 | #if HHI_INTERVIEW_SKIP |
---|
| 1662 | printf("InterView Skip: : %d\n", m_bInterViewSkip ? 1:0 ); |
---|
| 1663 | printf("InterView Skip Lambda Scale : %f\n", m_dInterViewSkipLambdaScale ); |
---|
| 1664 | #endif |
---|
[2] | 1665 | |
---|
| 1666 | printf("\n"); |
---|
[56] | 1667 | |
---|
| 1668 | printf("TOOL CFG General: "); |
---|
| 1669 | #if LCU_SYNTAX_ALF |
---|
| 1670 | printf("ALFMNF:%d ", m_iALFMaxNumberFilters); |
---|
| 1671 | printf("ALFInSlice:%d ", m_bALFParamInSlice); |
---|
| 1672 | printf("ALFPicEnc:%d ", m_bALFPicBasedEncode); |
---|
| 1673 | #endif |
---|
[2] | 1674 | printf("IBD:%d ", !!g_uiBitIncrement); |
---|
| 1675 | printf("HAD:%d ", m_bUseHADME ); |
---|
| 1676 | printf("SRD:%d ", m_bUseSBACRD ); |
---|
| 1677 | printf("SQP:%d ", m_uiDeltaQpRD ); |
---|
| 1678 | printf("ASR:%d ", m_bUseASR ); |
---|
[56] | 1679 | #if !PIC_CROPPING |
---|
[2] | 1680 | printf("PAD:%d ", m_bUsePAD ); |
---|
[56] | 1681 | #endif |
---|
[2] | 1682 | printf("LComb:%d ", m_bUseLComb ); |
---|
| 1683 | printf("LCMod:%d ", m_bLCMod ); |
---|
[56] | 1684 | printf("FEN:%d ", m_bUseFastEnc ); |
---|
| 1685 | printf("ECU:%d ", m_bUseEarlyCU ); |
---|
| 1686 | #if FAST_DECISION_FOR_MRG_RD_COST |
---|
| 1687 | printf("FDM:%d ", m_useFastDecisionForMerge ); |
---|
[2] | 1688 | #endif |
---|
[56] | 1689 | printf("CFM:%d ", m_bUseCbfFastMode ); |
---|
[2] | 1690 | printf("RQT:%d ", 1 ); |
---|
[56] | 1691 | printf("LMC:%d ", m_bUseLMChroma ); |
---|
| 1692 | printf("Slice: G=%d M=%d ", m_iSliceGranularity, m_iSliceMode); |
---|
[2] | 1693 | if (m_iSliceMode!=0) |
---|
| 1694 | { |
---|
[56] | 1695 | printf("A=%d ", m_iSliceArgument); |
---|
[2] | 1696 | } |
---|
[56] | 1697 | printf("EntropySlice: M=%d ",m_iEntropySliceMode); |
---|
[2] | 1698 | if (m_iEntropySliceMode!=0) |
---|
| 1699 | { |
---|
[56] | 1700 | printf("A=%d ", m_iEntropySliceArgument); |
---|
[2] | 1701 | } |
---|
| 1702 | printf("CIP:%d ", m_bUseConstrainedIntraPred); |
---|
[56] | 1703 | #if BURST_IPCM |
---|
| 1704 | printf("PCM:%d ", (m_usePCM && (1<<m_uiPCMLog2MinSize) <= m_uiMaxCUWidth)? 1 : 0); |
---|
| 1705 | #else |
---|
| 1706 | printf("PCM:%d ", ((1<<m_uiPCMLog2MinSize) <= m_uiMaxCUWidth)? 1 : 0); |
---|
[2] | 1707 | #endif |
---|
[56] | 1708 | #if SAO_UNIT_INTERLEAVING |
---|
| 1709 | printf("SAOInterleaving:%d ", (m_saoInterleavingFlag)?(1):(0)); |
---|
[2] | 1710 | #endif |
---|
[56] | 1711 | #if LOSSLESS_CODING |
---|
| 1712 | printf("LosslessCuEnabled:%d ", (m_useLossless)? 1:0 ); |
---|
| 1713 | #endif |
---|
| 1714 | printf("WPP:%d ", (Int)m_bUseWeightPred); |
---|
| 1715 | printf("WPB:%d ", m_uiBiPredIdc); |
---|
| 1716 | #if !REMOVE_TILE_DEPENDENCE |
---|
| 1717 | printf("TileBoundaryIndependence:%d ", m_iTileBoundaryIndependenceIdr ); |
---|
| 1718 | #endif |
---|
| 1719 | printf("TileLocationInSliceHdr:%d ", m_iTileLocationInSliceHeaderFlag); |
---|
| 1720 | printf("TileMarker:%d", m_iTileMarkerFlag); |
---|
| 1721 | if (m_iTileMarkerFlag) |
---|
| 1722 | { |
---|
| 1723 | printf("[%d] ", m_iMaxTileMarkerEntryPoints); |
---|
| 1724 | } |
---|
| 1725 | else |
---|
| 1726 | { |
---|
| 1727 | printf(" "); |
---|
| 1728 | } |
---|
| 1729 | printf(" WaveFrontSynchro:%d WaveFrontFlush:%d WaveFrontSubstreams:%d", |
---|
| 1730 | m_iWaveFrontSynchro, m_iWaveFrontFlush, m_iWaveFrontSubstreams); |
---|
| 1731 | printf(" ScalingList:%d ", m_useScalingListId ); |
---|
| 1732 | |
---|
[189] | 1733 | #if !TMVP_DEPTH_SWITCH |
---|
[56] | 1734 | printf("TMVP:%d ", m_enableTMVP ); |
---|
[189] | 1735 | #endif |
---|
[56] | 1736 | |
---|
| 1737 | #if ADAPTIVE_QP_SELECTION |
---|
| 1738 | printf("AQpS:%d", m_bUseAdaptQpSelect ); |
---|
| 1739 | #endif |
---|
| 1740 | |
---|
| 1741 | #if MULTIBITS_DATA_HIDING |
---|
| 1742 | printf(" SignBitHidingFlag:%d SignBitHidingThreshold:%d", m_signHideFlag, m_signHidingThreshold); |
---|
| 1743 | #endif |
---|
[2] | 1744 | printf("\n"); |
---|
| 1745 | printf("TOOL CFG VIDEO : "); |
---|
| 1746 | printf("ALF:%d ", (m_abUseALF [0] ? 1 : 0) ); |
---|
| 1747 | printf("SAO:%d ", (m_abUseSAO [0] ? 1 : 0)); |
---|
| 1748 | printf("RDQ:%d ", (m_abUseRDOQ[0] ? 1 : 0) ); |
---|
[189] | 1749 | #if TMVP_DEPTH_SWITCH |
---|
| 1750 | printf("TMVP:%d ", (m_enableTMVP[0] ? 1 : 0) ); |
---|
| 1751 | #endif |
---|
| 1752 | #if LGE_ILLUCOMP_B0045 |
---|
| 1753 | printf("IlluCompEnable: %d ", m_bUseIC); |
---|
| 1754 | #endif |
---|
| 1755 | |
---|
[2] | 1756 | printf("\n"); |
---|
| 1757 | |
---|
| 1758 | printf("TOOL CFG DEPTH : "); |
---|
| 1759 | printf("ALF:%d ", (m_abUseALF [1] ? 1 : 0)); |
---|
| 1760 | printf("SAO:%d ", (m_abUseSAO [1] ? 1 : 0)); |
---|
| 1761 | printf("RDQ:%d ", (m_abUseRDOQ[1] ? 1 : 0)); |
---|
[189] | 1762 | #if TMVP_DEPTH_SWITCH |
---|
| 1763 | printf("TMVP:%d ", (m_enableTMVP[1] ? 1 : 0) ); |
---|
| 1764 | #endif |
---|
[5] | 1765 | #if HHI_VSO |
---|
[2] | 1766 | printf("VSO:%d ", m_bUseVSO ); |
---|
[115] | 1767 | #endif |
---|
| 1768 | #if LGE_WVSO_A0119 |
---|
[120] | 1769 | printf("WVSO:%d ", m_bUseWVSO ); |
---|
[115] | 1770 | #endif |
---|
[189] | 1771 | #if OL_QTLIMIT_PREDCODING_B0068 |
---|
| 1772 | printf("QTLPC:%d ", m_bUseQTLPC); |
---|
[115] | 1773 | #endif |
---|
[5] | 1774 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
| 1775 | printf("DMM:%d ", m_bUseDMM ); |
---|
| 1776 | #endif |
---|
| 1777 | #if HHI_MPI |
---|
[2] | 1778 | printf("MVI:%d ", m_bUseMVI ? 1 : 0 ); |
---|
[5] | 1779 | #endif |
---|
[189] | 1780 | #if RWTH_SDC_DLT_B0036 |
---|
| 1781 | printf("SDC:%d ", m_bUseSDC ? 1 : 0 ); |
---|
| 1782 | printf("DLT:%d ", m_bUseDLT ? 1 : 0 ); |
---|
| 1783 | #endif |
---|
[115] | 1784 | #if LGE_WVSO_A0119 |
---|
[189] | 1785 | if ( m_bUseWVSO ) |
---|
| 1786 | printf("\nVSO : VSD : SAD weight = %d : %d : %d ", m_iVSOWeight, m_iVSDWeight, m_iDWeight ); |
---|
[115] | 1787 | #endif |
---|
[56] | 1788 | printf("\n\n"); |
---|
| 1789 | |
---|
[2] | 1790 | fflush(stdout); |
---|
| 1791 | } |
---|
| 1792 | |
---|
| 1793 | Void TAppEncCfg::xPrintUsage() |
---|
| 1794 | { |
---|
| 1795 | printf( " <name> = ALF - adaptive loop filter\n"); |
---|
| 1796 | printf( " IBD - bit-depth increasement\n"); |
---|
| 1797 | printf( " GPB - generalized B instead of P in low-delay mode\n"); |
---|
| 1798 | printf( " HAD - hadamard ME for fractional-pel\n"); |
---|
| 1799 | printf( " SRD - SBAC based RD estimation\n"); |
---|
| 1800 | printf( " RDQ - RDOQ\n"); |
---|
| 1801 | printf( " LDC - low-delay mode\n"); |
---|
| 1802 | printf( " NRF - non-reference frame marking in last layer\n"); |
---|
| 1803 | printf( " BQP - hier-P style QP assignment in low-delay mode\n"); |
---|
| 1804 | printf( " PAD - automatic source padding of multiple of 16\n"); |
---|
| 1805 | printf( " ASR - adaptive motion search range\n"); |
---|
[56] | 1806 | printf( " FEN - fast encoder setting\n"); |
---|
| 1807 | printf( " ECU - Early CU setting\n"); |
---|
| 1808 | printf( " CFM - Cbf fast mode setting\n"); |
---|
[2] | 1809 | printf( " LMC - intra chroma prediction based on luma\n"); |
---|
| 1810 | printf( "\n" ); |
---|
| 1811 | printf( " Example 1) TAppEncoder.exe -c test.cfg -q 32 -g 8 -f 9 -s 64 -h 4\n"); |
---|
| 1812 | printf(" -> QP 32, hierarchical-B GOP 8, 9 frames, 64x64-8x8 CU (~4x4 PU)\n\n"); |
---|
| 1813 | printf( " Example 2) TAppEncoder.exe -c test.cfg -q 32 -g 4 -f 9 -s 64 -h 4 -1 LDC\n"); |
---|
| 1814 | printf(" -> QP 32, hierarchical-P GOP 4, 9 frames, 64x64-8x8 CU (~4x4 PU)\n\n"); |
---|
| 1815 | } |
---|
| 1816 | |
---|
| 1817 | Bool confirmPara(Bool bflag, const char* message) |
---|
| 1818 | { |
---|
| 1819 | if (!bflag) |
---|
| 1820 | return false; |
---|
[56] | 1821 | |
---|
[2] | 1822 | printf("Error: %s\n",message); |
---|
| 1823 | return true; |
---|
| 1824 | } |
---|
| 1825 | |
---|
| 1826 | /* helper function */ |
---|
| 1827 | /* for handling "-1/-0 FOO" */ |
---|
| 1828 | void translateOldStyleCmdline(const char* value, po::Options& opts, const std::string& arg) |
---|
| 1829 | { |
---|
| 1830 | const char* argv[] = {arg.c_str(), value}; |
---|
| 1831 | /* replace some short names with their long name varients */ |
---|
| 1832 | if (arg == "LDC") |
---|
| 1833 | { |
---|
| 1834 | argv[0] = "LowDelayCoding"; |
---|
| 1835 | } |
---|
| 1836 | else if (arg == "RDQ") |
---|
| 1837 | { |
---|
| 1838 | argv[0] = "RDOQ"; |
---|
| 1839 | } |
---|
| 1840 | else if (arg == "HAD") |
---|
| 1841 | { |
---|
| 1842 | argv[0] = "HadamardME"; |
---|
| 1843 | } |
---|
| 1844 | else if (arg == "SRD") |
---|
| 1845 | { |
---|
| 1846 | argv[0] = "SBACRD"; |
---|
| 1847 | } |
---|
| 1848 | else if (arg == "IBD") |
---|
| 1849 | { |
---|
| 1850 | argv[0] = "BitIncrement"; |
---|
| 1851 | } |
---|
| 1852 | /* issue a warning for change in FEN behaviour */ |
---|
| 1853 | if (arg == "FEN") |
---|
| 1854 | { |
---|
| 1855 | /* xxx todo */ |
---|
| 1856 | } |
---|
| 1857 | po::storePair(opts, argv[0], argv[1]); |
---|
| 1858 | } |
---|
| 1859 | |
---|
| 1860 | void doOldStyleCmdlineOn(po::Options& opts, const std::string& arg) |
---|
| 1861 | { |
---|
| 1862 | if (arg == "IBD") |
---|
| 1863 | { |
---|
| 1864 | translateOldStyleCmdline("4", opts, arg); |
---|
| 1865 | return; |
---|
| 1866 | } |
---|
| 1867 | translateOldStyleCmdline("1", opts, arg); |
---|
| 1868 | } |
---|
| 1869 | |
---|
| 1870 | void doOldStyleCmdlineOff(po::Options& opts, const std::string& arg) |
---|
| 1871 | { |
---|
| 1872 | translateOldStyleCmdline("0", opts, arg); |
---|
| 1873 | } |
---|
| 1874 | |
---|
| 1875 | Void TAppEncCfg::xAppendToFileNameEnd( Char* pchInputFileName, const Char* pchStringToAppend, Char*& rpchOutputFileName) |
---|
| 1876 | { |
---|
| 1877 | size_t iInLength = strlen(pchInputFileName); |
---|
| 1878 | size_t iAppendLength = strlen(pchStringToAppend); |
---|
| 1879 | |
---|
| 1880 | rpchOutputFileName = (Char*) malloc(iInLength+iAppendLength+1); |
---|
| 1881 | Char* pCDot = strrchr(pchInputFileName,'.'); |
---|
| 1882 | pCDot = pCDot ? pCDot : pchInputFileName + iInLength; |
---|
| 1883 | size_t iCharsToDot = pCDot - pchInputFileName ; |
---|
| 1884 | size_t iCharsToEnd = iInLength - iCharsToDot; |
---|
| 1885 | strncpy(rpchOutputFileName , pchInputFileName , iCharsToDot ); |
---|
| 1886 | strncpy(rpchOutputFileName+ iCharsToDot , pchStringToAppend , iAppendLength); |
---|
| 1887 | strncpy(rpchOutputFileName+ iCharsToDot+iAppendLength , pchInputFileName+iCharsToDot, iCharsToEnd ); |
---|
| 1888 | rpchOutputFileName[iInLength+iAppendLength] = '\0'; |
---|
| 1889 | } |
---|
[56] | 1890 | |
---|
| 1891 | //! \} |
---|