📄 vopsedec.cpp
字号:
m_volmd.bHalfpel4)) {
fatal_error("Motion complexity estimation is enabled,\nbut no correponding flag is enabled.");
}
}
else
m_volmd.bAPM =
m_volmd.bNPM =
m_volmd.bInterpolateMCQ =
m_volmd.bForwBackMCQ =
m_volmd.bHalfpel2 =
m_volmd.bHalfpel4 = false;
uiMark = m_pbitstrmIn -> getBits (1);
assert (uiMark == 1);
}
// END: Complexity Estimation syntax support
UInt uiResyncMarkerDisable = m_pbitstrmIn -> getBits (1);
// Modified by Toshiba(1998-4-7)
m_volmd.bDataPartitioning = m_pbitstrmIn -> getBits (1);
if( m_volmd.bDataPartitioning )
m_volmd.bReversibleVlc = m_pbitstrmIn -> getBits (1);
else
m_volmd.bReversibleVlc = FALSE;
// End Toshiba
//wchen: wd changes
m_volmd.volType = (m_pbitstrmIn -> getBits (1) == 0) ? BASE_LAYER : ENHN_LAYER;
m_volmd.ihor_sampling_factor_n = 1;
m_volmd.ihor_sampling_factor_m = 1;
m_volmd.iver_sampling_factor_n = 1;
m_volmd.iver_sampling_factor_m = 1;
if (m_volmd.volType == ENHN_LAYER) {
//#ifdef _Scalable_SONY_
m_volmd.iHierarchyType = m_pbitstrmIn->getBits (1); //
if(m_volmd.iHierarchyType == 0)
fprintf(stdout,"Hierarchy_Type == 0 (Spatial scalability)\n");
else if(m_volmd.iHierarchyType == 1)
fprintf(stdout,"Hierarchy_type == 1 (Temporal scalability)\n");
//#endif _Scalable_SONY_
m_pbitstrmIn->getBits (4); // ref_layer_id
m_pbitstrmIn->getBits (1); // ref_layer_samping_director
m_volmd.ihor_sampling_factor_n = m_pbitstrmIn->getBits (5);
m_volmd.ihor_sampling_factor_m = m_pbitstrmIn->getBits (5);
m_volmd.iver_sampling_factor_n = m_pbitstrmIn->getBits (5);
m_volmd.iver_sampling_factor_m = m_pbitstrmIn->getBits (5);
m_volmd.iEnhnType = m_pbitstrmIn->getBits (1); //enhancement_type
}
m_volmd.bDeblockFilterDisable = TRUE; //no deblocking filter
}
Int BGComposition; // added by Sharp (98/3/24)
Bool CVideoObjectDecoder::decodeVOPHead ()
{
// Start code
UInt uiVopStartCode = m_pbitstrmIn -> getBits (NUMBITS_VOP_START_CODE);
if (uiVopStartCode == GOV_START_CODE) {
/*Added by SONY (98/03/30)*/
m_bUseGOV = TRUE;
m_bLinkisBroken = FALSE;
/*Added by SONY (98/03/30) End */
Int timecode;
timecode = m_pbitstrmIn -> getBits (5) * 3600;
timecode += m_pbitstrmIn -> getBits (6) * 60;
m_pbitstrmIn -> getBits (1);
timecode += m_pbitstrmIn -> getBits (6);
m_tModuloBaseDecd = timecode;
m_tModuloBaseDisp = timecode;
cout << "GOV Header (t=" << timecode << ")\n\n";
Int closed_gov = m_pbitstrmIn -> getBits (1);
Int broken_link = m_pbitstrmIn -> getBits (1);
/*modified by SONY (98/03/30)*/
if ((closed_gov == 0)&&(broken_link == 1))
m_bLinkisBroken = TRUE;
/*modified by SONY (98/03/30) End*/
findStartCode();
/*
m_pbitstrmIn -> getBits (4);
Int uiPrefix = m_pbitstrmIn -> getBits (NUMBITS_START_CODE_PREFIX);
assert(uiPrefix == START_CODE_PREFIX);
*/
uiVopStartCode = m_pbitstrmIn -> getBits (NUMBITS_VOP_START_CODE);
}
//980212
assert(uiVopStartCode == VOP_START_CODE);
m_vopmd.vopPredType = (VOPpredType) m_pbitstrmIn -> getBits (NUMBITS_VOP_PRED_TYPE);
// Time reference and VOP_pred_type
Int iModuloInc = 0;
while (m_pbitstrmIn -> getBits (1) != 0)
iModuloInc++;
Time tCurrSec = iModuloInc + ((m_vopmd.vopPredType != BVOP ||
(m_vopmd.vopPredType == BVOP && m_volmd.volType == ENHN_LAYER ))?
m_tModuloBaseDecd : m_tModuloBaseDisp);
// Added for error resilient mode by Toshiba(1997-11-14)
UInt uiMarker = m_pbitstrmIn -> getBits (1);
assert(uiMarker == 1);
// End Toshiba(1997-11-14)
Time tVopIncr = m_pbitstrmIn -> getBits (m_iNumBitsTimeIncr);
uiMarker = m_pbitstrmIn->getBits (1); // marker bit
assert(uiMarker == 1);
m_tOldModuloBaseDecd = m_tModuloBaseDecd;
m_tOldModuloBaseDisp = m_tModuloBaseDisp;
if (m_vopmd.vopPredType != BVOP ||
(m_vopmd.vopPredType == BVOP && m_volmd.volType == ENHN_LAYER ))
{
m_tModuloBaseDisp = m_tModuloBaseDecd; //update most recently displayed time base
m_tModuloBaseDecd = tCurrSec;
}
m_t = tCurrSec * m_volmd.iClockRate*m_iClockRateScale + tVopIncr*m_iClockRateScale;
if (m_pbitstrmIn->getBits (1) == 0) { //vop_coded == false
m_vopmd.bInterlace = FALSE; //wchen: temporary solution
return FALSE;
}
if (m_vopmd.vopPredType == PVOP && m_volmd.bShapeOnly==FALSE)
m_vopmd.iRoundingControl = m_pbitstrmIn->getBits (1); //"VOP_Rounding_Type"
else
m_vopmd.iRoundingControl = 0;
if (m_volmd.fAUsage != RECTANGLE) {
// Begin: modified by Hughes 4/9/98
if (!(m_uiSprite == 1 && m_vopmd.vopPredType == IVOP)) {
// End: modified by Hughes 4/9/98
Int width = m_pbitstrmIn -> getBits (NUMBITS_VOP_WIDTH);
// spt VOP assert (width % MB_SIZE == 0); // for sprite, may not be multiple of MB_SIZE
Int marker;
marker = m_pbitstrmIn -> getBits (1); // marker bit
assert(marker==1);
Int height = m_pbitstrmIn -> getBits (NUMBITS_VOP_HEIGHT);
// spt VOP assert (height % MB_SIZE == 0); // for sprite, may not be multiple of MB_SIZE
marker = m_pbitstrmIn -> getBits (1); // marker bit
assert(marker==1);
//wchen: cd changed to 2s complement
Int left = (m_pbitstrmIn -> getBits (1) == 0) ?
m_pbitstrmIn->getBits (NUMBITS_VOP_HORIZONTAL_SPA_REF - 1) :
((Int)m_pbitstrmIn->getBits (NUMBITS_VOP_HORIZONTAL_SPA_REF - 1) - (1 << (NUMBITS_VOP_HORIZONTAL_SPA_REF - 1)));
marker = m_pbitstrmIn -> getBits (1); // marker bit
assert(marker==1);
Int top = (m_pbitstrmIn -> getBits (1) == 0) ?
m_pbitstrmIn->getBits (NUMBITS_VOP_VERTICAL_SPA_REF - 1) :
((Int)m_pbitstrmIn->getBits (NUMBITS_VOP_VERTICAL_SPA_REF - 1) - (1 << (NUMBITS_VOP_VERTICAL_SPA_REF - 1)));
assert(((left | top)&1)==0); // must be even pix unit
m_rctCurrVOPY = CRct (left, top, left + width, top + height);
m_rctCurrVOPUV = m_rctCurrVOPY.downSampleBy2 ();
}
if ( m_volmd.volType == ENHN_LAYER && m_volmd.iEnhnType == 1 ){
BGComposition = m_pbitstrmIn -> getBits (1); // modified by Sharp (98/3/24)
// assert(BackgroundComposition==1); // modified by Sharp (98/3/24)
}
m_volmd.bNoCrChange = m_pbitstrmIn -> getBits (1); //VOP_CR_Change_Disable
Int iVopConstantAlpha = m_pbitstrmIn -> getBits (1);
if(iVopConstantAlpha==1)
m_vopmd.iVopConstantAlphaValue = m_pbitstrmIn -> getBits (8);
else
m_vopmd.iVopConstantAlphaValue = 255;
m_vopmd.bShapeCodingType = (m_vopmd.vopPredType == IVOP) ? 0 : 1; // Added error resilient mode by Toshiba(1998-1-16)
}
// START: Complexity Estimation syntax support - Marc Mongenet (EPFL) - 15 Jun 1998
if (! m_volmd.bComplexityEstimationDisable) {
if (m_volmd.iEstimationMethod != 0) {
fprintf (stderr, "ERROR: Unknown estimation method number %d.\n", m_volmd.iEstimationMethod);
exit (1);
}
if (m_vopmd.vopPredType == IVOP ||
m_vopmd.vopPredType == PVOP ||
m_vopmd.vopPredType == BVOP) {
if (m_volmd.bOpaque) {
printf ("dcecs_opaque = %d\n", m_vopmd.iOpaque = m_pbitstrmIn -> getBits (8));
if (m_vopmd.iOpaque == 0) {
fprintf (stderr, "ERROR: Illegal null value for 'opaque' complexity estimation.\n");
exit (1);
}
}
if (m_volmd.bTransparent) {
printf ("dcecs_transparent = %d\n", m_vopmd.iTransparent = m_pbitstrmIn -> getBits (8));
if (m_vopmd.iTransparent == 0) {
fprintf (stderr, "ERROR: Illegal null value for 'transparent' complexity estimation.\n");
exit (1);
}
}
if (m_volmd.bIntraCAE) {
printf ("dcecs_intra_cae = %d\n", m_vopmd.iIntraCAE = m_pbitstrmIn -> getBits (8));
if (m_vopmd.iIntraCAE == 0) {
fprintf (stderr, "ERROR: Illegal null value for 'intra_cae' complexity estimation.\n");
exit (1);
}
}
if (m_volmd.bInterCAE) {
printf ("dcecs_inter_cae = %d\n", m_vopmd.iInterCAE = m_pbitstrmIn -> getBits (8));
if (m_vopmd.iInterCAE == 0) {
fprintf (stderr, "ERROR: Illegal null value for 'inter_cae' complexity estimation.\n");
exit (1);
}
}
if (m_volmd.bNoUpdate) {
printf ("dcecs_no_update = %d\n", m_vopmd.iNoUpdate = m_pbitstrmIn -> getBits (8));
if (m_vopmd.iNoUpdate == 0) {
fprintf (stderr, "ERROR: Illegal null value for 'no_update' complexity estimation.\n");
exit (1);
}
}
if (m_volmd.bUpsampling) {
printf ("dcecs_upsampling = %d\n", m_vopmd.iUpsampling = m_pbitstrmIn -> getBits (8));
if (m_vopmd.iUpsampling == 0) {
fprintf (stderr, "ERROR: Illegal null value for 'upsampling' complexity estimation.\n");
exit (1);
}
}
}
if (m_volmd.bIntraBlocks) {
printf ("dcecs_intra_blocks = %d\n", m_vopmd.iIntraBlocks = m_pbitstrmIn -> getBits (8));
if (m_vopmd.iIntraBlocks == 0) {
fprintf (stderr, "ERROR: Illegal null value for 'intra_blocks' complexity estimation.\n");
exit (1);
}
}
if (m_volmd.bNotCodedBlocks) {
printf ("dcecs_not_coded_blocks = %d\n", m_vopmd.iNotCodedBlocks = m_pbitstrmIn -> getBits (8));
if (m_vopmd.iNotCodedBlocks == 0) {
fprintf (stderr, "ERROR: Illegal null value for 'not_coded_blocks' complexity estimation.\n");
exit (1);
}
}
if (m_volmd.bDCTCoefs) {
printf ("dcecs_dct_coefs = %d\n", m_vopmd.iDCTCoefs = m_pbitstrmIn -> getBits (8));
if (m_vopmd.iDCTCoefs == 0) {
fprintf (stderr, "ERROR: Illegal null value for 'dct_coefs' complexity estimation.\n");
exit (1);
}
}
if (m_volmd.bDCTLines) {
printf ("dcecs_dct_lines = %d\n", m_vopmd.iDCTLines = m_pbitstrmIn -> getBits (8));
if (m_vopmd.iDCTLines == 0) {
fprintf (stderr, "ERROR: Illegal null value for 'dct_lines' complexity estimation.\n");
exit (1);
}
}
if (m_volmd.bVLCSymbols) {
printf ("dcecs_vlc_symbols = %d\n", m_vopmd.iVLCSymbols = m_pbitstrmIn -> getBits (8));
if (m_vopmd.iVLCSymbols == 0) {
fprintf (stderr, "ERROR: Illegal null value for 'vlc_symbols' complexity estimation.\n");
exit (1);
}
}
if (m_volmd.bVLCBits) {
printf ("dcecs_vlc_bits = %d\n", m_vopmd.iVLCBits = m_pbitstrmIn -> getBits (4));
if (m_vopmd.iVLCBits == 0) {
fprintf (stderr, "ERROR: Illegal null value for 'vlc_bits' complexity estimation.\n");
exit (1);
}
}
if (m_vopmd.vopPredType == PVOP ||
m_vopmd.vopPredType == BVOP ||
m_vopmd.vopPredType == SPRITE) {
if (m_volmd.bInterBlocks) {
printf ("dcecs_inter_blocks = %d\n", m_vopmd.iInterBlocks = m_pbitstrmIn -> getBits (8));
if (m_vopmd.iInterBlocks == 0) {
fprintf (stderr, "ERROR: Illegal null value for 'inter_blocks' complexity estimation.\n");
exit (1);
}
}
if (m_volmd.bInter4vBlocks) {
printf ("dcecs_inter4v_blocks = %d\n", m_vopmd.iInter4vBlocks = m_pbitstrmIn -> getBits (8));
if (m_vopmd.iInter4vBlocks == 0) {
fprintf (stderr, "ERROR: Illegal null value for 'inter4v_blocks' complexity estimation.\n");
exit (1);
}
}
if (m_volmd.bAPM) {
printf ("dcecs_apm = %d\n", m_vopmd.iAPM = m_pbitstrmIn -> getBits (8));
if (m_vopmd.iAPM == 0) {
fprintf (stderr, "ERROR: Illegal null value for 'apm' complexity estimation.\n");
exit (1);
}
}
if (m_volmd.bNPM) {
printf ("dcecs_npm = %d\n", m_vopmd.iNPM = m_pbitstrmIn -> getBits (8));
if (m_vopmd.iNPM == 0) {
fprintf (stderr, "ERROR: Illegal null value for 'npm' complexity estimation.\n");
exit (1);
}
}
if (m_volmd.bForwBackMCQ) {
printf ("dcecs_forw_back_mc_q = %d\n", m_vopmd.iForwBackMCQ = m_pbitstrmIn -> getBits (8));
if (m_vopmd.iForwBackMCQ == 0) {
fprintf (stderr, "ERROR: Illegal null value for 'forw_back_mc_q' complexity estimation.\n");
exit (1);
}
}
if (m_volmd.bHalfpel2) {
printf ("dcecs_halfpel2 = %d\n", m_vopmd.iHalfpel2 = m_pbitstrmIn -> getBits (8));
if (m_vopmd.iHalfpel2 == 0) {
fprintf (stderr, "ERROR: Illegal null value for 'halfpel2' complexity estimation.\n");
exit (1);
}
}
if (m_volmd.bHalfpel4) {
printf ("dcecs_halfpel4 = %d\n", m_vopmd.iHalfpel4 = m_pbitstrmIn -> getBits (8));
if (m_vopmd.iHalfpel4 == 0) {
fprintf (stderr, "ERROR: Illegal null value for 'halfpel4' complexity estimation.\n");
exit (1);
}
}
}
if (m_vopmd.vopPredType == BVOP ||
m_vopmd.vopPredType == SPRITE) {
if (m_volmd.bInterpolateMCQ) {
printf ("dcecs_interpolate_mc_q = %d\n", m_vopmd.iInterpolateMCQ = m_pbitstrmIn -> getBits (8));
if (m_vopmd.iInterpolateMCQ == 0) {
fprintf (stderr, "ERROR: Illegal null value for 'interpolate_mc_q' complexity estimation.\n");
exit (1);
}
}
}
}
// END: Complexity Estimation syntax support
if(m_volmd.bShapeOnly==TRUE)
{
m_vopmd.intStep = 10; // probably not needed
m_vopmd.intStepI = 10;
m_vopmd.intStepB = 10;
m_vopmd.mvInfoForward.uiFCode = m_vopmd.mvInfoBackward.uiFCode = 1; // Modified error resilient mode by Toshiba (1998-1-16)
m_vopmd.bInterlace = FALSE; //wchen: temporary solution
return TRUE;
}
m_vopmd.iIntraDcSwitchThr = m_pbitstrmIn->getBits (3);
// INTERLACE
if (m_vopmd.bInterlace) {
m_vopmd.bTopFieldFirst = m_pbitstrmIn -> getBits (1);
m_vopmd.bAlternateScan = m_pbitstrmIn -> getBits (1);
assert(m_volmd.volType == BASE_LAYER);
} else
// ~INTERLACE
{
m_vopmd.bAlternateScan = FALSE;
}
if (m_vopmd.vopPredType == IVOP) {
m_vopmd.intStepI = m_vopmd.intStep = m_pbitstrmIn -> getBits (m_volmd.uiQuantPrecision); //also assign intStep to be safe
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -