對於單通道視頻而言,在HM中獲取相鄰PU的模式信息,這個已經可以很方便的獲得,詳見http://blog.csdn.net/yangxiao_xiang/article/details/8478283。但是對於多視點平臺而言,有時候需要獲得當前視點對應深度圖像的某個PU的模式信息,或者是當前POC的某個視點的PU的模式信息,爲了解決這個問題,在HTM中專門提供了一個選擇不同圖像的接口。下面以HTM 8.0爲例,簡單地介紹其功能。
在接口定義在TEncTop層,該層是頂層編碼層,因此在該層可以利用該接口完成不同layer之間的接入。
class TEncTop : public TEncCfg
{
TComPicLists* m_ivPicLists; ///< access to picture lists of otherlayers
TComPicLists* getIvPicLists() {return m_ivPicLists; }
}
接下來,認識TComPicLists這個類。
class TComPicLists
{
private:
TComList<TComList<TComPic*>*> m_lists;
#if H_3D
TComVPS* m_vps;
#endif
public:
Void push_back(TComList<TComPic*>* list ) { m_lists.push_back( list ); }
Int size () { return (Int)m_lists.size(); }
TComPic* getPic ( Int layerIdInNuh, Int poc );
TComPicYuv* getPicYuv( Int layerIdInNuh, Int poc, Bool recon );
#if H_3D
Void setVPS ( TComVPS* vps ) { m_vps = vps; };
TComPic* getPic ( Int viewIndex, Bool depthFlag, Int poc );
TComPicYuv* getPicYuv( Int viewIndex, Bool depthFlag, Int poc, Boolrecon );
#endif
Void print( );
}; // END CLASS DEFINITION TComPicLists
然後就可以發現裏面定義很多可以使用的接口,
TComPic* getPic ( Int layerIdInNuh, Int poc ); 這個是圖像返回指針,也就是我們需要的。
因此,我們可以採用以下方式獲取某個layer的圖像接口。以下是我獲取當前視點深度圖像的方法:
if(m_pcEncTop->getIsDepth())
{
TComPicLists*ivPicLists = m_pcEncTop->getIvPicLists();
TComPic*pcTextPic = ivPicLists->getPic(getLayerId()-1,pcPic->getPOC());
}
爲了得到PU的模式信息,還需要再TComDataCU::initCU函數中進行修改。
if( m_uiCUAddr / uiWidthInCU )
{
m_pcCUAbove = pcPic->getCU( m_uiCUAddr - uiWidthInCU );
}
if( m_pcCULeft && m_pcCUAbove )
{
m_pcCUAboveLeft = pcPic->getCU( m_uiCUAddr - uiWidthInCU - 1 );
}
if( m_pcCUAbove && ( (m_uiCUAddr%uiWidthInCU) < (uiWidthInCU-1) ) )
{
m_pcCUAboveRight = pcPic->getCU( m_uiCUAddr - uiWidthInCU + 1 );
}
if( getSlice()->getNumRefIdx( REF_PIC_LIST_0 ) > 0 )
{
m_apcCUColocated[0] = getSlice()->getRefPic( REF_PIC_LIST_0,0)->getCU( m_uiCUAddr );
}
if( getSlice()->getNumRefIdx( REF_PIC_LIST_1 ) > 0 )
{
m_apcCUColocated[1] = getSlice()->getRefPic( REF_PIC_LIST_1,0)->getCU( m_uiCUAddr );
}
if(m_pcPic->getIsDepth())
{
m_pcCUColorPic =m_pcPic->getTextPic()->getCU( m_uiCUAddr );
}
注意:關於m_pcCUColorPic 創建、釋放,以及指針的獲取,可以參考m_pcCULeft、m_pcCUAbove等指針。