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

Add Daala's Entropy Coder to Thor #8

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

tterribe
Copy link

@tterribe tterribe commented Aug 7, 2015

No description provided.

@metajack
Copy link
Contributor

metajack commented Aug 7, 2015

No comment about the results?

@tterribe
Copy link
Author

tterribe commented Aug 7, 2015

This doesn't convert any of the existing symbols to use arithmetic coding, so the only significant changes in results are due to the extra framing added in the first commit (see that commit for details).

Timothy B. Terriberry added 4 commits November 1, 2015 12:46
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.
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.

Unfortunately, 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.
@thdav
Copy link
Contributor

thdav commented Nov 4, 2015

Merged except for the actual addition of the entropy coder. Please can you rebase on the current master again and I will push to a new branch. It might also be an idea to reverse the Daala convention, and write raw bits forward and arithmetic coding bytes backwards.

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