| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 if (!skip_block) { | 50 if (!skip_block) { |
| 51 const int rc = 0; | 51 const int rc = 0; |
| 52 const int coeff = coeff_ptr[rc]; | 52 const int coeff = coeff_ptr[rc]; |
| 53 const int coeff_sign = (coeff >> 31); | 53 const int coeff_sign = (coeff >> 31); |
| 54 const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign; | 54 const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign; |
| 55 | 55 |
| 56 const int64_t tmp = | 56 const int64_t tmp = |
| 57 (clamp(abs_coeff + round_ptr[rc != 0], INT32_MIN, INT32_MAX) * | 57 (clamp(abs_coeff + round_ptr[rc != 0], INT32_MIN, INT32_MAX) * |
| 58 quant) >> 16; | 58 quant) >> 16; |
| 59 qcoeff_ptr[rc] = (tmp ^ coeff_sign) - coeff_sign; | 59 qcoeff_ptr[rc] = (tran_low_t)((tmp ^ coeff_sign) - coeff_sign); |
| 60 dqcoeff_ptr[rc] = qcoeff_ptr[rc] * dequant_ptr; | 60 dqcoeff_ptr[rc] = qcoeff_ptr[rc] * dequant_ptr; |
| 61 if (tmp) | 61 if (tmp) |
| 62 eob = 0; | 62 eob = 0; |
| 63 } | 63 } |
| 64 *eob_ptr = eob + 1; | 64 *eob_ptr = eob + 1; |
| 65 } | 65 } |
| 66 #endif | 66 #endif |
| 67 | 67 |
| 68 void vp9_quantize_dc_32x32(const tran_low_t *coeff_ptr, int skip_block, | 68 void vp9_quantize_dc_32x32(const tran_low_t *coeff_ptr, int skip_block, |
| 69 const int16_t *round_ptr, const int16_t quant, | 69 const int16_t *round_ptr, const int16_t quant, |
| (...skipping 30 matching lines...) Expand all Loading... |
| 100 | 100 |
| 101 if (!skip_block) { | 101 if (!skip_block) { |
| 102 const int rc = 0; | 102 const int rc = 0; |
| 103 const int coeff = coeff_ptr[rc]; | 103 const int coeff = coeff_ptr[rc]; |
| 104 const int coeff_sign = (coeff >> 31); | 104 const int coeff_sign = (coeff >> 31); |
| 105 const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign; | 105 const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign; |
| 106 | 106 |
| 107 const int64_t tmp = | 107 const int64_t tmp = |
| 108 (clamp(abs_coeff + round_ptr[rc != 0], INT32_MIN, INT32_MAX) * | 108 (clamp(abs_coeff + round_ptr[rc != 0], INT32_MIN, INT32_MAX) * |
| 109 quant) >> 15; | 109 quant) >> 15; |
| 110 qcoeff_ptr[rc] = (tmp ^ coeff_sign) - coeff_sign; | 110 qcoeff_ptr[rc] = (tran_low_t)((tmp ^ coeff_sign) - coeff_sign); |
| 111 dqcoeff_ptr[rc] = qcoeff_ptr[rc] * dequant_ptr / 2; | 111 dqcoeff_ptr[rc] = qcoeff_ptr[rc] * dequant_ptr / 2; |
| 112 if (tmp) | 112 if (tmp) |
| 113 eob = 0; | 113 eob = 0; |
| 114 } | 114 } |
| 115 *eob_ptr = eob + 1; | 115 *eob_ptr = eob + 1; |
| 116 } | 116 } |
| 117 #endif | 117 #endif |
| 118 | 118 |
| 119 void vp9_quantize_fp_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs, | 119 void vp9_quantize_fp_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs, |
| 120 int skip_block, | 120 int skip_block, |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 for (i = 0; i < count; i++) { | 190 for (i = 0; i < count; i++) { |
| 191 const int rc = scan[i]; | 191 const int rc = scan[i]; |
| 192 const int coeff = coeff_ptr[rc]; | 192 const int coeff = coeff_ptr[rc]; |
| 193 const int coeff_sign = (coeff >> 31); | 193 const int coeff_sign = (coeff >> 31); |
| 194 const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign; | 194 const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign; |
| 195 | 195 |
| 196 const int64_t tmp = | 196 const int64_t tmp = |
| 197 (clamp(abs_coeff + round_ptr[rc != 0], INT32_MIN, INT32_MAX) * | 197 (clamp(abs_coeff + round_ptr[rc != 0], INT32_MIN, INT32_MAX) * |
| 198 quant_ptr[rc != 0]) >> 16; | 198 quant_ptr[rc != 0]) >> 16; |
| 199 | 199 |
| 200 qcoeff_ptr[rc] = (tmp ^ coeff_sign) - coeff_sign; | 200 qcoeff_ptr[rc] = (tran_low_t)((tmp ^ coeff_sign) - coeff_sign); |
| 201 dqcoeff_ptr[rc] = qcoeff_ptr[rc] * dequant_ptr[rc != 0]; | 201 dqcoeff_ptr[rc] = qcoeff_ptr[rc] * dequant_ptr[rc != 0]; |
| 202 | 202 |
| 203 if (tmp) | 203 if (tmp) |
| 204 eob = i; | 204 eob = i; |
| 205 } | 205 } |
| 206 } | 206 } |
| 207 *eob_ptr = eob + 1; | 207 *eob_ptr = eob + 1; |
| 208 } | 208 } |
| 209 #endif | 209 #endif |
| 210 | 210 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 const int rc = scan[i]; | 277 const int rc = scan[i]; |
| 278 const int coeff = coeff_ptr[rc]; | 278 const int coeff = coeff_ptr[rc]; |
| 279 const int coeff_sign = (coeff >> 31); | 279 const int coeff_sign = (coeff >> 31); |
| 280 int64_t tmp = 0; | 280 int64_t tmp = 0; |
| 281 const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign; | 281 const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign; |
| 282 | 282 |
| 283 if (abs_coeff >= (dequant_ptr[rc != 0] >> 2)) { | 283 if (abs_coeff >= (dequant_ptr[rc != 0] >> 2)) { |
| 284 tmp = clamp(abs_coeff + ROUND_POWER_OF_TWO(round_ptr[rc != 0], 1), | 284 tmp = clamp(abs_coeff + ROUND_POWER_OF_TWO(round_ptr[rc != 0], 1), |
| 285 INT32_MIN, INT32_MAX); | 285 INT32_MIN, INT32_MAX); |
| 286 tmp = (tmp * quant_ptr[rc != 0]) >> 15; | 286 tmp = (tmp * quant_ptr[rc != 0]) >> 15; |
| 287 qcoeff_ptr[rc] = (tmp ^ coeff_sign) - coeff_sign; | 287 qcoeff_ptr[rc] = (tran_low_t)((tmp ^ coeff_sign) - coeff_sign); |
| 288 dqcoeff_ptr[rc] = qcoeff_ptr[rc] * dequant_ptr[rc != 0] / 2; | 288 dqcoeff_ptr[rc] = qcoeff_ptr[rc] * dequant_ptr[rc != 0] / 2; |
| 289 } | 289 } |
| 290 | 290 |
| 291 if (tmp) | 291 if (tmp) |
| 292 eob = i; | 292 eob = i; |
| 293 } | 293 } |
| 294 } | 294 } |
| 295 *eob_ptr = eob + 1; | 295 *eob_ptr = eob + 1; |
| 296 } | 296 } |
| 297 #endif | 297 #endif |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 const int rc = scan[i]; | 386 const int rc = scan[i]; |
| 387 const int coeff = coeff_ptr[rc]; | 387 const int coeff = coeff_ptr[rc]; |
| 388 const int coeff_sign = (coeff >> 31); | 388 const int coeff_sign = (coeff >> 31); |
| 389 const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign; | 389 const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign; |
| 390 | 390 |
| 391 if (abs_coeff >= zbins[rc != 0]) { | 391 if (abs_coeff >= zbins[rc != 0]) { |
| 392 int64_t tmp = clamp(abs_coeff + round_ptr[rc != 0], | 392 int64_t tmp = clamp(abs_coeff + round_ptr[rc != 0], |
| 393 INT32_MIN, INT32_MAX); | 393 INT32_MIN, INT32_MAX); |
| 394 tmp = ((((tmp * quant_ptr[rc != 0]) >> 16) + tmp) * | 394 tmp = ((((tmp * quant_ptr[rc != 0]) >> 16) + tmp) * |
| 395 quant_shift_ptr[rc != 0]) >> 16; // quantization | 395 quant_shift_ptr[rc != 0]) >> 16; // quantization |
| 396 qcoeff_ptr[rc] = (tmp ^ coeff_sign) - coeff_sign; | 396 qcoeff_ptr[rc] = (tran_low_t)((tmp ^ coeff_sign) - coeff_sign); |
| 397 dqcoeff_ptr[rc] = qcoeff_ptr[rc] * dequant_ptr[rc != 0]; | 397 dqcoeff_ptr[rc] = qcoeff_ptr[rc] * dequant_ptr[rc != 0]; |
| 398 | 398 |
| 399 if (tmp) | 399 if (tmp) |
| 400 eob = i; | 400 eob = i; |
| 401 } | 401 } |
| 402 } | 402 } |
| 403 } | 403 } |
| 404 *eob_ptr = eob + 1; | 404 *eob_ptr = eob + 1; |
| 405 } | 405 } |
| 406 #endif | 406 #endif |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 const int rc = scan[idx_arr[i]]; | 503 const int rc = scan[idx_arr[i]]; |
| 504 const int coeff = coeff_ptr[rc]; | 504 const int coeff = coeff_ptr[rc]; |
| 505 const int coeff_sign = (coeff >> 31); | 505 const int coeff_sign = (coeff >> 31); |
| 506 const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign; | 506 const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign; |
| 507 int64_t tmp = clamp(abs_coeff + | 507 int64_t tmp = clamp(abs_coeff + |
| 508 ROUND_POWER_OF_TWO(round_ptr[rc != 0], 1), | 508 ROUND_POWER_OF_TWO(round_ptr[rc != 0], 1), |
| 509 INT32_MIN, INT32_MAX); | 509 INT32_MIN, INT32_MAX); |
| 510 tmp = ((((tmp * quant_ptr[rc != 0]) >> 16) + tmp) * | 510 tmp = ((((tmp * quant_ptr[rc != 0]) >> 16) + tmp) * |
| 511 quant_shift_ptr[rc != 0]) >> 15; | 511 quant_shift_ptr[rc != 0]) >> 15; |
| 512 | 512 |
| 513 qcoeff_ptr[rc] = (tmp ^ coeff_sign) - coeff_sign; | 513 qcoeff_ptr[rc] = (tran_low_t)((tmp ^ coeff_sign) - coeff_sign); |
| 514 dqcoeff_ptr[rc] = qcoeff_ptr[rc] * dequant_ptr[rc != 0] / 2; | 514 dqcoeff_ptr[rc] = qcoeff_ptr[rc] * dequant_ptr[rc != 0] / 2; |
| 515 | 515 |
| 516 if (tmp) | 516 if (tmp) |
| 517 eob = idx_arr[i]; | 517 eob = idx_arr[i]; |
| 518 } | 518 } |
| 519 } | 519 } |
| 520 *eob_ptr = eob + 1; | 520 *eob_ptr = eob + 1; |
| 521 } | 521 } |
| 522 #endif | 522 #endif |
| 523 | 523 |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 | 732 |
| 733 int vp9_qindex_to_quantizer(int qindex) { | 733 int vp9_qindex_to_quantizer(int qindex) { |
| 734 int quantizer; | 734 int quantizer; |
| 735 | 735 |
| 736 for (quantizer = 0; quantizer < 64; ++quantizer) | 736 for (quantizer = 0; quantizer < 64; ++quantizer) |
| 737 if (quantizer_to_qindex[quantizer] >= qindex) | 737 if (quantizer_to_qindex[quantizer] >= qindex) |
| 738 return quantizer; | 738 return quantizer; |
| 739 | 739 |
| 740 return 63; | 740 return 63; |
| 741 } | 741 } |
| OLD | NEW |