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 #ifndef VP9_ENCODER_VP9_FIRSTPASS_H_ | 11 #ifndef VP9_ENCODER_VP9_FIRSTPASS_H_ |
12 #define VP9_ENCODER_VP9_FIRSTPASS_H_ | 12 #define VP9_ENCODER_VP9_FIRSTPASS_H_ |
13 #include "vp9/encoder/vp9_onyx_int.h" | |
14 | 13 |
15 #ifdef __cplusplus | 14 #ifdef __cplusplus |
16 extern "C" { | 15 extern "C" { |
17 #endif | 16 #endif |
18 | 17 |
19 void vp9_init_first_pass(VP9_COMP *cpi); | 18 typedef struct { |
20 void vp9_first_pass(VP9_COMP *cpi); | 19 double frame; |
21 void vp9_end_first_pass(VP9_COMP *cpi); | 20 double intra_error; |
| 21 double coded_error; |
| 22 double sr_coded_error; |
| 23 double ssim_weighted_pred_err; |
| 24 double pcnt_inter; |
| 25 double pcnt_motion; |
| 26 double pcnt_second_ref; |
| 27 double pcnt_neutral; |
| 28 double MVr; |
| 29 double mvr_abs; |
| 30 double MVc; |
| 31 double mvc_abs; |
| 32 double MVrv; |
| 33 double MVcv; |
| 34 double mv_in_out_count; |
| 35 double new_mv_count; |
| 36 double duration; |
| 37 double count; |
| 38 } FIRSTPASS_STATS; |
22 | 39 |
23 void vp9_init_second_pass(VP9_COMP *cpi); | 40 struct twopass_rc { |
24 void vp9_get_second_pass_params(VP9_COMP *cpi); | 41 unsigned int section_intra_rating; |
25 void vp9_end_second_pass(VP9_COMP *cpi); | 42 unsigned int next_iiratio; |
| 43 unsigned int this_iiratio; |
| 44 FIRSTPASS_STATS total_stats; |
| 45 FIRSTPASS_STATS this_frame_stats; |
| 46 FIRSTPASS_STATS *stats_in, *stats_in_end, *stats_in_start; |
| 47 FIRSTPASS_STATS total_left_stats; |
| 48 int first_pass_done; |
| 49 int64_t bits_left; |
| 50 int64_t clip_bits_total; |
| 51 double avg_iiratio; |
| 52 double modified_error_min; |
| 53 double modified_error_max; |
| 54 double modified_error_total; |
| 55 double modified_error_left; |
| 56 double kf_intra_err_min; |
| 57 double gf_intra_err_min; |
| 58 int static_scene_max_gf_interval; |
| 59 int kf_bits; |
| 60 // Remaining error from uncoded frames in a gf group. Two pass use only |
| 61 int64_t gf_group_error_left; |
26 | 62 |
27 void vp9_get_first_pass_params(VP9_COMP *cpi); | 63 // Projected total bits available for a key frame group of frames |
28 void vp9_get_one_pass_params(VP9_COMP *cpi); | 64 int64_t kf_group_bits; |
29 void vp9_get_one_pass_cbr_params(VP9_COMP *cpi); | |
30 void vp9_get_svc_params(VP9_COMP *cpi); | |
31 | 65 |
| 66 // Error score of frames still to be coded in kf group |
| 67 int64_t kf_group_error_left; |
| 68 |
| 69 // Projected Bits available for a group of frames including 1 GF or ARF |
| 70 int64_t gf_group_bits; |
| 71 // Bits for the golden frame or ARF - 2 pass only |
| 72 int gf_bits; |
| 73 int alt_extra_bits; |
| 74 |
| 75 int sr_update_lag; |
| 76 |
| 77 int kf_zeromotion_pct; |
| 78 int gf_zeromotion_pct; |
| 79 |
| 80 int active_worst_quality; |
| 81 }; |
| 82 |
| 83 struct VP9_COMP; |
| 84 |
| 85 void vp9_init_first_pass(struct VP9_COMP *cpi); |
| 86 void vp9_rc_get_first_pass_params(struct VP9_COMP *cpi); |
| 87 void vp9_first_pass(struct VP9_COMP *cpi); |
| 88 void vp9_end_first_pass(struct VP9_COMP *cpi); |
| 89 |
| 90 void vp9_init_second_pass(struct VP9_COMP *cpi); |
| 91 void vp9_rc_get_second_pass_params(struct VP9_COMP *cpi); |
| 92 void vp9_end_second_pass(struct VP9_COMP *cpi); |
| 93 int vp9_twopass_worst_quality(struct VP9_COMP *cpi, FIRSTPASS_STATS *fpstats, |
| 94 int section_target_bandwitdh); |
| 95 |
| 96 // Post encode update of the rate control parameters for 2-pass |
| 97 void vp9_twopass_postencode_update(struct VP9_COMP *cpi, |
| 98 uint64_t bytes_used); |
32 #ifdef __cplusplus | 99 #ifdef __cplusplus |
33 } // extern "C" | 100 } // extern "C" |
34 #endif | 101 #endif |
35 | 102 |
36 #endif // VP9_ENCODER_VP9_FIRSTPASS_H_ | 103 #endif // VP9_ENCODER_VP9_FIRSTPASS_H_ |
OLD | NEW |