[FFmpeg-devel] [PATCH 2/2] swresample/resample_template: move division out of loop for float/double swri_resample_linear()

Michael Niedermayer michaelni at gmx.at
Sun Jun 29 14:53:37 CEST 2014


Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 libswresample/resample_template.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/libswresample/resample_template.c b/libswresample/resample_template.c
index 3d566d0..ac1651e 100644
--- a/libswresample/resample_template.c
+++ b/libswresample/resample_template.c
@@ -159,6 +159,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++) {
@@ -175,7 +178,11 @@ int RENAME(swri_resample_linear)(ResampleContext *c,
         }
 #endif
 #ifdef FELEML
+#    if FILTER_SHIFT == 0
+        val += (v2 - val) * (FELEML) frac * inv_src_incr;
+#    else
         val += (v2 - val) * (FELEML) frac / c->src_incr;
+#    endif
 #else
         val += (v2 - val) / c->src_incr * frac;
 #endif
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list