avcodec/apedec: Factor constant sign out of loop in long_filter_high_3800()

930 -> 850 cycles

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
pull/389/head
Michael Niedermayer 2 years ago
parent eb768a75f8
commit b2a3279dbe
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64
  1. 17
      libavcodec/apedec.c

@ -955,9 +955,20 @@ static void long_filter_high_3800(int32_t *buffer, int order, int shift, int len
for (i = order; i < length; i++) { for (i = order; i < length; i++) {
dotprod = 0; dotprod = 0;
sign = APESIGN(buffer[i]); sign = APESIGN(buffer[i]);
for (j = 0; j < order; j++) { if (sign == 1) {
dotprod += delayp[j] * (unsigned)coeffs[j]; for (j = 0; j < order; j++) {
coeffs[j] += ((delayp[j] >> 31) | 1) * sign; dotprod += delayp[j] * (unsigned)coeffs[j];
coeffs[j] += (delayp[j] >> 31) | 1;
}
} else if (sign == -1) {
for (j = 0; j < order; j++) {
dotprod += delayp[j] * (unsigned)coeffs[j];
coeffs[j] -= (delayp[j] >> 31) | 1;
}
} else {
for (j = 0; j < order; j++) {
dotprod += delayp[j] * (unsigned)coeffs[j];
}
} }
buffer[i] -= (unsigned)(dotprod >> shift); buffer[i] -= (unsigned)(dotprod >> shift);
delayp ++; delayp ++;

Loading…
Cancel
Save