📄 umc_h264_dec.h
字号:
H264DecoderMacroblockGlobalInfo *GetColocatedMacroBlock(H264DecoderFrame *pRefFrame, Ipp8u Field, Ipp32s &yM, Ipp8s *scale = NULL) { Ipp32s num = GetColocatedLocation(pRefFrame, Field, yM, scale); if (num < 0) return NULL; return pRefFrame->m_mbinfo.mbs + num; } Status DecodeDirectMotionVectorsSpatial( H264DecoderFrame **pRefPicList0, H264DecoderFrame **pRefPicList1, Ipp8u Field, bool bUseDirect8x8Inference ); Status DecodeMotionVectors (bool bIsBSlice); bool DecodeSkipMotionVectors (); // Decode the coefficients for a macroblock, placing them // in m_pCoeffBlocksBuf CAVLC or CABAC. Status DecodeCoeffs4x4_CAVLC(Ipp32u cbp); Status DecodeCoeffs8x8_CAVLC(Ipp32u cbp); Status DecodeCoeffsIntra16x16_CAVLC(Ipp32u cbp); void GetLeftLumaBlockAcrossBoundary(H264DecoderBlockLocation *Block,Ipp8s y); void GetLeftChromaMacroBlockAcrossBoundary(Ipp32s& mb); void GetLeftLocationForCurrentMBLumaNonMBAFF(H264DecoderBlockLocation *Block); void GetLeftLocationForCurrentMBChromaNonMBAFF(H264DecoderBlockLocation *Block); void GetTopLocationForCurrentMBLumaNonMBAFF(H264DecoderBlockLocation *Block); void GetTopLocationForCurrentMBChromaNonMBAFF(H264DecoderBlockLocation *Block); void GetTopLeftLocationForCurrentMBLumaNonMBAFF(H264DecoderBlockLocation *Block); void GetTopRightLocationForCurrentMBLumaNonMBAFF(H264DecoderBlockLocation *Block); void GetLeftLocationForCurrentMBLumaMBAFF(H264DecoderBlockLocation *Block,Ipp32s AdditionalDecrement=0); void GetLeftLocationForCurrentMBChromaMBAFF(H264DecoderBlockLocation *Block); void GetTopLocationForCurrentMBLumaMBAFF(H264DecoderBlockLocation *Block,Ipp8u DeblockCalls); void GetTopLocationForCurrentMBChromaMBAFF(H264DecoderBlockLocation *Block); void GetTopLeftLocationForCurrentMBLumaMBAFF(H264DecoderBlockLocation *Block); void GetTopRightLocationForCurrentMBLumaMBAFF(H264DecoderBlockLocation *Block); void UpdateNeighbouringAddresses(Ipp8u IgnoreSliceEdges=0); void UpdateNeighbouringBlocks(Ipp8u DeblockCalls=0); void UpdateCurrentMBInfo(); Ipp32u GetDCBlocksLumaContext() { bool use_above = m_cur_mb.CurrentBlockNeighbours.mb_above.mb_num>=0; bool use_left = m_cur_mb.CurrentBlockNeighbours.mbs_left[0].mb_num>=0; Ipp8u above_coeffs=use_above? m_mbinfo.MacroblockCoeffsInfo[m_cur_mb.CurrentBlockNeighbours.mb_above.mb_num].numCoeff[m_cur_mb.CurrentBlockNeighbours.mb_above.block_num]:0; Ipp8u left_coeffs=use_left? m_mbinfo.MacroblockCoeffsInfo[m_cur_mb.CurrentBlockNeighbours.mbs_left[0].mb_num].numCoeff[m_cur_mb.CurrentBlockNeighbours.mbs_left[0].block_num]:0; if(use_above && use_left) return (above_coeffs+left_coeffs+1)/2; else if (use_above ) return above_coeffs; else if (use_left) return left_coeffs; else return 0; } Ipp32u GetBlocksLumaContext(Ipp32s x,Ipp32s y) { bool use_above = y || m_cur_mb.CurrentBlockNeighbours.mb_above.mb_num>=0; bool use_left = x || m_cur_mb.CurrentBlockNeighbours.mbs_left[y].mb_num>=0; Ipp8u above_coeffs=0; if (use_above) above_coeffs= y==0? m_mbinfo.MacroblockCoeffsInfo[m_cur_mb.CurrentBlockNeighbours.mb_above.mb_num].numCoeff[m_cur_mb.CurrentBlockNeighbours.mb_above.block_num+x]: m_mbinfo.MacroblockCoeffsInfo[m_CurMBAddr].numCoeff[y*4+x-4]; Ipp8u left_coeffs=0; if (use_left)left_coeffs = x==0? m_mbinfo.MacroblockCoeffsInfo[m_cur_mb.CurrentBlockNeighbours.mbs_left[y].mb_num].numCoeff[m_cur_mb.CurrentBlockNeighbours.mbs_left[y].block_num]: m_mbinfo.MacroblockCoeffsInfo[m_CurMBAddr].numCoeff[y*4+x-1]; if(use_above && use_left) return (above_coeffs+left_coeffs+1)/2; else if (use_above ) return above_coeffs; else if (use_left) return left_coeffs; else return 0; } Ipp32u GetBlocksChromaContext(Ipp32s x,Ipp32s y,Ipp32s component) { Ipp8u above_coeffs=0;Ipp8u left_coeffs=0; bool use_above;bool use_left; if (component) { use_above = y || m_cur_mb.CurrentBlockNeighbours.mb_above_chroma[1].mb_num>=0; use_left = x || m_cur_mb.CurrentBlockNeighbours.mbs_left_chroma[1][y].mb_num>=0; if (use_above) above_coeffs=y==0? m_mbinfo.MacroblockCoeffsInfo[m_cur_mb.CurrentBlockNeighbours.mb_above_chroma[1].mb_num].numCoeff[m_cur_mb.CurrentBlockNeighbours.mb_above_chroma[1].block_num+x]: m_mbinfo.MacroblockCoeffsInfo[m_CurMBAddr].numCoeff[y*2+x-2+20]; if (use_left) left_coeffs=x==0? m_mbinfo.MacroblockCoeffsInfo[m_cur_mb.CurrentBlockNeighbours.mbs_left_chroma[1][y].mb_num].numCoeff[m_cur_mb.CurrentBlockNeighbours.mbs_left_chroma[1][y].block_num]: m_mbinfo.MacroblockCoeffsInfo[m_CurMBAddr].numCoeff[y*2+x-1+20]; } else { use_above = y || m_cur_mb.CurrentBlockNeighbours.mb_above_chroma[0].mb_num>=0; use_left = x || m_cur_mb.CurrentBlockNeighbours.mbs_left_chroma[0][y].mb_num>=0; if (use_above) above_coeffs=y==0? m_mbinfo.MacroblockCoeffsInfo[m_cur_mb.CurrentBlockNeighbours.mb_above_chroma[0].mb_num].numCoeff[m_cur_mb.CurrentBlockNeighbours.mb_above_chroma[0].block_num+x]: m_mbinfo.MacroblockCoeffsInfo[m_CurMBAddr].numCoeff[y*2+x-2+16]; if (use_left) left_coeffs=x==0? m_mbinfo.MacroblockCoeffsInfo[m_cur_mb.CurrentBlockNeighbours.mbs_left_chroma[0][y].mb_num].numCoeff[m_cur_mb.CurrentBlockNeighbours.mbs_left_chroma[0][y].block_num]: m_mbinfo.MacroblockCoeffsInfo[m_CurMBAddr].numCoeff[y*2+x-1+16]; } if(use_above && use_left) return (above_coeffs+left_coeffs+1)/2; else if (use_above ) return above_coeffs; else if (use_left) return left_coeffs; else return 0; } //////////////////// Status DecodeCoefficients4x4_CABAC(Ipp32u cbp); Status DecodeCoefficients8x8_CABAC(Ipp32u cbp); // Decode the coefficients for a PCM macroblock, placing them // in m_pCoeffBlocksBuf. Status DecodeCoefficients_PCM(Ipp8u color_format); Ipp32u Intra_MB_type_CABAC(); Ipp32u B_Picture_MB_type_CABAC(); Ipp32u P_Picture_MB_type_CABAC(); Ipp32u DecodeCBP_CABAC(Ipp8u color_format); void ReconstructPCMMB (Ipp32u lumaOffset,Ipp8u color_format); void ReconstructMacroblock( Ipp8u *pDstY, Ipp8u *pDstV, Ipp8u *pDstU, Ipp32u mbXOffset, // for edge clipping Ipp32u mbYOffset, bool bUseDirect8x8Inference, H264DecoderFrame **pRefPicList0, H264DecoderFrame **pRefPicList1, Ipp8u color_format); void ReconstructMacroblock_FLD ( Ipp8u *pDstY, Ipp8u *pDstV, Ipp8u *pDstU, Ipp32u mbXOffset, // for edge clipping Ipp32u mbYOffset, bool bUseDirect8x8Inference, H264DecoderFrame **pRefPicList0, H264DecoderFrame **pRefPicList1, Ipp8s *pFields0, Ipp8s *pFields1, Ipp8u color_format); void ReconstructMacroblockMBAFF( Ipp8u *pDstY, Ipp8u *pDstV, Ipp8u *pDstU, Ipp32u mbXOffset, // for edge clipping Ipp32u mbYOffset, bool bUseDirect8x8Inference, H264DecoderFrame **pRefPicList0, H264DecoderFrame **pRefPicList1, Ipp8u color_format); static const Ipp8u ICBPTAB[6];public: H264VideoDecoder(); ~H264VideoDecoder();//////////////////////// interface methods///////////////////// Status Init (BaseCodecParams *init); // Decode & get decoded frame Status GetFrame(MediaData* in, MediaData* out); Status Close (); Status Reset(){return UMC_NOT_IMPLEMENTED;}; Status GetInfo(BaseCodecParams* info); Ipp32s m_SkipFlag; Ipp32s m_SkipCycle; Ipp32s m_ModSkipCycle; // reset skip frame counter Status ResetSkipCount() { if (IS_DECODE_ONLY_INTRA_REF_SLICES(m_NeedToSkip)) { m_WaitForDR = true;//set true to return to normal frame processing } m_NeedToSkip = 0; m_SkipFlag = 0; return UMC_OK; }; // increment skip frame counter Ipp32s m_VideoDecodingSpeed; virtual Status ChangeVideoDecodingSpeed(int& num) { m_VideoDecodingSpeed+=num; if (m_VideoDecodingSpeed<0) m_VideoDecodingSpeed=0; if (m_VideoDecodingSpeed>6) m_VideoDecodingSpeed=6; num=m_VideoDecodingSpeed; if (m_VideoDecodingSpeed>5) { m_SkipCycle=1; m_ModSkipCycle=1; m_PermanentTurnOffDeblocking = 1; } else if (m_VideoDecodingSpeed>4) { m_SkipCycle=3; m_ModSkipCycle=2; m_PermanentTurnOffDeblocking = 1; } else if (m_VideoDecodingSpeed>3) { m_SkipCycle=2; m_ModSkipCycle=2; m_PermanentTurnOffDeblocking = 1; } else if (m_VideoDecodingSpeed>2) { m_SkipCycle=3; m_ModSkipCycle=3; m_PermanentTurnOffDeblocking = 1; } else if (m_VideoDecodingSpeed>1) { m_SkipCycle=4; m_ModSkipCycle=4; m_PermanentTurnOffDeblocking = 1; } else if (m_VideoDecodingSpeed==1) { m_PermanentTurnOffDeblocking = 1; } else { m_PermanentTurnOffDeblocking = 0; } return UMC_OK; } Status SkipVideoFrame(int num) { INCREASE_SKIP_REPEAT_COUNTER(m_SkipRepeat); m_AskedSkipped+=num; vm_debug_trace(-1,VM_STRING("Skip Frame %d %d %d\n"),num,m_AskedSkipped,m_ReallySkipped); if (m_SkipRepeat>MAX_SKIP_REPEAT) { m_PermanentTurnOffDeblocking=1; m_SkipRepeat=MAX_SKIP_REPEAT; } m_NeedToSkip += num; if (m_NeedT
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -