📄 convertpar.cpp
字号:
/*************/ fprintf(pfOut, "Source.BitsPerPel = %d\nNot8Bit.QuantPrecision = %d\nNot8Bit.Enable = %d\n", nBits, uiQuantPrecision, bNot8Bit); /*************/ // object indexes nextValidLine (pfPara, pnLine); if ( fscanf (pfPara, "%u", &firstVO) != 1) { 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]; // version 2 rguiVerID = new UInt [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]; // version 2 rgbNewpredEnable [iL] = new Bool [nVO]; rgbNewpredSegmentType [iL] = new Bool [nVO]; rgcNewpredRefName [iL] = new char *[nVO]; rgcNewpredSlicePoint [iL] = new char *[nVO]; rgbSadctDisable [iL] = new Bool [nVO]; rgbQuarterSample [iL] = new Bool [nVO]; RRVmode[iL] = new RRVmodeStr [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]; } // Video Version ID if(iVersion > 815) // do not include in parameter file version 815 { // GMC_V2 nextValidLine (pfPara, pnLine); for (iObj = 0; iObj < nVO; iObj++) { if (fscanf (pfPara, "%d", &rguiVerID [iObj]) != 1) { fprintf (stderr, "wrong parameter file format on line %d\n", *pnLine); fatal_error("Conversion aborted"); } fatal_error("Bad value for version ID", rguiVerID [iObj] == 1 || rguiVerID [iObj] == 2); /*************/ fprintf(pfOut, "VersionID [%d] = %d\n", iObj, rguiVerID [iObj]); /*************/ } } else { // default to version 1 for (iObj = 0; iObj < nVO; iObj++) /*************/ fprintf(pfOut, "VersionID [%d] = 1\n", iObj); /*************/ } //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); /*************/ if(iVersion>=818) { //OBSS_SAIT_991015 //load reference status nextValidLine(pfPara,pnLine); fscanf(pfPara,"%d",&uiUse_ref_shape); fscanf(pfPara,"%d",&uiUse_ref_texture); //load upsampling factor for shape nextValidLine(pfPara,pnLine); fscanf(pfPara,"%d",&uiHor_sampling_n_shape); fscanf(pfPara,"%d",&uiHor_sampling_m_shape); nextValidLine(pfPara,pnLine); fscanf(pfPara,"%d",&uiVer_sampling_n_shape); fscanf(pfPara,"%d",&uiVer_sampling_m_shape); //~OBSS_SAIT_991015 } else { uiUse_ref_shape = 0; uiUse_ref_texture = 0; uiHor_sampling_n_shape = 2; uiHor_sampling_m_shape = 1; uiVer_sampling_n_shape = 2; uiVer_sampling_m_shape = 1; } /*************/ fprintf(pfOut, "Scalability.Spatial.UseRefShape.Enable [0] = %d\n", uiUse_ref_shape); fprintf(pfOut, "Scalability.Spatial.UseRefTexture.Enable [0] = %d\n", uiUse_ref_texture); fprintf(pfOut, "Scalability.Spatial.Shape.HorizFactor.N [0] = %d\n", uiHor_sampling_n_shape); fprintf(pfOut, "Scalability.Spatial.Shape.HorizFactor.M [0] = %d\n", uiHor_sampling_m_shape); fprintf(pfOut, "Scalability.Spatial.Shape.VertFactor.N [0] = %d\n", uiVer_sampling_n_shape); fprintf(pfOut, "Scalability.Spatial.Shape.VertFactor.M [0] = %d\n", uiVer_sampling_m_shape); /*************/ // 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")); /*************/ } if(iVersion>815) { // NEWPRED // NewpredEnable nextValidLine (pfPara, pnLine); for (iObj = 0; iObj < nVO; iObj++) { if (fscanf (pfPara, "%d", &rgbNewpredEnable [BASE_LAYER] [iObj] ) != 1) { fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine); exit (1); } if(rguiVerID[iObj] == 1) my_assert (rgbNewpredEnable [BASE_LAYER] [iObj] == 0); else if(rguiVerID[iObj] != 1) my_assert (rgbNewpredEnable [BASE_LAYER] [iObj] == 0 || rgbNewpredEnable [BASE_LAYER] [iObj] == 1); } if (bAnyScalability) { for (iObj = 0; iObj < nVO; iObj++) { if (fscanf (pfPara, "%d", &rgbNewpredEnable [ENHN_LAYER] [iObj]) != 1) { fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine); exit (1); } rgbNewpredEnable [ENHN_LAYER] [iObj] = FALSE; } } // NewpredSegmentType nextValidLine (pfPara, pnLine); for (iObj = 0; iObj < nVO; iObj++) { if (fscanf (pfPara, "%d", &rgbNewpredSegmentType [BASE_LAYER] [iObj] ) != 1) { fprintf(stderr, "wrong parameter file format on line %d\n", *pnLine); exit (1); } my_assert (rgbNewpredSegmentType [BASE_LAYER] [iObj] == 0 || rgbNewpredSegmentType [BASE_LAYER] [iObj] == 1); } if (bAnyScalability) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -