📄 sesenc.cpp
字号:
rgpvoenc [BASE_LAYER] -> codeGOVHead (iRefFrame - m_iFirstFrame + iDT);
//modified by SONY (98/03/30) End
/* rgpvoenc [BASE_LAYER] -> codeGOVHead (iSearchFrame - m_iFirstFrame);
Original*/ // why was this changed? - swinder
rgpostrm [BASE_LAYER]->write (rgpvoenc [BASE_LAYER]->pOutStream ()->str (),
rgpvoenc [BASE_LAYER]->pOutStream ()->pcount ());
}
//980212
int iGOPperiod = (volmd.iPbetweenI + 1) * (volmd.iBbetweenP + 1);
if (rgpvoenc [BASE_LAYER]->m_uiRateControl >= RC_TM5 && iGOPperiod != 0
&& ((iSearchFrame-m_iFirstFrame) % (iGOPperiod * volmd.iTemporalRate)) == 0)
{
Int nppic, npic = (m_iLastFrame - iSearchFrame + 1) / volmd.iTemporalRate;
if (iRefFrame == m_iFirstFrame) {
if (npic > (iGOPperiod - volmd.iBbetweenP))
npic = iGOPperiod - volmd.iBbetweenP;
} else {
npic += volmd.iBbetweenP;
if (npic > iGOPperiod)
npic = iGOPperiod;
}
nppic = (npic + volmd.iBbetweenP) / (volmd.iBbetweenP + 1) - 1;
rgpvoenc [BASE_LAYER] -> m_tm5rc.tm5rc_init_GOP(nppic, npic - nppic - 1); // np, nb remain
}
// encode IVOP
encodeVideoObject(bObjectExists, bPrevObjectExists, iSearchFrame, IVOP, bCachedRefDump ? DUMP_PREV : DUMP_NONE, // modified by Sharp (99/1/27)
iVO, iVOrelative, BASE_LAYER,
pfYuvSrc, pfSegSrc, ppfAuxSrc,
rgpfReconYUV, rgpfReconSeg, rgpfReconAux,
pxlcObjColor, rgpvoenc, volmd, rgpostrm);
bCachedRefDump = TRUE; // need to output this frame later
bCachedRefCoded = bObjectExists;
iPCount = volmd.iPbetweenI;
//OBSS_SAIT_991015
if (m_rgbSpatialScalability [iVOrelative] && !bTemporalScalability ) { // modified by Sharp
pvopcBasePVOPQuant = new CVOPU8YUVBA (*(rgpvoenc [BASE_LAYER]->pvopcReconCurr ()),
rgpvoenc [BASE_LAYER]->pvopcReconCurr ()->whereY());
//for OBSS BVOP_BASE : stack
//OBSSFIX_MODE3
if(rgpvoenc[ENHN_LAYER]->volmd().fAUsage == ONE_BIT &&
!(rgpvoenc[ENHN_LAYER]->volmd().iEnhnType != 0 && rgpvoenc[ENHN_LAYER]->volmd().iuseRefShape == 1)) {
// if(rgpvoenc[ENHN_LAYER]->volmd().fAUsage == ONE_BIT) {
//~OBSSFIX_MODE3
pBase_stack_rctBase = rgpvoenc [BASE_LAYER] -> getBaseRct();
iBase_stack_x = rgpvoenc [BASE_LAYER] -> m_iNumMBX;
iBase_stack_y = rgpvoenc [BASE_LAYER] -> m_iNumMBY;
pBase_stack_Baseshpmd = new ShapeMode [iBase_stack_x*iBase_stack_y];
Int i;
for(i=0;i<iBase_stack_x*iBase_stack_y;i++)
pBase_stack_Baseshpmd[i] = (rgpvoenc[BASE_LAYER] ->shapemd())[i];
pBase_stack_mvBaseBY = new CMotionVector [iBase_stack_x*iBase_stack_y];
for(i=0;i<iBase_stack_x*iBase_stack_y;i++)
pBase_stack_mvBaseBY[i] = (rgpvoenc[BASE_LAYER] ->getmvBaseBY())[i];
}
//~for OBSS BVOP_BASE : stack
}
//~OBSS_SAIT_991015
// begin: added by Sharp (98/2/12)
else if (m_rgbSpatialScalability [iVOrelative] && bTemporalScalability)
pBufP2->getBuf( rgpvoenc[BASE_LAYER] );
// end: added by Sharp (98/2/12)
}
else
{
// encoder PVOP
encodeVideoObject(bObjectExists, bPrevObjectExists, iSearchFrame, (m_rguiSpriteUsage [iVOrelative]==0 ? PVOP : SPRITE), bCachedRefDump ? DUMP_PREV : DUMP_NONE, // modified by Sharp (99/1/27) // GMC
iVO, iVOrelative, BASE_LAYER,
pfYuvSrcSpatialEnhn, pfSegSrc, ppfAuxSrc,
rgpfReconYUV, rgpfReconSeg, rgpfReconAux,
pxlcObjColor, rgpvoenc, volmd, rgpostrm);
bCachedRefDump = TRUE; // need to output this frame later
bCachedRefCoded = bObjectExists;
//OBSS_SAIT_991015
if (m_rgbSpatialScalability [iVOrelative] && !bTemporalScalability ) { // modified by Sharp (98/2/12)
pvopcBasePVOPQuant = new CVOPU8YUVBA (*(rgpvoenc [BASE_LAYER]->pvopcReconCurr ()),
rgpvoenc [BASE_LAYER]->pvopcReconCurr ()->whereY());
//OBSS BVOP_BASE : stack
//OBSSFIX_MODE3
if(rgpvoenc[ENHN_LAYER]->volmd().fAUsage == ONE_BIT &&
!(rgpvoenc[ENHN_LAYER]->volmd().iEnhnType != 0 && rgpvoenc[ENHN_LAYER]->volmd().iuseRefShape == 1 )) {
// if(rgpvoenc[ENHN_LAYER]->volmd().fAUsage == ONE_BIT) {
//~OBSSFIX_MODE3
pBase_stack_rctBase = rgpvoenc [BASE_LAYER] -> getBaseRct();
iBase_stack_x = rgpvoenc [BASE_LAYER] -> m_iNumMBX;
iBase_stack_y = rgpvoenc [BASE_LAYER] -> m_iNumMBY;
pBase_stack_Baseshpmd = new ShapeMode [iBase_stack_x*iBase_stack_y];
Int i;
for(i=0;i<iBase_stack_x*iBase_stack_y;i++)
pBase_stack_Baseshpmd[i] = (rgpvoenc[BASE_LAYER] ->shapemd())[i];
pBase_stack_mvBaseBY = new CMotionVector [iBase_stack_x*iBase_stack_y];
for(i=0;i<iBase_stack_x*iBase_stack_y;i++)
pBase_stack_mvBaseBY[i] = (rgpvoenc[BASE_LAYER] ->getmvBaseBY())[i];
}
}
//~OBSS_SAIT_991015
// begin: added by Sharp (98/2/12)
else if (m_rgbSpatialScalability [iVOrelative] && bTemporalScalability)
pBufP2->getBuf( rgpvoenc[BASE_LAYER] );
// end: added by Sharp (98/2/12)
if (iPCount>0) // needed to handle iPCount = -1
iPCount--;
}
bPrevObjectExists = bObjectExists;
// encode B frames if needed
Int iBFrame = iRefFrame + iDT; // added by Sharp (98/2/12)
if(iRefInterval>1)
{
Bool bCachedBVOP = FALSE; // added by Sharp (98/11/11)
// Int iBFrame; // deleted by Sharp (98/2/12)
for(iBFrame = iRefFrame + iDT; iBFrame < iSearchFrame; iBFrame += iDT)
{
if(rgpvoenc [BASE_LAYER] -> skipTest(iBFrame,BVOP))
continue;
//OBSS_SAIT_991015
// if(m_rgbSpatialScalability [iVOrelative] && (volmd.fAUsage == ONE_BIT)) //OBSSFIX_V2-8_before
if(m_rgbSpatialScalability [iVOrelative] && (volmd.fAUsage == ONE_BIT) && !bTemporalScalability) //OBSSFIX_V2-8_after
bObjectExists = loadDataSpriteCheck(iVOrelative,iBFrame, pfYuvSrc, pfSegSrcSpatialEnhn, pxlcObjColor, rgpvoenc [BASE_LAYER]->m_pvopcOrig, volmd,volmd_enhn);
else
//~OBSS_SAIT_991015
bObjectExists = loadDataSpriteCheck(iVOrelative,iBFrame, pfYuvSrc, pfSegSrc, ppfAuxSrc, pxlcObjColor, rgpvoenc [BASE_LAYER]->m_pvopcOrig, volmd);
encodeVideoObject (bObjectExists, bObjectExists, iBFrame, BVOP, bTemporalScalability ? DUMP_NONE: DUMP_CURR, // modified by Sharp (98/11/11)
iVO, iVOrelative, BASE_LAYER,
pfYuvSrc,pfSegSrc,ppfAuxSrc,
rgpfReconYUV,rgpfReconSeg,rgpfReconAux,
pxlcObjColor,rgpvoenc,volmd,rgpostrm);
bCachedBVOP = bTemporalScalability ? TRUE : FALSE; // added by Sharp (98/11/11)
if (m_rgbSpatialScalability [iVOrelative] && !bTemporalScalability) { // modified by Sharp (98/2/12)
pvopcBaseQuant = rgpvoenc [BASE_LAYER]->pvopcReconCurr ();
//OBSS_SAIT_991015
// Spatial Scalabe BVOP and PVOP
VOPpredType PrevType = (rgpvoenc[ENHN_LAYER]->m_volmd.iSpatialOption == 0 )? BVOP: PVOP; //for BVOP or PVOP enhn layer coding(OBSS)
encodeVideoObject (bObjectExists, bObjectExists, iBFrame, PrevType, DUMP_CURR,
iVO, iVOrelative, ENHN_LAYER,
pfYuvSrcSpatialEnhn, pfSegSrcSpatialEnhn, /*NULL*/ppfAuxSrc, //OBSSFIX_MAC
rgpfReconYUV, rgpfReconSeg, /*NULL*/rgpfReconAux, //OBSSFIX_MAC
pxlcObjColor, rgpvoenc, volmd, rgpostrm,
pvopcBaseQuant);
//~OBSS_SAIT_991015
}
// begin: added by Sharp (98/2/12)
else if (m_rgbSpatialScalability [iVOrelative] && bTemporalScalability)
pBufB2->getBuf( rgpvoenc[BASE_LAYER] );
if ( m_rgbSpatialScalability [iVOrelative] && bTemporalScalability ) { // for TPS enhancement layer
rgpvoenc [ENHN_LAYER] -> m_iBCount = 0;
for (Int iEFrame = iBFrame - iDT + iDT_enhn; iEFrame < iBFrame; iEFrame += iDT_enhn ) {
updateRefForTPS( rgpvoenc[ENHN_LAYER], pBufP1, pBufP2, pBufB1, pBufB2, pBufE,
0, iVOrelative, iEcount, iBFrame-iDT+iDT_enhn, iEFrame, 0 );
iEcount++;
encodeEnhanceVideoObject(bObjectExists, iEFrame, rgpvoenc[ENHN_LAYER]->m_vopmd.vopPredType, DUMP_CURR,
iVO,iVOrelative, pfYuvSrc,pfSegSrc,rgpfReconYUV,rgpfReconSeg,
pxlcObjColor,rgpvoenc[ENHN_LAYER],volmd, volmd_enhn, iBFrame - iDT + iDT_enhn, rgpostrm,
*pBufP1, *pBufP2, *pBufB1, *pBufB2, *pBufE
);
if ( !pBufB2->empty() ){
if ( pBufB2 -> m_bCodedFutureRef == 1 ) // added by Sharp (99/1/28)
pBufB1->copyBuf( *pBufB2 );
pBufB2->dispose();
}
}
}
// end: added by Sharp (98/2/12)
// begin: added by Sharp (98/11/11)
if(bCachedBVOP && (m_rguiSpriteUsage [iVOrelative] == 0 || m_rguiSpriteUsage [iVOrelative] == 2)) // GMC
{
// only for temporal scalability
#ifndef __OUT_ONE_FRAME_
// last ref frame needs to be output
dumpData (rgpfReconYUV [BASE_LAYER], rgpfReconSeg [BASE_LAYER],
rgpfReconAux [BASE_LAYER], BASE_LAYER,
rgpvoenc[BASE_LAYER] ->pvopcReconCurr(), m_rctOrg, volmd, rgpvoenc[BASE_LAYER] ->m_vopmd.bInterlace);
if (m_rgbSpatialScalability [iVOrelative] && !bTemporalScalability)
dumpData (rgpfReconYUV [BASE_LAYER], rgpfReconSeg [BASE_LAYER],
rgpfReconAux [BASE_LAYER], BASE_LAYER,
rgpvoenc[BASE_LAYER] ->pvopcReconCurr(), m_rctOrgSpatialEnhn, volmd, rgpvoenc[BASE_LAYER] ->m_vopmd.bInterlace);
#endif
bCachedBVOP = FALSE;
}
// end: added by Sharp (98/11/11)
}
}
if (m_rgbSpatialScalability [iVOrelative] && !bTemporalScalability) { // modified by Sharp (98/2/12)
/* (98/3/30) modified by SONY*/
if (iPCount == volmd.iPbetweenI) {
/* (98/3/20) modified by SONY(end)*/
/* ORIGINAL
if (iPCount == 0) {
*/
//OBSS_SAIT_991015
//for OBSS_BASE_BVOP : stack out
//OBSSFIX_MODE3
if(rgpvoenc[ENHN_LAYER]->volmd().fAUsage == ONE_BIT &&
!(rgpvoenc[ENHN_LAYER]->volmd().iEnhnType != 0 && rgpvoenc[ENHN_LAYER]->volmd().iuseRefShape == 1)) {
// if(rgpvoenc[ENHN_LAYER]->volmd().fAUsage == ONE_BIT) {
//~OBSSFIX_MODE3
pBase_tmp_Baseshpmd = (rgpvoenc[BASE_LAYER] -> m_rgBaseshpmd);
rgpvoenc[BASE_LAYER] -> m_rgBaseshpmd = pBase_stack_Baseshpmd;
pBase_tmp_mvBaseBY = (rgpvoenc[BASE_LAYER] -> m_rgmvBaseBY);
rgpvoenc[BASE_LAYER] -> m_rgmvBaseBY = pBase_stack_mvBaseBY;
rgpvoenc[BASE_LAYER] -> m_iNumMBX = iBase_stack_x;
rgpvoenc[BASE_LAYER] -> m_iNumMBY =iBase_stack_y;
rgpvoenc[BASE_LAYER] -> m_rctBase = pBase_stack_rctBase;
}
//~for OBSS_BASE_BVOP : stack out
encodeVideoObject(TRUE, TRUE, iSearchFrame, PVOP,
DUMP_CURR, // sony
iVO, iVOrelative, ENHN_LAYER,
pfYuvSrcSpatialEnhn, pfSegSrcSpatialEnhn, /*NULL*/ppfAuxSrc, //OBSSFIX_MAC
rgpfReconYUV, rgpfReconSeg, /*NULL*/rgpfReconAux,
pxlcObjColor,rgpvoenc,volmd,rgpostrm,
pvopcBasePVOPQuant);
//for OBSS_BASE_BVOP : stack free
//OBSSFIX_MODE3
if(rgpvoenc[ENHN_LAYER]->volmd().fAUsage == ONE_BIT &&
!(rgpvoenc[ENHN_LAYER]->volmd().iEnhnType != 0 && rgpvoenc[ENHN_LAYER]->volmd().iuseRefShape == 1)) {
// if(rgpvoenc[ENHN_LAYER]->volmd().fAUsage == ONE_BIT) {
//~OBSSFIX_MODE3
delete [] pBase_stack_Baseshpmd;
pBase_stack_Baseshpmd = NULL;
rgpvoenc[BASE_LAYER] -> m_rgBaseshpmd = pBase_tmp_Baseshpmd;
delete [] pBase_stack_mvBaseBY;
pBase_stack_mvBaseBY = NULL;
rgpvoenc[BASE_LAYER] -> m_rgmvBaseBY = pBase_tmp_mvBaseBY;
}
//~for OBSS_BASE_BVOP : stack free
//~OBSS_SAIT_991015
}
else {
VOPpredType PrevType = (rgpvoenc[ENHN_LAYER]->m_volmd.iSpatialOption == 0 )? BVOP: PVOP;
//OBSS_SAIT_991015
//for OBSS BASE_BVOP : stack out
//OBSSFIX_MODE3
if(rgpvoenc[ENHN_LAYER]->volmd().fAUsage == ONE_BIT &&
!(rgpvoenc[ENHN_LAYER]->volmd().iEnhnType != 0 && rgpvoenc[ENHN_LAYER]->volmd().iuseRefShape == 1)) {
// if(rgpvoenc[ENHN_LAYER]->volmd().fAUsage == ONE_BIT) {
//~OBSSFIX_MODE3
pBase_tmp_Baseshpmd = (rgpvoenc[BASE_LAYER] -> m_rgBaseshpmd);
rgpvoenc[BASE_LAYER] -> m_rgBaseshpmd = pBase_stack_Baseshpmd;
pBase_tmp_mvBaseBY = (rgpvoenc[BASE_LAYER] -> m_rgmvBaseBY);
rgpvoenc[BASE_LAYER] -> m_rgmvBaseBY = pBase_stack_mvBaseBY;
rgpvoenc[BASE_LAYER] -> m_iNumMBX = iBase_stack_x;
rgpvoenc[BASE_LAYER] -> m_iNumMBY =iBase_stack_y;
rgpvoenc[BASE_LAYER] -> m_rctBase = pBase_stack_rctBase;
}
encodeVideoObject (bObjectExists, bObjectExists, iSearchFrame, PrevType,
DUMP_CURR, // sony
iVO, iVOrelative, ENHN_LAYER,
pfYuvSrcSpatialEnhn, pfSegSrcSpatialEnhn, /*NULL*/ppfAuxSrc, //OBSSFIX_MAC
rgpfReconYUV, rgpfReconSeg, /*NULL*/rgpfReconAux,
pxlcObjColor, rgpvoenc, volmd, rgpostrm,
pvopcBasePVOPQuant);
//for OBSS BASE_BVOP : stack free
//OBSSFIX_MODE3
if(rgpvoenc[ENHN_LAYER]->volmd().fAUsage == ONE_BIT &&
!(rgpvoenc[ENHN_LAYER]->volmd().iEnhnType != 0 && rgpvoenc[ENHN_LAYER]->volmd().iuseRefShape == 1)) {
// if(rgpvoenc[ENHN_LAYER]->volmd().fAUsage == ONE_BIT) {
//~OBSSFIX_MODE3
delete [] pBase_stack_Baseshpmd;
pBase_stack_Baseshpmd = NULL;
rgpvoenc[BASE_LAYER] -> m_rgBaseshpmd = pBase_tmp_Baseshpmd;
delete [] pBase_stack_mvBaseBY;
pBase_stack_mvBaseBY = NULL;
rgpvoenc[BASE_LAYER] -> m_rgmvBaseBY = pBase_tmp_mvBaseBY;
}
//~OBSS_SAIT_991015
}
delete pvopcBasePVOPQuant;
}
// begin: added by Sharp (98/2/12)
else if ( m_rgbSpatialScalability [iVOrelative] && bTemporalScalability ){ // loop for TPS enhancement layer
rgpvoenc [ENHN_LAYER] -> m_iBCount = 0;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -