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

📄 umc_vc1_video_decoder.h

📁 audio-video-codecs.rar语音编解码器
💻 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) 2004-2007 Intel Corporation. All Rights Reserved.
//
*/
#include "umc_defs.h"

#if defined (UMC_ENABLE_VC1_VIDEO_DECODER)

#ifndef __UMC_VC1_VIDEO_DECODER_H_
#define __UMC_VC1_VIDEO_DECODER_H_

#include "umc_video_decoder.h"
#include "umc_vc1_dec_frame_descr.h"
#include "umc_vc1_dec_thread.h"
#include "umc_media_data_ex.h"
#include "umc_vc1_dec_skipping.h"


namespace UMC
{

    class VC1VideoDecoder : public VideoDecoder
    {
        friend class VC1TaskStore;
        friend class VC1ThreadDecoder;
      DYNAMIC_CAST_DECL(VC1VideoDecoder, VideoDecoder)
    public:
        // Default constructor
        VC1VideoDecoder();
        // Default destructor
        virtual ~VC1VideoDecoder();

        // Initialize for subsequent frame decoding.
        virtual Status Init(BaseCodecParams *init);

        // Get next frame
        virtual Status GetFrame(MediaData* in, MediaData* out);
        // Close  decoding & free all allocated resources
        virtual Status Close(void);

        // Reset decoder to initial state
        virtual Status   Reset(void);

        // Get video information, valid after initialization
        virtual Status GetInfo(BaseCodecParams* inInfo);

        Status GetPerformance(Ipp64f /**perf*/);

        //reset skip frame counter
        Status    ResetSkipCount();

        // increment skip frame counter
        Status    SkipVideoFrame(Ipp32s);

        // get skip frame counter statistic
        Ipp32u    GetNumOfSkippedFrames();

        // Perfomance tools. Improve speed or quality.
        //Accelarate Decoder (remove some features like deblockng, smoothing or change InvTransform and Quant)
        // speed_mode - return current mode

        // Change Decoding speed
        Status ChangeVideoDecodingSpeed(Ipp32s& speed_shift);
        // Set Decoding Speed.
        void SetVideoDecodingSpeed(VC1Skipping::SkippingMode SkipMode);



        // enable PostProcessing (despite if sequence header)
        void EnablePostProcessing(void);




        void StartAllThreadDecoders() {for ( Ipp32u i = 1;i < m_iThreadDecoderNum;i += 1) m_pdecoder[i]->StartProcessing();}



    protected:

        typedef enum
        {
            Routine,
            FreePostProc,
            MaxSpeed
        } PerformanceMode;

        Status CreateFrameBuffer();
        Status ResizeBuffer();

        void      SetReadFrameSize                     (MediaData* in);
        void      GetFrameSize                         (MediaData* in);
        void      GetPTS                               (Ipp64f in_pts);
        void      GetFPS();



        virtual Ipp32s    InitAlloc                   (VC1Context* pContext,
                                                       Ipp32u MaxFrameNum);

        void      FreeAlloc                           (VC1Context* pContext);

        virtual Status VC1DecodeFrame                 (VC1VideoDecoder* pDec,MediaData* in, VideoData* out_data);
        virtual Status VC1DecodeLastFrame             (VideoData* out_data);

        Status WriteFrame                             (MediaData* in_UpLeveldata,
                                                       VC1Context* pContext,
                                                       UMC::VideoData* out_data);

        // need to overload for correct H/W support
        Status ProcessPrevFrame               (MediaData* in, VideoData* out_data);

        Status GetStartCodes                          (MediaData* in,
                                                       MediaDataEx* out,
                                                       Ipp32u* readSize);

        Status  InitVAEnvironment               (Ipp32u frameSize);

        VC1Context*                m_pContext;
        VC1ThreadDecoder**         m_pdecoder;                              // (VC1ThreadDecoder *) pointer to array of thread decoders
        Ipp32u                     m_iThreadDecoderNum;                     // (Ipp32u) number of slice decoders
        Ipp8u*                     m_dataBuffer;                            //uses for swap data into decoder
        MediaDataEx*               m_frameData;                             //uses for swap data into decoder
        MediaDataEx::_MediaDataEx* m_stCodes;
        Ipp32u                     m_decoderInitFlag;
        Ipp32u                     m_decoderFlags;
        UMC::MemID                 m_pNewMemID;                             // frame memory
        Ipp64f                     m_pts;
        Ipp64f                     m_pts_dif;

        bool                       m_bIsWMPSplitter;
        Ipp32u                     m_iMaxFramesInProcessing;
        bool                       m_bIsFrameToOut;

        Ipp32s                     m_iRefFramesDst; // destination for reference frames
        Ipp32s                     m_iBFramesDst; // destination for B/BI frames
        VC1FrameDescriptor*        m_pPrevDescriptor;
        Ipp64u                     m_lFrameCount;
        bool                       m_bLastFrameNeedDisplay;
        bool                       m_bIsWarningStream;
        VC1VideoDecoder*           m_pSelfDecoder;
        VC1TaskStore*              m_pStore;
        VideoAccelerator*          m_va;
        PerformanceMode            m_CurrentMode;

#ifdef CREATE_ES
        FILE*                      m_fPureVideo;
#endif

#ifdef  VC1_THREAD_STATISTIC
        bool PrintParallelStatistic(Ipp32u frameCount,VC1Context* pContext);
        FILE* m_parallelStat;
        VC1ThreadEntry** m_eEntryArray;
#endif
    };


    class VC1VideoDecoderParams:public VideoDecoderParams
    {
        DYNAMIC_CAST_DECL(VC1VideoDecoderParams, VideoDecoderParams)

    public:
        Ipp8u* streamName;
        VC1VideoDecoderParams(){streamName =NULL;};
     };
}


#endif //__UMC_VC1_VIDEO_DECODER_H
#endif //UMC_ENABLE_VC1_VIDEO_DECODER

⌨️ 快捷键说明

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