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

Renamed stream_t to inbits/outbits #1

Open
wants to merge 6 commits into
base: entropy1
Choose a base branch
from

Conversation

jmvalin
Copy link

@jmvalin jmvalin commented Aug 11, 2015

Using the same type name in the encoder and decoder was confusing (esp.
to Eclipse) and _t is reserved by posix.

Timothy B. Terriberry and others added 6 commits August 7, 2015 14:19
This adds simple framing to the stream so that each frame may be
 parsed individually.
This is done by just adding a 4-byte big-endian length field to the
 start of each frame and byte-aligning the end of each frame.
The extra storage for this framing (4.5 bytes pre frame on average)
 is not included in the printed statistics, though it will show up
 on AWCY, which uses the actual file size.
The encoder would write, and the decoder would read, split flags
 for 8x8 blocks in keyframes, which could cause the decoder to
 split blocks down to invalid sizes given invalid streams, causing
 crashes.
To prevent this, just don't write or read the useless bits.
This will trap when run in a debugger, allowing the developer to
 examine backtraces, etc., to determine the cause of the error.
The encoder would write, and the decoder would read, split flags
 for rectangular blocks on the edge of a frame in keyframes.
The only way to not split such blocks is to skip them, which is not
 a choice available in keyframes.
In an invalid stream, when the decoder would read a flag telling it
 not to split a rectangular block, it would immediately return
 without filling in the deblocking info for that block.
This would cause FPE's in the deblocking code when attempting to
 compute j%q_size (with q_size uninitialized at 0).
To prevent this, just don't write or read the useless bits.
Daala's entropy coder supports a "raw bits" mode which just writes
 bits directly, working backwards from the end of the stream.
This should be essentially as fast as Thor's current bit writing
 and reading code.

This patch replaces that code with Daala's, allowing future patches
 to use the non-raw entropy coder.
This lets the existing code be converted a piece at a time.

Unfortuntaely, because Thor uses VLCs and does not match the number
 of bits written at the encoder with the number of bits it attempts
 to read at the decoder, the order the bits are written to the
 stream matters.
As a short-term solution, we currently bitreverse all bits before
 writing and bitreverse them again after reading, so that the
 relative order of bits remains the same.
It would also be possible to modify the calling code to expect the
 bits to be in a different order without any of this overhead.
Using the same type name in the encoder and decoder was confusing (esp.
to Eclipse) and _t is reserved by posix.
@tterribe tterribe force-pushed the entropy1 branch 2 times, most recently from 71295ed to 3535f7c Compare November 1, 2015 22:13
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.

1 participant