mirror of
https://github.com/mpv-player/mpv
synced 2025-02-17 04:58:06 +00:00
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:
parent
ae7e7d07b8
commit
3a85fd97e5
@ -211,8 +211,9 @@ static void output_overlap_float(struct priv *s, void *buf_out,
|
|||||||
float *po = s->buf_overlap;
|
float *po = s->buf_overlap;
|
||||||
float *pin = (float *)(s->buf_queue + bytes_off);
|
float *pin = (float *)(s->buf_queue + bytes_off);
|
||||||
for (int i = 0; i < s->samples_overlap; i++) {
|
for (int i = 0; i < s->samples_overlap; i++) {
|
||||||
*pout++ = *po - *pb++ *(*po - *pin++);
|
// the math is equal to *po * (1 - *pb) + *pin * *pb
|
||||||
po++;
|
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 *po = s->buf_overlap;
|
||||||
int16_t *pin = (int16_t *)(s->buf_queue + bytes_off);
|
int16_t *pin = (int16_t *)(s->buf_queue + bytes_off);
|
||||||
for (int i = 0; i < s->samples_overlap; i++) {
|
for (int i = 0; i < s->samples_overlap; i++) {
|
||||||
*pout++ = *po - ((*pb++ *(*po - *pin++)) >> 16);
|
// the math is equal to *po * (1 - *pb) + *pin * *pb
|
||||||
po++;
|
int32_t o = *po++;
|
||||||
|
*pout++ = o - ((*pb++ *(o - *pin++)) >> 16);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user