Commit 65e33d8e authored by Michael Niedermayer's avatar 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: 's avatarMatt Wolenetz <wolenetz@google.com>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 34db6507
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment