OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 // Bits Per MB at different Q (Multiplied by 512) | 23 // Bits Per MB at different Q (Multiplied by 512) |
24 #define BPER_MB_NORMBITS 9 | 24 #define BPER_MB_NORMBITS 9 |
25 | 25 |
26 typedef struct { | 26 typedef struct { |
27 // Rate targetting variables | 27 // Rate targetting variables |
28 int base_frame_target; // A baseline frame target before adjustment | 28 int base_frame_target; // A baseline frame target before adjustment |
29 // for previous under or over shoot. | 29 // for previous under or over shoot. |
30 int this_frame_target; // Actual frame target after rc adjustment. | 30 int this_frame_target; // Actual frame target after rc adjustment. |
31 int projected_frame_size; | 31 int projected_frame_size; |
32 int sb64_target_rate; | 32 int sb64_target_rate; |
33 int last_q[3]; // Separate values for Intra/Inter/ARF-GF | 33 int last_q[FRAME_TYPES]; // Separate values for Intra/Inter |
34 int last_boosted_qindex; // Last boosted GF/KF/ARF q | 34 int last_boosted_qindex; // Last boosted GF/KF/ARF q |
35 | 35 |
36 int gfu_boost; | 36 int gfu_boost; |
37 int last_boost; | 37 int last_boost; |
38 int kf_boost; | 38 int kf_boost; |
39 | 39 |
40 double rate_correction_factor; | 40 double rate_correction_factor; |
41 double key_frame_rate_correction_factor; | 41 double key_frame_rate_correction_factor; |
42 double gf_rate_correction_factor; | 42 double gf_rate_correction_factor; |
43 | 43 |
(...skipping 10 matching lines...) Expand all Loading... |
54 int source_alt_ref_active; | 54 int source_alt_ref_active; |
55 int is_src_frame_alt_ref; | 55 int is_src_frame_alt_ref; |
56 | 56 |
57 int avg_frame_bandwidth; // Average frame size target for clip | 57 int avg_frame_bandwidth; // Average frame size target for clip |
58 int min_frame_bandwidth; // Minimum allocation used for any frame | 58 int min_frame_bandwidth; // Minimum allocation used for any frame |
59 int max_frame_bandwidth; // Maximum burst rate allowed for a frame. | 59 int max_frame_bandwidth; // Maximum burst rate allowed for a frame. |
60 | 60 |
61 int ni_av_qi; | 61 int ni_av_qi; |
62 int ni_tot_qi; | 62 int ni_tot_qi; |
63 int ni_frames; | 63 int ni_frames; |
64 int avg_frame_qindex[3]; // 0 - KEY, 1 - INTER, 2 - ARF/GF | 64 int avg_frame_qindex[FRAME_TYPES]; |
65 double tot_q; | 65 double tot_q; |
66 double avg_q; | 66 double avg_q; |
67 | 67 |
68 int64_t buffer_level; | 68 int64_t buffer_level; |
69 int64_t bits_off_target; | 69 int64_t bits_off_target; |
70 int64_t vbr_bits_off_target; | 70 int64_t vbr_bits_off_target; |
71 | 71 |
72 int decimation_factor; | 72 int decimation_factor; |
73 int decimation_count; | 73 int decimation_count; |
74 | 74 |
75 int rolling_target_bits; | 75 int rolling_target_bits; |
76 int rolling_actual_bits; | 76 int rolling_actual_bits; |
77 | 77 |
78 int long_rolling_target_bits; | 78 int long_rolling_target_bits; |
79 int long_rolling_actual_bits; | 79 int long_rolling_actual_bits; |
80 | 80 |
81 int64_t total_actual_bits; | 81 int64_t total_actual_bits; |
82 int64_t total_target_bits; | 82 int64_t total_target_bits; |
83 int64_t total_target_vs_actual; | 83 int64_t total_target_vs_actual; |
84 | 84 |
85 int worst_quality; | 85 int worst_quality; |
86 int best_quality; | 86 int best_quality; |
| 87 |
| 88 int64_t starting_buffer_level; |
| 89 int64_t optimal_buffer_level; |
| 90 int64_t maximum_buffer_size; |
87 // int active_best_quality; | 91 // int active_best_quality; |
88 } RATE_CONTROL; | 92 } RATE_CONTROL; |
89 | 93 |
90 struct VP9_COMP; | 94 struct VP9_COMP; |
91 struct VP9EncoderConfig; | 95 struct VP9EncoderConfig; |
92 | 96 |
93 void vp9_rc_init(const struct VP9EncoderConfig *oxcf, int pass, | 97 void vp9_rc_init(const struct VP9EncoderConfig *oxcf, int pass, |
94 RATE_CONTROL *rc); | 98 RATE_CONTROL *rc); |
95 | 99 |
96 double vp9_convert_qindex_to_q(int qindex); | 100 double vp9_convert_qindex_to_q(int qindex); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 // to a target q value | 175 // to a target q value |
172 int vp9_compute_qdelta(const RATE_CONTROL *rc, double qstart, double qtarget); | 176 int vp9_compute_qdelta(const RATE_CONTROL *rc, double qstart, double qtarget); |
173 | 177 |
174 // Computes a q delta (in "q index" terms) to get from a starting q value | 178 // Computes a q delta (in "q index" terms) to get from a starting q value |
175 // to a value that should equate to the given rate ratio. | 179 // to a value that should equate to the given rate ratio. |
176 int vp9_compute_qdelta_by_rate(const RATE_CONTROL *rc, FRAME_TYPE frame_type, | 180 int vp9_compute_qdelta_by_rate(const RATE_CONTROL *rc, FRAME_TYPE frame_type, |
177 int qindex, double rate_target_ratio); | 181 int qindex, double rate_target_ratio); |
178 | 182 |
179 void vp9_rc_update_framerate(struct VP9_COMP *cpi); | 183 void vp9_rc_update_framerate(struct VP9_COMP *cpi); |
180 | 184 |
| 185 void vp9_rc_set_gf_max_interval(const struct VP9EncoderConfig *const oxcf, |
| 186 RATE_CONTROL *const rc); |
| 187 |
181 #ifdef __cplusplus | 188 #ifdef __cplusplus |
182 } // extern "C" | 189 } // extern "C" |
183 #endif | 190 #endif |
184 | 191 |
185 #endif // VP9_ENCODER_VP9_RATECTRL_H_ | 192 #endif // VP9_ENCODER_VP9_RATECTRL_H_ |
OLD | NEW |