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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 for (i = 0; i < 8; ++i) { | 218 for (i = 0; i < 8; ++i) { |
219 for (j = 0; j < 8; ++j) | 219 for (j = 0; j < 8; ++j) |
220 temp_in[j] = out[j * 8 + i]; | 220 temp_in[j] = out[j * 8 + i]; |
221 idct8_1d(temp_in, temp_out); | 221 idct8_1d(temp_in, temp_out); |
222 for (j = 0; j < 8; ++j) | 222 for (j = 0; j < 8; ++j) |
223 dest[j * dest_stride + i] = clip_pixel(ROUND_POWER_OF_TWO(temp_out[j], 5) | 223 dest[j * dest_stride + i] = clip_pixel(ROUND_POWER_OF_TWO(temp_out[j], 5) |
224 + dest[j * dest_stride + i]); | 224 + dest[j * dest_stride + i]); |
225 } | 225 } |
226 } | 226 } |
227 | 227 |
| 228 void vp9_short_idct8x8_1_add_c(int16_t *input, uint8_t *dest, int dest_stride) { |
| 229 int i, j; |
| 230 int a1; |
| 231 int16_t out = dct_const_round_shift(input[0] * cospi_16_64); |
| 232 out = dct_const_round_shift(out * cospi_16_64); |
| 233 a1 = ROUND_POWER_OF_TWO(out, 5); |
| 234 for (j = 0; j < 8; ++j) { |
| 235 for (i = 0; i < 8; ++i) |
| 236 dest[i] = clip_pixel(dest[i] + a1); |
| 237 dest += dest_stride; |
| 238 } |
| 239 } |
| 240 |
228 static void iadst4_1d(int16_t *input, int16_t *output) { | 241 static void iadst4_1d(int16_t *input, int16_t *output) { |
229 int s0, s1, s2, s3, s4, s5, s6, s7; | 242 int s0, s1, s2, s3, s4, s5, s6, s7; |
230 | 243 |
231 int x0 = input[0]; | 244 int x0 = input[0]; |
232 int x1 = input[1]; | 245 int x1 = input[1]; |
233 int x2 = input[2]; | 246 int x2 = input[2]; |
234 int x3 = input[3]; | 247 int x3 = input[3]; |
235 | 248 |
236 if (!(x0 | x1 | x2 | x3)) { | 249 if (!(x0 | x1 | x2 | x3)) { |
237 output[0] = output[1] = output[2] = output[3] = 0; | 250 output[0] = output[1] = output[2] = output[3] = 0; |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 for (i = 0; i < 8; ++i) { | 439 for (i = 0; i < 8; ++i) { |
427 for (j = 0; j < 8; ++j) | 440 for (j = 0; j < 8; ++j) |
428 temp_in[j] = out[j * 8 + i]; | 441 temp_in[j] = out[j * 8 + i]; |
429 idct8_1d(temp_in, temp_out); | 442 idct8_1d(temp_in, temp_out); |
430 for (j = 0; j < 8; ++j) | 443 for (j = 0; j < 8; ++j) |
431 dest[j * dest_stride + i] = clip_pixel(ROUND_POWER_OF_TWO(temp_out[j], 5) | 444 dest[j * dest_stride + i] = clip_pixel(ROUND_POWER_OF_TWO(temp_out[j], 5) |
432 + dest[j * dest_stride + i]); | 445 + dest[j * dest_stride + i]); |
433 } | 446 } |
434 } | 447 } |
435 | 448 |
436 void vp9_short_idct1_8x8_c(int16_t *input, int16_t *output) { | |
437 int16_t out = dct_const_round_shift(input[0] * cospi_16_64); | |
438 out = dct_const_round_shift(out * cospi_16_64); | |
439 output[0] = ROUND_POWER_OF_TWO(out, 5); | |
440 } | |
441 | |
442 static void idct16_1d(int16_t *input, int16_t *output) { | 449 static void idct16_1d(int16_t *input, int16_t *output) { |
443 int16_t step1[16], step2[16]; | 450 int16_t step1[16], step2[16]; |
444 int temp1, temp2; | 451 int temp1, temp2; |
445 | 452 |
446 // stage 1 | 453 // stage 1 |
447 step1[0] = input[0/2]; | 454 step1[0] = input[0/2]; |
448 step1[1] = input[16/2]; | 455 step1[1] = input[16/2]; |
449 step1[2] = input[8/2]; | 456 step1[2] = input[8/2]; |
450 step1[3] = input[24/2]; | 457 step1[3] = input[24/2]; |
451 step1[4] = input[4/2]; | 458 step1[4] = input[4/2]; |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
850 for (i = 0; i < 16; ++i) { | 857 for (i = 0; i < 16; ++i) { |
851 for (j = 0; j < 16; ++j) | 858 for (j = 0; j < 16; ++j) |
852 temp_in[j] = out[j*16 + i]; | 859 temp_in[j] = out[j*16 + i]; |
853 idct16_1d(temp_in, temp_out); | 860 idct16_1d(temp_in, temp_out); |
854 for (j = 0; j < 16; ++j) | 861 for (j = 0; j < 16; ++j) |
855 dest[j * dest_stride + i] = clip_pixel(ROUND_POWER_OF_TWO(temp_out[j], 6) | 862 dest[j * dest_stride + i] = clip_pixel(ROUND_POWER_OF_TWO(temp_out[j], 6) |
856 + dest[j * dest_stride + i]); | 863 + dest[j * dest_stride + i]); |
857 } | 864 } |
858 } | 865 } |
859 | 866 |
860 void vp9_short_idct1_16x16_c(int16_t *input, int16_t *output) { | 867 void vp9_short_idct16x16_1_add_c(int16_t *input, uint8_t *dest, |
| 868 int dest_stride) { |
| 869 int i, j; |
| 870 int a1; |
861 int16_t out = dct_const_round_shift(input[0] * cospi_16_64); | 871 int16_t out = dct_const_round_shift(input[0] * cospi_16_64); |
862 out = dct_const_round_shift(out * cospi_16_64); | 872 out = dct_const_round_shift(out * cospi_16_64); |
863 output[0] = ROUND_POWER_OF_TWO(out, 6); | 873 a1 = ROUND_POWER_OF_TWO(out, 6); |
| 874 for (j = 0; j < 16; ++j) { |
| 875 for (i = 0; i < 16; ++i) |
| 876 dest[i] = clip_pixel(dest[i] + a1); |
| 877 dest += dest_stride; |
| 878 } |
864 } | 879 } |
865 | 880 |
866 static void idct32_1d(int16_t *input, int16_t *output) { | 881 static void idct32_1d(int16_t *input, int16_t *output) { |
867 int16_t step1[32], step2[32]; | 882 int16_t step1[32], step2[32]; |
868 int temp1, temp2; | 883 int temp1, temp2; |
869 | 884 |
870 // stage 1 | 885 // stage 1 |
871 step1[0] = input[0]; | 886 step1[0] = input[0]; |
872 step1[1] = input[16]; | 887 step1[1] = input[16]; |
873 step1[2] = input[8]; | 888 step1[2] = input[8]; |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1252 dest[j * dest_stride + i] = clip_pixel(ROUND_POWER_OF_TWO(temp_out[j], 6) | 1267 dest[j * dest_stride + i] = clip_pixel(ROUND_POWER_OF_TWO(temp_out[j], 6) |
1253 + dest[j * dest_stride + i]); | 1268 + dest[j * dest_stride + i]); |
1254 } | 1269 } |
1255 } | 1270 } |
1256 | 1271 |
1257 void vp9_short_idct1_32x32_c(int16_t *input, int16_t *output) { | 1272 void vp9_short_idct1_32x32_c(int16_t *input, int16_t *output) { |
1258 int16_t out = dct_const_round_shift(input[0] * cospi_16_64); | 1273 int16_t out = dct_const_round_shift(input[0] * cospi_16_64); |
1259 out = dct_const_round_shift(out * cospi_16_64); | 1274 out = dct_const_round_shift(out * cospi_16_64); |
1260 output[0] = ROUND_POWER_OF_TWO(out, 6); | 1275 output[0] = ROUND_POWER_OF_TWO(out, 6); |
1261 } | 1276 } |
1262 | |
1263 void vp9_short_idct10_32x32_add_c(int16_t *input, uint8_t *dest, | |
1264 int dest_stride) { | |
1265 int16_t out[32 * 32] = { 0 }; | |
1266 int16_t *outptr = out; | |
1267 int i, j; | |
1268 int16_t temp_in[32], temp_out[32]; | |
1269 | |
1270 // First transform rows. Since all non-zero dct coefficients are in | |
1271 // upper-left 4x4 area, we only need to calculate first 4 rows here. | |
1272 for (i = 0; i < 4; ++i) { | |
1273 idct32_1d(input, outptr); | |
1274 input += 32; | |
1275 outptr += 32; | |
1276 } | |
1277 | |
1278 // Columns | |
1279 for (i = 0; i < 32; ++i) { | |
1280 for (j = 0; j < 32; ++j) | |
1281 temp_in[j] = out[j * 32 + i]; | |
1282 idct32_1d(temp_in, temp_out); | |
1283 for (j = 0; j < 32; ++j) | |
1284 dest[j * dest_stride + i] = clip_pixel(ROUND_POWER_OF_TWO(temp_out[j], 6) | |
1285 + dest[j * dest_stride + i]); | |
1286 } | |
1287 } | |
OLD | NEW |