按照调用层次结构列出各个cpp文件
//TEncTop.cpp中encode()函数
按调用顺序列出各个cpp文件
//TAppEncTop.cpp中 ,仅列出重要函数
Void TAppEncTop::encode()
{
--------------省略一部分函数-----------------
while ( !bEos )//该循环直到所有需要编码的帧已编码后才结束,否则bEos一直为false
{
--------------省略一部分函数-----------------
// increase number of received frames
m_iFrameRcvd++;
bEos = (m_isField && (m_iFrameRcvd == (m_framesToBeEncoded >> 1) )) || ( !m_isField && (m_iFrameRcvd == m_framesToBeEncoded) );
Bool flush = 0;
// if end of file (which is only detected on a read failure) flush the encoder of any queued pictures
if (m_cTVideoIOYuvInputFile.isEof())
{
flush = true;
bEos = true;
m_iFrameRcvd--;
m_cTEncTop.setFramesToBeEncoded(m_iFrameRcvd);
}
// call encoding function for one frame
if ( m_isField )
{
m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, flush ? 0 : &cPicYuvTrueOrg, snrCSC, m_cListPicYuvRec, outputAccessUnits, iNumEncoded, m_isTopFieldFirst );
}
else
{
m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, flush ? 0 : &cPicYuvTrueOrg, snrCSC, m_cListPicYuvRec, outputAccessUnits, iNumEncoded );
}
// write bistream to file if necessary
if ( iNumEncoded > 0 )
{
xWriteOutput(bitstreamFile, iNumEncoded, outputAccessUnits);
outputAccessUnits.clear();
}
// temporally skip frames
if( m_temporalSubsampleRatio > 1 )
{
m_cTVideoIOYuvInputFile.skipFrames(m_temporalSubsampleRatio-1, m_inputFileWidth, m_inputFileHeight, m_InputChromaFormatIDC);
}
}
m_cTEncTop.printSummary(m_isField);
--------------省略一部分函数-----------------
return;
}
TEncTop.cpp中encode()函数
Void TEncTop::encode( Bool flush, TComPicYuv* pcPicYuvOrg, TComPicYuv* pcPicYuvTrueOrg, const InputColourSpaceConversion snrCSC, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded )
{
--------------省略一部分函数-----------------
if ((m_iNumPicRcvd == 0) || (!flush && (m_iPOCLast != 0) && (m_iNumPicRcvd != m_iGOPSize) && (m_iGOPSize != 0)))
{
iNumEncoded = 0;
return; //每次读取m_iGOPSize后才会进入下面的m_cGOPEncoder.compressGOP()来编码,否则跳出该encode()
}
if ( m_RCEnableRateControl )
{
m_cRateCtrl.initRCGOP( m_iNumPicRcvd );
}
// compress GOP
m_cGOPEncoder.compressGOP(m_iPOCLast, m_iNumPicRcvd, m_cListPic, rcListPicYuvRecOut, accessUnitsOut, false, false, snrCSC, m_printFrameMSE);
if ( m_RCEnableRateControl )
{
m_cRateCtrl.destroyRCGOP();
}
iNumEncoded = m_iNumPicRcvd;
m_iNumPicRcvd = 0;
m_uiNumAllPicCoded += iNumEncoded;
}
TEncGOP.cpp中compressGOP函数
//TEncGOP.cpp
//compressGOP是一个很长的函数,这里只列出重要的函数
//输入是一个GOP的图像,利用for循环对每一帧处理
Void TEncGOP::compressGOP( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic,
TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsInGOP,
Bool isField, Bool isTff, const InputColourSpaceConversion snr_conversion, const Bool printFrameMSE )
{
--------------省略一部分函数-----------------
//对每帧处理
for ( Int iGOPid=0; iGOPid < m_iGopSize; iGOPid++ )//遍历GOP每帧图像
{
--------------省略一部分函数-----------------
//对每个Slice处理,但平台默认一帧就是一个slice
for(UInt nextCtuTsAddr = 0; nextCtuTsAddr < numberOfCtusInFrame; )
{
--------------省略一部分函数-----------------
m_pcSliceEncoder->precompressSlice( pcPic );
m_pcSliceEncoder->compressSlice ( pcPic, false, false );
--------------省略一部分函数-----------------
}
}
}