📄 rate_control.c
字号:
#include "global_declare.h"
//#include "encodemain.h"
#include "def_gary.h"
const int max_quant_IVOP = 12;
const int min_quant_IVOP = 2;
const int max_quant_PVOP = 12;
const int min_quant_PVOP = 2;
extern int bypass_dist;
void rate_control(int bits_diff)
{
//need to increase rate;
if(bits_diff < 0) {
if(bypass_dist>0) {
bypass_dist --;
return;
}
if(mQuantIVOP > min_quant_IVOP || mQuantPVOP > min_quant_PVOP) {
mQuantIVOP = (mQuantIVOP + min_quant_IVOP)>>1;
mQuantPVOP = (mQuantPVOP + min_quant_PVOP)>>1;
return;
}
// if(get_CurMB == get_CurMB_asm_prepro) {
// get_CurMB = get_CurMB_asm_no_pre;
// return;
// }
// if(get_MB == get_MB_dma_prepro) {
// get_MB = get_MB_dma_no_pre;
// get_MB_refwin = get_MB_refwin_dma_no_pre;
// MB_preprocess = MB_no_pre;
// return;
// }
if(restore_MB_get_MB_refwin == restore_MB_get_MB_refwin_prepro) {
restore_MB_get_MB_refwin = restore_MB_get_MB_refwin_no_pre;
MB_preprocess = MB_no_pre;
return;
}
/*
if(mIVOPdist > 1) {
mIVOPdist >>= 1;
return;
} */
}
//need to decrease rate;
if(bits_diff > 0) {
// if(get_CurMB == get_CurMB_asm_no_pre) {
// get_CurMB = get_CurMB_asm_prepro;
// return;
// }
// if(get_MB == get_MB_dma_no_pre) {
// get_MB = get_MB_dma_prepro;
// get_MB_refwin = get_MB_refwin_dma_prepro;
// MB_preprocess = MB_Gaus_filter;
// return;
// }
if(restore_MB_get_MB_refwin == restore_MB_get_MB_refwin_no_pre) {
restore_MB_get_MB_refwin = restore_MB_get_MB_refwin_prepro;
MB_preprocess = MB_Gaus_filter;
return;
}
/*
if(mIVOPdist < IVOP_DIST) {
// mIVOPdist = (mIVOPdist + 50 + 1)/2;
mIVOPdist = IVOP_DIST;
return;
}
*/
if(mQuantIVOP < max_quant_IVOP || mQuantPVOP < max_quant_PVOP) {
mQuantIVOP = (mQuantIVOP + max_quant_IVOP+1)>>1;
mQuantPVOP = (mQuantPVOP + max_quant_PVOP+1)>>1;
return;
}
if(bypass_dist < 23) {
bypass_dist ++;
return;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -