ffmpeg | branch: master | Michael Niedermayer <mich...@niedermayer.cc> | Sat Dec 10 02:03:43 2016 +0100| [65e33d8e23277bb96809842656482e0e3fe8746f] | committer: Michael Niedermayer
swresample/resample_template: Add filter values in parallel This is faster 2871 -> 2189 cycles for int16 matrixbench -> 23456hz Fixes a integer overflow in a artificial corner case Fixes part of 668007-media Found-by: Matt Wolenetz <wolen...@google.com> Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=65e33d8e23277bb96809842656482e0e3fe8746f --- libswresample/resample_template.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/libswresample/resample_template.c b/libswresample/resample_template.c index 31cf350..4c227b9 100644 --- a/libswresample/resample_template.c +++ b/libswresample/resample_template.c @@ -104,12 +104,20 @@ static int RENAME(resample_common)(ResampleContext *c, for (dst_index = 0; dst_index < n; dst_index++) { FELEM *filter = ((FELEM *) c->filter_bank) + c->filter_alloc * index; - FELEM2 val= FOFFSET; + FELEM2 val = FOFFSET; + FELEM2 val2= 0; int i; - for (i = 0; i < c->filter_length; i++) { - val += src[sample_index + i] * (FELEM2)filter[i]; + for (i = 0; i + 1 < c->filter_length; i+=2) { + val += src[sample_index + i ] * (FELEM2)filter[i ]; + val2 += src[sample_index + i + 1] * (FELEM2)filter[i + 1]; } - OUT(dst[dst_index], val); + if (i < c->filter_length) + val += src[sample_index + i ] * (FELEM2)filter[i ]; +#ifdef FELEML + OUT(dst[dst_index], val + (FELEML)val2); +#else + OUT(dst[dst_index], val + val2); +#endif frac += c->dst_incr_mod; index += c->dst_incr_div; _______________________________________________ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog