Newer
Older

Karsten Suehring
committed
break;
}
m_frameDeltaQps.push_back(val);
poc++;

Karsten Suehring
committed
}
fclose(fpt);
}
}
if( m_masteringDisplay.colourVolumeSEIEnabled )
{
for(uint32_t idx=0; idx<6; idx++)
{
m_masteringDisplay.primaries[idx/2][idx%2] = uint16_t((cfg_DisplayPrimariesCode.values.size() > idx) ? cfg_DisplayPrimariesCode.values[idx] : 0);
}
for(uint32_t idx=0; idx<2; idx++)
{
m_masteringDisplay.whitePoint[idx] = uint16_t((cfg_DisplayWhitePointCode.values.size() > idx) ? cfg_DisplayWhitePointCode.values[idx] : 0);
}
}
// set sei film grain parameters.
CHECK(!m_fgcSEIEnabled && m_fgcSEIAnalysisEnabled, "FGC SEI must be enabled in order to perform film grain analysis!");
if (m_fgcSEIEnabled)
{
if (m_iQP < 17 && m_fgcSEIAnalysisEnabled == true)
{ // TODO: JVET_Z0047_FG_IMPROVEMENT: check this; the constraint may have gone
msg(WARNING, "*************************************************************************\n");
msg(WARNING, "* WARNING: Film Grain Estimation is disabled for Qp<17! FGC SEI will use default parameters for film grain! *\n");
msg(WARNING, "*************************************************************************\n");
m_fgcSEIAnalysisEnabled = false;
}
if (m_intraPeriod < 1)
{ // low delay configuration
msg(WARNING, "*************************************************************************\n");
msg(WARNING, "* WARNING: For low delay configuration, FGC SEI is inserted for first frame only!*\n");
msg(WARNING, "*************************************************************************\n");
m_fgcSEIPerPictureSEI = false;
m_fgcSEIPersistenceFlag = true;
}
else if (m_intraPeriod == 1)
{ // all intra configuration
msg(WARNING, "*************************************************************************\n");
msg(WARNING, "* WARNING: For Intra Period = 1, FGC SEI is inserted per frame!*\n");
msg(WARNING, "*************************************************************************\n");
m_fgcSEIPerPictureSEI = true;
m_fgcSEIPersistenceFlag = false;
}
if (!m_fgcSEIPerPictureSEI && !m_fgcSEIPersistenceFlag) {
msg(WARNING, "*************************************************************************\n");
msg(WARNING, "* WARNING: SEIPerPictureSEI is set to 0, SEIPersistenceFlag needs to be set to 1! *\n");
msg(WARNING, "*************************************************************************\n");
m_fgcSEIPersistenceFlag = true;
}
else if (m_fgcSEIPerPictureSEI && m_fgcSEIPersistenceFlag) {
msg(WARNING, "*************************************************************************\n");
msg(WARNING, "* WARNING: SEIPerPictureSEI is set to 1, SEIPersistenceFlag needs to be set to 0! *\n");
msg(WARNING, "*************************************************************************\n");
m_fgcSEIPersistenceFlag = false;
}
if (m_fgcSEIAnalysisEnabled && m_fgcSEITemporalFilterStrengths.empty())
{
// By default: in random-acces = filter RAPs, in all-intra = filter every frame, otherwise = filter every 2s
int filteredFrame = m_intraPeriod < 1 ? 2 * m_frameRate.getIntValRound() : m_intraPeriod;
m_fgcSEITemporalFilterStrengths[filteredFrame] = 1.5;
}
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
uint32_t numModelCtr;
if (m_fgcSEICompModelPresent[0])
{
numModelCtr = 0;
for (uint8_t i = 0; i <= m_fgcSEINumIntensityIntervalMinus1[0]; i++)
{
m_fgcSEIIntensityIntervalLowerBound[0][i] = uint32_t((cfg_FgcSEIIntensityIntervalLowerBoundComp0.values.size() > i) ? cfg_FgcSEIIntensityIntervalLowerBoundComp0.values[i] : 10);
m_fgcSEIIntensityIntervalUpperBound[0][i] = uint32_t((cfg_FgcSEIIntensityIntervalUpperBoundComp0.values.size() > i) ? cfg_FgcSEIIntensityIntervalUpperBoundComp0.values[i] : 250);
for (uint8_t j = 0; j <= m_fgcSEINumModelValuesMinus1[0]; j++)
{
m_fgcSEICompModelValue[0][i][j] = uint32_t((cfg_FgcSEICompModelValueComp0.values.size() > numModelCtr) ? cfg_FgcSEICompModelValueComp0.values[numModelCtr] : 24);
numModelCtr++;
}
}
}
if (m_fgcSEICompModelPresent[1])
{
numModelCtr = 0;
for (uint8_t i = 0; i <= m_fgcSEINumIntensityIntervalMinus1[1]; i++)
{
m_fgcSEIIntensityIntervalLowerBound[1][i] = uint32_t((cfg_FgcSEIIntensityIntervalLowerBoundComp1.values.size() > i) ? cfg_FgcSEIIntensityIntervalLowerBoundComp1.values[i] : 60);
m_fgcSEIIntensityIntervalUpperBound[1][i] = uint32_t((cfg_FgcSEIIntensityIntervalUpperBoundComp1.values.size() > i) ? cfg_FgcSEIIntensityIntervalUpperBoundComp1.values[i] : 200);
for (uint8_t j = 0; j <= m_fgcSEINumModelValuesMinus1[1]; j++)
{
m_fgcSEICompModelValue[1][i][j] = uint32_t((cfg_FgcSEICompModelValueComp1.values.size() > numModelCtr) ? cfg_FgcSEICompModelValueComp1.values[numModelCtr] : 16);
numModelCtr++;
}
}
}
if (m_fgcSEICompModelPresent[2])
{
numModelCtr = 0;
for (uint8_t i = 0; i <= m_fgcSEINumIntensityIntervalMinus1[2]; i++)
{
m_fgcSEIIntensityIntervalLowerBound[2][i] = uint32_t((cfg_FgcSEIIntensityIntervalLowerBoundComp2.values.size() > i) ? cfg_FgcSEIIntensityIntervalLowerBoundComp2.values[i] : 60);
m_fgcSEIIntensityIntervalUpperBound[2][i] = uint32_t((cfg_FgcSEIIntensityIntervalUpperBoundComp2.values.size() > i) ? cfg_FgcSEIIntensityIntervalUpperBoundComp2.values[i] : 250);
for (uint8_t j = 0; j <= m_fgcSEINumModelValuesMinus1[2]; j++)
{
m_fgcSEICompModelValue[2][i][j] = uint32_t((cfg_FgcSEICompModelValueComp2.values.size() > numModelCtr) ? cfg_FgcSEICompModelValueComp2.values[numModelCtr] : 12);
numModelCtr++;
}
}
}
m_fgcSEILog2ScaleFactor = m_fgcSEILog2ScaleFactor ? m_fgcSEILog2ScaleFactor : 2;
}
{
CHECK(!m_ctiSEICrossComponentFlag && m_ctiSEICrossComponentInferred, "CTI CrossComponentFlag is 0, but CTI CrossComponentInferred is 1 (must be 0 for CrossComponentFlag 0)");
CHECK(!m_ctiSEICrossComponentFlag && !m_ctiSEICrossComponentInferred && !m_ctiSEINumberChromaLut, "For CTI CrossComponentFlag = 0, CTI NumberChromaLut needs to be specified (1 or 2) ");
CHECK(m_ctiSEICrossComponentFlag && !m_ctiSEICrossComponentInferred && !m_ctiSEINumberChromaLut, "For CTI CrossComponentFlag = 1 and CrossComponentInferred = 0, CTI NumberChromaLut needs to be specified (1 or 2) ");
CHECK(cfg_SEICTILut0.values.empty(), "SEI CTI (SEICTIEnabled) but no LUT0 specified");
m_ctiSEILut[0].presentFlag = true;
m_ctiSEILut[0].numLutValues = (int)cfg_SEICTILut0.values.size();
m_ctiSEILut[0].lutValues = cfg_SEICTILut0.values;
if (!m_ctiSEICrossComponentFlag || (m_ctiSEICrossComponentFlag && !m_ctiSEICrossComponentInferred))
{
CHECK(cfg_SEICTILut1.values.empty(), "SEI CTI LUT1 not specified");
m_ctiSEILut[1].presentFlag = true;
m_ctiSEILut[1].numLutValues = (int)cfg_SEICTILut1.values.size();
m_ctiSEILut[1].lutValues = cfg_SEICTILut1.values;
if (m_ctiSEINumberChromaLut == 1)
{ // Cb lut the same as Cr lut
m_ctiSEILut[2].presentFlag = true;
m_ctiSEILut[2].numLutValues = m_ctiSEILut[1].numLutValues;
m_ctiSEILut[2].lutValues = m_ctiSEILut[1].lutValues;
}
else if (m_ctiSEINumberChromaLut == 2)
{ // read from cfg
CHECK(cfg_SEICTILut2.values.empty(), "SEI CTI LUT2 not specified");
m_ctiSEILut[2].presentFlag = true;
m_ctiSEILut[2].numLutValues = (int)cfg_SEICTILut2.values.size();
m_ctiSEILut[2].lutValues = cfg_SEICTILut2.values;
}
{
CHECK(m_ctiSEINumberChromaLut < 1 && m_ctiSEINumberChromaLut > 2, "Number of chroma LUTs is missing or out of range!");
}
}
// check if lut size is power of 2
for (int idx = 0; idx < MAX_NUM_COMPONENT; idx++)
{
int n = m_ctiSEILut[idx].numLutValues - 1;
CHECK(n > 0 && (n & (n - 1)) != 0, "Size of LUT minus 1 should be power of 2!");
CHECK(n > MAX_CTI_LUT_SIZE, "LUT size minus 1 is larger than MAX_CTI_LUT_SIZE (64)!");
}
}
if ( m_omniViewportSEIEnabled && !m_omniViewportSEICancelFlag )
{
CHECK (!( m_omniViewportSEICntMinus1 >= 0 && m_omniViewportSEICntMinus1 < 16 ), "SEIOmniViewportCntMinus1 must be in the range of 0 to 16");
m_omniViewportSEIAzimuthCentre.resize (m_omniViewportSEICntMinus1+1);
m_omniViewportSEIElevationCentre.resize(m_omniViewportSEICntMinus1+1);
m_omniViewportSEITiltCentre.resize (m_omniViewportSEICntMinus1+1);
m_omniViewportSEIHorRange.resize (m_omniViewportSEICntMinus1+1);
m_omniViewportSEIVerRange.resize (m_omniViewportSEICntMinus1+1);
for(int i=0; i<(m_omniViewportSEICntMinus1+1); i++)
{
m_omniViewportSEIAzimuthCentre[i] = cfg_omniViewportSEIAzimuthCentre .values.size() > i ? cfg_omniViewportSEIAzimuthCentre .values[i] : 0;
m_omniViewportSEIElevationCentre[i] = cfg_omniViewportSEIElevationCentre.values.size() > i ? cfg_omniViewportSEIElevationCentre.values[i] : 0;
m_omniViewportSEITiltCentre[i] = cfg_omniViewportSEITiltCentre .values.size() > i ? cfg_omniViewportSEITiltCentre .values[i] : 0;
m_omniViewportSEIHorRange[i] = cfg_omniViewportSEIHorRange .values.size() > i ? cfg_omniViewportSEIHorRange .values[i] : 0;
m_omniViewportSEIVerRange[i] = cfg_omniViewportSEIVerRange .values.size() > i ? cfg_omniViewportSEIVerRange .values[i] : 0;
}
}
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
if(!m_rwpSEIRwpCancelFlag && m_rwpSEIEnabled)
{
CHECK (!( m_rwpSEINumPackedRegions > 0 && m_rwpSEINumPackedRegions <= std::numeric_limits<uint8_t>::max() ), "SEIRwpNumPackedRegions must be in the range of 1 to 255");
CHECK (!(cfg_rwpSEIRwpTransformType.values.size() == m_rwpSEINumPackedRegions), "Number of must SEIRwpTransformType values be equal to SEIRwpNumPackedRegions");
CHECK (!(cfg_rwpSEIRwpGuardBandFlag.values.size() == m_rwpSEINumPackedRegions), "Number of must SEIRwpGuardBandFlag values must be equal to SEIRwpNumPackedRegions");
CHECK (!(cfg_rwpSEIProjRegionWidth.values.size() == m_rwpSEINumPackedRegions), "Number of must SEIProjRegionWidth values must be equal to SEIRwpNumPackedRegions");
CHECK (!(cfg_rwpSEIProjRegionHeight.values.size() == m_rwpSEINumPackedRegions), "Number of must SEIProjRegionHeight values must be equal to SEIRwpNumPackedRegions");
CHECK (!(cfg_rwpSEIRwpSEIProjRegionTop.values.size() == m_rwpSEINumPackedRegions), "Number of must SEIRwpSEIProjRegionTop values must be equal to SEIRwpNumPackedRegions");
CHECK (!(cfg_rwpSEIProjRegionLeft.values.size() == m_rwpSEINumPackedRegions), "Number of must SEIProjRegionLeft values must be equal to SEIRwpNumPackedRegions");
CHECK (!(cfg_rwpSEIPackedRegionWidth.values.size() == m_rwpSEINumPackedRegions), "Number of must SEIPackedRegionWidth values must be equal to SEIRwpNumPackedRegions");
CHECK (!(cfg_rwpSEIPackedRegionHeight.values.size() == m_rwpSEINumPackedRegions), "Number of must SEIPackedRegionHeight values must be equal to SEIRwpNumPackedRegions");
CHECK (!(cfg_rwpSEIPackedRegionTop.values.size() == m_rwpSEINumPackedRegions), "Number of must SEIPackedRegionTop values must be equal to SEIRwpNumPackedRegions");
CHECK (!(cfg_rwpSEIPackedRegionLeft.values.size() == m_rwpSEINumPackedRegions), "Number of must SEIPackedRegionLeft values must be equal to SEIRwpNumPackedRegions");
m_rwpSEIRwpTransformType.resize(m_rwpSEINumPackedRegions);
m_rwpSEIRwpGuardBandFlag.resize(m_rwpSEINumPackedRegions);
m_rwpSEIProjRegionWidth.resize(m_rwpSEINumPackedRegions);
m_rwpSEIProjRegionHeight.resize(m_rwpSEINumPackedRegions);
m_rwpSEIRwpSEIProjRegionTop.resize(m_rwpSEINumPackedRegions);
m_rwpSEIProjRegionLeft.resize(m_rwpSEINumPackedRegions);
m_rwpSEIPackedRegionWidth.resize(m_rwpSEINumPackedRegions);
m_rwpSEIPackedRegionHeight.resize(m_rwpSEINumPackedRegions);
m_rwpSEIPackedRegionTop.resize(m_rwpSEINumPackedRegions);
m_rwpSEIPackedRegionLeft.resize(m_rwpSEINumPackedRegions);
m_rwpSEIRwpLeftGuardBandWidth.resize(m_rwpSEINumPackedRegions);
m_rwpSEIRwpRightGuardBandWidth.resize(m_rwpSEINumPackedRegions);
m_rwpSEIRwpTopGuardBandHeight.resize(m_rwpSEINumPackedRegions);
m_rwpSEIRwpBottomGuardBandHeight.resize(m_rwpSEINumPackedRegions);
m_rwpSEIRwpGuardBandNotUsedForPredFlag.resize(m_rwpSEINumPackedRegions);
m_rwpSEIRwpGuardBandType.resize(4*m_rwpSEINumPackedRegions);
for( int i=0; i < m_rwpSEINumPackedRegions; i++ )
{
m_rwpSEIRwpTransformType[i] = cfg_rwpSEIRwpTransformType.values[i];
CHECK (!( m_rwpSEIRwpTransformType[i] >= 0 && m_rwpSEIRwpTransformType[i] <= 7 ), "SEIRwpTransformType must be in the range of 0 to 7");
m_rwpSEIRwpGuardBandFlag[i] = cfg_rwpSEIRwpGuardBandFlag.values[i];
m_rwpSEIProjRegionWidth[i] = cfg_rwpSEIProjRegionWidth.values[i];
m_rwpSEIProjRegionHeight[i] = cfg_rwpSEIProjRegionHeight.values[i];
m_rwpSEIRwpSEIProjRegionTop[i] = cfg_rwpSEIRwpSEIProjRegionTop.values[i];
m_rwpSEIProjRegionLeft[i] = cfg_rwpSEIProjRegionLeft.values[i];
m_rwpSEIPackedRegionWidth[i] = cfg_rwpSEIPackedRegionWidth.values[i];
m_rwpSEIPackedRegionHeight[i] = cfg_rwpSEIPackedRegionHeight.values[i];
m_rwpSEIPackedRegionTop[i] = cfg_rwpSEIPackedRegionTop.values[i];
m_rwpSEIPackedRegionLeft[i] = cfg_rwpSEIPackedRegionLeft.values[i];
if( m_rwpSEIRwpGuardBandFlag[i] )
{
m_rwpSEIRwpLeftGuardBandWidth[i] = cfg_rwpSEIRwpLeftGuardBandWidth.values[i];
m_rwpSEIRwpRightGuardBandWidth[i] = cfg_rwpSEIRwpRightGuardBandWidth.values[i];
m_rwpSEIRwpTopGuardBandHeight[i] = cfg_rwpSEIRwpTopGuardBandHeight.values[i];
m_rwpSEIRwpBottomGuardBandHeight[i] = cfg_rwpSEIRwpBottomGuardBandHeight.values[i];
CHECK (! ( m_rwpSEIRwpLeftGuardBandWidth[i] > 0 || m_rwpSEIRwpRightGuardBandWidth[i] > 0 || m_rwpSEIRwpTopGuardBandHeight[i] >0 || m_rwpSEIRwpBottomGuardBandHeight[i] >0 ), "At least one of the RWP guard band parameters mut be greater than zero");
m_rwpSEIRwpGuardBandNotUsedForPredFlag[i] = cfg_rwpSEIRwpGuardBandNotUsedForPredFlag.values[i];
for( int j=0; j < 4; j++ )
{
m_rwpSEIRwpGuardBandType[i*4 + j] = cfg_rwpSEIRwpGuardBandType.values[i*4 + j];
}
}
}
}
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
if (m_gcmpSEIEnabled && !m_gcmpSEICancelFlag)
{
int numFace = m_gcmpSEIPackingType == 4 || m_gcmpSEIPackingType == 5 ? 5 : 6;
CHECK (!(cfg_gcmpSEIFaceIndex.values.size() == numFace), "Number of SEIGcmpFaceIndex must be equal to 5 when SEIGcmpPackingType is equal to 4 or 5, otherwise, it must be equal to 6");
CHECK (!(cfg_gcmpSEIFaceRotation.values.size() == numFace), "Number of SEIGcmpFaceRotation must be equal to 5 when SEIGcmpPackingType is equal to 4 or 5, otherwise, it must be equal to 6");
m_gcmpSEIFaceIndex.resize(numFace);
m_gcmpSEIFaceRotation.resize(numFace);
if (m_gcmpSEIMappingFunctionType == 2)
{
CHECK (!(cfg_gcmpSEIFunctionCoeffU.values.size() == numFace), "Number of SEIGcmpFunctionCoeffU must be equal to 5 when SEIGcmpPackingType is equal to 4 or 5, otherwise, it must be equal to 6");
CHECK (!(cfg_gcmpSEIFunctionUAffectedByVFlag.values.size() == numFace), "Number of SEIGcmpFunctionUAffectedByVFlag must be equal to 5 when SEIGcmpPackingType is equal to 4 or 5, otherwise, it must be equal to 6");
CHECK (!(cfg_gcmpSEIFunctionCoeffV.values.size() == numFace), "Number of SEIGcmpFunctionCoeffV must be equal to 5 when SEIGcmpPackingType is equal to 4 or 5, otherwise, it must be equal to 6");
CHECK (!(cfg_gcmpSEIFunctionVAffectedByUFlag.values.size() == numFace), "Number of SEIGcmpFunctionVAffectedByUFlag must be equal to 5 when SEIGcmpPackingType is equal to 4 or 5, otherwise, it must be equal to 6");
m_gcmpSEIFunctionCoeffU.resize(numFace);
m_gcmpSEIFunctionUAffectedByVFlag.resize(numFace);
m_gcmpSEIFunctionCoeffV.resize(numFace);
m_gcmpSEIFunctionVAffectedByUFlag.resize(numFace);
}
for (int i = 0; i < numFace; i++)
{
m_gcmpSEIFaceIndex[i] = cfg_gcmpSEIFaceIndex.values[i];
m_gcmpSEIFaceRotation[i] = cfg_gcmpSEIFaceRotation.values[i];
if (m_gcmpSEIMappingFunctionType == 2)
{
m_gcmpSEIFunctionCoeffU[i] = cfg_gcmpSEIFunctionCoeffU.values[i];
m_gcmpSEIFunctionUAffectedByVFlag[i] = cfg_gcmpSEIFunctionUAffectedByVFlag.values[i];
m_gcmpSEIFunctionCoeffV[i] = cfg_gcmpSEIFunctionCoeffV.values[i];
m_gcmpSEIFunctionVAffectedByUFlag[i] = cfg_gcmpSEIFunctionVAffectedByUFlag.values[i];
}
}
}
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
if ( m_sdiSEIEnabled )
{
if (m_sdiSEIMultiviewInfoFlag || m_sdiSEIAuxiliaryInfoFlag)
{
m_sdiSEILayerId.resize(m_sdiSEIMaxLayersMinus1 + 1);
m_sdiSEIViewIdVal.resize(m_sdiSEIMaxLayersMinus1 + 1);
m_sdiSEIAuxId.resize(m_sdiSEIMaxLayersMinus1 + 1);
m_sdiSEINumAssociatedPrimaryLayersMinus1.resize(m_sdiSEIMaxLayersMinus1 + 1);
for (int i = 0; i <= m_sdiSEIMaxLayersMinus1; i++)
{
m_sdiSEILayerId[i] = cfg_sdiSEILayerId.values[i];
if (m_sdiSEIMultiviewInfoFlag)
{
m_sdiSEIViewIdVal[i] = cfg_sdiSEIViewIdVal.values[i];
}
if (m_sdiSEIAuxiliaryInfoFlag)
{
m_sdiSEIAuxId[i] = cfg_sdiSEIAuxId.values[i];
if (m_sdiSEIAuxId[i] > 0)
{
m_sdiSEINumAssociatedPrimaryLayersMinus1[i] = cfg_sdiSEINumAssociatedPrimaryLayersMinus1.values[i];
}
}
}
}
}
if ( m_maiSEIEnabled )
{
if (m_maiSEIIntrinsicParamFlag)
{
int numViews = m_maiSEIIntrinsicParamsEqualFlag ? 1 : m_maiSEINumViewsMinus1 + 1;
m_maiSEISignFocalLengthX .resize( numViews );
m_maiSEIExponentFocalLengthX .resize( numViews );
m_maiSEIMantissaFocalLengthX .resize( numViews );
m_maiSEISignFocalLengthY .resize( numViews );
m_maiSEIExponentFocalLengthY .resize( numViews );
m_maiSEIMantissaFocalLengthY .resize( numViews );
m_maiSEISignPrincipalPointX .resize( numViews );
m_maiSEIExponentPrincipalPointX.resize( numViews );
m_maiSEIMantissaPrincipalPointX.resize( numViews );
m_maiSEISignPrincipalPointY .resize( numViews );
m_maiSEIExponentPrincipalPointY.resize( numViews );
m_maiSEIMantissaPrincipalPointY.resize( numViews );
m_maiSEISignSkewFactor .resize( numViews );
m_maiSEIExponentSkewFactor .resize( numViews );
m_maiSEIMantissaSkewFactor .resize( numViews );
for( int i = 0; i <= ( m_maiSEIIntrinsicParamsEqualFlag ? 0 : m_maiSEINumViewsMinus1 ); i++ )
{
m_maiSEISignFocalLengthX [i] = cfg_maiSEISignFocalLengthX.values[i];
m_maiSEIExponentFocalLengthX [i] = cfg_maiSEIExponentFocalLengthX.values[i];
m_maiSEIMantissaFocalLengthX [i] = cfg_maiSEIMantissaFocalLengthX.values[i];
m_maiSEISignFocalLengthY [i] = cfg_maiSEISignFocalLengthY.values[i];
m_maiSEIExponentFocalLengthY [i] = cfg_maiSEIExponentFocalLengthY.values[i];
m_maiSEIMantissaFocalLengthY [i] = cfg_maiSEIMantissaFocalLengthY.values[i];
m_maiSEISignPrincipalPointX [i] = cfg_maiSEISignPrincipalPointX.values[i];
m_maiSEIExponentPrincipalPointX[i] = cfg_maiSEIExponentPrincipalPointX.values[i];
m_maiSEIMantissaPrincipalPointX[i] = cfg_maiSEIMantissaPrincipalPointX.values[i];
m_maiSEISignPrincipalPointY [i] = cfg_maiSEISignPrincipalPointY.values[i];
m_maiSEIExponentPrincipalPointY[i] = cfg_maiSEIExponentPrincipalPointY.values[i];
m_maiSEIMantissaPrincipalPointY[i] = cfg_maiSEIMantissaPrincipalPointY.values[i];
m_maiSEISignSkewFactor [i] = cfg_maiSEISignSkewFactor.values[i];
m_maiSEIExponentSkewFactor [i] = cfg_maiSEIExponentSkewFactor.values[i];
m_maiSEIMantissaSkewFactor [i] = cfg_maiSEIMantissaSkewFactor.values[i];
}
}
}
if (m_mvpSEIEnabled)
{
int numViews = m_mvpSEINumViewsMinus1 + 1;
m_mvpSEIViewPosition.resize(numViews);
for (int i = 0; i <= m_mvpSEINumViewsMinus1; i++)
{
m_mvpSEIViewPosition[i] = cfg_mvpSEIViewPosition.values[i];
if ( m_driSEIEnabled )
{
m_driSEINonlinearModel.resize(m_driSEINonlinearNumMinus1+1);
for(int i=0; i<(m_driSEINonlinearNumMinus1+1); i++)
{
m_driSEINonlinearModel[i] = cfg_driSEINonlinearModel.values.size() > i ? cfg_driSEINonlinearModel.values[i] : 0;
}
}
m_reshapeCW.rspFps = m_frameRate.getIntValRound();
m_reshapeCW.rspPicSize = m_sourceWidth*m_sourceHeight;
m_reshapeCW.rspFpsToIp = std::max(16, 16 * (int) (round(m_frameRate.getFloatVal() / 16.0)));
m_reshapeCW.updateCtrl = m_updateCtrl;
m_reshapeCW.adpOption = m_adpOption;
m_reshapeCW.initialCW = m_initialCW;

Karsten Suehring
committed
#if ENABLE_TRACING
g_trace_ctx = tracing_init(sTracingFile, sTracingRule);
if( bTracingChannelsList && g_trace_ctx )
{
std::string sChannelsList;
g_trace_ctx->getChannelsList( sChannelsList );
msg( INFO, "\n Using tracing channels:\n\n%s\n", sChannelsList.c_str() );
}
#endif
#if ENABLE_QPA

Christian Helmrich
committed
if (m_bUsePerceptQPA && !m_bUseAdaptiveQP && m_dualTree && (m_cbQpOffsetDualTree != 0 || m_crQpOffsetDualTree != 0 || m_cbCrQpOffsetDualTree != 0))
{
msg( WARNING, "*************************************************************************\n" );
msg( WARNING, "* WARNING: chroma QPA on, ignoring nonzero dual-tree chroma QP offsets! *\n" );
msg( WARNING, "*************************************************************************\n" );
}

Christian Helmrich
committed
#if ENABLE_QPA_SUB_CTU
if ((m_iQP < 38) && m_bUsePerceptQPA && !m_bUseAdaptiveQP && (m_sourceWidth <= 2048) && (m_sourceHeight <= 1280)
&& (!m_wcgChromaQpControl.enabled)
#endif
&& ((1 << (m_log2MaxTbSize + 1)) == m_ctuSize) && (m_sourceWidth > 512 || m_sourceHeight > 320))

Christian Helmrich
committed
{

Christian Helmrich
committed
}
#else
if ((m_iQP < 38) && (m_gopSize > 4) && m_bUsePerceptQPA && !m_bUseAdaptiveQP && (m_sourceHeight <= 1280)
&& (m_sourceWidth <= 2048))

Karsten Suehring
committed
{
msg( WARNING, "*************************************************************************\n" );
msg( WARNING, "* WARNING: QPA on with large CTU for <=HD sequences, limiting CTU size! *\n" );
msg( WARNING, "*************************************************************************\n" );

Karsten Suehring
committed
m_ctuSize = m_maxCuWidth;
if ((1u << m_log2MaxTbSize) > m_ctuSize)
{
m_log2MaxTbSize--;
}

Karsten Suehring
committed
}

Christian Helmrich
committed
#endif
#endif // ENABLE_QPA

Karsten Suehring
committed
Jeeva Raj A
committed
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
#if JVET_Z0120_SII_SEI_PROCESSING
m_ShutterFilterEnable = false;
#endif
if (m_siiSEIEnabled)
{
assert(m_siiSEITimeScale >= 0 && m_siiSEITimeScale <= MAX_UINT);
uint32_t sii_max_sub_layers = (uint32_t)cfg_siiSEIInputNumUnitsInSI.values.size();
assert(sii_max_sub_layers > 0);
if (sii_max_sub_layers > 1)
{
m_siiSEISubLayerNumUnitsInSI.resize(sii_max_sub_layers);
for (int32_t i = 0; i < sii_max_sub_layers; i++)
{
m_siiSEISubLayerNumUnitsInSI[i] = cfg_siiSEIInputNumUnitsInSI.values[i];
assert(m_siiSEISubLayerNumUnitsInSI[i] >= 0 && m_siiSEISubLayerNumUnitsInSI[i] <= MAX_UINT);
}
}
else
{
m_siiSEINumUnitsInShutterInterval = cfg_siiSEIInputNumUnitsInSI.values[0];
assert(m_siiSEINumUnitsInShutterInterval >= 0 && m_siiSEINumUnitsInShutterInterval <= MAX_UINT);
}
#if JVET_Z0120_SII_SEI_PROCESSING
uint32_t siiMaxSubLayersMinus1 = sii_max_sub_layers - 1;
int blending_ratio = (m_siiSEISubLayerNumUnitsInSI[0] / m_siiSEISubLayerNumUnitsInSI[siiMaxSubLayersMinus1]);
if (sii_max_sub_layers > 1 && m_siiSEISubLayerNumUnitsInSI[0] ==
(blending_ratio * m_siiSEISubLayerNumUnitsInSI[siiMaxSubLayersMinus1]))
{
m_ShutterFilterEnable = true;
double fpsHFR = m_frameRate.getFloatVal();
Jeeva Raj A
committed
int32_t i;
bool checkEqualValuesOfSFR = true;
bool checkSubLayerSI = false;
Jeeva Raj A
committed
double shutterAngleFactor = (fpsHFR * ((double)(m_siiSEISubLayerNumUnitsInSI[siiMaxSubLayersMinus1])))/((double)m_siiSEITimeScale);
// If shutterAngleFactor = 1 indicates that shutterAngle = 360
Jeeva Raj A
committed
// If shutterAngleFactor = 0.5 indicates that shutterAngle = 180
// If shutterAngleFactor = 0.25 indicates that shutterAngle = 90
if (shutterAngleFactor < 0.5)
{
for (int i = 0; i < siiMaxSubLayersMinus1; i++)
{
m_siiSEISubLayerNumUnitsInSI[i] = m_siiSEISubLayerNumUnitsInSI[siiMaxSubLayersMinus1];
}
m_ShutterFilterEnable = false;
printf("Warning: For the shutterAngle = %d, the blending can't be applied\n", (int)(shutterAngleFactor * 360));
}
// supports only the case of SFR = HFR / 2
Jeeva Raj A
committed
if (m_siiSEISubLayerNumUnitsInSI[siiMaxSubLayersMinus1] < m_siiSEISubLayerNumUnitsInSI[siiMaxSubLayersMinus1 - 1])
{
Jeeva Raj A
committed
}
// check shutter interval for all sublayer remains same for LFR pictures
for (i = 1; i < siiMaxSubLayersMinus1; i++)
{
if (m_siiSEISubLayerNumUnitsInSI[0] != m_siiSEISubLayerNumUnitsInSI[i])
{
checkEqualValuesOfSFR = false;
Jeeva Raj A
committed
}
}
if (checkSubLayerSI && checkEqualValuesOfSFR)
{
setBlendingRatioSII(blending_ratio);
}
else
{
m_ShutterFilterEnable = false;
}
}
else
{
printf("Warning: SII-processing is applied for multiple shutter intervals and number of LFR units should be 2 times of number of HFR units\n");
}
#endif
}
if (m_poSEIEnabled)
{
assert(cfg_poSEIPayloadType.values.size() > 1);
assert(cfg_poSEIProcessingOrder.values.size() == cfg_poSEIPayloadType.values.size());
m_poSEIPayloadType.resize((uint32_t) cfg_poSEIPayloadType.values.size());
m_poSEIProcessingOrder.resize((uint32_t) cfg_poSEIPayloadType.values.size());
m_poSEIPrefixByte.resize((uint32_t) cfg_poSEIPayloadType.values.size());
uint16_t prefixByteIdx = 0;
for (uint32_t i = 0; i < (uint32_t) cfg_poSEIPayloadType.values.size(); i++)
m_poSEIPayloadType[i] = cfg_poSEIPayloadType.values[i];
m_poSEIProcessingOrder[i] = (uint16_t) cfg_poSEIProcessingOrder.values[i];
if (m_poSEIPayloadType[i] == (uint16_t) SEI::PayloadType::USER_DATA_REGISTERED_ITU_T_T35)
m_poSEIPrefixByte[i].resize(cfg_poSEINumofPrefixByte.values[i]);
for (uint32_t j = 0; j < cfg_poSEINumofPrefixByte.values[i]; j++)
m_poSEIPrefixByte[i][j] = (uint8_t) cfg_poSEIPrefixByte.values[prefixByteIdx++];
}
}
// Error check, to avoid same PayloadType and same prefix bytes when present with different PayloadOrder
for (uint32_t j = 0; j < i; j++)
{
auto payloadType = SEI::PayloadType(cfg_poSEIPayloadType.values[i]);
if (payloadType == SEI::PayloadType::USER_DATA_REGISTERED_ITU_T_T35)
{
for (uint32_t j = 0; j < i; j++)
{
if (m_poSEIPayloadType[j] == m_poSEIPayloadType[i])
auto numofPrefixBytes = std::min(cfg_poSEINumofPrefixByte.values[i], cfg_poSEINumofPrefixByte.values[j]);
if (std::equal(m_poSEIPrefixByte[i].begin() + 1, m_poSEIPrefixByte[i].begin() + numofPrefixBytes - 1,
m_poSEIPrefixByte[j].begin()))
{
assert(m_poSEIProcessingOrder[j] == m_poSEIProcessingOrder[i]);
}
}
}
}
}
}
// Error check, to avoid all SEI messages share the same PayloadOrder
assert(!std::equal(cfg_poSEIProcessingOrder.values.begin() + 1, cfg_poSEIProcessingOrder.values.end(),
cfg_poSEIProcessingOrder.values.begin()));
assert(m_poSEIPayloadType.size() > 0);
assert(m_poSEIProcessingOrder.size() == m_poSEIPayloadType.size());
}
if (m_postFilterHintSEIEnabled)
{
CHECK(cfg_postFilterHintSEIValues.values.size() <= 0, "The number of filter coefficient shall be greater than zero");
CHECK(!(cfg_postFilterHintSEIValues.values.size() == ((m_postFilterHintSEIChromaCoeffPresentFlag ? 3 : 1) * m_postFilterHintSEISizeY * m_postFilterHintSEISizeX)), "The number of filter coefficient shall match the matrix size and considering whether filters for chroma is present of not");
m_postFilterHintValues.resize(cfg_postFilterHintSEIValues.values.size());
for (uint32_t i = 0; i < m_postFilterHintValues.size(); i++)
{
m_postFilterHintValues[i] = cfg_postFilterHintSEIValues.values[i];
}
}
if( m_costMode == COST_LOSSLESS_CODING )
{
bool firstSliceLossless = false;
if (m_mixedLossyLossless)
{
if (m_sliceLosslessArray.size() > 0)
{
for (uint32_t i = 0; i < m_sliceLosslessArray.size(); i++)
{
if (m_sliceLosslessArray[i] == 0)
{
firstSliceLossless = true;
break;
}
}
}
}
else
{
firstSliceLossless = true;
}
if (firstSliceLossless) // if first slice is lossless
m_iQP = LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP - ((m_internalBitDepth[ChannelType::LUMA] - 8) * 6);
}

