aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/ratecontrol.c
diff options
context:
space:
mode:
authorStefano Sabatini <stefano.sabatini-lala@poste.it>2011-04-29 18:53:57 +0200
committerDiego Biurrun <diego@biurrun.de>2011-05-02 12:18:44 +0200
commit975a1447f76e8d30fc01e6ea5466c84faf3d76e4 (patch)
treed462ee5cc7a2f59c44f797c97fc237c999c94e55 /libavcodec/ratecontrol.c
parent6209669de4a0aa056ae05b0a2c78eaf2ca489b23 (diff)
downloadffmpeg-975a1447f76e8d30fc01e6ea5466c84faf3d76e4.tar.gz
Replace deprecated FF_*_TYPE symbols with AV_PICTURE_TYPE_*.
Signed-off-by: Diego Biurrun <diego@biurrun.de>
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 196ba18de9..0d7b995476 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=FF_P_TYPE;
+ rce->pict_type= rce->new_pict_type=AV_PICTURE_TYPE_P;
rce->qscale= rce->new_qscale=FF_QP2LAMBDA * 2;
rce->misc_bits= s->mb_num + 10;
rce->mb_var_sum= s->mb_num*100;
@@ -211,9 +211,9 @@ int ff_rate_control_init(MpegEncContext *s)
double bits= s->avctx->rc_initial_cplx * (i/10000.0 + 1.0)*s->mb_num;
RateControlEntry rce;
- 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;
+ if (i%((s->gop_size+3)/4)==0) rce.pict_type= AV_PICTURE_TYPE_I;
+ else if(i%(s->max_b_frames+1)) rce.pict_type= AV_PICTURE_TYPE_B;
+ else rce.pict_type= AV_PICTURE_TYPE_P;
rce.new_pict_type= rce.pict_type;
rce.mc_mb_var_sum= bits*s->mb_num/100000;
@@ -223,7 +223,7 @@ int ff_rate_control_init(MpegEncContext *s)
rce.b_code = 1;
rce.misc_bits= 1;
- if(s->pict_type== FF_I_TYPE){
+ if(s->pict_type== AV_PICTURE_TYPE_I){
rce.i_count = s->mb_num;
rce.i_tex_bits= bits;
rce.p_tex_bits= 0;
@@ -317,23 +317,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 == FF_B_TYPE ? (rce->f_code + rce->b_code)*0.5 : rce->f_code,
+ rce->pict_type == AV_PICTURE_TYPE_B ? (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 == FF_I_TYPE,
- rce->pict_type == FF_P_TYPE,
- rce->pict_type == FF_B_TYPE,
+ rce->pict_type == AV_PICTURE_TYPE_I,
+ rce->pict_type == AV_PICTURE_TYPE_P,
+ rce->pict_type == AV_PICTURE_TYPE_B,
rcc->qscale_sum[pict_type] / (double)rcc->frame_count[pict_type],
a->qcompress,
-/* rcc->last_qscale_for[FF_I_TYPE],
- rcc->last_qscale_for[FF_P_TYPE],
- rcc->last_qscale_for[FF_B_TYPE],
+/* rcc->last_qscale_for[AV_PICTURE_TYPE_I],
+ rcc->last_qscale_for[AV_PICTURE_TYPE_P],
+ rcc->last_qscale_for[AV_PICTURE_TYPE_B],
rcc->next_non_b_qscale,*/
- 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[AV_PICTURE_TYPE_I] / (double)rcc->frame_count[AV_PICTURE_TYPE_I],
+ rcc->i_cplx_sum[AV_PICTURE_TYPE_P] / (double)rcc->frame_count[AV_PICTURE_TYPE_P],
+ rcc->p_cplx_sum[AV_PICTURE_TYPE_P] / (double)rcc->frame_count[AV_PICTURE_TYPE_P],
+ rcc->p_cplx_sum[AV_PICTURE_TYPE_B] / (double)rcc->frame_count[AV_PICTURE_TYPE_B],
(rcc->i_cplx_sum[pict_type] + rcc->p_cplx_sum[pict_type]) / (double)rcc->frame_count[pict_type],
0
};
@@ -364,9 +364,9 @@ static double get_qscale(MpegEncContext *s, RateControlEntry *rce, double rate_f
q= bits2qp(rce, bits);
/* I/B difference */
- if (pict_type==FF_I_TYPE && s->avctx->i_quant_factor<0.0)
+ if (pict_type==AV_PICTURE_TYPE_I && s->avctx->i_quant_factor<0.0)
q= -q*s->avctx->i_quant_factor + s->avctx->i_quant_offset;
- else if(pict_type==FF_B_TYPE && s->avctx->b_quant_factor<0.0)
+ else if(pict_type==AV_PICTURE_TYPE_B && s->avctx->b_quant_factor<0.0)
q= -q*s->avctx->b_quant_factor + s->avctx->b_quant_offset;
if(q<1) q=1;
@@ -377,17 +377,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[FF_P_TYPE];
+ const double last_p_q = rcc->last_qscale_for[AV_PICTURE_TYPE_P];
const double last_non_b_q= rcc->last_qscale_for[rcc->last_non_b_pict_type];
- if (pict_type==FF_I_TYPE && (a->i_quant_factor>0.0 || rcc->last_non_b_pict_type==FF_P_TYPE))
+ if (pict_type==AV_PICTURE_TYPE_I && (a->i_quant_factor>0.0 || rcc->last_non_b_pict_type==AV_PICTURE_TYPE_P))
q= last_p_q *FFABS(a->i_quant_factor) + a->i_quant_offset;
- else if(pict_type==FF_B_TYPE && a->b_quant_factor>0.0)
+ else if(pict_type==AV_PICTURE_TYPE_B && 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!=FF_I_TYPE){
+ if(rcc->last_non_b_pict_type==pict_type || pict_type!=AV_PICTURE_TYPE_I){
double last_q= rcc->last_qscale_for[pict_type];
const int maxdiff= FF_QP2LAMBDA * a->max_qdiff;
@@ -397,7 +397,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!=FF_B_TYPE)
+ if(pict_type!=AV_PICTURE_TYPE_B)
rcc->last_non_b_pict_type= pict_type;
return q;
@@ -412,10 +412,10 @@ static void get_qminmax(int *qmin_ret, int *qmax_ret, MpegEncContext *s, int pic
assert(qmin <= qmax);
- if(pict_type==FF_B_TYPE){
+ if(pict_type==AV_PICTURE_TYPE_B){
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==FF_I_TYPE){
+ }else if(pict_type==AV_PICTURE_TYPE_I){
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);
}
@@ -441,7 +441,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==FF_P_TYPE)
+ if(s->avctx->rc_qmod_freq && frame_num%s->avctx->rc_qmod_freq==0 && pict_type==AV_PICTURE_TYPE_P)
q*= s->avctx->rc_qmod_amp;
//printf("q:%f\n", q);
@@ -684,7 +684,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 == FF_I_TYPE ? rcc->last_mb_var_sum : rcc->last_mc_mb_var_sum;
+ const int last_var= s->last_pict_type == AV_PICTURE_TYPE_I ? 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);
}
@@ -699,7 +699,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 == FF_B_TYPE || s->low_delay)
+ if(s->pict_type == AV_PICTURE_TYPE_B || s->low_delay)
dts_pic= s->current_picture_ptr;
else
dts_pic= s->last_picture_ptr;
@@ -717,11 +717,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 == FF_I_TYPE ? pic->mb_var_sum : pic->mc_mb_var_sum;
+ var= pict_type == AV_PICTURE_TYPE_I ? pic->mb_var_sum : pic->mc_mb_var_sum;
short_term_q = 0; /* avoid warning */
if(s->flags&CODEC_FLAG_PASS2){
- if(pict_type!=FF_I_TYPE)
+ if(pict_type!=AV_PICTURE_TYPE_I)
assert(pict_type == rce->new_pict_type);
q= rce->new_qscale / br_compensation;
@@ -737,7 +737,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== FF_I_TYPE){
+ if(pict_type== AV_PICTURE_TYPE_I){
rce->i_count = s->mb_num;
rce->i_tex_bits= bits;
rce->p_tex_bits= 0;
@@ -767,7 +767,7 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run)
//printf("%f ", q);
assert(q>0.0);
- if(pict_type==FF_P_TYPE || s->intra_only){ //FIXME type dependent blur like in 2-pass
+ if(pict_type==AV_PICTURE_TYPE_P || s->intra_only){ //FIXME type dependent blur like in 2-pass
rcc->short_term_qsum*=a->qblur;
rcc->short_term_qcount*=a->qblur;
@@ -842,7 +842,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[FF_I_TYPE] + const_bits[FF_P_TYPE] + const_bits[FF_B_TYPE];
+ all_const_bits= const_bits[AV_PICTURE_TYPE_I] + const_bits[AV_PICTURE_TYPE_P] + const_bits[AV_PICTURE_TYPE_B];
if(all_available_bits < all_const_bits){
av_log(s->avctx, AV_LOG_ERROR, "requested bitrate is too low\n");