HM_SCC的调色板模式palette_mode编码流程整理
不足之处,还请各位大佬多多指教。
HM_SCC_plt_framework
TEncGOP::TEncGOP(){
m_numPalettePred = 0;
m_encodePPSPalette = false;
}
Void TAppEncTop::encode(){
// initialize internal class & member variables
xInitLibCfg();
Void TAppEncTop::xInitLibCfg(){
// SCM new added variables
m_cTEncTop.setUsePaletteMode ( m_usePaletteMode );(542-546)
m_cTEncTop.setPaletteMaxSize ( m_paletteMaxSize );
m_cTEncTop.setPaletteMaxPredSize ( m_paletteMaxPredSize );
m_cTEncTop.setPalettePredInSPSEnabled ( m_palettePredInSPSEnabled );
m_cTEncTop.setPalettePredInPPSEnabled ( m_palettePredInPPSEnabled );
}
xCreateLib();
Void TAppEncTop::xCreateLib(){
m_cTEncTop.create();
Void TEncTop::create (){
m_cCuEncoder.create( m_maxTotalCUDepth, m_maxCUWidth, m_maxCUHeight, m_chromaFormatIDC, m_paletteMaxSize, m_paletteMaxPredSize );
Void TEncCu::create(){
...
}
}
}
xInitLib(m_isField);
Void TAppEncTop::xInitLib(Bool isFieldCoding){
m_cTEncTop.init(isFieldCoding);
Void TEncTop::init(Bool isFieldCoding){
Void TEncTop::xInitSPS(TComSPS &sps){
// Set up SPS screen extension settings
sps.getSpsScreenExtension().setUsePaletteMode( m_usePaletteMode );
sps.getSpsScreenExtension().setPaletteMaxSize( m_paletteMaxSize );
sps.getSpsScreenExtension().setPaletteMaxPredSize( m_paletteMaxPredSize );
sps.getSpsScreenExtension().setMotionVectorResolutionControlIdc( m_motionVectorResolutionControlIdc );
assert( m_paletteMaxPredSize <= 128 );
}
}
}
// call encoding function for one frame
if ( m_isField ) //场编码
// { (399-476,TEncTop.cpp)
// m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, flush ? 0 : &cPicYuvTrueOrg, snrCSC, m_cListPicYuvRec, outputAccessUnits, iNumEncoded, m_isTopFieldFirst );
// Void TEncTop::encode(){
// compressGOP(); 469
// }
// }
else
{
m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, flush ? 0 : &cPicYuvTrueOrg, snrCSC, m_cListPicYuvRec, outputAccessUnits, iNumEncoded );
Void TEncTop::encode(){
compressGOP();
}
}
Void TEncGOP::compressGOP(){
printf(" => sending PPS %u with %u elements\n", pcSlice->getPPS()->getPPSId(), pcSlice->getPPS()->getPpsScreenExtension().getNumPalettePred()); //1853
m_pcSliceEncoder->precompressSlice( pcPic );
Void TEncSlice::precompressSlice( TComPic* pcPic ){
}
m_pcSliceEncoder->compressSlice ( pcPic, false, false );
Void TEncSlice::compressSlice( TComPic* pcPic, const Bool bCompressEntireSlice, const Bool bFastDeltaQP ){
/* slice-plt-initialize*/
palette_initialize {...};
else
{
xSetPredDefault(lastPalette, lastPaletteSize, pcSlice);
}
// This will only occur if dependent slice-segments (m_entropyCodingSyncContextState=true) are being used.
if( pCurrentTile->getTileWidthInCtus() >= 2 || !m_pcCfg->getEntropyCodingSyncEnabledFlag() ){
//初始化;
}
// run CTU trial encoder
m_pcCuEncoder->compressCtu( pCtu, lastPaletteSize, lastPalette ); 933 //默认不执行这个
m_pcCuEncoder->compressCtu( pCtu, lastPaletteSize, lastPalette ); 1254 //************默认执行这句********************//
Void TEncCu::compressCtu( TComDataCU* pCtu, UChar* lastPaletteSize, Pel lastPalette[][MAX_PALETTE_PRED_SIZE] ){
palette_initialize;
xcompressCU();
Void TEncCu::xCompressCU( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, const UInt uiDepth DEBUG_STRING_FN_DECLARE(sDebug_), PartSize eParentPartSize )
{
...
palette_initialize;
/***********************************************************************************************************************************/
testedModes[iterNumber]=xCheckPaletteMode( rpcBestCU, rpcTempCU, false, iterNumber, paletteSize); 1094,1102,1109,1116,
unsigned int TEncCu::xCheckPaletteMode(){
3447-3470
//搜索最佳调色板,返回无符号整型 testedModes表示成功与否。
UInt testedModes=m_pcPredSearch->paletteSearch(...); 3460
UInt TEncSearch::paletteSearch(){ 8038-8334
}
}
/***********************************************************************************************************************************/
Void TEncCu::xCheckRDCostIntra( TComDataCU *&rpcBestCU,TComDataCU *&rpcTempCU,Double &cost,PartSize eSize DEBUG_STRING_FN_DECLARE(sDebug), Bool bRGBIntraModeReuse){
m_pcEntropyCoder->encodePaletteModeInfo( rpcTempCU, 0, true, &bCodeDQP, &codeChromaQpAdjFlag );
}
Void TEncCu::xCheckIntraPCM( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU ){
m_pcEntropyCoder->encodePaletteModeInfo( rpcTempCU, 0, true );
}
Void TEncCu::xCheckDQP( TComDataCU* pcCU ){
if ( pcCU->getQtRootCbf( 0) || ( pcCU->getPaletteModeFlag(0) && pcCU->getPaletteEscape(COMPONENT_Y, 0) ) ){...}
}
Void TEncCu::xCheckRDCostIntraCSC(){
m_pcEntropyCoder->encodePaletteModeInfo( rpcTempCU, 0, true, &bCodeDQP, &codeChromaQpAdjFlag );
}
}
}
// encode CTU and calculate the true bit counters.
m_pcCuEncoder->encodeCtu( pCtu );
m_pcCuEncoder->encodeCtu( pCtu ); 1596 //************默认执行这句进入CTU编码********************//
Void TEncCu::encodeCtu ( TComDataCU* pCtu ){
// Encode CU data
xEncodeCU( pCtu, 0, 0 );
Void TEncCu::xEncodeCU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
{
}
}
}
// SCM added functions
Void TEncSlice::xSetPredFromPPS(Pel lastPalette[MAX_NUM_COMPONENT][MAX_PALETTE_PRED_SIZE], UChar lastPaletteSize[MAX_NUM_COMPONENT], TComSlice *pcSlice)
Void TEncSlice::xSetPredFromSPS(Pel lastPalette[MAX_NUM_COMPONENT][MAX_PALETTE_PRED_SIZE], UChar lastPaletteSize[MAX_NUM_COMPONENT], TComSlice *pcSlice)
Void TEncSlice::xSetPredDefault(Pel lastPalette[MAX_NUM_COMPONENT][MAX_PALETTE_PRED_SIZE], UChar lastPaletteSize[MAX_NUM_COMPONENT], TComSlice *pcSlice)
}
}