summaryrefslogtreecommitdiff
path: root/libswresample/resample_template.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2014-03-23 19:05:16 -0300
committerMichael Niedermayer <michaelni@gmx.at>2014-03-24 02:33:16 +0100
commitfa25c4c400649bcc7693107d2d4b9d1fa137173e (patch)
tree548982ee6e1c438be8f89881e6ccca6f704d36c8 /libswresample/resample_template.c
parentffd77f94a26be22b8ead3178ceec3ed39e68abc5 (diff)
swresample/resample: mmx2/sse2 int16 linear interpolation
About three times faster Signed-off-by: James Almer <jamrial@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswresample/resample_template.c')
-rw-r--r--libswresample/resample_template.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libswresample/resample_template.c b/libswresample/resample_template.c
index 8d5ff4d50e..c6612766b4 100644
--- a/libswresample/resample_template.c
+++ b/libswresample/resample_template.c
@@ -81,9 +81,11 @@
# define RENAME(N) N ## _int16
# elif defined(TEMPLATE_RESAMPLE_S16_MMX2)
# define COMMON_CORE COMMON_CORE_INT16_MMX2
+# define LINEAR_CORE LINEAR_CORE_INT16_MMX2
# define RENAME(N) N ## _int16_mmx2
# elif defined(TEMPLATE_RESAMPLE_S16_SSE2)
# define COMMON_CORE COMMON_CORE_INT16_SSE2
+# define LINEAR_CORE LINEAR_CORE_INT16_SSE2
# define RENAME(N) N ## _int16_sse2
# endif
@@ -163,10 +165,14 @@ int RENAME(swri_resample)(ResampleContext *c, DELEM *dst, const DELEM *src, int
OUT(dst[dst_index], val);
}else if(c->linear){
FELEM2 v2=0;
+#ifdef LINEAR_CORE
+ LINEAR_CORE
+#else
for(i=0; i<c->filter_length; i++){
val += src[sample_index + i] * (FELEM2)filter[i];
v2 += src[sample_index + i] * (FELEM2)filter[i + c->filter_alloc];
}
+#endif
val+=(v2-val)*(FELEML)frac / c->src_incr;
OUT(dst[dst_index], val);
}else{
@@ -213,6 +219,7 @@ int RENAME(swri_resample)(ResampleContext *c, DELEM *dst, const DELEM *src, int
}
#undef COMMON_CORE
+#undef LINEAR_CORE
#undef RENAME
#undef FILTER_SHIFT
#undef DELEM