Mercurial > libavcodec.hg
annotate ratecontrol.h @ 4816:ef2cf8f41c08 libavcodec
general purpose var should be int
author | michael |
---|---|
date | Sat, 07 Apr 2007 23:27:11 +0000 |
parents | 90e848a24c70 |
children | 4394344397d8 |
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 * |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3789
diff
changeset
|
6 * This file is part of FFmpeg. |
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3789
diff
changeset
|
7 * |
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3789
diff
changeset
|
8 * FFmpeg is free software; you can redistribute it and/or |
429 | 9 * modify it under the terms of the GNU Lesser General Public |
10 * License as published by the Free Software Foundation; either | |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3789
diff
changeset
|
11 * version 2.1 of the License, or (at your option) any later version. |
0 | 12 * |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3789
diff
changeset
|
13 * FFmpeg is distributed in the hope that it will be useful, |
0 | 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
429 | 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 * Lesser General Public License for more details. | |
0 | 17 * |
429 | 18 * You should have received a copy of the GNU Lesser General Public |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3789
diff
changeset
|
19 * License along with FFmpeg; if not, write to the Free Software |
3036
0b546eab515d
Update licensing information: The FSF changed postal address.
diego
parents:
2997
diff
changeset
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
0 | 21 */ |
22 | |
3789
730ad999e379
Move the ratecontrol related code from mpegvideo.h to a separate header file.
takis
parents:
3786
diff
changeset
|
23 #ifndef AVCODEC_RATECONTROL_H |
730ad999e379
Move the ratecontrol related code from mpegvideo.h to a separate header file.
takis
parents:
3786
diff
changeset
|
24 #define AVCODEC_RATECONTROL_H |
0 | 25 |
3789
730ad999e379
Move the ratecontrol related code from mpegvideo.h to a separate header file.
takis
parents:
3786
diff
changeset
|
26 /** |
730ad999e379
Move the ratecontrol related code from mpegvideo.h to a separate header file.
takis
parents:
3786
diff
changeset
|
27 * @file ratecontrol.h |
730ad999e379
Move the ratecontrol related code from mpegvideo.h to a separate header file.
takis
parents:
3786
diff
changeset
|
28 * ratecontrol header. |
730ad999e379
Move the ratecontrol related code from mpegvideo.h to a separate header file.
takis
parents:
3786
diff
changeset
|
29 */ |
3068 | 30 |
4084 | 31 #include "eval.h" |
32 | |
268 | 33 typedef struct Predictor{ |
34 double coeff; | |
35 double count; | |
36 double decay; | |
37 } Predictor; | |
38 | |
329 | 39 typedef struct RateControlEntry{ |
40 int pict_type; | |
690
a1c69cb685b3
adaptive quantization (lumi/temporal & spatial complexity masking)
michaelni
parents:
680
diff
changeset
|
41 float qscale; |
329 | 42 int mv_bits; |
43 int i_tex_bits; | |
44 int p_tex_bits; | |
45 int misc_bits; | |
3064 | 46 int header_bits; |
1064 | 47 uint64_t expected_bits; |
329 | 48 int new_pict_type; |
49 float new_qscale; | |
612 | 50 int mc_mb_var_sum; |
51 int mb_var_sum; | |
52 int i_count; | |
3064 | 53 int skip_count; |
612 | 54 int f_code; |
55 int b_code; | |
329 | 56 }RateControlEntry; |
57 | |
1110 | 58 /** |
59 * rate control context. | |
60 */ | |
329 | 61 typedef struct RateControlContext{ |
62 FILE *stats_file; | |
2967 | 63 int num_entries; ///< number of RateControlEntries |
329 | 64 RateControlEntry *entry; |
2967 | 65 double buffer_index; ///< amount of bits in the video/audio buffer |
612 | 66 Predictor pred[5]; |
2967 | 67 double short_term_qsum; ///< sum of recent qscales |
68 double short_term_qcount; ///< count of recent qscales | |
69 double pass1_rc_eq_output_sum;///< sum of the output of the rc equation, this is used for normalization | |
70 double pass1_wanted_bits; ///< bits which should have been outputed by the pass1 code (including complexity init) | |
612 | 71 double last_qscale; |
2967 | 72 double last_qscale_for[5]; ///< last qscale for a specific pict type, used for max_diff & ipb factor stuff |
612 | 73 int last_mc_mb_var_sum; |
74 int last_mb_var_sum; | |
1064 | 75 uint64_t i_cplx_sum[5]; |
76 uint64_t p_cplx_sum[5]; | |
77 uint64_t mv_bits_sum[5]; | |
78 uint64_t qscale_sum[5]; | |
612 | 79 int frame_count[5]; |
680 | 80 int last_non_b_pict_type; |
3064 | 81 |
82 void *non_lavc_opaque; ///< context for non lavc rc code (for example xvid) | |
83 float dry_run_qscale; ///< for xvid rc | |
3204 | 84 int last_picture_number; ///< for xvid rc |
4084 | 85 AVEvalExpr * rc_eq_eval; |
329 | 86 }RateControlContext; |
87 | |
936 | 88 struct MpegEncContext; |
89 | |
3789
730ad999e379
Move the ratecontrol related code from mpegvideo.h to a separate header file.
takis
parents:
3786
diff
changeset
|
90 /* rate control */ |
730ad999e379
Move the ratecontrol related code from mpegvideo.h to a separate header file.
takis
parents:
3786
diff
changeset
|
91 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
|
92 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
|
93 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
|
94 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
|
95 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
|
96 void ff_get_2pass_fcode(struct MpegEncContext *s); |
2967 | 97 |
3789
730ad999e379
Move the ratecontrol related code from mpegvideo.h to a separate header file.
takis
parents:
3786
diff
changeset
|
98 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
|
99 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
|
100 float ff_xvid_rate_estimate_qscale(struct MpegEncContext *s, int dry_run); |
930 | 101 |
3789
730ad999e379
Move the ratecontrol related code from mpegvideo.h to a separate header file.
takis
parents:
3786
diff
changeset
|
102 #endif /* AVCODEC_RATECONTROL_H */ |
1652 | 103 |