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

📄 encratecontrol.h

📁 freescale i.mx31 BSP CE5.0全部源码
💻 H
字号:
/*------------------------------------------------------------------------------
--                                                                            --
--       This software is confidential and proprietary and may be used        --
--        only as expressly authorized by a licensing agreement from          --
--                                                                            --
--                            Hantro Products Oy.                             --
--                                                                            --
--      In the event of publication, the following notice is applicable:      --
--                                                                            --
--                   (C) COPYRIGHT 2004 HANTRO PRODUCTS OY                    --
--                            ALL RIGHTS RESERVED                             --
--                                                                            --
--          The entire notice above must be reproduced on all copies.         --
--                                                                            --
--------------------------------------------------------------------------------
--
--  Description : Encoder internal
--
-------------------------------------------------------------------------------*/


/*------------------------------------------------------------------------------

    Table of context

    1. Include headers
    2. External compiler flags
    3. Module defines
    4. Function prototypes

------------------------------------------------------------------------------*/
#ifndef __ENC_RATE_CONTROL__
#define __ENC_RATE_CONTROL__

/*------------------------------------------------------------------------------
    1. Include headers
------------------------------------------------------------------------------*/
#include "basetype.h"
#include "EncSim.h"
#include "EncVideoObjectPlane.h"

/*------------------------------------------------------------------------------
    2. External compiler flags
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
    3. Module defines
------------------------------------------------------------------------------*/
#define	CHECK_POINT	10
#define CTRL_CNT	7

typedef struct {
	i32	wordError[CTRL_CNT];	/* Check point error bit */
	i32	qpChange[CTRL_CNT];	/* Check point qp difference */
	i32	wordCntTarget[CHECK_POINT];	/* Required bit count */
	i32	wordCntPrev[CHECK_POINT];	/* Real bit count */
	i32	checkPoint[CHECK_POINT];/* Chech point indicator */
} qpCtrl_s;

/* Cyclic intra refresh */
typedef struct {
	i32	cir;		/* Distance between two INTRA macroblock */
	i32	mbPerVop;	/* Number of macroblock per VOP */
	i32	mbCnt;
	i32	firstMbNum;
	i32	mbCntAsic;
	i32	seed;
	i32	period;
} cir_s;

/* Very accurate virtual buffer, ready to use. */
typedef struct {
	i32	bitPerSecond;	/* Input bit rate per second */
	i32	bitPerVop;	/* Bit per vop */
	true_e	setFirstVop;	/* Allow set first vop parameters */
	i32	vopTimeInc;	/* TimeInc since last coded Vop */
	i32	vopTimeIncRes;	/* Input frame rate numerator */
	i32	timeInc;	/* Input frame rate denominator */
	i32	virtualBitCnt;	/* Virtual (channel) bit count */
	i32	driftPerVop;	/* Bit drift per vop */
	i32	realBitCnt;	/* Real world bit usage */
	i32	bitAvailable;	/* Bit count of next vop */
	true_e	skipBuffFlush;	/* Skip buffer is in use */
	i32	skipBuffBit;	/* Skip limit buffer */
} virtualBuffer_s;

/* Video buffer verifier */
typedef struct {
	true_e	vbv;		/* Video buffer verifier is in use */
	true_e	underflow;	/* Next vop must be Intra */
	true_e	overflow;	/* Vbv overFlow, you just can't recover this */
	i32	stuffWordCnt;	/* Minimun bit per vop */
	i32	stuffBitCnt;	/* Added stuffing bits */
	i32	vopTimeInc;	/* Used timeInc beginnin of coded vop */
	i32	vopTimeIncRes;	/* Input frame rate numerator */
	i32	timeInc;	/* Current timeInc beginnin of previous vop */
	i32	bitPerSecond;	/* Bit rate */
	i32	bitPerVop;	/* Bit per vop */
	i32	videoBufferBitCnt;	/* Video buffer verifier bit count */
	i32	videoBufferSize;	/* Video buffer verifier size */
} vbv_s;

typedef struct {
	true_e	vopRc;		/* Vop header qp can vary, src. model rc */
	true_e	mbRc;		/* Mb header qp can vary, check point rc */
	true_e	vopSkip;	/* Vop Skip enable */

	i32	width;		/* Width of reference image */
	i32	height;		/* Height of reference image */

	i32	mbPerVop;	/* Number of macroblock per VOP */
	i32	coeffCnt;	/* Number of coeff per VOP */
	i32	srcPrm;		/* Source parameter */
	i32	scaler;		/* Zero cnt scaler, needed by source model */

	i32	zeroCnt;	/* Zero coefficient counter */
	i32	qpSum;		/* Qp sum counter */
	i32	bitCntLastVop;	/* Bit count of last coded vop */

	vopType_e vopTypeCur;	/* Vop type */
	vopType_e vopTypePrev;	/* Vop type */
	true_e	vopCoded;	/* Vop coded information */

	i32	qpHdr;		/* Vop header qp of current voded VOP */
	i32	qpHdrMin;	/* Vop header minimum qp, user set */
	i32	qpHdrMax;	/* Vop header maximum qp, user set */
	i32	qpHdrPrev[2];	/* Vop header qp of previous voded VOPs */

	qpCtrl_s qpCtrl;
	cir_s	cir;		/* Cyclic intra refresh */
	virtualBuffer_s virtualBuffer;
	vbv_s	videoBuffer;
} rateControl_s;

/*------------------------------------------------------------------------------
    4. Function prototypes
------------------------------------------------------------------------------*/
bool_e EncRcCheck(rateControl_s *rc);
void EncBeforeVopRc(rateControl_s *rc, i32 timeInc);
void EncAfterVopRc(rateControl_s *rc, i32 zeroCnt, i32 byteCnt);

#endif

⌨️ 快捷键说明

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