Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(552)

Side by Side Diff: source/libvpx/vp9/encoder/vp9_ratectrl.h

Issue 592203002: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_quantize.c ('k') | source/libvpx/vp9/encoder/vp9_ratectrl.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_codec.h"
15 #include "vpx/vpx_integer.h" 16 #include "vpx/vpx_integer.h"
16 17
17 #include "vp9/common/vp9_blockd.h" 18 #include "vp9/common/vp9_blockd.h"
18 19
19 #ifdef __cplusplus 20 #ifdef __cplusplus
20 extern "C" { 21 extern "C" {
21 #endif 22 #endif
22 23
23 // Bits Per MB at different Q (Multiplied by 512) 24 // Bits Per MB at different Q (Multiplied by 512)
24 #define BPER_MB_NORMBITS 9 25 #define BPER_MB_NORMBITS 9
25 26
26 typedef enum { 27 typedef enum {
27 INTER_NORMAL = 0, 28 INTER_NORMAL = 0,
28 INTER_HIGH = 1, 29 INTER_HIGH = 1,
29 GF_ARF_LOW = 2, 30 GF_ARF_LOW = 2,
30 GF_ARF_STD = 3, 31 GF_ARF_STD = 3,
31 KF_STD = 4, 32 KF_STD = 4,
32 RATE_FACTOR_LEVELS = 5 33 RATE_FACTOR_LEVELS = 5
33 } RATE_FACTOR_LEVEL; 34 } RATE_FACTOR_LEVEL;
34 35
35 typedef struct { 36 typedef struct {
36 // Rate targetting variables 37 // Rate targetting variables
37 int base_frame_target; // A baseline frame target before adjustment 38 int base_frame_target; // A baseline frame target before adjustment
38 // for previous under or over shoot. 39 // for previous under or over shoot.
39 int this_frame_target; // Actual frame target after rc adjustment. 40 int this_frame_target; // Actual frame target after rc adjustment.
40 int projected_frame_size; 41 int projected_frame_size;
41 int sb64_target_rate; 42 int sb64_target_rate;
42 int last_q[FRAME_TYPES]; // Separate values for Intra/Inter 43 int last_q[FRAME_TYPES]; // Separate values for Intra/Inter
43 int last_boosted_qindex; // Last boosted GF/KF/ARF q 44 int last_boosted_qindex; // Last boosted GF/KF/ARF q
45 int last_kf_qindex; // Q index of the last key frame coded.
44 46
45 int gfu_boost; 47 int gfu_boost;
46 int last_boost; 48 int last_boost;
47 int kf_boost; 49 int kf_boost;
48 50
49 double rate_correction_factors[RATE_FACTOR_LEVELS]; 51 double rate_correction_factors[RATE_FACTOR_LEVELS];
50 52
51 int frames_since_golden; 53 int frames_since_golden;
52 int frames_till_gf_update_due; 54 int frames_till_gf_update_due;
53 int max_gf_interval; 55 int max_gf_interval;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 int64_t maximum_buffer_size; 99 int64_t maximum_buffer_size;
98 // int active_best_quality; 100 // int active_best_quality;
99 } RATE_CONTROL; 101 } RATE_CONTROL;
100 102
101 struct VP9_COMP; 103 struct VP9_COMP;
102 struct VP9EncoderConfig; 104 struct VP9EncoderConfig;
103 105
104 void vp9_rc_init(const struct VP9EncoderConfig *oxcf, int pass, 106 void vp9_rc_init(const struct VP9EncoderConfig *oxcf, int pass,
105 RATE_CONTROL *rc); 107 RATE_CONTROL *rc);
106 108
107 double vp9_convert_qindex_to_q(int qindex); 109 double vp9_convert_qindex_to_q(int qindex, vpx_bit_depth_t bit_depth);
108 110
109 void vp9_rc_init_minq_luts(); 111 void vp9_rc_init_minq_luts();
110 112
111 // Generally at the high level, the following flow is expected 113 // Generally at the high level, the following flow is expected
112 // to be enforced for rate control: 114 // to be enforced for rate control:
113 // First call per frame, one of: 115 // First call per frame, one of:
114 // vp9_rc_get_one_pass_vbr_params() 116 // vp9_rc_get_one_pass_vbr_params()
115 // vp9_rc_get_one_pass_cbr_params() 117 // vp9_rc_get_one_pass_cbr_params()
116 // vp9_rc_get_svc_params() 118 // vp9_rc_get_svc_params()
117 // vp9_rc_get_first_pass_params() 119 // vp9_rc_get_first_pass_params()
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 int vp9_rc_pick_q_and_bounds(const struct VP9_COMP *cpi, 162 int vp9_rc_pick_q_and_bounds(const struct VP9_COMP *cpi,
161 int *bottom_index, 163 int *bottom_index,
162 int *top_index); 164 int *top_index);
163 165
164 // Estimates q to achieve a target bits per frame 166 // Estimates q to achieve a target bits per frame
165 int vp9_rc_regulate_q(const struct VP9_COMP *cpi, int target_bits_per_frame, 167 int vp9_rc_regulate_q(const struct VP9_COMP *cpi, int target_bits_per_frame,
166 int active_best_quality, int active_worst_quality); 168 int active_best_quality, int active_worst_quality);
167 169
168 // Estimates bits per mb for a given qindex and correction factor. 170 // Estimates bits per mb for a given qindex and correction factor.
169 int vp9_rc_bits_per_mb(FRAME_TYPE frame_type, int qindex, 171 int vp9_rc_bits_per_mb(FRAME_TYPE frame_type, int qindex,
170 double correction_factor); 172 double correction_factor, vpx_bit_depth_t bit_depth);
171 173
172 // Clamping utilities for bitrate targets for iframes and pframes. 174 // Clamping utilities for bitrate targets for iframes and pframes.
173 int vp9_rc_clamp_iframe_target_size(const struct VP9_COMP *const cpi, 175 int vp9_rc_clamp_iframe_target_size(const struct VP9_COMP *const cpi,
174 int target); 176 int target);
175 int vp9_rc_clamp_pframe_target_size(const struct VP9_COMP *const cpi, 177 int vp9_rc_clamp_pframe_target_size(const struct VP9_COMP *const cpi,
176 int target); 178 int target);
177 // Utility to set frame_target into the RATE_CONTROL structure 179 // Utility to set frame_target into the RATE_CONTROL structure
178 // This function is called only from the vp9_rc_get_..._params() functions. 180 // This function is called only from the vp9_rc_get_..._params() functions.
179 void vp9_rc_set_frame_target(struct VP9_COMP *cpi, int target); 181 void vp9_rc_set_frame_target(struct VP9_COMP *cpi, int target);
180 182
181 // Computes a q delta (in "q index" terms) to get from a starting q value 183 // Computes a q delta (in "q index" terms) to get from a starting q value
182 // to a target q value 184 // to a target q value
183 int vp9_compute_qdelta(const RATE_CONTROL *rc, double qstart, double qtarget); 185 int vp9_compute_qdelta(const RATE_CONTROL *rc, double qstart, double qtarget,
186 vpx_bit_depth_t bit_depth);
184 187
185 // Computes a q delta (in "q index" terms) to get from a starting q value 188 // Computes a q delta (in "q index" terms) to get from a starting q value
186 // to a value that should equate to the given rate ratio. 189 // to a value that should equate to the given rate ratio.
187 int vp9_compute_qdelta_by_rate(const RATE_CONTROL *rc, FRAME_TYPE frame_type, 190 int vp9_compute_qdelta_by_rate(const RATE_CONTROL *rc, FRAME_TYPE frame_type,
188 int qindex, double rate_target_ratio); 191 int qindex, double rate_target_ratio,
192 vpx_bit_depth_t bit_depth);
189 193
190 void vp9_rc_update_framerate(struct VP9_COMP *cpi); 194 void vp9_rc_update_framerate(struct VP9_COMP *cpi);
191 195
192 void vp9_rc_set_gf_max_interval(const struct VP9_COMP *const cpi, 196 void vp9_rc_set_gf_max_interval(const struct VP9_COMP *const cpi,
193 RATE_CONTROL *const rc); 197 RATE_CONTROL *const rc);
194 198
195 #ifdef __cplusplus 199 #ifdef __cplusplus
196 } // extern "C" 200 } // extern "C"
197 #endif 201 #endif
198 202
199 #endif // VP9_ENCODER_VP9_RATECTRL_H_ 203 #endif // VP9_ENCODER_VP9_RATECTRL_H_
OLDNEW
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_quantize.c ('k') | source/libvpx/vp9/encoder/vp9_ratectrl.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698