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

📄 ratectl.h

📁 This rar file contains the source code for inplementing H264 encoder on a DSP 64xx processor
💻 H
字号:
/**********************************************************************
 * Software Copyright Licensing Disclaimer
 *
 * This software module was originally developed by contributors to the
 * course of the development of ISO/IEC 14496-10 for reference purposes
 * and its performance may not have been optimized.  This software
 * module is an implementation of one or more tools as specified by
 * ISO/IEC 14496-10.  ISO/IEC gives users free license to this software
 * module or modifications thereof. Those intending to use this software
 * module in products are advised that its use may infringe existing
 * patents.  ISO/IEC have no liability for use of this software module
 * or modifications thereof.  The original contributors retain full
 * rights to modify and use the code for their own purposes, and to
 * assign or donate the code to third-parties.
 *
 * This copyright notice must be included in all copies or derivative
 * works.  Copyright (c) ISO/IEC 2004.
 **********************************************************************/
/*
***********************************************************************
* COPYRIGHT AND WARRANTY INFORMATION
*
* Copyright 2001, International Telecommunications Union, Geneva
*
* DISCLAIMER OF WARRANTY
*
* These software programs are available to the user without any
* license fee or royalty on an "as is" basis. The ITU disclaims
* any and all warranties, whether express, implied, or
* statutory, including any implied warranties of merchantability
* or of fitness for a particular purpose.  In no event shall the
* contributor or the ITU be liable for any incidental, punitive, or
* consequential damages of any kind whatsoever arising from the
* use of these programs.
*
* This disclaimer of warranty extends to the user of these programs
* and user's customers, employees, agents, transferees, successors,
* and assigns.
*
* The ITU does not represent or warrant that the programs furnished
* hereunder are free of infringement of any third-party patents.
* Commercial implementations of ITU-T Recommendations, including
* shareware, may be subject to royalty fees to patent holders.
* Information regarding the ITU-T patent policy is available from
* the ITU Web site at http://www.itu.int.
*
* THIS IS NOT A GRANT OF PATENT RIGHTS - SEE THE ITU-T PATENT POLICY.
************************************************************************
*/

/*!
 ***************************************************************************
 * \file
 *    ratectl.h
 *
 * \author
 *    Zhengguo LI
 *
 * \date
 *    14 Jan 2003
 *
 * \brief
 *    Headerfile for rate control 
 **************************************************************************
 */
#ifndef _RATE_CTL_H_
#define _RATE_CTL_H_

#ifdef _TMS320C6X
#define EXTERN extern
#else
#define EXTERN
#endif

#define MIN(a,b)  (((a)<(b)) ? (a) : (b))//LIZG 28/10/2002
#define MAX(a,b)  (((a)<(b)) ? (b) : (a))//LIZG 28/10/2002

EXTERN double bit_rate; 
EXTERN double frame_rate;
EXTERN double GAMMAP;//LIZG, JVT019r1
EXTERN double BETAP;//LIZG, JVT019r1

EXTERN int RC_MAX_QUANT;//LIZG 28/10/2002
EXTERN int RC_MIN_QUANT;//LIZG 28/10/2002

EXTERN double BufferSize; //LIZG 25/10/2002
EXTERN double GOPTargetBufferLevel;
EXTERN double CurrentBufferFullness; //LIZG 25/10/2002
EXTERN double TargetBufferLevel;//LIZG 25/10/2002
EXTERN double PreviousBit_Rate;//LIZG  25/10/2002
EXTERN double AWp;
EXTERN double AWb;
EXTERN int MyInitialQp;
EXTERN int PAverageQp;

/*LIZG JVT50V2 distortion prediction model*/
/*coefficients of the prediction model*/
EXTERN double PreviousPictureMAD;
EXTERN double MADPictureC1;
EXTERN double MADPictureC2;
EXTERN double PMADPictureC1;
EXTERN double PMADPictureC2;
/* LIZG JVT50V2 picture layer MAD */
EXTERN Boolean PictureRejected[21];
EXTERN double PPictureMAD[21];
EXTERN double PictureMAD[21];
EXTERN double ReferenceMAD[21];

/*quadratic rate-distortion model*/
EXTERN Boolean   m_rgRejected[21];
EXTERN double  m_rgQp[21];
EXTERN double m_rgRp[21];
EXTERN double m_X1;
EXTERN double m_X2;
EXTERN int m_Qc;
EXTERN double m_Qstep;
EXTERN int m_Qp;
EXTERN int Pm_Qp;
EXTERN int PreAveMBHeader;
EXTERN int CurAveMBHeader;
EXTERN int PPreHeader;
EXTERN int PreviousQp1;
EXTERN int PreviousQp2;
EXTERN int NumberofBFrames;
/*basic unit layer rate control*/
EXTERN int TotalFrameQP;
EXTERN int NumberofBasicUnit;
EXTERN int PAveHeaderBits1;
EXTERN int PAveHeaderBits2;
EXTERN int PAveHeaderBits3;
EXTERN int PAveFrameQP;
EXTERN int TotalNumberofBasicUnit;
EXTERN int CodedBasicUnit;
EXTERN double MINVALUE;
EXTERN double CurrentFrameMAD;
EXTERN double CurrentBUMAD;
EXTERN double TotalBUMAD;
EXTERN double PreviousFrameMAD;
EXTERN int m_Hp;
EXTERN int m_windowSize;
EXTERN int MADm_windowSize;
EXTERN int DDquant;
EXTERN int MBPerRow;
EXTERN double AverageMADPreviousFrame;
EXTERN int TotalBasicUnitBits;
EXTERN int QPLastPFrame;
EXTERN int QPLastGOP;
//int MADn_windowSize;
//int n_windowSize;

EXTERN double Pm_rgQp[20];
EXTERN double Pm_rgRp[20];
EXTERN double Pm_X1;
EXTERN double Pm_X2;
EXTERN int Pm_Hp;
/* adaptive field/frame coding*/
EXTERN int FieldQPBuffer;
EXTERN int FrameQPBuffer;
EXTERN int FrameAveHeaderBits;
EXTERN int FieldAveHeaderBits;
EXTERN double BUPFMAD[6336];//LIZG
EXTERN double BUCFMAD[6336];//LIZG
EXTERN double FCBUCFMAD[6336];
EXTERN double FCBUPFMAD[6336];

EXTERN Boolean GOPOverdue;


//comput macroblock activity for rate control
EXTERN int diffy[16][16];
EXTERN int diffyy[16][16];
EXTERN int diffy8[16][16];//for P8X8 mode 

extern int Iprev_bits;
extern int Pprev_bits;

void rc_init_seq();
void rc_init_GOP(int np, int nb);
void rc_update_pict_frame(int nbits);
void rc_init_pict(int fieldpic,int topfield, int targetcomputation);
void rc_update_pict(int nbits);
void setbitscount(int nbits);

int updateQuantizationParameter(int topfield);/*LIZG*/
void updateRCModel ();/*LIZG*/
void updateMADModel ();/*LIZG*/
Boolean skipThisFrame (); /*LIZG*/
void RCModelEstimator (int n_windowSize);/*LIZG*/
void MADModelEstimator (int n_windowSize);/*LIZG*/
double calc_MAD();/*LIZG*/
double ComputeFrameMAD();
int Qstep2QP( double Qstep );
double QP2Qstep( int QP );

#endif

⌨️ 快捷键说明

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