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 "vp9/encoder/vp9_onyx_int.h" | 15 #include "vp9/encoder/vp9_onyx_int.h" |
16 | 16 |
17 #define FRAME_OVERHEAD_BITS 200 | 17 #define FRAME_OVERHEAD_BITS 200 |
18 | 18 |
19 void vp9_save_coding_context(VP9_COMP *cpi); | 19 void vp9_save_coding_context(VP9_COMP *cpi); |
20 void vp9_restore_coding_context(VP9_COMP *cpi); | 20 void vp9_restore_coding_context(VP9_COMP *cpi); |
21 | 21 |
22 void vp9_setup_key_frame(VP9_COMP *cpi); | 22 void vp9_setup_key_frame(VP9_COMP *cpi); |
23 void vp9_update_rate_correction_factors(VP9_COMP *cpi, int damp_var); | 23 void vp9_setup_inter_frame(VP9_COMP *cpi); |
24 int vp9_regulate_q(VP9_COMP *cpi, int target_bits_per_frame); | 24 |
25 void vp9_adjust_key_frame_context(VP9_COMP *cpi); | 25 double vp9_convert_qindex_to_q(int qindex); |
26 void vp9_compute_frame_size_bounds(VP9_COMP *cpi, | 26 |
27 int *frame_under_shoot_limit, | 27 // Updates rate correction factors |
28 int *frame_over_shoot_limit); | 28 void vp9_rc_update_rate_correction_factors(VP9_COMP *cpi, int damp_var); |
| 29 |
| 30 // initialize luts for minq |
| 31 void vp9_rc_init_minq_luts(void); |
29 | 32 |
30 // return of 0 means drop frame | 33 // return of 0 means drop frame |
31 int vp9_pick_frame_size(VP9_COMP *cpi); | 34 // Changes only rc.this_frame_target and rc.sb64_rate_target |
| 35 int vp9_rc_pick_frame_size_target(VP9_COMP *cpi); |
32 | 36 |
33 double vp9_convert_qindex_to_q(int qindex); | 37 void vp9_rc_compute_frame_size_bounds(const VP9_COMP *cpi, |
34 int vp9_gfboost_qadjust(int qindex); | 38 int this_frame_target, |
35 int vp9_bits_per_mb(FRAME_TYPE frame_type, int qindex, | 39 int *frame_under_shoot_limit, |
36 double correction_factor); | 40 int *frame_over_shoot_limit); |
37 void vp9_setup_inter_frame(VP9_COMP *cpi); | 41 |
| 42 // Picks q and q bounds given the target for bits |
| 43 int vp9_rc_pick_q_and_adjust_q_bounds(const VP9_COMP *cpi, |
| 44 int *bottom_index, |
| 45 int *top_index, |
| 46 int *top_index_prop); |
| 47 |
| 48 // Estimates q to achieve a target bits per frame |
| 49 int vp9_rc_regulate_q(const VP9_COMP *cpi, int target_bits_per_frame, |
| 50 int active_best_quality, int active_worst_quality); |
| 51 |
| 52 // Post encode update of the rate control parameters based |
| 53 // on bytes used and q used for the frame |
| 54 void vp9_rc_postencode_update(VP9_COMP *cpi, |
| 55 uint64_t bytes_used, |
| 56 int worst_q); |
| 57 |
| 58 // estimates bits per mb for a given qindex and correction factor |
| 59 int vp9_rc_bits_per_mb(FRAME_TYPE frame_type, int qindex, |
| 60 double correction_factor); |
| 61 |
| 62 // Post encode update of the rate control parameters for 2-pass |
| 63 void vp9_twopass_postencode_update(VP9_COMP *cpi, |
| 64 uint64_t bytes_used); |
38 | 65 |
39 #endif // VP9_ENCODER_VP9_RATECTRL_H_ | 66 #endif // VP9_ENCODER_VP9_RATECTRL_H_ |
OLD | NEW |