H264AVC_NAMESPACE_BEGIN CabacContextModel2DBuffer::CabacContextModel2DBuffer( UInt uiSizeY, UInt uiSizeX ) : m_pcCContextModel( NULL ), m_uiSizeX( uiSizeX ), m_uiSizeY( uiSizeY ) { AOF_DBG( uiSizeY ); AOF_DBG( uiSizeX ); m_pcCContextModel = new CabacContextModel[ m_uiSizeY * m_uiSizeX ]; }
ErrVal BitReadBuffer::flush( UInt uiNumberOfBits ) { // check the number_of_bits parameter matches the range AOF_DBG( uiNumberOfBits <= 32 ); DECROTR( uiNumberOfBits > m_uiBitsLeft, Err::m_nEndOfBuffer ); // sub the desired number of bits m_uiBitsLeft -= uiNumberOfBits; m_iValidBits -= uiNumberOfBits; // check the current word for beeing still valid if( 0 < m_iValidBits ) { m_ulCurrentBits <<= uiNumberOfBits; return Err::m_nOK; } xReadNextWord(); // shift to the right position m_ulCurrentBits <<= 32 - m_iValidBits; return Err::m_nOK; }
UInt MotionEstimationCost::getComponentBits( Int iVal ) { UInt uiLength = 1; UInt uiTemp = ( iVal <= 0) ? (-iVal<<1)+1: (iVal<<1); AOF_DBG( uiTemp ); while( 1 != uiTemp ) { uiTemp >>= 1; uiLength += 2; } return uiLength; }
ErrVal MbDataCtrl::initSlice( SliceHeader& rcSH, ProcessingState eProcessingState, Bool bDecoder, MbDataCtrl* pcMbDataCtrl ) { AOF_DBG( m_bInitDone ); m_eProcessingState = eProcessingState; m_pcMbDataCtrl0L1 = NULL; m_iColocatedOffset = 0; m_bUseTopField = false; m_bPicCodedField = rcSH.getFieldPicFlag(); if( rcSH.isInterB() ) { if( ((rcSH.getNalUnitType() != NAL_UNIT_CODED_SLICE_IDR_SCALABLE && rcSH.getNalUnitType() != NAL_UNIT_CODED_SLICE_SCALABLE) || (!rcSH.getSvcMvcFlag()) ) && bDecoder && rcSH.getRefListSize( LIST_1 ) ) { const RefPic& rcRefPic0L1 = rcSH.getRefPic( 1, rcSH.getPicType(), LIST_1 ); AOF_DBG( rcRefPic0L1.isAvailable() ); const FrameUnit* pcFU = rcRefPic0L1.getPic().getFrameUnit(); Int iCurrPoc = rcSH.getPoc(); Int iTopDiffPOC = iCurrPoc - pcFU->getTopField().getPOC(); Int iBotDiffPOC = iCurrPoc - pcFU->getBotField().getPOC(); m_bUseTopField = (abs( iTopDiffPOC ) < abs( iBotDiffPOC ) ); m_pcMbDataCtrl0L1 = pcFU->getMbDataCtrl(); if( FRAME != rcSH.getPicType() ) { if( rcRefPic0L1.getFrame()->getPicType() != rcSH.getPicType() && m_pcMbDataCtrl0L1->isPicCodedField() ) { m_iColocatedOffset = m_iMbPerLine; } } } if( pcMbDataCtrl ) { m_pcMbDataCtrl0L1 = pcMbDataCtrl; } if(!bDecoder) { // Fix by hwsun@Panasonic & Dong if (eProcessingState == ENCODE_PROCESS) { if( (rcSH.getNalUnitType() != NAL_UNIT_CODED_SLICE_IDR_SCALABLE && rcSH.getNalUnitType() != NAL_UNIT_CODED_SLICE_SCALABLE) || (!rcSH.getSvcMvcFlag()) ) { PicType picType = rcSH.getPicType(); RefFrameList* pRefFrameList1 = rcSH.getRefFrameList(picType, LIST_1); Int iCurrPoc = rcSH.getPoc(); Int iTopDiffPOC = iCurrPoc - pRefFrameList1->getEntry( 0 )->getTopFieldPoc(); Int iBotDiffPOC = iCurrPoc - pRefFrameList1->getEntry( 0 )->getBotFieldPoc(); m_bUseTopField = (abs( iTopDiffPOC ) < abs( iBotDiffPOC ) ); if( FRAME != rcSH.getPicType() ) { if( pRefFrameList1->getEntry( 0 )->getPicType() != rcSH.getPicType() && m_pcMbDataCtrl0L1->isPicCodedField() ) { m_iColocatedOffset = m_iMbPerLine; } } } } else { m_bUseTopField = true;//lufeng: default } } } if( PARSE_PROCESS == m_eProcessingState || ENCODE_PROCESS == m_eProcessingState ) { m_uiSliceId++; //manu.mathew@samsung : memory leak fix if( m_cpDFPBuffer.get( m_uiSliceId ) ) { delete m_cpDFPBuffer.get( m_uiSliceId ); m_cpDFPBuffer.set( m_uiSliceId, NULL ); } //-- m_cpDFPBuffer.set( m_uiSliceId, rcSH.getDeblockingFilterParameter().getCopy() ); m_bDirect8x8InferenceFlag = rcSH.getSPS().getDirect8x8InferenceFlag(); } m_pcSliceHeader = &rcSH; Int iMbPerColumn = rcSH.getSPS().getFrameHeightInMbs (); m_iMbPerLine = rcSH.getSPS().getFrameWidthInMbs (); m_uiMbOffset = rcSH.getBottomFieldFlag() ? 1 * m_iMbPerLine : 0; m_uiMbStride = rcSH.getFieldPicFlag() ? 2 * m_iMbPerLine : m_iMbPerLine; m_iMbPerColumn = rcSH.getFieldPicFlag() ? iMbPerColumn/2 : iMbPerColumn; m_ucLastMbQp = rcSH.getPicQp(); H264AVC_DELETE_CLASS( m_pcMbDataAccess ); return Err::m_nOK; }
Void IntraPrediction::setAvailableMaskMb( UInt uiAvailableMaskMb ) { AOF_DBG( uiAvailableMaskMb < 256 ); m_uiAvailableMaskMb = uiAvailableMaskMb; }