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