📄 convertpar.cpp
字号:
fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);
fatal_error("Conversion aborted");
}
nextValidLine (pfPara, pnLine);
if ( fscanf (pfPara, "%u", &lastVO) != 1) {
fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);
fatal_error("Conversion aborted");
}
my_assert (lastVO >= firstVO);
nVO = lastVO - firstVO + 1;
/*************/
fprintf(pfOut, "Source.ObjectIndex.First = %d\nSource.ObjectIndex.Last = %d\n",
firstVO, lastVO);
/*************/
// allocate per-vo parameters
rgiTemporalScalabilityType = new Int [nVO];
rgbSpatialScalability = new Bool [nVO];
rgbScalability = new Bool [nVO];
rgiEnhancementType = new Int [nVO];
rgfAlphaUsage = new AlphaUsage [nVO];
rgbShapeOnly = new Bool [nVO];
rgiBinaryAlphaTH = new Int [nVO];
rgbNoCrChange = new Bool [nVO];
rgiBinaryAlphaRR = new Int [nVO];
rgbRoundingControlDisable = new Bool [nVO];
rgiInitialRoundingType = new Int [nVO];
rgiNumPbetweenIVOP = new Int [nVO];
rgiNumBbetweenPVOP = new Int [nVO];
rgiGOVperiod = new Int [nVO];
rgbDeblockFilterDisable = new Bool [nVO];
rgiTSRate = new Int [nVO];
rgiEnhcTSRate = new Int [nVO];
rgfChrType = new ChromType [nVO];
rgbAllowSkippedPMBs = new Bool [nVO];
rgSpriteMode = new SptMode [nVO];
rgbDumpMB = new Bool [nVO];
rgbTrace = new Bool [nVO];
rguiSpriteUsage = new UInt [nVO];
rguiWarpingAccuracy = new UInt [nVO];
rgiNumPnts = new Int [nVO];
Int iL;
for(iL = BASE_LAYER; iL<=ENHN_LAYER; iL++)
{
// allocate per-layer parameters
rguiRateControl [iL] = new UInt [nVO];
rguiBitsBudget [iL] = new UInt [nVO];
rgbAdvPredDisable [iL] = new Bool [nVO];
rgbErrorResilientDisable [iL] = new Bool [nVO];
rgbDataPartitioning [iL] = new Bool [nVO];
rgbReversibleVlc [iL] = new Bool [nVO];
rgiVPBitTh [iL] = new Int [nVO];
rgbInterlacedCoding [iL] = new Bool [nVO];
rgfQuant [iL] = new Quantizer [nVO];
rgbLoadIntraMatrix [iL] = new Bool [nVO];
rgppiIntraQuantizerMatrix [iL] = new Int * [nVO];
rgbLoadInterMatrix [iL] = new Bool [nVO];
rgppiInterQuantizerMatrix [iL] = new Int * [nVO];
rgiIntraDCSwitchingThr [iL] = new Int [nVO];
rgiIStep [iL] = new Int [nVO];
rgiPStep [iL] = new Int [nVO];
rgiStepBCode [iL] = new Int [nVO];
rgbLoadIntraMatrixAlpha [iL] = new Bool [nVO];
rgppiIntraQuantizerMatrixAlpha [iL] = new Int * [nVO];
rgbLoadInterMatrixAlpha [iL] = new Bool [nVO];
rgppiInterQuantizerMatrixAlpha [iL] = new Int * [nVO];
rgiIStepAlpha [iL] = new Int [nVO];
rgiPStepAlpha [iL] = new Int [nVO];
rgiBStepAlpha [iL] = new Int [nVO];
rgbNoGrayQuantUpdate [iL] = new Bool [nVO];
rguiSearchRange [iL] = new UInt [nVO];
rgbOriginalME [iL] = new Bool [nVO];
rgbComplexityEstimationDisable [iL] = new Bool [nVO];
rgbOpaque [iL] = new Bool [nVO];
rgbTransparent [iL] = new Bool [nVO];
rgbIntraCAE [iL] = new Bool [nVO];
rgbInterCAE [iL] = new Bool [nVO];
rgbNoUpdate [iL] = new Bool [nVO];
rgbUpsampling [iL] = new Bool [nVO];
rgbIntraBlocks [iL] = new Bool [nVO];
rgbInterBlocks [iL] = new Bool [nVO];
rgbInter4vBlocks [iL] = new Bool [nVO];
rgbNotCodedBlocks [iL] = new Bool [nVO];
rgbDCTCoefs [iL] = new Bool [nVO];
rgbDCTLines [iL] = new Bool [nVO];
rgbVLCSymbols [iL] = new Bool [nVO];
rgbVLCBits [iL] = new Bool [nVO];
rgbAPM [iL] = new Bool [nVO];
rgbNPM [iL] = new Bool [nVO];
rgbInterpolateMCQ [iL] = new Bool [nVO];
rgbForwBackMCQ [iL] = new Bool [nVO];
rgbHalfpel2 [iL] = new Bool [nVO];
rgbHalfpel4 [iL] = new Bool [nVO];
rguiVolControlParameters [iL] = new UInt [nVO];
rguiChromaFormat [iL] = new UInt [nVO];
rguiLowDelay [iL] = new UInt [nVO];
rguiVBVParams [iL] = new UInt [nVO];
rguiBitRate [iL] = new UInt [nVO];
rguiVbvBufferSize [iL] = new UInt [nVO];
rguiVbvBufferOccupany [iL] = new UInt [nVO];
rgdFrameFrequency [iL] = new Double [nVO];
rgbTopFieldFirst [iL] = new Bool [nVO];
rgbAlternateScan [iL] = new Bool [nVO];
rgiDirectModeRadius [iL] = new Bool [nVO];
rgiMVFileUsage[iL] = new Int [nVO];
pchMVFileName[iL] = new char * [nVO];
}
for (iObj = 0; iObj < nVO; iObj++)
{
// per object alloc
rgppiIntraQuantizerMatrix [BASE_LAYER] [iObj] = new Int [BLOCK_SQUARE_SIZE];
rgppiIntraQuantizerMatrix [ENHN_LAYER] [iObj] = new Int [BLOCK_SQUARE_SIZE];
rgppiInterQuantizerMatrix [BASE_LAYER] [iObj] = new Int [BLOCK_SQUARE_SIZE];
rgppiInterQuantizerMatrix [ENHN_LAYER] [iObj] = new Int [BLOCK_SQUARE_SIZE];
rgppiIntraQuantizerMatrixAlpha [BASE_LAYER] [iObj] = new Int [BLOCK_SQUARE_SIZE];
rgppiIntraQuantizerMatrixAlpha [ENHN_LAYER] [iObj] = new Int [BLOCK_SQUARE_SIZE];
rgppiInterQuantizerMatrixAlpha [BASE_LAYER] [iObj] = new Int [BLOCK_SQUARE_SIZE];
rgppiInterQuantizerMatrixAlpha [ENHN_LAYER] [iObj] = new Int [BLOCK_SQUARE_SIZE];
}
//scalability indicators: 1 = temporal, 2 = spatial scalability
nextValidLine (pfPara, pnLine);
bAnyScalability = FALSE;
for (iObj = 0; iObj < nVO; iObj++) {
if (fscanf (pfPara, "%d", &rgbScalability [iObj]) != 1) {
fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);
fatal_error("Conversion aborted");
}
if (rgbScalability[iObj] == TEMPORAL_SCALABILITY ||
rgbScalability[iObj] == SPATIAL_SCALABILITY)
bAnyScalability = TRUE;
else
my_assert (rgbScalability[iObj] == NO_SCALABILITY);
if(rgbScalability[iObj] == SPATIAL_SCALABILITY || rgbScalability[iObj] == TEMPORAL_SCALABILITY) // modifiedy by Sharp(98/2/12)
rgbSpatialScalability[iObj] = TRUE;
else
rgbSpatialScalability[iObj] = FALSE;
/*************/
fprintf(pfOut, "Scalability [%d] = \"%s\"\n", iObj,
rgbScalability[iObj] == TEMPORAL_SCALABILITY ? "Temporal" : (rgbScalability[iObj] == SPATIAL_SCALABILITY ? "Spatial" : "None"));
/*************/
}
//coded added by Sony, only deals with ONE VO.
//Type option of Spatial Scalable Coding
//This parameter is used for dicision VOP prediction types of Enhancement layer in Spatial Scalable Coding
//If this option is set to 0, Enhancement layer is coded as "PPPPPP......",
//else if set to 1 ,It's coded as "PBBBB......."
nextValidLine(pfPara,pnLine);
my_assert (nVO == 1);
fscanf(pfPara,"%d",&iSpatialOption);
if(rgbScalability[0] == SPATIAL_SCALABILITY)
if (iSpatialOption == 1)
fprintf(stdout,"Enhancement layer is coded as \"PPPPP.....\"\n");
else if (iSpatialOption == 0)
fprintf(stdout,"Enhancement layer is coded as \"PBBBB.....\"\n");
else {
fprintf(stderr,"The parameter \"SpatialOption\" is not set correctly\n");
fatal_error("Conversion aborted");
}
/*************/
fprintf(pfOut, "Scalability.Spatial.PredictionType [0] = \"%s\"\n", iSpatialOption==0 ? "PBB" : "PPP");
/*************/
//Load enhancement layer (Spatial Scalable) size
nextValidLine(pfPara,pnLine);
fscanf(pfPara,"%d",&uiFrmWidth_SS);
fscanf(pfPara,"%d",&uiFrmHeight_SS);
//load upsampling factor
nextValidLine(pfPara,pnLine);
fscanf(pfPara,"%d",&uiHor_sampling_n);
fscanf(pfPara,"%d",&uiHor_sampling_m);
nextValidLine(pfPara,pnLine);
fscanf(pfPara,"%d",&uiVer_sampling_n);
fscanf(pfPara,"%d",&uiVer_sampling_m);
/*************/
fprintf(pfOut, "Scalability.Spatial.Width [0] = %d\n", uiFrmWidth_SS);
fprintf(pfOut, "Scalability.Spatial.Height [0] = %d\n", uiFrmHeight_SS);
fprintf(pfOut, "Scalability.Spatial.HorizFactor.N [0] = %d\n", uiHor_sampling_n);
fprintf(pfOut, "Scalability.Spatial.HorizFactor.M [0] = %d\n", uiHor_sampling_m);
fprintf(pfOut, "Scalability.Spatial.VertFactor.N [0] = %d\n", uiVer_sampling_n);
fprintf(pfOut, "Scalability.Spatial.VertFactor.M [0] = %d\n", uiVer_sampling_m);
/*************/
// form of temporal scalability indicators
// case 0 Enhn P P ....
// Base I P P ....
// case 1 Enhn B B B B ....
// Base I P P ....
// case 2 Enhn P B B ....
// Base I B P B ....
nextValidLine (pfPara, pnLine);
for (iObj = 0; iObj < nVO; iObj++) {
if (fscanf (pfPara, "%d", &rgiTemporalScalabilityType [iObj]) != 1) {
fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);
fatal_error("Conversion aborted");
}
my_assert (rgiTemporalScalabilityType [iObj] == 0 ||
rgiTemporalScalabilityType [iObj] == 1 ||
rgiTemporalScalabilityType [iObj] == 2 ||
rgiTemporalScalabilityType [iObj] == 3 ||
rgiTemporalScalabilityType [iObj] == 4);
/*************/
fprintf(pfOut, "Scalability.Temporal.PredictionType [%d] = %d\n", iObj, rgiTemporalScalabilityType [iObj]);
/*************/
}
// enhancement_type for scalability
nextValidLine (pfPara, pnLine);
for (iObj = 0; iObj < nVO; iObj++) {
if (fscanf (pfPara, "%d", &rgiEnhancementType [iObj]) != 1) {
fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);
fatal_error("Conversion aborted");
}
my_assert (rgiEnhancementType [iObj] == 0 || // entire region of the base layer is enhanced
// begin: modified by Sharp (98/3/24)
rgiEnhancementType [iObj] == 1 || // partial region of the base layer is enhanced (with background composition)
rgiEnhancementType [iObj] == 2); // partial region of the base layer is enhanced (without background composition)
// end: modified by Sharp (98/3/24)
/*************/
fprintf(pfOut, "Scalability.Temporal.EnhancementType [%d] = \"%s\"\n", iObj,
rgiEnhancementType [iObj] == 0 ? "Full" : (rgiEnhancementType [iObj] == 1 ? "PartC" : "PartNC"));
/*************/
}
// rate control flag
nextValidLine (pfPara, pnLine);
for (iObj = 0; iObj < nVO; iObj++) {
if (fscanf (pfPara, "%u", &rguiRateControl [BASE_LAYER] [iObj] ) != 1) {
fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);
fatal_error("Conversion aborted");
}
my_assert (rguiRateControl [BASE_LAYER] [iObj] == RC_MPEG4 ||
rguiRateControl [BASE_LAYER] [iObj] == RC_TM5 ||
rguiRateControl [BASE_LAYER] [iObj] == 0);
/*************/
fprintf(pfOut, "RateControl.Type [%d] = \"%s\"\n", iObj,
rguiRateControl [BASE_LAYER] [iObj] == 0 ? "None" : (rguiRateControl [BASE_LAYER] [iObj] == RC_MPEG4 ? "MP4" : "TM5"));
/*************/
}
if (bAnyScalability) {
for (iObj = 0; iObj < nVO; iObj++) {
if (fscanf (pfPara, "%u", &rguiRateControl [ENHN_LAYER] [iObj]) != 1) {
fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);
fatal_error("Conversion aborted");
}
my_assert (rguiRateControl [ENHN_LAYER] [iObj] == 0 ||
rguiRateControl [ENHN_LAYER] [iObj] == RC_MPEG4 ||
rguiRateControl [ENHN_LAYER] [iObj] == RC_TM5);
/*************/
fprintf(pfOut, "RateControl.Type [%d] = \"%s\"\n", iObj + nVO,
rguiRateControl [ENHN_LAYER] [iObj] == 0 ? "None" : (rguiRateControl [ENHN_LAYER] [iObj] == RC_MPEG4 ? "MP4" : "TM5"));
/*************/
}
}
// bit budget for each object.
nextValidLine (pfPara, pnLine);
for (iObj = 0; iObj < nVO; iObj++) {
if (fscanf (pfPara, "%d", &rguiBitsBudget [BASE_LAYER] [iObj]) != 1) {
fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);
fatal_error("Conversion aborted");
}
/*************/
fprintf(pfOut, "RateControl.BitsPerVOP [%d] = %d\n", iObj, rguiBitsBudget [BASE_LAYER] [iObj]);
/*************/
}
if (bAnyScalability) {
for (iObj = 0; iObj < nVO; iObj++) {
if (fscanf (pfPara, "%d", &rguiBitsBudget [ENHN_LAYER] [iObj]) != 1) {
fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);
fatal_error("Conversion aborted");
}
my_assert (rguiBitsBudget [ENHN_LAYER] [iObj] > 0);
/*************/
fprintf(pfOut, "RateControl.BitsPerVOP [%d] = %d\n", iObj + nVO, rguiBitsBudget [ENHN_LAYER] [iObj]);
/*************/
}
}
// alpha usage for each object. 0: rectangle, 1: binary, 2: 8-bit, 3: shape only
nextValidLine (pfPara, pnLine);
for (iObj = 0; iObj < nVO; iObj++) {
UInt uiAlpha;
if (fscanf (pfPara, "%d", &uiAlpha) != 1) {
fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine);
fatal_error("Conversion aborted");
}
else {
my_assert (uiAlpha == 0 || uiAlpha == 1 || uiAlpha == 2 || uiAlpha == 3);
if(uiAlpha<3)
{
rgfAlphaUsage [iObj] = (AlphaUsage) uiAlpha;
rgbShapeOnly [iObj] = FALSE;
}
else
{
rgfAlphaUsage [iObj] = ONE_BIT;
rgbShapeOnly [iObj] = TRUE;
}
}
/*************/
fprintf(pfOut, "Alpha.Type [%d] = \"%s\"\n", iObj,
uiAlpha==0 ? "None" : (uiAlpha==1 ? "Binary" : (uiAlpha==2 ? "Gray" : "ShapeOnly")));
/*************/
}
// binary shape rounding para
nextValidLine (pfPara, pnLine);
for (iObj = 0; iObj < nVO; iObj++) {
if (fscanf (pfPara, "%d", &rgiBinaryAlphaTH [iObj]) != 1) {
fprintf (stderr, "wrong parameter file format on line %d\n", *pnLine);
fatal_error("Conversion aborted");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -