[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)); |
---|
[644] | 62 | #if P0312_VERT_PHASE_ADJ |
---|
| 63 | ::memset(m_vertPhasePositionEnableFlag, 0, sizeof(m_vertPhasePositionEnableFlag)); |
---|
| 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 | Void TAppEncLayerCfg::xPrintParameter() |
---|
| 160 | { |
---|
| 161 | printf("Input File : %s\n", m_cInputFile.c_str() ); |
---|
| 162 | printf("Reconstruction File : %s\n", m_cReconFile.c_str() ); |
---|
[713] | 163 | #if REPN_FORMAT_IN_VPS |
---|
| 164 | printf("Real Format : %dx%d %dHz\n", m_iSourceWidth - ( m_confLeft + m_confRight ) * TComSPS::getWinUnitX( m_chromaFormatIDC ), m_iSourceHeight - ( m_confTop + m_confBottom ) * TComSPS::getWinUnitY( m_chromaFormatIDC ), m_iFrameRate ); |
---|
| 165 | #else |
---|
[313] | 166 | printf("Real Format : %dx%d %dHz\n", m_iSourceWidth - m_confLeft - m_confRight, m_iSourceHeight - m_confTop - m_confBottom, m_iFrameRate ); |
---|
[713] | 167 | #endif |
---|
[313] | 168 | printf("Internal Format : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate ); |
---|
[494] | 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 |
---|
| 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); |
---|
[494] | 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 |
---|
[494] | 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); |
---|
[494] | 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; |
---|
[713] | 225 | #if REPN_FORMAT_IN_VPS |
---|
| 226 | m_confRight /= TComSPS::getWinUnitX( m_chromaFormatIDC ); |
---|
| 227 | #endif |
---|
[313] | 228 | } |
---|
| 229 | if (m_iSourceHeight % minCuSize) |
---|
| 230 | { |
---|
| 231 | m_aiPad[1] = m_confBottom = ((m_iSourceHeight / minCuSize) + 1) * minCuSize - m_iSourceHeight; |
---|
| 232 | m_iSourceHeight += m_confBottom; |
---|
[442] | 233 | if ( isField ) |
---|
| 234 | { |
---|
| 235 | m_iSourceHeightOrg += m_confBottom << 1; |
---|
| 236 | m_aiPad[1] = m_confBottom << 1; |
---|
| 237 | } |
---|
[713] | 238 | #if REPN_FORMAT_IN_VPS |
---|
| 239 | m_confBottom /= TComSPS::getWinUnitY( m_chromaFormatIDC ); |
---|
| 240 | #endif |
---|
[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]; |
---|
[713] | 251 | #if REPN_FORMAT_IN_VPS |
---|
| 252 | m_confRight /= TComSPS::getWinUnitX( m_chromaFormatIDC ); |
---|
| 253 | m_confBottom /= TComSPS::getWinUnitY( m_chromaFormatIDC ); |
---|
| 254 | #endif |
---|
[313] | 255 | break; |
---|
| 256 | } |
---|
| 257 | case 3: |
---|
| 258 | { |
---|
| 259 | // conformance |
---|
| 260 | if ((m_confLeft == 0) && (m_confRight == 0) && (m_confTop == 0) && (m_confBottom == 0)) |
---|
| 261 | { |
---|
| 262 | fprintf(stderr, "Warning: Cropping enabled, but all cropping parameters set to zero\n"); |
---|
| 263 | } |
---|
| 264 | if ((m_aiPad[1] != 0) || (m_aiPad[0]!=0)) |
---|
| 265 | { |
---|
| 266 | fprintf(stderr, "Warning: Cropping enabled, padding parameters will be ignored\n"); |
---|
| 267 | } |
---|
| 268 | m_aiPad[1] = m_aiPad[0] = 0; |
---|
| 269 | break; |
---|
| 270 | } |
---|
| 271 | } |
---|
| 272 | |
---|
| 273 | // allocate slice-based dQP values |
---|
| 274 | Int iFrameToBeEncoded = m_cAppEncCfg->getNumFrameToBeEncoded(); |
---|
| 275 | Int iGOPSize = m_cAppEncCfg->getGOPSize(); |
---|
| 276 | if( m_aidQP == NULL ) |
---|
| 277 | m_aidQP = new Int[iFrameToBeEncoded + iGOPSize + 1 ]; |
---|
| 278 | ::memset( m_aidQP, 0, sizeof(Int)*( iFrameToBeEncoded + iGOPSize + 1 ) ); |
---|
| 279 | |
---|
| 280 | // handling of floating-point QP values |
---|
| 281 | // if QP is not integer, sequence is split into two sections having QP and QP+1 |
---|
| 282 | m_iQP = (Int)( m_fQP ); |
---|
| 283 | if ( m_iQP < m_fQP ) |
---|
| 284 | { |
---|
| 285 | Int iSwitchPOC = (Int)( iFrameToBeEncoded - (m_fQP - m_iQP)*iFrameToBeEncoded + 0.5 ); |
---|
| 286 | |
---|
| 287 | |
---|
| 288 | iSwitchPOC = (Int)( (Double)iSwitchPOC / iGOPSize + 0.5 )*iGOPSize; |
---|
| 289 | for ( Int i=iSwitchPOC; i<iFrameToBeEncoded + iGOPSize + 1; i++ ) |
---|
| 290 | { |
---|
| 291 | m_aidQP[i] = 1; |
---|
| 292 | } |
---|
| 293 | } |
---|
| 294 | |
---|
[494] | 295 | #if LAYER_CTB |
---|
| 296 | UInt maxCUWidth = m_uiMaxCUWidth; |
---|
| 297 | UInt maxCUHeight = m_uiMaxCUHeight; |
---|
| 298 | UInt maxCUDepth = m_uiMaxCUDepth; |
---|
| 299 | #else |
---|
[313] | 300 | UInt maxCUWidth = m_cAppEncCfg->getMaxCUWidth(); |
---|
| 301 | UInt maxCUHeight = m_cAppEncCfg->getMaxCUHeight(); |
---|
| 302 | UInt maxCUDepth = m_cAppEncCfg->getMaxCUDepth(); |
---|
[494] | 303 | #endif |
---|
[313] | 304 | bool check_failed = false; /* abort if there is a fatal configuration problem */ |
---|
| 305 | #define xConfirmPara(a,b) check_failed |= confirmPara(a,b) |
---|
| 306 | // check range of parameters |
---|
| 307 | xConfirmPara( m_iFrameRate <= 0, "Frame rate must be more than 1" ); |
---|
| 308 | xConfirmPara( (m_iSourceWidth % (maxCUWidth >> (maxCUDepth-1)))!=0, "Resulting coded frame width must be a multiple of the minimum CU size"); |
---|
| 309 | xConfirmPara( (m_iSourceHeight % (maxCUHeight >> (maxCUDepth-1)))!=0, "Resulting coded frame height must be a multiple of the minimum CU size"); |
---|
| 310 | xConfirmPara( (m_iIntraPeriod > 0 && m_iIntraPeriod < iGOPSize) || m_iIntraPeriod == 0, "Intra period must be more than GOP size, or -1 , not 0" ); |
---|
| 311 | if (m_cAppEncCfg->getDecodingRefreshType() == 2) |
---|
| 312 | { |
---|
| 313 | xConfirmPara( m_iIntraPeriod > 0 && m_iIntraPeriod <= iGOPSize , "Intra period must be larger than GOP size for periodic IDR pictures"); |
---|
| 314 | } |
---|
| 315 | |
---|
[494] | 316 | #if O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
| 317 | for(UInt layer = 0; layer < MAX_LAYERS; layer++) |
---|
| 318 | { |
---|
| 319 | xConfirmPara( m_iQP < -6 * ((Int)m_cAppEncCfg->getInternalBitDepthY(layer) - 8) || m_iQP > 51, "QP exceeds supported range (-QpBDOffsety to 51)" ); |
---|
| 320 | } |
---|
| 321 | #else |
---|
[313] | 322 | xConfirmPara( m_iQP < -6 * ((Int)m_cAppEncCfg->getInternalBitDepthY() - 8) || m_iQP > 51, "QP exceeds supported range (-QpBDOffsety to 51)" ); |
---|
[494] | 323 | #endif |
---|
[313] | 324 | |
---|
| 325 | |
---|
[494] | 326 | m_iWaveFrontSubstreams = m_cAppEncCfg->getWaveFrontSynchro() ? (m_iSourceHeight + maxCUHeight - 1) / maxCUHeight : 1; |
---|
[313] | 327 | xConfirmPara( m_iWaveFrontSubstreams <= 0, "WaveFrontSubstreams must be positive" ); |
---|
| 328 | xConfirmPara( m_iWaveFrontSubstreams > 1 && !m_cAppEncCfg->getWaveFrontSynchro(), "Must have WaveFrontSynchro > 0 in order to have WaveFrontSubstreams > 1" ); |
---|
| 329 | |
---|
| 330 | //chekc parameters |
---|
| 331 | xConfirmPara( m_iSourceWidth % TComSPS::getWinUnitX(CHROMA_420) != 0, "Picture width must be an integer multiple of the specified chroma subsampling"); |
---|
| 332 | xConfirmPara( m_iSourceHeight % TComSPS::getWinUnitY(CHROMA_420) != 0, "Picture height must be an integer multiple of the specified chroma subsampling"); |
---|
| 333 | |
---|
| 334 | xConfirmPara( m_aiPad[0] % TComSPS::getWinUnitX(CHROMA_420) != 0, "Horizontal padding must be an integer multiple of the specified chroma subsampling"); |
---|
| 335 | xConfirmPara( m_aiPad[1] % TComSPS::getWinUnitY(CHROMA_420) != 0, "Vertical padding must be an integer multiple of the specified chroma subsampling"); |
---|
| 336 | |
---|
[713] | 337 | #if !REPN_FORMAT_IN_VPS |
---|
[313] | 338 | xConfirmPara( m_confLeft % TComSPS::getWinUnitX(CHROMA_420) != 0, "Left conformance window offset must be an integer multiple of the specified chroma subsampling"); |
---|
| 339 | xConfirmPara( m_confRight % TComSPS::getWinUnitX(CHROMA_420) != 0, "Right conformance window offset must be an integer multiple of the specified chroma subsampling"); |
---|
| 340 | xConfirmPara( m_confTop % TComSPS::getWinUnitY(CHROMA_420) != 0, "Top conformance window offset must be an integer multiple of the specified chroma subsampling"); |
---|
| 341 | xConfirmPara( m_confBottom % TComSPS::getWinUnitY(CHROMA_420) != 0, "Bottom conformance window offset must be an integer multiple of the specified chroma subsampling"); |
---|
[713] | 342 | #endif |
---|
[494] | 343 | |
---|
| 344 | #if LAYER_CTB |
---|
| 345 | xConfirmPara( (m_uiMaxCUWidth >> m_uiMaxCUDepth) < 4, "Minimum partition width size should be larger than or equal to 8"); |
---|
| 346 | xConfirmPara( (m_uiMaxCUHeight >> m_uiMaxCUDepth) < 4, "Minimum partition height size should be larger than or equal to 8"); |
---|
| 347 | xConfirmPara( m_uiMaxCUWidth < 16, "Maximum partition width size should be larger than or equal to 16"); |
---|
| 348 | xConfirmPara( m_uiMaxCUHeight < 16, "Maximum partition height size should be larger than or equal to 16"); |
---|
| 349 | xConfirmPara( m_uiQuadtreeTULog2MinSize < 2, "QuadtreeTULog2MinSize must be 2 or greater."); |
---|
| 350 | xConfirmPara( m_uiQuadtreeTULog2MaxSize > 5, "QuadtreeTULog2MaxSize must be 5 or smaller."); |
---|
| 351 | xConfirmPara( (1<<m_uiQuadtreeTULog2MaxSize) > m_uiMaxCUWidth, "QuadtreeTULog2MaxSize must be log2(maxCUSize) or smaller."); |
---|
| 352 | xConfirmPara( m_uiQuadtreeTULog2MaxSize < m_uiQuadtreeTULog2MinSize, "QuadtreeTULog2MaxSize must be greater than or equal to m_uiQuadtreeTULog2MinSize."); |
---|
| 353 | xConfirmPara( (1<<m_uiQuadtreeTULog2MinSize)>(m_uiMaxCUWidth >>(m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than minimum CU size" ); // HS |
---|
| 354 | xConfirmPara( (1<<m_uiQuadtreeTULog2MinSize)>(m_uiMaxCUHeight>>(m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than minimum CU size" ); // HS |
---|
| 355 | xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) > ( m_uiMaxCUWidth >> m_uiMaxCUDepth ), "Minimum CU width must be greater than minimum transform size." ); |
---|
| 356 | xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) > ( m_uiMaxCUHeight >> m_uiMaxCUDepth ), "Minimum CU height must be greater than minimum transform size." ); |
---|
| 357 | xConfirmPara( m_uiQuadtreeTUMaxDepthInter < 1, "QuadtreeTUMaxDepthInter must be greater than or equal to 1" ); |
---|
| 358 | 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" ); |
---|
| 359 | xConfirmPara( m_uiQuadtreeTUMaxDepthIntra < 1, "QuadtreeTUMaxDepthIntra must be greater than or equal to 1" ); |
---|
| 360 | 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" ); |
---|
| 361 | |
---|
| 362 | // max CU width and height should be power of 2 |
---|
| 363 | UInt ui = m_uiMaxCUWidth; |
---|
| 364 | while(ui) |
---|
| 365 | { |
---|
| 366 | ui >>= 1; |
---|
| 367 | if( (ui & 1) == 1) |
---|
| 368 | xConfirmPara( ui != 1 , "Width should be 2^n"); |
---|
| 369 | } |
---|
| 370 | ui = m_uiMaxCUHeight; |
---|
| 371 | while(ui) |
---|
| 372 | { |
---|
| 373 | ui >>= 1; |
---|
| 374 | if( (ui & 1) == 1) |
---|
| 375 | xConfirmPara( ui != 1 , "Height should be 2^n"); |
---|
| 376 | } |
---|
| 377 | #endif |
---|
| 378 | |
---|
[313] | 379 | #undef xConfirmPara |
---|
| 380 | return check_failed; |
---|
| 381 | } |
---|
| 382 | |
---|
[494] | 383 | #endif //SVC_EXTENSION |
---|
[313] | 384 | |
---|
| 385 | |
---|
| 386 | //! \} |
---|