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

Bit-stuffing issue #4

Open
OliverGorman opened this issue Jan 27, 2021 · 0 comments
Open

Bit-stuffing issue #4

OliverGorman opened this issue Jan 27, 2021 · 0 comments

Comments

@OliverGorman
Copy link

This issue takes place in the process() function of the Encoder class.
If a byte is begun with a stuffed bit, bitPosition is not incremented. This leads to the next byte being loaded before the current byte has been transmitted.

In other words, if bytePosition % 8 == 0 and a bit-stuff occurs, currentByte will be overwritten on the next iteration since the algorithm thinks the byte has finished.

A simple solution would be to introduce a flag that when raised prevents entry into the if(bitPosition == 0) block. It is lowered on each loop before currentBit is set, and raised when a bit-stuff occurs.

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

No branches or pull requests

1 participant