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 static void convolve_horiz_4_dspr2(const uint8_t *src, | 21 static void convolve_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 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 src_ptr += src_stride; | 834 src_ptr += src_stride; |
835 dst_ptr += dst_stride; | 835 dst_ptr += dst_stride; |
836 } | 836 } |
837 } | 837 } |
838 | 838 |
839 void vpx_convolve8_horiz_dspr2(const uint8_t *src, ptrdiff_t src_stride, | 839 void vpx_convolve8_horiz_dspr2(const uint8_t *src, ptrdiff_t src_stride, |
840 uint8_t *dst, ptrdiff_t dst_stride, | 840 uint8_t *dst, ptrdiff_t dst_stride, |
841 const int16_t *filter_x, int x_step_q4, | 841 const int16_t *filter_x, int x_step_q4, |
842 const int16_t *filter_y, int y_step_q4, | 842 const int16_t *filter_y, int y_step_q4, |
843 int w, int h) { | 843 int w, int h) { |
844 if (((const int32_t *)filter_x)[1] == 0x800000) { | 844 assert(x_step_q4 == 16); |
845 vpx_convolve_copy(src, src_stride, | 845 assert(((const int32_t *)filter_x)[1] != 0x800000); |
846 dst, dst_stride, | 846 |
847 filter_x, x_step_q4, | 847 if (((const int32_t *)filter_x)[0] == 0) { |
848 filter_y, y_step_q4, | |
849 w, h); | |
850 } else if (((const int32_t *)filter_x)[0] == 0) { | |
851 vpx_convolve2_horiz_dspr2(src, src_stride, | 848 vpx_convolve2_horiz_dspr2(src, src_stride, |
852 dst, dst_stride, | 849 dst, dst_stride, |
853 filter_x, x_step_q4, | 850 filter_x, x_step_q4, |
854 filter_y, y_step_q4, | 851 filter_y, y_step_q4, |
855 w, h); | 852 w, h); |
856 } else { | 853 } else { |
857 if (16 == x_step_q4) { | 854 uint32_t pos = 38; |
858 uint32_t pos = 38; | |
859 | 855 |
860 prefetch_load((const uint8_t *)filter_x); | 856 prefetch_load((const uint8_t *)filter_x); |
861 src -= 3; | 857 src -= 3; |
862 | 858 |
863 /* bit positon for extract from acc */ | 859 /* bit positon for extract from acc */ |
864 __asm__ __volatile__ ( | 860 __asm__ __volatile__ ( |
865 "wrdsp %[pos], 1 \n\t" | 861 "wrdsp %[pos], 1 \n\t" |
866 : | 862 : |
867 : [pos] "r" (pos) | 863 : [pos] "r" (pos) |
868 ); | 864 ); |
869 | 865 |
870 /* prefetch data to cache memory */ | 866 /* prefetch data to cache memory */ |
871 prefetch_load(src); | 867 prefetch_load(src); |
872 prefetch_load(src + 32); | 868 prefetch_load(src + 32); |
873 prefetch_store(dst); | 869 prefetch_store(dst); |
874 | 870 |
875 switch (w) { | 871 switch (w) { |
876 case 4: | 872 case 4: |
877 convolve_horiz_4_dspr2(src, (int32_t)src_stride, | 873 convolve_horiz_4_dspr2(src, (int32_t)src_stride, |
878 dst, (int32_t)dst_stride, | 874 dst, (int32_t)dst_stride, |
879 filter_x, (int32_t)h); | 875 filter_x, (int32_t)h); |
880 break; | 876 break; |
881 case 8: | 877 case 8: |
882 convolve_horiz_8_dspr2(src, (int32_t)src_stride, | 878 convolve_horiz_8_dspr2(src, (int32_t)src_stride, |
883 dst, (int32_t)dst_stride, | 879 dst, (int32_t)dst_stride, |
884 filter_x, (int32_t)h); | 880 filter_x, (int32_t)h); |
885 break; | 881 break; |
886 case 16: | 882 case 16: |
887 convolve_horiz_16_dspr2(src, (int32_t)src_stride, | 883 convolve_horiz_16_dspr2(src, (int32_t)src_stride, |
888 dst, (int32_t)dst_stride, | 884 dst, (int32_t)dst_stride, |
889 filter_x, (int32_t)h, 1); | 885 filter_x, (int32_t)h, 1); |
890 break; | 886 break; |
891 case 32: | 887 case 32: |
892 convolve_horiz_16_dspr2(src, (int32_t)src_stride, | 888 convolve_horiz_16_dspr2(src, (int32_t)src_stride, |
893 dst, (int32_t)dst_stride, | 889 dst, (int32_t)dst_stride, |
894 filter_x, (int32_t)h, 2); | 890 filter_x, (int32_t)h, 2); |
895 break; | 891 break; |
896 case 64: | 892 case 64: |
897 prefetch_load(src + 64); | 893 prefetch_load(src + 64); |
898 prefetch_store(dst + 32); | 894 prefetch_store(dst + 32); |
899 | 895 |
900 convolve_horiz_64_dspr2(src, (int32_t)src_stride, | 896 convolve_horiz_64_dspr2(src, (int32_t)src_stride, |
901 dst, (int32_t)dst_stride, | 897 dst, (int32_t)dst_stride, |
902 filter_x, (int32_t)h); | 898 filter_x, (int32_t)h); |
903 break; | 899 break; |
904 default: | 900 default: |
905 vpx_convolve8_horiz_c(src + 3, src_stride, | 901 vpx_convolve8_horiz_c(src + 3, src_stride, |
906 dst, dst_stride, | 902 dst, dst_stride, |
907 filter_x, x_step_q4, | 903 filter_x, x_step_q4, |
908 filter_y, y_step_q4, | 904 filter_y, y_step_q4, |
909 w, h); | 905 w, h); |
910 break; | 906 break; |
911 } | |
912 } else { | |
913 vpx_convolve8_horiz_c(src, src_stride, | |
914 dst, dst_stride, | |
915 filter_x, x_step_q4, | |
916 filter_y, y_step_q4, | |
917 w, h); | |
918 } | 907 } |
919 } | 908 } |
920 } | 909 } |
921 #endif | 910 #endif |
OLD | NEW |