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