ErrVal Frame::removeFieldBuffer( PicType ePicType ) { ASSERT( m_ePicType==FRAME ); if( ePicType==TOP_FIELD ) { if( NULL != m_pcFrameTopField ) { // remove the default yuv memory from buffers RNOK( m_pcFrameTopField->uninit () ); RNOK( m_pcFrameTopField->destroy() ); m_pcFrameTopField = NULL; } } else if( ePicType==BOT_FIELD ) { if( NULL != m_pcFrameBotField ) { // remove the default yuv memory from buffers RNOK( m_pcFrameBotField->uninit () ); RNOK( m_pcFrameBotField->destroy() ); m_pcFrameBotField = NULL; } } return Err::m_nOK; }
ErrVal MVCScalableModifyCode::WriteTrailingBits() { RNOK( WriteFlag( 1 ) ); RNOK( WriteAlignZero() ); return Err::m_nOK; }
ErrVal ReconstructionBypass::xPad8x8Blk_MbAff( YuvMbBufferExtension* pcBuffer, UInt ui8x8Blk, Bool bV0, Bool bV1, Bool bH, Bool bC0, Bool bC1 ) { Bool bSwitch = ( !bV0 && bV1 && bH ) || ( !bV0 && !bH && !bC0 && ( bV1 || bC1 ) ); Bool bDouble = ( bV0 && bV1 ) || ( ( bV0 || bC0 ) && !bH && ( bV1 || bC1 ) ); ROT( bSwitch && bDouble ); Bool bFromAbove = ( ui8x8Blk < 2 ); Bool bFromLeft = ( ui8x8Blk % 2 == 0 ); B8x8Idx cIdx( (Par8x8)ui8x8Blk ); if( bDouble ) { RNOK( xPadBlock_MbAff( pcBuffer, cIdx, bV0, bH, bC0, true, bFromAbove, bFromLeft ) ); RNOK( xPadBlock_MbAff( pcBuffer, cIdx, bV1, bH, bC1, true, !bFromAbove, bFromLeft ) ); } else if( bSwitch ) { RNOK( xPadBlock_MbAff( pcBuffer, cIdx, bV1, bH, bC1, false, !bFromAbove, bFromLeft ) ); } else { RNOK( xPadBlock_MbAff( pcBuffer, cIdx, bV0, bH, bC0, false, bFromAbove, bFromLeft ) ); } return Err::m_nOK; }
ErrVal MbDecoder::xDecodeMbIntra4x4( MbDataAccess& rcMbDataAccess, IntYuvMbBuffer& cYuvMbBuffer, IntYuvMbBuffer& rcPredBuffer ) { Int iStride = cYuvMbBuffer.getLStride(); MbTransformCoeffs& rcCoeffs = m_cTCoeffs; for( B4x4Idx cIdx; cIdx.isLegal(); cIdx++ ) { rcMbDataAccess.getMbData().intraPredMode( cIdx ) = rcMbDataAccess.decodeIntraPredMode( cIdx ); XPel* puc = cYuvMbBuffer.getYBlk( cIdx ); UInt uiPredMode = rcMbDataAccess.getMbData().intraPredMode( cIdx ); RNOK( m_pcIntraPrediction->predictLumaBlock( puc, iStride, uiPredMode, cIdx ) ); rcPredBuffer.loadLuma( cYuvMbBuffer, cIdx ); if( rcMbDataAccess.getMbData().is4x4BlkCoded( cIdx ) ) { RNOK( m_pcTransform->invTransform4x4Blk( puc, iStride, rcCoeffs.get( cIdx ) ) ); } } UInt uiChromaCbp = rcMbDataAccess.getMbData().getCbpChroma4x4(); RNOK( xDecodeChroma( rcMbDataAccess, cYuvMbBuffer, rcPredBuffer, uiChromaCbp, true ) ); return Err::m_nOK; }
ErrVal MbDecoder::xDecodeChroma( MbDataAccess& rcMbDataAccess, YuvMbBuffer& rcRecYuvBuffer, UInt uiChromaCbp, Bool bPredChroma ) { MbTransformCoeffs& rcCoeffs = m_cTCoeffs; Pel* pucCb = rcRecYuvBuffer.getMbCbAddr(); Pel* pucCr = rcRecYuvBuffer.getMbCrAddr(); Int iStride = rcRecYuvBuffer.getCStride(); if( bPredChroma ) { RNOK( m_pcIntraPrediction->predictChromaBlock( pucCb, pucCr, iStride, rcMbDataAccess.getMbData().getChromaPredMode() ) ); } ROTRS( 0 == uiChromaCbp, Err::m_nOK ); Int iScale; Bool bIntra = rcMbDataAccess.getMbData().isIntra(); UInt uiUScalId = ( bIntra ? 1 : 4 ); UInt uiVScalId = ( bIntra ? 2 : 5 ); const UChar* pucScaleU = rcMbDataAccess.getSH().getScalingMatrix( uiUScalId ); const UChar* pucScaleV = rcMbDataAccess.getSH().getScalingMatrix( uiVScalId ); // scaling has already been performed on DC coefficients iScale = ( pucScaleU ? pucScaleU[0] : 16 ); m_pcTransform->invTransformChromaDc( rcCoeffs.get( CIdx(0) ), iScale ); iScale = ( pucScaleV ? pucScaleV[0] : 16 ); m_pcTransform->invTransformChromaDc( rcCoeffs.get( CIdx(4) ), iScale ); RNOK( m_pcTransform->invTransformChromaBlocks( pucCb, iStride, rcCoeffs.get( CIdx(0) ) ) ); RNOK( m_pcTransform->invTransformChromaBlocks( pucCr, iStride, rcCoeffs.get( CIdx(4) ) ) ); return Err::m_nOK; }
ErrVal MbDecoder::xDecodeMbIntra16x16( MbDataAccess& rcMbDataAccess, IntYuvMbBuffer& cYuvMbBuffer, IntYuvMbBuffer& rcPredBuffer ) { Int iStride = cYuvMbBuffer.getLStride(); RNOK( m_pcIntraPrediction->predictLumaMb( cYuvMbBuffer.getMbLumAddr(), iStride, rcMbDataAccess.getMbData().intraPredMode() ) ); rcPredBuffer.loadLuma( cYuvMbBuffer ); MbTransformCoeffs& rcCoeffs = m_cTCoeffs; Quantizer cQuantizer; cQuantizer.setQp ( rcMbDataAccess, false ); const QpParameter rcLQp = cQuantizer.getLumaQp(); Int iScaleY = g_aaiDequantCoef[rcLQp.rem()][0] << rcLQp.per(); const UChar* pucScaleY = rcMbDataAccess.getSH().getScalingMatrix( 0 ); if( pucScaleY ) { iScaleY *= pucScaleY[0]; iScaleY >>= 4; } RNOK( m_pcTransform->invTransformDcCoeff( rcCoeffs.get( B4x4Idx(0) ), iScaleY ) ); for( B4x4Idx cIdx; cIdx.isLegal(); cIdx++ ) { RNOK( m_pcTransform->invTransform4x4Blk( cYuvMbBuffer.getYBlk( cIdx ), iStride, rcCoeffs.get( cIdx ) ) ); } UInt uiChromaCbp = rcMbDataAccess.getMbData().getCbpChroma16x16(); RNOK( xDecodeChroma( rcMbDataAccess, cYuvMbBuffer, rcPredBuffer, uiChromaCbp, true ) ); return Err::m_nOK; }
ErrVal MbDecoder::calcMv( MbDataAccess& rcMbDataAccess, MbDataAccess* pcMbDataAccessBaseMotion ) { if( rcMbDataAccess.getMbData().getBLSkipFlag() ) { return Err::m_nOK; } if( rcMbDataAccess.getMbData().getMbMode() == INTRA_4X4 ) { //----- intra prediction ----- rcMbDataAccess.getMbMotionData( LIST_0 ).setRefIdx( BLOCK_NOT_PREDICTED ); rcMbDataAccess.getMbMotionData( LIST_0 ).setAllMv ( Mv::ZeroMv() ); rcMbDataAccess.getMbMotionData( LIST_1 ).setRefIdx( BLOCK_NOT_PREDICTED ); rcMbDataAccess.getMbMotionData( LIST_1 ).setAllMv ( Mv::ZeroMv() ); } else { if( rcMbDataAccess.getMbData().getMbMode() == MODE_8x8 || rcMbDataAccess.getMbData().getMbMode() == MODE_8x8ref0 ) { for( B8x8Idx c8x8Idx; c8x8Idx.isLegal(); c8x8Idx++ ) { //----- motion compensated prediction ----- RNOK( m_pcMotionCompensation->calcMvSubMb( c8x8Idx, rcMbDataAccess, pcMbDataAccessBaseMotion ) ); } } else { //----- motion compensated prediction ----- RNOK( m_pcMotionCompensation->calcMvMb( rcMbDataAccess, pcMbDataAccessBaseMotion ) ); } } return Err::m_nOK; }
// ---------------------------------------------------------------------- // // FUNCTION: AddMultiviewRefsToList // // INPUTS: recPicBufUnitList: A list of refernce pictures potentially // containing multiview references. // rcList: A RefFrameList object to add multiview references to. // refDirection: Direction of references to add to rcList. // // PURPOSE: This function goes through each reference in recPicBufUnitList, // finds all multiview references with the given refDirection, // and adds them to rcList. // // MODIFIED: Tue Mar 14, 2006 // // ---------------------------------------------------------------------- // modified to be a member of RecPicBuffer 26 Dec, 2006 // and the format has also been adjusted (AddMultiviewRef) // Simplified again for JVT-V043 7 Feb. 2007 // and some cleanup ErrVal RecPicBuffer::AddMultiviewRef( RecPicBufUnitList& recPicBufUnitList, RefFrameList& rcList, const int maxListSize, const MultiviewReferenceDirection refDirection, SliceHeader& rcSliceheader, QuarterPelFilter* pcQuarterPelFilter) { RefFrameList tempList; RecPicBufUnitList::iterator iter; for (iter = recPicBufUnitList.begin();iter != recPicBufUnitList.end(); iter++) { if ( refDirection == (*iter)->GetMultiviewReferenceDirection() ) { if(m_pcPicEncoder->derivation_Inter_View_Flag((*iter)->getViewId(), rcSliceheader)){ //JVT-W056 Samsung RecPicBufUnit* bufUnitToAdd = (*iter); if( 1) { RNOK( bufUnitToAdd->getRecFrame()->initHalfPel() ); } if( ! bufUnitToAdd->getRecFrame()->isExtended() ) { RNOK( bufUnitToAdd->getRecFrame()->extendFrame( pcQuarterPelFilter, FRAME, rcSliceheader.getSPS().getFrameMbsOnlyFlag() )); } rcList.add( bufUnitToAdd->getRecFrame()->getPic(rcSliceheader.getPicType()) ); } } } return Err::m_nOK; }
ErrVal PictureParameterSet::xReadFrext( HeaderSymbolReadIf* pcReadIf ) { const CommonMainH264* pcMainH264 = CommonMain::getMainH264(); ASSERT(pcMainH264 != NULL); const CommonElt* pcCurrent = pcMainH264->getEltCurrent(); const CommonSyntax* pcSyntax; const CommonControl* pcControlIf0 = pcCurrent->addControl("if" , "more_rbsp_data", pcReadIf->moreRBSPData()); ROTRS( ! pcReadIf->moreRBSPData(), Err::m_nOK ); pcSyntax = pcCurrent->addSyntax("transform_8x8_mode_flag", "u(1)"); RNOK ( pcReadIf->getFlag ( m_bTransform8x8ModeFlag, "PPS: transform_8x8_mode_flag" ) ); pcSyntax->setValue(m_bTransform8x8ModeFlag); pcSyntax = pcCurrent->addSyntax("pic_scaling_matrix_present_flag", "u(1)"); RNOK ( pcReadIf->getFlag ( m_bPicScalingMatrixPresentFlag, "PPS: pic_scaling_matrix_present_flag" ) ); pcSyntax->setValue(m_bPicScalingMatrixPresentFlag); const CommonControl* pcControlIf1 = pcCurrent->addControl("if" , "pic_scaling_matrix_present_flag", m_bPicScalingMatrixPresentFlag); if( m_bPicScalingMatrixPresentFlag ) { pcMainH264->setEltCurrent(pcControlIf1); RNOK( m_cPicScalingMatrix.read( pcReadIf, m_bTransform8x8ModeFlag ) ); pcMainH264->setEltCurrent(pcCurrent); } pcSyntax = pcCurrent->addSyntax("second_chroma_qp_index_offset", "se(v)"); RNOK ( pcReadIf->getSvlc ( m_iSecondChromaQpIndexOffset, "PPS: second_chroma_qp_index_offset" ) ); pcSyntax->setValue(m_iSecondChromaQpIndexOffset); ROT ( m_iSecondChromaQpIndexOffset < -12 || m_iSecondChromaQpIndexOffset > 12 ); return Err::m_nOK; }
ErrVal ControlMngH264AVCDecoder::initSliceForReading( const SliceHeader& rcSH ) { m_uiCurrLayer = rcSH.getLayerId(); MbSymbolReadIf* pcMbSymbolReadIf; if( rcSH.getPPS().getEntropyCodingModeFlag() ) { pcMbSymbolReadIf = m_pcCabacReader; } else { pcMbSymbolReadIf = m_pcUvlcReader; } if ( rcSH.getTrueSlice()) { RNOK( pcMbSymbolReadIf->startSlice( rcSH ) ); } RNOK( m_pcMbParser->initSlice( pcMbSymbolReadIf ) ); #ifdef LF_INTERLACE m_pcSliceHeader = &rcSH; #endif return Err::m_nOK; }
ErrVal MbCoder::xWriteIntraPredModes( MbDataAccess& rcMbDataAccess ) { ROFRS( rcMbDataAccess.getMbData().isIntra(), Err::m_nOK ); if( rcMbDataAccess.getMbData().isIntra4x4() ) { if( rcMbDataAccess.getSH().getPPS().getTransform8x8ModeFlag() ) { RNOK( m_pcMbSymbolWriteIf->transformSize8x8Flag( rcMbDataAccess ) ); } if( rcMbDataAccess.getMbData().isTransformSize8x8() ) { for( B8x8Idx cIdx; cIdx.isLegal(); cIdx++ ) { RNOK( m_pcMbSymbolWriteIf->intraPredModeLuma( rcMbDataAccess, cIdx ) ); } } else { for( S4x4Idx cIdx; cIdx.isLegal(); cIdx++ ) { RNOK( m_pcMbSymbolWriteIf->intraPredModeLuma( rcMbDataAccess, cIdx ) ); } } } if( rcMbDataAccess.getMbData().isIntra4x4() || rcMbDataAccess.getMbData().isIntra16x16() ) { RNOK( m_pcMbSymbolWriteIf->intraPredModeChroma( rcMbDataAccess ) ); } return Err::m_nOK; }
ErrVal MbDataCtrl::init( const SequenceParameterSet& rcSPS ) { AOT_DBG( m_bInitDone ); UInt uiSize = rcSPS.getMbInFrame(); ROT( 0 == uiSize ); if( m_uiSize == uiSize ) { RNOK( xResetData() ); } else { RNOK( xDeleteData() ); RNOK( xCreateData( uiSize ) ); m_uiSize = uiSize; } m_iMbPerLine = rcSPS.getFrameWidthInMbs(); RNOK( m_cpDFPBuffer.init( uiSize+1 ) ); m_cpDFPBuffer.clear(); m_bInitDone = true; return Err::m_nOK; }
ErrVal ControlMngH264AVCDecoder::initMbForDecoding( MbDataAccess*& rpcMbDataAccess,UInt uiMbIndex) #endif { ROF( m_uiCurrLayer < MAX_LAYERS ); #ifndef LF_INTERLACE UInt uiMbY, uiMbX; uiMbY = uiMbIndex / m_auiMbXinFrame[m_uiCurrLayer]; uiMbX = uiMbIndex - uiMbY * m_auiMbXinFrame[m_uiCurrLayer]; #endif RNOK( m_pcMbDataCtrl ->initMb( rpcMbDataAccess, uiMbY, uiMbX ) ); #ifdef LF_INTERLACE RNOK( m_apcYuvFullPelBufferCtrl[m_uiCurrLayer]->initMb( uiMbY, uiMbX, bMbAFF ) ); // for future use #else //!LF_INTERLACE RNOK( m_apcYuvFullPelBufferCtrl[m_uiCurrLayer]->initMb( uiMbY, uiMbX ) ); #endif //LF_INTERLACE #ifdef LF_INTERLACE RNOK( m_pcMotionCompensation ->initMb( uiMbY, uiMbX, *rpcMbDataAccess ) ) ; #else RNOK( m_pcMotionCompensation ->initMb( uiMbY, uiMbX ) ) ; #endif return Err::m_nOK; }
ErrVal MVCScalableModifyCode::WritePayloadHeader( enum h264::SEI::MessageType eType, UInt uiSize ) { //type { UInt uiTemp = eType; UInt uiByte = 0xFF; while( 0xFF == uiByte ) { uiByte = (0xFF > uiTemp) ? uiTemp : 0xff; uiTemp -= 0xFF; RNOK( WriteCode( uiByte, 8 ) ); } } // size { UInt uiTemp = uiSize; UInt uiByte = 0xFF; while( 0xFF == uiByte ) { uiByte = (0xFF > uiTemp) ? uiTemp : 0xff; uiTemp -= 0xFF; RNOK( WriteCode( uiByte, 8 ) ); } } return Err::m_nOK; }
ErrVal VUI::LayerInfo::write( HeaderSymbolWriteIf* pcWriteIf ) const { RNOK( pcWriteIf->writeCode( m_uiDependencyID, 3, "VUI: dependency_id" ) ); RNOK( pcWriteIf->writeCode( m_uiQualityId, 4, "VUI: quality_level" ) ); RNOK( pcWriteIf->writeCode( m_uiTemporalId, 3, "VUI: temporal_level" ) ); return Err::m_nOK; }
ErrVal CabaEncoder::writeExGolombLevel( UInt uiSymbol, CabacContextModel& rcCCModel ) { if( uiSymbol ) { RNOK( writeSymbol( 1, rcCCModel ) ); UInt uiCount = 0; Bool bNoExGo = (uiSymbol < 13); while( --uiSymbol && ++uiCount < 13 ) { RNOK( writeSymbol( 1, rcCCModel ) ); } if( bNoExGo ) { RNOK( writeSymbol( 0, rcCCModel ) ); } else { RNOK( writeEpExGolomb( uiSymbol, 0 ) ); } } else { RNOK( writeSymbol( 0, rcCCModel ) ); } return Err::m_nOK; }
ErrVal ControlMngH264AVCDecoder::initSlice( SliceHeader& rcSH, ProcessingState eProcessingState ) { m_uiCurrLayer = rcSH.getLayerId(); m_pcMbDataCtrl = rcSH.getFrameUnit()->getMbDataCtrl(); RNOK( m_pcMbDataCtrl->initSlice( rcSH, eProcessingState, true, NULL ) ); RNOK( m_pcSampleWeighting->initSlice( rcSH ) ); if( PARSE_PROCESS == eProcessingState && rcSH.getTrueSlice())//TMM_EC { MbSymbolReadIf* pcMbSymbolReadIf; if( rcSH.getPPS().getEntropyCodingModeFlag() ) { pcMbSymbolReadIf = m_pcCabacReader; } else { pcMbSymbolReadIf = m_pcUvlcReader; } RNOK( pcMbSymbolReadIf->startSlice( rcSH ) ); RNOK( m_pcMbParser->initSlice( pcMbSymbolReadIf ) ); } if( DECODE_PROCESS == eProcessingState) { RNOK( m_pcMotionCompensation->initSlice( rcSH ) ); } return Err::m_nOK; }
ErrVal RecPicBuffer::xStorePicture( RecPicBufUnit* pcRecPicBufUnit, PicBufferList& rcOutputList, PicBufferList& rcUnusedList, SliceHeader* pcSliceHeader, Bool bTreatAsIdr ) { ROF( pcRecPicBufUnit == m_pcCurrRecPicBufUnit ); if( bTreatAsIdr ) { RNOK( xClearOutputAll( rcOutputList, rcUnusedList ) ); m_cUsedRecPicBufUnitList.push_back( pcRecPicBufUnit ); } else { m_cUsedRecPicBufUnitList.push_back( pcRecPicBufUnit ); if( !pcSliceHeader->getInterViewRef()) // { RNOK( xUpdateMemory( pcSliceHeader ) ); } RNOK( xOutput( rcOutputList, rcUnusedList ) ); } RNOK( xDumpRecPicBuffer() ); m_pcCurrRecPicBufUnit = m_cFreeRecPicBufUnitList.popFront(); return Err::m_nOK; }
ErrVal RecPicBuffer::xCheckMissingPics( SliceHeader* pcSliceHeader, PicBufferList& rcOutputList, PicBufferList& rcUnusedList ) { ROTRS( pcSliceHeader->isIdrNalUnit(), Err::m_nOK ); ROTRS( ( ( m_uiLastRefFrameNum + 1 ) % m_uiMaxFrameNum ) == pcSliceHeader->getFrameNum(), Err::m_nOK ); UInt uiMissingFrames = pcSliceHeader->getFrameNum() - m_uiLastRefFrameNum - 1; if( pcSliceHeader->getFrameNum() <= m_uiLastRefFrameNum ) { uiMissingFrames += m_uiMaxFrameNum; } ROF( pcSliceHeader->getSPS().getRequiredFrameNumUpdateBehaviourFlag() ); for( UInt uiIndex = 1; uiIndex <= uiMissingFrames; uiIndex++ ) { Bool bTreatAsIdr = ( m_cUsedRecPicBufUnitList.empty() ); Int iPoc = ( bTreatAsIdr ? 0 : m_cUsedRecPicBufUnitList.back()->getPoc() ); UInt uiFrameNum = ( m_uiLastRefFrameNum + uiIndex ) % m_uiMaxFrameNum; RNOK( m_pcCurrRecPicBufUnit->initNonEx( iPoc, uiFrameNum ) ); RNOK( xStorePicture( m_pcCurrRecPicBufUnit, rcOutputList, rcUnusedList, pcSliceHeader, bTreatAsIdr ) ); } m_uiLastRefFrameNum = ( m_uiLastRefFrameNum + uiMissingFrames ) % m_uiMaxFrameNum; return Err::m_nOK; }
ErrVal RecPicBuffer::ProcessRef(SliceHeader& rcSliceHeader, RefFrameList& rcList ,RefFrameList& rcListTemp, QuarterPelFilter* pcQuarterPelFilter) { UInt uiPos; PicType ePicType=rcSliceHeader.getPicType(); bool bFieldPic=(ePicType!=FRAME); for( uiPos = 0; uiPos < rcListTemp.getSize() ; uiPos++ ) { IntFrame* pcRefFrame = rcListTemp.getEntry( uiPos ); if( 1)//! ( pcRefFrame->isHalfPel() && pcRefFrame->isPicReady(FRAME) ) ) { RNOK( pcRefFrame->initHalfPel() ); } if( ! pcRefFrame->isExtended() ) { RNOK( pcRefFrame->extendFrame( pcQuarterPelFilter, FRAME, rcSliceHeader.getSPS().getFrameMbsOnlyFlag() )); } } if(bFieldPic)//lufeng xFieldList(rcSliceHeader,rcList,rcListTemp); else { for( uiPos = 0; uiPos < rcListTemp.getSize() ; uiPos++ ) { rcListTemp[uiPos+1]->getFullPelYuvBuffer()->fillMargin();//lufeng: for frame ref rcList.add(rcListTemp[uiPos+1]); } } return Err::m_nOK; }
ErrVal SliceEncoder::updatePictureResTransform( ControlData& rcControlData, UInt uiMbInRow ) { ROF( m_bInitDone ); SliceHeader& rcSliceHeader = *rcControlData.getSliceHeader (); MbDataCtrl* pcMbDataCtrl = rcControlData.getMbDataCtrl (); MbDataCtrl* pcBaseLayerCtrl = rcControlData.getBaseLayerCtrl (); UInt uiMbAddress = 0; UInt uiLastMbAddress = rcSliceHeader.getMbInPic() - 1; //====== initialization ====== RNOK( pcMbDataCtrl->initSlice( rcSliceHeader, DECODE_PROCESS, false, NULL ) ); // Update the macroblock state // Must be done after the bit-stream has been constructed for( ; uiMbAddress <= uiLastMbAddress; ) { UInt uiMbY = 0; UInt uiMbX = 0; MbDataAccess* pcMbDataAccess = 0; MbDataAccess* pcMbDataAccessBase = 0; rcSliceHeader.getMbPositionFromAddress( uiMbY, uiMbX, uiMbAddress ); RNOK( pcMbDataCtrl ->initMb ( pcMbDataAccess, uiMbY, uiMbX ) ); if( pcBaseLayerCtrl ) { RNOK( pcBaseLayerCtrl ->initMb ( pcMbDataAccessBase, uiMbY, uiMbX ) ); pcMbDataAccess->setMbDataAccessBase( pcMbDataAccessBase ); } // modify QP values (as specified in G.8.1.5.1.2) if( pcMbDataAccess->getMbData().getMbCbp() == 0 && ( pcMbDataAccess->getMbData().getMbMode() == INTRA_BL || pcMbDataAccess->getMbData().getResidualPredFlag() ) ) { pcMbDataAccess->getMbData().setQp ( pcMbDataAccessBase->getMbData().getQp() ); pcMbDataAccess->getMbData().setQp4LF( pcMbDataAccessBase->getMbData().getQp() ); } // if cbp==0, tranform size is not transmitted, in this case inherit the transform size from base layer if( ( pcMbDataAccess->getMbData().getResidualPredFlag() && ! pcMbDataAccess->getMbData().isIntra() && ! pcMbDataAccessBase->getMbData().isIntra() ) || ( pcMbDataAccess->getMbData().getMbMode() == INTRA_BL ) ) { if( ( pcMbDataAccess->getMbData().getMbCbp() & 0x0F ) == 0 ) { pcMbDataAccess->getMbData().setTransformSize8x8( pcMbDataAccessBase->getMbData().isTransformSize8x8() ); } } // set I_PCM mode (for deblocking) when CBP is 0, mbMode is I_BL, and base layer mbMode is I_PCM if( pcMbDataAccess->getMbData().getMbCbp() == 0 && pcMbDataAccess->getMbData().isIntraBL() && pcMbDataAccessBase->getMbData().isPCM() ) { pcMbDataAccess->getMbData().setMbMode( MODE_PCM ); } uiMbAddress++; } return Err::m_nOK; }
ErrVal Frame::store( PicBuffer* pcPicBuffer, PicType ePicType ) { ASSERT( m_ePicType == FRAME ); RNOK ( getFullPelYuvBuffer()->storeToPicBuffer ( pcPicBuffer ) ); ROTRS ( ePicType == FRAME, Err::m_nOK ); RNOK ( getFullPelYuvBuffer()->interpolatedPicBuffer( pcPicBuffer, ePicType == TOP_FIELD ) ); return Err::m_nOK; }
ErrVal VUI::ChromaLocationInfo::write( HeaderSymbolWriteIf* pcWriteIf ) const { RNOK( pcWriteIf->writeFlag( m_bChromaLocationInfoPresentFlag, "VUI: chroma_location_info_present_flag")); ROFRS( m_bChromaLocationInfoPresentFlag, Err::m_nOK ); RNOK( pcWriteIf->writeUvlc( m_uiChromaLocationFrame, "VUI: chroma_location_frame")); RNOK( pcWriteIf->writeUvlc( m_uiChromaLocationField, "VUI: chroma_location_field")); return Err::m_nOK; }
ErrVal ControlMngH264AVCDecoder::initSliceForDecoding( const SliceHeader& rcSH ) { m_uiCurrLayer = rcSH.getLayerId(); RNOK( m_pcMotionCompensation->initSlice( rcSH ) ); RNOK( m_pcSampleWeighting->initSlice( rcSH ) ); return Err::m_nOK; }
ErrVal Frame::addFrameFieldBuffer() { ASSERT( m_ePicType==FRAME ); RNOK( addFieldBuffer( TOP_FIELD ) ); RNOK( addFieldBuffer( BOT_FIELD ) ); return Err::m_nOK; }
ErrVal ControlMngH264AVCDecoder::initSlice0( SliceHeader *rcSH ) { UInt uiLayer = rcSH->getLayerId (); /* //JVT-T054{ if(rcSH->getBaseLayerId() != MSYS_UINT_MAX && rcSH->getQualityLevel() != 0) { if( !m_apcMCTFDecoder[uiLayer]->isActive()) { m_apcMCTFDecoder[uiLayer]->initSlice0( rcSH ); } //if(!m_apcMCTFDecoder[uiLayer]->getResizeParameters()) RNOK( xInitESS( rcSH ) ); return Err::m_nOK; } //JVT-T054} */ ROTRS( m_uiInitilized[uiLayer], Err::m_nOK ); m_auiMbXinFrame[uiLayer] = rcSH->getSPS().getFrameWidthInMbs (); m_auiMbYinFrame[uiLayer] = rcSH->getSPS().getFrameHeightInMbs (); UInt uiSizeX = m_auiMbXinFrame [uiLayer] << 4; UInt uiSizeY = m_auiMbYinFrame [uiLayer] << 4; RNOK( m_apcYuvFullPelBufferCtrl [uiLayer]->initSlice( uiSizeY, uiSizeX, YUV_Y_MARGIN, YUV_X_MARGIN ) ); if( uiLayer == 0 ) { m_bLayer0IsAVC = ( rcSH->getNalUnitType() == NAL_UNIT_CODED_SLICE || rcSH->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR); RNOK( m_pcFrameMng->initSlice ( rcSH ) ); m_pcH264AVCDecoder->setReconstructionLayerId( uiLayer ); m_pcH264AVCDecoder->setBaseAVCCompatible ( m_bLayer0IsAVC ); } else { m_pcH264AVCDecoder->setReconstructionLayerId( uiLayer ); } if( (rcSH->getNalUnitType() == NAL_UNIT_CODED_SLICE_SCALABLE || rcSH->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_SCALABLE) && rcSH->getTrueSlice())//TMM_EC { /* if(!rcSH->getSvcMvcFlag() ) m_apcMCTFDecoder[uiLayer]->initSlice0( rcSH ); */ } RNOK( xInitESS( rcSH ) ); m_uiInitilized[uiLayer] = true; return Err::m_nOK; }
ErrVal VUI::TimingInfo::write( HeaderSymbolWriteIf* pcWriteIf ) const { RNOK( pcWriteIf->writeFlag( m_bTimingInfoPresentFlag, "VUI: timing_info_present_flag")); ROFRS( m_bTimingInfoPresentFlag, Err::m_nOK ); RNOK( pcWriteIf->writeCode( m_uiNumUnitsInTick, 32, "VUI: num_units_in_tick")); RNOK( pcWriteIf->writeCode( m_uiTimeScale, 32, "VUI: time_scale")); RNOK( pcWriteIf->writeFlag( m_bFixedFrameRateFlag, "VUI: fixed_frame_rate_flag")); return Err::m_nOK; }
ErrVal MbDecoder::compensatePrediction( MbDataAccess& rcMbDataAccess ) { ROTRS( rcMbDataAccess.getMbData().isIntra(), Err::m_nOK ); IntYuvMbBuffer cIntYuvMbBuffer; YuvMbBuffer cYuvMbBuffer; RNOK( m_pcMotionCompensation->compensateMb( rcMbDataAccess, &cYuvMbBuffer, false, false ) ); cIntYuvMbBuffer.loadBuffer( &cYuvMbBuffer ); RNOK( m_pcFrameMng->getPredictionIntFrame()->getFullPelYuvBuffer()->loadBuffer( &cIntYuvMbBuffer ) ); return Err::m_nOK; }
ErrVal VUI::copyExceptHRDParametersAndSVCExt( const VUI& rcVUI ) { m_bVuiParametersPresentFlag = rcVUI.m_bVuiParametersPresentFlag; m_bOverscanInfoPresentFlag = rcVUI.m_bOverscanInfoPresentFlag; m_bOverscanAppropriateFlag = rcVUI.m_bOverscanAppropriateFlag; RNOK( m_cAspectRatioInfo .copy( rcVUI.m_cAspectRatioInfo ) ); RNOK( m_cVideoSignalType .copy( rcVUI.m_cVideoSignalType ) ); RNOK( m_cChromaLocationInfo .copy( rcVUI.m_cChromaLocationInfo ) ); RNOK( m_cBitstreamRestriction .copy( rcVUI.m_cBitstreamRestriction ) ); return Err::m_nOK; }
__inline ErrVal CabaEncoder::xWriteBitAndBitsToFollow( UInt uiBit) { RNOK( xWriteBit( uiBit ) ); // invert bit uiBit = 1-uiBit; while( m_uiBitsToFollow > 0) { m_uiBitsToFollow--; RNOK( xWriteBit( uiBit ) ); } return Err::m_nOK; }