diff options
author | ferreum <code@ferreum.de> | 2023-08-08 12:50:39 +0200 |
---|---|---|
committer | Niklas Haas <github-daiK1o@haasn.dev> | 2023-09-20 14:36:23 +0200 |
commit | 33d6d0f311b410a5a5a6acb1838a41ec3e91c25b (patch) | |
tree | 92299e69ba7eaa963228b6f43aa5f8b3ef840e46 /audio/filter/af_scaletempo2_internals.h | |
parent | c3bceb324343afe423d24428a56047aeb45d5f67 (diff) | |
download | mpv-33d6d0f311b410a5a5a6acb1838a41ec3e91c25b.tar.bz2 mpv-33d6d0f311b410a5a5a6acb1838a41ec3e91c25b.tar.xz |
af_scaletempo2: fix audio artifact on initial WSOLA iteration
The first WSOLA iteration overlapped audio with whatever was in the
`wsola_output` buffer. This was either silence (if not run before), or
old frames (if switching to 1x and back to a different speed).
Track the state of the output buffer and memcpy the whole window for the
first iteration instead.
Diffstat (limited to 'audio/filter/af_scaletempo2_internals.h')
-rw-r--r-- | audio/filter/af_scaletempo2_internals.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/audio/filter/af_scaletempo2_internals.h b/audio/filter/af_scaletempo2_internals.h index b062159966..64f4104019 100644 --- a/audio/filter/af_scaletempo2_internals.h +++ b/audio/filter/af_scaletempo2_internals.h @@ -80,6 +80,9 @@ struct mp_scaletempo2 { // them and can be copied to output if fill_buffer() is called. It also // specifies the index where the next WSOLA window has to overlap-and-add. int num_complete_frames; + // Whether |wsola_output| contains an additional |ola_hop_size| of overlap + // frames for the next iteration. + bool wsola_output_started; // Overlap-and-add window. float *ola_window; // Transition window, used to update |optimal_block| by a weighted sum of |