1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-10 06:10:52 +02:00

avcodec/apedec: Move pointer instead of copying each element in delay in long_filter_high_3800()

~1000 -> 930 cycles

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer
2023-04-23 23:51:38 +02:00
parent b614388056
commit eb768a75f8

View File

@@ -944,7 +944,7 @@ static void long_filter_high_3800(int32_t *buffer, int order, int shift, int len
{ {
int i, j; int i, j;
int32_t dotprod, sign; int32_t dotprod, sign;
int32_t coeffs[256], delay[256]; int32_t coeffs[256], delay[256+256], *delayp = delay;
if (order >= length) if (order >= length)
return; return;
@@ -956,13 +956,16 @@ static void long_filter_high_3800(int32_t *buffer, int order, int shift, int len
dotprod = 0; dotprod = 0;
sign = APESIGN(buffer[i]); sign = APESIGN(buffer[i]);
for (j = 0; j < order; j++) { for (j = 0; j < order; j++) {
dotprod += delay[j] * (unsigned)coeffs[j]; dotprod += delayp[j] * (unsigned)coeffs[j];
coeffs[j] += ((delay[j] >> 31) | 1) * sign; coeffs[j] += ((delayp[j] >> 31) | 1) * sign;
} }
buffer[i] -= (unsigned)(dotprod >> shift); buffer[i] -= (unsigned)(dotprod >> shift);
for (j = 0; j < order - 1; j++) delayp ++;
delay[j] = delay[j + 1]; delayp[order - 1] = buffer[i];
delay[order - 1] = buffer[i]; if (delayp - delay == 256) {
memcpy(delay, delayp, sizeof(*delay)*256);
delayp = delay;
}
} }
} }