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