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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 output[2] = (tran_low_t)fdct_round_shift(s2); | 163 output[2] = (tran_low_t)fdct_round_shift(s2); |
164 output[3] = (tran_low_t)fdct_round_shift(s3); | 164 output[3] = (tran_low_t)fdct_round_shift(s3); |
165 } | 165 } |
166 | 166 |
167 void vp9_fht4x4_c(const int16_t *input, tran_low_t *output, | 167 void vp9_fht4x4_c(const int16_t *input, tran_low_t *output, |
168 int stride, int tx_type) { | 168 int stride, int tx_type) { |
169 if (tx_type == DCT_DCT) { | 169 if (tx_type == DCT_DCT) { |
170 vp9_fdct4x4_c(input, output, stride); | 170 vp9_fdct4x4_c(input, output, stride); |
171 } else { | 171 } else { |
172 tran_low_t out[4 * 4]; | 172 tran_low_t out[4 * 4]; |
173 tran_low_t *outptr = &out[0]; | |
174 int i, j; | 173 int i, j; |
175 tran_low_t temp_in[4], temp_out[4]; | 174 tran_low_t temp_in[4], temp_out[4]; |
176 const transform_2d ht = FHT_4[tx_type]; | 175 const transform_2d ht = FHT_4[tx_type]; |
177 | 176 |
178 // Columns | 177 // Columns |
179 for (i = 0; i < 4; ++i) { | 178 for (i = 0; i < 4; ++i) { |
180 for (j = 0; j < 4; ++j) | 179 for (j = 0; j < 4; ++j) |
181 temp_in[j] = input[j * stride + i] * 16; | 180 temp_in[j] = input[j * stride + i] * 16; |
182 if (i == 0 && temp_in[0]) | 181 if (i == 0 && temp_in[0]) |
183 temp_in[0] += 1; | 182 temp_in[0] += 1; |
184 ht.cols(temp_in, temp_out); | 183 ht.cols(temp_in, temp_out); |
185 for (j = 0; j < 4; ++j) | 184 for (j = 0; j < 4; ++j) |
186 outptr[j * 4 + i] = temp_out[j]; | 185 out[j * 4 + i] = temp_out[j]; |
187 } | 186 } |
188 | 187 |
189 // Rows | 188 // Rows |
190 for (i = 0; i < 4; ++i) { | 189 for (i = 0; i < 4; ++i) { |
191 for (j = 0; j < 4; ++j) | 190 for (j = 0; j < 4; ++j) |
192 temp_in[j] = out[j + i * 4]; | 191 temp_in[j] = out[j + i * 4]; |
193 ht.rows(temp_in, temp_out); | 192 ht.rows(temp_in, temp_out); |
194 for (j = 0; j < 4; ++j) | 193 for (j = 0; j < 4; ++j) |
195 output[j + i * 4] = (temp_out[j] + 1) >> 2; | 194 output[j + i * 4] = (temp_out[j] + 1) >> 2; |
196 } | 195 } |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 } | 331 } |
333 | 332 |
334 void vp9_fdct8x8_quant_c(const int16_t *input, int stride, | 333 void vp9_fdct8x8_quant_c(const int16_t *input, int stride, |
335 tran_low_t *coeff_ptr, intptr_t n_coeffs, | 334 tran_low_t *coeff_ptr, intptr_t n_coeffs, |
336 int skip_block, | 335 int skip_block, |
337 const int16_t *zbin_ptr, const int16_t *round_ptr, | 336 const int16_t *zbin_ptr, const int16_t *round_ptr, |
338 const int16_t *quant_ptr, | 337 const int16_t *quant_ptr, |
339 const int16_t *quant_shift_ptr, | 338 const int16_t *quant_shift_ptr, |
340 tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, | 339 tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, |
341 const int16_t *dequant_ptr, | 340 const int16_t *dequant_ptr, |
342 int zbin_oq_value, uint16_t *eob_ptr, | 341 uint16_t *eob_ptr, |
343 const int16_t *scan, const int16_t *iscan) { | 342 const int16_t *scan, const int16_t *iscan) { |
344 int eob = -1; | 343 int eob = -1; |
345 | 344 |
346 int i, j; | 345 int i, j; |
347 tran_low_t intermediate[64]; | 346 tran_low_t intermediate[64]; |
348 | 347 |
349 // Transform columns | 348 // Transform columns |
350 { | 349 { |
351 tran_low_t *output = intermediate; | 350 tran_low_t *output = intermediate; |
352 tran_high_t s0, s1, s2, s3, s4, s5, s6, s7; // canbe16 | 351 tran_high_t s0, s1, s2, s3, s4, s5, s6, s7; // canbe16 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 for (i = 0; i < 8; ++i) { | 408 for (i = 0; i < 8; ++i) { |
410 vp9_fdct8(&intermediate[i * 8], &coeff_ptr[i * 8]); | 409 vp9_fdct8(&intermediate[i * 8], &coeff_ptr[i * 8]); |
411 for (j = 0; j < 8; ++j) | 410 for (j = 0; j < 8; ++j) |
412 coeff_ptr[j + i * 8] /= 2; | 411 coeff_ptr[j + i * 8] /= 2; |
413 } | 412 } |
414 | 413 |
415 // TODO(jingning) Decide the need of these arguments after the | 414 // TODO(jingning) Decide the need of these arguments after the |
416 // quantization process is completed. | 415 // quantization process is completed. |
417 (void)zbin_ptr; | 416 (void)zbin_ptr; |
418 (void)quant_shift_ptr; | 417 (void)quant_shift_ptr; |
419 (void)zbin_oq_value; | |
420 (void)iscan; | 418 (void)iscan; |
421 | 419 |
422 vpx_memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr)); | 420 vpx_memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr)); |
423 vpx_memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr)); | 421 vpx_memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr)); |
424 | 422 |
425 if (!skip_block) { | 423 if (!skip_block) { |
426 // Quantization pass: All coefficients with index >= zero_flag are | 424 // Quantization pass: All coefficients with index >= zero_flag are |
427 // skippable. Note: zero_flag can be zero. | 425 // skippable. Note: zero_flag can be zero. |
428 for (i = 0; i < n_coeffs; i++) { | 426 for (i = 0; i < n_coeffs; i++) { |
429 const int rc = scan[i]; | 427 const int rc = scan[i]; |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
705 output[6] = (tran_low_t)x5; | 703 output[6] = (tran_low_t)x5; |
706 output[7] = (tran_low_t)-x1; | 704 output[7] = (tran_low_t)-x1; |
707 } | 705 } |
708 | 706 |
709 void vp9_fht8x8_c(const int16_t *input, tran_low_t *output, | 707 void vp9_fht8x8_c(const int16_t *input, tran_low_t *output, |
710 int stride, int tx_type) { | 708 int stride, int tx_type) { |
711 if (tx_type == DCT_DCT) { | 709 if (tx_type == DCT_DCT) { |
712 vp9_fdct8x8_c(input, output, stride); | 710 vp9_fdct8x8_c(input, output, stride); |
713 } else { | 711 } else { |
714 tran_low_t out[64]; | 712 tran_low_t out[64]; |
715 tran_low_t *outptr = &out[0]; | |
716 int i, j; | 713 int i, j; |
717 tran_low_t temp_in[8], temp_out[8]; | 714 tran_low_t temp_in[8], temp_out[8]; |
718 const transform_2d ht = FHT_8[tx_type]; | 715 const transform_2d ht = FHT_8[tx_type]; |
719 | 716 |
720 // Columns | 717 // Columns |
721 for (i = 0; i < 8; ++i) { | 718 for (i = 0; i < 8; ++i) { |
722 for (j = 0; j < 8; ++j) | 719 for (j = 0; j < 8; ++j) |
723 temp_in[j] = input[j * stride + i] * 4; | 720 temp_in[j] = input[j * stride + i] * 4; |
724 ht.cols(temp_in, temp_out); | 721 ht.cols(temp_in, temp_out); |
725 for (j = 0; j < 8; ++j) | 722 for (j = 0; j < 8; ++j) |
726 outptr[j * 8 + i] = temp_out[j]; | 723 out[j * 8 + i] = temp_out[j]; |
727 } | 724 } |
728 | 725 |
729 // Rows | 726 // Rows |
730 for (i = 0; i < 8; ++i) { | 727 for (i = 0; i < 8; ++i) { |
731 for (j = 0; j < 8; ++j) | 728 for (j = 0; j < 8; ++j) |
732 temp_in[j] = out[j + i * 8]; | 729 temp_in[j] = out[j + i * 8]; |
733 ht.rows(temp_in, temp_out); | 730 ht.rows(temp_in, temp_out); |
734 for (j = 0; j < 8; ++j) | 731 for (j = 0; j < 8; ++j) |
735 output[j + i * 8] = (temp_out[j] + (temp_out[j] < 0)) >> 1; | 732 output[j + i * 8] = (temp_out[j] + (temp_out[j] < 0)) >> 1; |
736 } | 733 } |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1097 output[14] = (tran_low_t)x9; | 1094 output[14] = (tran_low_t)x9; |
1098 output[15] = (tran_low_t)-x1; | 1095 output[15] = (tran_low_t)-x1; |
1099 } | 1096 } |
1100 | 1097 |
1101 void vp9_fht16x16_c(const int16_t *input, tran_low_t *output, | 1098 void vp9_fht16x16_c(const int16_t *input, tran_low_t *output, |
1102 int stride, int tx_type) { | 1099 int stride, int tx_type) { |
1103 if (tx_type == DCT_DCT) { | 1100 if (tx_type == DCT_DCT) { |
1104 vp9_fdct16x16_c(input, output, stride); | 1101 vp9_fdct16x16_c(input, output, stride); |
1105 } else { | 1102 } else { |
1106 tran_low_t out[256]; | 1103 tran_low_t out[256]; |
1107 tran_low_t *outptr = &out[0]; | |
1108 int i, j; | 1104 int i, j; |
1109 tran_low_t temp_in[16], temp_out[16]; | 1105 tran_low_t temp_in[16], temp_out[16]; |
1110 const transform_2d ht = FHT_16[tx_type]; | 1106 const transform_2d ht = FHT_16[tx_type]; |
1111 | 1107 |
1112 // Columns | 1108 // Columns |
1113 for (i = 0; i < 16; ++i) { | 1109 for (i = 0; i < 16; ++i) { |
1114 for (j = 0; j < 16; ++j) | 1110 for (j = 0; j < 16; ++j) |
1115 temp_in[j] = input[j * stride + i] * 4; | 1111 temp_in[j] = input[j * stride + i] * 4; |
1116 ht.cols(temp_in, temp_out); | 1112 ht.cols(temp_in, temp_out); |
1117 for (j = 0; j < 16; ++j) | 1113 for (j = 0; j < 16; ++j) |
1118 outptr[j * 16 + i] = (temp_out[j] + 1 + (temp_out[j] < 0)) >> 2; | 1114 out[j * 16 + i] = (temp_out[j] + 1 + (temp_out[j] < 0)) >> 2; |
1119 } | 1115 } |
1120 | 1116 |
1121 // Rows | 1117 // Rows |
1122 for (i = 0; i < 16; ++i) { | 1118 for (i = 0; i < 16; ++i) { |
1123 for (j = 0; j < 16; ++j) | 1119 for (j = 0; j < 16; ++j) |
1124 temp_in[j] = out[j + i * 16]; | 1120 temp_in[j] = out[j + i * 16]; |
1125 ht.rows(temp_in, temp_out); | 1121 ht.rows(temp_in, temp_out); |
1126 for (j = 0; j < 16; ++j) | 1122 for (j = 0; j < 16; ++j) |
1127 output[j + i * 16] = temp_out[j]; | 1123 output[j + i * 16] = temp_out[j]; |
1128 } | 1124 } |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1586 | 1582 |
1587 void vp9_highbd_fdct32x32_c(const int16_t *input, tran_low_t *out, int stride) { | 1583 void vp9_highbd_fdct32x32_c(const int16_t *input, tran_low_t *out, int stride) { |
1588 vp9_fdct32x32_c(input, out, stride); | 1584 vp9_fdct32x32_c(input, out, stride); |
1589 } | 1585 } |
1590 | 1586 |
1591 void vp9_highbd_fdct32x32_rd_c(const int16_t *input, tran_low_t *out, | 1587 void vp9_highbd_fdct32x32_rd_c(const int16_t *input, tran_low_t *out, |
1592 int stride) { | 1588 int stride) { |
1593 vp9_fdct32x32_rd_c(input, out, stride); | 1589 vp9_fdct32x32_rd_c(input, out, stride); |
1594 } | 1590 } |
1595 #endif // CONFIG_VP9_HIGHBITDEPTH | 1591 #endif // CONFIG_VP9_HIGHBITDEPTH |
OLD | NEW |