📄 vopsedec.cpp
字号:
if( m_volmd.bDataPartitioning )
m_volmd.bReversibleVlc = m_pbitstrmIn -> getBits (1);
else
m_volmd.bReversibleVlc = FALSE;
// End Toshiba
// NEWPRED
if(m_volmd.uiVerID == 1)
m_volmd.bNewpredEnable = FALSE;
else if(m_volmd.uiVerID != 1)
m_volmd.bNewpredEnable = m_pbitstrmIn -> getBits (1);
if (m_volmd.bNewpredEnable) {
assert (m_volmd.fAUsage == RECTANGLE);
assert (m_vopmd.bInterlace == 0);
assert (m_uiSprite == 0);
m_volmd.iRequestedBackwardMessegeType = m_pbitstrmIn -> getBits (2);
m_volmd.bNewpredSegmentType = m_pbitstrmIn -> getBits (1);
// generate NEWPRED object
g_pNewPredDec = new CNewPredDecoder();
}
// ~NEWPRED
// RRV insertion
if(m_volmd.uiVerID != 1)
{
m_volmd.breduced_resolution_vop_enable = m_pbitstrmIn -> getBits (1);
}
else
{
m_volmd.breduced_resolution_vop_enable = 0;
}
m_vopmd.RRVmode.iOnOff = m_volmd.breduced_resolution_vop_enable;
// ~RRV
//wchen: wd changes
m_volmd.volType = (m_pbitstrmIn -> getBits (1) == 0) ? BASE_LAYER : ENHN_LAYER;
// NEWPRED
if (m_volmd.bNewpredEnable)
assert (m_volmd.volType == BASE_LAYER);
// ~NEWPRED
// GMC
if(m_uiSprite == 2) assert(m_volmd.volType == BASE_LAYER);
// ~GMC
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;
//OBSS_SAIT_991015
m_volmd.ihor_sampling_factor_n_shape = 1;
m_volmd.ihor_sampling_factor_m_shape = 1;
m_volmd.iver_sampling_factor_n_shape = 1;
m_volmd.iver_sampling_factor_m_shape = 1;
//~OBSS_SAIT_991015
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
//OBSS_SAIT_991015
if (m_volmd.fAUsage == ONE_BIT && m_volmd.iHierarchyType == 0) {
m_volmd.iuseRefShape = m_pbitstrmIn->getBits (1); // use_ref_shape
m_volmd.iuseRefTexture = m_pbitstrmIn->getBits (1); // use_ref_texture
m_volmd.ihor_sampling_factor_n_shape = m_pbitstrmIn->getBits (5);
m_volmd.ihor_sampling_factor_m_shape = m_pbitstrmIn->getBits (5);
m_volmd.iver_sampling_factor_n_shape = m_pbitstrmIn->getBits (5);
m_volmd.iver_sampling_factor_m_shape = m_pbitstrmIn->getBits (5);
}
//~OBSS_SAIT_991015
}
m_volmd.bDeblockFilterDisable = TRUE; //no deblocking filter
}
//OBSSFIX_MODE3 //TPS_FIX_BGC
//Int BGComposition; // added by Sharp (98/3/24)
//~OBSSFIX_MODE3 //~TPS_FIX_BGC
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);
// NEWPRED
if (m_volmd.bNewpredEnable)
assert (m_vopmd.vopPredType != BVOP);
// ~NEWPRED
// 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 = 0;
if(m_iNumBitsTimeIncr!=0)
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;
}
// NEWPRED
if (m_volmd.bNewpredEnable) {
m_vopmd.m_iVopID = m_pbitstrmIn -> getBits(m_vopmd.m_iNumBitsVopID);
m_vopmd.m_iVopID4Prediction_Indication = m_pbitstrmIn -> getBits(NUMBITS_VOP_ID_FOR_PREDICTION_INDICATION);
if( m_vopmd.m_iVopID4Prediction_Indication )
m_vopmd.m_iVopID4Prediction = m_pbitstrmIn -> getBits(m_vopmd.m_iNumBitsVopID);
m_pbitstrmIn -> getBits(MARKER_BIT);
g_pNewPredDec->GetRef(
NP_VOP_HEADER,
m_vopmd.vopPredType,
m_vopmd.m_iVopID,
m_vopmd.m_iVopID4Prediction_Indication,
m_vopmd.m_iVopID4Prediction
);
}
// ~NEWPRED
if ((m_vopmd.vopPredType == PVOP || (m_uiSprite == 2 && m_vopmd.vopPredType == SPRITE)) && m_volmd.bShapeOnly==FALSE) // GMC
m_vopmd.iRoundingControl = m_pbitstrmIn->getBits (1); //"VOP_Rounding_Type"
else
m_vopmd.iRoundingControl = 0;
// RRV insertion
if((m_volmd.breduced_resolution_vop_enable == 1)&&(m_volmd.fAUsage == RECTANGLE)&&
((m_vopmd.vopPredType == PVOP)||(m_vopmd.vopPredType == IVOP)))
{
m_vopmd.RRVmode.iRRVOnOff = m_pbitstrmIn->getBits (1);
}
else
{
m_vopmd.RRVmode.iRRVOnOff = 0;
}
// ~RRV
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
marker = m_pbitstrmIn -> getBits (1); // marker bit added Nov 10, swinder
assert(marker==1);
m_rctCurrVOPY = CRct (left, top, left + width, top + height);
m_rctCurrVOPUV = m_rctCurrVOPY.downSampleBy2 ();
}
if ( m_volmd.volType == ENHN_LAYER && m_volmd.iEnhnType != 0 ){ // change added for Norio Ito
//OBSSFIX_MODE3 //TPS_FIX_BGC
m_vopmd.bBGComposition = m_pbitstrmIn -> getBits (1); // modified by Sharp (98/3/24)
// BGComposition = m_pbitstrmIn -> getBits (1); // modified by Sharp (98/3/24)
//~OBSSFIX_MODE3 //~TPS_FIX_BGC
// 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) {
// START: Complexity Estimation syntax support - Update version 2 - Massimo Ravasi (EPFL) - 5 Nov 1999
if ( (m_volmd.iEstimationMethod != 0) && (m_volmd.iEstimationMethod != 1) ) {
//// Replaced line: if (m_volmd.iEstimationMethod != 0) {
// END: Complexity Estimation syntax support - Update version 2
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 ||
// START: Complexity Estimation syntax support - Update version 2 - Massimo Ravasi (EPFL) - 11 Nov 1999
((m_vopmd.vopPredType) == SPRITE && (m_uiSprite == 1)) ) {
// END: Complexity Estimation syntax support - Update version 2
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");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -