Mercurial > libavcodec.hg
comparison mpegvideo.h @ 612:c0005de2be59 libavcodec
new ratecontrol code
author | michaelni |
---|---|
date | Sun, 25 Aug 2002 21:19:50 +0000 |
parents | 98e39397636b |
children | 4f3d4a07d374 |
comparison
equal
deleted
inserted
replaced
611:3214d3f4519e | 612:c0005de2be59 |
---|---|
59 int p_tex_bits; | 59 int p_tex_bits; |
60 int misc_bits; | 60 int misc_bits; |
61 UINT64 expected_bits; | 61 UINT64 expected_bits; |
62 int new_pict_type; | 62 int new_pict_type; |
63 float new_qscale; | 63 float new_qscale; |
64 int mc_mb_var_sum; | |
65 int mb_var_sum; | |
66 int i_count; | |
67 int f_code; | |
68 int b_code; | |
64 }RateControlEntry; | 69 }RateControlEntry; |
65 | 70 |
66 typedef struct RateControlContext{ | 71 typedef struct RateControlContext{ |
67 FILE *stats_file; | 72 FILE *stats_file; |
68 int num_entries; | 73 int num_entries; /* number of RateControlEntries */ |
69 RateControlEntry *entry; | 74 RateControlEntry *entry; |
75 int buffer_index; /* amount of bits in the video/audio buffer */ | |
76 Predictor pred[5]; | |
77 double short_term_qsum; /* sum of recent qscales */ | |
78 double short_term_qcount; /* count of recent qscales */ | |
79 double pass1_bits; /* bits outputted by the pass1 code (including complexity init) */ | |
80 double pass1_wanted_bits; /* bits which should have been outputed by the pass1 code (including complexity init) */ | |
81 double last_qscale; | |
82 double last_qscale_for[5]; /* last qscale for a specific pict type */ | |
83 double next_non_b_qscale; | |
84 double next_p_qscale; | |
85 int last_mc_mb_var_sum; | |
86 int last_mb_var_sum; | |
87 UINT64 i_cplx_sum[5]; | |
88 UINT64 p_cplx_sum[5]; | |
89 UINT64 mv_bits_sum[5]; | |
90 UINT64 qscale_sum[5]; | |
91 int frame_count[5]; | |
70 }RateControlContext; | 92 }RateControlContext; |
71 | 93 |
72 typedef struct ReorderBuffer{ | 94 typedef struct ReorderBuffer{ |
73 UINT8 *picture[3]; | 95 UINT8 *picture[3]; |
74 int pict_type; | 96 int pict_type; |
105 int max_qdiff; /* max qscale difference between frames */ | 127 int max_qdiff; /* max qscale difference between frames */ |
106 int encoding; /* true if we are encoding (vs decoding) */ | 128 int encoding; /* true if we are encoding (vs decoding) */ |
107 int flags; /* AVCodecContext.flags (HQ, MV4, ...) */ | 129 int flags; /* AVCodecContext.flags (HQ, MV4, ...) */ |
108 int force_input_type;/* 0= no force, otherwise I_TYPE, P_TYPE, ... */ | 130 int force_input_type;/* 0= no force, otherwise I_TYPE, P_TYPE, ... */ |
109 int max_b_frames; /* max number of b-frames for encoding */ | 131 int max_b_frames; /* max number of b-frames for encoding */ |
110 float b_quant_factor;/* qscale factor between ips and b frames */ | |
111 float b_quant_offset;/* qscale offset between ips and b frames */ | |
112 int rc_strategy; | |
113 int b_frame_strategy; | 132 int b_frame_strategy; |
114 int luma_elim_threshold; | 133 int luma_elim_threshold; |
115 int chroma_elim_threshold; | 134 int chroma_elim_threshold; |
116 int strict_std_compliance; /* strictly follow the std (MPEG4, ...) */ | 135 int strict_std_compliance; /* strictly follow the std (MPEG4, ...) */ |
117 int workaround_bugs; /* workaround bugs in encoders which cannot be detected automatically */ | 136 int workaround_bugs; /* workaround bugs in encoders which cannot be detected automatically */ |
168 | 187 |
169 int input_qscale; /* qscale prior to reordering of frames */ | 188 int input_qscale; /* qscale prior to reordering of frames */ |
170 int input_pict_type; /* pict_type prior to reordering of frames */ | 189 int input_pict_type; /* pict_type prior to reordering of frames */ |
171 int force_type; /* 0= no force, otherwise I_TYPE, P_TYPE, ... */ | 190 int force_type; /* 0= no force, otherwise I_TYPE, P_TYPE, ... */ |
172 int qscale; /* QP */ | 191 int qscale; /* QP */ |
173 int last_non_b_qscale; /* QP of last non b frame used for b frame qscale*/ | |
174 int pict_type; /* I_TYPE, P_TYPE, B_TYPE, ... */ | 192 int pict_type; /* I_TYPE, P_TYPE, B_TYPE, ... */ |
193 int last_pict_type; | |
175 int last_non_b_pict_type; /* used for mpeg4 gmc b-frames & ratecontrol */ | 194 int last_non_b_pict_type; /* used for mpeg4 gmc b-frames & ratecontrol */ |
176 int frame_rate_index; | 195 int frame_rate_index; |
177 /* motion compensation */ | 196 /* motion compensation */ |
178 int unrestricted_mv; | 197 int unrestricted_mv; |
179 int h263_long_vectors; /* use horrible h263v1 long vector mode */ | 198 int h263_long_vectors; /* use horrible h263v1 long vector mode */ |
269 | 288 |
270 /* bit rate control */ | 289 /* bit rate control */ |
271 int I_frame_bits; //FIXME used in mpeg12 ... | 290 int I_frame_bits; //FIXME used in mpeg12 ... |
272 int mb_var_sum; /* sum of MB variance for current frame */ | 291 int mb_var_sum; /* sum of MB variance for current frame */ |
273 int mc_mb_var_sum; /* motion compensated MB variance for current frame */ | 292 int mc_mb_var_sum; /* motion compensated MB variance for current frame */ |
274 int last_non_b_mc_mb_var;/* motion compensated MB variance for last non b frame */ | |
275 INT64 wanted_bits; | 293 INT64 wanted_bits; |
276 INT64 total_bits; | 294 INT64 total_bits; |
277 int frame_bits; /* bits used for the current frame */ | 295 int frame_bits; /* bits used for the current frame */ |
278 int pb_frame_bits; /* bits of the last b...bp group */ | 296 RateControlContext rc_context; // contains stuff only accessed in ratecontrol.c |
279 Predictor i_pred; | |
280 Predictor p_pred; | |
281 double qsum; /* sum of qscales */ | |
282 double qcount; /* count of qscales */ | |
283 double short_term_qsum; /* sum of recent qscales */ | |
284 double short_term_qcount; /* count of recent qscales */ | |
285 RateControlContext rc_context; | |
286 | 297 |
287 /* statistics, used for 2-pass encoding */ | 298 /* statistics, used for 2-pass encoding */ |
288 int mv_bits; | 299 int mv_bits; |
289 int header_bits; | 300 int header_bits; |
290 int i_tex_bits; | 301 int i_tex_bits; |
588 int ff_rate_control_init(MpegEncContext *s); | 599 int ff_rate_control_init(MpegEncContext *s); |
589 int ff_rate_estimate_qscale(MpegEncContext *s); | 600 int ff_rate_estimate_qscale(MpegEncContext *s); |
590 int ff_rate_estimate_qscale_pass2(MpegEncContext *s); | 601 int ff_rate_estimate_qscale_pass2(MpegEncContext *s); |
591 void ff_write_pass1_stats(MpegEncContext *s); | 602 void ff_write_pass1_stats(MpegEncContext *s); |
592 void ff_rate_control_uninit(MpegEncContext *s); | 603 void ff_rate_control_uninit(MpegEncContext *s); |
604 double ff_eval(char *s, double *const_value, char **const_name, | |
605 double (**func1)(void *, double), char **func1_name, | |
606 double (**func2)(void *, double, double), char **func2_name, | |
607 void *opaque); | |
608 | |
593 | 609 |
594 #endif /* AVCODEC_MPEGVIDEO_H */ | 610 #endif /* AVCODEC_MPEGVIDEO_H */ |