there are sse2 equivalents for all remaining variance implementations
Unified · Split
| @@ -976,16 +976,6 @@ INSTANTIATE_TEST_CASE_P( · 975 unmodified lines | |||
| 976 | make_tuple(2, 2, &vpx_highbd_12_sub_pixel_avg_variance4x4_c, 12))); | 976 | make_tuple(2, 2, &vpx_highbd_12_sub_pixel_avg_variance4x4_c, 12))); |
| 977 | #endif // CONFIG_VP9_HIGHBITDEPTH | 977 | #endif // CONFIG_VP9_HIGHBITDEPTH |
| 978 | 978 | ||
| 979 | #if HAVE_MMX | ||
| 980 | INSTANTIATE_TEST_CASE_P( | ||
| 981 | MMX, VpxSubpelVarianceTest, | ||
| 982 | ::testing::Values(make_tuple(4, 4, &vpx_sub_pixel_variance16x16_mmx, 0), | ||
| 983 | make_tuple(4, 3, &vpx_sub_pixel_variance16x8_mmx, 0), | ||
| 984 | make_tuple(3, 4, &vpx_sub_pixel_variance8x16_mmx, 0), | ||
| 985 | make_tuple(3, 3, &vpx_sub_pixel_variance8x8_mmx, 0), | ||
| 986 | make_tuple(2, 2, &vpx_sub_pixel_variance4x4_mmx, 0))); | ||
| 987 | #endif // HAVE_MMX | ||
| 988 | |||
| 989 | #if HAVE_SSE2 | 979 | #if HAVE_SSE2 |
| 990 | INSTANTIATE_TEST_CASE_P(SSE2, SumOfSquaresTest, | 980 | INSTANTIATE_TEST_CASE_P(SSE2, SumOfSquaresTest, |
| 991 | ::testing::Values(vpx_get_mb_ss_sse2)); | 981 | ::testing::Values(vpx_get_mb_ss_sse2)); |
| @@ -322,8 +322,6 @@ DSP_SRCS-$(HAVE_NEON) += arm/variance_neon.c · 321 unmodified lines | |||
| 322 | DSP_SRCS-$(HAVE_MSA) += mips/variance_msa.c | 322 | DSP_SRCS-$(HAVE_MSA) += mips/variance_msa.c |
| 323 | DSP_SRCS-$(HAVE_MSA) += mips/sub_pixel_variance_msa.c | 323 | DSP_SRCS-$(HAVE_MSA) += mips/sub_pixel_variance_msa.c |
| 324 | 324 | ||
| 325 | DSP_SRCS-$(HAVE_MMX) += x86/variance_mmx.c | ||
| 326 | DSP_SRCS-$(HAVE_MMX) += x86/variance_impl_mmx.asm | ||
| 327 | DSP_SRCS-$(HAVE_SSE) += x86/variance_sse2.c | 325 | DSP_SRCS-$(HAVE_SSE) += x86/variance_sse2.c |
| 328 | DSP_SRCS-$(HAVE_SSE2) += x86/variance_sse2.c # Contains SSE2 and SSSE3 | 326 | DSP_SRCS-$(HAVE_SSE2) += x86/variance_sse2.c # Contains SSE2 and SSSE3 |
| 329 | DSP_SRCS-$(HAVE_SSE2) += x86/halfpix_variance_sse2.c | 327 | DSP_SRCS-$(HAVE_SSE2) += x86/halfpix_variance_sse2.c |
| @@ -1478,16 +1478,16 @@ add_proto qw/uint32_t vpx_sub_pixel_variance16x32/, "const uint8_t *src_ptr, int · 1477 unmodified lines | |||
| 1478 | specialize qw/vpx_sub_pixel_variance16x32 msa/, "$sse2_x86inc", "$ssse3_x86inc"; | 1478 | specialize qw/vpx_sub_pixel_variance16x32 msa/, "$sse2_x86inc", "$ssse3_x86inc"; |
| 1479 | 1479 | ||
| 1480 | add_proto qw/uint32_t vpx_sub_pixel_variance16x16/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse"; | 1480 | add_proto qw/uint32_t vpx_sub_pixel_variance16x16/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse"; |
| 1481 | specialize qw/vpx_sub_pixel_variance16x16 mmx media neon msa/, "$sse2_x86inc", "$ssse3_x86inc"; | 1481 | specialize qw/vpx_sub_pixel_variance16x16 media neon msa/, "$sse2_x86inc", "$ssse3_x86inc"; |
| 1482 | 1482 | ||
| 1483 | add_proto qw/uint32_t vpx_sub_pixel_variance16x8/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse"; | 1483 | add_proto qw/uint32_t vpx_sub_pixel_variance16x8/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse"; |
| 1484 | specialize qw/vpx_sub_pixel_variance16x8 mmx msa/, "$sse2_x86inc", "$ssse3_x86inc"; | 1484 | specialize qw/vpx_sub_pixel_variance16x8 msa/, "$sse2_x86inc", "$ssse3_x86inc"; |
| 1485 | 1485 | ||
| 1486 | add_proto qw/uint32_t vpx_sub_pixel_variance8x16/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse"; | 1486 | add_proto qw/uint32_t vpx_sub_pixel_variance8x16/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse"; |
| 1487 | specialize qw/vpx_sub_pixel_variance8x16 mmx msa/, "$sse2_x86inc", "$ssse3_x86inc"; | 1487 | specialize qw/vpx_sub_pixel_variance8x16 msa/, "$sse2_x86inc", "$ssse3_x86inc"; |
| 1488 | 1488 | ||
| 1489 | add_proto qw/uint32_t vpx_sub_pixel_variance8x8/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse"; | 1489 | add_proto qw/uint32_t vpx_sub_pixel_variance8x8/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse"; |
| 1490 | specialize qw/vpx_sub_pixel_variance8x8 mmx media neon msa/, "$sse2_x86inc", "$ssse3_x86inc"; | 1490 | specialize qw/vpx_sub_pixel_variance8x8 media neon msa/, "$sse2_x86inc", "$ssse3_x86inc"; |
| 1491 | 1491 | ||
| 1492 | add_proto qw/uint32_t vpx_sub_pixel_variance8x4/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse"; | 1492 | add_proto qw/uint32_t vpx_sub_pixel_variance8x4/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse"; |
| 1493 | specialize qw/vpx_sub_pixel_variance8x4 msa/, "$sse2_x86inc", "$ssse3_x86inc"; | 1493 | specialize qw/vpx_sub_pixel_variance8x4 msa/, "$sse2_x86inc", "$ssse3_x86inc"; |
| @@ -1496,7 +1496,7 @@ add_proto qw/uint32_t vpx_sub_pixel_variance4x8/, "const uint8_t *src_ptr, int s · 2 unmodified lines | |||
| 1496 | specialize qw/vpx_sub_pixel_variance4x8 msa/, "$sse2_x86inc", "$ssse3_x86inc"; | 1496 | specialize qw/vpx_sub_pixel_variance4x8 msa/, "$sse2_x86inc", "$ssse3_x86inc"; |
| 1497 | 1497 | ||
| 1498 | add_proto qw/uint32_t vpx_sub_pixel_variance4x4/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse"; | 1498 | add_proto qw/uint32_t vpx_sub_pixel_variance4x4/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse"; |
| 1499 | specialize qw/vpx_sub_pixel_variance4x4 mmx msa/, "$sse2_x86inc", "$ssse3_x86inc"; | 1499 | specialize qw/vpx_sub_pixel_variance4x4 msa/, "$sse2_x86inc", "$ssse3_x86inc"; |
| 1500 | 1500 | ||
| 1501 | add_proto qw/uint32_t vpx_sub_pixel_avg_variance64x64/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred"; | 1501 | add_proto qw/uint32_t vpx_sub_pixel_avg_variance64x64/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred"; |
| 1502 | specialize qw/vpx_sub_pixel_avg_variance64x64 avx2 msa/, "$sse2_x86inc", "$ssse3_x86inc"; | 1502 | specialize qw/vpx_sub_pixel_avg_variance64x64 avx2 msa/, "$sse2_x86inc", "$ssse3_x86inc"; |
| @@ -1541,13 +1541,13 @@ add_proto qw/uint32_t vpx_sub_pixel_avg_variance4x4/, "const uint8_t *src_ptr, i · 38 unmodified lines | |||
| 1541 | # Specialty Subpixel | 1541 | # Specialty Subpixel |
| 1542 | # | 1542 | # |
| 1543 | add_proto qw/uint32_t vpx_variance_halfpixvar16x16_h/, "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, uint32_t *sse"; | 1543 | add_proto qw/uint32_t vpx_variance_halfpixvar16x16_h/, "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, uint32_t *sse"; |
| 1544 | specialize qw/vpx_variance_halfpixvar16x16_h mmx sse2 media/; | 1544 | specialize qw/vpx_variance_halfpixvar16x16_h sse2 media/; |
| 1545 | 1545 | ||
| 1546 | add_proto qw/uint32_t vpx_variance_halfpixvar16x16_v/, "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, uint32_t *sse"; | 1546 | add_proto qw/uint32_t vpx_variance_halfpixvar16x16_v/, "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, uint32_t *sse"; |
| 1547 | specialize qw/vpx_variance_halfpixvar16x16_v mmx sse2 media/; | 1547 | specialize qw/vpx_variance_halfpixvar16x16_v sse2 media/; |
| 1548 | 1548 | ||
| 1549 | add_proto qw/uint32_t vpx_variance_halfpixvar16x16_hv/, "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, uint32_t *sse"; | 1549 | add_proto qw/uint32_t vpx_variance_halfpixvar16x16_hv/, "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, uint32_t *sse"; |
| 1550 | specialize qw/vpx_variance_halfpixvar16x16_hv mmx sse2 media/; | 1550 | specialize qw/vpx_variance_halfpixvar16x16_hv sse2 media/; |
| 1551 | 1551 | ||
| 1552 | if (vpx_config("CONFIG_VP9_HIGHBITDEPTH") eq "yes") { | 1552 | if (vpx_config("CONFIG_VP9_HIGHBITDEPTH") eq "yes") { |
| 1553 | add_proto qw/unsigned int vpx_highbd_12_variance64x64/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse"; | 1553 | add_proto qw/unsigned int vpx_highbd_12_variance64x64/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse"; |
| @@ -1,343 +0,0 @@ | |||
| 1 | ; | ||
| 2 | ; Copyright (c) 2010 The WebM project authors. All Rights Reserved. | ||
| 3 | ; | ||
| 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 | ||
| 6 | ; tree. An additional intellectual property rights grant can be found | ||
| 7 | ; in the file PATENTS. All contributing project authors may | ||
| 8 | ; be found in the AUTHORS file in the root of the source tree. | ||
| 9 | ; | ||
| 10 | |||
| 11 | |||
| 12 | %include "vpx_ports/x86_abi_support.asm" | ||
| 13 | |||
| 14 | %define mmx_filter_shift 7 | ||
| 15 | |||
| 16 | ;void vpx_filter_block2d_bil4x4_var_mmx | ||
| 17 | ;( | ||
| 18 | ; unsigned char *ref_ptr, | ||
| 19 | ; int ref_pixels_per_line, | ||
| 20 | ; unsigned char *src_ptr, | ||
| 21 | ; int src_pixels_per_line, | ||
| 22 | ; unsigned short *HFilter, | ||
| 23 | ; unsigned short *VFilter, | ||
| 24 | ; int *sum, | ||
| 25 | ; unsigned int *sumsquared | ||
| 26 | ;) | ||
| 27 | global sym(vpx_filter_block2d_bil4x4_var_mmx) PRIVATE | ||
| 28 | sym(vpx_filter_block2d_bil4x4_var_mmx): | ||
| 29 | push rbp | ||
| 30 | mov rbp, rsp | ||
| 31 | SHADOW_ARGS_TO_STACK 8 | ||
| 32 | GET_GOT rbx | ||
| 33 | push rsi | ||
| 34 | push rdi | ||
| 35 | sub rsp, 16 | ||
| 36 | ; end prolog | ||
| 37 | |||
| 38 | pxor mm6, mm6 ; | ||
| 39 | pxor mm7, mm7 ; | ||
| 40 | |||
| 41 | mov rax, arg(4) ;HFilter ; | ||
| 42 | mov rdx, arg(5) ;VFilter ; | ||
| 43 | |||
| 44 | mov rsi, arg(0) ;ref_ptr ; | ||
| 45 | mov rdi, arg(2) ;src_ptr ; | ||
| 46 | |||
| 47 | mov rcx, 4 ; | ||
| 48 | pxor mm0, mm0 ; | ||
| 49 | |||
| 50 | movd mm1, [rsi] ; | ||
| 51 | movd mm3, [rsi+1] ; | ||
| 52 | |||
| 53 | punpcklbw mm1, mm0 ; | ||
| 54 | pmullw mm1, [rax] ; | ||
| 55 | |||
| 56 | punpcklbw mm3, mm0 ; | ||
| 57 | pmullw mm3, [rax+8] ; | ||
| 58 | |||
| 59 | paddw mm1, mm3 ; | ||
| 60 | paddw mm1, [GLOBAL(mmx_bi_rd)] ; | ||
| 61 | |||
| 62 | psraw mm1, mmx_filter_shift ; | ||
| 63 | movq mm5, mm1 | ||
| 64 | |||
| 65 | %if ABI_IS_32BIT | ||
| 66 | add rsi, dword ptr arg(1) ;ref_pixels_per_line ; | ||
| 67 | %else | ||
| 68 | movsxd r8, dword ptr arg(1) ;ref_pixels_per_line ; | ||
| 69 | add rsi, r8 | ||
| 70 | %endif | ||
| 71 | |||
| 72 | .filter_block2d_bil4x4_var_mmx_loop: | ||
| 73 | |||
| 74 | movd mm1, [rsi] ; | ||
| 75 | movd mm3, [rsi+1] ; | ||
| 76 | |||
| 77 | punpcklbw mm1, mm0 ; | ||
| 78 | pmullw mm1, [rax] ; | ||
| 79 | |||
| 80 | punpcklbw mm3, mm0 ; | ||
| 81 | pmullw mm3, [rax+8] ; | ||
| 82 | |||
| 83 | paddw mm1, mm3 ; | ||
| 84 | paddw mm1, [GLOBAL(mmx_bi_rd)] ; | ||
| 85 | |||
| 86 | psraw mm1, mmx_filter_shift ; | ||
| 87 | movq mm3, mm5 ; | ||
| 88 | |||
| 89 | movq mm5, mm1 ; | ||
| 90 | pmullw mm3, [rdx] ; | ||
| 91 | |||
| 92 | pmullw mm1, [rdx+8] ; | ||
| 93 | paddw mm1, mm3 ; | ||
| 94 | |||
| 95 | paddw mm1, [GLOBAL(mmx_bi_rd)] ; | ||
| 96 | psraw mm1, mmx_filter_shift ; | ||
| 97 | |||
| 98 | movd mm3, [rdi] ; | ||
| 99 | punpcklbw mm3, mm0 ; | ||
| 100 | |||
| 101 | psubw mm1, mm3 ; | ||
| 102 | paddw mm6, mm1 ; | ||
| 103 | |||
| 104 | pmaddwd mm1, mm1 ; | ||
| 105 | paddd mm7, mm1 ; | ||
| 106 | |||
| 107 | %if ABI_IS_32BIT | ||
| 108 | add rsi, dword ptr arg(1) ;ref_pixels_per_line ; | ||
| 109 | add rdi, dword ptr arg(3) ;src_pixels_per_line ; | ||
| 110 | %else | ||
| 111 | movsxd r8, dword ptr arg(1) ;ref_pixels_per_line | ||
| 112 | movsxd r9, dword ptr arg(3) ;src_pixels_per_line | ||
| 113 | add rsi, r8 | ||
| 114 | add rdi, r9 | ||
| 115 | %endif | ||
| 116 | sub rcx, 1 ; | ||
| 117 | jnz .filter_block2d_bil4x4_var_mmx_loop ; | ||
| 118 | |||
| 119 | pxor mm3, mm3 ; | ||
| 120 | pxor mm2, mm2 ; | ||
| 121 | |||
| 122 | punpcklwd mm2, mm6 ; | ||
| 123 | punpckhwd mm3, mm6 ; | ||
| 124 | |||
| 125 | paddd mm2, mm3 ; | ||
| 126 | movq mm6, mm2 ; | ||
| 127 | |||
| 128 | psrlq mm6, 32 ; | ||
| 129 | paddd mm2, mm6 ; | ||
| 130 | |||
| 131 | psrad mm2, 16 ; | ||
| 132 | movq mm4, mm7 ; | ||
| 133 | |||
| 134 | psrlq mm4, 32 ; | ||
| 135 | paddd mm4, mm7 ; | ||
| 136 | |||
| 137 | mov rdi, arg(6) ;sum | ||
| 138 | mov rsi, arg(7) ;sumsquared | ||
| 139 | |||
| 140 | movd dword ptr [rdi], mm2 ; | ||
| 141 | movd dword ptr [rsi], mm4 ; | ||
| 142 | |||
| 143 | ; begin epilog | ||
| 144 | add rsp, 16 | ||
| 145 | pop rdi | ||
| 146 | pop rsi | ||
| 147 | RESTORE_GOT | ||
| 148 | UNSHADOW_ARGS | ||
| 149 | pop rbp | ||
| 150 | ret | ||
| 151 | |||
| 152 | ;void vpx_filter_block2d_bil_var_mmx | ||
| 153 | ;( | ||
| 154 | ; unsigned char *ref_ptr, | ||
| 155 | ; int ref_pixels_per_line, | ||
| 156 | ; unsigned char *src_ptr, | ||
| 157 | ; int src_pixels_per_line, | ||
| 158 | ; unsigned int Height, | ||
| 159 | ; unsigned short *HFilter, | ||
| 160 | ; unsigned short *VFilter, | ||
| 161 | ; int *sum, | ||
| 162 | ; unsigned int *sumsquared | ||
| 163 | ;) | ||
| 164 | global sym(vpx_filter_block2d_bil_var_mmx) PRIVATE | ||
| 165 | sym(vpx_filter_block2d_bil_var_mmx): | ||
| 166 | push rbp | ||
| 167 | mov rbp, rsp | ||
| 168 | SHADOW_ARGS_TO_STACK 9 | ||
| 169 | GET_GOT rbx | ||
| 170 | push rsi | ||
| 171 | push rdi | ||
| 172 | sub rsp, 16 | ||
| 173 | ; end prolog | ||
| 174 | |||
| 175 | pxor mm6, mm6 ; | ||
| 176 | pxor mm7, mm7 ; | ||
| 177 | mov rax, arg(5) ;HFilter ; | ||
| 178 | |||
| 179 | mov rdx, arg(6) ;VFilter ; | ||
| 180 | mov rsi, arg(0) ;ref_ptr ; | ||
| 181 | |||
| 182 | mov rdi, arg(2) ;src_ptr ; | ||
| 183 | movsxd rcx, dword ptr arg(4) ;Height ; | ||
| 184 | |||
| 185 | pxor mm0, mm0 ; | ||
| 186 | movq mm1, [rsi] ; | ||
| 187 | |||
| 188 | movq mm3, [rsi+1] ; | ||
| 189 | movq mm2, mm1 ; | ||
| 190 | |||
| 191 | movq mm4, mm3 ; | ||
| 192 | punpcklbw mm1, mm0 ; | ||
| 193 | |||
| 194 | punpckhbw mm2, mm0 ; | ||
| 195 | pmullw mm1, [rax] ; | ||
| 196 | |||
| 197 | pmullw mm2, [rax] ; | ||
| 198 | punpcklbw mm3, mm0 ; | ||
| 199 | |||
| 200 | punpckhbw mm4, mm0 ; | ||
| 201 | pmullw mm3, [rax+8] ; | ||
| 202 | |||
| 203 | pmullw mm4, [rax+8] ; | ||
| 204 | paddw mm1, mm3 ; | ||
| 205 | |||
| 206 | paddw mm2, mm4 ; | ||
| 207 | paddw mm1, [GLOBAL(mmx_bi_rd)] ; | ||
| 208 | |||
| 209 | psraw mm1, mmx_filter_shift ; | ||
| 210 | paddw mm2, [GLOBAL(mmx_bi_rd)] ; | ||
| 211 | |||
| 212 | psraw mm2, mmx_filter_shift ; | ||
| 213 | movq mm5, mm1 | ||
| 214 | |||
| 215 | packuswb mm5, mm2 ; | ||
| 216 | %if ABI_IS_32BIT | ||
| 217 | add rsi, dword ptr arg(1) ;ref_pixels_per_line | ||
| 218 | %else | ||
| 219 | movsxd r8, dword ptr arg(1) ;ref_pixels_per_line | ||
| 220 | add rsi, r8 | ||
| 221 | %endif | ||
| 222 | |||
| 223 | .filter_block2d_bil_var_mmx_loop: | ||
| 224 | |||
| 225 | movq mm1, [rsi] ; | ||
| 226 | movq mm3, [rsi+1] ; | ||
| 227 | |||
| 228 | movq mm2, mm1 ; | ||
| 229 | movq mm4, mm3 ; | ||
| 230 | |||
| 231 | punpcklbw mm1, mm0 ; | ||
| 232 | punpckhbw mm2, mm0 ; | ||
| 233 | |||
| 234 | pmullw mm1, [rax] ; | ||
| 235 | pmullw mm2, [rax] ; | ||
| 236 | |||
| 237 | punpcklbw mm3, mm0 ; | ||
| 238 | punpckhbw mm4, mm0 ; | ||
| 239 | |||
| 240 | pmullw mm3, [rax+8] ; | ||
| 241 | pmullw mm4, [rax+8] ; | ||
| 242 | |||
| 243 | paddw mm1, mm3 ; | ||
| 244 | paddw mm2, mm4 ; | ||
| 245 | |||
| 246 | paddw mm1, [GLOBAL(mmx_bi_rd)] ; | ||
| 247 | psraw mm1, mmx_filter_shift ; | ||
| 248 | |||
| 249 | paddw mm2, [GLOBAL(mmx_bi_rd)] ; | ||
| 250 | psraw mm2, mmx_filter_shift ; | ||
| 251 | |||
| 252 | movq mm3, mm5 ; | ||
| 253 | movq mm4, mm5 ; | ||
| 254 | |||
| 255 | punpcklbw mm3, mm0 ; | ||
| 256 | punpckhbw mm4, mm0 ; | ||
| 257 | |||
| 258 | movq mm5, mm1 ; | ||
| 259 | packuswb mm5, mm2 ; | ||
| 260 | |||
| 261 | pmullw mm3, [rdx] ; | ||
| 262 | pmullw mm4, [rdx] ; | ||
| 263 | |||
| 264 | pmullw mm1, [rdx+8] ; | ||
| 265 | pmullw mm2, [rdx+8] ; | ||
| 266 | |||
| 267 | paddw mm1, mm3 ; | ||
| 268 | paddw mm2, mm4 ; | ||
| 269 | |||
| 270 | paddw mm1, [GLOBAL(mmx_bi_rd)] ; | ||
| 271 | paddw mm2, [GLOBAL(mmx_bi_rd)] ; | ||
| 272 | |||
| 273 | psraw mm1, mmx_filter_shift ; | ||
| 274 | psraw mm2, mmx_filter_shift ; | ||
| 275 | |||
| 276 | movq mm3, [rdi] ; | ||
| 277 | movq mm4, mm3 ; | ||
| 278 | |||
| 279 | punpcklbw mm3, mm0 ; | ||
| 280 | punpckhbw mm4, mm0 ; | ||
| 281 | |||
| 282 | psubw mm1, mm3 ; | ||
| 283 | psubw mm2, mm4 ; | ||
| 284 | |||
| 285 | paddw mm6, mm1 ; | ||
| 286 | pmaddwd mm1, mm1 ; | ||
| 287 | |||
| 288 | paddw mm6, mm2 ; | ||
| 289 | pmaddwd mm2, mm2 ; | ||
| 290 | |||
| 291 | paddd mm7, mm1 ; | ||
| 292 | paddd mm7, mm2 ; | ||
| 293 | |||
| 294 | %if ABI_IS_32BIT | ||
| 295 | add rsi, dword ptr arg(1) ;ref_pixels_per_line ; | ||
| 296 | add rdi, dword ptr arg(3) ;src_pixels_per_line ; | ||
| 297 | %else | ||
| 298 | movsxd r8, dword ptr arg(1) ;ref_pixels_per_line ; | ||
| 299 | movsxd r9, dword ptr arg(3) ;src_pixels_per_line ; | ||
| 300 | add rsi, r8 | ||
| 301 | add rdi, r9 | ||
| 302 | %endif | ||
| 303 | sub rcx, 1 ; | ||
| 304 | jnz .filter_block2d_bil_var_mmx_loop ; | ||
| 305 | |||
| 306 | pxor mm3, mm3 ; | ||
| 307 | pxor mm2, mm2 ; | ||
| 308 | |||
| 309 | punpcklwd mm2, mm6 ; | ||
| 310 | punpckhwd mm3, mm6 ; | ||
| 311 | |||
| 312 | paddd mm2, mm3 ; | ||
| 313 | movq mm6, mm2 ; | ||
| 314 | |||
| 315 | psrlq mm6, 32 ; | ||
| 316 | paddd mm2, mm6 ; | ||
| 317 | |||
| 318 | psrad mm2, 16 ; | ||
| 319 | movq mm4, mm7 ; | ||
| 320 | |||
| 321 | psrlq mm4, 32 ; | ||
| 322 | paddd mm4, mm7 ; | ||
| 323 | |||
| 324 | mov rdi, arg(7) ;sum | ||
| 325 | mov rsi, arg(8) ;sumsquared | ||
| 326 | |||
| 327 | movd dword ptr [rdi], mm2 ; | ||
| 328 | movd dword ptr [rsi], mm4 ; | ||
| 329 | |||
| 330 | ; begin epilog | ||
| 331 | add rsp, 16 | ||
| 332 | pop rdi | ||
| 333 | pop rsi | ||
| 334 | RESTORE_GOT | ||
| 335 | UNSHADOW_ARGS | ||
| 336 | pop rbp | ||
| 337 | ret | ||
| 338 | |||
| 339 | SECTION_RODATA | ||
| 340 | ;short mmx_bi_rd[4] = { 64, 64, 64, 64}; | ||
| 341 | align 16 | ||
| 342 | mmx_bi_rd: | ||
| 343 | times 4 dw 64 | ||
| @@ -1,153 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | ||
| 3 | * | ||
| 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 | ||
| 6 | * tree. An additional intellectual property rights grant can be found | ||
| 7 | * in the file PATENTS. All contributing project authors may | ||
| 8 | * be found in the AUTHORS file in the root of the source tree. | ||
| 9 | */ | ||
| 10 | |||
| 11 | #include "./vpx_dsp_rtcd.h" | ||
| 12 | |||
| 13 | #include "vpx_ports/mem.h" | ||
| 14 | |||
| 15 | DECLARE_ALIGNED(16, static const int16_t, bilinear_filters_mmx[8][8]) = { | ||
| 16 | { 128, 128, 128, 128, 0, 0, 0, 0 }, | ||
| 17 | { 112, 112, 112, 112, 16, 16, 16, 16 }, | ||
| 18 | { 96, 96, 96, 96, 32, 32, 32, 32 }, | ||
| 19 | { 80, 80, 80, 80, 48, 48, 48, 48 }, | ||
| 20 | { 64, 64, 64, 64, 64, 64, 64, 64 }, | ||
| 21 | { 48, 48, 48, 48, 80, 80, 80, 80 }, | ||
| 22 | { 32, 32, 32, 32, 96, 96, 96, 96 }, | ||
| 23 | { 16, 16, 16, 16, 112, 112, 112, 112 } | ||
| 24 | }; | ||
| 25 | |||
| 26 | extern void vpx_filter_block2d_bil4x4_var_mmx(const unsigned char *ref_ptr, | ||
| 27 | int ref_pixels_per_line, | ||
| 28 | const unsigned char *src_ptr, | ||
| 29 | int src_pixels_per_line, | ||
| 30 | const int16_t *HFilter, | ||
| 31 | const int16_t *VFilter, | ||
| 32 | int *sum, | ||
| 33 | unsigned int *sumsquared); | ||
| 34 | |||
| 35 | extern void vpx_filter_block2d_bil_var_mmx(const unsigned char *ref_ptr, | ||
| 36 | int ref_pixels_per_line, | ||
| 37 | const unsigned char *src_ptr, | ||
| 38 | int src_pixels_per_line, | ||
| 39 | unsigned int Height, | ||
| 40 | const int16_t *HFilter, | ||
| 41 | const int16_t *VFilter, | ||
| 42 | int *sum, | ||
| 43 | unsigned int *sumsquared); | ||
| 44 | |||
| 45 | |||
| 46 | uint32_t vpx_sub_pixel_variance4x4_mmx(const uint8_t *a, int a_stride, | ||
| 47 | int xoffset, int yoffset, | ||
| 48 | const uint8_t *b, int b_stride, | ||
| 49 | uint32_t *sse) { | ||
| 50 | int xsum; | ||
| 51 | unsigned int xxsum; | ||
| 52 | vpx_filter_block2d_bil4x4_var_mmx(a, a_stride, b, b_stride, | ||
| 53 | bilinear_filters_mmx[xoffset], | ||
| 54 | bilinear_filters_mmx[yoffset], | ||
| 55 | &xsum, &xxsum); | ||
| 56 | *sse = xxsum; | ||
| 57 | return (xxsum - (((unsigned int)xsum * xsum) >> 4)); | ||
| 58 | } | ||
| 59 | |||
| 60 | |||
| 61 | uint32_t vpx_sub_pixel_variance8x8_mmx(const uint8_t *a, int a_stride, | ||
| 62 | int xoffset, int yoffset, | ||
| 63 | const uint8_t *b, int b_stride, | ||
| 64 | uint32_t *sse) { | ||
| 65 | int xsum; | ||
| 66 | uint32_t xxsum; | ||
| 67 | vpx_filter_block2d_bil_var_mmx(a, a_stride, b, b_stride, 8, | ||
| 68 | bilinear_filters_mmx[xoffset], | ||
| 69 | bilinear_filters_mmx[yoffset], | ||
| 70 | &xsum, &xxsum); | ||
| 71 | *sse = xxsum; | ||
| 72 | return (xxsum - (((uint32_t)xsum * xsum) >> 6)); | ||
| 73 | } | ||
| 74 | |||
| 75 | uint32_t vpx_sub_pixel_variance16x16_mmx(const uint8_t *a, int a_stride, | ||
| 76 | int xoffset, int yoffset, | ||
| 77 | const uint8_t *b, int b_stride, | ||
| 78 | uint32_t *sse) { | ||
| 79 | int xsum0, xsum1; | ||
| 80 | unsigned int xxsum0, xxsum1; | ||
| 81 | |||
| 82 | vpx_filter_block2d_bil_var_mmx(a, a_stride, b, b_stride, 16, | ||
| 83 | bilinear_filters_mmx[xoffset], | ||
| 84 | bilinear_filters_mmx[yoffset], | ||
| 85 | &xsum0, &xxsum0); | ||
| 86 | |||
| 87 | vpx_filter_block2d_bil_var_mmx(a + 8, a_stride, b + 8, b_stride, 16, | ||
| 88 | bilinear_filters_mmx[xoffset], | ||
| 89 | bilinear_filters_mmx[yoffset], | ||
| 90 | &xsum1, &xxsum1); | ||
| 91 | |||
| 92 | xsum0 += xsum1; | ||
| 93 | xxsum0 += xxsum1; | ||
| 94 | |||
| 95 | *sse = xxsum0; | ||
| 96 | return (xxsum0 - (((uint32_t)xsum0 * xsum0) >> 8)); | ||
| 97 | } | ||
| 98 | |||
| 99 | uint32_t vpx_sub_pixel_variance16x8_mmx(const uint8_t *a, int a_stride, | ||
| 100 | int xoffset, int yoffset, | ||
| 101 | const uint8_t *b, int b_stride, | ||
| 102 | uint32_t *sse) { | ||
| 103 | int xsum0, xsum1; | ||
| 104 | unsigned int xxsum0, xxsum1; | ||
| 105 | |||
| 106 | vpx_filter_block2d_bil_var_mmx(a, a_stride, b, b_stride, 8, | ||
| 107 | bilinear_filters_mmx[xoffset], | ||
| 108 | bilinear_filters_mmx[yoffset], | ||
| 109 | &xsum0, &xxsum0); | ||
| 110 | |||
| 111 | vpx_filter_block2d_bil_var_mmx(a + 8, a_stride, b + 8, b_stride, 8, | ||
| 112 | bilinear_filters_mmx[xoffset], | ||
| 113 | bilinear_filters_mmx[yoffset], | ||
| 114 | &xsum1, &xxsum1); | ||
| 115 | |||
| 116 | xsum0 += xsum1; | ||
| 117 | xxsum0 += xxsum1; | ||
| 118 | |||
| 119 | *sse = xxsum0; | ||
| 120 | return (xxsum0 - (((uint32_t)xsum0 * xsum0) >> 7)); | ||
| 121 | } | ||
| 122 | |||
| 123 | uint32_t vpx_sub_pixel_variance8x16_mmx(const uint8_t *a, int a_stride, | ||
| 124 | int xoffset, int yoffset, | ||
| 125 | const uint8_t *b, int b_stride, | ||
| 126 | uint32_t *sse) { | ||
| 127 | int xsum; | ||
| 128 | unsigned int xxsum; | ||
| 129 | vpx_filter_block2d_bil_var_mmx(a, a_stride, b, b_stride, 16, | ||
| 130 | bilinear_filters_mmx[xoffset], | ||
| 131 | bilinear_filters_mmx[yoffset], | ||
| 132 | &xsum, &xxsum); | ||
| 133 | *sse = xxsum; | ||
| 134 | return (xxsum - (((uint32_t)xsum * xsum) >> 7)); | ||
| 135 | } | ||
| 136 | |||
| 137 | uint32_t vpx_variance_halfpixvar16x16_h_mmx(const uint8_t *a, int a_stride, | ||
| 138 | const uint8_t *b, int b_stride, | ||
| 139 | uint32_t *sse) { | ||
| 140 | return vpx_sub_pixel_variance16x16_mmx(a, a_stride, 4, 0, b, b_stride, sse); | ||
| 141 | } | ||
| 142 | |||
| 143 | uint32_t vpx_variance_halfpixvar16x16_v_mmx(const uint8_t *a, int a_stride, | ||
| 144 | const uint8_t *b, int b_stride, | ||
| 145 | uint32_t *sse) { | ||
| 146 | return vpx_sub_pixel_variance16x16_mmx(a, a_stride, 0, 4, b, b_stride, sse); | ||
| 147 | } | ||
| 148 | |||
| 149 | uint32_t vpx_variance_halfpixvar16x16_hv_mmx(const uint8_t *a, int a_stride, | ||
| 150 | const uint8_t *b, int b_stride, | ||
| 151 | uint32_t *sse) { | ||
| 152 | return vpx_sub_pixel_variance16x16_mmx(a, a_stride, 4, 4, b, b_stride, sse); | ||
| 153 | } | ||