Karsten Suehring
committed
// check validity of input parameters
if( xCheckParameter() )
{
// return check failed
return false;
}
// print-out parameters
xPrintParameter();
return true;
}
#ifdef _MSC_VER
// Restore optimizations

Karsten Suehring
committed
// ====================================================================================================================
// Private member functions
// ====================================================================================================================
///< auto determine the profile to use given the other configuration settings. Returns 1 if erred. Can select profile 'NONE'
int EncAppCfg::xAutoDetermineProfile()
{
const int maxBitDepth =
std::max(m_internalBitDepth[ChannelType::LUMA], m_internalBitDepth[getLastChannel(m_chromaFormatIdc)]);
m_profile=Profile::NONE;
case ChromaFormat::_400:
case ChromaFormat::_420:
if (m_level == Level::LEVEL15_5 && m_framesToBeEncoded == 1)
{
m_profile = m_maxLayers > 1 ? Profile::MULTILAYER_MAIN_10_STILL_PICTURE : Profile::MAIN_10_STILL_PICTURE;
}
else
{
m_profile = m_maxLayers > 1 ? Profile::MULTILAYER_MAIN_10 : Profile::MAIN_10;
}
Tomohiro Ikai
committed
else if (maxBitDepth <= 12)
{
m_profile = (m_level == Level::LEVEL15_5 && m_framesToBeEncoded == 1) ? Profile::MAIN_12_STILL_PICTURE
: (m_intraPeriod == 1) ? Profile::MAIN_12_INTRA
: Profile::MAIN_12;
Tomohiro Ikai
committed
}
else if (maxBitDepth <= 16)
{
// Since there's no 16bit 420 profiles in VVC, we use 444 profiles.
m_profile = (m_level == Level::LEVEL15_5 && m_framesToBeEncoded == 1) ? Profile::MAIN_16_444_STILL_PICTURE
: (m_intraPeriod == 1) ? Profile::MAIN_16_444_INTRA
: Profile::MAIN_16_444;
Tomohiro Ikai
committed
}
case ChromaFormat::_422:
case ChromaFormat::_444:
if (m_level == Level::LEVEL15_5 && m_framesToBeEncoded == 1)
{
m_profile =
m_maxLayers > 1 ? Profile::MULTILAYER_MAIN_10_444_STILL_PICTURE : Profile::MAIN_10_444_STILL_PICTURE;
}
else
{
m_profile = m_maxLayers > 1 ? Profile::MULTILAYER_MAIN_10_444 : Profile::MAIN_10_444;
}
Tomohiro Ikai
committed
else if (maxBitDepth <= 12)
{
m_profile = (m_level == Level::LEVEL15_5 && m_framesToBeEncoded == 1) ? Profile::MAIN_12_444_STILL_PICTURE
: (m_intraPeriod == 1) ? Profile::MAIN_12_444_INTRA
: Profile::MAIN_12_444;
Tomohiro Ikai
committed
}
else if (maxBitDepth <= 16)
{
m_profile = (m_level == Level::LEVEL15_5 && m_framesToBeEncoded == 1) ? Profile::MAIN_16_444_STILL_PICTURE
: (m_intraPeriod == 1) ? Profile::MAIN_16_444_INTRA
: Profile::MAIN_16_444;
Tomohiro Ikai
committed
}
Adrian Browne
committed
if (m_profile == Profile::MAIN_12_INTRA || m_profile == Profile::MAIN_12_444_INTRA || m_profile == Profile::MAIN_16_444_INTRA ||
m_profile == Profile::MAIN_12_STILL_PICTURE || m_profile == Profile::MAIN_12_444_STILL_PICTURE || m_profile == Profile::MAIN_16_444_STILL_PICTURE)
{
m_allRapPicturesFlag = 1;
}

Karsten Suehring
committed
bool EncAppCfg::xCheckParameter()
{
msg( NOTICE, "\n" );
if (m_decodedPictureHashSEIType == HashType::NONE)

Karsten Suehring
committed
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
{
msg( DETAILS, "******************************************************************\n");
msg( DETAILS, "** WARNING: --SEIDecodedPictureHash is now disabled by default. **\n");
msg( DETAILS, "** Automatic verification of decoded pictures by a **\n");
msg( DETAILS, "** decoder requires this option to be enabled. **\n");
msg( DETAILS, "******************************************************************\n");
}
if( m_profile==Profile::NONE )
{
msg( DETAILS, "***************************************************************************\n");
msg( DETAILS, "** WARNING: For conforming bitstreams a valid Profile value must be set! **\n");
msg( DETAILS, "***************************************************************************\n");
}
if( m_level==Level::NONE )
{
msg( DETAILS, "***************************************************************************\n");
msg( DETAILS, "** WARNING: For conforming bitstreams a valid Level value must be set! **\n");
msg( DETAILS, "***************************************************************************\n");
}
bool check_failed = false; /* abort if there is a fatal configuration problem */
#define xConfirmPara(a,b) check_failed |= confirmPara(a,b)
xConfirmPara(m_alfapsIDShift < 0, "ALF APSs shift should be positive");
xConfirmPara(m_alfapsIDShift + m_maxNumAlfAps > ALF_CTB_MAX_NUM_APS, "The number of ALF APSs should not be more than ALF_CTB_MAX_NUM_APS");

Karsten Suehring
committed
if( m_depQuantEnabledFlag )
{
xConfirmPara( !m_useRDOQ || !m_useRDOQTS, "RDOQ and RDOQTS must be equal to 1 if dependent quantization is enabled" );
xConfirmPara( m_signDataHidingEnabledFlag, "SignHideFlag must be equal to 0 if dependent quantization is enabled" );
}

Karsten Suehring
committed
const int minCUSize = 1 << m_log2MinCuSize;
xConfirmPara(m_wrapAroundOffset <= m_ctuSize + minCUSize,
"Wrap-around offset must be greater than CtbSizeY + MinCbSize");
xConfirmPara(m_wrapAroundOffset > m_sourceWidth, "Wrap-around offset must not be greater than the source picture width");

Karsten Suehring
committed
xConfirmPara( m_wrapAroundOffset % minCUSize != 0, "Wrap-around offset must be an integer multiple of the specified minimum CU size" );

Karsten Suehring
committed
}
#if SHARP_LUMA_DELTA_QP && ENABLE_QPA
xConfirmPara( m_bUsePerceptQPA && m_lumaLevelToDeltaQPMapping.mode >= 2, "QPA and SharpDeltaQP mode 2 cannot be used together" );
if( m_bUsePerceptQPA && m_lumaLevelToDeltaQPMapping.mode == LUMALVL_TO_DQP_AVG_METHOD )
{
msg( WARNING, "*********************************************************************************\n" );
msg( WARNING, "** WARNING: Applying custom luma-based QPA with activity-based perceptual QPA! **\n" );
msg( WARNING, "*********************************************************************************\n" );
m_lumaLevelToDeltaQPMapping.mode = LUMALVL_TO_DQP_NUM_MODES; // special QPA mode
}
#endif
xConfirmPara( m_useAMaxBT && !m_SplitConsOverrideEnabledFlag, "AMaxBt can only be used with PartitionConstriantsOverride enabled" );

Karsten Suehring
committed
xConfirmPara(m_bitstreamFileName.empty(), "A bitstream file name must be specified (BitstreamFile)");
xConfirmPara(m_internalBitDepth[ChannelType::CHROMA] != m_internalBitDepth[ChannelType::LUMA],
"The internalBitDepth must be the same for luma and chroma");
{
xConfirmPara(m_log2MaxTransformSkipBlockSize>=6, "Transform Skip Log2 Max Size must be less or equal to 5 for given profile.");
xConfirmPara(m_transformSkipRotationEnabledFlag==true, "UseResidualRotation must not be enabled for given profile.");
xConfirmPara(m_transformSkipContextEnabledFlag==true, "UseSingleSignificanceMapContext must not be enabled for given profile.");
xConfirmPara(m_highPrecisionOffsetsEnabledFlag==true, "UseHighPrecisionPredictionWeighting must not be enabled for given profile.");
xConfirmPara(m_cabacBypassAlignmentEnabledFlag, "AlignCABACBeforeBypass cannot be enabled for given profile.");
}
Tomohiro Ikai
committed
if (m_profile != Profile::NONE && m_profile != Profile::MAIN_12_444 && m_profile != Profile::MAIN_16_444 && m_profile != Profile::MAIN_12_444_INTRA && m_profile != Profile::MAIN_16_444_INTRA && m_profile != Profile::MAIN_12_444_STILL_PICTURE && m_profile != Profile::MAIN_12_444_STILL_PICTURE && m_profile != Profile::MAIN_16_444_STILL_PICTURE)
{
xConfirmPara(m_rrcRiceExtensionEnableFlag == true, "Extention of the Golomb-Rice parameter derivation for RRC must not be enabled for given profile.");
xConfirmPara(m_persistentRiceAdaptationEnabledFlag==true, "GolombRiceParameterAdaption must not be enabled for given profile.");
xConfirmPara(m_extendedPrecisionProcessingFlag==true, "UseExtendedPrecision must not be enabled for given profile.");
Hong-Jheng Jhu
committed
xConfirmPara(m_tsrcRicePresentFlag == true, "TSRCRicePresent must not be enabled for given profile.");
Tomohiro Ikai
committed
xConfirmPara(m_reverseLastSigCoeffEnabledFlag == true, "ReverseLastSigCoeff must not be enabled for given profile.");

Karsten Suehring
committed
// check range of parameters
xConfirmPara(m_inputBitDepth[ChannelType::LUMA] < 8, "InputBitDepth must be at least 8");
xConfirmPara(m_inputBitDepth[ChannelType::CHROMA] < 8, "InputBitDepthC must be at least 8");

Karsten Suehring
committed
if ((m_internalBitDepth[ChannelType::LUMA] < m_inputBitDepth[ChannelType::LUMA])
|| (m_internalBitDepth[ChannelType::CHROMA] < m_inputBitDepth[ChannelType::CHROMA]))
{
msg(WARNING, "*****************************************************************************\n");
msg(WARNING, "** WARNING: InternalBitDepth is set to the lower value than InputBitDepth! **\n");
msg(WARNING, "** min_qp_prime_ts_minus4 will be clipped to 0 at the low end! **\n");
msg(WARNING, "*****************************************************************************\n");
}
Alexey Filippov
committed
#if !RExt__HIGH_BIT_DEPTH_SUPPORT

Karsten Suehring
committed
if (m_extendedPrecisionProcessingFlag)
{

Karsten Suehring
committed
{
xConfirmPara((bd > 8), "Model is not configured to support high enough internal accuracies - enable "
"RExt__HIGH_BIT_DEPTH_SUPPORT to use increased precision internal data types etc...");

Karsten Suehring
committed
}
}
else
{

Karsten Suehring
committed
{
xConfirmPara((bd > 12), "Model is not configured to support high enough internal accuracies - enable "
"RExt__HIGH_BIT_DEPTH_SUPPORT to use increased precision internal data types etc...");

Karsten Suehring
committed
}
}
Alexey Filippov
committed
#endif

Karsten Suehring
committed
xConfirmPara((m_msbExtendedBitDepth[ChannelType::LUMA] < m_inputBitDepth[ChannelType::LUMA]),
"MSB-extended bit depth for luma channel (--MSBExtendedBitDepth) must be greater than or equal to input "
"bit depth for luma channel (--InputBitDepth)");
xConfirmPara((m_msbExtendedBitDepth[ChannelType::CHROMA] < m_inputBitDepth[ChannelType::CHROMA]),
"MSB-extended bit depth for chroma channel (--MSBExtendedBitDepthC) must be greater than or equal to "
"input bit depth for chroma channel (--InputBitDepthC)");

Karsten Suehring
committed
bool check_sps_range_extension_flag = m_extendedPrecisionProcessingFlag || m_rrcRiceExtensionEnableFlag
|| m_persistentRiceAdaptationEnabledFlag || m_tsrcRicePresentFlag;
if (m_internalBitDepth[ChannelType::LUMA] <= 10)
{
Takeshi Tsukuba
committed
xConfirmPara( (check_sps_range_extension_flag == 1) ,
"RExt tools (Extended Precision Processing, RRC Rice Extension, Persistent Rice Adaptation and TSRC Rice Extension) must be disabled for BitDepth is less than or equal to 10 (the value of sps_range_extension_flag shall be 0 when BitDepth is less than or equal to 10.)");
xConfirmPara(m_chromaFormatIdc >= ChromaFormat::NUM, "ChromaFormatIDC must be either 400, 420, 422 or 444");

Karsten Suehring
committed
std::string sTempIPCSC="InputColourSpaceConvert must be empty, "+getListOfColourSpaceConverts(true);
xConfirmPara( m_inputColourSpaceConvert >= NUMBER_INPUT_COLOUR_SPACE_CONVERSIONS, sTempIPCSC.c_str() );
xConfirmPara(m_inputChromaFormatIDC >= ChromaFormat::NUM, "InputChromaFormatIDC must be either 400, 420, 422 or 444");
xConfirmPara(m_frameRate.getFloatVal() <= 0, "Frame rate cannot be 0 or less");

Karsten Suehring
committed
xConfirmPara( m_framesToBeEncoded <= 0, "Total Number Of Frames encoded must be more than 0" );
xConfirmPara( m_framesToBeEncoded < m_switchPOC, "debug POC out of range" );
xConfirmPara(m_gopSize < 1, "GOP Size must be greater or equal to 1");
xConfirmPara(m_gopSize > 1 && m_gopSize % 2, "GOP Size must be a multiple of 2, if GOP Size is greater than 1");
xConfirmPara((m_intraPeriod > 0 && m_intraPeriod < m_gopSize) || m_intraPeriod == 0,
"Intra period must be more than GOP size, or -1 , not 0");
xConfirmPara( m_drapPeriod < 0, "DRAP period must be greater or equal to 0" );
xConfirmPara( m_edrapPeriod < 0, "EDRAP period must be greater or equal to 0" );
xConfirmPara(m_intraRefreshType < 0 || m_intraRefreshType > 3,
"Decoding Refresh Type must be comprised between 0 and 3 included");

Karsten Suehring
committed
if (m_isField)
{
if (!m_frameFieldInfoSEIEnabled)
{
msg( WARNING, "*************************************************************************************\n");
msg( WARNING, "** WARNING: Frame field information SEI should be enabled for field coding! **\n");
msg( WARNING, "*************************************************************************************\n");
}

Karsten Suehring
committed
}

Karsten Suehring
committed
if ( m_pictureTimingSEIEnabled && (!m_bufferingPeriodSEIEnabled))
{
msg( WARNING, "****************************************************************************\n");
msg( WARNING, "** WARNING: Picture Timing SEI requires Buffering Period SEI. Disabling. **\n");
msg( WARNING, "****************************************************************************\n");
m_pictureTimingSEIEnabled = false;
}

Karsten Suehring
committed

Karsten Suehring
committed
xConfirmPara( m_bufferingPeriodSEIEnabled == true && m_RCCpbSize == 0, "RCCpbSize must be greater than zero, when buffering period SEI is enabled" );

Karsten Suehring
committed
xConfirmPara (m_log2MaxTransformSkipBlockSize < 2, "Transform Skip Log2 Max Size must be at least 2 (4x4)");
xConfirmPara ( m_onePictureOnlyConstraintFlag && m_framesToBeEncoded!=1, "When onePictureOnlyConstraintFlag is true, the number of frames to be encoded must be 1" );
if (m_profile != Profile::NONE)
{
const ProfileFeatures *features = ProfileFeatures::getProfileFeatures(m_profile);
CHECK(features->profile != m_profile, "Profile not found");
xConfirmPara(m_level == Level::LEVEL15_5 && !features->canUseLevel15p5, "Profile does not support level 15.5");
xConfirmPara(m_level < Level::LEVEL4 && m_levelTier == Level::HIGH, "High tier not defined for levels below 4.");

Karsten Suehring
committed
xConfirmPara(m_iQP < -6 * (m_internalBitDepth[ChannelType::LUMA] - 8) || m_iQP > MAX_QP,
"QP exceeds supported range (-QpBDOffsety to 63)");
xConfirmPara( m_deblockingFilterMetric!=0 && (m_deblockingFilterDisable || m_deblockingFilterOffsetInPPS), "If DeblockingFilterMetric is non-zero then both LoopFilterDisable and LoopFilterOffsetInPPS must be 0");
xConfirmPara( m_deblockingFilterBetaOffsetDiv2 < -12 || m_deblockingFilterBetaOffsetDiv2 > 12, "Loop Filter Beta Offset div. 2 exceeds supported range (-12 to 12" );
xConfirmPara( m_deblockingFilterTcOffsetDiv2 < -12 || m_deblockingFilterTcOffsetDiv2 > 12, "Loop Filter Tc Offset div. 2 exceeds supported range (-12 to 12)" );
xConfirmPara( m_deblockingFilterCbBetaOffsetDiv2 < -12 || m_deblockingFilterCbBetaOffsetDiv2 > 12, "Loop Filter Beta Offset div. 2 exceeds supported range (-12 to 12" );
xConfirmPara( m_deblockingFilterCbTcOffsetDiv2 < -12 || m_deblockingFilterCbTcOffsetDiv2 > 12, "Loop Filter Tc Offset div. 2 exceeds supported range (-12 to 12)" );
xConfirmPara( m_deblockingFilterCrBetaOffsetDiv2 < -12 || m_deblockingFilterCrBetaOffsetDiv2 > 12, "Loop Filter Beta Offset div. 2 exceeds supported range (-12 to 12" );
xConfirmPara( m_deblockingFilterCrTcOffsetDiv2 < -12 || m_deblockingFilterCrTcOffsetDiv2 > 12, "Loop Filter Tc Offset div. 2 exceeds supported range (-12 to 12)" );

Karsten Suehring
committed
xConfirmPara( m_iSearchRange < 0 , "Search Range must be more than 0" );
xConfirmPara( m_bipredSearchRange < 0 , "Bi-prediction refinement search range must be more than 0" );
xConfirmPara( m_minSearchWindow < 0, "Minimum motion search window size for the adaptive window ME must be greater than or equal to 0" );
xConfirmPara( m_iMaxDeltaQP > MAX_DELTA_QP, "Absolute Delta QP exceeds supported range (0 to 7)" );
#if ENABLE_QPA
xConfirmPara( m_bUsePerceptQPA && m_uiDeltaQpRD > 0, "Perceptual QPA cannot be used together with slice-level multiple-QP optimization" );
#endif

Karsten Suehring
committed
#if SHARP_LUMA_DELTA_QP
xConfirmPara( m_lumaLevelToDeltaQPMapping.mode && m_uiDeltaQpRD > 0, "Luma-level-based Delta QP cannot be used together with slice level multiple-QP optimization\n" );
Taoran Lu
committed
xConfirmPara( m_lumaLevelToDeltaQPMapping.mode && m_RCEnableRateControl, "Luma-level-based Delta QP cannot be used together with rate control\n" );

Karsten Suehring
committed
#endif
if (m_lumaLevelToDeltaQPMapping.mode && m_lmcsEnabled)
msg(WARNING, "For HDR-PQ, LMCS should be used mutual-exclusively with Luma-level-based Delta QP. If use LMCS, turn lumaDQP off.\n");
m_lumaLevelToDeltaQPMapping.mode = LUMALVL_TO_DQP_DISABLED;
if (!m_lmcsEnabled)
if (m_lmcsEnabled && m_reshapeSignalType == RESHAPE_SIGNAL_PQ)
else if (m_lmcsEnabled && (m_reshapeSignalType == RESHAPE_SIGNAL_SDR || m_reshapeSignalType == RESHAPE_SIGNAL_HLG))
m_lmcsEnabled = false;
if (m_lmcsEnabled)
{
xConfirmPara(m_updateCtrl < 0, "Min. LMCS Update Control is 0");
xConfirmPara(m_updateCtrl > 2, "Max. LMCS Update Control is 2");
xConfirmPara(m_adpOption < 0, "Min. LMCS Adaptation Option is 0");
xConfirmPara(m_adpOption > 4, "Max. LMCS Adaptation Option is 4");
xConfirmPara(m_initialCW < 0, "Min. Initial Total Codeword is 0");
xConfirmPara(m_initialCW > 1023, "Max. Initial Total Codeword is 1023");
xConfirmPara(m_CSoffset < -7, "Min. LMCS Offset value is -7");
xConfirmPara(m_CSoffset > 7, "Max. LMCS Offset value is 7");
if (m_updateCtrl > 0 && m_adpOption > 2) { m_adpOption -= 2; }
}

Karsten Suehring
committed
if (m_ctiSEIEnabled)
{
xConfirmPara(m_ctiSEINumberChromaLut < 0 || m_ctiSEINumberChromaLut > 2, "CTI number of chroma LUTs is out of range");
}

Karsten Suehring
committed
xConfirmPara( m_cbQpOffset < -12, "Min. Chroma Cb QP Offset is -12" );
xConfirmPara( m_cbQpOffset > 12, "Max. Chroma Cb QP Offset is 12" );
xConfirmPara( m_crQpOffset < -12, "Min. Chroma Cr QP Offset is -12" );
xConfirmPara( m_crQpOffset > 12, "Max. Chroma Cr QP Offset is 12" );
xConfirmPara( m_cbQpOffsetDualTree < -12, "Min. Chroma Cb QP Offset for dual tree is -12" );
xConfirmPara( m_cbQpOffsetDualTree > 12, "Max. Chroma Cb QP Offset for dual tree is 12" );
xConfirmPara( m_crQpOffsetDualTree < -12, "Min. Chroma Cr QP Offset for dual tree is -12" );
xConfirmPara( m_crQpOffsetDualTree > 12, "Max. Chroma Cr QP Offset for dual tree is 12" );
if (m_dualTree && !isChromaEnabled(m_chromaFormatIdc))
{
msg( WARNING, "****************************************************************************\n");
msg( WARNING, "** WARNING: --DualITree has been disabled because the chromaFormat is 400 **\n");
msg( WARNING, "****************************************************************************\n");
m_dualTree = false;
}
Kenneth Andersson
committed
if (m_alf)
{
xConfirmPara(m_alfStrengthLuma < 0.0, "ALFStrengthLuma is less than 0. Valid range is 0.0 <= ALFStrengthLuma <= 1.0");
xConfirmPara(m_alfStrengthLuma > 1.0, "ALFStrengthLuma is greater than 1. Valid range is 0.0 <= ALFStrengthLuma <= 1.0");
Kenneth Andersson
committed
}
Kenneth Andersson
committed
if (m_ccalf)
{
xConfirmPara(m_ccalfStrength < 0.0, "CCALFStrength is less than 0. Valid range is 0.0 <= CCALFStrength <= 1.0");
xConfirmPara(m_ccalfStrength > 1.0, "CCALFStrength is greater than 1. Valid range is 0.0 <= CCALFStrength <= 1.0");
if (m_alf)
{
xConfirmPara(m_alfStrengthChroma < 0.0, "ALFStrengthChroma is less than 0. Valid range is 0.0 <= ALFStrengthChroma <= 1.0");
xConfirmPara(m_alfStrengthChroma > 1.0, "ALFStrengthChroma is greater than 1. Valid range is 0.0 <= ALFStrengthChroma <= 1.0");
xConfirmPara(m_alfStrengthTargetLuma < 0.0, "ALFStrengthTargetLuma is less than 0. Valid range is 0.0 <= ALFStrengthTargetLuma <= 1.0");
xConfirmPara(m_alfStrengthTargetLuma > 1.0, "ALFStrengthTargetLuma is greater than 1. Valid range is 0.0 <= ALFStrengthTargetLuma <= 1.0");
xConfirmPara(m_alfStrengthTargetChroma < 0.0, "ALFStrengthTargetChroma is less than 0. Valid range is 0.0 <= ALFStrengthTargetChroma <= 1.0");
xConfirmPara(m_alfStrengthTargetChroma > 1.0, "ALFStrengthTargetChroma is greater than 1. Valid range is 0.0 <= ALFStrengthTargetChroma <= 1.0");
}
if (m_ccalf)
{
xConfirmPara(m_ccalfStrengthTarget < 0.0, "CCALFStrengthTarget is less than 0. Valid range is 0.0 <= CCALFStrengthTarget <= 1.0");
xConfirmPara(m_ccalfStrengthTarget > 1.0, "CCALFStrengthTarget is greater than 1. Valid range is 0.0 <= CCALFStrengthTarget <= 1.0");
}
if (m_ccalf && !isChromaEnabled(m_chromaFormatIdc))
{
msg( WARNING, "****************************************************************************\n");
msg( WARNING, "** WARNING: --CCALF has been disabled because the chromaFormat is 400 **\n");
msg( WARNING, "****************************************************************************\n");
m_ccalf = false;
}
if (m_jointCbCrMode && !isChromaEnabled(m_chromaFormatIdc))
{
msg( WARNING, "****************************************************************************\n");

Christian Helmrich
committed
msg( WARNING, "** WARNING: --JointCbCr has been disabled because the chromaFormat is 400 **\n");
msg( WARNING, "****************************************************************************\n");
xConfirmPara( m_cbCrQpOffset < -12, "Min. Joint Cb-Cr QP Offset is -12");
xConfirmPara( m_cbCrQpOffset > 12, "Max. Joint Cb-Cr QP Offset is 12");
xConfirmPara( m_cbCrQpOffsetDualTree < -12, "Min. Joint Cb-Cr QP Offset for dual tree is -12");
xConfirmPara( m_cbCrQpOffsetDualTree > 12, "Max. Joint Cb-Cr QP Offset for dual tree is 12");

Karsten Suehring
committed
xConfirmPara( m_iQPAdaptationRange <= 0, "QP Adaptation Range must be more than 0" );

Karsten Suehring
committed
{
xConfirmPara(m_intraPeriod > 0 && m_intraPeriod <= m_gopSize,
"Intra period must be larger than GOP size for periodic IDR pictures");

Karsten Suehring
committed
}
xConfirmPara(m_maxCuWidth > MAX_CU_SIZE, "MaxCUWith exceeds predefined MAX_CU_SIZE limit");

Karsten Suehring
committed
const int minCuSize = 1 << m_log2MinCuSize;
xConfirmPara(m_minQt[0] > 64, "Min Luma QT size in I slices should be smaller than or equal to 64");
xConfirmPara(m_minQt[1] > 64, "Min Luma QT size in non-I slices should be smaller than or equal to 64");
xConfirmPara(m_maxBt[2] > 64, "Maximum BT size for chroma block in I slice should be smaller than or equal to 64");
xConfirmPara(m_maxTt[0] > 64, "Maximum TT size for luma block in I slice should be smaller than or equal to 64");
xConfirmPara(m_maxTt[1] > 64, "Maximum TT size for luma block in non-I slice should be smaller than or equal to 64");
xConfirmPara(m_maxTt[2] > 64, "Maximum TT size for chroma block in I slice should be smaller than or equal to 64");
xConfirmPara(m_minQt[0] < minCuSize, "Min Luma QT size in I slices should be larger than or equal to minCuSize");
xConfirmPara(m_minQt[1] < minCuSize, "Min Luma QT size in non-I slices should be larger than or equal to minCuSize");
xConfirmPara((m_sourceWidth % minCuSize ) || (m_sourceHeight % minCuSize), "Picture width or height is not a multiple of minCuSize");
- std::max(MIN_CU_LOG2, (int) m_log2MinCuSize - (int) getChannelTypeScaleX(ChannelType::CHROMA, m_chromaFormatIdc));
xConfirmPara( minDiff < 0 , "Min Chroma QT size in I slices is smaller than Min Luma CU size even considering color format");
xConfirmPara((m_minQt[2] << (int) getChannelTypeScaleX(ChannelType::CHROMA, m_chromaFormatIdc))
> std::min(64, (int) m_ctuSize),
"Min Chroma QT size in I slices should be smaller than or equal to CTB size or CB size after implicit "
"split of CTB");
xConfirmPara(m_ctuSize < 32, "CTUSize must be greater than or equal to 32");
xConfirmPara(m_ctuSize > 128, "CTUSize must be less than or equal to 128");
xConfirmPara(m_ctuSize != 32 && m_ctuSize != 64 && m_ctuSize != 128, "CTUSize must be a power of 2 (32, 64, or 128)");
xConfirmPara(m_maxCuWidth < 16, "Maximum partition width size should be larger than or equal to 16");
xConfirmPara(m_maxCuHeight < 16, "Maximum partition height size should be larger than or equal to 16");
xConfirmPara(m_maxBt[0] < m_minQt[0],
"Maximum BT size for luma block in I slice should be larger than minimum QT size");
xConfirmPara(m_maxBt[0] > m_ctuSize,
"Maximum BT size for luma block in I slice should be smaller than or equal to CTUSize");
xConfirmPara(m_maxBt[1] < m_minQt[1],
"Maximum BT size for luma block in non I slice should be larger than minimum QT size");
xConfirmPara(m_maxBt[1] > m_ctuSize,
"Maximum BT size for luma block in non I slice should be smaller than or equal to CTUSize");
xConfirmPara(m_maxBt[2] < (m_minQt[2] << (int) getChannelTypeScaleX(ChannelType::CHROMA, m_chromaFormatIdc)),