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 |
(...skipping 29 matching lines...) Expand all Loading... |
40 int_mv ref_mvs[MAX_REF_FRAMES][MAX_MV_REF_CANDIDATES]; | 40 int_mv ref_mvs[MAX_REF_FRAMES][MAX_MV_REF_CANDIDATES]; |
41 int rate; | 41 int rate; |
42 int distortion; | 42 int distortion; |
43 int64_t intra_error; | 43 int64_t intra_error; |
44 int best_mode_index; | 44 int best_mode_index; |
45 int rddiv; | 45 int rddiv; |
46 int rdmult; | 46 int rdmult; |
47 int hybrid_pred_diff; | 47 int hybrid_pred_diff; |
48 int comp_pred_diff; | 48 int comp_pred_diff; |
49 int single_pred_diff; | 49 int single_pred_diff; |
50 int64_t txfm_rd_diff[NB_TXFM_MODES]; | 50 int64_t tx_rd_diff[TX_MODES]; |
51 int64_t best_filter_diff[VP9_SWITCHABLE_FILTERS + 1]; | 51 int64_t best_filter_diff[SWITCHABLE_FILTERS + 1]; |
52 | 52 |
53 // Bit flag for each mode whether it has high error in comparison to others. | 53 // Bit flag for each mode whether it has high error in comparison to others. |
54 unsigned int modes_with_high_error; | 54 unsigned int modes_with_high_error; |
55 | 55 |
56 // Bit flag for each ref frame whether it has high error compared to others. | 56 // Bit flag for each ref frame whether it has high error compared to others. |
57 unsigned int frames_with_high_error; | 57 unsigned int frames_with_high_error; |
58 } PICK_MODE_CONTEXT; | 58 } PICK_MODE_CONTEXT; |
59 | 59 |
60 struct macroblock_plane { | 60 struct macroblock_plane { |
61 DECLARE_ALIGNED(16, int16_t, src_diff[64*64]); | 61 DECLARE_ALIGNED(16, int16_t, src_diff[64*64]); |
62 DECLARE_ALIGNED(16, int16_t, coeff[64*64]); | 62 DECLARE_ALIGNED(16, int16_t, coeff[64*64]); |
63 struct buf_2d src; | 63 struct buf_2d src; |
64 | 64 |
65 // Quantizer setings | 65 // Quantizer setings |
66 int16_t *quant; | 66 int16_t *quant; |
67 int16_t *quant_shift; | 67 int16_t *quant_shift; |
68 int16_t *zbin; | 68 int16_t *zbin; |
69 int16_t *round; | 69 int16_t *round; |
70 | 70 |
71 // Zbin Over Quant value | 71 // Zbin Over Quant value |
72 int16_t zbin_extra; | 72 int16_t zbin_extra; |
73 }; | 73 }; |
74 | 74 |
| 75 /* The [2] dimension is for whether we skip the EOB node (i.e. if previous |
| 76 * coefficient in this block was zero) or not. */ |
| 77 typedef unsigned int vp9_coeff_cost[BLOCK_TYPES][REF_TYPES][COEF_BANDS][2] |
| 78 [PREV_COEF_CONTEXTS][MAX_ENTROPY_TOKENS]; |
| 79 |
75 typedef struct macroblock MACROBLOCK; | 80 typedef struct macroblock MACROBLOCK; |
76 struct macroblock { | 81 struct macroblock { |
77 struct macroblock_plane plane[MAX_MB_PLANE]; | 82 struct macroblock_plane plane[MAX_MB_PLANE]; |
78 | 83 |
79 MACROBLOCKD e_mbd; | 84 MACROBLOCKD e_mbd; |
80 int skip_block; | 85 int skip_block; |
81 PARTITION_INFO *partition_info; /* work pointer */ | 86 PARTITION_INFO *partition_info; /* work pointer */ |
82 PARTITION_INFO *pi; /* Corresponds to upper left visible macroblock */ | 87 PARTITION_INFO *pi; /* Corresponds to upper left visible macroblock */ |
83 PARTITION_INFO *pip; /* Base of allocated array */ | 88 PARTITION_INFO *pip; /* Base of allocated array */ |
84 | 89 |
85 search_site *ss; | 90 search_site *ss; |
86 int ss_count; | 91 int ss_count; |
87 int searches_per_step; | 92 int searches_per_step; |
88 | 93 |
89 int errorperbit; | 94 int errorperbit; |
90 int sadperbit16; | 95 int sadperbit16; |
91 int sadperbit4; | 96 int sadperbit4; |
92 int rddiv; | 97 int rddiv; |
93 int rdmult; | 98 int rdmult; |
94 unsigned int *mb_activity_ptr; | 99 unsigned int *mb_activity_ptr; |
95 int *mb_norm_activity_ptr; | 100 int *mb_norm_activity_ptr; |
96 signed int act_zbin_adj; | 101 signed int act_zbin_adj; |
97 | 102 |
98 int mv_best_ref_index[MAX_REF_FRAMES]; | 103 int mv_best_ref_index[MAX_REF_FRAMES]; |
99 unsigned int max_mv_context[MAX_REF_FRAMES]; | 104 unsigned int max_mv_context[MAX_REF_FRAMES]; |
| 105 unsigned int source_variance; |
100 | 106 |
101 int nmvjointcost[MV_JOINTS]; | 107 int nmvjointcost[MV_JOINTS]; |
102 int nmvcosts[2][MV_VALS]; | 108 int nmvcosts[2][MV_VALS]; |
103 int *nmvcost[2]; | 109 int *nmvcost[2]; |
104 int nmvcosts_hp[2][MV_VALS]; | 110 int nmvcosts_hp[2][MV_VALS]; |
105 int *nmvcost_hp[2]; | 111 int *nmvcost_hp[2]; |
106 int **mvcost; | 112 int **mvcost; |
107 | 113 |
108 int nmvjointsadcost[MV_JOINTS]; | 114 int nmvjointsadcost[MV_JOINTS]; |
109 int nmvsadcosts[2][MV_VALS]; | 115 int nmvsadcosts[2][MV_VALS]; |
110 int *nmvsadcost[2]; | 116 int *nmvsadcost[2]; |
111 int nmvsadcosts_hp[2][MV_VALS]; | 117 int nmvsadcosts_hp[2][MV_VALS]; |
112 int *nmvsadcost_hp[2]; | 118 int *nmvsadcost_hp[2]; |
113 int **mvsadcost; | 119 int **mvsadcost; |
114 | 120 |
115 int mbmode_cost[MB_MODE_COUNT]; | 121 int mbmode_cost[MB_MODE_COUNT]; |
116 unsigned inter_mode_cost[INTER_MODE_CONTEXTS][MB_MODE_COUNT - NEARESTMV]; | 122 unsigned inter_mode_cost[INTER_MODE_CONTEXTS][MB_MODE_COUNT - NEARESTMV]; |
117 int intra_uv_mode_cost[2][MB_MODE_COUNT]; | 123 int intra_uv_mode_cost[2][MB_MODE_COUNT]; |
118 int y_mode_costs[VP9_INTRA_MODES][VP9_INTRA_MODES][VP9_INTRA_MODES]; | 124 int y_mode_costs[INTRA_MODES][INTRA_MODES][INTRA_MODES]; |
119 int switchable_interp_costs[VP9_SWITCHABLE_FILTERS + 1] | 125 int switchable_interp_costs[SWITCHABLE_FILTERS + 1] |
120 [VP9_SWITCHABLE_FILTERS]; | 126 [SWITCHABLE_FILTERS]; |
121 | 127 |
122 // These define limits to motion vector components to prevent them | 128 // These define limits to motion vector components to prevent them |
123 // from extending outside the UMV borders | 129 // from extending outside the UMV borders |
124 int mv_col_min; | 130 int mv_col_min; |
125 int mv_col_max; | 131 int mv_col_max; |
126 int mv_row_min; | 132 int mv_row_min; |
127 int mv_row_max; | 133 int mv_row_max; |
128 | 134 |
129 int skip; | 135 int skip; |
130 | 136 |
131 int encode_breakout; | 137 int encode_breakout; |
132 | 138 |
133 unsigned char *active_ptr; | 139 unsigned char *active_ptr; |
134 | 140 |
135 // note that token_costs is the cost when eob node is skipped | 141 // note that token_costs is the cost when eob node is skipped |
136 vp9_coeff_count token_costs[TX_SIZE_MAX_SB][BLOCK_TYPES][2]; | 142 vp9_coeff_cost token_costs[TX_SIZES]; |
137 | 143 |
138 int optimize; | 144 int optimize; |
139 | 145 |
140 // indicate if it is in the rd search loop or encoding process | 146 // indicate if it is in the rd search loop or encoding process |
141 int rd_search; | 147 int use_lp32x32fdct; |
142 int skip_encode; | 148 int skip_encode; |
143 | 149 |
144 // Used to store sub partition's choices. | 150 // Used to store sub partition's choices. |
145 int fast_ms; | 151 int fast_ms; |
146 int_mv pred_mv; | 152 int_mv pred_mv; |
147 int subblock_ref; | 153 int subblock_ref; |
148 | 154 |
149 // TODO(jingning): Need to refactor the structure arrays that buffers the | 155 // TODO(jingning): Need to refactor the structure arrays that buffers the |
150 // coding mode decisions of each partition type. | 156 // coding mode decisions of each partition type. |
151 PICK_MODE_CONTEXT ab4x4_context[4][4][4]; | 157 PICK_MODE_CONTEXT ab4x4_context[4][4][4]; |
152 PICK_MODE_CONTEXT sb8x4_context[4][4][4]; | 158 PICK_MODE_CONTEXT sb8x4_context[4][4][4]; |
153 PICK_MODE_CONTEXT sb4x8_context[4][4][4]; | 159 PICK_MODE_CONTEXT sb4x8_context[4][4][4]; |
154 PICK_MODE_CONTEXT sb8x8_context[4][4][4]; | 160 PICK_MODE_CONTEXT sb8x8_context[4][4][4]; |
155 PICK_MODE_CONTEXT sb8x16_context[4][4][2]; | 161 PICK_MODE_CONTEXT sb8x16_context[4][4][2]; |
156 PICK_MODE_CONTEXT sb16x8_context[4][4][2]; | 162 PICK_MODE_CONTEXT sb16x8_context[4][4][2]; |
157 PICK_MODE_CONTEXT mb_context[4][4]; | 163 PICK_MODE_CONTEXT mb_context[4][4]; |
158 PICK_MODE_CONTEXT sb32x16_context[4][2]; | 164 PICK_MODE_CONTEXT sb32x16_context[4][2]; |
159 PICK_MODE_CONTEXT sb16x32_context[4][2]; | 165 PICK_MODE_CONTEXT sb16x32_context[4][2]; |
160 // when 4 MBs share coding parameters: | 166 // when 4 MBs share coding parameters: |
161 PICK_MODE_CONTEXT sb32_context[4]; | 167 PICK_MODE_CONTEXT sb32_context[4]; |
162 PICK_MODE_CONTEXT sb32x64_context[2]; | 168 PICK_MODE_CONTEXT sb32x64_context[2]; |
163 PICK_MODE_CONTEXT sb64x32_context[2]; | 169 PICK_MODE_CONTEXT sb64x32_context[2]; |
164 PICK_MODE_CONTEXT sb64_context; | 170 PICK_MODE_CONTEXT sb64_context; |
165 int partition_cost[NUM_PARTITION_CONTEXTS][PARTITION_TYPES]; | 171 int partition_cost[NUM_PARTITION_CONTEXTS][PARTITION_TYPES]; |
166 | 172 |
167 BLOCK_SIZE_TYPE b_partitioning[4][4][4]; | 173 BLOCK_SIZE b_partitioning[4][4][4]; |
168 BLOCK_SIZE_TYPE mb_partitioning[4][4]; | 174 BLOCK_SIZE mb_partitioning[4][4]; |
169 BLOCK_SIZE_TYPE sb_partitioning[4]; | 175 BLOCK_SIZE sb_partitioning[4]; |
170 BLOCK_SIZE_TYPE sb64_partitioning; | 176 BLOCK_SIZE sb64_partitioning; |
171 | 177 |
172 void (*fwd_txm4x4)(int16_t *input, int16_t *output, int pitch); | 178 void (*fwd_txm4x4)(int16_t *input, int16_t *output, int pitch); |
173 void (*fwd_txm8x4)(int16_t *input, int16_t *output, int pitch); | 179 void (*fwd_txm8x4)(int16_t *input, int16_t *output, int pitch); |
174 void (*fwd_txm8x8)(int16_t *input, int16_t *output, int pitch); | 180 void (*fwd_txm8x8)(int16_t *input, int16_t *output, int pitch); |
175 void (*fwd_txm16x16)(int16_t *input, int16_t *output, int pitch); | 181 void (*fwd_txm16x16)(int16_t *input, int16_t *output, int pitch); |
176 void (*quantize_b_4x4)(MACROBLOCK *x, int b_idx, TX_TYPE tx_type, | 182 void (*quantize_b_4x4)(MACROBLOCK *x, int b_idx, TX_TYPE tx_type, |
177 int y_blocks); | 183 int y_blocks); |
178 }; | 184 }; |
179 | 185 |
180 #endif // VP9_ENCODER_VP9_BLOCK_H_ | 186 #endif // VP9_ENCODER_VP9_BLOCK_H_ |
OLD | NEW |