OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 |
11 #include <assert.h> | 11 #include <assert.h> |
12 #include <stdio.h> | 12 #include <stdio.h> |
13 | 13 |
14 #include "./vpx_dsp_rtcd.h" | 14 #include "./vpx_dsp_rtcd.h" |
15 #include "vpx_dsp/mips/vpx_common_dspr2.h" | 15 #include "vpx_dsp/mips/convolve_common_dspr2.h" |
16 #include "vpx_dsp/vpx_dsp_common.h" | 16 #include "vpx_dsp/vpx_dsp_common.h" |
17 #include "vpx_dsp/vpx_filter.h" | 17 #include "vpx_dsp/vpx_filter.h" |
18 #include "vpx_ports/mem.h" | 18 #include "vpx_ports/mem.h" |
19 | 19 |
20 #if HAVE_DSPR2 | 20 #if HAVE_DSPR2 |
21 uint8_t vpx_ff_cropTbl_a[256 + 2 * CROP_WIDTH]; | |
22 uint8_t *vpx_ff_cropTbl; | |
23 | |
24 void vpx_dsputil_static_init(void) { | |
25 int i; | |
26 | |
27 for (i = 0; i < 256; i++) vpx_ff_cropTbl_a[i + CROP_WIDTH] = i; | |
28 | |
29 for (i = 0; i < CROP_WIDTH; i++) { | |
30 vpx_ff_cropTbl_a[i] = 0; | |
31 vpx_ff_cropTbl_a[i + CROP_WIDTH + 256] = 255; | |
32 } | |
33 | |
34 vpx_ff_cropTbl = &vpx_ff_cropTbl_a[CROP_WIDTH]; | |
35 } | |
36 | |
37 static void convolve_horiz_4_transposed_dspr2(const uint8_t *src, | 21 static void convolve_horiz_4_transposed_dspr2(const uint8_t *src, |
38 int32_t src_stride, | 22 int32_t src_stride, |
39 uint8_t *dst, | 23 uint8_t *dst, |
40 int32_t dst_stride, | 24 int32_t dst_stride, |
41 const int16_t *filter_x0, | 25 const int16_t *filter_x0, |
42 int32_t h) { | 26 int32_t h) { |
43 int32_t y; | 27 int32_t y; |
44 uint8_t *cm = vpx_ff_cropTbl; | 28 uint8_t *cm = vpx_ff_cropTbl; |
45 uint8_t *dst_ptr; | 29 uint8_t *dst_ptr; |
46 int32_t vector1b, vector2b, vector3b, vector4b; | 30 int32_t vector1b, vector2b, vector3b, vector4b; |
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
945 | 929 |
946 void vpx_convolve8_dspr2(const uint8_t *src, ptrdiff_t src_stride, | 930 void vpx_convolve8_dspr2(const uint8_t *src, ptrdiff_t src_stride, |
947 uint8_t *dst, ptrdiff_t dst_stride, | 931 uint8_t *dst, ptrdiff_t dst_stride, |
948 const int16_t *filter_x, int x_step_q4, | 932 const int16_t *filter_x, int x_step_q4, |
949 const int16_t *filter_y, int y_step_q4, | 933 const int16_t *filter_y, int y_step_q4, |
950 int w, int h) { | 934 int w, int h) { |
951 DECLARE_ALIGNED(32, uint8_t, temp[64 * 135]); | 935 DECLARE_ALIGNED(32, uint8_t, temp[64 * 135]); |
952 int32_t intermediate_height = ((h * y_step_q4) >> 4) + 7; | 936 int32_t intermediate_height = ((h * y_step_q4) >> 4) + 7; |
953 uint32_t pos = 38; | 937 uint32_t pos = 38; |
954 | 938 |
| 939 assert(x_step_q4 == 16); |
| 940 assert(y_step_q4 == 16); |
| 941 assert(((const int32_t *)filter_x)[1] != 0x800000); |
| 942 assert(((const int32_t *)filter_y)[1] != 0x800000); |
| 943 |
| 944 |
955 /* bit positon for extract from acc */ | 945 /* bit positon for extract from acc */ |
956 __asm__ __volatile__ ( | 946 __asm__ __volatile__ ( |
957 "wrdsp %[pos], 1 \n\t" | 947 "wrdsp %[pos], 1 \n\t" |
958 : | 948 : |
959 : [pos] "r" (pos) | 949 : [pos] "r" (pos) |
960 ); | 950 ); |
961 | 951 |
962 if (intermediate_height < h) | 952 if (intermediate_height < h) |
963 intermediate_height = h; | 953 intermediate_height = h; |
964 | 954 |
965 if (x_step_q4 != 16 || y_step_q4 != 16) | |
966 return vpx_convolve8_c(src, src_stride, | |
967 dst, dst_stride, | |
968 filter_x, x_step_q4, | |
969 filter_y, y_step_q4, | |
970 w, h); | |
971 | |
972 if ((((const int32_t *)filter_x)[1] == 0x800000) | |
973 && (((const int32_t *)filter_y)[1] == 0x800000)) | |
974 return vpx_convolve_copy(src, src_stride, | |
975 dst, dst_stride, | |
976 filter_x, x_step_q4, | |
977 filter_y, y_step_q4, | |
978 w, h); | |
979 | |
980 /* copy the src to dst */ | 955 /* copy the src to dst */ |
981 if (filter_x[3] == 0x80) { | 956 if (filter_x[3] == 0x80) { |
982 copy_horiz_transposed(src - src_stride * 3, src_stride, | 957 copy_horiz_transposed(src - src_stride * 3, src_stride, |
983 temp, intermediate_height, | 958 temp, intermediate_height, |
984 w, intermediate_height); | 959 w, intermediate_height); |
985 } else if (((const int32_t *)filter_x)[0] == 0) { | 960 } else if (((const int32_t *)filter_x)[0] == 0) { |
986 vpx_convolve2_dspr2(src - src_stride * 3, src_stride, | 961 vpx_convolve2_dspr2(src - src_stride * 3, src_stride, |
987 temp, intermediate_height, | 962 temp, intermediate_height, |
988 filter_x, | 963 filter_x, |
989 w, intermediate_height); | 964 w, intermediate_height); |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1273 dst[x] = src[x]; | 1248 dst[x] = src[x]; |
1274 } | 1249 } |
1275 | 1250 |
1276 src += src_stride; | 1251 src += src_stride; |
1277 dst += dst_stride; | 1252 dst += dst_stride; |
1278 } | 1253 } |
1279 break; | 1254 break; |
1280 } | 1255 } |
1281 } | 1256 } |
1282 #endif | 1257 #endif |
OLD | NEW |