On Sun, Dec 6, 2015 at 8:20 AM, Ganesh Ajjanagadde <gajjanaga...@gmail.com> wrote: > On Tue, Dec 1, 2015 at 7:27 PM, Ganesh Ajjanagadde > <gajjanaga...@gmail.com> wrote: >> Signed-off-by: Ganesh Ajjanagadde <gajjanaga...@gmail.com> >> --- >> libavcodec/mdct_template.c | 5 +++-- >> 1 file changed, 3 insertions(+), 2 deletions(-) >> >> diff --git a/libavcodec/mdct_template.c b/libavcodec/mdct_template.c >> index e7e5f62..ecdeb54 100644 >> --- a/libavcodec/mdct_template.c >> +++ b/libavcodec/mdct_template.c >> @@ -23,6 +23,7 @@ >> #include <string.h> >> #include "libavutil/common.h" >> #include "libavutil/mathematics.h" >> +#include "libavutil/libm.h" >> #include "fft.h" >> #include "fft-internal.h" >> >> @@ -82,8 +83,8 @@ av_cold int ff_mdct_init(FFTContext *s, int nbits, int >> inverse, double scale) >> for(i=0;i<n4;i++) { >> alpha = 2 * M_PI * (i + theta) / n; >> #if FFT_FIXED_32 >> - s->tcos[i*tstep] = (FFTSample)floor(-cos(alpha) * 2147483648.0 + >> 0.5); >> - s->tsin[i*tstep] = (FFTSample)floor(-sin(alpha) * 2147483648.0 + >> 0.5); >> + s->tcos[i*tstep] = lrint(-cos(alpha) * 2147483648.0); >> + s->tsin[i*tstep] = lrint(-sin(alpha) * 2147483648.0); >> #else >> s->tcos[i*tstep] = FIX15(-cos(alpha) * scale); >> s->tsin[i*tstep] = FIX15(-sin(alpha) * scale); >> -- >> 2.6.2 >> > > Ping for this one, it is relatively important among the lrint patches > as this is frequently used and table may be large, making speed > benefit somewhat useful. > I have noted the header alphabetical include order mistake above.
This is going in soon, as it actually fixes a bug since cos, sin can be positive in the relevant ranges here. Last call. Note: I think there might be undefined behavior here (before and after the patch) since cos(alpha) can be -1 (or very close it) here. That is a separate issue that I will examine some time. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel