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 12 matching lines...) Expand all Loading... |
23 int n_coeffs, int skip_block, | 23 int n_coeffs, int skip_block, |
24 const int16_t *round_ptr, const int16_t quant, | 24 const int16_t *round_ptr, const int16_t quant, |
25 tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, | 25 tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, |
26 const int16_t dequant_ptr, uint16_t *eob_ptr) { | 26 const int16_t dequant_ptr, uint16_t *eob_ptr) { |
27 const int rc = 0; | 27 const int rc = 0; |
28 const int coeff = coeff_ptr[rc]; | 28 const int coeff = coeff_ptr[rc]; |
29 const int coeff_sign = (coeff >> 31); | 29 const int coeff_sign = (coeff >> 31); |
30 const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign; | 30 const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign; |
31 int tmp, eob = -1; | 31 int tmp, eob = -1; |
32 | 32 |
33 vpx_memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr)); | 33 memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr)); |
34 vpx_memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr)); | 34 memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr)); |
35 | 35 |
36 if (!skip_block) { | 36 if (!skip_block) { |
37 tmp = clamp(abs_coeff + round_ptr[rc != 0], INT16_MIN, INT16_MAX); | 37 tmp = clamp(abs_coeff + round_ptr[rc != 0], INT16_MIN, INT16_MAX); |
38 tmp = (tmp * quant) >> 16; | 38 tmp = (tmp * quant) >> 16; |
39 qcoeff_ptr[rc] = (tmp ^ coeff_sign) - coeff_sign; | 39 qcoeff_ptr[rc] = (tmp ^ coeff_sign) - coeff_sign; |
40 dqcoeff_ptr[rc] = qcoeff_ptr[rc] * dequant_ptr; | 40 dqcoeff_ptr[rc] = qcoeff_ptr[rc] * dequant_ptr; |
41 if (tmp) | 41 if (tmp) |
42 eob = 0; | 42 eob = 0; |
43 } | 43 } |
44 *eob_ptr = eob + 1; | 44 *eob_ptr = eob + 1; |
45 } | 45 } |
46 | 46 |
47 #if CONFIG_VP9_HIGHBITDEPTH | 47 #if CONFIG_VP9_HIGHBITDEPTH |
48 void vp9_highbd_quantize_dc(const tran_low_t *coeff_ptr, | 48 void vp9_highbd_quantize_dc(const tran_low_t *coeff_ptr, |
49 int n_coeffs, int skip_block, | 49 int n_coeffs, int skip_block, |
50 const int16_t *round_ptr, const int16_t quant, | 50 const int16_t *round_ptr, const int16_t quant, |
51 tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, | 51 tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, |
52 const int16_t dequant_ptr, uint16_t *eob_ptr) { | 52 const int16_t dequant_ptr, uint16_t *eob_ptr) { |
53 int eob = -1; | 53 int eob = -1; |
54 | 54 |
55 vpx_memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr)); | 55 memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr)); |
56 vpx_memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr)); | 56 memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr)); |
57 | 57 |
58 if (!skip_block) { | 58 if (!skip_block) { |
59 const int rc = 0; | 59 const int rc = 0; |
60 const int coeff = coeff_ptr[rc]; | 60 const int coeff = coeff_ptr[rc]; |
61 const int coeff_sign = (coeff >> 31); | 61 const int coeff_sign = (coeff >> 31); |
62 const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign; | 62 const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign; |
63 | 63 |
64 const int64_t tmp = | 64 const int64_t tmp = |
65 (clamp(abs_coeff + round_ptr[rc != 0], INT32_MIN, INT32_MAX) * | 65 (clamp(abs_coeff + round_ptr[rc != 0], INT32_MIN, INT32_MAX) * |
66 quant) >> 16; | 66 quant) >> 16; |
(...skipping 10 matching lines...) Expand all Loading... |
77 const int16_t *round_ptr, const int16_t quant, | 77 const int16_t *round_ptr, const int16_t quant, |
78 tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, | 78 tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, |
79 const int16_t dequant_ptr, uint16_t *eob_ptr) { | 79 const int16_t dequant_ptr, uint16_t *eob_ptr) { |
80 const int n_coeffs = 1024; | 80 const int n_coeffs = 1024; |
81 const int rc = 0; | 81 const int rc = 0; |
82 const int coeff = coeff_ptr[rc]; | 82 const int coeff = coeff_ptr[rc]; |
83 const int coeff_sign = (coeff >> 31); | 83 const int coeff_sign = (coeff >> 31); |
84 const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign; | 84 const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign; |
85 int tmp, eob = -1; | 85 int tmp, eob = -1; |
86 | 86 |
87 vpx_memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr)); | 87 memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr)); |
88 vpx_memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr)); | 88 memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr)); |
89 | 89 |
90 if (!skip_block) { | 90 if (!skip_block) { |
91 | 91 |
92 tmp = clamp(abs_coeff + ROUND_POWER_OF_TWO(round_ptr[rc != 0], 1), | 92 tmp = clamp(abs_coeff + ROUND_POWER_OF_TWO(round_ptr[rc != 0], 1), |
93 INT16_MIN, INT16_MAX); | 93 INT16_MIN, INT16_MAX); |
94 tmp = (tmp * quant) >> 15; | 94 tmp = (tmp * quant) >> 15; |
95 qcoeff_ptr[rc] = (tmp ^ coeff_sign) - coeff_sign; | 95 qcoeff_ptr[rc] = (tmp ^ coeff_sign) - coeff_sign; |
96 dqcoeff_ptr[rc] = qcoeff_ptr[rc] * dequant_ptr / 2; | 96 dqcoeff_ptr[rc] = qcoeff_ptr[rc] * dequant_ptr / 2; |
97 if (tmp) | 97 if (tmp) |
98 eob = 0; | 98 eob = 0; |
99 } | 99 } |
100 *eob_ptr = eob + 1; | 100 *eob_ptr = eob + 1; |
101 } | 101 } |
102 | 102 |
103 #if CONFIG_VP9_HIGHBITDEPTH | 103 #if CONFIG_VP9_HIGHBITDEPTH |
104 void vp9_highbd_quantize_dc_32x32(const tran_low_t *coeff_ptr, | 104 void vp9_highbd_quantize_dc_32x32(const tran_low_t *coeff_ptr, |
105 int skip_block, | 105 int skip_block, |
106 const int16_t *round_ptr, | 106 const int16_t *round_ptr, |
107 const int16_t quant, | 107 const int16_t quant, |
108 tran_low_t *qcoeff_ptr, | 108 tran_low_t *qcoeff_ptr, |
109 tran_low_t *dqcoeff_ptr, | 109 tran_low_t *dqcoeff_ptr, |
110 const int16_t dequant_ptr, | 110 const int16_t dequant_ptr, |
111 uint16_t *eob_ptr) { | 111 uint16_t *eob_ptr) { |
112 const int n_coeffs = 1024; | 112 const int n_coeffs = 1024; |
113 int eob = -1; | 113 int eob = -1; |
114 | 114 |
115 vpx_memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr)); | 115 memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr)); |
116 vpx_memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr)); | 116 memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr)); |
117 | 117 |
118 if (!skip_block) { | 118 if (!skip_block) { |
119 const int rc = 0; | 119 const int rc = 0; |
120 const int coeff = coeff_ptr[rc]; | 120 const int coeff = coeff_ptr[rc]; |
121 const int coeff_sign = (coeff >> 31); | 121 const int coeff_sign = (coeff >> 31); |
122 const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign; | 122 const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign; |
123 | 123 |
124 const int64_t tmp = | 124 const int64_t tmp = |
125 (clamp(abs_coeff + ROUND_POWER_OF_TWO(round_ptr[rc != 0], 1), | 125 (clamp(abs_coeff + ROUND_POWER_OF_TWO(round_ptr[rc != 0], 1), |
126 INT32_MIN, INT32_MAX) * quant) >> 15; | 126 INT32_MIN, INT32_MAX) * quant) >> 15; |
(...skipping 14 matching lines...) Expand all Loading... |
141 const int16_t *dequant_ptr, | 141 const int16_t *dequant_ptr, |
142 uint16_t *eob_ptr, | 142 uint16_t *eob_ptr, |
143 const int16_t *scan, const int16_t *iscan) { | 143 const int16_t *scan, const int16_t *iscan) { |
144 int i, eob = -1; | 144 int i, eob = -1; |
145 // TODO(jingning) Decide the need of these arguments after the | 145 // TODO(jingning) Decide the need of these arguments after the |
146 // quantization process is completed. | 146 // quantization process is completed. |
147 (void)zbin_ptr; | 147 (void)zbin_ptr; |
148 (void)quant_shift_ptr; | 148 (void)quant_shift_ptr; |
149 (void)iscan; | 149 (void)iscan; |
150 | 150 |
151 vpx_memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr)); | 151 memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr)); |
152 vpx_memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr)); | 152 memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr)); |
153 | 153 |
154 if (!skip_block) { | 154 if (!skip_block) { |
155 // Quantization pass: All coefficients with index >= zero_flag are | 155 // Quantization pass: All coefficients with index >= zero_flag are |
156 // skippable. Note: zero_flag can be zero. | 156 // skippable. Note: zero_flag can be zero. |
157 for (i = 0; i < n_coeffs; i++) { | 157 for (i = 0; i < n_coeffs; i++) { |
158 const int rc = scan[i]; | 158 const int rc = scan[i]; |
159 const int coeff = coeff_ptr[rc]; | 159 const int coeff = coeff_ptr[rc]; |
160 const int coeff_sign = (coeff >> 31); | 160 const int coeff_sign = (coeff >> 31); |
161 const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign; | 161 const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign; |
162 | 162 |
(...skipping 25 matching lines...) Expand all Loading... |
188 const int16_t *scan, | 188 const int16_t *scan, |
189 const int16_t *iscan) { | 189 const int16_t *iscan) { |
190 int i; | 190 int i; |
191 int eob = -1; | 191 int eob = -1; |
192 // TODO(jingning) Decide the need of these arguments after the | 192 // TODO(jingning) Decide the need of these arguments after the |
193 // quantization process is completed. | 193 // quantization process is completed. |
194 (void)zbin_ptr; | 194 (void)zbin_ptr; |
195 (void)quant_shift_ptr; | 195 (void)quant_shift_ptr; |
196 (void)iscan; | 196 (void)iscan; |
197 | 197 |
198 vpx_memset(qcoeff_ptr, 0, count * sizeof(*qcoeff_ptr)); | 198 memset(qcoeff_ptr, 0, count * sizeof(*qcoeff_ptr)); |
199 vpx_memset(dqcoeff_ptr, 0, count * sizeof(*dqcoeff_ptr)); | 199 memset(dqcoeff_ptr, 0, count * sizeof(*dqcoeff_ptr)); |
200 | 200 |
201 if (!skip_block) { | 201 if (!skip_block) { |
202 // Quantization pass: All coefficients with index >= zero_flag are | 202 // Quantization pass: All coefficients with index >= zero_flag are |
203 // skippable. Note: zero_flag can be zero. | 203 // skippable. Note: zero_flag can be zero. |
204 for (i = 0; i < count; i++) { | 204 for (i = 0; i < count; i++) { |
205 const int rc = scan[i]; | 205 const int rc = scan[i]; |
206 const int coeff = coeff_ptr[rc]; | 206 const int coeff = coeff_ptr[rc]; |
207 const int coeff_sign = (coeff >> 31); | 207 const int coeff_sign = (coeff >> 31); |
208 const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign; | 208 const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign; |
209 | 209 |
(...skipping 21 matching lines...) Expand all Loading... |
231 const int16_t *quant_shift_ptr, | 231 const int16_t *quant_shift_ptr, |
232 tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, | 232 tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, |
233 const int16_t *dequant_ptr, | 233 const int16_t *dequant_ptr, |
234 uint16_t *eob_ptr, | 234 uint16_t *eob_ptr, |
235 const int16_t *scan, const int16_t *iscan) { | 235 const int16_t *scan, const int16_t *iscan) { |
236 int i, eob = -1; | 236 int i, eob = -1; |
237 (void)zbin_ptr; | 237 (void)zbin_ptr; |
238 (void)quant_shift_ptr; | 238 (void)quant_shift_ptr; |
239 (void)iscan; | 239 (void)iscan; |
240 | 240 |
241 vpx_memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr)); | 241 memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr)); |
242 vpx_memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr)); | 242 memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr)); |
243 | 243 |
244 if (!skip_block) { | 244 if (!skip_block) { |
245 for (i = 0; i < n_coeffs; i++) { | 245 for (i = 0; i < n_coeffs; i++) { |
246 const int rc = scan[i]; | 246 const int rc = scan[i]; |
247 const int coeff = coeff_ptr[rc]; | 247 const int coeff = coeff_ptr[rc]; |
248 const int coeff_sign = (coeff >> 31); | 248 const int coeff_sign = (coeff >> 31); |
249 int tmp = 0; | 249 int tmp = 0; |
250 int abs_coeff = (coeff ^ coeff_sign) - coeff_sign; | 250 int abs_coeff = (coeff ^ coeff_sign) - coeff_sign; |
251 | 251 |
252 if (abs_coeff >= (dequant_ptr[rc != 0] >> 2)) { | 252 if (abs_coeff >= (dequant_ptr[rc != 0] >> 2)) { |
(...skipping 21 matching lines...) Expand all Loading... |
274 tran_low_t *qcoeff_ptr, | 274 tran_low_t *qcoeff_ptr, |
275 tran_low_t *dqcoeff_ptr, | 275 tran_low_t *dqcoeff_ptr, |
276 const int16_t *dequant_ptr, | 276 const int16_t *dequant_ptr, |
277 uint16_t *eob_ptr, | 277 uint16_t *eob_ptr, |
278 const int16_t *scan, const int16_t *iscan) { | 278 const int16_t *scan, const int16_t *iscan) { |
279 int i, eob = -1; | 279 int i, eob = -1; |
280 (void)zbin_ptr; | 280 (void)zbin_ptr; |
281 (void)quant_shift_ptr; | 281 (void)quant_shift_ptr; |
282 (void)iscan; | 282 (void)iscan; |
283 | 283 |
284 vpx_memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr)); | 284 memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr)); |
285 vpx_memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr)); | 285 memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr)); |
286 | 286 |
287 if (!skip_block) { | 287 if (!skip_block) { |
288 for (i = 0; i < n_coeffs; i++) { | 288 for (i = 0; i < n_coeffs; i++) { |
289 const int rc = scan[i]; | 289 const int rc = scan[i]; |
290 const int coeff = coeff_ptr[rc]; | 290 const int coeff = coeff_ptr[rc]; |
291 const int coeff_sign = (coeff >> 31); | 291 const int coeff_sign = (coeff >> 31); |
292 int64_t tmp = 0; | 292 int64_t tmp = 0; |
293 const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign; | 293 const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign; |
294 | 294 |
295 if (abs_coeff >= (dequant_ptr[rc != 0] >> 2)) { | 295 if (abs_coeff >= (dequant_ptr[rc != 0] >> 2)) { |
(...skipping 18 matching lines...) Expand all Loading... |
314 const int16_t *quant_ptr, const int16_t *quant_shift_ptr, | 314 const int16_t *quant_ptr, const int16_t *quant_shift_ptr, |
315 tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, | 315 tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, |
316 const int16_t *dequant_ptr, | 316 const int16_t *dequant_ptr, |
317 uint16_t *eob_ptr, | 317 uint16_t *eob_ptr, |
318 const int16_t *scan, const int16_t *iscan) { | 318 const int16_t *scan, const int16_t *iscan) { |
319 int i, non_zero_count = (int)n_coeffs, eob = -1; | 319 int i, non_zero_count = (int)n_coeffs, eob = -1; |
320 const int zbins[2] = {zbin_ptr[0], zbin_ptr[1]}; | 320 const int zbins[2] = {zbin_ptr[0], zbin_ptr[1]}; |
321 const int nzbins[2] = {zbins[0] * -1, zbins[1] * -1}; | 321 const int nzbins[2] = {zbins[0] * -1, zbins[1] * -1}; |
322 (void)iscan; | 322 (void)iscan; |
323 | 323 |
324 vpx_memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr)); | 324 memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr)); |
325 vpx_memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr)); | 325 memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr)); |
326 | 326 |
327 if (!skip_block) { | 327 if (!skip_block) { |
328 // Pre-scan pass | 328 // Pre-scan pass |
329 for (i = (int)n_coeffs - 1; i >= 0; i--) { | 329 for (i = (int)n_coeffs - 1; i >= 0; i--) { |
330 const int rc = scan[i]; | 330 const int rc = scan[i]; |
331 const int coeff = coeff_ptr[rc]; | 331 const int coeff = coeff_ptr[rc]; |
332 | 332 |
333 if (coeff < zbins[rc != 0] && coeff > nzbins[rc != 0]) | 333 if (coeff < zbins[rc != 0] && coeff > nzbins[rc != 0]) |
334 non_zero_count--; | 334 non_zero_count--; |
335 else | 335 else |
(...skipping 30 matching lines...) Expand all Loading... |
366 const int16_t *quant_shift_ptr, | 366 const int16_t *quant_shift_ptr, |
367 tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, | 367 tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, |
368 const int16_t *dequant_ptr, | 368 const int16_t *dequant_ptr, |
369 uint16_t *eob_ptr, const int16_t *scan, | 369 uint16_t *eob_ptr, const int16_t *scan, |
370 const int16_t *iscan) { | 370 const int16_t *iscan) { |
371 int i, non_zero_count = (int)n_coeffs, eob = -1; | 371 int i, non_zero_count = (int)n_coeffs, eob = -1; |
372 const int zbins[2] = {zbin_ptr[0], zbin_ptr[1]}; | 372 const int zbins[2] = {zbin_ptr[0], zbin_ptr[1]}; |
373 const int nzbins[2] = {zbins[0] * -1, zbins[1] * -1}; | 373 const int nzbins[2] = {zbins[0] * -1, zbins[1] * -1}; |
374 (void)iscan; | 374 (void)iscan; |
375 | 375 |
376 vpx_memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr)); | 376 memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr)); |
377 vpx_memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr)); | 377 memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr)); |
378 | 378 |
379 if (!skip_block) { | 379 if (!skip_block) { |
380 // Pre-scan pass | 380 // Pre-scan pass |
381 for (i = (int)n_coeffs - 1; i >= 0; i--) { | 381 for (i = (int)n_coeffs - 1; i >= 0; i--) { |
382 const int rc = scan[i]; | 382 const int rc = scan[i]; |
383 const int coeff = coeff_ptr[rc]; | 383 const int coeff = coeff_ptr[rc]; |
384 | 384 |
385 if (coeff < zbins[rc != 0] && coeff > nzbins[rc != 0]) | 385 if (coeff < zbins[rc != 0] && coeff > nzbins[rc != 0]) |
386 non_zero_count--; | 386 non_zero_count--; |
387 else | 387 else |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 const int16_t *scan, const int16_t *iscan) { | 424 const int16_t *scan, const int16_t *iscan) { |
425 const int zbins[2] = {ROUND_POWER_OF_TWO(zbin_ptr[0], 1), | 425 const int zbins[2] = {ROUND_POWER_OF_TWO(zbin_ptr[0], 1), |
426 ROUND_POWER_OF_TWO(zbin_ptr[1], 1)}; | 426 ROUND_POWER_OF_TWO(zbin_ptr[1], 1)}; |
427 const int nzbins[2] = {zbins[0] * -1, zbins[1] * -1}; | 427 const int nzbins[2] = {zbins[0] * -1, zbins[1] * -1}; |
428 | 428 |
429 int idx = 0; | 429 int idx = 0; |
430 int idx_arr[1024]; | 430 int idx_arr[1024]; |
431 int i, eob = -1; | 431 int i, eob = -1; |
432 (void)iscan; | 432 (void)iscan; |
433 | 433 |
434 vpx_memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr)); | 434 memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr)); |
435 vpx_memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr)); | 435 memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr)); |
436 | 436 |
437 if (!skip_block) { | 437 if (!skip_block) { |
438 // Pre-scan pass | 438 // Pre-scan pass |
439 for (i = 0; i < n_coeffs; i++) { | 439 for (i = 0; i < n_coeffs; i++) { |
440 const int rc = scan[i]; | 440 const int rc = scan[i]; |
441 const int coeff = coeff_ptr[rc]; | 441 const int coeff = coeff_ptr[rc]; |
442 | 442 |
443 // If the coefficient is out of the base ZBIN range, keep it for | 443 // If the coefficient is out of the base ZBIN range, keep it for |
444 // quantization. | 444 // quantization. |
445 if (coeff >= zbins[rc != 0] || coeff <= nzbins[rc != 0]) | 445 if (coeff >= zbins[rc != 0] || coeff <= nzbins[rc != 0]) |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 const int16_t *scan, const int16_t *iscan) { | 483 const int16_t *scan, const int16_t *iscan) { |
484 const int zbins[2] = {ROUND_POWER_OF_TWO(zbin_ptr[0], 1), | 484 const int zbins[2] = {ROUND_POWER_OF_TWO(zbin_ptr[0], 1), |
485 ROUND_POWER_OF_TWO(zbin_ptr[1], 1)}; | 485 ROUND_POWER_OF_TWO(zbin_ptr[1], 1)}; |
486 const int nzbins[2] = {zbins[0] * -1, zbins[1] * -1}; | 486 const int nzbins[2] = {zbins[0] * -1, zbins[1] * -1}; |
487 | 487 |
488 int idx = 0; | 488 int idx = 0; |
489 int idx_arr[1024]; | 489 int idx_arr[1024]; |
490 int i, eob = -1; | 490 int i, eob = -1; |
491 (void)iscan; | 491 (void)iscan; |
492 | 492 |
493 vpx_memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr)); | 493 memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr)); |
494 vpx_memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr)); | 494 memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr)); |
495 | 495 |
496 if (!skip_block) { | 496 if (!skip_block) { |
497 // Pre-scan pass | 497 // Pre-scan pass |
498 for (i = 0; i < n_coeffs; i++) { | 498 for (i = 0; i < n_coeffs; i++) { |
499 const int rc = scan[i]; | 499 const int rc = scan[i]; |
500 const int coeff = coeff_ptr[rc]; | 500 const int coeff = coeff_ptr[rc]; |
501 | 501 |
502 // If the coefficient is out of the base ZBIN range, keep it for | 502 // If the coefficient is out of the base ZBIN range, keep it for |
503 // quantization. | 503 // quantization. |
504 if (coeff >= zbins[rc != 0] || coeff <= nzbins[rc != 0]) | 504 if (coeff >= zbins[rc != 0] || coeff <= nzbins[rc != 0]) |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 quants->uv_round[q][i] = quants->uv_round[q][1]; | 639 quants->uv_round[q][i] = quants->uv_round[q][1]; |
640 cpi->uv_dequant[q][i] = cpi->uv_dequant[q][1]; | 640 cpi->uv_dequant[q][i] = cpi->uv_dequant[q][1]; |
641 } | 641 } |
642 } | 642 } |
643 } | 643 } |
644 | 644 |
645 void vp9_init_plane_quantizers(VP9_COMP *cpi, MACROBLOCK *x) { | 645 void vp9_init_plane_quantizers(VP9_COMP *cpi, MACROBLOCK *x) { |
646 const VP9_COMMON *const cm = &cpi->common; | 646 const VP9_COMMON *const cm = &cpi->common; |
647 MACROBLOCKD *const xd = &x->e_mbd; | 647 MACROBLOCKD *const xd = &x->e_mbd; |
648 QUANTS *const quants = &cpi->quants; | 648 QUANTS *const quants = &cpi->quants; |
649 const int segment_id = xd->mi[0].src_mi->mbmi.segment_id; | 649 const int segment_id = xd->mi[0]->mbmi.segment_id; |
650 const int qindex = vp9_get_qindex(&cm->seg, segment_id, cm->base_qindex); | 650 const int qindex = vp9_get_qindex(&cm->seg, segment_id, cm->base_qindex); |
651 const int rdmult = vp9_compute_rd_mult(cpi, qindex + cm->y_dc_delta_q); | 651 const int rdmult = vp9_compute_rd_mult(cpi, qindex + cm->y_dc_delta_q); |
652 int i; | 652 int i; |
653 | 653 |
654 // Y | 654 // Y |
655 x->plane[0].quant = quants->y_quant[qindex]; | 655 x->plane[0].quant = quants->y_quant[qindex]; |
656 x->plane[0].quant_fp = quants->y_quant_fp[qindex]; | 656 x->plane[0].quant_fp = quants->y_quant_fp[qindex]; |
657 x->plane[0].round_fp = quants->y_round_fp[qindex]; | 657 x->plane[0].round_fp = quants->y_round_fp[qindex]; |
658 x->plane[0].quant_shift = quants->y_quant_shift[qindex]; | 658 x->plane[0].quant_shift = quants->y_quant_shift[qindex]; |
659 x->plane[0].zbin = quants->y_zbin[qindex]; | 659 x->plane[0].zbin = quants->y_zbin[qindex]; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 | 718 |
719 int vp9_qindex_to_quantizer(int qindex) { | 719 int vp9_qindex_to_quantizer(int qindex) { |
720 int quantizer; | 720 int quantizer; |
721 | 721 |
722 for (quantizer = 0; quantizer < 64; ++quantizer) | 722 for (quantizer = 0; quantizer < 64; ++quantizer) |
723 if (quantizer_to_qindex[quantizer] >= qindex) | 723 if (quantizer_to_qindex[quantizer] >= qindex) |
724 return quantizer; | 724 return quantizer; |
725 | 725 |
726 return 63; | 726 return 63; |
727 } | 727 } |
OLD | NEW |