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