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

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

Issue 756673003: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years 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_ratectrl.c ('k') | source/libvpx/vp9/encoder/vp9_rd.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
(...skipping 18 matching lines...) Expand all
29 #define QIDX_SKIP_THRESH 115 29 #define QIDX_SKIP_THRESH 115
30 30
31 #define MV_COST_WEIGHT 108 31 #define MV_COST_WEIGHT 108
32 #define MV_COST_WEIGHT_SUB 120 32 #define MV_COST_WEIGHT_SUB 120
33 33
34 #define INVALID_MV 0x80008000 34 #define INVALID_MV 0x80008000
35 35
36 #define MAX_MODES 30 36 #define MAX_MODES 30
37 #define MAX_REFS 6 37 #define MAX_REFS 6
38 38
39 #define RD_THRESH_MAX_FACT 64
40 #define RD_THRESH_INC 1
41
39 // This enumerator type needs to be kept aligned with the mode order in 42 // This enumerator type needs to be kept aligned with the mode order in
40 // const MODE_DEFINITION vp9_mode_order[MAX_MODES] used in the rd code. 43 // const MODE_DEFINITION vp9_mode_order[MAX_MODES] used in the rd code.
41 typedef enum { 44 typedef enum {
42 THR_NEARESTMV, 45 THR_NEARESTMV,
43 THR_NEARESTA, 46 THR_NEARESTA,
44 THR_NEARESTG, 47 THR_NEARESTG,
45 48
46 THR_DC, 49 THR_DC,
47 50
48 THR_NEWMV, 51 THR_NEWMV,
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 94
92 typedef struct RD_OPT { 95 typedef struct RD_OPT {
93 // Thresh_mult is used to set a threshold for the rd score. A higher value 96 // Thresh_mult is used to set a threshold for the rd score. A higher value
94 // means that we will accept the best mode so far more often. This number 97 // means that we will accept the best mode so far more often. This number
95 // is used in combination with the current block size, and thresh_freq_fact 98 // is used in combination with the current block size, and thresh_freq_fact
96 // to pick a threshold. 99 // to pick a threshold.
97 int thresh_mult[MAX_MODES]; 100 int thresh_mult[MAX_MODES];
98 int thresh_mult_sub8x8[MAX_REFS]; 101 int thresh_mult_sub8x8[MAX_REFS];
99 102
100 int threshes[MAX_SEGMENTS][BLOCK_SIZES][MAX_MODES]; 103 int threshes[MAX_SEGMENTS][BLOCK_SIZES][MAX_MODES];
101 int thresh_freq_fact[BLOCK_SIZES][MAX_MODES];
102 104
103 int mode_map[BLOCK_SIZES][MAX_MODES];
104
105 int64_t comp_pred_diff[REFERENCE_MODES];
106 int64_t prediction_type_threshes[MAX_REF_FRAMES][REFERENCE_MODES]; 105 int64_t prediction_type_threshes[MAX_REF_FRAMES][REFERENCE_MODES];
107 int64_t tx_select_diff[TX_MODES];
108 // TODO(agrange): can this overflow? 106 // TODO(agrange): can this overflow?
109 int tx_select_threshes[MAX_REF_FRAMES][TX_MODES]; 107 int tx_select_threshes[MAX_REF_FRAMES][TX_MODES];
110 108
111 int64_t filter_diff[SWITCHABLE_FILTER_CONTEXTS];
112 int64_t filter_threshes[MAX_REF_FRAMES][SWITCHABLE_FILTER_CONTEXTS]; 109 int64_t filter_threshes[MAX_REF_FRAMES][SWITCHABLE_FILTER_CONTEXTS];
113 int64_t filter_cache[SWITCHABLE_FILTER_CONTEXTS];
114 int64_t mask_filter;
115 110
116 int RDMULT; 111 int RDMULT;
117 int RDDIV; 112 int RDDIV;
118 } RD_OPT; 113 } RD_OPT;
119 114
120 typedef struct RD_COST { 115 typedef struct RD_COST {
121 int rate; 116 int rate;
122 int64_t dist; 117 int64_t dist;
123 int64_t rdcost; 118 int64_t rdcost;
124 } RD_COST; 119 } RD_COST;
125 120
126 // Reset the rate distortion cost values to maximum (invalid) value. 121 // Reset the rate distortion cost values to maximum (invalid) value.
127 void vp9_rd_cost_reset(RD_COST *rd_cost); 122 void vp9_rd_cost_reset(RD_COST *rd_cost);
128 // Initialize the rate distortion cost values to zero. 123 // Initialize the rate distortion cost values to zero.
129 void vp9_rd_cost_init(RD_COST *rd_cost); 124 void vp9_rd_cost_init(RD_COST *rd_cost);
130 125
131 struct TileInfo; 126 struct TileInfo;
127 struct TileDataEnc;
132 struct VP9_COMP; 128 struct VP9_COMP;
133 struct macroblock; 129 struct macroblock;
134 130
135 int vp9_compute_rd_mult(const struct VP9_COMP *cpi, int qindex); 131 int vp9_compute_rd_mult(const struct VP9_COMP *cpi, int qindex);
136 132
137 void vp9_initialize_rd_consts(struct VP9_COMP *cpi); 133 void vp9_initialize_rd_consts(struct VP9_COMP *cpi);
138 134
139 void vp9_initialize_me_consts(struct VP9_COMP *cpi, int qindex); 135 void vp9_initialize_me_consts(struct VP9_COMP *cpi, int qindex);
140 136
141 void vp9_model_rd_from_var_lapndz(unsigned int var, unsigned int n, 137 void vp9_model_rd_from_var_lapndz(unsigned int var, unsigned int n,
142 unsigned int qstep, int *rate, 138 unsigned int qstep, int *rate,
143 int64_t *dist); 139 int64_t *dist);
144 140
145 int vp9_get_switchable_rate(const struct VP9_COMP *cpi); 141 int vp9_get_switchable_rate(const struct VP9_COMP *cpi);
146 142
147 const YV12_BUFFER_CONFIG *vp9_get_scaled_ref_frame(const struct VP9_COMP *cpi, 143 const YV12_BUFFER_CONFIG *vp9_get_scaled_ref_frame(const struct VP9_COMP *cpi,
148 int ref_frame); 144 int ref_frame);
149 145
150 void vp9_init_me_luts(); 146 void vp9_init_me_luts();
151 147
152 void vp9_get_entropy_contexts(BLOCK_SIZE bsize, TX_SIZE tx_size, 148 void vp9_get_entropy_contexts(BLOCK_SIZE bsize, TX_SIZE tx_size,
153 const struct macroblockd_plane *pd, 149 const struct macroblockd_plane *pd,
154 ENTROPY_CONTEXT t_above[16], 150 ENTROPY_CONTEXT t_above[16],
155 ENTROPY_CONTEXT t_left[16]); 151 ENTROPY_CONTEXT t_left[16]);
156 152
157 void vp9_set_rd_speed_thresholds(struct VP9_COMP *cpi); 153 void vp9_set_rd_speed_thresholds(struct VP9_COMP *cpi);
158 154
159 void vp9_set_rd_speed_thresholds_sub8x8(struct VP9_COMP *cpi); 155 void vp9_set_rd_speed_thresholds_sub8x8(struct VP9_COMP *cpi);
160 156
157 void vp9_update_rd_thresh_fact(int (*fact)[MAX_MODES], int rd_thresh,
158 int bsize, int best_mode_index);
159
161 static INLINE int rd_less_than_thresh(int64_t best_rd, int thresh, 160 static INLINE int rd_less_than_thresh(int64_t best_rd, int thresh,
162 int thresh_fact) { 161 int thresh_fact) {
163 return best_rd < ((int64_t)thresh * thresh_fact >> 5) || thresh == INT_MAX; 162 return best_rd < ((int64_t)thresh * thresh_fact >> 5) || thresh == INT_MAX;
164 } 163 }
165 164
166 void vp9_mv_pred(struct VP9_COMP *cpi, MACROBLOCK *x, 165 void vp9_mv_pred(struct VP9_COMP *cpi, MACROBLOCK *x,
167 uint8_t *ref_y_buffer, int ref_y_stride, 166 uint8_t *ref_y_buffer, int ref_y_stride,
168 int ref_frame, BLOCK_SIZE block_size); 167 int ref_frame, BLOCK_SIZE block_size);
169 168
170 void vp9_setup_pred_block(const MACROBLOCKD *xd, 169 void vp9_setup_pred_block(const MACROBLOCKD *xd,
171 struct buf_2d dst[MAX_MB_PLANE], 170 struct buf_2d dst[MAX_MB_PLANE],
172 const YV12_BUFFER_CONFIG *src, 171 const YV12_BUFFER_CONFIG *src,
173 int mi_row, int mi_col, 172 int mi_row, int mi_col,
174 const struct scale_factors *scale, 173 const struct scale_factors *scale,
175 const struct scale_factors *scale_uv); 174 const struct scale_factors *scale_uv);
176 175
177 int vp9_get_intra_cost_penalty(int qindex, int qdelta, 176 int vp9_get_intra_cost_penalty(int qindex, int qdelta,
178 vpx_bit_depth_t bit_depth); 177 vpx_bit_depth_t bit_depth);
179 178
180 #ifdef __cplusplus 179 #ifdef __cplusplus
181 } // extern "C" 180 } // extern "C"
182 #endif 181 #endif
183 182
184 #endif // VP9_ENCODER_VP9_RD_H_ 183 #endif // VP9_ENCODER_VP9_RD_H_
OLDNEW
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_ratectrl.c ('k') | source/libvpx/vp9/encoder/vp9_rd.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698