mirror of https://git.ffmpeg.org/ffmpeg.git
swresample/resample_template: move division out of loop for float/double swri_resample_linear()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
86576129bd
commit
418e5768c6
|
@ -32,7 +32,6 @@
|
||||||
# define DELEM double
|
# define DELEM double
|
||||||
# define FELEM double
|
# define FELEM double
|
||||||
# define FELEM2 double
|
# define FELEM2 double
|
||||||
# define FELEML double
|
|
||||||
# define OUT(d, v) d = v
|
# define OUT(d, v) d = v
|
||||||
|
|
||||||
# if defined(TEMPLATE_RESAMPLE_DBL)
|
# if defined(TEMPLATE_RESAMPLE_DBL)
|
||||||
|
@ -49,7 +48,6 @@
|
||||||
# define DELEM float
|
# define DELEM float
|
||||||
# define FELEM float
|
# define FELEM float
|
||||||
# define FELEM2 float
|
# define FELEM2 float
|
||||||
# define FELEML float
|
|
||||||
# define OUT(d, v) d = v
|
# define OUT(d, v) d = v
|
||||||
|
|
||||||
# if defined(TEMPLATE_RESAMPLE_FLT)
|
# if defined(TEMPLATE_RESAMPLE_FLT)
|
||||||
|
@ -158,6 +156,9 @@ int RENAME(swri_resample_linear)(ResampleContext *c,
|
||||||
int index= c->index;
|
int index= c->index;
|
||||||
int frac= c->frac;
|
int frac= c->frac;
|
||||||
int sample_index = index >> c->phase_shift;
|
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;
|
index &= c->phase_mask;
|
||||||
for (dst_index = 0; dst_index < n; dst_index++) {
|
for (dst_index = 0; dst_index < n; dst_index++) {
|
||||||
|
@ -175,8 +176,12 @@ int RENAME(swri_resample_linear)(ResampleContext *c,
|
||||||
#endif
|
#endif
|
||||||
#ifdef FELEML
|
#ifdef FELEML
|
||||||
val += (v2 - val) * (FELEML) frac / c->src_incr;
|
val += (v2 - val) * (FELEML) frac / c->src_incr;
|
||||||
|
#else
|
||||||
|
# if FILTER_SHIFT == 0
|
||||||
|
val += (v2 - val) * inv_src_incr * frac;
|
||||||
# else
|
# else
|
||||||
val += (v2 - val) / c->src_incr * frac;
|
val += (v2 - val) / c->src_incr * frac;
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
OUT(dst[dst_index], val);
|
OUT(dst[dst_index], val);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue