⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 umc_mpeg2_dec_base.h

📁 这是在PCA下的基于IPP库示例代码例子,在网上下了IPP的库之后,设置相关参数就可以编译该代码.
💻 H
字号:
/*//////////////////////////////////////////////////////////////////////////////////                  INTEL CORPORATION PROPRIETARY INFORMATION//     This software is supplied under the terms of a license agreement or//     nondisclosure agreement with Intel Corporation and may not be copied//     or disclosed except in accordance with the terms of that agreement.//          Copyright(c) 2003-2005 Intel Corporation. All Rights Reserved.//*///  MPEG-2 is a international standard promoted by ISO/IEC and//  other organizations. Implementations of this standard, or the standard//  enabled platforms may require licenses from various entities, including//  Intel Corporation.#ifndef __UMC_MPEG2_DEC_BASE_H#define __UMC_MPEG2_DEC_BASE_H//IPP headers#include "ipps.h"#include "ippi.h"#include "ippvc_bs.h"#include "ippvc.h"//VM headers#include "vm_debug.h"#include "vm_thread.h"#include "vm_event.h"//UMC headers#include "umc_structures.h"#include "umc_video_decoder.h"#include "umc_media_data_ex.h"#include "umc_mpeg2_dec_defs.h"#include "umc_cyclic_buffer.h"#define MPEG2_VIRTUALnamespace UMC{    class MPEG2VideoDecoderBase : public VideoDecoder    {    public:        ///////////////////////////////////////////////////////        /////////////High Level public interface///////////////        ///////////////////////////////////////////////////////        // Default constructor        MPEG2VideoDecoderBase(void);        // Default destructor        MPEG2_VIRTUAL ~MPEG2VideoDecoderBase(void);        // Initialize for subsequent frame decoding.        MPEG2_VIRTUAL Status Init(BaseCodecParams *init);        // Get next frame        MPEG2_VIRTUAL Status GetFrame(MediaData* in, MediaData* out);        // Close  decoding & free all allocated resources        MPEG2_VIRTUAL Status Close(void);        // Reset decoder to initial state        MPEG2_VIRTUAL Status Reset(void);        // Get audio information, valid after initialization        MPEG2_VIRTUAL Status GetInfo(BaseCodecParams* ininfo);        Status          GetPerformance(double *perf);        //reset skip frame counter        Status          ResetSkipCount();        // increment skip frame counter        Status          SkipVideoFrame(int);        // get skip frame counter statistic        vm_var32        GetSkipedFrame();        // returns closed capture data from gop user data        MPEG2_VIRTUAL Status GetClosedCaptureData(MediaData* pCC);        MPEG2_VIRTUAL Status  SetParams(BaseCodecParams* params);    protected:        Status          PrepareBuffer(MediaData* data);        Status          FlushBuffer(MediaData* data, bool);        bool            AdjustSpeed(int nframe);        bool            AdjustSpeed(double delta);        int             DecreaseSpeed(double delta);        int             IncreaseSpeed(double delta);        int             IncreaseSpeedN (int numoffr);        unsigned int     ulResized;        bool            m_bNoBframes;        bool            m_bNoPframes;        double          m_dPlaybackRate;    protected:        //The purpose of protected interface to have controled        //code in derived UMC MPEG2 decoder classes        ///////////////////////////////////////////////////////        /////////////Level 1 protected interface///////////////        ///////////////////////////////////////////////////////        //Level 1 can call level 2 functions or re-implement it        //Sequence Header decode        MPEG2_VIRTUAL Status DecodeSequenceHeader(int threadID = 0);        //Picture Header decode and picture        MPEG2_VIRTUAL Status DecodePicture();        ///////////////////////////////////////////////////////        /////////////Level 2 protected interface///////////////        ///////////////////////////////////////////////////////        //Level 2 can call level 3 functions or re-implement it        //Picture Header decode        MPEG2_VIRTUAL Status DecodePictureHeader();        MPEG2_VIRTUAL Status DecodeSlices(int threadID);        //Slice decode, includes MB decode        MPEG2_VIRTUAL Status DecodeSlice(int threadID);        // decode all headers but slice, starts right after startcode        MPEG2_VIRTUAL Status DecodeHeader(int startcode, int threadID);        ///////////////////////////////////////////////////////        /////////////Level 3 protected interface///////////////        ///////////////////////////////////////////////////////        //Level 3 can call level 4 functions or re-implement it        //Slice Header decode        MPEG2_VIRTUAL Status DecodeSliceHeader(int threadID);        //updates mb_[col/row]_prev, decodes mb position to mb_[col/row]        MPEG2_VIRTUAL Status GetMBposition(int threadID);        //MB Header decode        //MPEG2_VIRTUAL Status DecodeMackroblockHeader();        //Intra MB decode        //MPEG2_VIRTUAL Status DecodeIntraMB();        //Inter MB decode        //MPEG2_VIRTUAL Status DecodeInterMB();        ///////////////////////////////////////////////////////        /////////////Level 4 protected interface///////////////        ///////////////////////////////////////////////////////        //Level 4 is the lowest level chunk of code        //can be used as is for basic codec to implement standard        //or overloaded for special purposes like HWMC, smart decode        //MV decode and calculation        //MPEG2_VIRTUAL Status DecodeMV();        //Reconstruction VLC+dezigzag+IDCT+dequant in intra MB        MPEG2_VIRTUAL Status ReconstructIntraMB(int threadID, int num_blk, int dct_type);        //decode pattern+Reconstruction VLC+dezigzag+IDCT+dequant in inter MB        MPEG2_VIRTUAL Status ReconstuctInterMB(int threadID, int dct_type);        //Motion compensation        MPEG2_VIRTUAL Status  Macroblock_mpeg1            (int threadID);        MPEG2_VIRTUAL Status  BlockIntraChroma_mpeg1      (int threadID, Ipp8u* pDst, short* dc_past);        MPEG2_VIRTUAL Status  BlockIntraLuma_mpeg1        (int threadID, Ipp8u* pDst);        MPEG2_VIRTUAL Status  skipped_macroblockP_mpeg1   (int threadID);        MPEG2_VIRTUAL Status  skipped_macroblockB_mpeg1   (int threadID); protected:        SampleBuffer*             m_pCCData;        MediaData                 m_ccCurrData;        sSequenceHeader           sequenceHeader;        sPictureHeader            PictureHeader;        Ipp8u                     intraBuff[sizeof(IppiDecodeIntraSpec_MPEG2) + 16];        Ipp8u                     interBuff[sizeof(IppiDecodeInterSpec_MPEG2) + 16];        IppiDecodeIntraSpec_MPEG2 *decodeIntraSpec;        IppiDecodeInterSpec_MPEG2 *decodeInterSpec;        vlcStorageMPEG2           vlcTables;        mp2_VLCTable              vlcMBAdressing;        mp2_VLCTable              vlcMBType[3];        mp2_VLCTable              vlcMBPattern;        mp2_VLCTable              vlcMotionVector;        mp2_VLCTable              vlcDctDcSizeLuma;        mp2_VLCTable              vlcDctDcSizeChroma;        IppVideoContext*          Video;        unsigned int              m_lFlags;        bool                      m_bTwoPictures;        BaseColorSpaceConverter * m_lpConverter;        ColorConversionParams     m_Convert;        ColorConversionParams     m_ConvertPreview;        int                       m_decodedFrameNum;        int                       m_maxThreads;        unsigned int              m_uiEndian;        int                       m_nNumberOfThreads;        int                       m_nNumberOfAllocatedThreads;        vm_event*                 m_lpQuit;        vm_event*                 m_lpStopEvent;        vm_event*                 m_lpStartEvent;        vm_thread*                m_lpThreads;        class THREAD_ID        {        public:            vm_var32            m_nNumber;            void *              m_lpOwner;        };        THREAD_ID*                 m_lpThreadsID;        MediaDataEx::_MediaDataEx* m_pStartCodesData;        Status                  ThreadingSetup();        static  unsigned int    ThreadWorkingRoutine(void *lpv);        Status                  RetrieveLastFrame (MediaData* output);        bool                    InitColorConverter(BaseCodecParams *pInit);        bool                    DeleteTables();        bool                    InitTables();        MPEG2_VIRTUAL Status    DecodeBegin(double time, sVideoStreamInfo * info);        MPEG2_VIRTUAL Status    GetNextFrame(MediaData *input,MediaData *output);        MPEG2_VIRTUAL void      CalculateFrameTime(double in_time, double * out_time);        void                    ConvertSlice(unsigned int lSliceNum, int threadID);        void                    PrepareConvertFrame();        void                    FinalizeConvertFrame();        Status                  Macroblock_420_I_frame(int threadID);        Status                  Macroblock_420_frame(int threadID);        Status                  Macroblock_422(int threadID);        Status                  Macroblock_444(int threadID);        Status                  ReconstuctIntraFieldMB(int threadID);        Status                  Macroblock_420_I_field(int threadID);        Status                  Macroblock_420_P_field(int threadID);        Status                  Macroblock_420_B_field(int threadID);        Status                  Macroblock_420_DP(int threadID,                                                  int macroblock_type);        Status                  Macroblock_420_DP_field(int threadID,                                                        int macroblock_type);        Status                  mv_decode(int r,int s, int threadID);        Status                  mv_decode_dp(int threadID);        Status                  mv_decode_full_pel(int s, int threadID);        void                    skipped_macroblockP_frame(int threadID);        void                    skipped_macroblockP_field(int threadID);        void                    skipped_macroblockB_field(int threadID);        void                    skipped_macroblockB_frame(int threadID);        Status                  BlockInterLuma   (int coded_block_pattern,                                                  int offset, int pitch, int threadID);        Status                  BlockInterChroma (int coded_block_pattern,                                                  int offset, int pitch, int threadID);        void                    mc_mp2_420_field(short* diff, int threadID);        void                    mc_mp2_420b_frame(short* diff, int threadID);        void                    mc_mp2_420_frame_zero(int threadID);        void                    mc_mp2_420(short* diff, int threadID);        void                    mc_mp2_422(short* diff, int threadID);        void                    mc_mp2_444(short* diff, int threadID);        void                    mc_mp2_420b_frame_skip(short* diff, int threadID);        void                    mc_mp2_420_frame_skip(int threadID);        typedef Status (MPEG2VideoDecoderBase::*ptrBlockInter)(int offset, int pitch, int);        int blkOffsets[3][8];        int blkPitches[3][2];        short *pDC[3]; private:         void                   sequence_display_extension();         void                   sequence_scalable_extension();         void                   picture_temporal_scalable_extension();         void                   picture_spartial_scalable_extension();         void                   picture_display_extension();         void                   copyright_extension();         void                   quant_matrix_extension();         void                   ReadCCData();    };}#endif //__UMC_MPEG2_DEC_BASE_H

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -