| 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 |
|---|
| 4 | * granted under this license. |
|---|
| 5 | * |
|---|
| 6 | * Copyright (c) 2010-2012, ITU/ISO/IEC |
|---|
| 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. |
|---|
| 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may |
|---|
| 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 | */ |
|---|
| 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> |
|---|
| 42 | #include "TLibCommon/TComRom.h" |
|---|
| 43 | #include "TAppEncCfg.h" |
|---|
| 44 | #include "TAppCommon/program_options_lite.h" |
|---|
| 45 | #include "TLibEncoder/TEncRateCtrl.h" |
|---|
| 46 | #ifdef WIN32 |
|---|
| 47 | #define strdup _strdup |
|---|
| 48 | #endif |
|---|
| 49 | |
|---|
| 50 | using namespace std; |
|---|
| 51 | namespace po = df::program_options_lite; |
|---|
| 52 | |
|---|
| 53 | //! \ingroup TAppEncoder |
|---|
| 54 | //! \{ |
|---|
| 55 | |
|---|
| 56 | // ==================================================================================================================== |
|---|
| 57 | // Constructor / destructor / initialization / destroy |
|---|
| 58 | // ==================================================================================================================== |
|---|
| 59 | |
|---|
| 60 | TAppEncCfg::TAppEncCfg() |
|---|
| 61 | #if SVC_EXTENSION |
|---|
| 62 | : m_pchBitstreamFile() |
|---|
| 63 | , m_pchColumnWidth() |
|---|
| 64 | , m_pchRowHeight() |
|---|
| 65 | , m_scalingListFile() |
|---|
| 66 | #if REF_IDX_FRAMEWORK |
|---|
| 67 | , m_elRapSliceBEnabled(0) |
|---|
| 68 | #endif |
|---|
| 69 | #else |
|---|
| 70 | : m_pchInputFile() |
|---|
| 71 | , m_pchBitstreamFile() |
|---|
| 72 | , m_pchReconFile() |
|---|
| 73 | , m_pchdQPFile() |
|---|
| 74 | , m_pchColumnWidth() |
|---|
| 75 | , m_pchRowHeight() |
|---|
| 76 | , m_scalingListFile() |
|---|
| 77 | #endif |
|---|
| 78 | { |
|---|
| 79 | #if SVC_EXTENSION |
|---|
| 80 | for(UInt layer=0; layer<MAX_LAYERS; layer++) |
|---|
| 81 | { |
|---|
| 82 | m_acLayerCfg[layer].setAppEncCfg(this); |
|---|
| 83 | } |
|---|
| 84 | #else |
|---|
| 85 | m_aidQP = NULL; |
|---|
| 86 | #endif |
|---|
| 87 | } |
|---|
| 88 | |
|---|
| 89 | TAppEncCfg::~TAppEncCfg() |
|---|
| 90 | { |
|---|
| 91 | #if !SVC_EXTENSION |
|---|
| 92 | if ( m_aidQP ) |
|---|
| 93 | { |
|---|
| 94 | delete[] m_aidQP; |
|---|
| 95 | } |
|---|
| 96 | free(m_pchInputFile); |
|---|
| 97 | #endif |
|---|
| 98 | free(m_pchBitstreamFile); |
|---|
| 99 | #if !SVC_EXTENSION |
|---|
| 100 | free(m_pchReconFile); |
|---|
| 101 | free(m_pchdQPFile); |
|---|
| 102 | #endif |
|---|
| 103 | free(m_pchColumnWidth); |
|---|
| 104 | free(m_pchRowHeight); |
|---|
| 105 | free(m_scalingListFile); |
|---|
| 106 | } |
|---|
| 107 | |
|---|
| 108 | Void TAppEncCfg::create() |
|---|
| 109 | { |
|---|
| 110 | } |
|---|
| 111 | |
|---|
| 112 | Void TAppEncCfg::destroy() |
|---|
| 113 | { |
|---|
| 114 | } |
|---|
| 115 | |
|---|
| 116 | std::istringstream &operator>>(std::istringstream &in, GOPEntry &entry) //input |
|---|
| 117 | { |
|---|
| 118 | in>>entry.m_sliceType; |
|---|
| 119 | in>>entry.m_POC; |
|---|
| 120 | in>>entry.m_QPOffset; |
|---|
| 121 | in>>entry.m_QPFactor; |
|---|
| 122 | in>>entry.m_temporalId; |
|---|
| 123 | in>>entry.m_numRefPicsActive; |
|---|
| 124 | #if !TEMPORAL_LAYER_NON_REFERENCE |
|---|
| 125 | in>>entry.m_refPic; |
|---|
| 126 | #endif |
|---|
| 127 | in>>entry.m_numRefPics; |
|---|
| 128 | for ( Int i = 0; i < entry.m_numRefPics; i++ ) |
|---|
| 129 | { |
|---|
| 130 | in>>entry.m_referencePics[i]; |
|---|
| 131 | } |
|---|
| 132 | in>>entry.m_interRPSPrediction; |
|---|
| 133 | #if AUTO_INTER_RPS |
|---|
| 134 | if (entry.m_interRPSPrediction==1) |
|---|
| 135 | { |
|---|
| 136 | #if !J0234_INTER_RPS_SIMPL |
|---|
| 137 | in>>entry.m_deltaRIdxMinus1; |
|---|
| 138 | #endif |
|---|
| 139 | in>>entry.m_deltaRPS; |
|---|
| 140 | in>>entry.m_numRefIdc; |
|---|
| 141 | for ( Int i = 0; i < entry.m_numRefIdc; i++ ) |
|---|
| 142 | { |
|---|
| 143 | in>>entry.m_refIdc[i]; |
|---|
| 144 | } |
|---|
| 145 | } |
|---|
| 146 | else if (entry.m_interRPSPrediction==2) |
|---|
| 147 | { |
|---|
| 148 | #if !J0234_INTER_RPS_SIMPL |
|---|
| 149 | in>>entry.m_deltaRIdxMinus1; |
|---|
| 150 | #endif |
|---|
| 151 | in>>entry.m_deltaRPS; |
|---|
| 152 | } |
|---|
| 153 | #else |
|---|
| 154 | if (entry.m_interRPSPrediction) |
|---|
| 155 | { |
|---|
| 156 | #if !J0234_INTER_RPS_SIMPL |
|---|
| 157 | in>>entry.m_deltaRIdxMinus1; |
|---|
| 158 | #endif |
|---|
| 159 | in>>entry.m_deltaRPS; |
|---|
| 160 | in>>entry.m_numRefIdc; |
|---|
| 161 | for ( Int i = 0; i < entry.m_numRefIdc; i++ ) |
|---|
| 162 | { |
|---|
| 163 | in>>entry.m_refIdc[i]; |
|---|
| 164 | } |
|---|
| 165 | } |
|---|
| 166 | #endif |
|---|
| 167 | return in; |
|---|
| 168 | } |
|---|
| 169 | |
|---|
| 170 | #if SVC_EXTENSION |
|---|
| 171 | void TAppEncCfg::getDirFilename(string& filename, string& dir, const string path) |
|---|
| 172 | { |
|---|
| 173 | size_t pos = path.find_last_of("\\"); |
|---|
| 174 | if(pos != std::string::npos) |
|---|
| 175 | { |
|---|
| 176 | filename.assign(path.begin() + pos + 1, path.end()); |
|---|
| 177 | dir.assign(path.begin(), path.begin() + pos + 1); |
|---|
| 178 | } |
|---|
| 179 | else |
|---|
| 180 | { |
|---|
| 181 | pos = path.find_last_of("/"); |
|---|
| 182 | if(pos != std::string::npos) |
|---|
| 183 | { |
|---|
| 184 | filename.assign(path.begin() + pos + 1, path.end()); |
|---|
| 185 | dir.assign(path.begin(), path.begin() + pos + 1); |
|---|
| 186 | } |
|---|
| 187 | else |
|---|
| 188 | { |
|---|
| 189 | filename = path; |
|---|
| 190 | dir.assign(""); |
|---|
| 191 | } |
|---|
| 192 | } |
|---|
| 193 | } |
|---|
| 194 | #endif |
|---|
| 195 | |
|---|
| 196 | // ==================================================================================================================== |
|---|
| 197 | // Public member functions |
|---|
| 198 | // ==================================================================================================================== |
|---|
| 199 | |
|---|
| 200 | /** \param argc number of arguments |
|---|
| 201 | \param argv array of arguments |
|---|
| 202 | \retval true when success |
|---|
| 203 | */ |
|---|
| 204 | Bool TAppEncCfg::parseCfg( Int argc, Char* argv[] ) |
|---|
| 205 | { |
|---|
| 206 | bool do_help = false; |
|---|
| 207 | |
|---|
| 208 | #if SVC_EXTENSION |
|---|
| 209 | string cfg_LayerCfgFile [MAX_LAYERS]; |
|---|
| 210 | string cfg_BitstreamFile; |
|---|
| 211 | string* cfg_InputFile [MAX_LAYERS]; |
|---|
| 212 | string* cfg_ReconFile [MAX_LAYERS]; |
|---|
| 213 | Double* cfg_fQP [MAX_LAYERS]; |
|---|
| 214 | |
|---|
| 215 | Int* cfg_SourceWidth [MAX_LAYERS]; |
|---|
| 216 | Int* cfg_SourceHeight [MAX_LAYERS]; |
|---|
| 217 | Int* cfg_FrameRate [MAX_LAYERS]; |
|---|
| 218 | Int* cfg_IntraPeriod [MAX_LAYERS]; |
|---|
| 219 | Int* cfg_CroppingMode [MAX_LAYERS]; |
|---|
| 220 | for(UInt layer = 0; layer < MAX_LAYERS; layer++) |
|---|
| 221 | { |
|---|
| 222 | cfg_InputFile[layer] = &m_acLayerCfg[layer].m_cInputFile; |
|---|
| 223 | cfg_ReconFile[layer] = &m_acLayerCfg[layer].m_cReconFile; |
|---|
| 224 | cfg_fQP[layer] = &m_acLayerCfg[layer].m_fQP; |
|---|
| 225 | cfg_SourceWidth[layer] = &m_acLayerCfg[layer].m_iSourceWidth; |
|---|
| 226 | cfg_SourceHeight[layer] = &m_acLayerCfg[layer].m_iSourceHeight; |
|---|
| 227 | cfg_FrameRate[layer] = &m_acLayerCfg[layer].m_iFrameRate; |
|---|
| 228 | cfg_IntraPeriod[layer] = &m_acLayerCfg[layer].m_iIntraPeriod; |
|---|
| 229 | cfg_CroppingMode[layer] = &m_acLayerCfg[layer].m_croppingMode; |
|---|
| 230 | } |
|---|
| 231 | #else |
|---|
| 232 | string cfg_InputFile; |
|---|
| 233 | string cfg_BitstreamFile; |
|---|
| 234 | string cfg_ReconFile; |
|---|
| 235 | string cfg_dQPFile; |
|---|
| 236 | #endif |
|---|
| 237 | string cfg_ColumnWidth; |
|---|
| 238 | string cfg_RowHeight; |
|---|
| 239 | string cfg_ScalingListFile; |
|---|
| 240 | po::Options opts; |
|---|
| 241 | opts.addOptions() |
|---|
| 242 | ("help", do_help, false, "this help text") |
|---|
| 243 | ("c", po::parseConfigFile, "configuration file name") |
|---|
| 244 | |
|---|
| 245 | // File, I/O and source parameters |
|---|
| 246 | #if SVC_EXTENSION |
|---|
| 247 | ("InputFile%d,-i%d", cfg_InputFile, string(""), MAX_LAYERS, "original YUV input file name for layer %d") |
|---|
| 248 | ("ReconFile%d,-o%d", cfg_ReconFile, string(""), MAX_LAYERS, "reconstruction YUV input file name for layer %d") |
|---|
| 249 | ("LayerConfig%d,-lc%d", cfg_LayerCfgFile, string(""), MAX_LAYERS, "layer %d configuration file name") |
|---|
| 250 | ("BitstreamFile,b", cfg_BitstreamFile, string(""), "bitstream output file name") |
|---|
| 251 | ("SourceWidth%d,-wdt%d", cfg_SourceWidth, 0, MAX_LAYERS, "Source picture width for layer %d") |
|---|
| 252 | ("SourceHeight%d,-hgt%d", cfg_SourceHeight, 0, MAX_LAYERS, "Source picture height for layer %d") |
|---|
| 253 | ("FrameRate%d,-fr%d", cfg_FrameRate, 0, MAX_LAYERS, "Frame rate for layer %d") |
|---|
| 254 | ("LambdaModifier%d,-LM%d", m_adLambdaModifier, ( double )1.0, MAX_TLAYER, "Lambda modifier for temporal layer %d") |
|---|
| 255 | ("CroppingMode%d", cfg_CroppingMode,0, MAX_LAYERS, "Cropping mode (0: no cropping, 1:automatic padding, 2: padding, 3:cropping") |
|---|
| 256 | ("InputBitDepth", m_uiInputBitDepth, 8u, "bit-depth of input file") |
|---|
| 257 | ("BitDepth", m_uiInputBitDepth, 8u, "deprecated alias of InputBitDepth") |
|---|
| 258 | ("OutputBitDepth", m_uiOutputBitDepth, 0u, "bit-depth of output file") |
|---|
| 259 | ("InternalBitDepth", m_uiInternalBitDepth, 0u, "Internal bit-depth (BitDepth+BitIncrement)") |
|---|
| 260 | #if AVC_BASE |
|---|
| 261 | ("InputBLFile,-ibl", *cfg_InputFile[0], string(""), "Original BL rec YUV input file name") |
|---|
| 262 | #endif |
|---|
| 263 | #if REF_IDX_FRAMEWORK |
|---|
| 264 | ("EnableElRapB,-use-rap-b", m_elRapSliceBEnabled, 0, "Set ILP over base-layer I picture to B picture (default is P picture_") |
|---|
| 265 | #endif |
|---|
| 266 | #else |
|---|
| 267 | ("InputFile,i", cfg_InputFile, string(""), "Original YUV input file name") |
|---|
| 268 | ("BitstreamFile,b", cfg_BitstreamFile, string(""), "Bitstream output file name") |
|---|
| 269 | ("ReconFile,o", cfg_ReconFile, string(""), "Reconstructed YUV output file name") |
|---|
| 270 | ("SourceWidth,-wdt", m_iSourceWidth, 0, "Source picture width") |
|---|
| 271 | ("SourceHeight,-hgt", m_iSourceHeight, 0, "Source picture height") |
|---|
| 272 | ("InputBitDepth", m_uiInputBitDepth, 8u, "Bit-depth of input file") |
|---|
| 273 | ("BitDepth", m_uiInputBitDepth, 8u, "Deprecated alias of InputBitDepth") |
|---|
| 274 | ("OutputBitDepth", m_uiOutputBitDepth, 0u, "Bit-depth of output file") |
|---|
| 275 | ("InternalBitDepth", m_uiInternalBitDepth, 0u, "Internal bit-depth (BitDepth+BitIncrement)") |
|---|
| 276 | ("CroppingMode", m_croppingMode, 0, "Cropping mode (0: no cropping, 1:automatic padding, 2: padding, 3:cropping") |
|---|
| 277 | ("HorizontalPadding,-pdx",m_aiPad[0], 0, "Horizontal source padding for cropping mode 2") |
|---|
| 278 | ("VerticalPadding,-pdy", m_aiPad[1], 0, "Vertical source padding for cropping mode 2") |
|---|
| 279 | ("CropLeft", m_cropLeft, 0, "Left cropping for cropping mode 3") |
|---|
| 280 | ("CropRight", m_cropRight, 0, "Right cropping for cropping mode 3") |
|---|
| 281 | ("CropTop", m_cropTop, 0, "Top cropping for cropping mode 3") |
|---|
| 282 | ("CropBottom", m_cropBottom, 0, "Bottom cropping for cropping mode 3") |
|---|
| 283 | ("FrameRate,-fr", m_iFrameRate, 0, "Frame rate") |
|---|
| 284 | #endif |
|---|
| 285 | ("FrameSkip,-fs", m_FrameSkip, 0u, "Number of frames to skip at start of input YUV") |
|---|
| 286 | ("FramesToBeEncoded,f", m_iFrameToBeEncoded, 0, "Number of frames to be encoded (default=all)") |
|---|
| 287 | |
|---|
| 288 | #if SVC_EXTENSION |
|---|
| 289 | ("NumLayers", m_numLayers, 1, "Number of layers to code") |
|---|
| 290 | #endif |
|---|
| 291 | |
|---|
| 292 | // Unit definition parameters |
|---|
| 293 | ("MaxCUWidth", m_uiMaxCUWidth, 64u) |
|---|
| 294 | ("MaxCUHeight", m_uiMaxCUHeight, 64u) |
|---|
| 295 | // todo: remove defaults from MaxCUSize |
|---|
| 296 | ("MaxCUSize,s", m_uiMaxCUWidth, 64u, "Maximum CU size") |
|---|
| 297 | ("MaxCUSize,s", m_uiMaxCUHeight, 64u, "Maximum CU size") |
|---|
| 298 | ("MaxPartitionDepth,h", m_uiMaxCUDepth, 4u, "CU depth") |
|---|
| 299 | |
|---|
| 300 | ("QuadtreeTULog2MaxSize", m_uiQuadtreeTULog2MaxSize, 6u, "Maximum TU size in logarithm base 2") |
|---|
| 301 | ("QuadtreeTULog2MinSize", m_uiQuadtreeTULog2MinSize, 2u, "Minimum TU size in logarithm base 2") |
|---|
| 302 | |
|---|
| 303 | ("QuadtreeTUMaxDepthIntra", m_uiQuadtreeTUMaxDepthIntra, 1u, "Depth of TU tree for intra CUs") |
|---|
| 304 | ("QuadtreeTUMaxDepthInter", m_uiQuadtreeTUMaxDepthInter, 2u, "Depth of TU tree for inter CUs") |
|---|
| 305 | |
|---|
| 306 | // Coding structure paramters |
|---|
| 307 | #if SVC_EXTENSION |
|---|
| 308 | ("IntraPeriod%d,-ip%d", cfg_IntraPeriod, -1, MAX_LAYERS, "intra period in frames for layer %d, (-1: only first frame)") |
|---|
| 309 | #else |
|---|
| 310 | ("IntraPeriod,-ip", m_iIntraPeriod, -1, "Intra period in frames, (-1: only first frame)") |
|---|
| 311 | #endif |
|---|
| 312 | ("DecodingRefreshType,-dr", m_iDecodingRefreshType, 0, "Intra refresh type (0:none 1:CRA 2:IDR)") |
|---|
| 313 | ("GOPSize,g", m_iGOPSize, 1, "GOP size of temporal structure") |
|---|
| 314 | ("ListCombination,-lc", m_bUseLComb, true, "Combined reference list for uni-prediction estimation in B-slices") |
|---|
| 315 | // motion options |
|---|
| 316 | ("FastSearch", m_iFastSearch, 1, "0:Full search 1:Diamond 2:PMVFAST") |
|---|
| 317 | ("SearchRange,-sr", m_iSearchRange, 96, "Motion search range") |
|---|
| 318 | ("BipredSearchRange", m_bipredSearchRange, 4, "Motion search range for bipred refinement") |
|---|
| 319 | ("HadamardME", m_bUseHADME, true, "Hadamard ME for fractional-pel") |
|---|
| 320 | ("ASR", m_bUseASR, false, "Adaptive motion search range") |
|---|
| 321 | |
|---|
| 322 | #if !SVC_EXTENSION |
|---|
| 323 | // Mode decision parameters |
|---|
| 324 | ("LambdaModifier0,-LM0", m_adLambdaModifier[ 0 ], ( double )1.0, "Lambda modifier for temporal layer 0") |
|---|
| 325 | ("LambdaModifier1,-LM1", m_adLambdaModifier[ 1 ], ( double )1.0, "Lambda modifier for temporal layer 1") |
|---|
| 326 | ("LambdaModifier2,-LM2", m_adLambdaModifier[ 2 ], ( double )1.0, "Lambda modifier for temporal layer 2") |
|---|
| 327 | ("LambdaModifier3,-LM3", m_adLambdaModifier[ 3 ], ( double )1.0, "Lambda modifier for temporal layer 3") |
|---|
| 328 | ("LambdaModifier4,-LM4", m_adLambdaModifier[ 4 ], ( double )1.0, "Lambda modifier for temporal layer 4") |
|---|
| 329 | ("LambdaModifier5,-LM5", m_adLambdaModifier[ 5 ], ( double )1.0, "Lambda modifier for temporal layer 5") |
|---|
| 330 | ("LambdaModifier6,-LM6", m_adLambdaModifier[ 6 ], ( double )1.0, "Lambda modifier for temporal layer 6") |
|---|
| 331 | ("LambdaModifier7,-LM7", m_adLambdaModifier[ 7 ], ( double )1.0, "Lambda modifier for temporal layer 7") |
|---|
| 332 | #endif |
|---|
| 333 | |
|---|
| 334 | /* Quantization parameters */ |
|---|
| 335 | #if SVC_EXTENSION |
|---|
| 336 | ("QP%d,-q%d", cfg_fQP, 30.0, MAX_LAYERS, "Qp value for layer %d, if value is float, QP is switched once during encoding") |
|---|
| 337 | #else |
|---|
| 338 | ("QP,q", m_fQP, 30.0, "Qp value, if value is float, QP is switched once during encoding") |
|---|
| 339 | #endif |
|---|
| 340 | ("DeltaQpRD,-dqr",m_uiDeltaQpRD, 0u, "max dQp offset for slice") |
|---|
| 341 | ("MaxDeltaQP,d", m_iMaxDeltaQP, 0, "max dQp offset for block") |
|---|
| 342 | ("MaxCuDQPDepth,-dqd", m_iMaxCuDQPDepth, 0, "max depth for a minimum CuDQP") |
|---|
| 343 | |
|---|
| 344 | ("CbQpOffset,-cbqpofs", m_cbQpOffset, 0, "Chroma Cb QP Offset") |
|---|
| 345 | ("CrQpOffset,-crqpofs", m_crQpOffset, 0, "Chroma Cr QP Offset") |
|---|
| 346 | |
|---|
| 347 | #if ADAPTIVE_QP_SELECTION |
|---|
| 348 | ("AdaptiveQpSelection,-aqps", m_bUseAdaptQpSelect, false, "AdaptiveQpSelection") |
|---|
| 349 | #endif |
|---|
| 350 | |
|---|
| 351 | ("AdaptiveQP,-aq", m_bUseAdaptiveQP, false, "QP adaptation based on a psycho-visual model") |
|---|
| 352 | ("MaxQPAdaptationRange,-aqr", m_iQPAdaptationRange, 6, "QP adaptation range") |
|---|
| 353 | #if !SVC_EXTENSION |
|---|
| 354 | ("dQPFile,m", cfg_dQPFile, string(""), "dQP file name") |
|---|
| 355 | #endif |
|---|
| 356 | ("RDOQ", m_bUseRDOQ, true ) |
|---|
| 357 | |
|---|
| 358 | // Entropy coding parameters |
|---|
| 359 | ("SBACRD", m_bUseSBACRD, true, "SBAC based RD estimation") |
|---|
| 360 | |
|---|
| 361 | // Deblocking filter parameters |
|---|
| 362 | ("LoopFilterDisable", m_bLoopFilterDisable, false ) |
|---|
| 363 | ("LoopFilterOffsetInPPS", m_loopFilterOffsetInPPS, false ) |
|---|
| 364 | ("LoopFilterBetaOffset_div2", m_loopFilterBetaOffsetDiv2, 0 ) |
|---|
| 365 | ("LoopFilterTcOffset_div2", m_loopFilterTcOffsetDiv2, 0 ) |
|---|
| 366 | ("DeblockingFilterControlPresent", m_DeblockingFilterControlPresent, false ) |
|---|
| 367 | |
|---|
| 368 | // Coding tools |
|---|
| 369 | #if !REMOVE_NSQT |
|---|
| 370 | ("NSQT", m_enableNSQT, true, "Enable non-square transforms") |
|---|
| 371 | #endif |
|---|
| 372 | ("AMP", m_enableAMP, true, "Enable asymmetric motion partitions") |
|---|
| 373 | #if !REMOVE_LMCHROMA |
|---|
| 374 | ("LMChroma", m_bUseLMChroma, true, "Intra chroma prediction based on reconstructed luma") |
|---|
| 375 | #endif |
|---|
| 376 | ("TransformSkip", m_useTransformSkip, false, "Intra transform skipping") |
|---|
| 377 | ("TransformSkipFast", m_useTransformSkipFast, false, "Fast intra transform skipping") |
|---|
| 378 | #if !REMOVE_ALF |
|---|
| 379 | ("ALF", m_bUseALF, true, "Enable Adaptive Loop Filter") |
|---|
| 380 | #endif |
|---|
| 381 | ("SAO", m_bUseSAO, true, "Enable Sample Adaptive Offset") |
|---|
| 382 | ("MaxNumOffsetsPerPic", m_maxNumOffsetsPerPic, 2048, "Max number of SAO offset per picture (Default: 2048)") |
|---|
| 383 | #if SAO_LCU_BOUNDARY |
|---|
| 384 | ("SAOLcuBoundary", m_saoLcuBoundary, false, "0: right/bottom LCU boundary areas skipped from SAO parameter estimation, 1: non-deblocked pixels are used for those areas") |
|---|
| 385 | #endif |
|---|
| 386 | ("SAOLcuBasedOptimization", m_saoLcuBasedOptimization, true, "0: SAO picture-based optimization, 1: SAO LCU-based optimization ") |
|---|
| 387 | #if !REMOVE_ALF |
|---|
| 388 | ("ALFLowLatencyEncode", m_alfLowLatencyEncoding, false, "Low-latency ALF encoding, 0: picture latency (trained from current frame), 1: LCU latency(trained from previous frame)") |
|---|
| 389 | #endif |
|---|
| 390 | ("SliceMode", m_iSliceMode, 0, "0: Disable all Recon slice limits, 1: Enforce max # of LCUs, 2: Enforce max # of bytes") |
|---|
| 391 | ("SliceArgument", m_iSliceArgument, 0, "if SliceMode==1 SliceArgument represents max # of LCUs. if SliceMode==2 SliceArgument represents max # of bytes.") |
|---|
| 392 | ("DependentSliceMode", m_iDependentSliceMode, 0, "0: Disable all dependent slice limits, 1: Enforce max # of LCUs, 2: Enforce constraint based dependent slices") |
|---|
| 393 | ("DependentSliceArgument", m_iDependentSliceArgument,0, "if DependentSliceMode==1 SliceArgument represents max # of LCUs. if DependentSliceMode==2 DependentSliceArgument represents max # of bins.") |
|---|
| 394 | #if DEPENDENT_SLICES |
|---|
| 395 | #if TILES_WPP_ENTROPYSLICES_FLAGS |
|---|
| 396 | ("EntropySliceEnabledFlag", m_entropySliceEnabledFlag, false, "Enable use of entropy slices instead of dependent slices." ) |
|---|
| 397 | #else |
|---|
| 398 | ("CabacIndependentFlag", m_bCabacIndependentFlag, false) |
|---|
| 399 | #endif |
|---|
| 400 | #endif |
|---|
| 401 | #if !REMOVE_FGS |
|---|
| 402 | ("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.") |
|---|
| 403 | #endif |
|---|
| 404 | ("LFCrossSliceBoundaryFlag", m_bLFCrossSliceBoundaryFlag, true) |
|---|
| 405 | |
|---|
| 406 | ("ConstrainedIntraPred", m_bUseConstrainedIntraPred, false, "Constrained Intra Prediction") |
|---|
| 407 | ("PCMEnabledFlag", m_usePCM , false) |
|---|
| 408 | ("PCMLog2MaxSize", m_pcmLog2MaxSize, 5u) |
|---|
| 409 | ("PCMLog2MinSize", m_uiPCMLog2MinSize, 3u) |
|---|
| 410 | |
|---|
| 411 | ("PCMInputBitDepthFlag", m_bPCMInputBitDepthFlag, true) |
|---|
| 412 | ("PCMFilterDisableFlag", m_bPCMFilterDisableFlag, false) |
|---|
| 413 | ("LosslessCuEnabled", m_useLossless, false) |
|---|
| 414 | ("weighted_pred_flag,-wpP", m_bUseWeightPred, false, "weighted prediction flag (P-Slices)") |
|---|
| 415 | ("weighted_bipred_flag,-wpB", m_useWeightedBiPred, false, "weighted bipred flag (B-Slices)") |
|---|
| 416 | ("Log2ParallelMergeLevel", m_log2ParallelMergeLevel, 2u, "Parallel merge estimation region") |
|---|
| 417 | ("UniformSpacingIdc", m_iUniformSpacingIdr, 0, "Indicates if the column and row boundaries are distributed uniformly") |
|---|
| 418 | ("NumTileColumnsMinus1", m_iNumColumnsMinus1, 0, "Number of columns in a picture minus 1") |
|---|
| 419 | ("ColumnWidthArray", cfg_ColumnWidth, string(""), "Array containing ColumnWidth values in units of LCU") |
|---|
| 420 | ("NumTileRowsMinus1", m_iNumRowsMinus1, 0, "Number of rows in a picture minus 1") |
|---|
| 421 | ("RowHeightArray", cfg_RowHeight, string(""), "Array containing RowHeight values in units of LCU") |
|---|
| 422 | ("LFCrossTileBoundaryFlag", m_bLFCrossTileBoundaryFlag, true, "1: cross-tile-boundary loop filtering. 0:non-cross-tile-boundary loop filtering") |
|---|
| 423 | ("WaveFrontSynchro", m_iWaveFrontSynchro, 0, "0: no synchro; 1 synchro with TR; 2 TRR etc") |
|---|
| 424 | ("ScalingList", m_useScalingListId, 0, "0: no scaling list, 1: default scaling lists, 2: scaling lists specified in ScalingListFile") |
|---|
| 425 | ("ScalingListFile", cfg_ScalingListFile, string(""), "Scaling list file name") |
|---|
| 426 | ("SignHideFlag,-SBH", m_signHideFlag, 1) |
|---|
| 427 | ("MaxNumMergeCand", m_maxNumMergeCand, 5u, "Maximum number of merge candidates") |
|---|
| 428 | |
|---|
| 429 | /* Misc. */ |
|---|
| 430 | ("SEIpictureDigest", m_decodePictureHashSEIEnabled, 0, "Control generation of decode picture hash SEI messages\n" |
|---|
| 431 | "\t3: checksum\n" |
|---|
| 432 | "\t2: CRC\n" |
|---|
| 433 | "\t1: use MD5\n" |
|---|
| 434 | "\t0: disable") |
|---|
| 435 | ("TMVPMode", m_TMVPModeId, 1, "TMVP mode 0: TMVP disable for all slices. 1: TMVP enable for all slices (default) 2: TMVP enable for certain slices only") |
|---|
| 436 | ("FEN", m_bUseFastEnc, false, "fast encoder setting") |
|---|
| 437 | ("ECU", m_bUseEarlyCU, false, "Early CU setting") |
|---|
| 438 | ("FDM", m_useFastDecisionForMerge, true, "Fast decision for Merge RD Cost") |
|---|
| 439 | ("CFM", m_bUseCbfFastMode, false, "Cbf fast mode setting") |
|---|
| 440 | ("ESD", m_useEarlySkipDetection, false, "Early SKIP detection setting") |
|---|
| 441 | ("RateCtrl,-rc", m_enableRateCtrl, false, "Rate control on/off") |
|---|
| 442 | ("TargetBitrate,-tbr", m_targetBitrate, 0, "Input target bitrate") |
|---|
| 443 | ("NumLCUInUnit,-nu", m_numLCUInUnit, 0, "Number of LCUs in an Unit") |
|---|
| 444 | |
|---|
| 445 | ("TransquantBypassEnableFlag", m_TransquantBypassEnableFlag, false, "transquant_bypass_enable_flag indicator in PPS") |
|---|
| 446 | ("CUTransquantBypassFlagValue", m_CUTransquantBypassFlagValue, false, "Fixed cu_transquant_bypass_flag value, when transquant_bypass_enable_flag is enabled") |
|---|
| 447 | #if RECALCULATE_QP_ACCORDING_LAMBDA |
|---|
| 448 | ("RecalculateQPAccordingToLambda", m_recalculateQPAccordingToLambda, false, "Recalculate QP values according to lambda values. Do not suggest to be enabled in all intra case") |
|---|
| 449 | #endif |
|---|
| 450 | #if ACTIVE_PARAMETER_SETS_SEI_MESSAGE |
|---|
| 451 | ("ActiveParameterSets", m_activeParameterSetsSEIEnabled, 0, "Control generation of active parameter sets SEI messages\n" |
|---|
| 452 | "\t2: enable active parameter sets SEI message with active_sps_id\n" |
|---|
| 453 | "\t1: enable active parameter sets SEI message without active_sps_id\n" |
|---|
| 454 | "\t0: disable") |
|---|
| 455 | #endif |
|---|
| 456 | #if SUPPORT_FOR_VUI |
|---|
| 457 | ("VuiParametersPresent,-vui", m_vuiParametersPresentFlag, false, "Enable generation of vui_parameters()") |
|---|
| 458 | ("AspectRatioInfoPresent", m_aspectRatioInfoPresentFlag, false, "Signals whether aspect_ratio_idc is present") |
|---|
| 459 | ("AspectRatioIdc", m_aspectRatioIdc, 0, "aspect_ratio_idc") |
|---|
| 460 | ("SarWidth", m_sarWidth, 0, "horizontal size of the sample aspect ratio") |
|---|
| 461 | ("SarHeight", m_sarHeight, 0, "vertical size of the sample aspect ratio") |
|---|
| 462 | ("OverscanInfoPresent", m_overscanInfoPresentFlag, false, "Indicates whether cropped decoded pictures are suitable for display using overscan\n") |
|---|
| 463 | ("OverscanAppropriate", m_overscanAppropriateFlag, false, "Indicates whether cropped decoded pictures are suitable for display using overscan\n") |
|---|
| 464 | ("VideoSignalTypePresent", m_videoSignalTypePresentFlag, false, "Signals whether video_format, video_full_range_flag, and colour_description_present_flag are present") |
|---|
| 465 | ("VideoFormat", m_videoFormat, 5, "Indicates representation of pictures") |
|---|
| 466 | ("VideoFullRange", m_videoFullRangeFlag, false, "Indicates the black level and range of luma and chroma signals") |
|---|
| 467 | ("ColourDescriptionPresent", m_colourDescriptionPresentFlag, false, "Signals whether colour_primaries, transfer_characteristics and matrix_coefficients are present") |
|---|
| 468 | ("ColourPrimaries", m_colourPrimaries, 2, "Indicates chromaticity coordinates of the source primaries") |
|---|
| 469 | ("TransferCharateristics", m_transferCharacteristics, 2, "Indicates the opto-electronic transfer characteristics of the source") |
|---|
| 470 | ("MatrixCoefficients", m_matrixCoefficients, 2, "Describes the matrix coefficients used in deriving luma and chroma from RGB primaries") |
|---|
| 471 | ("ChromaLocInfoPresent", m_chromaLocInfoPresentFlag, false, "Signals whether chroma_sample_loc_type_top_field and chroma_sample_loc_type_bottom_field are present") |
|---|
| 472 | ("ChromaSampleLocTypeTopField", m_chromaSampleLocTypeTopField, 0, "Specifies the location of chroma samples for top field") |
|---|
| 473 | ("ChromaSampleLocTypeBottomField", m_chromaSampleLocTypeBottomField, 0, "Specifies the location of chroma samples for bottom field") |
|---|
| 474 | ("NeutralChromaIndication", m_neutralChromaIndicationFlag, false, "Indicates that the value of all decoded chroma samples is equal to 1<<(BitDepthCr-1)") |
|---|
| 475 | ("BitstreamRestriction", m_bitstreamRestrictionFlag, false, "Signals whether bitstream restriction parameters are present") |
|---|
| 476 | ("TilesFixedStructure", m_tilesFixedStructureFlag, false, "Indicates that each active picture parameter set has the same values of the syntax elements related to tiles") |
|---|
| 477 | ("MotionVectorsOverPicBoundaries", m_motionVectorsOverPicBoundariesFlag, false, "Indicates that no samples outside the picture boundaries are used for inter prediction") |
|---|
| 478 | ("MaxBytesPerPicDenom", m_maxBytesPerPicDenom, 2, "Indicates a number of bytes not exceeded by the sum of the sizes of the VCL NAL units associated with any coded picture") |
|---|
| 479 | ("MaxBitsPerMinCuDenom", m_maxBitsPerMinCuDenom, 1, "Indicates an upper bound for the number of bits of coding_unit() data") |
|---|
| 480 | ("Log2MaxMvLengthHorizontal", m_log2MaxMvLengthHorizontal, 15, "Indicate the maximum absolute value of a decoded horizontal MV component in quarter-pel luma units") |
|---|
| 481 | ("Log2MaxMvLengthVertical", m_log2MaxMvLengthVertical, 15, "Indicate the maximum absolute value of a decoded vertical MV component in quarter-pel luma units") |
|---|
| 482 | #endif |
|---|
| 483 | #if RECOVERY_POINT_SEI |
|---|
| 484 | ("SEIRecoveryPoint", m_recoveryPointSEIEnabled, 0, "Control generation of recovery point SEI messages") |
|---|
| 485 | #endif |
|---|
| 486 | #if BUFFERING_PERIOD_AND_TIMING_SEI |
|---|
| 487 | ("SEIBufferingPeriod", m_bufferingPeriodSEIEnabled, 0, "Control generation of buffering period SEI messages") |
|---|
| 488 | ("SEIPictureTiming", m_pictureTimingSEIEnabled, 0, "Control generation of picture timing SEI messages") |
|---|
| 489 | #endif |
|---|
| 490 | ; |
|---|
| 491 | |
|---|
| 492 | for(Int i=1; i<MAX_GOP+1; i++) { |
|---|
| 493 | std::ostringstream cOSS; |
|---|
| 494 | cOSS<<"Frame"<<i; |
|---|
| 495 | opts.addOptions()(cOSS.str(), m_GOPList[i-1], GOPEntry()); |
|---|
| 496 | } |
|---|
| 497 | po::setDefaults(opts); |
|---|
| 498 | const list<const char*>& argv_unhandled = po::scanArgv(opts, argc, (const char**) argv); |
|---|
| 499 | |
|---|
| 500 | for (list<const char*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++) |
|---|
| 501 | { |
|---|
| 502 | fprintf(stderr, "Unhandled argument ignored: `%s'\n", *it); |
|---|
| 503 | } |
|---|
| 504 | |
|---|
| 505 | if (argc == 1 || do_help) |
|---|
| 506 | { |
|---|
| 507 | /* argc == 1: no options have been specified */ |
|---|
| 508 | po::doHelp(cout, opts); |
|---|
| 509 | return false; |
|---|
| 510 | } |
|---|
| 511 | |
|---|
| 512 | /* |
|---|
| 513 | * Set any derived parameters |
|---|
| 514 | */ |
|---|
| 515 | /* convert std::string to c string for compatability */ |
|---|
| 516 | #if SVC_EXTENSION |
|---|
| 517 | m_pchBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str()); |
|---|
| 518 | #else |
|---|
| 519 | m_pchInputFile = cfg_InputFile.empty() ? NULL : strdup(cfg_InputFile.c_str()); |
|---|
| 520 | m_pchBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str()); |
|---|
| 521 | m_pchReconFile = cfg_ReconFile.empty() ? NULL : strdup(cfg_ReconFile.c_str()); |
|---|
| 522 | m_pchdQPFile = cfg_dQPFile.empty() ? NULL : strdup(cfg_dQPFile.c_str()); |
|---|
| 523 | #endif |
|---|
| 524 | |
|---|
| 525 | m_pchColumnWidth = cfg_ColumnWidth.empty() ? NULL: strdup(cfg_ColumnWidth.c_str()); |
|---|
| 526 | m_pchRowHeight = cfg_RowHeight.empty() ? NULL : strdup(cfg_RowHeight.c_str()); |
|---|
| 527 | m_scalingListFile = cfg_ScalingListFile.empty() ? NULL : strdup(cfg_ScalingListFile.c_str()); |
|---|
| 528 | |
|---|
| 529 | #if !SVC_EXTENSION |
|---|
| 530 | // TODO:ChromaFmt assumes 4:2:0 below |
|---|
| 531 | switch (m_croppingMode) |
|---|
| 532 | { |
|---|
| 533 | case 0: |
|---|
| 534 | { |
|---|
| 535 | // no cropping or padding |
|---|
| 536 | m_cropLeft = m_cropRight = m_cropTop = m_cropBottom = 0; |
|---|
| 537 | m_aiPad[1] = m_aiPad[0] = 0; |
|---|
| 538 | break; |
|---|
| 539 | } |
|---|
| 540 | case 1: |
|---|
| 541 | { |
|---|
| 542 | // automatic padding to minimum CU size |
|---|
| 543 | Int minCuSize = m_uiMaxCUHeight >> (m_uiMaxCUDepth - 1); |
|---|
| 544 | if (m_iSourceWidth % minCuSize) |
|---|
| 545 | { |
|---|
| 546 | m_aiPad[0] = m_cropRight = ((m_iSourceWidth / minCuSize) + 1) * minCuSize - m_iSourceWidth; |
|---|
| 547 | m_iSourceWidth += m_cropRight; |
|---|
| 548 | } |
|---|
| 549 | if (m_iSourceHeight % minCuSize) |
|---|
| 550 | { |
|---|
| 551 | m_aiPad[1] = m_cropBottom = ((m_iSourceHeight / minCuSize) + 1) * minCuSize - m_iSourceHeight; |
|---|
| 552 | m_iSourceHeight += m_cropBottom; |
|---|
| 553 | } |
|---|
| 554 | if (m_aiPad[0] % TComSPS::getCropUnitX(CHROMA_420) != 0) |
|---|
| 555 | { |
|---|
| 556 | fprintf(stderr, "Error: picture width is not an integer multiple of the specified chroma subsampling\n"); |
|---|
| 557 | exit(EXIT_FAILURE); |
|---|
| 558 | } |
|---|
| 559 | if (m_aiPad[1] % TComSPS::getCropUnitY(CHROMA_420) != 0) |
|---|
| 560 | { |
|---|
| 561 | fprintf(stderr, "Error: picture height is not an integer multiple of the specified chroma subsampling\n"); |
|---|
| 562 | exit(EXIT_FAILURE); |
|---|
| 563 | } |
|---|
| 564 | break; |
|---|
| 565 | } |
|---|
| 566 | case 2: |
|---|
| 567 | { |
|---|
| 568 | //padding |
|---|
| 569 | m_iSourceWidth += m_aiPad[0]; |
|---|
| 570 | m_iSourceHeight += m_aiPad[1]; |
|---|
| 571 | m_cropRight = m_aiPad[0]; |
|---|
| 572 | m_cropBottom = m_aiPad[1]; |
|---|
| 573 | break; |
|---|
| 574 | } |
|---|
| 575 | case 3: |
|---|
| 576 | { |
|---|
| 577 | // cropping |
|---|
| 578 | if ((m_cropLeft == 0) && (m_cropRight == 0) && (m_cropTop == 0) && (m_cropBottom == 0)) |
|---|
| 579 | { |
|---|
| 580 | fprintf(stderr, "Warning: Cropping enabled, but all cropping parameters set to zero\n"); |
|---|
| 581 | } |
|---|
| 582 | if ((m_aiPad[1] != 0) || (m_aiPad[0]!=0)) |
|---|
| 583 | { |
|---|
| 584 | fprintf(stderr, "Warning: Cropping enabled, padding parameters will be ignored\n"); |
|---|
| 585 | } |
|---|
| 586 | m_aiPad[1] = m_aiPad[0] = 0; |
|---|
| 587 | break; |
|---|
| 588 | } |
|---|
| 589 | } |
|---|
| 590 | |
|---|
| 591 | // allocate slice-based dQP values |
|---|
| 592 | m_aidQP = new Int[ m_iFrameToBeEncoded + m_iGOPSize + 1 ]; |
|---|
| 593 | ::memset( m_aidQP, 0, sizeof(Int)*( m_iFrameToBeEncoded + m_iGOPSize + 1 ) ); |
|---|
| 594 | |
|---|
| 595 | // handling of floating-point QP values |
|---|
| 596 | // if QP is not integer, sequence is split into two sections having QP and QP+1 |
|---|
| 597 | m_iQP = (Int)( m_fQP ); |
|---|
| 598 | if ( m_iQP < m_fQP ) |
|---|
| 599 | { |
|---|
| 600 | Int iSwitchPOC = (Int)( m_iFrameToBeEncoded - (m_fQP - m_iQP)*m_iFrameToBeEncoded + 0.5 ); |
|---|
| 601 | |
|---|
| 602 | iSwitchPOC = (Int)( (Double)iSwitchPOC / m_iGOPSize + 0.5 )*m_iGOPSize; |
|---|
| 603 | for ( Int i=iSwitchPOC; i<m_iFrameToBeEncoded + m_iGOPSize + 1; i++ ) |
|---|
| 604 | { |
|---|
| 605 | m_aidQP[i] = 1; |
|---|
| 606 | } |
|---|
| 607 | } |
|---|
| 608 | |
|---|
| 609 | // reading external dQP description from file |
|---|
| 610 | if ( m_pchdQPFile ) |
|---|
| 611 | { |
|---|
| 612 | FILE* fpt=fopen( m_pchdQPFile, "r" ); |
|---|
| 613 | if ( fpt ) |
|---|
| 614 | { |
|---|
| 615 | Int iValue; |
|---|
| 616 | Int iPOC = 0; |
|---|
| 617 | while ( iPOC < m_iFrameToBeEncoded ) |
|---|
| 618 | { |
|---|
| 619 | if ( fscanf(fpt, "%d", &iValue ) == EOF ) break; |
|---|
| 620 | m_aidQP[ iPOC ] = iValue; |
|---|
| 621 | iPOC++; |
|---|
| 622 | } |
|---|
| 623 | fclose(fpt); |
|---|
| 624 | } |
|---|
| 625 | } |
|---|
| 626 | m_iWaveFrontSubstreams = m_iWaveFrontSynchro ? (m_iSourceHeight + m_uiMaxCUHeight - 1) / m_uiMaxCUHeight : 1; |
|---|
| 627 | #endif |
|---|
| 628 | // check validity of input parameters |
|---|
| 629 | xCheckParameter(); |
|---|
| 630 | |
|---|
| 631 | // set global varibles |
|---|
| 632 | xSetGlobal(); |
|---|
| 633 | |
|---|
| 634 | // print-out parameters |
|---|
| 635 | xPrintParameter(); |
|---|
| 636 | |
|---|
| 637 | return true; |
|---|
| 638 | } |
|---|
| 639 | |
|---|
| 640 | // ==================================================================================================================== |
|---|
| 641 | // Private member functions |
|---|
| 642 | // ==================================================================================================================== |
|---|
| 643 | |
|---|
| 644 | Bool confirmPara(Bool bflag, const char* message); |
|---|
| 645 | |
|---|
| 646 | Void TAppEncCfg::xCheckParameter() |
|---|
| 647 | { |
|---|
| 648 | if (!m_decodePictureHashSEIEnabled) |
|---|
| 649 | { |
|---|
| 650 | fprintf(stderr, "*************************************************************\n"); |
|---|
| 651 | fprintf(stderr, "** WARNING: --SEIpictureDigest is now disabled by default. **\n"); |
|---|
| 652 | fprintf(stderr, "** Automatic verification of decoded pictures by **\n"); |
|---|
| 653 | fprintf(stderr, "** a decoder requires this option to be enabled. **\n"); |
|---|
| 654 | fprintf(stderr, "*************************************************************\n"); |
|---|
| 655 | } |
|---|
| 656 | |
|---|
| 657 | bool check_failed = false; /* abort if there is a fatal configuration problem */ |
|---|
| 658 | #define xConfirmPara(a,b) check_failed |= confirmPara(a,b) |
|---|
| 659 | // check range of parameters |
|---|
| 660 | xConfirmPara( m_uiInputBitDepth < 8, "InputBitDepth must be at least 8" ); |
|---|
| 661 | #if !SVC_EXTENSION |
|---|
| 662 | xConfirmPara( m_iFrameRate <= 0, "Frame rate must be more than 1" ); |
|---|
| 663 | #endif |
|---|
| 664 | xConfirmPara( m_iFrameToBeEncoded <= 0, "Total Number Of Frames encoded must be more than 0" ); |
|---|
| 665 | xConfirmPara( m_iGOPSize < 1 , "GOP Size must be greater or equal to 1" ); |
|---|
| 666 | xConfirmPara( m_iGOPSize > 1 && m_iGOPSize % 2, "GOP Size must be a multiple of 2, if GOP Size is greater than 1" ); |
|---|
| 667 | #if !SVC_EXTENSION |
|---|
| 668 | xConfirmPara( (m_iIntraPeriod > 0 && m_iIntraPeriod < m_iGOPSize) || m_iIntraPeriod == 0, "Intra period must be more than GOP size, or -1 , not 0" ); |
|---|
| 669 | #endif |
|---|
| 670 | xConfirmPara( m_iDecodingRefreshType < 0 || m_iDecodingRefreshType > 2, "Decoding Refresh Type must be equal to 0, 1 or 2" ); |
|---|
| 671 | #if !SVC_EXTENSION |
|---|
| 672 | xConfirmPara( m_iQP < -6 * ((Int)m_uiInternalBitDepth - 8) || m_iQP > 51, "QP exceeds supported range (-QpBDOffsety to 51)" ); |
|---|
| 673 | #endif |
|---|
| 674 | xConfirmPara( m_loopFilterBetaOffsetDiv2 < -13 || m_loopFilterBetaOffsetDiv2 > 13, "Loop Filter Beta Offset div. 2 exceeds supported range (-13 to 13)"); |
|---|
| 675 | xConfirmPara( m_loopFilterTcOffsetDiv2 < -13 || m_loopFilterTcOffsetDiv2 > 13, "Loop Filter Tc Offset div. 2 exceeds supported range (-13 to 13)"); |
|---|
| 676 | xConfirmPara( m_iFastSearch < 0 || m_iFastSearch > 2, "Fast Search Mode is not supported value (0:Full search 1:Diamond 2:PMVFAST)" ); |
|---|
| 677 | xConfirmPara( m_iSearchRange < 0 , "Search Range must be more than 0" ); |
|---|
| 678 | xConfirmPara( m_bipredSearchRange < 0 , "Search Range must be more than 0" ); |
|---|
| 679 | xConfirmPara( m_iMaxDeltaQP > 7, "Absolute Delta QP exceeds supported range (0 to 7)" ); |
|---|
| 680 | xConfirmPara( m_iMaxCuDQPDepth > m_uiMaxCUDepth - 1, "Absolute depth for a minimum CuDQP exceeds maximum coding unit depth" ); |
|---|
| 681 | |
|---|
| 682 | xConfirmPara( m_cbQpOffset < -12, "Min. Chroma Cb QP Offset is -12" ); |
|---|
| 683 | xConfirmPara( m_cbQpOffset > 12, "Max. Chroma Cb QP Offset is 12" ); |
|---|
| 684 | xConfirmPara( m_crQpOffset < -12, "Min. Chroma Cr QP Offset is -12" ); |
|---|
| 685 | xConfirmPara( m_crQpOffset > 12, "Max. Chroma Cr QP Offset is 12" ); |
|---|
| 686 | |
|---|
| 687 | xConfirmPara( m_iQPAdaptationRange <= 0, "QP Adaptation Range must be more than 0" ); |
|---|
| 688 | #if !SVC_EXTENSION |
|---|
| 689 | if (m_iDecodingRefreshType == 2) |
|---|
| 690 | { |
|---|
| 691 | xConfirmPara( m_iIntraPeriod > 0 && m_iIntraPeriod <= m_iGOPSize , "Intra period must be larger than GOP size for periodic IDR pictures"); |
|---|
| 692 | } |
|---|
| 693 | #endif |
|---|
| 694 | xConfirmPara( (m_uiMaxCUWidth >> m_uiMaxCUDepth) < 4, "Minimum partition width size should be larger than or equal to 8"); |
|---|
| 695 | xConfirmPara( (m_uiMaxCUHeight >> m_uiMaxCUDepth) < 4, "Minimum partition height size should be larger than or equal to 8"); |
|---|
| 696 | xConfirmPara( m_uiMaxCUWidth < 16, "Maximum partition width size should be larger than or equal to 16"); |
|---|
| 697 | xConfirmPara( m_uiMaxCUHeight < 16, "Maximum partition height size should be larger than or equal to 16"); |
|---|
| 698 | #if !SVC_EXTENSION |
|---|
| 699 | xConfirmPara( (m_iSourceWidth % (m_uiMaxCUWidth >> (m_uiMaxCUDepth-1)))!=0, "Resulting coded frame width must be a multiple of the minimum CU size"); |
|---|
| 700 | xConfirmPara( (m_iSourceHeight % (m_uiMaxCUHeight >> (m_uiMaxCUDepth-1)))!=0, "Resulting coded frame height must be a multiple of the minimum CU size"); |
|---|
| 701 | #endif |
|---|
| 702 | |
|---|
| 703 | xConfirmPara( m_uiQuadtreeTULog2MinSize < 2, "QuadtreeTULog2MinSize must be 2 or greater."); |
|---|
| 704 | xConfirmPara( m_uiQuadtreeTULog2MinSize > 5, "QuadtreeTULog2MinSize must be 5 or smaller."); |
|---|
| 705 | xConfirmPara( m_uiQuadtreeTULog2MaxSize < 2, "QuadtreeTULog2MaxSize must be 2 or greater."); |
|---|
| 706 | xConfirmPara( m_uiQuadtreeTULog2MaxSize > 5, "QuadtreeTULog2MaxSize must be 5 or smaller."); |
|---|
| 707 | xConfirmPara( m_uiQuadtreeTULog2MaxSize < m_uiQuadtreeTULog2MinSize, "QuadtreeTULog2MaxSize must be greater than or equal to m_uiQuadtreeTULog2MinSize."); |
|---|
| 708 | xConfirmPara( (1<<m_uiQuadtreeTULog2MinSize)>(m_uiMaxCUWidth >>(m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than minimum CU size" ); // HS |
|---|
| 709 | xConfirmPara( (1<<m_uiQuadtreeTULog2MinSize)>(m_uiMaxCUHeight>>(m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than minimum CU size" ); // HS |
|---|
| 710 | xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) > ( m_uiMaxCUWidth >> m_uiMaxCUDepth ), "Minimum CU width must be greater than minimum transform size." ); |
|---|
| 711 | xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) > ( m_uiMaxCUHeight >> m_uiMaxCUDepth ), "Minimum CU height must be greater than minimum transform size." ); |
|---|
| 712 | xConfirmPara( m_uiQuadtreeTUMaxDepthInter < 1, "QuadtreeTUMaxDepthInter must be greater than or equal to 1" ); |
|---|
| 713 | xConfirmPara( m_uiQuadtreeTUMaxDepthInter > m_uiQuadtreeTULog2MaxSize - m_uiQuadtreeTULog2MinSize + 1, "QuadtreeTUMaxDepthInter must be less than or equal to the difference between QuadtreeTULog2MaxSize and QuadtreeTULog2MinSize plus 1" ); |
|---|
| 714 | xConfirmPara( m_uiQuadtreeTUMaxDepthIntra < 1, "QuadtreeTUMaxDepthIntra must be greater than or equal to 1" ); |
|---|
| 715 | xConfirmPara( m_uiQuadtreeTUMaxDepthIntra > m_uiQuadtreeTULog2MaxSize - m_uiQuadtreeTULog2MinSize + 1, "QuadtreeTUMaxDepthIntra must be less than or equal to the difference between QuadtreeTULog2MaxSize and QuadtreeTULog2MinSize plus 1" ); |
|---|
| 716 | |
|---|
| 717 | xConfirmPara( m_maxNumMergeCand < 1, "MaxNumMergeCand must be 1 or greater."); |
|---|
| 718 | xConfirmPara( m_maxNumMergeCand > 5, "MaxNumMergeCand must be 5 or smaller."); |
|---|
| 719 | |
|---|
| 720 | #if !SVC_EXTENSION |
|---|
| 721 | #if ADAPTIVE_QP_SELECTION |
|---|
| 722 | xConfirmPara( m_bUseAdaptQpSelect == true && m_iQP < 0, "AdaptiveQpSelection must be disabled when QP < 0."); |
|---|
| 723 | xConfirmPara( m_bUseAdaptQpSelect == true && (m_cbQpOffset !=0 || m_crQpOffset != 0 ), "AdaptiveQpSelection must be disabled when ChromaQpOffset is not equal to 0."); |
|---|
| 724 | #endif |
|---|
| 725 | #endif |
|---|
| 726 | |
|---|
| 727 | if( m_usePCM) |
|---|
| 728 | { |
|---|
| 729 | xConfirmPara( m_uiPCMLog2MinSize < 3, "PCMLog2MinSize must be 3 or greater."); |
|---|
| 730 | xConfirmPara( m_uiPCMLog2MinSize > 5, "PCMLog2MinSize must be 5 or smaller."); |
|---|
| 731 | xConfirmPara( m_pcmLog2MaxSize > 5, "PCMLog2MaxSize must be 5 or smaller."); |
|---|
| 732 | xConfirmPara( m_pcmLog2MaxSize < m_uiPCMLog2MinSize, "PCMLog2MaxSize must be equal to or greater than m_uiPCMLog2MinSize."); |
|---|
| 733 | } |
|---|
| 734 | |
|---|
| 735 | xConfirmPara( m_iSliceMode < 0 || m_iSliceMode > 3, "SliceMode exceeds supported range (0 to 3)" ); |
|---|
| 736 | if (m_iSliceMode!=0) |
|---|
| 737 | { |
|---|
| 738 | xConfirmPara( m_iSliceArgument < 1 , "SliceArgument should be larger than or equal to 1" ); |
|---|
| 739 | } |
|---|
| 740 | #if !REMOVE_FGS |
|---|
| 741 | if (m_iSliceMode==3) |
|---|
| 742 | { |
|---|
| 743 | xConfirmPara( m_iSliceGranularity > 0 , "When SliceMode == 3 is chosen, the SliceGranularity must be 0" ); |
|---|
| 744 | } |
|---|
| 745 | #endif |
|---|
| 746 | xConfirmPara( m_iDependentSliceMode < 0 || m_iDependentSliceMode > 2, "DependentSliceMode exceeds supported range (0 to 2)" ); |
|---|
| 747 | if (m_iDependentSliceMode!=0) |
|---|
| 748 | { |
|---|
| 749 | xConfirmPara( m_iDependentSliceArgument < 1 , "DependentSliceArgument should be larger than or equal to 1" ); |
|---|
| 750 | } |
|---|
| 751 | #if !REMOVE_FGS |
|---|
| 752 | xConfirmPara( m_iSliceGranularity >= m_uiMaxCUDepth, "SliceGranularity must be smaller than maximum cu depth"); |
|---|
| 753 | xConfirmPara( m_iSliceGranularity <0 || m_iSliceGranularity > 3, "SliceGranularity exceeds supported range (0 to 3)" ); |
|---|
| 754 | xConfirmPara( m_iSliceGranularity > m_iMaxCuDQPDepth, "SliceGranularity must be smaller smaller than or equal to maximum dqp depth" ); |
|---|
| 755 | #endif |
|---|
| 756 | |
|---|
| 757 | bool tileFlag = (m_iNumColumnsMinus1 > 0 || m_iNumRowsMinus1 > 0 ); |
|---|
| 758 | #if !TILES_WPP_ENTROPYSLICES_FLAGS |
|---|
| 759 | xConfirmPara( tileFlag && m_iDependentSliceMode, "Tile and Dependent Slice can not be applied together"); |
|---|
| 760 | #endif |
|---|
| 761 | xConfirmPara( tileFlag && m_iWaveFrontSynchro, "Tile and Wavefront can not be applied together"); |
|---|
| 762 | #if !DEPENDENT_SLICES |
|---|
| 763 | xConfirmPara( m_iWaveFrontSynchro && m_iDependentSliceMode, "Wavefront and Dependent Slice can not be applied together"); |
|---|
| 764 | #endif |
|---|
| 765 | #if DEPENDENT_SLICES |
|---|
| 766 | #if TILES_WPP_ENTROPYSLICES_FLAGS |
|---|
| 767 | xConfirmPara( m_iWaveFrontSynchro && m_entropySliceEnabledFlag, "WaveFrontSynchro and EntropySliceEnabledFlag can not be applied together"); |
|---|
| 768 | #else |
|---|
| 769 | xConfirmPara( m_iWaveFrontSynchro && m_bCabacIndependentFlag, "Wavefront and CabacIndependentFlag can not be applied together"); |
|---|
| 770 | #endif |
|---|
| 771 | #endif |
|---|
| 772 | |
|---|
| 773 | //TODO:ChromaFmt assumes 4:2:0 below |
|---|
| 774 | #if !SVC_EXTENSION |
|---|
| 775 | xConfirmPara( m_iSourceWidth % TComSPS::getCropUnitX(CHROMA_420) != 0, "Picture width must be an integer multiple of the specified chroma subsampling"); |
|---|
| 776 | xConfirmPara( m_iSourceHeight % TComSPS::getCropUnitY(CHROMA_420) != 0, "Picture height must be an integer multiple of the specified chroma subsampling"); |
|---|
| 777 | #endif |
|---|
| 778 | |
|---|
| 779 | #if !SVC_EXTENSION |
|---|
| 780 | xConfirmPara( m_aiPad[0] % TComSPS::getCropUnitX(CHROMA_420) != 0, "Horizontal padding must be an integer multiple of the specified chroma subsampling"); |
|---|
| 781 | xConfirmPara( m_aiPad[1] % TComSPS::getCropUnitY(CHROMA_420) != 0, "Vertical padding must be an integer multiple of the specified chroma subsampling"); |
|---|
| 782 | |
|---|
| 783 | xConfirmPara( m_cropLeft % TComSPS::getCropUnitX(CHROMA_420) != 0, "Left cropping must be an integer multiple of the specified chroma subsampling"); |
|---|
| 784 | xConfirmPara( m_cropRight % TComSPS::getCropUnitX(CHROMA_420) != 0, "Right cropping must be an integer multiple of the specified chroma subsampling"); |
|---|
| 785 | xConfirmPara( m_cropTop % TComSPS::getCropUnitY(CHROMA_420) != 0, "Top cropping must be an integer multiple of the specified chroma subsampling"); |
|---|
| 786 | xConfirmPara( m_cropBottom % TComSPS::getCropUnitY(CHROMA_420) != 0, "Bottom cropping must be an integer multiple of the specified chroma subsampling"); |
|---|
| 787 | #endif |
|---|
| 788 | |
|---|
| 789 | // max CU width and height should be power of 2 |
|---|
| 790 | UInt ui = m_uiMaxCUWidth; |
|---|
| 791 | while(ui) |
|---|
| 792 | { |
|---|
| 793 | ui >>= 1; |
|---|
| 794 | if( (ui & 1) == 1) |
|---|
| 795 | xConfirmPara( ui != 1 , "Width should be 2^n"); |
|---|
| 796 | } |
|---|
| 797 | ui = m_uiMaxCUHeight; |
|---|
| 798 | while(ui) |
|---|
| 799 | { |
|---|
| 800 | ui >>= 1; |
|---|
| 801 | if( (ui & 1) == 1) |
|---|
| 802 | xConfirmPara( ui != 1 , "Height should be 2^n"); |
|---|
| 803 | } |
|---|
| 804 | |
|---|
| 805 | Bool verifiedGOP=false; |
|---|
| 806 | Bool errorGOP=false; |
|---|
| 807 | Int checkGOP=1; |
|---|
| 808 | Int numRefs = 1; |
|---|
| 809 | Int refList[MAX_NUM_REF_PICS+1]; |
|---|
| 810 | refList[0]=0; |
|---|
| 811 | Bool isOK[MAX_GOP]; |
|---|
| 812 | for(Int i=0; i<MAX_GOP; i++) |
|---|
| 813 | { |
|---|
| 814 | isOK[i]=false; |
|---|
| 815 | } |
|---|
| 816 | Int numOK=0; |
|---|
| 817 | #if !SVC_EXTENSION |
|---|
| 818 | xConfirmPara( m_iIntraPeriod >=0&&(m_iIntraPeriod%m_iGOPSize!=0), "Intra period must be a multiple of GOPSize, or -1" ); |
|---|
| 819 | #endif |
|---|
| 820 | |
|---|
| 821 | for(Int i=0; i<m_iGOPSize; i++) |
|---|
| 822 | { |
|---|
| 823 | if(m_GOPList[i].m_POC==m_iGOPSize) |
|---|
| 824 | { |
|---|
| 825 | xConfirmPara( m_GOPList[i].m_temporalId!=0 , "The last frame in each GOP must have temporal ID = 0 " ); |
|---|
| 826 | } |
|---|
| 827 | } |
|---|
| 828 | |
|---|
| 829 | m_extraRPSs=0; |
|---|
| 830 | |
|---|
| 831 | #if SVC_EXTENSION |
|---|
| 832 | // verify layer configuration parameters |
|---|
| 833 | for(UInt layer=0; layer<m_numLayers; layer++) |
|---|
| 834 | { |
|---|
| 835 | if(m_acLayerCfg[layer].xCheckParameter()) |
|---|
| 836 | { |
|---|
| 837 | printf("\nError: invalid configuration parameter found in layer %d \n", layer); |
|---|
| 838 | check_failed = true; |
|---|
| 839 | } |
|---|
| 840 | } |
|---|
| 841 | #endif |
|---|
| 842 | |
|---|
| 843 | //start looping through frames in coding order until we can verify that the GOP structure is correct. |
|---|
| 844 | while(!verifiedGOP&&!errorGOP) |
|---|
| 845 | { |
|---|
| 846 | Int curGOP = (checkGOP-1)%m_iGOPSize; |
|---|
| 847 | Int curPOC = ((checkGOP-1)/m_iGOPSize)*m_iGOPSize + m_GOPList[curGOP].m_POC; |
|---|
| 848 | if(m_GOPList[curGOP].m_POC<0) |
|---|
| 849 | { |
|---|
| 850 | printf("\nError: found fewer Reference Picture Sets than GOPSize\n"); |
|---|
| 851 | errorGOP=true; |
|---|
| 852 | } |
|---|
| 853 | else |
|---|
| 854 | { |
|---|
| 855 | //check that all reference pictures are available, or have a POC < 0 meaning they might be available in the next GOP. |
|---|
| 856 | Bool beforeI = false; |
|---|
| 857 | for(Int i = 0; i< m_GOPList[curGOP].m_numRefPics; i++) |
|---|
| 858 | { |
|---|
| 859 | Int absPOC = curPOC+m_GOPList[curGOP].m_referencePics[i]; |
|---|
| 860 | if(absPOC < 0) |
|---|
| 861 | { |
|---|
| 862 | beforeI=true; |
|---|
| 863 | } |
|---|
| 864 | else |
|---|
| 865 | { |
|---|
| 866 | Bool found=false; |
|---|
| 867 | for(Int j=0; j<numRefs; j++) |
|---|
| 868 | { |
|---|
| 869 | if(refList[j]==absPOC) |
|---|
| 870 | { |
|---|
| 871 | found=true; |
|---|
| 872 | for(Int k=0; k<m_iGOPSize; k++) |
|---|
| 873 | { |
|---|
| 874 | if(absPOC%m_iGOPSize == m_GOPList[k].m_POC%m_iGOPSize) |
|---|
| 875 | { |
|---|
| 876 | #if TEMPORAL_LAYER_NON_REFERENCE |
|---|
| 877 | if(m_GOPList[k].m_temporalId==m_GOPList[curGOP].m_temporalId) |
|---|
| 878 | { |
|---|
| 879 | m_GOPList[k].m_refPic = true; |
|---|
| 880 | } |
|---|
| 881 | #endif |
|---|
| 882 | m_GOPList[curGOP].m_usedByCurrPic[i]=m_GOPList[k].m_temporalId<=m_GOPList[curGOP].m_temporalId; |
|---|
| 883 | } |
|---|
| 884 | } |
|---|
| 885 | } |
|---|
| 886 | } |
|---|
| 887 | if(!found) |
|---|
| 888 | { |
|---|
| 889 | printf("\nError: ref pic %d is not available for GOP frame %d\n",m_GOPList[curGOP].m_referencePics[i],curGOP+1); |
|---|
| 890 | errorGOP=true; |
|---|
| 891 | } |
|---|
| 892 | } |
|---|
| 893 | } |
|---|
| 894 | if(!beforeI&&!errorGOP) |
|---|
| 895 | { |
|---|
| 896 | //all ref frames were present |
|---|
| 897 | if(!isOK[curGOP]) |
|---|
| 898 | { |
|---|
| 899 | numOK++; |
|---|
| 900 | isOK[curGOP]=true; |
|---|
| 901 | if(numOK==m_iGOPSize) |
|---|
| 902 | { |
|---|
| 903 | verifiedGOP=true; |
|---|
| 904 | } |
|---|
| 905 | } |
|---|
| 906 | } |
|---|
| 907 | else |
|---|
| 908 | { |
|---|
| 909 | //create a new GOPEntry for this frame containing all the reference pictures that were available (POC > 0) |
|---|
| 910 | m_GOPList[m_iGOPSize+m_extraRPSs]=m_GOPList[curGOP]; |
|---|
| 911 | Int newRefs=0; |
|---|
| 912 | for(Int i = 0; i< m_GOPList[curGOP].m_numRefPics; i++) |
|---|
| 913 | { |
|---|
| 914 | Int absPOC = curPOC+m_GOPList[curGOP].m_referencePics[i]; |
|---|
| 915 | if(absPOC>=0) |
|---|
| 916 | { |
|---|
| 917 | m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[newRefs]=m_GOPList[curGOP].m_referencePics[i]; |
|---|
| 918 | m_GOPList[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[newRefs]=m_GOPList[curGOP].m_usedByCurrPic[i]; |
|---|
| 919 | newRefs++; |
|---|
| 920 | } |
|---|
| 921 | } |
|---|
| 922 | Int numPrefRefs = m_GOPList[curGOP].m_numRefPicsActive; |
|---|
| 923 | |
|---|
| 924 | for(Int offset = -1; offset>-checkGOP; offset--) |
|---|
| 925 | { |
|---|
| 926 | //step backwards in coding order and include any extra available pictures we might find useful to replace the ones with POC < 0. |
|---|
| 927 | Int offGOP = (checkGOP-1+offset)%m_iGOPSize; |
|---|
| 928 | Int offPOC = ((checkGOP-1+offset)/m_iGOPSize)*m_iGOPSize + m_GOPList[offGOP].m_POC; |
|---|
| 929 | #if TEMPORAL_LAYER_NON_REFERENCE |
|---|
| 930 | if(offPOC>=0&&m_GOPList[offGOP].m_temporalId<=m_GOPList[curGOP].m_temporalId) |
|---|
| 931 | #else |
|---|
| 932 | if(offPOC>=0&&m_GOPList[offGOP].m_refPic&&m_GOPList[offGOP].m_temporalId<=m_GOPList[curGOP].m_temporalId) |
|---|
| 933 | #endif |
|---|
| 934 | { |
|---|
| 935 | Bool newRef=false; |
|---|
| 936 | for(Int i=0; i<numRefs; i++) |
|---|
| 937 | { |
|---|
| 938 | if(refList[i]==offPOC) |
|---|
| 939 | { |
|---|
| 940 | newRef=true; |
|---|
| 941 | } |
|---|
| 942 | } |
|---|
| 943 | for(Int i=0; i<newRefs; i++) |
|---|
| 944 | { |
|---|
| 945 | if(m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[i]==offPOC-curPOC) |
|---|
| 946 | { |
|---|
| 947 | newRef=false; |
|---|
| 948 | } |
|---|
| 949 | } |
|---|
| 950 | if(newRef) |
|---|
| 951 | { |
|---|
| 952 | Int insertPoint=newRefs; |
|---|
| 953 | //this picture can be added, find appropriate place in list and insert it. |
|---|
| 954 | #if TEMPORAL_LAYER_NON_REFERENCE |
|---|
| 955 | if(m_GOPList[offGOP].m_temporalId==m_GOPList[curGOP].m_temporalId) |
|---|
| 956 | { |
|---|
| 957 | m_GOPList[offGOP].m_refPic = true; |
|---|
| 958 | } |
|---|
| 959 | #endif |
|---|
| 960 | for(Int j=0; j<newRefs; j++) |
|---|
| 961 | { |
|---|
| 962 | if(m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[j]<offPOC-curPOC||m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[j]>0) |
|---|
| 963 | { |
|---|
| 964 | insertPoint = j; |
|---|
| 965 | break; |
|---|
| 966 | } |
|---|
| 967 | } |
|---|
| 968 | Int prev = offPOC-curPOC; |
|---|
| 969 | Int prevUsed = m_GOPList[offGOP].m_temporalId<=m_GOPList[curGOP].m_temporalId; |
|---|
| 970 | for(Int j=insertPoint; j<newRefs+1; j++) |
|---|
| 971 | { |
|---|
| 972 | Int newPrev = m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[j]; |
|---|
| 973 | Int newUsed = m_GOPList[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[j]; |
|---|
| 974 | m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[j]=prev; |
|---|
| 975 | m_GOPList[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[j]=prevUsed; |
|---|
| 976 | prevUsed=newUsed; |
|---|
| 977 | prev=newPrev; |
|---|
| 978 | } |
|---|
| 979 | newRefs++; |
|---|
| 980 | } |
|---|
| 981 | } |
|---|
| 982 | if(newRefs>=numPrefRefs) |
|---|
| 983 | { |
|---|
| 984 | break; |
|---|
| 985 | } |
|---|
| 986 | } |
|---|
| 987 | m_GOPList[m_iGOPSize+m_extraRPSs].m_numRefPics=newRefs; |
|---|
| 988 | m_GOPList[m_iGOPSize+m_extraRPSs].m_POC = curPOC; |
|---|
| 989 | if (m_extraRPSs == 0) |
|---|
| 990 | { |
|---|
| 991 | m_GOPList[m_iGOPSize+m_extraRPSs].m_interRPSPrediction = 0; |
|---|
| 992 | m_GOPList[m_iGOPSize+m_extraRPSs].m_numRefIdc = 0; |
|---|
| 993 | } |
|---|
| 994 | else |
|---|
| 995 | { |
|---|
| 996 | Int rIdx = m_iGOPSize + m_extraRPSs - 1; |
|---|
| 997 | Int refPOC = m_GOPList[rIdx].m_POC; |
|---|
| 998 | Int refPics = m_GOPList[rIdx].m_numRefPics; |
|---|
| 999 | Int newIdc=0; |
|---|
| 1000 | for(Int i = 0; i<= refPics; i++) |
|---|
| 1001 | { |
|---|
| 1002 | Int deltaPOC = ((i != refPics)? m_GOPList[rIdx].m_referencePics[i] : 0); // check if the reference abs POC is >= 0 |
|---|
| 1003 | Int absPOCref = refPOC+deltaPOC; |
|---|
| 1004 | Int refIdc = 0; |
|---|
| 1005 | for (Int j = 0; j < m_GOPList[m_iGOPSize+m_extraRPSs].m_numRefPics; j++) |
|---|
| 1006 | { |
|---|
| 1007 | if ( (absPOCref - curPOC) == m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[j]) |
|---|
| 1008 | { |
|---|
| 1009 | if (m_GOPList[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[j]) |
|---|
| 1010 | { |
|---|
| 1011 | refIdc = 1; |
|---|
| 1012 | } |
|---|
| 1013 | else |
|---|
| 1014 | { |
|---|
| 1015 | refIdc = 2; |
|---|
| 1016 | } |
|---|
| 1017 | } |
|---|
| 1018 | } |
|---|
| 1019 | m_GOPList[m_iGOPSize+m_extraRPSs].m_refIdc[newIdc]=refIdc; |
|---|
| 1020 | newIdc++; |
|---|
| 1021 | } |
|---|
| 1022 | m_GOPList[m_iGOPSize+m_extraRPSs].m_interRPSPrediction = 1; |
|---|
| 1023 | m_GOPList[m_iGOPSize+m_extraRPSs].m_numRefIdc = newIdc; |
|---|
| 1024 | m_GOPList[m_iGOPSize+m_extraRPSs].m_deltaRPS = refPOC - m_GOPList[m_iGOPSize+m_extraRPSs].m_POC; |
|---|
| 1025 | #if !J0234_INTER_RPS_SIMPL |
|---|
| 1026 | m_GOPList[m_iGOPSize+m_extraRPSs].m_deltaRIdxMinus1 = 0; |
|---|
| 1027 | #endif |
|---|
| 1028 | } |
|---|
| 1029 | curGOP=m_iGOPSize+m_extraRPSs; |
|---|
| 1030 | m_extraRPSs++; |
|---|
| 1031 | } |
|---|
| 1032 | numRefs=0; |
|---|
| 1033 | for(Int i = 0; i< m_GOPList[curGOP].m_numRefPics; i++) |
|---|
| 1034 | { |
|---|
| 1035 | Int absPOC = curPOC+m_GOPList[curGOP].m_referencePics[i]; |
|---|
| 1036 | if(absPOC >= 0) |
|---|
| 1037 | { |
|---|
| 1038 | refList[numRefs]=absPOC; |
|---|
| 1039 | numRefs++; |
|---|
| 1040 | } |
|---|
| 1041 | } |
|---|
| 1042 | refList[numRefs]=curPOC; |
|---|
| 1043 | numRefs++; |
|---|
| 1044 | } |
|---|
| 1045 | checkGOP++; |
|---|
| 1046 | } |
|---|
| 1047 | xConfirmPara(errorGOP,"Invalid GOP structure given"); |
|---|
| 1048 | m_maxTempLayer = 1; |
|---|
| 1049 | for(Int i=0; i<m_iGOPSize; i++) |
|---|
| 1050 | { |
|---|
| 1051 | if(m_GOPList[i].m_temporalId >= m_maxTempLayer) |
|---|
| 1052 | { |
|---|
| 1053 | m_maxTempLayer = m_GOPList[i].m_temporalId+1; |
|---|
| 1054 | } |
|---|
| 1055 | xConfirmPara(m_GOPList[i].m_sliceType!='B'&&m_GOPList[i].m_sliceType!='P', "Slice type must be equal to B or P"); |
|---|
| 1056 | } |
|---|
| 1057 | for(Int i=0; i<MAX_TLAYER; i++) |
|---|
| 1058 | { |
|---|
| 1059 | m_numReorderPics[i] = 0; |
|---|
| 1060 | m_maxDecPicBuffering[i] = 0; |
|---|
| 1061 | } |
|---|
| 1062 | for(Int i=0; i<m_iGOPSize; i++) |
|---|
| 1063 | { |
|---|
| 1064 | if(m_GOPList[i].m_numRefPics > m_maxDecPicBuffering[m_GOPList[i].m_temporalId]) |
|---|
| 1065 | { |
|---|
| 1066 | m_maxDecPicBuffering[m_GOPList[i].m_temporalId] = m_GOPList[i].m_numRefPics; |
|---|
| 1067 | } |
|---|
| 1068 | Int highestDecodingNumberWithLowerPOC = 0; |
|---|
| 1069 | for(Int j=0; j<m_iGOPSize; j++) |
|---|
| 1070 | { |
|---|
| 1071 | if(m_GOPList[j].m_POC <= m_GOPList[i].m_POC) |
|---|
| 1072 | { |
|---|
| 1073 | highestDecodingNumberWithLowerPOC = j; |
|---|
| 1074 | } |
|---|
| 1075 | } |
|---|
| 1076 | Int numReorder = 0; |
|---|
| 1077 | for(Int j=0; j<highestDecodingNumberWithLowerPOC; j++) |
|---|
| 1078 | { |
|---|
| 1079 | if(m_GOPList[j].m_temporalId <= m_GOPList[i].m_temporalId && |
|---|
| 1080 | m_GOPList[j].m_POC > m_GOPList[i].m_POC) |
|---|
| 1081 | { |
|---|
| 1082 | numReorder++; |
|---|
| 1083 | } |
|---|
| 1084 | } |
|---|
| 1085 | if(numReorder > m_numReorderPics[m_GOPList[i].m_temporalId]) |
|---|
| 1086 | { |
|---|
| 1087 | m_numReorderPics[m_GOPList[i].m_temporalId] = numReorder; |
|---|
| 1088 | } |
|---|
| 1089 | } |
|---|
| 1090 | for(Int i=0; i<MAX_TLAYER-1; i++) |
|---|
| 1091 | { |
|---|
| 1092 | // a lower layer can not have higher value of m_numReorderPics than a higher layer |
|---|
| 1093 | if(m_numReorderPics[i+1] < m_numReorderPics[i]) |
|---|
| 1094 | { |
|---|
| 1095 | m_numReorderPics[i+1] = m_numReorderPics[i]; |
|---|
| 1096 | } |
|---|
| 1097 | // the value of num_reorder_pics[ i ] shall be in the range of 0 to max_dec_pic_buffering[ i ], inclusive |
|---|
| 1098 | if(m_numReorderPics[i] > m_maxDecPicBuffering[i]) |
|---|
| 1099 | { |
|---|
| 1100 | m_maxDecPicBuffering[i] = m_numReorderPics[i]; |
|---|
| 1101 | } |
|---|
| 1102 | // a lower layer can not have higher value of m_uiMaxDecPicBuffering than a higher layer |
|---|
| 1103 | if(m_maxDecPicBuffering[i+1] < m_maxDecPicBuffering[i]) |
|---|
| 1104 | { |
|---|
| 1105 | m_maxDecPicBuffering[i+1] = m_maxDecPicBuffering[i]; |
|---|
| 1106 | } |
|---|
| 1107 | } |
|---|
| 1108 | // the value of num_reorder_pics[ i ] shall be in the range of 0 to max_dec_pic_buffering[ i ], inclusive |
|---|
| 1109 | if(m_numReorderPics[MAX_TLAYER-1] > m_maxDecPicBuffering[MAX_TLAYER-1]) |
|---|
| 1110 | { |
|---|
| 1111 | m_maxDecPicBuffering[MAX_TLAYER-1] = m_numReorderPics[MAX_TLAYER-1]; |
|---|
| 1112 | } |
|---|
| 1113 | |
|---|
| 1114 | xConfirmPara( m_bUseLComb==false && m_numReorderPics[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. |
|---|
| 1115 | xConfirmPara( m_iWaveFrontSynchro < 0, "WaveFrontSynchro cannot be negative" ); |
|---|
| 1116 | #if !SVC_EXTENSION |
|---|
| 1117 | xConfirmPara( m_iWaveFrontSubstreams <= 0, "WaveFrontSubstreams must be positive" ); |
|---|
| 1118 | xConfirmPara( m_iWaveFrontSubstreams > 1 && !m_iWaveFrontSynchro, "Must have WaveFrontSynchro > 0 in order to have WaveFrontSubstreams > 1" ); |
|---|
| 1119 | #endif |
|---|
| 1120 | |
|---|
| 1121 | xConfirmPara( m_decodePictureHashSEIEnabled<0 || m_decodePictureHashSEIEnabled>3, "this hash type is not correct!\n"); |
|---|
| 1122 | |
|---|
| 1123 | #if !SVC_EXTENSION |
|---|
| 1124 | if(m_enableRateCtrl) |
|---|
| 1125 | { |
|---|
| 1126 | Int numLCUInWidth = (m_iSourceWidth / m_uiMaxCUWidth) + (( m_iSourceWidth % m_uiMaxCUWidth ) ? 1 : 0); |
|---|
| 1127 | Int numLCUInHeight = (m_iSourceHeight / m_uiMaxCUHeight)+ (( m_iSourceHeight % m_uiMaxCUHeight) ? 1 : 0); |
|---|
| 1128 | Int numLCUInPic = numLCUInWidth * numLCUInHeight; |
|---|
| 1129 | |
|---|
| 1130 | xConfirmPara( (numLCUInPic % m_numLCUInUnit) != 0, "total number of LCUs in a frame should be completely divided by NumLCUInUnit" ); |
|---|
| 1131 | |
|---|
| 1132 | m_iMaxDeltaQP = MAX_DELTA_QP; |
|---|
| 1133 | m_iMaxCuDQPDepth = MAX_CUDQP_DEPTH; |
|---|
| 1134 | } |
|---|
| 1135 | #endif |
|---|
| 1136 | |
|---|
| 1137 | xConfirmPara(!m_TransquantBypassEnableFlag && m_CUTransquantBypassFlagValue, "CUTransquantBypassFlagValue cannot be 1 when TransquantBypassEnableFlag is 0"); |
|---|
| 1138 | |
|---|
| 1139 | xConfirmPara(m_log2ParallelMergeLevel < 2, "Log2ParallelMergeLevel should be larger than or equal to 2"); |
|---|
| 1140 | |
|---|
| 1141 | #if ACTIVE_PARAMETER_SETS_SEI_MESSAGE |
|---|
| 1142 | xConfirmPara(m_activeParameterSetsSEIEnabled < 0 || m_activeParameterSetsSEIEnabled > 2, "ActiveParametersSEIEnabled exceeds supported range (0 to 2)"); |
|---|
| 1143 | #endif |
|---|
| 1144 | |
|---|
| 1145 | #undef xConfirmPara |
|---|
| 1146 | if (check_failed) |
|---|
| 1147 | { |
|---|
| 1148 | exit(EXIT_FAILURE); |
|---|
| 1149 | } |
|---|
| 1150 | } |
|---|
| 1151 | |
|---|
| 1152 | /** \todo use of global variables should be removed later |
|---|
| 1153 | */ |
|---|
| 1154 | Void TAppEncCfg::xSetGlobal() |
|---|
| 1155 | { |
|---|
| 1156 | // set max CU width & height |
|---|
| 1157 | g_uiMaxCUWidth = m_uiMaxCUWidth; |
|---|
| 1158 | g_uiMaxCUHeight = m_uiMaxCUHeight; |
|---|
| 1159 | |
|---|
| 1160 | // compute actual CU depth with respect to config depth and max transform size |
|---|
| 1161 | g_uiAddCUDepth = 0; |
|---|
| 1162 | while( (m_uiMaxCUWidth>>m_uiMaxCUDepth) > ( 1 << ( m_uiQuadtreeTULog2MinSize + g_uiAddCUDepth ) ) ) g_uiAddCUDepth++; |
|---|
| 1163 | |
|---|
| 1164 | m_uiMaxCUDepth += g_uiAddCUDepth; |
|---|
| 1165 | g_uiAddCUDepth++; |
|---|
| 1166 | g_uiMaxCUDepth = m_uiMaxCUDepth; |
|---|
| 1167 | |
|---|
| 1168 | // set internal bit-depth and constants |
|---|
| 1169 | #if FULL_NBIT |
|---|
| 1170 | g_uiBitDepth = m_uiInternalBitDepth; |
|---|
| 1171 | g_uiBitIncrement = 0; |
|---|
| 1172 | #else |
|---|
| 1173 | g_uiBitDepth = 8; |
|---|
| 1174 | g_uiBitIncrement = m_uiInternalBitDepth - g_uiBitDepth; |
|---|
| 1175 | #endif |
|---|
| 1176 | |
|---|
| 1177 | g_uiBASE_MAX = ((1<<(g_uiBitDepth))-1); |
|---|
| 1178 | |
|---|
| 1179 | #if IBDI_NOCLIP_RANGE |
|---|
| 1180 | g_uiIBDI_MAX = g_uiBASE_MAX << g_uiBitIncrement; |
|---|
| 1181 | #else |
|---|
| 1182 | g_uiIBDI_MAX = ((1<<(g_uiBitDepth+g_uiBitIncrement))-1); |
|---|
| 1183 | #endif |
|---|
| 1184 | |
|---|
| 1185 | if (m_uiOutputBitDepth == 0) |
|---|
| 1186 | { |
|---|
| 1187 | m_uiOutputBitDepth = m_uiInternalBitDepth; |
|---|
| 1188 | } |
|---|
| 1189 | |
|---|
| 1190 | g_uiPCMBitDepthLuma = m_uiPCMBitDepthLuma = ((m_bPCMInputBitDepthFlag)? m_uiInputBitDepth : m_uiInternalBitDepth); |
|---|
| 1191 | g_uiPCMBitDepthChroma = ((m_bPCMInputBitDepthFlag)? m_uiInputBitDepth : m_uiInternalBitDepth); |
|---|
| 1192 | } |
|---|
| 1193 | |
|---|
| 1194 | Void TAppEncCfg::xPrintParameter() |
|---|
| 1195 | { |
|---|
| 1196 | printf("\n"); |
|---|
| 1197 | #if SVC_EXTENSION |
|---|
| 1198 | printf("Total number of layers : %d\n", m_numLayers ); |
|---|
| 1199 | for(UInt layer=0; layer<m_numLayers; layer++) |
|---|
| 1200 | { |
|---|
| 1201 | printf("=== Layer %d settings === \n", layer); |
|---|
| 1202 | m_acLayerCfg[layer].xPrintParameter(); |
|---|
| 1203 | printf("\n"); |
|---|
| 1204 | } |
|---|
| 1205 | printf("=== Common configuration settings === \n"); |
|---|
| 1206 | printf("Bitstream File : %s\n", m_pchBitstreamFile ); |
|---|
| 1207 | #else |
|---|
| 1208 | printf("Input File : %s\n", m_pchInputFile ); |
|---|
| 1209 | printf("Bitstream File : %s\n", m_pchBitstreamFile ); |
|---|
| 1210 | printf("Reconstruction File : %s\n", m_pchReconFile ); |
|---|
| 1211 | printf("Real Format : %dx%d %dHz\n", m_iSourceWidth - m_cropLeft - m_cropRight, m_iSourceHeight - m_cropTop - m_cropBottom, m_iFrameRate ); |
|---|
| 1212 | printf("Internal Format : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate ); |
|---|
| 1213 | #endif |
|---|
| 1214 | printf("Frame index : %u - %d (%d frames)\n", m_FrameSkip, m_FrameSkip+m_iFrameToBeEncoded-1, m_iFrameToBeEncoded ); |
|---|
| 1215 | printf("CU size / depth : %d / %d\n", m_uiMaxCUWidth, m_uiMaxCUDepth ); |
|---|
| 1216 | printf("RQT trans. size (min / max) : %d / %d\n", 1 << m_uiQuadtreeTULog2MinSize, 1 << m_uiQuadtreeTULog2MaxSize ); |
|---|
| 1217 | printf("Max RQT depth inter : %d\n", m_uiQuadtreeTUMaxDepthInter); |
|---|
| 1218 | printf("Max RQT depth intra : %d\n", m_uiQuadtreeTUMaxDepthIntra); |
|---|
| 1219 | printf("Min PCM size : %d\n", 1 << m_uiPCMLog2MinSize); |
|---|
| 1220 | printf("Motion search range : %d\n", m_iSearchRange ); |
|---|
| 1221 | #if !SVC_EXTENSION |
|---|
| 1222 | printf("Intra period : %d\n", m_iIntraPeriod ); |
|---|
| 1223 | #endif |
|---|
| 1224 | printf("Decoding refresh type : %d\n", m_iDecodingRefreshType ); |
|---|
| 1225 | #if !SVC_EXTENSION |
|---|
| 1226 | printf("QP : %5.2f\n", m_fQP ); |
|---|
| 1227 | #endif |
|---|
| 1228 | printf("Max dQP signaling depth : %d\n", m_iMaxCuDQPDepth); |
|---|
| 1229 | |
|---|
| 1230 | printf("Cb QP Offset : %d\n", m_cbQpOffset ); |
|---|
| 1231 | printf("Cr QP Offset : %d\n", m_crQpOffset); |
|---|
| 1232 | |
|---|
| 1233 | printf("QP adaptation : %d (range=%d)\n", m_bUseAdaptiveQP, (m_bUseAdaptiveQP ? m_iQPAdaptationRange : 0) ); |
|---|
| 1234 | printf("GOP size : %d\n", m_iGOPSize ); |
|---|
| 1235 | printf("Internal bit depth : %d\n", m_uiInternalBitDepth ); |
|---|
| 1236 | printf("PCM sample bit depth : %d\n", m_uiPCMBitDepthLuma ); |
|---|
| 1237 | printf("RateControl : %d\n", m_enableRateCtrl); |
|---|
| 1238 | if(m_enableRateCtrl) |
|---|
| 1239 | { |
|---|
| 1240 | printf("TargetBitrate : %d\n", m_targetBitrate); |
|---|
| 1241 | printf("NumLCUInUnit : %d\n", m_numLCUInUnit); |
|---|
| 1242 | } |
|---|
| 1243 | printf("Max Num Merge Candidates : %d\n", m_maxNumMergeCand); |
|---|
| 1244 | printf("\n"); |
|---|
| 1245 | |
|---|
| 1246 | printf("TOOL CFG: "); |
|---|
| 1247 | #if !REMOVE_ALF |
|---|
| 1248 | printf("ALF:%d ", m_bUseALF ); |
|---|
| 1249 | printf("ALFLowLatencyEncode:%d ", m_alfLowLatencyEncoding?1:0); |
|---|
| 1250 | #endif |
|---|
| 1251 | printf("IBD:%d ", !!g_uiBitIncrement); |
|---|
| 1252 | printf("HAD:%d ", m_bUseHADME ); |
|---|
| 1253 | printf("SRD:%d ", m_bUseSBACRD ); |
|---|
| 1254 | printf("RDQ:%d ", m_bUseRDOQ ); |
|---|
| 1255 | printf("SQP:%d ", m_uiDeltaQpRD ); |
|---|
| 1256 | printf("ASR:%d ", m_bUseASR ); |
|---|
| 1257 | printf("LComb:%d ", m_bUseLComb ); |
|---|
| 1258 | printf("FEN:%d ", m_bUseFastEnc ); |
|---|
| 1259 | printf("ECU:%d ", m_bUseEarlyCU ); |
|---|
| 1260 | printf("FDM:%d ", m_useFastDecisionForMerge ); |
|---|
| 1261 | printf("CFM:%d ", m_bUseCbfFastMode ); |
|---|
| 1262 | printf("ESD:%d ", m_useEarlySkipDetection ); |
|---|
| 1263 | printf("RQT:%d ", 1 ); |
|---|
| 1264 | #if !REMOVE_LMCHROMA |
|---|
| 1265 | printf("LMC:%d ", m_bUseLMChroma ); |
|---|
| 1266 | #endif |
|---|
| 1267 | printf("TransformSkip:%d ", m_useTransformSkip ); |
|---|
| 1268 | printf("TransformSkipFast:%d ", m_useTransformSkipFast ); |
|---|
| 1269 | #if REMOVE_FGS |
|---|
| 1270 | printf("Slice: M=%d ", m_iSliceMode); |
|---|
| 1271 | #else |
|---|
| 1272 | printf("Slice: G=%d M=%d ", m_iSliceGranularity, m_iSliceMode); |
|---|
| 1273 | #endif |
|---|
| 1274 | if (m_iSliceMode!=0) |
|---|
| 1275 | { |
|---|
| 1276 | printf("A=%d ", m_iSliceArgument); |
|---|
| 1277 | } |
|---|
| 1278 | printf("DependentSlice: M=%d ",m_iDependentSliceMode); |
|---|
| 1279 | if (m_iDependentSliceMode!=0) |
|---|
| 1280 | { |
|---|
| 1281 | printf("A=%d ", m_iDependentSliceArgument); |
|---|
| 1282 | } |
|---|
| 1283 | printf("CIP:%d ", m_bUseConstrainedIntraPred); |
|---|
| 1284 | printf("SAO:%d ", (m_bUseSAO)?(1):(0)); |
|---|
| 1285 | printf("PCM:%d ", (m_usePCM && (1<<m_uiPCMLog2MinSize) <= m_uiMaxCUWidth)? 1 : 0); |
|---|
| 1286 | printf("SAOLcuBasedOptimization:%d ", (m_saoLcuBasedOptimization)?(1):(0)); |
|---|
| 1287 | |
|---|
| 1288 | printf("LosslessCuEnabled:%d ", (m_useLossless)? 1:0 ); |
|---|
| 1289 | printf("WPP:%d ", (Int)m_bUseWeightPred); |
|---|
| 1290 | printf("WPB:%d ", (Int)m_useWeightedBiPred); |
|---|
| 1291 | printf("PME:%d ", m_log2ParallelMergeLevel); |
|---|
| 1292 | #if !SVC_EXTENSION |
|---|
| 1293 | printf(" WaveFrontSynchro:%d WaveFrontSubstreams:%d", |
|---|
| 1294 | m_iWaveFrontSynchro, m_iWaveFrontSubstreams); |
|---|
| 1295 | #endif |
|---|
| 1296 | printf(" ScalingList:%d ", m_useScalingListId ); |
|---|
| 1297 | printf("TMVPMode:%d ", m_TMVPModeId ); |
|---|
| 1298 | #if ADAPTIVE_QP_SELECTION |
|---|
| 1299 | printf("AQpS:%d", m_bUseAdaptQpSelect ); |
|---|
| 1300 | #endif |
|---|
| 1301 | |
|---|
| 1302 | printf(" SignBitHidingFlag:%d ", m_signHideFlag); |
|---|
| 1303 | #if SVC_EXTENSION |
|---|
| 1304 | #if RECALCULATE_QP_ACCORDING_LAMBDA |
|---|
| 1305 | printf("RecalQP:%d ", m_recalculateQPAccordingToLambda ? 1 : 0 ); |
|---|
| 1306 | #endif |
|---|
| 1307 | #if REF_IDX_FRAMEWORK |
|---|
| 1308 | printf("REF_IDX_FRAMEWORK:%d ", REF_IDX_FRAMEWORK); |
|---|
| 1309 | printf("EL_RAP_SliceType: %d ", m_elRapSliceBEnabled); |
|---|
| 1310 | printf("REF_IDX_ME_AROUND_ZEROMV:%d ", REF_IDX_ME_AROUND_ZEROMV); |
|---|
| 1311 | #else |
|---|
| 1312 | printf("INTRA_BL:%d ", INTRA_BL); |
|---|
| 1313 | printf("AVC_BASE:%d ", AVC_BASE); |
|---|
| 1314 | #if !AVC_BASE |
|---|
| 1315 | printf("SVC_MVP:%d ", SVC_MVP ); |
|---|
| 1316 | printf("SVC_BL_CAND_INTRA:%d", SVC_BL_CAND_INTRA ); |
|---|
| 1317 | #endif |
|---|
| 1318 | #endif |
|---|
| 1319 | #else |
|---|
| 1320 | #if RECALCULATE_QP_ACCORDING_LAMBDA |
|---|
| 1321 | printf("RecalQP:%d", m_recalculateQPAccordingToLambda ? 1 : 0 ); |
|---|
| 1322 | #endif |
|---|
| 1323 | #endif |
|---|
| 1324 | printf("\n\n"); |
|---|
| 1325 | |
|---|
| 1326 | fflush(stdout); |
|---|
| 1327 | } |
|---|
| 1328 | |
|---|
| 1329 | Bool confirmPara(Bool bflag, const char* message) |
|---|
| 1330 | { |
|---|
| 1331 | if (!bflag) |
|---|
| 1332 | return false; |
|---|
| 1333 | |
|---|
| 1334 | printf("Error: %s\n",message); |
|---|
| 1335 | return true; |
|---|
| 1336 | } |
|---|
| 1337 | |
|---|
| 1338 | //! \} |
|---|