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

Need a way to signal the JPEG-style "center" chroma sample position for AVIF images #88

Open
wantehchang opened this issue Jul 8, 2020 · 2 comments
Labels

Comments

@wantehchang
Copy link
Collaborator

Right now there does not seem to be a way to signal the JPEG-style "center" chroma sample position for AVIF images.

The AV1 specification defines the following four values for the chroma_sample_position syntax element (encoded using two bits):

  • 0 CSP_UNKNOWN: Unknown (in this case the source video transfer function must be signaled outside the AV1 bitstream)
  • 1 CSP_VERTICAL: Horizontally co-located with (0, 0) luma sample, vertical position in the middle between two luma samples
  • 2 CSP_COLOCATED: co-located with (0, 0) luma sample
  • 3 CSP_RESERVED

We have some options.

  1. Set chroma_sample_position to CSP_UNKNOWN in the AV1 bitstream, and amend the AVIF spec to interpret CSP_UNKOWN as the JPEG-style "center" chroma sample position.
  2. Set chroma_sample_position to CSP_UNKNOWN in the AV1 bitstream, and amend the AVIF spec to signal the chroma sample position in the AVIF container format. This option allows AVIF to potentially have more than four chroma sample positions (encoded using more than two bits).
  3. Amend the AV1 specification to assign the currently reserved value of 3 to the JPEG-style "center" chroma sample position.

I think Option 3 is the best.

@cconcolato
Copy link
Collaborator

There is a PR in the AV1 spec to implement option 3: AOMediaCodec/av1-spec#308

wantehchang added a commit to wantehchang/cavif-rs that referenced this issue Sep 9, 2021
The chroma_sample_position syntax element is only used for YUV 4:2:0 in
the AV1 bitstream. So set chroma_sample_position to
ChromaSamplePosition::Unknown for all other YUV formats, including
monochrome (YUV 4:0:0).

Note: For still images, the most common chroma sample position in
practice is the "center" position. Unfortunately the AV1 specification
does not have a value for the "center" chroma sample position. See
AOMediaCodec/av1-avif#88 and
AOMediaCodec/av1-spec#308. This pull request
preserves the ChromaSamplePosition::Colocated value that is currently
used, but it is likely to be incorrect when YUV 4:2:0 is supported.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants
@cconcolato @wantehchang and others