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

AVIF encoding uses chroma subsampling #1368

Open
kornelski opened this issue Jun 12, 2023 · 2 comments
Open

AVIF encoding uses chroma subsampling #1368

kornelski opened this issue Jun 12, 2023 · 2 comments

Comments

@kornelski
Copy link

AVIF encoding option has "Subsample chroma: Half".

This is an exceptionally bad choice:

  1. Chroma upsampling algorithm is not specified for AVIF, which makes a blocky nearest-neighbor a valid implementation. Appearance of AVIFs with subsampled chroma will be inconsistent across implementations. This is even worse than the worst of WebP, because WebP at least has a guaranteed upsampling algorithm and filters that reduce the distortion.

  2. AV1 supports chroma-from-luma compression technique, which is a proper effective way to compress chroma. Naive destruction of 75% of the color data misses out on the unique ability to compress it well.

I think it'd be best to completely remove the subsampling option, and pretend it never existed.

@jakearchibald
Copy link
Collaborator

jakearchibald commented Jun 12, 2023

It's the default in avif-enc, right?

I agree that lack of specified upscaling is bad, they should fix that.

From my own testing, for photos, subsampling still seems worth it in terms of compression. But yeah, I worry that the option is buried, because you don't want it for other types of imagery.

@kornelski
Copy link
Author

I've asked for upsampling to be specified, and it has been closed as wontfix.

I would not interpret defaults of avif-enc as an informed recommendation. Codecs and their tooling are full of "we've always done it this way", and subsampling has been a normal thing since 1953.

AV1 inherited a few weird features and a ton of obsolete color modes that nobody should be using anymore, which are carried over because people don't want to touch Chesterton's fence.

AFAIK AV1 is the first codec to have chroma-from-luma technique which allows it to compress full-res sharp chroma cheaply. It also scales to low bitrates very well, so even if you want to mangle color, you can do by increasing compression of chroma channels without having to outright decimate their resolution.

Subsampling is useful in JPEG which isn’t as resolution-independent and lower-res higher-quality channel may look better than a higher-res lower-quality channel. But there’s no such problem with AV1, so subsampling just destroys chroma’s edges without having a chance to use any of AV1’s techniques that could have saved those edges.

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

2 participants