af_scaletempo: add comment to overlap calculation

Also reduce pointer dereferences by one. That won't make much of a
difference (if at all), but since it already needs two lines we might
as well.
This commit is contained in:
Christoph Heinrich 2023-09-29 20:10:07 +02:00 committed by Kacper Michajłow
parent ae7e7d07b8
commit 3a85fd97e5
1 changed files with 6 additions and 4 deletions

View File

@ -211,8 +211,9 @@ static void output_overlap_float(struct priv *s, void *buf_out,
float *po = s->buf_overlap;
float *pin = (float *)(s->buf_queue + bytes_off);
for (int i = 0; i < s->samples_overlap; i++) {
*pout++ = *po - *pb++ *(*po - *pin++);
po++;
// the math is equal to *po * (1 - *pb) + *pin * *pb
float o = *po++;
*pout++ = o - *pb++ * (o - *pin++);
}
}
@ -224,8 +225,9 @@ static void output_overlap_s16(struct priv *s, void *buf_out,
int16_t *po = s->buf_overlap;
int16_t *pin = (int16_t *)(s->buf_queue + bytes_off);
for (int i = 0; i < s->samples_overlap; i++) {
*pout++ = *po - ((*pb++ *(*po - *pin++)) >> 16);
po++;
// the math is equal to *po * (1 - *pb) + *pin * *pb
int32_t o = *po++;
*pout++ = o - ((*pb++ *(o - *pin++)) >> 16);
}
}