Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cycle buffers #530

Merged
merged 2 commits into from
Jul 3, 2023
Merged

Cycle buffers #530

merged 2 commits into from
Jul 3, 2023

Conversation

froody
Copy link

@froody froody commented Jul 1, 2023

Fix for #528

I'm unsure about the correctness of this change but I ran all the unit tests and they all passed. The attached test fails before the addition of _cycle_buffers and passes after adding _cycle_buffers.

My rationale for the fix is that all the sites that were swapping buffers looked like they intended to rotate 3 variables, but actually lose a variable each time:

_src = _dest;
_dest = _tmp;
_tmp = _src;

is equivalent to

uint8_t *scratch = _dest;
_dest = _tmp;
_src = scratch;
_tmp = scratch;

So that any filter which writes to the _tmp buffer will be corrupting its own input.

@FrancescAlted
Copy link
Member

Well seen! This produces a warning on the params of the new _cycle_buffers, but I will fix that later on. Thanks @froody !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants