main( int argc, char** argv)
H264AVCEncoderTest::create( pcH264AVCEncoderTest )
pcH264AVCEncoderTest->init( argc, argv )
pcH264AVCEncoderTest->go()
===== initialization =====编码参数初始化
===== write parameter sets =====写序列参数集,在没有写SPS和
===== determine parameters for required frame buffers =====
for( uiLayer = 0; uiLayer < uiNumLayers; uiLayer++ )
{}
===== loop over frames =====
for( uiFrame = 0; uiFrame < uiMaxFrame; uiFrame++ )
===== get picture buffers and read original pictur
for( uiLayer = 0; uiLayer < uiNumLayers; uiLayer++
===== call encoder =====//每两个图像调用一次,但是
m_pcH264AVCEncoder->process( cOutExtBinDataAccesso
apcOriginalPicBuffer,
apcReconstructPicBuff
acPicBufferOutputList
acPicBufferUnusedList
//分AVC和SVC两种模式
//SVC模式下有:
m_pcH264AVCEncoder->process( rcEx
apcO
apcR
apcP
apcP
===== fill lists =====
uiHighestLayer = m_pcC
for( UInt uiLayer = 0;
{
}
===== encoding of GO
if ( m_acOr
{
主要编码函数---->> RNOK( x
}
===== update data accessor list
m_cAccessUnitDataList.
到此m_pcH264AVCEncoder->process结束
===== write and release NAL unit buffers =====
xWrite ( acPicBufferOutputList[uiLayer], uiLayer
xRelease( acPicBufferUnusedList[uiLayer], uiLayer
===== write and release reconstructed pictures ===
循环完uiMaxFrame后往下跳
===== finish encoding =====
//===== encode GOP =====xProcessGOP( apcPicBuff
//===== update data accessor list =====
//===== finish encoding =====
m_apcLayerEncoder[uiLayer-1]-
===== write and release NAL unit buffers =====
===== write and release reconstructed pictures =====
===== set parameters and output summary =====
//到此go()函数结束
以下为第38行的函数另起一行
H264AVCEncoder::xProcessGOP( apcPicBufferOutputList, apcPicBufferUnusedLis
===== init GOP =====//分层设置LayerCGSSNR,QualityLevelCGSSNR,BaseLayerCGSSNR,for( uiLayer = 0; uiLayer < m_pcCodingParameter->getNumberOfLayers(); uiLayer++ )
===== loop over access units in GOP, and layers inside access units =====分图像,分层处for( uiAUIndex = 0; uiAUIndex <= 64; uiAUIndex++ )
{
for( uiLayer = 0; uiLayer < m_pcCodingParameter->getNu
{
LayerEncoder::m_apcLayerEncoder[uiLayer]->process(
m_cAccessUn
m_acOrgPicB
m_acRecPicB
apcPicBuffe
m_pcParamet
到此for( uiAUIndex = 0; uiAUIndex <= 64; uiAUIndex++ )结束xCalMaxBitrate(uiLayer)//1140行
===== update pic buffer lists =====分层更新图像缓存//1145行
----- set output list -----
----- update unused list -----
----- reset lists -----
到此xProcessGOP函数结束
以下为第147行的函数另起一行
m_pcSliceEncoder->encodeIntraPicture ( uiBits,
rcControlData,
pcFrame,
pcResidual,
pcBaseLayerFrame,
pcPredSignal,
m_uiFrameWidthInMb,
rcControlData.getLambda(),
ePicType )
====== initialization ======
====== initialization ======
===== loop over macroblocks =====
pcMbDataCtrl ->initMb ( pcMbDataAccess, uiMbY, uiMbX )
----- get co-located MbIndex -----
m_pcMbEncoder ->encodeIntra ( *pcMbDataAccess,
pcMbDataAccessBase,
pcFrame ->getPic( ePicType )
pcFrame ->getPic( ePicType )
pcRecSubband ->getPic( ePicT
dLambda,
dCost)
===== INTRA_BL =====
===== spatial intra modes =====
===== check normal intra modes (if base layer or a
xEstimateMbIntra16( m_pcIntMbTempData, m_pcIntMbBe
----- init intra prediction -----
// Make sure the uiPredMode is equal to t
m_pcIntraPrediction->predictSLumaMb( rpcM
m_pcTransform->transformMb16x16( m_pcIntO
xForTransform4x4Blk( pucOrg + iO
xForTransformLumaDc( aiCoeff )
xQuantDequantNonUniformLuma( &pi
invTransformDcCoeff( aiCoeff, iQ
xInvTransform4x4Blk( pucRec + iO
MbCoder::xScanLumaIntra16x16( *rpcMbTempD
xEstimateMbIntra8 ( m_pcIntMbTempData, m_pcIntMbBe
----- init intra prediction -----
xEncode8x8IntraBlock( *rpcMbTempData, c8x
m_pcIntraPrediction-
m_pcTransform->transform8x8Blk(
xForTransform8x8Blk
xQuantDequantUniform8x8
invTransform8x8Blk
m_pcIntraPrediction->predictSLum
m_pcTransform->transform8x8Blk(
xForTransform8x8Blk
xQuantDequantUniform8x8
invTransform8x8Blk
xEncodeChromaIntra( *rpcMbTempData, uiExt
----- store estimated parameters -----RNOK( xEstimateMbIntra4 ( rcMbDataAccess, m_pcIntM
xEncode4x4IntraBlock( *rpcMbTempData, cId
m_pcIntraPrediction->predictSLum
m_pcTransform->transform4x4Blk(
xForTransform4x4Blk( pO
xQuantDequantUniform4x4
xInvTransform4x4Blk( pR
MbCoder::xScanLumaBlock( rcMbTem
m_pcMbSymbolWriteIf->re
xEncodeChromaIntra( *rpcMbTempData, uiExt
--- store estimated parameters ---
xEstimateMbPCM ( m_pcIntMbTempData, m_pcIntMbBe
xStoreEstimation( rcMbDataAccess, *m_pcIntMbBestDa m_pcMbCoder ->encode ( *pcMbDataAccess,pcMbDataAccessBase ( uiMbAddress == uiLastMbAddress ), true )
===== skip flag =====
===== base layer mode flag and base layer refineme
===== macroblock mode =====
m_pcMbSymbolWriteIf->mbMode( rcMbDataAccess )
--- reset motion pred flags ---
===== prediction info =====
m_pcMbSymbolWriteIf->transformSize8x8Flag( rcMbDat
m_pcMbSymbolWriteIf->intraPredModeLuma( rcMbDataAc
===== TEXTURE =====
xWriteTextureInfo( rcMbDataAccess,
pcMbDataAccessBase,
rcMbDataAccess.getMbTCoeffs(),
bTrafo8x8Flag,
rcMbDataAccess.getSH().getSPS()
rcMbDataAccess.getSH().getSPS()
uiMGSFragment )
xScanLumaBlock( rcMbDataAccess, rcMbTCoef
xScanChromaBlocks( rcMbDataAccess, rcMbTC
--- write terminating bit ---
m_pcMbSymbolWriteIf->terminatingBit ( bTerminateSl
uiMbAddress = rcSliceHeader.getFMO()->getNextMBNr(uiMbAddre //===== encode non-key pictures =====编码非关键帧,都是一次
xMotionEstimationFrame( iLevel, uiFrame, ePicType )
//===== get reference frame lists =====得到参考帧列表
xGetPredictionLists ( rcRefFrameList0, rcRefFrameList1,
//===== list 0 =====
----- create half-pel buffer -----
xFillAndUpsampleFrame ( pcFrame, FRAME, bFrameMbsO
pcFrame->initHalfPel( pHPData )
pcFrame->extendFrame( m_pcQuarterPelFilte
getFullPelYuvBuffer()->fillMargi
xFillPlaneMargin( getMb
xFillPlaneMargin( getMb
xFillPlaneMargin( getMb
pcQuarterPelFilter->filterFrame(
===== list 1 =====
//===== set lambda and QP =====初始化拉格朗日优化参数和QP
xInitControlDataMotion ( uiBaseLevel, uiFrame, true, ePicT
m_pcSliceEncoder->xSetPredWeights( *pcSliceHeader,
pcFrame,
rcRefFrameList0,
//===== motion estimation =====是否为宏块自适应帧场
xMotionEstimation ( &rcRefFrameList0,
&rcRefFrameList1,
pcFrame,
pcIntraRecFrame,
rcControlData,
m_bBiPredOnly,
m_uiNumMaxIter,
m_uiIterSearchRange,
uiFrameIdInGOP ,
ePicType )
//===== copy motion if non-adaptive prediction ===
//===== loop over macroblocks =====
//===== init macroblock =====得到宏块pcMbEncoder->estimatePrediction ( *pcMbDataAccess, pcMbDataAccessB *pcRefFrameList0 *pcRefFrameList1 pcBaseLayerFram pcBaseLayerResi *pcOrigFrame *pcIntraRecFrame bBiPredOnly,
uiNumMaxIter, uiIterSearchRan m_bBLSkipEnable rcControlData.g dCost,
true )
//===== P_SKIP ====跳帧
//===== inter modes with residual predict
//===== intra base layer mode =====基层层
//===== inter modes without residual pred
xEstimateMbDirect ( m_pcIntMbTempData,
//===== H.264/AVC compatible dir
rcMbDataAccess.getMvPredictorDir
xSpatialDirectMode ( eP
xSetRdCostInterMb ( *rpcMbTemp
//===== set forward / b
//===== get prediction
m_pcMotionEstimation->c
xGetB
getTa
xPred
xPred
//===== encode residual
//--- LUMA ---
xEncode4x4InterBlock( r
//--- CHROMA ---
xEncodeChromaTexture( r
xCheckSkipSliceMb( rcMb
//===== get distortion
//===== get rate =====速
MbCoder::m_pcMbSymbolWr
MbCoder::m_pcMbSymbolWr
MbCoder::m_pcMbSymbolWr
MbCoder::xWriteMotionPr
MbCoder::xWriteReferenc
MbCoder::xWriteMotionVe
//===== set rd-cost ===
m_pcRateDistortionIf->g xCheckBestEstimation( rpcMbTemp
//----- switch data obj xCheckInterMbMode8x8( rpcMbTemp
xSetRdCost8x8InterMb( *
xCheckBestE
//----- switch data obj
xEstimateMbDirect ( m_pcIntMbTempData,
在下面会有解释xEstimateMb16x16 ( m_pcIntMbTempData,
在下面会有解释xEstimateMb16x8 ( m_pcIntMbTempData,
在下面会有解释xEstimateMb8x16 ( m_pcIntMbTempData,
在下面会有解释xEstimateMb8x8 ( m_pcIntMbTempData,
在下面会有解释xEstimateMb8x8Frext ( m_pcIntMbTempData,
//===== normal intra mode =====
xEstimateMbIntra16 ( m_pcIntMbTempData,
xEstimateMbIntra8 ( m_pcIntMbTempData,
xEstimateMbIntra4 ( rcMbDataAccess, m_p
xEstimateMbIntra4 ( rcMbDataAccess, m_p
xStoreEstimation( rcMbDataAccess, *m_pcIn
//===== reset parameters: IMPORT xDecompositionFrame ( iLevel, uiFrame,ePicType )在下面会有解释xEncodeNonKeyPicture ( iLevel, uiFrame, rcAccessUnitData, cPicOutputDataList, ePi xCompositionFrame ( iLevel, uiFrame, rcPicBufferInputList, ePi xCalculateAndAddPSNR ( iLevel, uiFrame, rcPicBufferInputList, cPicOutputDataList ) xCalculateTiming(cPicOutputDataList, uiFrame )
xOutputPicData ( cPicOutputDataList ) xClearBufferExtensions()
以下为第434行的函数另起一行
xEstimateMb16x16 ( m_pcIntMbTempData, m_pcIntMbBestData, rcRefFrameList
//===== LIST 0 PREDICTION ======
rpcMbTempData->getMbDataAccess().getMvPredictor ( cMvPred
xGetMvPredictor( rcMv, scRef, eListIdx, MEDIAN, B4
m_pcMotionEstimation->estimateBlockWithStart( *rpcMbTempDat
cMvLastEst[0]
cMvPred [0]
uiBitsTest, u
PART_16x16, M
&rpcMbTempDat
//----- weighting -----
//===== FULL-PEL ESTIMATION ======
xTZSearch( pcRefPelData[0], cMv, uiMinSAD )
// limit search range
// set rcMv as start point an
xTZSearchHelp( cStrukt, rcMv.getHor(), rc
// test whether zerovektor is a better st
xTZSearchHelp( cStrukt, 0, 0, 0, 0 )
// start search
// fist search
xTZ8PointDiamondSearch( cStrukt, cSearchR
// test whether zerovektor is a better st
// calculate only 2 missing points instea
// raster search if distance is to big
// raster refinement
// star refinement
// write out best match
// test for errors in debug mode
//===== SUB-PEL ESTIMATION =====
xSubPelSearch( pcRefPelData[1], cMv, uiMinSAD, uiB
xGetSizeFromMode ( uiXSize, uiYSize,
xCompensateBlocksHalf ( m_aXHPelSearch, p
//--- get best h-pel search posi
//compute SAD for initial 1/2 pe
m_pcQuarterPelFilter->filterBloc
//1/4 pel refinement around init //===== LIST 1 PREDICTION =====
m_pcMotionEstimation->compensateBlock ( &cYuvM
PART_
xGetSizeFromMode( uiXSize, uiYSize, uiMod //===== BI PREDICTION =====
//----- initialize with forward and backward estim
//----- iterative search -----
m_pcMotionEstimation->estimateBlockWithStart( *rpc
cMv
cMv
uiB
PAR
uiI
//----- standard weighting -----
m_pcSampleWeighting->inverseLumaSamples
//===== FULL-PEL ESTIMATION ======
xPelBlockSearch ( pcRefPelData[0], cM
//===== SUB-PEL ESTIMATION =====
xSubPelSearch( pcRefPelData[1], cMv, uiM
xGetSizeFromMode ( uiXSize,
xCompensateBlocksHalf ( m_aXHPel
//--- get best h-pel se
//compute S
//1/4 pel refinement ar
m_pcMotionEstimation->compensateBlock ( &cYuvM
PART_1
//===== chose parameters =====
//----- list 1 prediction -----
xSetRdCostInterMb ( *rpcMbTempData, pcMbDataAccessBase, r
false, 0, false, 0, bLowComplexMbEna
xCheckBestEstimation( rpcMbTempData, rpcMbBestData )
xCheckInterMbMode8x8( rpcMbTempData, rpcMbBestData, pcMbRe 以下为第435行的函数另起一行
xEstimateMb16x8 ( m_pcIntMbTempData, m_pcIntMbBestData, rcRefFrameList
//===== LIST 0 PREDICTION ======
m_pcMotionEstimation->estimateBlockWithStart( *rpcMbTempDa
cMvLastEst[0
cMvPred [0
uiBitsTest,
eParIdx, MOD
&rpcMbTempDa
//===== FULL-PEL ESTIMATION ====
//===== SUB-PEL ESTIMATION =====
//===== LIST 1 PREDICTION =====
m_pcMotionEstimation->estimateBlockWithStart( *rpcMbTempDa
cMvLastEst[1
cMvPred [1
uiBitsTest,
eParIdx, MOD
&rpcMbTempDa
m_pcMotionEstimation->compensateBlock ( &cYuvMbBuffer[1
//===== BI PREDICTION =====
//----- initialize with forward and backward estimation ---
//----- iterative search -----
m_pcMotionEstimation->estimateBlockWithStart( *rpcMbTempDa
cMvLastEst[u
cMvPred [u
uiBitsTest,
eParIdx, MOD
uiIterSearch
m_pcMotionEstimation->compensateBlock ( &cYuvMbBuffer[u
eParIdx, MODE_1
//===== chose parameters =====
xSetRdCostInterMb ( *rpcMbTempData, pcMbDataA
false, 0, false, 0, bLowComplexMbEna
xCheckBestEstimation( rpcMbTempData, rpcMbBestData )
xCheckInterMbMode8x8( rpcMbTempData, rpcMbBestData, pcMbRe 以下为第437行的函数另起一行
xEstimateMb8x8 ( m_pcIntMbTempData, m_pcIntMbBestData, rcRefFrameList
xEstimateSubMbDirect ( ePar8x8, m_pcIntMbTemp8x8Data, m_pc
rcMbDataAccess.getMvPredictorDirect( eParIdx8x8, b
xSetRdCostInterSubMb( *rpcMbTempData, rcRefFrameLi
xCheckBestEstimation( rpcMbTempData, rpcMbBestDat
xEstimateSubMb8x8 ( ePar8x8, m_pcIntMbTemp8x8Data, m_pc
//===== LIST 0 PREDICTION ======
m_pcMotionEstimation->estimateBlockWithStart( *rp
cMv
cMv
uiB
ePa
&r
//===== LIST 1 PREDICTION =====
m_pcMotionEstimation->estimateBlockWithStart( *rp
cMv
cMv
uiB
ePa
&rp
m_pcMotionEstimation->compensateBlock ( &cYuvM
eParId
//===== BI PREDICTION =====
m_pcMotionEstimation->estimateBlockWithStart( *rp
cMv
cMv
uiB
ePa
uiI
m_pcMotionEstimation->compensateBlock ( &cYuv
ePar
//===== chose parameters =====
xSetRdCostInterSubMb( *rpcMbTempData, rcRefFrameLi
xCheckBestEstimation( rpcMbTempData, rpcMbBestDat
xEstimateSubMb8x4 ( ePar8x8, m_pcIntMbTemp8x8Data, m_pcIn
//===== LIST 0 PREDICTION ======
//===== LIST 1 PREDICTION =====
//===== BI PREDICTION =====
//===== chose parameters =====
xSetRdCostInterSubMb( *rpcMbTempData, rcRefFrameLi
xCheckBestEstimation( rpcMbTempData, rpcMbBestDat
xEstimateSubMb4x8 ( ePar8x8, m_pcIntMbTemp8x8Data, m_pcIn
//===== LIST 0 PREDICTION ======
//===== LIST 1 PREDICTION =====
//===== BI PREDICTION =====
//===== chose parameters =====
//===== set parameters and compare =====
xSetRdCostInterSubMb( *rpcMbTempData, rcRefFrameLi
xCheckBestEstimation( rpcMbTempData, rpcMbBestDat
xEstimateSubMb4x4 ( ePar8x8, m_pcIntMbTemp8x8Data, m_pcIn
//===== LIST 0 PREDICTION ======
//===== LIST 1 PREDICTION =====
//===== BI PREDICTION =====
//===== chose parameters =====
//===== set parameters and compare =====
xSetRdCostInterSubMb( *rpcMbTempData, rcRefFrameLi
xCheckBestEstimation( rpcMbTempData, rpcMbBestDat
//----- store parameters in MbTempData -----
//----- set parameters in MbTemp8x8Data for prediction of n
xSetRdCostInterMb ( *rpcMbTempData, pcMbDataAccessBase, r
false, 0, false, 0, bLowComplexMbEna
xCheckBestEstimation( rpcMbTempData, rpcMbBestData )
以下为第438行的函数另起一行
xEstimateMb8x8Frext ( m_pcIntMbTempData, m_pcIntMbBestData, rcRefFrameList
xEstimateSubMbDirect ( ePar8x8, m_pcIntMbTemp8x8Data, m_pc
xSetRdCostInterSubMb( *rpcMbTempData, rcRefFrameLi
xCheckBestEstimation( rpcMbTempData, rpcMbBestDat
xEstimateSubMb8x8 ( ePar8x8, m_pcIntMbTemp8x8Data, m_pc
//===== LIST 0 PREDICTION ======
m_pcMotionEstimation->estimateBlockWithStart( *rp
cMv
cMv
uiB
ePa
&rp
//===== LIST 1 PREDICTION =====
m_pcMotionEstimation->estimateBlockWithStart( *rp
cM
cM
ui
eP
&r
m_pcMotionEstimation->compensateBlock
eParI
//===== BI PREDICTION =====
m_pcMotionEstimation->estimateBlockWithStart( *rp
cM
cM
ui
eP
ui
m_pcMotionEstimation->compensateBlock ( &cYuvM
eParId
//===== chose parameters =====
//===== set parameters and compare =====
xSetRdCostInterSubMb( *rpcMbTempData, rcRefFrameLi
xCheckBestEstimation( rpcMbTempData, rpcMbBestDat
//----- store parameters in MbTempData -----
//----- set parameters in MbTemp8x8Data for prediction of n
xCheckInterMbMode8x8( rpcMbTempData, rpcMbBestData, pcMbRe 以下为第446行的函数另起一行
xDecompositionFrame ( iLevel, uiFrame,ePicType )
//===== get reference frame lists =====
xGetPredictionLists ( rcRefFrameList0, rcRefFrameList1,
//===== set lambda and QP =====
//===== prediction =====
xMotionCompensation ( pcMCFrame, &rcRefFrameList0, &rcRefF
//===== loop over macroblocks =====
pcMbEncoder->compensatePrediction( *pcMbDataAccess
pcMCFrame->get
*apcRefFrameLis
*apcRefFrameLis
bCalcMv, bFaul
pcFrame->prediction ( pcMCFrame, pcFrame, ePicType )
getFullPelYuvBuffer()->prediction( pcSrcFrame->get
pcMCPFrame->get
//===== set residual =====
pcResidual->copy ( pcFrame , ePicType 以下为第447行的函数另起一行
xEncodeNonKeyPicture ( iLevel, uiFrame, rcAccessUnitData, cPicOutputD
//===== base layer encoding =====
pcBLRecFrame->copy ( pcFrame, ePicType ) xEncodeHighPassSignal ( rcOutputList,
rcControlData,
pcOrgFrame,
pcBLRecFrame,
pcResidual,
pcPredSignal,
uiBits,
uiBitsRes, rcPicOutputDataList, ePicType )
//----- Subsequence SEI -----
//----- init NAL UNIT -----
//---- write Slice Header -----
m_pcNalUnitEncoder->write( *pcSliceHeader )
//----- write slice data -----
m_pcSliceEncoder->encodeHighPassPicture ( uiMbCode
uiBits,
*pcSlice
pcOrgFr
pcFrame
pcResid
pcPredS
rcContr
rcContr
rcContr
rcContr
m_uiFra
rcContr
m_iMaxD
ePicTyp
//====== initialization ======
//===== loop over macroblocks =====
m_pcMbEncoder ->encodeResidual ( *pcMbD
pcOrg
pcFra
pcRes
pcBas
bCode
dLamb
iMaxD
//----- encode luminance signal
xEncode4x4InterBlock( *m_pcIntMb
//----- encode chrominance signa
xEncodeChromaTexture( *m_pcIntMb
//----- set parameters ----
//----- fix QP ------
//--- set parameters
//----- store parameters and rec
//----- store "base layer" resid
//----- set residual prediction
// restore original residual
m_pcMbCoder->encode( *pcMbDataAccess, pcM
//===== skip flag =====
//===== base layer mode flag and
//===== macroblock mode =====
//--- reset motion pred flags --
//===== prediction info =====
//===== MOTION INFORMATION =====
//===== TEXTURE =====
xWriteTextureInfo( rcMbDataAcces
pcMbDataAcces
rcMbDataAcces
bTrafo8x8Flag
rcMbDataAcces
rcMbDataAcces
uiMGSFragment
xScanChromaBlocks( rcMb
//--- write terminating bit ---
//----- close NAL UNIT -----
以下为第448行的函数另起一行
xCompositionFrame ( iLevel, uiFrame, rcPicBufferInputList,
//--- highest FGS reference for closed-loop coding ---
//===== get reference frame lists =====
xMotionCompensation ( pcMCFrame, &rcRefFrameList0,
rcControlData.getMbDataCtrl()
pcFrame ->inversePrediction ( pcMCFrame, pcFrame, ePicType
//----- store non-deblocked signal for inter-layer predicti
//===== de-blocking =====
m_pcLoopFilter->process( *pcSliceHeader, pcFrame, pcResidua
//===== filtering =====
xFilterMb( *pcMbDataAccess, pcFrameBuffer, pcResid
//===== check residual blocks and set "re
//===== set mode parameters =====
//===== determine boundary filter strengt
xGetVerFilterStrength( rcMbDataAccess, cI
xGetHorFilterStrength( rcMbDataAccess, cI
//===== filtering =====滤波
//--- highest FGS reference for closed-loop coding ---
集,在没有写SPS和PPS时结束循环
ired frame buffers =====
yers; uiLayer++ )//uiNumLayers=2 是配置文件里的输入层数
ame; uiFrame++ )//maxframe = FrameToBeEncode
and read original pictures =====
< uiNumLayers; uiLayer++ )
每两个图像调用一次,但是在函数内部是一个GOP处理一次
s( cOutExtBinDataAccessorList,
apcOriginalPicBuffer,
apcReconstructPicBuffer,
acPicBufferOutputList,
acPicBufferUnusedList )
r->process( rcExtBinDataAccessorList,
apcOriginalPicBuffer,
apcReconstructPicBuffer,
apcPicBufferOutputList,
apcPicBufferUnusedList )
ll lists =====
uiHighestLayer = m_pcCodingParameter->getNumberOfLayers() - 1;
for( UInt uiLayer = 0; uiLayer <= uiHighestLayer; uiLayer++ )//循环numlayer次
m_acOrgPicBufferList [ uiLayer ].push_back( apcOriginalPicBuffer [ uiLayer ] );
m_acRecPicBufferList [ uiLayer ].push_back( apcReconstructPicBuffer[ uiLayer ] );
of GOP =====//只有17帧都读进来后才会进入xProcessGOP函数
if ( m_acOrgPicBufferList[uiHighestLayer].size() == uiTargetSize )//targetSize = 17 GOP+1 OK( xProcessGOP( apcPicBufferOutputList, apcPicBufferUnusedList ) );//17帧入buffer后才调date data accessor list =====
m_cAccessUnitDataList.emptyNALULists( rcExtBinDataAccessorList );
L unit buffers =====
tList[uiLayer], uiLayer )
dList[uiLayer], uiLayer )
constructed pictures =====
ssGOP( apcPicBufferOutputList, apcPicBufferUnusedList )?????
or list =====
r-1]->finish( ruiNumCodedFrames, rdHighestLayerOutputRate, m_aaadFinalFramerate, m_aaa
====
ed pictures =====
mary =====
ferUnusedList )
CGSSNR,BaseLayerCGSSNR,BaseQualityLevelCGSSNR,initGOP
ayers(); uiLayer++ )
units =====分图像,分层处理
pcCodingParameter->getNumberOfLayers(); uiLayer ++ )
ayer]->process( uiAUIndex,
m_cAccessUnitDataList.getAccessUnitData( uiAUIndex ),
m_acOrgPicBufferList [uiLayer],
m_acRecPicBufferList [uiLayer],
apcPicBufferUnusedList[uiLayer],
m_pcParameterSetMng )
===== init some parameters =====
===== update higher layer pictures ===== 分为16次
//===== encode key pictures =====编码关键帧,都是一次?编码非关键帧见298新起一行
LayerEncoder::xEncodeKeyPicture ( bPicCoded, uiKeyFrame, rcAccessUnit
===== check for first GOP =====
xSetBaseLayerData( uiFrameIdInGOP, ePicType )
===== initialize =====
xInitControlDataLowPass ( uiFrameIdInGOP, m_uiDecompositionStages-1, uiF
xInitBaseLayerData( rcControlData,uiBaseLevel,uiFrame, false, &
===== init =====
===== motion data =====
===== residual data =====
==== reconstructed (intra) data =====
//xSetPredWeights
===== base layer encoding =====
===== primary picture coding =====
pcBLRecFrame->copy ( pcFrame, ePicType )
getFullPelYuvBuffer()->copy( pcSrcFrame->getFullPelYuvBuffer())
===== luminance =====
===== chrominance U =====
===== chrominance V =====
LayerEncoder::xEncodeLowPassSignal(rcOutputList,
rcControlData,
pcFrame,
pcBLRecFrame,
pcResidual,
pcPredSignal,
uiBits,
rcPicOutputDataList,
ePicType )
----- subsequence SEI -----
LayerEncoder::xWriteSEI( rcOutExtBinDataAcces
pcSubSeqInfo->init( uiSubSeqLayer, 0
m_pcNalUnitEncoder->write( cSEIMessa
SEI::write( m_pcHeaderSymbo
===== NAL unit hea
xWrite( pcWriteIf,
m_pcNalUnitEncoder->closeNalUnit( ui
===== write trailing bits =
xWriteTrailingBits()
m_pcBitWriteBuffer->flushBu
===== convert to payload an
convertRBSPToPayload( uiBit
===== NAL unit hea
===== NAL unit pay
m_pcBinDataAccessor->decrea
==== reset parameters =====
xWritePrefixUnit( rcOutExtBinDataAccessorList
m_pcNalUnitEncoder->writePrefix( rcS
rcSH.writePrefix( *m_pcHead
PrefixHeader::writ
m_pcNalUnitEncoder->closeNalUnit( ui
----- init NAL UNIT -----
---- write Slice Header -----
m_pcNalUnitEncoder->write ( *pc
----- modify copy of slice he
----- write copy of slice header ---
cSH.write( *pcCurrWriteIf )
----- update -----
----- encode slice data -----
m_pcSliceEncoder->encodeIntraPicture ( uiBit
rcCon
pcFra
pcRes
pcBas
pcPre
m_uiF
rcCon
ePicT
----- close NAL UNIT -----
m_pcNalUnitEncoder->closeAndAppendNalUnits( a
r
&
m
m
m
m ===== deblock and store picture for prediction of following low-pass fra
----- store for inter-layer prediction (non-deblocked version) -----
m_papcSubband[ uiFrameIdInGOP ]->copy( pcBLRecFrame, ePicType )
----- de-blocking -----
m_pcLoopFilter->process( *pcSliceHeader, pcBLRecFrame, pcResidual, pcMbD ===== filtering =====
xFilterMb( *pcMbDataAccess, pcFrameBuffer, pcResidualBuffer, pc ----- store for prediction of following low-pass pictures -----
m_pcLowPassBaseReconstruction->copy( pcBLRecFrame, ePicType )
pcFrame->copy( pcBLRecFrame, ePicType )
xUpdateLowPassRec()
xCalculateAndAddPSNR ( m_uiDecompositionStages, uiKeyFrame, rcPicBufferInputList xCalculateTiming(cPicOutputDataList, uiKeyFrame )
xOutputPicData ( cPicOutputDataList )//打印出结果
//xClearBufferExtensions()
到此LayerEncoder::m_apcLayerEncoder[uiLayer]->process结束