| 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_convolve.h" | 16 #include "vpx_dsp/vpx_convolve.h" |
| 17 #include "vpx_dsp/vpx_dsp_common.h" | 17 #include "vpx_dsp/vpx_dsp_common.h" |
| 18 #include "vpx_ports/mem.h" | 18 #include "vpx_ports/mem.h" |
| 19 | 19 |
| 20 #if HAVE_DSPR2 | 20 #if HAVE_DSPR2 |
| 21 static void convolve_avg_horiz_4_dspr2(const uint8_t *src, | 21 static void convolve_avg_horiz_4_dspr2(const uint8_t *src, |
| 22 int32_t src_stride, | 22 int32_t src_stride, |
| 23 uint8_t *dst, | 23 uint8_t *dst, |
| 24 int32_t dst_stride, | 24 int32_t dst_stride, |
| 25 const int16_t *filter_x0, | 25 const int16_t *filter_x0, |
| (...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 950 src_ptr += src_stride; | 950 src_ptr += src_stride; |
| 951 dst_ptr += dst_stride; | 951 dst_ptr += dst_stride; |
| 952 } | 952 } |
| 953 } | 953 } |
| 954 | 954 |
| 955 void vpx_convolve8_avg_horiz_dspr2(const uint8_t *src, ptrdiff_t src_stride, | 955 void vpx_convolve8_avg_horiz_dspr2(const uint8_t *src, ptrdiff_t src_stride, |
| 956 uint8_t *dst, ptrdiff_t dst_stride, | 956 uint8_t *dst, ptrdiff_t dst_stride, |
| 957 const int16_t *filter_x, int x_step_q4, | 957 const int16_t *filter_x, int x_step_q4, |
| 958 const int16_t *filter_y, int y_step_q4, | 958 const int16_t *filter_y, int y_step_q4, |
| 959 int w, int h) { | 959 int w, int h) { |
| 960 if (((const int32_t *)filter_x)[1] == 0x800000) { | 960 assert(x_step_q4 == 16); |
| 961 vpx_convolve_avg(src, src_stride, | 961 assert(((const int32_t *)filter_x)[1] != 0x800000); |
| 962 dst, dst_stride, | 962 |
| 963 filter_x, x_step_q4, | 963 if (((const int32_t *)filter_x)[0] == 0) { |
| 964 filter_y, y_step_q4, | |
| 965 w, h); | |
| 966 } else if (((const int32_t *)filter_x)[0] == 0) { | |
| 967 vpx_convolve2_avg_horiz_dspr2(src, src_stride, | 964 vpx_convolve2_avg_horiz_dspr2(src, src_stride, |
| 968 dst, dst_stride, | 965 dst, dst_stride, |
| 969 filter_x, x_step_q4, | 966 filter_x, x_step_q4, |
| 970 filter_y, y_step_q4, | 967 filter_y, y_step_q4, |
| 971 w, h); | 968 w, h); |
| 972 } else { | 969 } else { |
| 973 if (16 == x_step_q4) { | 970 uint32_t pos = 38; |
| 974 uint32_t pos = 38; | |
| 975 | 971 |
| 976 src -= 3; | 972 src -= 3; |
| 977 | 973 |
| 978 /* bit positon for extract from acc */ | 974 /* bit positon for extract from acc */ |
| 979 __asm__ __volatile__ ( | 975 __asm__ __volatile__ ( |
| 980 "wrdsp %[pos], 1 \n\t" | 976 "wrdsp %[pos], 1 \n\t" |
| 981 : | 977 : |
| 982 : [pos] "r" (pos) | 978 : [pos] "r" (pos) |
| 983 ); | 979 ); |
| 984 | 980 |
| 985 /* prefetch data to cache memory */ | 981 /* prefetch data to cache memory */ |
| 986 prefetch_load(src); | 982 prefetch_load(src); |
| 987 prefetch_load(src + 32); | 983 prefetch_load(src + 32); |
| 988 prefetch_store(dst); | 984 prefetch_store(dst); |
| 989 | 985 |
| 990 switch (w) { | 986 switch (w) { |
| 991 case 4: | 987 case 4: |
| 992 convolve_avg_horiz_4_dspr2(src, src_stride, | 988 convolve_avg_horiz_4_dspr2(src, src_stride, |
| 993 dst, dst_stride, | 989 dst, dst_stride, |
| 994 filter_x, h); | 990 filter_x, h); |
| 995 break; | 991 break; |
| 996 case 8: | 992 case 8: |
| 997 convolve_avg_horiz_8_dspr2(src, src_stride, | 993 convolve_avg_horiz_8_dspr2(src, src_stride, |
| 998 dst, dst_stride, | 994 dst, dst_stride, |
| 999 filter_x, h); | 995 filter_x, h); |
| 1000 break; | 996 break; |
| 1001 case 16: | 997 case 16: |
| 1002 convolve_avg_horiz_16_dspr2(src, src_stride, | 998 convolve_avg_horiz_16_dspr2(src, src_stride, |
| 1003 dst, dst_stride, | 999 dst, dst_stride, |
| 1004 filter_x, h, 1); | 1000 filter_x, h, 1); |
| 1005 break; | 1001 break; |
| 1006 case 32: | 1002 case 32: |
| 1007 convolve_avg_horiz_16_dspr2(src, src_stride, | 1003 convolve_avg_horiz_16_dspr2(src, src_stride, |
| 1008 dst, dst_stride, | 1004 dst, dst_stride, |
| 1009 filter_x, h, 2); | 1005 filter_x, h, 2); |
| 1010 break; | 1006 break; |
| 1011 case 64: | 1007 case 64: |
| 1012 prefetch_load(src + 64); | 1008 prefetch_load(src + 64); |
| 1013 prefetch_store(dst + 32); | 1009 prefetch_store(dst + 32); |
| 1014 | 1010 |
| 1015 convolve_avg_horiz_64_dspr2(src, src_stride, | 1011 convolve_avg_horiz_64_dspr2(src, src_stride, |
| 1016 dst, dst_stride, | |
| 1017 filter_x, h); | |
| 1018 break; | |
| 1019 default: | |
| 1020 vpx_convolve8_avg_horiz_c(src + 3, src_stride, | |
| 1021 dst, dst_stride, | 1012 dst, dst_stride, |
| 1022 filter_x, x_step_q4, | 1013 filter_x, h); |
| 1023 filter_y, y_step_q4, | 1014 break; |
| 1024 w, h); | 1015 default: |
| 1025 break; | 1016 vpx_convolve8_avg_horiz_c(src + 3, src_stride, |
| 1026 } | 1017 dst, dst_stride, |
| 1027 } else { | 1018 filter_x, x_step_q4, |
| 1028 vpx_convolve8_avg_horiz_c(src, src_stride, | 1019 filter_y, y_step_q4, |
| 1029 dst, dst_stride, | 1020 w, h); |
| 1030 filter_x, x_step_q4, | 1021 break; |
| 1031 filter_y, y_step_q4, | |
| 1032 w, h); | |
| 1033 } | 1022 } |
| 1034 } | 1023 } |
| 1035 } | 1024 } |
| 1036 #endif | 1025 #endif |
| OLD | NEW |