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

Update uvlc definition to match implementations #343

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fhvwy
Copy link

@fhvwy fhvwy commented Nov 27, 2023

The specified uvlc parsing process does not match that used by the libaom reference implementation [1]. The specification encodes 2^32-1 as at least thirty-two zero bits followed by a one, while libaom uses exactly thirty-two zero bits without a one. Other implementations also do not match the specification here ([2] matches the libaom behaviour, [3] raises an error if it sees this case).

The difference is never encountered in conforming streams because the one syntax element using the uvlc parsing process
(num_ticks_per_picture_minus_1) is not allowed to take the maximum value of 2^32-1. Given that this area is therefore not covered for conformance purposes, it seems easier to update the text of the specification to match the existing implementations than to do the reverse.

[1] https://aomedia.googlesource.com/aom/+/refs/heads/main/aom_dsp/bitreader_buffer.c, line 63.

[2] https://gitlab.com/AOMediaCodec/SVT-AV1/-/blob/master/Source/Lib/Decoder/Codec/EbDecBitstream.c?ref_type=heads#L68

[3] https://chromium.googlesource.com/codecs/libgav1/+/refs/heads/main/src/utils/raw_bit_reader.cc, line 161.

The specified uvlc parsing process does not match that used by the
libaom reference implementation [1].  The specification encodes 2^32-1
as at least thirty-two zero bits followed by a one, while libaom uses
exactly thirty-two zero bits without a one.  Other implementations also
do not match the specification here ([2] matches the libaom behaviour,
[3] raises an error if it sees this case).

The difference is never encountered in conforming streams because the
one syntax element using the uvlc parsing process
(num_ticks_per_picture_minus_1) is not allowed to take the maximum
value of 2^32-1.  Given that this area is therefore not covered for
conformance purposes, it seems easier to update the text of the
specification to match the existing implementations than to do the
reverse.

[1] <https://aomedia.googlesource.com/aom/+/refs/heads/main/aom_dsp/bitreader_buffer.c>, line 63.

[2] <https://gitlab.com/AOMediaCodec/SVT-AV1/-/blob/master/Source/Lib/Decoder/Codec/EbDecBitstream.c?ref_type=heads#L68>

[3] <https://chromium.googlesource.com/codecs/libgav1/+/refs/heads/main/src/utils/raw_bit_reader.cc>, line 161.
@peterderivaz
Copy link
Collaborator

Looks reasonable to me.

I am not sure if any of the important people get notified of issues here, so you will probably have to mention it at the working group to get the change adopted. If there is reluctance to change the content, then at least a note could be added to prevent others from having to debug the same issue again!

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.

2 participants