[313] | 1 | /** \file TAppEncLayerCfg.cpp |
---|
| 2 | \brief Handle encoder configuration parameters |
---|
| 3 | */ |
---|
| 4 | |
---|
| 5 | #include <stdlib.h> |
---|
| 6 | #include <cassert> |
---|
| 7 | #include <cstring> |
---|
| 8 | #include <string> |
---|
| 9 | #include "TLibCommon/TComRom.h" |
---|
| 10 | #include "TAppEncCfg.h" |
---|
| 11 | #include "TAppEncLayerCfg.h" |
---|
| 12 | #include "TAppCommon/program_options_lite.h" |
---|
| 13 | |
---|
| 14 | #ifdef WIN32 |
---|
| 15 | #define strdup _strdup |
---|
| 16 | #endif |
---|
| 17 | |
---|
| 18 | using namespace std; |
---|
| 19 | namespace po = df::program_options_lite; |
---|
| 20 | |
---|
| 21 | //! \ingroup TAppEncoder |
---|
| 22 | //! \{ |
---|
| 23 | |
---|
| 24 | |
---|
[494] | 25 | #if AUXILIARY_PICTURES |
---|
| 26 | static inline ChromaFormat numberToChromaFormat(const Int val) |
---|
| 27 | { |
---|
| 28 | switch (val) |
---|
| 29 | { |
---|
| 30 | case 400: return CHROMA_400; break; |
---|
| 31 | case 420: return CHROMA_420; break; |
---|
| 32 | case 422: return CHROMA_422; break; |
---|
| 33 | case 444: return CHROMA_444; break; |
---|
| 34 | default: return NUM_CHROMA_FORMAT; |
---|
| 35 | } |
---|
| 36 | } |
---|
| 37 | #endif |
---|
| 38 | |
---|
[313] | 39 | // ==================================================================================================================== |
---|
| 40 | // Constructor / destructor / initialization / destroy |
---|
| 41 | // ==================================================================================================================== |
---|
| 42 | #if SVC_EXTENSION |
---|
| 43 | TAppEncLayerCfg::TAppEncLayerCfg() |
---|
| 44 | :m_cInputFile(string("")), |
---|
| 45 | m_cReconFile(string("")), |
---|
| 46 | m_conformanceMode( 0 ), |
---|
| 47 | m_aidQP(NULL) |
---|
[442] | 48 | #if REPN_FORMAT_IN_VPS |
---|
| 49 | , m_repFormatIdx (-1) |
---|
| 50 | #endif |
---|
[313] | 51 | { |
---|
| 52 | m_confLeft = m_confRight = m_confTop = m_confBottom = 0; |
---|
| 53 | m_aiPad[1] = m_aiPad[0] = 0; |
---|
| 54 | m_numScaledRefLayerOffsets = 0; |
---|
[540] | 55 | #if O0098_SCALED_REF_LAYER_ID |
---|
| 56 | ::memset(m_scaledRefLayerId, 0, sizeof(m_scaledRefLayerId)); |
---|
| 57 | #endif |
---|
[313] | 58 | ::memset(m_scaledRefLayerLeftOffset, 0, sizeof(m_scaledRefLayerLeftOffset)); |
---|
| 59 | ::memset(m_scaledRefLayerTopOffset, 0, sizeof(m_scaledRefLayerTopOffset)); |
---|
| 60 | ::memset(m_scaledRefLayerRightOffset, 0, sizeof(m_scaledRefLayerRightOffset)); |
---|
| 61 | ::memset(m_scaledRefLayerBottomOffset, 0, sizeof(m_scaledRefLayerBottomOffset)); |
---|
[627] | 62 | #if P0312_VERT_PHASE_ADJ |
---|
[633] | 63 | ::memset(m_vertPhasePositionEnableFlag, 0, sizeof(m_vertPhasePositionEnableFlag)); |
---|
[627] | 64 | #endif |
---|
[313] | 65 | } |
---|
| 66 | |
---|
| 67 | TAppEncLayerCfg::~TAppEncLayerCfg() |
---|
| 68 | { |
---|
| 69 | if ( m_aidQP ) |
---|
| 70 | { |
---|
| 71 | delete[] m_aidQP; |
---|
| 72 | } |
---|
| 73 | } |
---|
| 74 | |
---|
| 75 | Void TAppEncLayerCfg::create() |
---|
| 76 | { |
---|
| 77 | } |
---|
| 78 | |
---|
| 79 | Void TAppEncLayerCfg::destroy() |
---|
| 80 | { |
---|
| 81 | } |
---|
| 82 | |
---|
| 83 | |
---|
| 84 | // ==================================================================================================================== |
---|
| 85 | // Public member functions |
---|
| 86 | // ==================================================================================================================== |
---|
| 87 | |
---|
| 88 | /** \param argc number of arguments |
---|
| 89 | \param argv array of arguments |
---|
| 90 | \retval true when success |
---|
| 91 | */ |
---|
| 92 | bool TAppEncLayerCfg::parseCfg( const string& cfgFileName ) |
---|
| 93 | { |
---|
| 94 | string cfg_InputFile; |
---|
| 95 | string cfg_ReconFile; |
---|
| 96 | string cfg_dQPFile; |
---|
[494] | 97 | #if AUXILIARY_PICTURES |
---|
| 98 | Int tmpInputChromaFormat; |
---|
| 99 | Int tmpChromaFormat; |
---|
| 100 | #endif |
---|
| 101 | |
---|
[313] | 102 | po::Options opts; |
---|
| 103 | opts.addOptions() |
---|
| 104 | ("InputFile,i", cfg_InputFile, string(""), "original YUV input file name") |
---|
| 105 | #if AVC_BASE |
---|
| 106 | ("InputBLFile,-ibl", cfg_InputFile, string(""), "original YUV input file name") |
---|
| 107 | #endif |
---|
| 108 | ("ReconFile,o", cfg_ReconFile, string(""), "reconstructed YUV output file name") |
---|
| 109 | ("SourceWidth,-wdt", m_iSourceWidth, 0, "Source picture width") |
---|
| 110 | ("SourceHeight,-hgt", m_iSourceHeight, 0, "Source picture height") |
---|
| 111 | ("CroppingMode", m_conformanceMode, 0, "Cropping mode (0: no cropping, 1:automatic padding, 2: padding, 3:cropping") |
---|
[494] | 112 | #if AUXILIARY_PICTURES |
---|
| 113 | ("InputChromaFormat", tmpInputChromaFormat, 420, "InputChromaFormatIDC") |
---|
| 114 | ("ChromaFormatIDC", tmpChromaFormat, 420, "ChromaFormatIDC (400|420|422|444 or set 0 (default) for same as InputChromaFormat)") |
---|
| 115 | #endif |
---|
[313] | 116 | ("CropLeft", m_confLeft, 0, "Left cropping/padding for cropping mode 3") |
---|
| 117 | ("CropRight", m_confRight, 0, "Right cropping/padding for cropping mode 3") |
---|
| 118 | ("CropTop", m_confTop, 0, "Top cropping/padding for cropping mode 3") |
---|
| 119 | ("CropBottom", m_confBottom, 0, "Bottom cropping/padding for cropping mode 3") |
---|
| 120 | ("HorizontalPadding,-pdx",m_aiPad[0], 0, "horizontal source padding for cropping mode 2") |
---|
| 121 | ("VerticalPadding,-pdy", m_aiPad[1], 0, "vertical source padding for cropping mode 2") |
---|
| 122 | ("IntraPeriod,-ip", m_iIntraPeriod, -1, "intra period in frames, (-1: only first frame)") |
---|
| 123 | ("FrameRate,-fr", m_iFrameRate, 0, "Frame rate") |
---|
| 124 | ("dQPFile,m", cfg_dQPFile, string(""), "dQP file name") |
---|
| 125 | ("QP,q", m_fQP, 30.0, "Qp value, if value is float, QP is switched once during encoding") |
---|
| 126 | ; |
---|
| 127 | |
---|
| 128 | po::setDefaults(opts); |
---|
| 129 | po::parseConfigFile(opts, cfgFileName); |
---|
| 130 | |
---|
| 131 | m_cInputFile = cfg_InputFile; |
---|
| 132 | m_cReconFile = cfg_ReconFile; |
---|
| 133 | m_pchdQPFile = cfg_dQPFile.empty() ? NULL : strdup(cfg_dQPFile.c_str()); |
---|
[494] | 134 | #if AUXILIARY_PICTURES |
---|
| 135 | m_InputChromaFormat = numberToChromaFormat(tmpInputChromaFormat); |
---|
| 136 | m_chromaFormatIDC = ((tmpChromaFormat == 0) ? (m_InputChromaFormat) : (numberToChromaFormat(tmpChromaFormat))); |
---|
| 137 | #endif |
---|
[313] | 138 | |
---|
| 139 | // reading external dQP description from file |
---|
| 140 | if ( m_pchdQPFile ) |
---|
| 141 | { |
---|
| 142 | FILE* fpt=fopen( m_pchdQPFile, "r" ); |
---|
| 143 | if ( fpt ) |
---|
| 144 | { |
---|
| 145 | Int iValue; |
---|
| 146 | Int iPOC = 0; |
---|
| 147 | while ( iPOC < m_cAppEncCfg->getNumFrameToBeEncoded() ) |
---|
| 148 | { |
---|
| 149 | if ( fscanf(fpt, "%d", &iValue ) == EOF ) break; |
---|
| 150 | m_aidQP[ iPOC ] = iValue; |
---|
| 151 | iPOC++; |
---|
| 152 | } |
---|
| 153 | fclose(fpt); |
---|
| 154 | } |
---|
| 155 | } |
---|
| 156 | return true; |
---|
| 157 | } |
---|
| 158 | |
---|
| 159 | #if AVC_SYNTAX |
---|
| 160 | Void TAppEncLayerCfg::xPrintParameter( UInt layerId ) |
---|
| 161 | #else |
---|
| 162 | Void TAppEncLayerCfg::xPrintParameter() |
---|
| 163 | #endif |
---|
| 164 | { |
---|
| 165 | printf("Input File : %s\n", m_cInputFile.c_str() ); |
---|
| 166 | printf("Reconstruction File : %s\n", m_cReconFile.c_str() ); |
---|
| 167 | #if AVC_SYNTAX |
---|
| 168 | if( layerId == 0 ) |
---|
| 169 | { |
---|
| 170 | printf("Base layer syntax file : %s\n", m_cAppEncCfg->getBLSyntaxFile() ); |
---|
| 171 | } |
---|
| 172 | #endif |
---|
| 173 | printf("Real Format : %dx%d %dHz\n", m_iSourceWidth - m_confLeft - m_confRight, m_iSourceHeight - m_confTop - m_confBottom, m_iFrameRate ); |
---|
| 174 | printf("Internal Format : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate ); |
---|
[494] | 175 | #if O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
| 176 | printf("Input bit depth : (Y:%d, C:%d)\n", m_inputBitDepthY , m_inputBitDepthC ); |
---|
| 177 | printf("Internal bit depth : (Y:%d, C:%d)\n", m_internalBitDepthY, m_internalBitDepthC ); |
---|
| 178 | printf("PCM sample bit depth : (Y:%d, C:%d)\n", m_cAppEncCfg->getPCMInputBitDepthFlag() ? m_inputBitDepthY : m_internalBitDepthY, m_cAppEncCfg->getPCMInputBitDepthFlag() ? m_inputBitDepthC : m_internalBitDepthC ); |
---|
| 179 | #endif |
---|
| 180 | #if LAYER_CTB |
---|
| 181 | printf("CU size / depth : %d / %d\n", m_uiMaxCUWidth, m_uiMaxCUDepth ); |
---|
| 182 | printf("RQT trans. size (min / max) : %d / %d\n", 1 << m_uiQuadtreeTULog2MinSize, 1 << m_uiQuadtreeTULog2MaxSize ); |
---|
| 183 | printf("Max RQT depth inter : %d\n", m_uiQuadtreeTUMaxDepthInter); |
---|
| 184 | printf("Max RQT depth intra : %d\n", m_uiQuadtreeTUMaxDepthIntra); |
---|
| 185 | #endif |
---|
[313] | 186 | printf("QP : %5.2f\n", m_fQP ); |
---|
| 187 | printf("Intra period : %d\n", m_iIntraPeriod ); |
---|
| 188 | #if RC_SHVC_HARMONIZATION |
---|
| 189 | printf("RateControl : %d\n", m_RCEnableRateControl ); |
---|
| 190 | if(m_RCEnableRateControl) |
---|
| 191 | { |
---|
| 192 | printf("TargetBitrate : %d\n", m_RCTargetBitrate ); |
---|
| 193 | printf("KeepHierarchicalBit : %d\n", m_RCKeepHierarchicalBit ); |
---|
| 194 | printf("LCULevelRC : %d\n", m_RCLCULevelRC ); |
---|
| 195 | printf("UseLCUSeparateModel : %d\n", m_RCUseLCUSeparateModel ); |
---|
| 196 | printf("InitialQP : %d\n", m_RCInitialQP ); |
---|
| 197 | printf("ForceIntraQP : %d\n", m_RCForceIntraQP ); |
---|
| 198 | } |
---|
| 199 | #endif |
---|
| 200 | printf("WaveFrontSynchro:%d WaveFrontSubstreams:%d", m_cAppEncCfg->getWaveFrontSynchro(), m_iWaveFrontSubstreams); |
---|
[494] | 201 | #if LAYER_CTB |
---|
| 202 | printf("PCM:%d ", (m_cAppEncCfg->getUsePCM() && (1<<m_cAppEncCfg->getPCMLog2MinSize()) <= m_uiMaxCUWidth)? 1 : 0); |
---|
| 203 | #endif |
---|
[313] | 204 | } |
---|
| 205 | |
---|
| 206 | Bool confirmPara(Bool bflag, const char* message); |
---|
| 207 | |
---|
[442] | 208 | Bool TAppEncLayerCfg::xCheckParameter( Bool isField ) |
---|
[313] | 209 | { |
---|
| 210 | switch (m_conformanceMode) |
---|
| 211 | { |
---|
| 212 | case 0: |
---|
| 213 | { |
---|
| 214 | // no cropping or padding |
---|
| 215 | m_confLeft = m_confRight = m_confTop = m_confBottom = 0; |
---|
| 216 | m_aiPad[1] = m_aiPad[0] = 0; |
---|
| 217 | break; |
---|
| 218 | } |
---|
| 219 | case 1: |
---|
| 220 | { |
---|
| 221 | // automatic padding to minimum CU size |
---|
[494] | 222 | #if LAYER_CTB |
---|
| 223 | Int minCuSize = m_uiMaxCUHeight >> (m_uiMaxCUDepth - 1); |
---|
| 224 | #else |
---|
[313] | 225 | Int minCuSize = m_cAppEncCfg->getMaxCUHeight() >> (m_cAppEncCfg->getMaxCUDepth() - 1); |
---|
[494] | 226 | #endif |
---|
[313] | 227 | if (m_iSourceWidth % minCuSize) |
---|
| 228 | { |
---|
| 229 | m_aiPad[0] = m_confRight = ((m_iSourceWidth / minCuSize) + 1) * minCuSize - m_iSourceWidth; |
---|
| 230 | m_iSourceWidth += m_confRight; |
---|
| 231 | } |
---|
| 232 | if (m_iSourceHeight % minCuSize) |
---|
| 233 | { |
---|
| 234 | m_aiPad[1] = m_confBottom = ((m_iSourceHeight / minCuSize) + 1) * minCuSize - m_iSourceHeight; |
---|
| 235 | m_iSourceHeight += m_confBottom; |
---|
[442] | 236 | if ( isField ) |
---|
| 237 | { |
---|
| 238 | m_iSourceHeightOrg += m_confBottom << 1; |
---|
| 239 | m_aiPad[1] = m_confBottom << 1; |
---|
| 240 | } |
---|
[313] | 241 | } |
---|
| 242 | break; |
---|
| 243 | } |
---|
| 244 | case 2: |
---|
| 245 | { |
---|
| 246 | //padding |
---|
| 247 | m_iSourceWidth += m_aiPad[0]; |
---|
| 248 | m_iSourceHeight += m_aiPad[1]; |
---|
| 249 | m_confRight = m_aiPad[0]; |
---|
| 250 | m_confBottom = m_aiPad[1]; |
---|
| 251 | break; |
---|
| 252 | } |
---|
| 253 | case 3: |
---|
| 254 | { |
---|
| 255 | // conformance |
---|
| 256 | if ((m_confLeft == 0) && (m_confRight == 0) && (m_confTop == 0) && (m_confBottom == 0)) |
---|
| 257 | { |
---|
| 258 | fprintf(stderr, "Warning: Cropping enabled, but all cropping parameters set to zero\n"); |
---|
| 259 | } |
---|
| 260 | if ((m_aiPad[1] != 0) || (m_aiPad[0]!=0)) |
---|
| 261 | { |
---|
| 262 | fprintf(stderr, "Warning: Cropping enabled, padding parameters will be ignored\n"); |
---|
| 263 | } |
---|
| 264 | m_aiPad[1] = m_aiPad[0] = 0; |
---|
| 265 | break; |
---|
| 266 | } |
---|
| 267 | } |
---|
| 268 | |
---|
| 269 | // allocate slice-based dQP values |
---|
| 270 | Int iFrameToBeEncoded = m_cAppEncCfg->getNumFrameToBeEncoded(); |
---|
| 271 | Int iGOPSize = m_cAppEncCfg->getGOPSize(); |
---|
| 272 | if( m_aidQP == NULL ) |
---|
| 273 | m_aidQP = new Int[iFrameToBeEncoded + iGOPSize + 1 ]; |
---|
| 274 | ::memset( m_aidQP, 0, sizeof(Int)*( iFrameToBeEncoded + iGOPSize + 1 ) ); |
---|
| 275 | |
---|
| 276 | // handling of floating-point QP values |
---|
| 277 | // if QP is not integer, sequence is split into two sections having QP and QP+1 |
---|
| 278 | m_iQP = (Int)( m_fQP ); |
---|
| 279 | if ( m_iQP < m_fQP ) |
---|
| 280 | { |
---|
| 281 | Int iSwitchPOC = (Int)( iFrameToBeEncoded - (m_fQP - m_iQP)*iFrameToBeEncoded + 0.5 ); |
---|
| 282 | |
---|
| 283 | |
---|
| 284 | iSwitchPOC = (Int)( (Double)iSwitchPOC / iGOPSize + 0.5 )*iGOPSize; |
---|
| 285 | for ( Int i=iSwitchPOC; i<iFrameToBeEncoded + iGOPSize + 1; i++ ) |
---|
| 286 | { |
---|
| 287 | m_aidQP[i] = 1; |
---|
| 288 | } |
---|
| 289 | } |
---|
| 290 | |
---|
[494] | 291 | #if LAYER_CTB |
---|
| 292 | UInt maxCUWidth = m_uiMaxCUWidth; |
---|
| 293 | UInt maxCUHeight = m_uiMaxCUHeight; |
---|
| 294 | UInt maxCUDepth = m_uiMaxCUDepth; |
---|
| 295 | #else |
---|
[313] | 296 | UInt maxCUWidth = m_cAppEncCfg->getMaxCUWidth(); |
---|
| 297 | UInt maxCUHeight = m_cAppEncCfg->getMaxCUHeight(); |
---|
| 298 | UInt maxCUDepth = m_cAppEncCfg->getMaxCUDepth(); |
---|
[494] | 299 | #endif |
---|
[313] | 300 | bool check_failed = false; /* abort if there is a fatal configuration problem */ |
---|
| 301 | #define xConfirmPara(a,b) check_failed |= confirmPara(a,b) |
---|
| 302 | // check range of parameters |
---|
| 303 | xConfirmPara( m_iFrameRate <= 0, "Frame rate must be more than 1" ); |
---|
| 304 | xConfirmPara( (m_iSourceWidth % (maxCUWidth >> (maxCUDepth-1)))!=0, "Resulting coded frame width must be a multiple of the minimum CU size"); |
---|
| 305 | xConfirmPara( (m_iSourceHeight % (maxCUHeight >> (maxCUDepth-1)))!=0, "Resulting coded frame height must be a multiple of the minimum CU size"); |
---|
| 306 | xConfirmPara( (m_iIntraPeriod > 0 && m_iIntraPeriod < iGOPSize) || m_iIntraPeriod == 0, "Intra period must be more than GOP size, or -1 , not 0" ); |
---|
| 307 | if (m_cAppEncCfg->getDecodingRefreshType() == 2) |
---|
| 308 | { |
---|
| 309 | xConfirmPara( m_iIntraPeriod > 0 && m_iIntraPeriod <= iGOPSize , "Intra period must be larger than GOP size for periodic IDR pictures"); |
---|
| 310 | } |
---|
| 311 | |
---|
[494] | 312 | #if O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
| 313 | for(UInt layer = 0; layer < MAX_LAYERS; layer++) |
---|
| 314 | { |
---|
| 315 | xConfirmPara( m_iQP < -6 * ((Int)m_cAppEncCfg->getInternalBitDepthY(layer) - 8) || m_iQP > 51, "QP exceeds supported range (-QpBDOffsety to 51)" ); |
---|
| 316 | } |
---|
| 317 | #else |
---|
[313] | 318 | xConfirmPara( m_iQP < -6 * ((Int)m_cAppEncCfg->getInternalBitDepthY() - 8) || m_iQP > 51, "QP exceeds supported range (-QpBDOffsety to 51)" ); |
---|
[494] | 319 | #endif |
---|
[313] | 320 | |
---|
| 321 | |
---|
[494] | 322 | m_iWaveFrontSubstreams = m_cAppEncCfg->getWaveFrontSynchro() ? (m_iSourceHeight + maxCUHeight - 1) / maxCUHeight : 1; |
---|
[313] | 323 | xConfirmPara( m_iWaveFrontSubstreams <= 0, "WaveFrontSubstreams must be positive" ); |
---|
| 324 | xConfirmPara( m_iWaveFrontSubstreams > 1 && !m_cAppEncCfg->getWaveFrontSynchro(), "Must have WaveFrontSynchro > 0 in order to have WaveFrontSubstreams > 1" ); |
---|
| 325 | |
---|
| 326 | //chekc parameters |
---|
| 327 | xConfirmPara( m_iSourceWidth % TComSPS::getWinUnitX(CHROMA_420) != 0, "Picture width must be an integer multiple of the specified chroma subsampling"); |
---|
| 328 | xConfirmPara( m_iSourceHeight % TComSPS::getWinUnitY(CHROMA_420) != 0, "Picture height must be an integer multiple of the specified chroma subsampling"); |
---|
| 329 | |
---|
| 330 | xConfirmPara( m_aiPad[0] % TComSPS::getWinUnitX(CHROMA_420) != 0, "Horizontal padding must be an integer multiple of the specified chroma subsampling"); |
---|
| 331 | xConfirmPara( m_aiPad[1] % TComSPS::getWinUnitY(CHROMA_420) != 0, "Vertical padding must be an integer multiple of the specified chroma subsampling"); |
---|
| 332 | |
---|
| 333 | xConfirmPara( m_confLeft % TComSPS::getWinUnitX(CHROMA_420) != 0, "Left conformance window offset must be an integer multiple of the specified chroma subsampling"); |
---|
| 334 | xConfirmPara( m_confRight % TComSPS::getWinUnitX(CHROMA_420) != 0, "Right conformance window offset must be an integer multiple of the specified chroma subsampling"); |
---|
| 335 | xConfirmPara( m_confTop % TComSPS::getWinUnitY(CHROMA_420) != 0, "Top conformance window offset must be an integer multiple of the specified chroma subsampling"); |
---|
| 336 | xConfirmPara( m_confBottom % TComSPS::getWinUnitY(CHROMA_420) != 0, "Bottom conformance window offset must be an integer multiple of the specified chroma subsampling"); |
---|
[494] | 337 | |
---|
| 338 | #if LAYER_CTB |
---|
| 339 | xConfirmPara( (m_uiMaxCUWidth >> m_uiMaxCUDepth) < 4, "Minimum partition width size should be larger than or equal to 8"); |
---|
| 340 | xConfirmPara( (m_uiMaxCUHeight >> m_uiMaxCUDepth) < 4, "Minimum partition height size should be larger than or equal to 8"); |
---|
| 341 | xConfirmPara( m_uiMaxCUWidth < 16, "Maximum partition width size should be larger than or equal to 16"); |
---|
| 342 | xConfirmPara( m_uiMaxCUHeight < 16, "Maximum partition height size should be larger than or equal to 16"); |
---|
| 343 | xConfirmPara( m_uiQuadtreeTULog2MinSize < 2, "QuadtreeTULog2MinSize must be 2 or greater."); |
---|
| 344 | xConfirmPara( m_uiQuadtreeTULog2MaxSize > 5, "QuadtreeTULog2MaxSize must be 5 or smaller."); |
---|
| 345 | xConfirmPara( (1<<m_uiQuadtreeTULog2MaxSize) > m_uiMaxCUWidth, "QuadtreeTULog2MaxSize must be log2(maxCUSize) or smaller."); |
---|
| 346 | xConfirmPara( m_uiQuadtreeTULog2MaxSize < m_uiQuadtreeTULog2MinSize, "QuadtreeTULog2MaxSize must be greater than or equal to m_uiQuadtreeTULog2MinSize."); |
---|
| 347 | xConfirmPara( (1<<m_uiQuadtreeTULog2MinSize)>(m_uiMaxCUWidth >>(m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than minimum CU size" ); // HS |
---|
| 348 | xConfirmPara( (1<<m_uiQuadtreeTULog2MinSize)>(m_uiMaxCUHeight>>(m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than minimum CU size" ); // HS |
---|
| 349 | xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) > ( m_uiMaxCUWidth >> m_uiMaxCUDepth ), "Minimum CU width must be greater than minimum transform size." ); |
---|
| 350 | xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) > ( m_uiMaxCUHeight >> m_uiMaxCUDepth ), "Minimum CU height must be greater than minimum transform size." ); |
---|
| 351 | xConfirmPara( m_uiQuadtreeTUMaxDepthInter < 1, "QuadtreeTUMaxDepthInter must be greater than or equal to 1" ); |
---|
| 352 | xConfirmPara( m_uiMaxCUWidth < ( 1 << (m_uiQuadtreeTULog2MinSize + m_uiQuadtreeTUMaxDepthInter - 1) ), "QuadtreeTUMaxDepthInter must be less than or equal to the difference between log2(maxCUSize) and QuadtreeTULog2MinSize plus 1" ); |
---|
| 353 | xConfirmPara( m_uiQuadtreeTUMaxDepthIntra < 1, "QuadtreeTUMaxDepthIntra must be greater than or equal to 1" ); |
---|
| 354 | xConfirmPara( m_uiMaxCUWidth < ( 1 << (m_uiQuadtreeTULog2MinSize + m_uiQuadtreeTUMaxDepthIntra - 1) ), "QuadtreeTUMaxDepthInter must be less than or equal to the difference between log2(maxCUSize) and QuadtreeTULog2MinSize plus 1" ); |
---|
| 355 | |
---|
| 356 | // max CU width and height should be power of 2 |
---|
| 357 | UInt ui = m_uiMaxCUWidth; |
---|
| 358 | while(ui) |
---|
| 359 | { |
---|
| 360 | ui >>= 1; |
---|
| 361 | if( (ui & 1) == 1) |
---|
| 362 | xConfirmPara( ui != 1 , "Width should be 2^n"); |
---|
| 363 | } |
---|
| 364 | ui = m_uiMaxCUHeight; |
---|
| 365 | while(ui) |
---|
| 366 | { |
---|
| 367 | ui >>= 1; |
---|
| 368 | if( (ui & 1) == 1) |
---|
| 369 | xConfirmPara( ui != 1 , "Height should be 2^n"); |
---|
| 370 | } |
---|
| 371 | #endif |
---|
| 372 | |
---|
[313] | 373 | #undef xConfirmPara |
---|
| 374 | return check_failed; |
---|
| 375 | } |
---|
| 376 | |
---|
[494] | 377 | #endif //SVC_EXTENSION |
---|
[313] | 378 | |
---|
| 379 | |
---|
| 380 | //! \} |
---|