Mercurial > libavcodec.hg
annotate ratecontrol.h @ 3823:41ad23b61a2c libavcodec
Original Commit: r17 | ods15 | 2006-09-22 12:28:28 +0300 (Fri, 22 Sep 2006) | 2 lines
bug fixes in codebook header syntax
author | ods15 |
---|---|
date | Mon, 02 Oct 2006 05:55:43 +0000 |
parents | 730ad999e379 |
children | c8c591fe26f8 |
rev | line source |
---|---|
0 | 1 /* |
3789
730ad999e379
Move the ratecontrol related code from mpegvideo.h to a separate header file.
takis
parents:
3786
diff
changeset
|
2 * Ratecontrol |
429 | 3 * Copyright (c) 2000, 2001, 2002 Fabrice Bellard. |
1739
07a484280a82
copyright year update of the files i touched and remembered, things look annoyingly unmaintained otherwise
michael
parents:
1719
diff
changeset
|
4 * Copyright (c) 2002-2004 Michael Niedermayer |
0 | 5 * |
429 | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Lesser General Public | |
8 * License as published by the Free Software Foundation; either | |
9 * version 2 of the License, or (at your option) any later version. | |
0 | 10 * |
429 | 11 * This library is distributed in the hope that it will be useful, |
0 | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
429 | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 * Lesser General Public License for more details. | |
0 | 15 * |
429 | 16 * You should have received a copy of the GNU Lesser General Public |
17 * License along with this library; if not, write to the Free Software | |
3036
0b546eab515d
Update licensing information: The FSF changed postal address.
diego
parents:
2997
diff
changeset
|
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
0 | 19 */ |
20 | |
3789
730ad999e379
Move the ratecontrol related code from mpegvideo.h to a separate header file.
takis
parents:
3786
diff
changeset
|
21 #ifndef AVCODEC_RATECONTROL_H |
730ad999e379
Move the ratecontrol related code from mpegvideo.h to a separate header file.
takis
parents:
3786
diff
changeset
|
22 #define AVCODEC_RATECONTROL_H |
0 | 23 |
3789
730ad999e379
Move the ratecontrol related code from mpegvideo.h to a separate header file.
takis
parents:
3786
diff
changeset
|
24 /** |
730ad999e379
Move the ratecontrol related code from mpegvideo.h to a separate header file.
takis
parents:
3786
diff
changeset
|
25 * @file ratecontrol.h |
730ad999e379
Move the ratecontrol related code from mpegvideo.h to a separate header file.
takis
parents:
3786
diff
changeset
|
26 * ratecontrol header. |
730ad999e379
Move the ratecontrol related code from mpegvideo.h to a separate header file.
takis
parents:
3786
diff
changeset
|
27 */ |
3068 | 28 |
268 | 29 typedef struct Predictor{ |
30 double coeff; | |
31 double count; | |
32 double decay; | |
33 } Predictor; | |
34 | |
329 | 35 typedef struct RateControlEntry{ |
36 int pict_type; | |
690
a1c69cb685b3
adaptive quantization (lumi/temporal & spatial complexity masking)
michaelni
parents:
680
diff
changeset
|
37 float qscale; |
329 | 38 int mv_bits; |
39 int i_tex_bits; | |
40 int p_tex_bits; | |
41 int misc_bits; | |
3064 | 42 int header_bits; |
1064 | 43 uint64_t expected_bits; |
329 | 44 int new_pict_type; |
45 float new_qscale; | |
612 | 46 int mc_mb_var_sum; |
47 int mb_var_sum; | |
48 int i_count; | |
3064 | 49 int skip_count; |
612 | 50 int f_code; |
51 int b_code; | |
329 | 52 }RateControlEntry; |
53 | |
1110 | 54 /** |
55 * rate control context. | |
56 */ | |
329 | 57 typedef struct RateControlContext{ |
58 FILE *stats_file; | |
2967 | 59 int num_entries; ///< number of RateControlEntries |
329 | 60 RateControlEntry *entry; |
2967 | 61 double buffer_index; ///< amount of bits in the video/audio buffer |
612 | 62 Predictor pred[5]; |
2967 | 63 double short_term_qsum; ///< sum of recent qscales |
64 double short_term_qcount; ///< count of recent qscales | |
65 double pass1_rc_eq_output_sum;///< sum of the output of the rc equation, this is used for normalization | |
66 double pass1_wanted_bits; ///< bits which should have been outputed by the pass1 code (including complexity init) | |
612 | 67 double last_qscale; |
2967 | 68 double last_qscale_for[5]; ///< last qscale for a specific pict type, used for max_diff & ipb factor stuff |
612 | 69 int last_mc_mb_var_sum; |
70 int last_mb_var_sum; | |
1064 | 71 uint64_t i_cplx_sum[5]; |
72 uint64_t p_cplx_sum[5]; | |
73 uint64_t mv_bits_sum[5]; | |
74 uint64_t qscale_sum[5]; | |
612 | 75 int frame_count[5]; |
680 | 76 int last_non_b_pict_type; |
3064 | 77 |
78 void *non_lavc_opaque; ///< context for non lavc rc code (for example xvid) | |
79 float dry_run_qscale; ///< for xvid rc | |
3204 | 80 int last_picture_number; ///< for xvid rc |
329 | 81 }RateControlContext; |
82 | |
936 | 83 struct MpegEncContext; |
84 | |
3789
730ad999e379
Move the ratecontrol related code from mpegvideo.h to a separate header file.
takis
parents:
3786
diff
changeset
|
85 /* rate control */ |
730ad999e379
Move the ratecontrol related code from mpegvideo.h to a separate header file.
takis
parents:
3786
diff
changeset
|
86 int ff_rate_control_init(struct MpegEncContext *s); |
730ad999e379
Move the ratecontrol related code from mpegvideo.h to a separate header file.
takis
parents:
3786
diff
changeset
|
87 float ff_rate_estimate_qscale(struct MpegEncContext *s, int dry_run); |
730ad999e379
Move the ratecontrol related code from mpegvideo.h to a separate header file.
takis
parents:
3786
diff
changeset
|
88 void ff_write_pass1_stats(struct MpegEncContext *s); |
730ad999e379
Move the ratecontrol related code from mpegvideo.h to a separate header file.
takis
parents:
3786
diff
changeset
|
89 void ff_rate_control_uninit(struct MpegEncContext *s); |
730ad999e379
Move the ratecontrol related code from mpegvideo.h to a separate header file.
takis
parents:
3786
diff
changeset
|
90 int ff_vbv_update(struct MpegEncContext *s, int frame_size); |
730ad999e379
Move the ratecontrol related code from mpegvideo.h to a separate header file.
takis
parents:
3786
diff
changeset
|
91 void ff_get_2pass_fcode(struct MpegEncContext *s); |
2967 | 92 |
3789
730ad999e379
Move the ratecontrol related code from mpegvideo.h to a separate header file.
takis
parents:
3786
diff
changeset
|
93 int ff_xvid_rate_control_init(struct MpegEncContext *s); |
730ad999e379
Move the ratecontrol related code from mpegvideo.h to a separate header file.
takis
parents:
3786
diff
changeset
|
94 void ff_xvid_rate_control_uninit(struct MpegEncContext *s); |
730ad999e379
Move the ratecontrol related code from mpegvideo.h to a separate header file.
takis
parents:
3786
diff
changeset
|
95 float ff_xvid_rate_estimate_qscale(struct MpegEncContext *s, int dry_run); |
930 | 96 |
3789
730ad999e379
Move the ratecontrol related code from mpegvideo.h to a separate header file.
takis
parents:
3786
diff
changeset
|
97 #endif /* AVCODEC_RATECONTROL_H */ |
1652 | 98 |