Void IntMbTempData::copyTo( MbDataAccess& rcMbDataAccess ) { rcMbDataAccess.getMbData() .copyFrom( *this ); rcMbDataAccess.getMbTCoeffs() .copyFrom( *this ); rcMbDataAccess.getMbMvdData(LIST_0) .copyFrom( m_acMbMvdData[LIST_0] ); rcMbDataAccess.getMbMotionData(LIST_0).copyFrom( m_acMbMotionData[LIST_0] ); if( rcMbDataAccess.getSH().isBSlice() ) { rcMbDataAccess.getMbMvdData(LIST_1) .copyFrom( m_acMbMvdData[LIST_1] ); rcMbDataAccess.getMbMotionData(LIST_1).copyFrom( m_acMbMotionData[LIST_1] ); } }
Bool MbParser::xCheckSkipSliceMb( MbDataAccess& rcMbDataAccess, UInt uiNumMbRead, Bool& rbEndOfSlice ) { ROFRS( rcMbDataAccess.getSH().getSliceSkipFlag(), false ); MbData& rcMbData = rcMbDataAccess.getMbData(); rcMbData.setSkipFlag ( false ); rcMbData.setBLSkipFlag ( true ); rcMbData.setResidualPredFlag ( true ); rcMbData.setMbExtCbp ( 0 ); rcMbData.setFwdBwd ( 0 ); rcMbDataAccess.resetQp (); rcMbDataAccess.getMbMotionData( LIST_0 ).clear( BLOCK_NOT_PREDICTED ); rcMbDataAccess.getMbMotionData( LIST_1 ).clear( BLOCK_NOT_PREDICTED ); rcMbDataAccess.getMbMvdData ( LIST_0 ).clear(); rcMbDataAccess.getMbMvdData ( LIST_1 ).clear(); rbEndOfSlice = ( uiNumMbRead >= rcMbDataAccess.getSH().getNumMbsInSliceMinus1() ); return true; }
ErrVal MbParser::read( MbDataAccess& rcMbDataAccess, UInt uiNumMbRead, Bool& rbEndOfSlice, UInt& ruiNextSkippedVLC ) { const CommonMainH264* pcMainH264 = CommonMain::getMainH264(); // FIXME: if (pcMainH264->getCurrentPictureId() == 1 && pcMainH264->getCurrentLayerId() == 16 && rcMbDataAccess.getMbData().getMbAddr() == 76) { int a = 0; } ROF( m_bInitDone ); ROTRS( xCheckSkipSliceMb( rcMbDataAccess, uiNumMbRead, rbEndOfSlice ), Err::m_nOK ); Bool bIsCoded = true; if( m_pcMbSymbolReadIf->isMbSkipped( rcMbDataAccess, ruiNextSkippedVLC ) ) { bIsCoded = false; rcMbDataAccess.getMbTCoeffs().clear(); rcMbDataAccess.getMbData().clearIntraPredictionModes( true ); RNOK( xSkipMb( rcMbDataAccess ) ); rcMbDataAccess.getMbData().setBLSkipFlag( false ); rcMbDataAccess.getMbData().setResidualPredFlag( rcMbDataAccess.getMbData().getInCropWindowFlag() ? rcMbDataAccess.getSH().getDefaultResidualPredictionFlag() : false ); if( rcMbDataAccess.getSH().isBSlice() ) { rcMbDataAccess.getMbData().setFwdBwd( 0x3333 ); rcMbDataAccess.getMbMotionData( LIST_0 ).clear( RefIdxValues(1) ); rcMbDataAccess.getMbMvdData ( LIST_0 ).clear(); rcMbDataAccess.getMbMotionData( LIST_1 ).clear( RefIdxValues(1) ); rcMbDataAccess.getMbMvdData ( LIST_1 ).clear(); } else { rcMbDataAccess.getMbData().setFwdBwd( 0x1111 ); rcMbDataAccess.getMbMotionData( LIST_0 ).clear( RefIdxValues(1) ); rcMbDataAccess.getMbMvdData ( LIST_0 ).clear(); } rcMbDataAccess.resetQp(); // set QP to that of the last macroblock } if( bIsCoded ) { if( rcMbDataAccess.getSH().isMbaffFrame() && ( rcMbDataAccess.isTopMb() || m_bPrevIsSkipped ) ) { RNOK( m_pcMbSymbolReadIf->fieldFlag( rcMbDataAccess) ); } Bool bBaseLayerAvailable = ! rcMbDataAccess.getSH().getNoInterLayerPredFlag(); //===== base layer mode flag and base layer refinement flag ===== if( bBaseLayerAvailable ) { if ( rcMbDataAccess.getMbData().getInCropWindowFlag() == true ) { if( rcMbDataAccess.getSH().getAdaptiveBaseModeFlag() ) { m_pcMbSymbolReadIf->isBLSkipped( rcMbDataAccess ); } else { rcMbDataAccess.getMbData().setBLSkipFlag( rcMbDataAccess.getSH().getDefaultBaseModeFlag() ); } } else { rcMbDataAccess.getMbData().setBLSkipFlag( false ); } } else { rcMbDataAccess.getMbData().setBLSkipFlag( false ); } if( rcMbDataAccess.getSH().getStoreRefBasePicFlag() && rcMbDataAccess.getSH().getQualityId() > 0 && rcMbDataAccess.getMbData().getBLSkipFlag() == false ) { printf("Conformance Issue: base_mode_flag = 0 in enhancement layer MGS key picture\n"); } //===== macroblock mode ===== if( ! rcMbDataAccess.getMbData().getBLSkipFlag() ) { DECRNOK( m_pcMbSymbolReadIf->mbMode( rcMbDataAccess ) ); } if( rcMbDataAccess.getMbData().getBLSkipFlag() ) { //===== copy motion data from base layer ====== rcMbDataAccess.getMbMvdData( LIST_0 ).clear(); rcMbDataAccess.getMbMvdData( LIST_1 ).clear(); rcMbDataAccess.getMbData().setBLSkipFlag( true ); } else { //===== BLOCK MODES ===== if( rcMbDataAccess.getMbData().isInter8x8() ) { DECRNOK( m_pcMbSymbolReadIf->blockModes( rcMbDataAccess ) ); //===== set motion data for skip block mode ===== UInt uiFwdBwd = 0; for( B8x8Idx c8x8Idx; c8x8Idx.isLegal(); c8x8Idx++ ) { UInt uiBlkFwdBwd = rcMbDataAccess.getMbData().getBlockFwdBwd( c8x8Idx.b8x8Index() ); if( rcMbDataAccess.getMbData().getBlkMode( c8x8Idx.b8x8Index() ) == BLK_SKIP ) { uiBlkFwdBwd = 3; rcMbDataAccess.getMbMotionData( LIST_0 ).setRefIdx( 1, c8x8Idx.b8x8() ); rcMbDataAccess.getMbMotionData( LIST_1 ).setRefIdx( 1, c8x8Idx.b8x8() ); rcMbDataAccess.getMbMvdData ( LIST_0 ).setAllMv ( Mv::ZeroMv(), c8x8Idx.b8x8() ); rcMbDataAccess.getMbMvdData ( LIST_1 ).setAllMv ( Mv::ZeroMv(), c8x8Idx.b8x8() ); } uiFwdBwd |= ( uiBlkFwdBwd << ( c8x8Idx.b8x8Index() * 4 ) ); } rcMbDataAccess.getMbData().setFwdBwd( uiFwdBwd ); } rcMbDataAccess.resetQp(); // set QP to that of the last macroblock //===== MOTION DATA ===== MbMode eMbMode = rcMbDataAccess.getMbData().getMbMode(); if( rcMbDataAccess.getMbData().isIntra() ) { //===== clear mtoion data for intra blocks ===== rcMbDataAccess.getMbMotionData( LIST_0 ).clear( BLOCK_NOT_PREDICTED ); rcMbDataAccess.getMbMvdData ( LIST_0 ).clear(); if( rcMbDataAccess.getSH().isBSlice() ) { rcMbDataAccess.getMbMotionData( LIST_1 ).clear( BLOCK_NOT_PREDICTED ); rcMbDataAccess.getMbMvdData ( LIST_1 ).clear(); } } else if( eMbMode == MODE_SKIP ) { if( rcMbDataAccess.getSH().isBSlice() ) { rcMbDataAccess.getMbData().setFwdBwd( 0x3333 ); rcMbDataAccess.getMbMotionData( LIST_0 ).clear( RefIdxValues(1) ); rcMbDataAccess.getMbMvdData ( LIST_0 ).clear(); rcMbDataAccess.getMbMotionData( LIST_1 ).clear( RefIdxValues(1) ); rcMbDataAccess.getMbMvdData ( LIST_1 ).clear(); } else { rcMbDataAccess.getMbData().setFwdBwd( 0x1111 ); rcMbDataAccess.getMbMotionData( LIST_0 ).clear( RefIdxValues(1) ); rcMbDataAccess.getMbMvdData ( LIST_0 ).clear(); rcMbDataAccess.getMbMotionData( LIST_1 ).clear( BLOCK_NOT_PREDICTED ); rcMbDataAccess.getMbMvdData ( LIST_1 ).clear(); } } else { if( rcMbDataAccess.getSH().isBSlice() ) { DECRNOK( xReadMotionPredFlags ( rcMbDataAccess, eMbMode, LIST_0 ) ); DECRNOK( xReadMotionPredFlags ( rcMbDataAccess, eMbMode, LIST_1 ) ); DECRNOK( xReadReferenceIndices ( rcMbDataAccess, eMbMode, LIST_0 ) ); DECRNOK( xReadReferenceIndices ( rcMbDataAccess, eMbMode, LIST_1 ) ); DECRNOK( xReadMotionVectors ( rcMbDataAccess, eMbMode, LIST_0 ) ); DECRNOK( xReadMotionVectors ( rcMbDataAccess, eMbMode, LIST_1 ) ); } else { DECRNOK( xReadMotionPredFlags ( rcMbDataAccess, eMbMode, LIST_0 ) ); DECRNOK( xReadReferenceIndices ( rcMbDataAccess, eMbMode, LIST_0 ) ); DECRNOK( xReadMotionVectors ( rcMbDataAccess, eMbMode, LIST_0 ) ); } } } //===== TEXTURE INFO ===== if( rcMbDataAccess.getMbData().isPCM() ) { DECRNOK( m_pcMbSymbolReadIf->samplesPCM( rcMbDataAccess ) ); } else { if( ! rcMbDataAccess.getMbData().getBLSkipFlag() ) { DECRNOK( xReadIntraPredModes( rcMbDataAccess ) ); } Bool bTrafo8x8Flag = ( rcMbDataAccess.getSH().getPPS().getTransform8x8ModeFlag() && ( rcMbDataAccess.getMbData().getBLSkipFlag() || ( rcMbDataAccess.getMbData().is8x8TrafoFlagPresent( rcMbDataAccess.getSH().getSPS().getDirect8x8InferenceFlag() ) && !rcMbDataAccess.getMbData().isIntra4x4() ) ) ); bBaseLayerAvailable = ! rcMbDataAccess.getSH().getNoInterLayerPredFlag(); DECRNOK( xReadTextureInfo( rcMbDataAccess, bTrafo8x8Flag, bBaseLayerAvailable, rcMbDataAccess.getSH().getScanIdxStart(), rcMbDataAccess.getSH().getScanIdxStop() ) ); } } m_bPrevIsSkipped = ! bIsCoded; if( rcMbDataAccess.getSH().isMbaffFrame() && ( rcMbDataAccess.isTopMb() ) ) { rbEndOfSlice = false; return Err::m_nOK; } //===== terminating bits ===== rbEndOfSlice = m_pcMbSymbolReadIf->isEndOfSlice(); return Err::m_nOK; }