summaryrefslogtreecommitdiff
path: root/libswresample/x86
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2014-04-25 04:52:31 -0300
committerMichael Niedermayer <michaelni@gmx.at>2014-04-25 16:46:07 +0200
commitcdac3ab59f3c187ee12006972dba0757a1e7cc08 (patch)
tree7f0bc69d052fea30b6e0158f03b50a2ad638e485 /libswresample/x86
parent92cc6d5163cd43a1a909dcc63787292f33e5d6ed (diff)
swresample: add swri_resample_double_sse2
Signed-off-by: James Almer <jamrial@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswresample/x86')
-rw-r--r--libswresample/x86/resample_mmx.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/libswresample/x86/resample_mmx.h b/libswresample/x86/resample_mmx.h
index a0df6e1e1e..1d47266097 100644
--- a/libswresample/x86/resample_mmx.h
+++ b/libswresample/x86/resample_mmx.h
@@ -25,6 +25,7 @@
int swri_resample_int16_mmx2 (struct ResampleContext *c, int16_t *dst, const int16_t *src, int *consumed, int src_size, int dst_size, int update_ctx);
int swri_resample_int16_sse2 (struct ResampleContext *c, int16_t *dst, const int16_t *src, int *consumed, int src_size, int dst_size, int update_ctx);
int swri_resample_float_sse (struct ResampleContext *c, float *dst, const float *src, int *consumed, int src_size, int dst_size, int update_ctx);
+int swri_resample_double_sse2(struct ResampleContext *c, double *dst, const double *src, int *consumed, int src_size, int dst_size, int update_ctx);
DECLARE_ALIGNED(16, const uint64_t, ff_resample_int16_rounder)[2] = { 0x0000000000004000ULL, 0x0000000000000000ULL};
@@ -191,3 +192,51 @@ __asm__ volatile(\
"r" (((uint8_t*)(filter+c->filter_alloc))-len)\
XMM_CLOBBERS_ONLY("%xmm0", "%xmm1", "%xmm2", "%xmm3")\
);
+
+#define COMMON_CORE_DBL_SSE2 \
+ x86_reg len= -8*c->filter_length;\
+__asm__ volatile(\
+ "xorpd %%xmm0, %%xmm0 \n\t"\
+ "1: \n\t"\
+ "movupd (%1, %0), %%xmm1 \n\t"\
+ "mulpd (%2, %0), %%xmm1 \n\t"\
+ "addpd %%xmm1, %%xmm0 \n\t"\
+ "add $16, %0 \n\t"\
+ " js 1b \n\t"\
+ "movhlps %%xmm0, %%xmm1 \n\t"\
+ "addpd %%xmm1, %%xmm0 \n\t"\
+ "movsd %%xmm0, (%3) \n\t"\
+ : "+r" (len)\
+ : "r" (((uint8_t*)(src+sample_index))-len),\
+ "r" (((uint8_t*)filter)-len),\
+ "r" (dst+dst_index)\
+);
+
+#define LINEAR_CORE_DBL_SSE2 \
+ x86_reg len= -8*c->filter_length;\
+__asm__ volatile(\
+ "xorpd %%xmm0, %%xmm0 \n\t"\
+ "xorpd %%xmm2, %%xmm2 \n\t"\
+ "1: \n\t"\
+ "movupd (%3, %0), %%xmm1 \n\t"\
+ "movapd %%xmm1, %%xmm3 \n\t"\
+ "mulpd (%4, %0), %%xmm1 \n\t"\
+ "mulpd (%5, %0), %%xmm3 \n\t"\
+ "addpd %%xmm1, %%xmm0 \n\t"\
+ "addpd %%xmm3, %%xmm2 \n\t"\
+ "add $16, %0 \n\t"\
+ " js 1b \n\t"\
+ "movhlps %%xmm0, %%xmm1 \n\t"\
+ "movhlps %%xmm2, %%xmm3 \n\t"\
+ "addpd %%xmm1, %%xmm0 \n\t"\
+ "addpd %%xmm3, %%xmm2 \n\t"\
+ "movsd %%xmm0, %1 \n\t"\
+ "movsd %%xmm2, %2 \n\t"\
+ : "+r" (len),\
+ "=m" (val),\
+ "=m" (v2)\
+ : "r" (((uint8_t*)(src+sample_index))-len),\
+ "r" (((uint8_t*)filter)-len),\
+ "r" (((uint8_t*)(filter+c->filter_alloc))-len)\
+ XMM_CLOBBERS_ONLY("%xmm0", "%xmm1", "%xmm2", "%xmm3")\
+);