Browse Source

swresample/resample_template: move division out of loop for float/double swri_resample_linear()

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
tags/n2.3
Michael Niedermayer 11 years ago
parent
commit
418e5768c6
1 changed files with 7 additions and 2 deletions
  1. +7
    -2
      libswresample/resample_template.c

+ 7
- 2
libswresample/resample_template.c View File

@@ -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);



Loading…
Cancel
Save