aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-06-29 14:23:49 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-06-30 04:30:10 +0200
commit418e5768c68b8688c12e30f2e017688c97249e85 (patch)
treeb12922c9be3930d061bfb44102aed56937384154
parent86576129bd22401c5155772971809ca1be01ca59 (diff)
downloadffmpeg-418e5768c68b8688c12e30f2e017688c97249e85.tar.gz
swresample/resample_template: move division out of loop for float/double swri_resample_linear()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libswresample/resample_template.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/libswresample/resample_template.c b/libswresample/resample_template.c
index 5983d46b79..1982992e8a 100644
--- a/libswresample/resample_template.c
+++ b/libswresample/resample_template.c
@@ -32,7 +32,6 @@
# define DELEM double
# define FELEM double
# define FELEM2 double
-# define FELEML double
# define OUT(d, v) d = v
# if defined(TEMPLATE_RESAMPLE_DBL)
@@ -49,7 +48,6 @@
# define DELEM float
# define FELEM float
# define FELEM2 float
-# define FELEML float
# define OUT(d, v) d = v
# if defined(TEMPLATE_RESAMPLE_FLT)
@@ -158,6 +156,9 @@ int RENAME(swri_resample_linear)(ResampleContext *c,
int index= c->index;
int frac= c->frac;
int sample_index = index >> c->phase_shift;
+#if FILTER_SHIFT == 0
+ double inv_src_incr = 1.0 / c->src_incr;
+#endif
index &= c->phase_mask;
for (dst_index = 0; dst_index < n; dst_index++) {
@@ -176,7 +177,11 @@ int RENAME(swri_resample_linear)(ResampleContext *c,
#ifdef FELEML
val += (v2 - val) * (FELEML) frac / c->src_incr;
#else
+# if FILTER_SHIFT == 0
+ val += (v2 - val) * inv_src_incr * frac;
+# else
val += (v2 - val) / c->src_incr * frac;
+# endif
#endif
OUT(dst[dst_index], val);