From 018afc236ee5df0b05cdddd235fc583e17bb8c4b Mon Sep 17 00:00:00 2001 From: Wan-Teh Chang Date: Thu, 9 Sep 2021 14:55:30 -0700 Subject: [PATCH] Set chroma_sample_position only for YUV 4:2:0 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 https://github.com/AOMediaCodec/av1-avif/issues/88 and https://github.com/AOMediaCodec/av1-spec/pull/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. --- ravif/src/av1encoder.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ravif/src/av1encoder.rs b/ravif/src/av1encoder.rs index ab29c10..b5ced8e 100644 --- a/ravif/src/av1encoder.rs +++ b/ravif/src/av1encoder.rs @@ -351,10 +351,10 @@ fn encode_to_av1(p: &Av1EncodeConfig<'_>) -> Result, Box