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 |
11 | 11 |
12 #ifndef VP9_ENCODER_VP9_RATECTRL_H_ | 12 #ifndef VP9_ENCODER_VP9_RATECTRL_H_ |
13 #define VP9_ENCODER_VP9_RATECTRL_H_ | 13 #define VP9_ENCODER_VP9_RATECTRL_H_ |
14 | 14 |
15 #include "vpx/vpx_integer.h" | 15 #include "vpx/vpx_integer.h" |
16 | 16 |
17 #include "vp9/common/vp9_blockd.h" | 17 #include "vp9/common/vp9_blockd.h" |
18 | 18 |
19 #ifdef __cplusplus | 19 #ifdef __cplusplus |
20 extern "C" { | 20 extern "C" { |
21 #endif | 21 #endif |
22 | 22 |
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 enum { |
| 27 INTER_NORMAL = 0, |
| 28 INTER_HIGH = 1, |
| 29 GF_ARF_LOW = 2, |
| 30 GF_ARF_STD = 3, |
| 31 KF_STD = 4, |
| 32 RATE_FACTOR_LEVELS = 5 |
| 33 } RATE_FACTOR_LEVEL; |
| 34 |
26 typedef struct { | 35 typedef struct { |
27 // Rate targetting variables | 36 // Rate targetting variables |
28 int base_frame_target; // A baseline frame target before adjustment | 37 int base_frame_target; // A baseline frame target before adjustment |
29 // for previous under or over shoot. | 38 // for previous under or over shoot. |
30 int this_frame_target; // Actual frame target after rc adjustment. | 39 int this_frame_target; // Actual frame target after rc adjustment. |
31 int projected_frame_size; | 40 int projected_frame_size; |
32 int sb64_target_rate; | 41 int sb64_target_rate; |
33 int last_q[FRAME_TYPES]; // Separate values for Intra/Inter | 42 int last_q[FRAME_TYPES]; // Separate values for Intra/Inter |
34 int last_boosted_qindex; // Last boosted GF/KF/ARF q | 43 int last_boosted_qindex; // Last boosted GF/KF/ARF q |
35 | 44 |
36 int gfu_boost; | 45 int gfu_boost; |
37 int last_boost; | 46 int last_boost; |
38 int kf_boost; | 47 int kf_boost; |
39 | 48 |
40 double rate_correction_factor; | 49 double rate_correction_factors[RATE_FACTOR_LEVELS]; |
41 double key_frame_rate_correction_factor; | |
42 double gf_rate_correction_factor; | |
43 | 50 |
44 int frames_since_golden; | 51 int frames_since_golden; |
45 int frames_till_gf_update_due; | 52 int frames_till_gf_update_due; |
46 int max_gf_interval; | 53 int max_gf_interval; |
47 int static_scene_max_gf_interval; | 54 int static_scene_max_gf_interval; |
48 int baseline_gf_interval; | 55 int baseline_gf_interval; |
49 int frames_to_key; | 56 int frames_to_key; |
50 int frames_since_key; | 57 int frames_since_key; |
51 int this_key_frame_forced; | 58 int this_key_frame_forced; |
52 int next_key_frame_forced; | 59 int next_key_frame_forced; |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 void vp9_rc_update_framerate(struct VP9_COMP *cpi); | 190 void vp9_rc_update_framerate(struct VP9_COMP *cpi); |
184 | 191 |
185 void vp9_rc_set_gf_max_interval(const struct VP9EncoderConfig *const oxcf, | 192 void vp9_rc_set_gf_max_interval(const struct VP9EncoderConfig *const oxcf, |
186 RATE_CONTROL *const rc); | 193 RATE_CONTROL *const rc); |
187 | 194 |
188 #ifdef __cplusplus | 195 #ifdef __cplusplus |
189 } // extern "C" | 196 } // extern "C" |
190 #endif | 197 #endif |
191 | 198 |
192 #endif // VP9_ENCODER_VP9_RATECTRL_H_ | 199 #endif // VP9_ENCODER_VP9_RATECTRL_H_ |
OLD | NEW |