📄 app_encoder_encoder.cpp
字号:
if(strcmp(pchTmp, "Full")==0) rgiEnhancementType [iObj] = 0; else if(strcmp(pchTmp, "PartC")==0) rgiEnhancementType [iObj] = 1; else if(strcmp(pchTmp, "PartNC")==0) rgiEnhancementType [iObj] = 2; else fatal_error("Unknown temporal scalability enhancement type"); } // alpha usage GetSVal(&par, "Alpha.Type", iObj, &pchTmp); rgbShapeOnly[iObj] = FALSE; rgiAlphaShapeExtension[iObj] = -1; // default if(strcmp(pchTmp, "None")==0) rgfAlphaUsage[iObj] = RECTANGLE; else if(strcmp(pchTmp, "Binary")==0) rgfAlphaUsage[iObj] = ONE_BIT; else if(strcmp(pchTmp, "Gray")==0) { rgfAlphaUsage[iObj] = EIGHT_BIT; if(iVersion>=903) { Bool bMACEnable; readBoolParam(&par, "Alpha.MAC.Enable", iObj, &bMACEnable); GetIVal(&par, "Alpha.ShapeExtension", iObj, &rgiAlphaShapeExtension[iObj]); // MAC-V2 (SB) if(!bMACEnable) rgiAlphaShapeExtension[iObj] = -1; } } else if(strcmp(pchTmp, "ShapeOnly")==0) { rgbShapeOnly[iObj] = TRUE; rgfAlphaUsage[iObj] = ONE_BIT; } else fatal_error("Unknown alpha type"); GetIVal(&par, "Alpha.Binary.RoundingThreshold", iObj, &rgiBinaryAlphaTH [iObj]); fatal_error("Binary rounding threshold must be >= 0", rgiBinaryAlphaTH [iObj] >= 0); if(iVersion>=905) { GetIVal(&par, "Alpha.Binary.FromGrayThreshold", iObj, &rgiGrayToBinaryTH [iObj]); fatal_error("Binary from Gray threshold must be >= 0 (beware of the grays!)", rgiGrayToBinaryTH [iObj] >= 0); } else { rgiGrayToBinaryTH [iObj] = GRAY_ALPHA_THRESHOLD; } Bool bSizeConvEnable; readBoolParam(&par, "Alpha.Binary.SizeConversion.Enable", iObj, &bSizeConvEnable); rgbNoCrChange [iObj] = !bSizeConvEnable; if (rgiBinaryAlphaTH [iObj] == 0 && rgbNoCrChange [iObj] == 0) { printf("Size conversion was disabled since binary rounding threshold is zero"); rgbNoCrChange [iObj] = TRUE; } GetIVal(&par, "ErrorResil.AlphaRefreshRate", iObj, &rgiBinaryAlphaRR [iObj]); fatal_error("Alpha refresh rate must be >= 0", rgiBinaryAlphaRR [iObj] >= 0); Bool bRoundingControlEnable; readBoolParam(&par, "Motion.RoundingControl.Enable", iObj, &bRoundingControlEnable); rgbRoundingControlDisable [iObj] = !bRoundingControlEnable; GetIVal(&par, "Motion.RoundingControl.StartValue", iObj, &rgiInitialRoundingType [iObj]); fatal_error("Rounding control start value must be either 0 or 1", rgiInitialRoundingType [iObj]==0 || rgiInitialRoundingType [iObj]==1); GetIVal(&par, "Motion.PBetweenICount", iObj, &rgiNumPbetweenIVOP [iObj]); if(rgiNumPbetweenIVOP [iObj] < 0) rgiNumPbetweenIVOP [iObj] = (lastFrm - firstFrm + 1); //only 1 I at the beginning GetIVal(&par, "Motion.BBetweenPCount", iObj, &rgiNumBbetweenPVOP [iObj]); fatal_error("Motion.BBetweenPCount must be >= 0", rgiNumBbetweenPVOP [iObj]>=0); //number of VOP between GOV header //CAUTION:GOV period is not used in spatial scalable coding Bool bGOVEnable; readBoolParam(&par, "GOV.Enable", iObj, &bGOVEnable); if(!bGOVEnable) rgiGOVperiod[iObj] = 0; else GetIVal(&par, "GOV.Period", iObj, &rgiGOVperiod[iObj]); Bool bDeblockingFilterEnable; readBoolParam(&par, "Motion.DeblockingFilter.Enable", iObj, &bDeblockingFilterEnable); rgbDeblockFilterDisable[iObj] = !bDeblockingFilterEnable; GetSVal(&par, "Source.Format", iObj, &pchTmp); if(strcmp(pchTmp, "444")==0) rgfChrType[iObj] = FOUR_FOUR_FOUR; else if(strcmp(pchTmp, "422")==0) rgfChrType[iObj] = FOUR_TWO_TWO; else if(strcmp(pchTmp, "420")==0) rgfChrType[iObj] = FOUR_TWO_ZERO; else fatal_error("Unrecognised source format"); if(iVersion>=902) { // version 2 parameters GetIVal(&par, "VersionID", iObj, (Int *)&rguiVerID[iObj]); } else { // default parameter values rguiVerID[iObj] = 1; } GetSVal(&par, "Sprite.Type", iObj, &pchTmp); if(strcmp(pchTmp, "None")==0) rguiSpriteUsage[iObj] = 0; else if(strcmp(pchTmp, "Static")==0) rguiSpriteUsage[iObj] = 1; else if(strcmp(pchTmp, "GMC")==0) rguiSpriteUsage[iObj] = 2; else fatal_error("Unknown value for Sprite.Type"); if (rgbScalability [iObj] == TRUE && rguiSpriteUsage[iObj]==1) fatal_error("Sprite and scalability modes cannot be combined"); if (rguiVerID[iObj]==1 && rguiSpriteUsage[iObj]==2) fatal_error("GMC cannot be enabled in a Version 1 stream"); GetSVal(&par, "Sprite.WarpAccuracy", iObj, &pchTmp); if(strcmp(pchTmp, "1/2")==0) rguiWarpingAccuracy[iObj] = 0; else if(strcmp(pchTmp, "1/4")==0) rguiWarpingAccuracy[iObj] = 1; else if(strcmp(pchTmp, "1/8")==0) rguiWarpingAccuracy[iObj] = 2; else if(strcmp(pchTmp, "1/16")==0) rguiWarpingAccuracy[iObj] = 3; else fatal_error("Unknown value for Sprite.WarpAccuracy"); GetIVal(&par, "Sprite.Points", iObj, &rgiNumPnts[iObj]); if(rguiSpriteUsage[iObj] == 2) fatal_error("Sprite.Points must lie in the range 0 to 3", rgiNumPnts[iObj]>=0 && rgiNumPnts[iObj]<4); else fatal_error("Sprite.Points must lie in the range -1 to 4", rgiNumPnts[iObj]>=-1 && rgiNumPnts[iObj]<5); GetSVal(&par, "Sprite.Mode", iObj, &pchTmp); if(strcmp(pchTmp, "Basic")==0) rgSpriteMode[iObj] = BASIC_SPRITE; else if(strcmp(pchTmp, "LowLatency")==0) rgSpriteMode[iObj] = LOW_LATENCY; else if(strcmp(pchTmp, "PieceObject")==0) rgSpriteMode[iObj] = PIECE_OBJECT; else if(strcmp(pchTmp, "PieceUpdate")==0) rgSpriteMode[iObj] = PIECE_UPDATE; else fatal_error("Unkown value for Sprite.Mode"); if(rguiSpriteUsage[iObj]==0) { rgiNumPnts[iObj] = -1; //rgSpriteMode[iObj] = -1; } readBoolParam(&par, "Trace.CreateFile.Enable", iObj, &rgbTrace[iObj]); readBoolParam(&par, "Trace.DetailedDump.Enable", iObj, &rgbDumpMB[iObj]);#ifndef __TRACE_AND_STATS_ if(rgbTrace[iObj]) { printf("Warning: this encoder will not generate trace information.\n"); printf("If you want trace information, re-compile with __TRACE_AND_STATS_ defined.\n"); }#endif readBoolParam(&par, "Motion.SkippedMB.Enable", iObj, &rgbAllowSkippedPMBs[iObj]); // parameters that can be different for each scalability layer Int iLayer, iLayerCount; if(rgbScalability[iObj]!=NO_SCALABILITY) iLayerCount = 2; else iLayerCount = 1; for(iLayer = 0; iLayer<iLayerCount; iLayer++) { Int iLayerObj = iObj + iLayer * nVO; // rate control GetSVal(&par, "RateControl.Type", iLayerObj, &pchTmp); if(strcmp(pchTmp, "None")==0) rguiRateControl [iLayer][iObj] = 0; else if(strcmp(pchTmp, "MP4")==0) rguiRateControl [iLayer][iObj] = RC_MPEG4; else if(strcmp(pchTmp, "TM5")==0) rguiRateControl [iLayer][iObj] = RC_TM5; else fatal_error("Unknown rate control type"); // bit budget Double dVal; Int er = par.GetDouble("RateControl.BitsPerSecond", iLayerObj, &dVal); if(er!=ERES_OK) { // previously was erroneously called bitspervop, but it should be per second // the value is still the same er = par.GetDouble("RateControl.BitsPerVOP", iLayerObj, &dVal); if(er!=ERES_OK) printf("Error: can't find RateControl.BitsPerSecond in parameter file.\n"); } rguiBitsBudget[iLayer][iObj] = (Int)dVal; Bool bRVLCEnable, bDPEnable, bVPEnable; readBoolParam(&par, "ErrorResil.RVLC.Enable", iLayerObj, &bRVLCEnable); readBoolParam(&par, "ErrorResil.DataPartition.Enable", iLayerObj, &bDPEnable); readBoolParam(&par, "ErrorResil.VideoPacket.Enable", iLayerObj, &bVPEnable); if(bDPEnable) bVPEnable = TRUE; rgbErrorResilientDisable [iLayer][iObj] = bVPEnable ? (iLayer!=0) : TRUE; rgbReversibleVlc [iLayer] [iObj] = bRVLCEnable ? (iLayer==0) : FALSE; rgbDataPartitioning [iLayer][iObj] = bDPEnable ? (iLayer==0) : FALSE; if(rgbErrorResilientDisable [BASE_LAYER][iObj]) rgiBinaryAlphaRR [iObj] = -1; GetIVal(&par, "ErrorResil.VideoPacket.Length", iLayerObj, &rgiVPBitTh[iLayer][iObj]); if(rgbErrorResilientDisable [iLayer][iObj]) rgiVPBitTh [iLayer][iObj] = -1; readBoolParam(&par, "Motion.Interlaced.Enable", iLayerObj, &rgbInterlacedCoding [iLayer][iObj]); GetSVal(&par, "Quant.Type", iLayerObj, &pchTmp); if(strcmp(pchTmp, "H263")==0) rgfQuant[iLayer][iObj] = Q_H263; else if(strcmp(pchTmp, "MPEG")==0) rgfQuant[iLayer][iObj] = Q_MPEG; else fatal_error("Unknown quantizer type"); readBoolParam(&par, "Texture.QuantMatrix.Intra.Enable", iLayerObj, &rgbLoadIntraMatrix [iLayer][iObj]); if(rgbLoadIntraMatrix [iLayer][iObj]) { Double *pdTmp; Int iCount; GetAVal(&par, "Texture.QuantMatrix.Intra", iLayerObj, &pdTmp, &iCount); fatal_error("Wrong number of intra quant matrix values (should be 64)", iCount<=64); Int i; for(i=0; i<iCount; i++) rgppiIntraQuantizerMatrix[iLayer][iObj][i] = (Int)pdTmp[i]; if(iCount<64) rgppiIntraQuantizerMatrix[iLayer][iObj][iCount] = 0; } else memcpy (rgppiIntraQuantizerMatrix [iLayer][iObj], rgiDefaultIntraQMatrix, BLOCK_SQUARE_SIZE * sizeof(Int)); readBoolParam(&par, "Texture.QuantMatrix.Inter.Enable", iLayerObj, &rgbLoadInterMatrix [iLayer][iObj]); if(rgbLoadInterMatrix [iLayer][iObj]) { Double *pdTmp; Int iCount; GetAVal(&par, "Texture.QuantMatrix.Inter", iLayerObj, &pdTmp, &iCount); fatal_error("Wrong number of inter quant matrix values (should be 64)", iCount<=64); Int i; for(i=0; i<iCount; i++) rgppiInterQuantizerMatrix[iLayer][iObj][i] = (Int)pdTmp[i]; if(iCount<64) rgppiInterQuantizerMatrix[iLayer][iObj][iCount] = 0; } else memcpy (rgppiInterQuantizerMatrix [iLayer][iObj], rgiDefaultInterQMatrix, BLOCK_SQUARE_SIZE * sizeof(Int)); GetIVal(&par, "Texture.IntraDCThreshold", iLayerObj, &rgiIntraDCSwitchingThr [iLayer] [iObj]); fatal_error("Intra DC Threshold must be in range 0 - 7", rgiIntraDCSwitchingThr [iLayer] [iObj] >= 0 && rgiIntraDCSwitchingThr [iLayer] [iObj] <= 7); GetIVal(&par, "Texture.QuantStep.IVOP", iLayerObj, &rgiIStep [iLayer] [iObj]); fatal_error("IVOP quantizer stepsize is out of range", rgiIStep [iLayer] [iObj] > 0 && rgiIStep [iLayer] [iObj] < (1<<uiQuantPrecision)); GetIVal(&par, "Texture.QuantStep.PVOP", iLayerObj, &rgiPStep [iLayer] [iObj]); fatal_error("PVOP quantizer stepsize is out of range", rgiPStep [iLayer] [iObj] > 0 && rgiPStep [iLayer] [iObj] < (1<<uiQuantPrecision)); GetIVal(&par, "Texture.QuantStep.BVOP", iLayerObj, &rgiStepBCode [iLayer] [iObj]); fatal_error("BVOP quantizer stepsize is out of range", rgiStepBCode [iLayer] [iObj] > 0 && rgiStepBCode [iLayer] [iObj] < (1<<uiQuantPrecision)); readBoolParam(&par, "Alpha.QuantMatrix.Intra.Enable", iLayerObj, &rgbLoadIntraMatrixAlpha [iLayer][iObj]); if(rgbLoadIntraMatrixAlpha [iLayer][iObj]) { Double *pdTmp; Int iCount; GetAVal(&par, "Alpha.QuantMatrix.Intra", iLayerObj, &pdTmp, &iCount); fatal_error("Wrong number of alpha intra quant matrix values (should be 64)", iCount<=64); Int i; for(i=0; i<iCount; i++) rgppiIntraQuantizerMatrixAlpha[iLayer][iObj][i] = (Int)pdTmp[i]; if(iCount<64) rgppiIntraQuantizerMatrixAlpha[iLayer][iObj][iCount] = 0; } else memcpy (rgppiIntraQuantizerMatrixAlpha [iLayer][iObj], rgiDefaultIntraQMatrixAlpha, BLOCK_SQUARE_SIZE * sizeof(Int)); readBoolParam(&par, "Alpha.QuantMatrix.Inter.Enable", iLayerObj, &rgbLoadInterMatrixAlpha [iLayer][iObj]); if(rgbLoadInterMatrixAlpha [iLayer][iObj]) { Double *pdTmp; Int iCount; GetAVal(&par, "Alpha.QuantMatrix.Inter", iLayerObj, &pdTmp, &iCount); fatal_error("Wrong number of alpha inter quant matrix values (should be 64)", iCount<=64); Int i; for(i=0; i<iCount; i++) rgppiInterQuantizerMatrixAlpha[iLayer][iObj][i] = (Int)pdTmp[i]; if(iCount<64) rgppiInterQuantizerMatrixAlpha[iLayer][iObj][iCount] = 0; } else memcpy (rgppiInterQuantizerMatrixAlpha [iLayer][iObj], rgiDefaultInterQMatrixAlpha, BLOCK_SQUARE_SIZE * sizeof(Int)); GetIVal(&par, "Alpha.QuantStep.IVOP", iLayerObj, &rgiIStepAlpha [iLayer] [iObj]); fatal_error("IVOP alpha quantizer stepsize is out of range", rgiIStepAlpha [iLayer] [iObj] > 0 && rgiIStepAlpha [iLayer] [iObj] < 64); GetIVal(&par, "Alpha.QuantStep.PVOP", iLayerObj, &rgiPStepAlpha [iLayer] [iObj]); fatal_error("PVOP alpha quantizer stepsize is out of range", rgiPStepAlpha [iLayer] [iObj] > 0 && rgiPStepAlpha [iLayer] [iObj] < 64); GetIVal(&par, "Alpha.QuantStep.BVOP", iLayerObj, &rgiBStepAlpha [iLayer] [iObj]); fatal_error("BVOP alpha quantizer stepsize is out of range", rgiBStepAlpha [iLayer] [iObj] > 0 && rgiBStepAlpha [iLayer] [iObj] < 64); readBoolParam(&par, "Alpha.QuantDecouple.Enable", iLayerObj, &rgbNoGrayQuantUpdate [iLayer] [iObj]); Int iRate; GetIVal(&par, "Source.SamplingRate", iLayerObj, &iRate); fatal_error("Source sampling rate must be > 0", iRate>0); if(iLayer==BASE_LAYER) rgiTSRate[iObj] = iRate; else rgiEnhcTSRate[iObj] = iRate; GetIVal(&par, "Motion.SearchRange", iLayerObj, (Int *)&rguiSearchRange[iLayer][iObj]); fatal_error("Motion.SearchRange must be > 0", rguiSearchRange[iLayer][iObj]>0); readBoolParam(&par, "Motion.UseSourceForME.Enable", iLayerObj, &rgbOriginalME [iLayer] [iObj]); Bool bAdvPredEnable; readBoolParam(&par, "Motion.AdvancedPrediction.Enable", iLayerObj, &bAdvPredEnable); rgbAdvPredDisable [iLayer][iObj] = !bAdvPredEnable; Bool bComplexityEnable; readBoolParam(&par, "Complexity.Enable", iLayerObj, &bComplexityEnable); rgbComplexityEstimationDisable[iLayer][iObj] = !bComplexityEnable; if(bComplexityEnable) { readBoolParam(&par, "Complexity.Opaque.Enable", iLayerObj, &rgbOpaque[iLayer][iObj]); readBoolParam(&par, "Complexity.Transparent.Enable", iLayerObj, &rgbTransparent[iLayer][iObj]); readBoolParam(&par, "Complexity.IntraCAE.Enable", iLayerObj, &rgbIntraCAE[iLayer][iObj]); readBoolParam(&par, "Complexity.InterCAE.Enable", iLayerObj, &rgbInterCAE[iLayer][iObj]); readBoolParam(&par, "Complexity.NoUpdate.Enable", iLayerObj, &rgbNoUpdate[iLayer][iObj]);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -