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

📄 umc_vc1_enc_bit_rate_control.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) 2007 Intel Corporation. All Rights Reserved.
//
//
//          VC-1 (VC1) encoder, bit rate control
//
*/

#include "umc_defs.h"

#if defined (UMC_ENABLE_VC1_VIDEO_ENCODER)

#ifndef _ENCODER_VC1_BITRATE_H_
#define _ENCODER_VC1_BITRATE_H_

#include "ippdefs.h"
#include "umc_vc1_enc_hrd.h"
#include "umc_vc1_enc_brc_gop.h"

namespace UMC_VC1_ENCODER
{

#define VC1_ENC_MAX_NUM_LEAKY_BUCKET 31 //0-31
#define VC1_ENC_LEAKY_BUCKET_NUM     1


#ifdef VC1_ENC_DEBUG_ON
  //#define BRC_TEST
#endif

#ifdef BRC_TEST
typedef struct
{
    FILE* RES_File;
} BRCTest;
#endif

typedef struct
{
    Ipp32s bitrate;
    Ipp64f framerate;
    Ipp32s constQuant;
}VC1BRInfo;

class VC1BitRateControl
{
    public:
        VC1BitRateControl();
        ~VC1BitRateControl();

    protected:

        Ipp32u m_bitrate;           //current bitrate
        Ipp64f m_framerate;         //current frame rate

        //GOP BRC
        VC1BRC*                     m_BRC;

        //hypothetical ref decoder
        VC1HRDecoder** m_HRD;
        Ipp32s m_LBucketNum;

        //Frames parameters
        Ipp32s m_currSize;         //last coded frame size

        //GOP parameters
        Ipp32s m_GOPLength;         //number of frame in GOP
        Ipp32s m_BFrLength;         //number of successive B frames

         //coding params
         Ipp32u m_encMode;        //coding mode

    public:
        UMC::Status Init(Ipp32u yuvFSize,  Ipp32u bitrate,
                         Ipp64f framerate, Ipp32u mode,
                         Ipp32u GOPLength, Ipp32u BFrLength, Ipp32u doubleQuant);

        UMC::Status InitBuffer(Ipp32s profile, Ipp32s level, Ipp32s BufferSize, Ipp32s initFull);

        void Reset();
        void Close();

        Ipp32s GetLevel(Ipp32u profile, Ipp32u bitrate, Ipp32u widthMB, Ipp32u heightMB);

        //get and prepare data for coding (all data compressed as needed (see standard))
        void GetAllHRDParams(VC1_HRD_PARAMS* param);
        UMC::Status GetCurrentHRDParams(Ipp32s HRDNum, VC1_hrd_OutData* hrdParams);

        //return number of coeffs witch will be reduce by zero
        //1 - intra block, 0 - inter block
        //Ipp32s CheckBlockQuality(Ipp16s* pSrc, Ipp32u srcStep,
        //                         Ipp32u quant, Ipp32u intra);
        UMC::Status CheckFrameCompression(Ipp32u picType, Ipp32u currSize);
        UMC::Status CompleteFrame(Ipp32u picType);
        UMC::Status HandleHRDResult(Ipp32s hrdStatus);

        //return recomended quant
        void GetQuant(Ipp32u picType, Ipp8u* PQuant, bool* Half);
        UMC::Status GetBRInfo(VC1BRInfo* pInfo);

        Ipp32s GetLBucketNum();
protected:

        Ipp32s GetHRD_Rate  (Ipp32s* rate);
        Ipp32s GetHRD_Buffer(Ipp32s* size);

#ifdef BRC_TEST
        BRCTest  BRCFileSizeTest;
#endif
};

}

#endif
#endif //defined (UMC_ENABLE_VC1_VIDEO_ENCODER)

⌨️ 快捷键说明

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