summaryrefslogtreecommitdiff
path: root/libavcodec/ratecontrol.c
diff options
context:
space:
mode:
authorAurelien Jacobs <aurel@gnuage.org>2008-03-09 23:31:02 +0000
committerAurelien Jacobs <aurel@gnuage.org>2008-03-09 23:31:02 +0000
commit9701840bb539546bc0cfb1307b04655140851b04 (patch)
tree283d60d225a87c960c78d20975491802b3385797 /libavcodec/ratecontrol.c
parent88855b51cdba35c2e7daf8351645d91cf85cb8af (diff)
downloadffmpeg-9701840bb539546bc0cfb1307b04655140851b04.tar.gz
add FF_ prefix to all (frame)_TYPE usage
Originally committed as revision 12399 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/ratecontrol.c')
-rw-r--r--libavcodec/ratecontrol.c66
1 files changed, 33 insertions, 33 deletions
diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c
index d289a19cb6..509d33e2c2 100644
--- a/libavcodec/ratecontrol.c
+++ b/libavcodec/ratecontrol.c
@@ -144,7 +144,7 @@ int ff_rate_control_init(MpegEncContext *s)
/* init all to skipped p frames (with b frames we might have a not encoded frame at the end FIXME) */
for(i=0; i<rcc->num_entries; i++){
RateControlEntry *rce= &rcc->entry[i];
- rce->pict_type= rce->new_pict_type=P_TYPE;
+ rce->pict_type= rce->new_pict_type=FF_P_TYPE;
rce->qscale= rce->new_qscale=FF_QP2LAMBDA * 2;
rce->misc_bits= s->mb_num + 10;
rce->mb_var_sum= s->mb_num*100;
@@ -212,9 +212,9 @@ int ff_rate_control_init(MpegEncContext *s)
RateControlEntry rce;
double q;
- if (i%((s->gop_size+3)/4)==0) rce.pict_type= I_TYPE;
- else if(i%(s->max_b_frames+1)) rce.pict_type= B_TYPE;
- else rce.pict_type= P_TYPE;
+ if (i%((s->gop_size+3)/4)==0) rce.pict_type= FF_I_TYPE;
+ else if(i%(s->max_b_frames+1)) rce.pict_type= FF_B_TYPE;
+ else rce.pict_type= FF_P_TYPE;
rce.new_pict_type= rce.pict_type;
rce.mc_mb_var_sum= bits*s->mb_num/100000;
@@ -224,7 +224,7 @@ int ff_rate_control_init(MpegEncContext *s)
rce.b_code = 1;
rce.misc_bits= 1;
- if(s->pict_type== I_TYPE){
+ if(s->pict_type== FF_I_TYPE){
rce.i_count = s->mb_num;
rce.i_tex_bits= bits;
rce.p_tex_bits= 0;
@@ -320,23 +320,23 @@ static double get_qscale(MpegEncContext *s, RateControlEntry *rce, double rate_f
rce->p_tex_bits*rce->qscale,
(rce->i_tex_bits + rce->p_tex_bits)*(double)rce->qscale,
rce->mv_bits/mb_num,
- rce->pict_type == B_TYPE ? (rce->f_code + rce->b_code)*0.5 : rce->f_code,
+ rce->pict_type == FF_B_TYPE ? (rce->f_code + rce->b_code)*0.5 : rce->f_code,
rce->i_count/mb_num,
rce->mc_mb_var_sum/mb_num,
rce->mb_var_sum/mb_num,
- rce->pict_type == I_TYPE,
- rce->pict_type == P_TYPE,
- rce->pict_type == B_TYPE,
+ rce->pict_type == FF_I_TYPE,
+ rce->pict_type == FF_P_TYPE,
+ rce->pict_type == FF_B_TYPE,
rcc->qscale_sum[pict_type] / (double)rcc->frame_count[pict_type],
a->qcompress,
-/* rcc->last_qscale_for[I_TYPE],
- rcc->last_qscale_for[P_TYPE],
- rcc->last_qscale_for[B_TYPE],
+/* rcc->last_qscale_for[FF_I_TYPE],
+ rcc->last_qscale_for[FF_P_TYPE],
+ rcc->last_qscale_for[FF_B_TYPE],
rcc->next_non_b_qscale,*/
- rcc->i_cplx_sum[I_TYPE] / (double)rcc->frame_count[I_TYPE],
- rcc->i_cplx_sum[P_TYPE] / (double)rcc->frame_count[P_TYPE],
- rcc->p_cplx_sum[P_TYPE] / (double)rcc->frame_count[P_TYPE],
- rcc->p_cplx_sum[B_TYPE] / (double)rcc->frame_count[B_TYPE],
+ rcc->i_cplx_sum[FF_I_TYPE] / (double)rcc->frame_count[FF_I_TYPE],
+ rcc->i_cplx_sum[FF_P_TYPE] / (double)rcc->frame_count[FF_P_TYPE],
+ rcc->p_cplx_sum[FF_P_TYPE] / (double)rcc->frame_count[FF_P_TYPE],
+ rcc->p_cplx_sum[FF_B_TYPE] / (double)rcc->frame_count[FF_B_TYPE],
(rcc->i_cplx_sum[pict_type] + rcc->p_cplx_sum[pict_type]) / (double)rcc->frame_count[pict_type],
0
};
@@ -367,9 +367,9 @@ static double get_qscale(MpegEncContext *s, RateControlEntry *rce, double rate_f
q= bits2qp(rce, bits);
/* I/B difference */
- if (pict_type==I_TYPE && s->avctx->i_quant_factor<0.0)
+ if (pict_type==FF_I_TYPE && s->avctx->i_quant_factor<0.0)
q= -q*s->avctx->i_quant_factor + s->avctx->i_quant_offset;
- else if(pict_type==B_TYPE && s->avctx->b_quant_factor<0.0)
+ else if(pict_type==FF_B_TYPE && s->avctx->b_quant_factor<0.0)
q= -q*s->avctx->b_quant_factor + s->avctx->b_quant_offset;
if(q<1) q=1;
@@ -380,17 +380,17 @@ static double get_diff_limited_q(MpegEncContext *s, RateControlEntry *rce, doubl
RateControlContext *rcc= &s->rc_context;
AVCodecContext *a= s->avctx;
const int pict_type= rce->new_pict_type;
- const double last_p_q = rcc->last_qscale_for[P_TYPE];
+ const double last_p_q = rcc->last_qscale_for[FF_P_TYPE];
const double last_non_b_q= rcc->last_qscale_for[rcc->last_non_b_pict_type];
- if (pict_type==I_TYPE && (a->i_quant_factor>0.0 || rcc->last_non_b_pict_type==P_TYPE))
+ if (pict_type==FF_I_TYPE && (a->i_quant_factor>0.0 || rcc->last_non_b_pict_type==FF_P_TYPE))
q= last_p_q *FFABS(a->i_quant_factor) + a->i_quant_offset;
- else if(pict_type==B_TYPE && a->b_quant_factor>0.0)
+ else if(pict_type==FF_B_TYPE && a->b_quant_factor>0.0)
q= last_non_b_q* a->b_quant_factor + a->b_quant_offset;
if(q<1) q=1;
/* last qscale / qdiff stuff */
- if(rcc->last_non_b_pict_type==pict_type || pict_type!=I_TYPE){
+ if(rcc->last_non_b_pict_type==pict_type || pict_type!=FF_I_TYPE){
double last_q= rcc->last_qscale_for[pict_type];
const int maxdiff= FF_QP2LAMBDA * a->max_qdiff;
@@ -400,7 +400,7 @@ static double get_diff_limited_q(MpegEncContext *s, RateControlEntry *rce, doubl
rcc->last_qscale_for[pict_type]= q; //Note we cannot do that after blurring
- if(pict_type!=B_TYPE)
+ if(pict_type!=FF_B_TYPE)
rcc->last_non_b_pict_type= pict_type;
return q;
@@ -415,10 +415,10 @@ static void get_qminmax(int *qmin_ret, int *qmax_ret, MpegEncContext *s, int pic
assert(qmin <= qmax);
- if(pict_type==B_TYPE){
+ if(pict_type==FF_B_TYPE){
qmin= (int)(qmin*FFABS(s->avctx->b_quant_factor)+s->avctx->b_quant_offset + 0.5);
qmax= (int)(qmax*FFABS(s->avctx->b_quant_factor)+s->avctx->b_quant_offset + 0.5);
- }else if(pict_type==I_TYPE){
+ }else if(pict_type==FF_I_TYPE){
qmin= (int)(qmin*FFABS(s->avctx->i_quant_factor)+s->avctx->i_quant_offset + 0.5);
qmax= (int)(qmax*FFABS(s->avctx->i_quant_factor)+s->avctx->i_quant_offset + 0.5);
}
@@ -445,7 +445,7 @@ static double modify_qscale(MpegEncContext *s, RateControlEntry *rce, double q,
get_qminmax(&qmin, &qmax, s, pict_type);
/* modulation */
- if(s->avctx->rc_qmod_freq && frame_num%s->avctx->rc_qmod_freq==0 && pict_type==P_TYPE)
+ if(s->avctx->rc_qmod_freq && frame_num%s->avctx->rc_qmod_freq==0 && pict_type==FF_P_TYPE)
q*= s->avctx->rc_qmod_amp;
bits= qp2bits(rce, q);
@@ -689,7 +689,7 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run)
//printf("input_pic_num:%d pic_num:%d frame_rate:%d\n", s->input_picture_number, s->picture_number, s->frame_rate);
/* update predictors */
if(picture_number>2 && !dry_run){
- const int last_var= s->last_pict_type == I_TYPE ? rcc->last_mb_var_sum : rcc->last_mc_mb_var_sum;
+ const int last_var= s->last_pict_type == FF_I_TYPE ? rcc->last_mb_var_sum : rcc->last_mc_mb_var_sum;
update_predictor(&rcc->pred[s->last_pict_type], rcc->last_qscale, sqrt(last_var), s->frame_bits);
}
@@ -704,7 +704,7 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run)
//FIXME add a dts field to AVFrame and ensure its set and use it here instead of reordering
//but the reordering is simpler for now until h.264 b pyramid must be handeld
- if(s->pict_type == B_TYPE || s->low_delay)
+ if(s->pict_type == FF_B_TYPE || s->low_delay)
dts_pic= s->current_picture_ptr;
else
dts_pic= s->last_picture_ptr;
@@ -722,11 +722,11 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run)
br_compensation= (a->bit_rate_tolerance - diff)/a->bit_rate_tolerance;
if(br_compensation<=0.0) br_compensation=0.001;
- var= pict_type == I_TYPE ? pic->mb_var_sum : pic->mc_mb_var_sum;
+ var= pict_type == FF_I_TYPE ? pic->mb_var_sum : pic->mc_mb_var_sum;
short_term_q = 0; /* avoid warning */
if(s->flags&CODEC_FLAG_PASS2){
- if(pict_type!=I_TYPE)
+ if(pict_type!=FF_I_TYPE)
assert(pict_type == rce->new_pict_type);
q= rce->new_qscale / br_compensation;
@@ -742,7 +742,7 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run)
rce->misc_bits= 1;
bits= predict_size(&rcc->pred[pict_type], rce->qscale, sqrt(var));
- if(pict_type== I_TYPE){
+ if(pict_type== FF_I_TYPE){
rce->i_count = s->mb_num;
rce->i_tex_bits= bits;
rce->p_tex_bits= 0;
@@ -772,7 +772,7 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run)
//printf("%f ", q);
assert(q>0.0);
- if(pict_type==P_TYPE || s->intra_only){ //FIXME type dependent blur like in 2-pass
+ if(pict_type==FF_P_TYPE || s->intra_only){ //FIXME type dependent blur like in 2-pass
rcc->short_term_qsum*=a->qblur;
rcc->short_term_qcount*=a->qblur;
@@ -855,7 +855,7 @@ static int init_pass2(MpegEncContext *s)
complexity[rce->new_pict_type]+= (rce->i_tex_bits+ rce->p_tex_bits)*(double)rce->qscale;
const_bits[rce->new_pict_type]+= rce->mv_bits + rce->misc_bits;
}
- all_const_bits= const_bits[I_TYPE] + const_bits[P_TYPE] + const_bits[B_TYPE];
+ all_const_bits= const_bits[FF_I_TYPE] + const_bits[FF_P_TYPE] + const_bits[FF_B_TYPE];
if(all_available_bits < all_const_bits){
av_log(s->avctx, AV_LOG_ERROR, "requested bitrate is too low\n");