AOMediaCodec / av1-avif

AV1 Image File Format Specification - ISO-BMFF/HEIF derivative
https://aomediacodec.github.io/av1-avif/
BSD 2-Clause "Simplified" License
466 stars 40 forks source link

Chroma upsampling filter #98

Closed kornelski closed 3 years ago

kornelski commented 4 years ago

I can't find whether upsampling filter is specified for either AV1 or AVIF. It seems it only specifies chroma sample position, but not how to interpolate the samples.

Differences in upsampling filters can cause significantly different visual artifacts, and make it impossible for encoders to optimize visual quality and aim for (nearly) pixel-perfect decoding.

I suggest following what JPEG did in JPEG-XT spec, and require a triangle filter when upscaling subsampled chroma channels.

paperboyo commented 4 years ago

👋 Related (?): https://bugs.chromium.org/p/chromium/issues/detail?id=1121579 https://bugzilla.mozilla.org/show_bug.cgi?id=1657300

alexismt73 commented 4 years ago

Commonly video specifications do not mandate how operations such as chroma upsampling are performed. This is because such operations may be handled through the display pipeline and different implementors may have already their own filter implementations. Such implementations may also be used for multiple specifications. Making this normative could make those implementations not conformant for relatively small benefit. Therefore, mandating such operations would be, in this context, undesirable.

However, it was agreed that if a "recommended" filter was provided as a hint (i.e. metadata) to the decoder that could be useful and maybe could achieve the desired intent, although only for decoders capable of recognizing and handling such a hint. Such hints would be completely optional and a decoder would not need to act on them. The group will try to define such metadata either as a new OBU or using the T.35 mechanism. Similar metadata also exists in other video specifications (see chroma resampling filter hint SEI message in the HEVC/H.265 specification).

kornelski commented 4 years ago

The constraints and expectations for video are different than images:

kornelski commented 4 years ago

My suggestion is to define a single recommended upsampling filter for chroma, and make it a SHOULD in the spec.

This will avoid extra metadata in AVIF. It will allow software decoders to conform by supporting just that one method instead of adding more code paths. The multitude of color spaces and subsampling variations allowed in AV1 is already painful to support, and forces software to create fast paths for most common combinations of settings. Any new option risks having to double amount of code in the fast paths, which is highly undesirable. Code size is a problem for AVIF adoption currently. Support for exotic inflexible YUV video outputs isn't even on the radar of image decoder implementers.

leo-barnes commented 4 years ago

This was discussed during the last meeting, but we did not have time to fully come to a conclusion. We will discuss it again at the next meeting. Some comments that came up during the discussion in a kind of random order:

leo-barnes commented 3 years ago

This has been extensively discussed during the last couple of meetings with the conclusion that we think it is unlikely that implementations of AV1 decoders/renderers can converge on implementing a common upsampling chroma filter, and therefore recommending one is difficult. Additionally, we would have to recommend at least one filter for HDR and one for SDR.

Outside of AVIF, the following documents exist that contain best practices for dealing with subsampled chroma: SDR: https://www.itu.int/wftp3/av-arch/jvt-site/2003_09_SanDiego/JVT-I019r2.doc HDR: https://www.itu.int/rec/T-REC-H.Sup15-201701-I

The conclusion was also that content creators should ideally avoid subsampled chroma for still images if at all possible. This is extra important for PQ HDR images.

jyrkialakuijala commented 3 years ago

Which implementation(s) of AVIF encoding have a mature YUV444 model (for example with quantization matrices fitted for YUV444) that one can use for quality evaluation of AVIF YUV444?