?? ratecontrol.h
字號:
/*COPYRIGHT, LICENSE AND WARRANTY INFORMATIONThis software module has been originally developed by Nokia Corporation. Provided that a person, entity or a company willing to use the Software (hereinafter Licensee) comply with all the terms and conditions of this Statement and subject to the limitations set forth in this Statement Nokia grants to such Licensee a non-exclusive, sub-licensable, worldwide, limited license under copyrights owned by Nokia to use the Software for the sole purpose of creating, manufacturing, selling, marketing, or distributing (including the right to make modifications to the Software) a fully compliant decoder implementation (hereinafter "Decoder") of ITU-T Recommendation H.264 / ISO/IEC International Standard 14496-10 and an encoder implementation producing output that is decodable with the Decoder.Nokia retains the ownership of copyrights to the Software. There is no patent nor other intellectual property right of Nokia licensed under this Statement (except the copyright license above). Licensee hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if patent licenses are required, it is their responsibility to acquire the license before utilizing the Software.The license by Nokia is subject to that the Licensee grants to Nokia the non-exclusive, worldwide, royalty-free, perpetual and irrevocable covenant that the Licensee(s) shall not bring a suit before any court or administrative agency or otherwise assert a claim for infringement under the Licensee intellectual property rights that, but for a license, would be infringed by the Software against (a) Nokia or Nokia's Affiliate; or (b) other recipient of a license and covenant not to sue with respect to the Software from Nokia; or (c) contractor, customer or distributor of a party listed above in a or b, which suit or claim is related to the Software or use thereof.The Licensee(s) further agrees to grant a reciprocal license to Nokia (as granted by Nokia to the Licensee(s) on the modifications made by Licensee(s) to the Software. THE SOFTWARE IS PROVIDED "AS IS" AND THE ORIGINAL DEVELOPER DISCLAIMS ANY AND ALL WARRANTIES WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. THOSE INTENDING TO USE THE SOFTWARE ARE EXPRESSLY ADVISED THAT ITS USE MAY INFRINGE EXISTING PATENTS AND BE SUBJECT TO ROYALTY PAYMENTS TO PATENT OWNERS. ANYONE USING THE SOFTWARE ON THE BASIS OF THIS LICENSE AGREES TO OBTAIN THE NECESSARY PERMISSIONS FROM ANY AND ALL APPLICABLE PATENT OWNERS FOR SUCH USE.IN NO EVENT SHALL THE ORIGINAL DEVELOPER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.This copyright, license and warranty information notice must be retained in all copies and derivative works of the Software or substantial portions thereof.*/#ifndef _RATECONTROL_H_#define _RATECONTROL_H_#include <stdio.h>#include "encparams.h"#include "avcencoder.h"#include "parameterset.h"#include "sei.h"//#define RC_DEBUG // Debug file is used#define MAX_RD_WINDOW_SIZE 20 // Short term RD model window size#define MAX_LT_RD_WINDOW_SIZE 100 // Long term RD model window size//#define USE_SPP // Use High-Quality P Pictures (SPP) periodically#define SPP_PICTURE_FREQ 15 // The freq to use SPP pictures, Should be higher if GOP is used.#define SPP_QP_CHANGE 4 // QP Change in High Quality P Pictures#define STRICT_FILE_SIZE_CONTROL //#define ENABLE_REENCODE // For realtime operation disable this#define MIN(a,b) (((a)<(b)) ? (a) : (b))#define MAX(a,b) (((a)<(b)) ? (b) : (a)) typedef struct { //RD_Model Related Parameters float rdModel_QP[MAX_LT_RD_WINDOW_SIZE+1]; float rdModel_Qstep[MAX_RD_WINDOW_SIZE+1]; int rdModel_TextureBits[MAX_RD_WINDOW_SIZE+1]; int rdModel_HeaderBits[MAX_RD_WINDOW_SIZE+1]; float rdModel_PictureMAD[MAX_RD_WINDOW_SIZE+1]; int rdModel_Rejected[MAX_RD_WINDOW_SIZE+1]; float rdModel_X1; float rdModel_X2; int rdModel_windowSize; int frameSkipEnabled; int modeDecision; //Long Term Model float lt_rdModel_Qstep[MAX_LT_RD_WINDOW_SIZE+1]; int lt_rdModel_TextureBits[MAX_LT_RD_WINDOW_SIZE+1]; int lt_rdModel_HeaderBits[MAX_LT_RD_WINDOW_SIZE+1]; float lt_rdModel_PictureMAD[MAX_LT_RD_WINDOW_SIZE+1]; int lt_rdModel_Rejected[MAX_LT_RD_WINDOW_SIZE+1]; float lt_rdModel_X1; float lt_rdModel_X2; int lt_rdModel_windowSize; int BufferFullnessArray[MAX_LT_RD_WINDOW_SIZE]; float CurrentPicturePredictedMAD; float framePSNR[MAX_LT_RD_WINDOW_SIZE+1]; float currentFramePSNR ; int upperFrameLimit; int lowerFrameLimit; int centerFrameBits; int TotalFrameBits; int SPPPictureCounter; int SPPframeComputedQP; float averageQPforFrame; int TotalBits; int stat_NumberofSkips; int stat_NumberofReencodes; int TotalNumberofMB; int QP_LW; int QP_SW; int img_type; int numConsecutiveSkips; int frameComputedQP; int frameReturnedQP; int PictureIndex; int PPictureIndexinGOP; int GOPSize; int use_lt_RD_Model; int use_sh_RD_Model; int BufferSize; int CurrentBufferFullness; int TargetBufferLevel; int TargetTextureBits; int bit_rate; int frame_rate; int bitsPerFrame; int bitsPerPFrame; int bitDifference; int bufferStall; int playingStartFrame; int numFrms; int InitialQP; int scut; int useSEI; int numIntraMBs; int numNonref; int prevFrameBits; int currentFrameBits; int ignoreIDR; // A special case for video telephony. If enabled, the output bitrate will be slightly off the target // No buffer regulation is done for IDR pictures FILE* rcdebug; picture_timing_SEI_s picture_timing_SEI; buffering_period_SEI_s bufperiodSEI; int BIT_ADJUST_FREQUENCY; int BIT_ADJUST_WINDOW; int LT_WINDOW_QP_UPDATE_FREQ; int nalRefIdc; int srcPicNum; int numSkippedMBs ; int UPPER_LIMIT_MULTIPLE; int LOWER_LIMIT_MULTIPLE; int* prevFrame_MBsad; int* prevFrame_MBQp; int* prevFrame_MBtexbits; int* prevFrame_MBheaderbits; int* currentFrame_MBsad; int* currentFrame_MBQp; int* currentFrame_MBtexbits; int* currentFrame_MBheaderbits; int* MSEofMB; int lastQPUpdateID; int IFrameQP[10]; int IFrameBits[10]; int brcdisableMBLevel; int I_P_RATIO;} rateCtrl_s;void rc_init_seq(rateCtrl_s *pbRC, encParams_s *pencPar);void rc_init_pict(rateCtrl_s *pbRC, int img_type, int nalRefIdc,int srcPicNum);int rc_update_pict(rateCtrl_s *pbRC, int img_type, int texbits,int headerbits,float psnrY);int rc_getFrameQP(rateCtrl_s *pbRC, int img_type);void rc_update_bitrate(rateCtrl_s *pbRC, int bitrate);int rc_getMBQP(rateCtrl_s *pbRC, macroblock_s* pMb, int sliceType,int mbNum);void rc_updateMB(rateCtrl_s *pbRC, int texbits,int headerbits,macroblock_s *mb,int mbNum);void fillHRDParameters(rateCtrl_s *pbRC, hrd_parameters_s *hrd);void fillBufferingPeriodSEI(rateCtrl_s *pbRC);void fillPictureTimingSEI(rateCtrl_s *pbRC);void fillFillerPayloadSEI(rateCtrl_s *pbRC,int payloadSize);void rc_free_mem(rateCtrl_s *pbRC);void rc_printDebug(rateCtrl_s *pbRC,statSlice_s *frmStat);void mbkModeSelection(rateCtrl_s *pbRC, macroblock_s *mb, meProfile_s *pMeProf, refFrmBuf_s **refBufList, int nRefFrames, int picType, encParams_s *encPar, int *mapRIR, int *channelDistortion, int forcedIRNo, int *forcedIR, int mbNum);#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -