Decrease AC chroma on 4:2:2 content with `tune=ssimulacra2` Increase U and V chroma qindex (i.e. lower chroma quality) on AC coefficients when encoding content that uses 4:2:2 chroma subsampling. SSIMULACRA 2 appears to have trouble correctly scoring 4:2:2, so the chroma delta-q value (6) was chosen so encoded chroma channels are roughly the same size of their 4:2:0 and 4:4:4 encoded counterparts, with a subjective validation check to ensure balanced luma/chroma allocation. Approximate BD-Rate gains over no AC chroma decrease - cpu-used=6 (Daala's subset1, for completeness): - SSIMULACRA2 60: -0.3% - SSIMULACRA2 70: -0.3% - SSIMULACRA2 80: -0.19% - SSIMULACRA2 90: N/A (unreacheable) Bug: aomedia:375221136 Change-Id: I61e7d3d5381b794697db5c1c2ad267f192adc1d6
diff --git a/av1/encoder/av1_quantize.c b/av1/encoder/av1_quantize.c index b572923..3ddedce 100644 --- a/av1/encoder/av1_quantize.c +++ b/av1/encoder/av1_quantize.c
@@ -891,6 +891,25 @@ // finding a linear equation that fits the convex hull. chroma_dc_delta_q = -clamp((quant_params->base_qindex / 2) - 14, 0, 16); chroma_ac_delta_q = chroma_dc_delta_q; + } else if (cm->seq_params->subsampling_x == 1 && + cm->seq_params->subsampling_y == 0) { + // 4:2:2 subsampling: Constant chroma AC delta_q increase (i.e. improved + // luma quality relative to chroma) with gradual ramp-down for very low + // qindexes. + // SSIMULACRA 2 appears to have some issues correctly scoring 4:2:2 + // material. Solely optimizing for maximum scores suggests a chroma AC + // delta_q of 12 is the most efficient. However, visual inspection on + // difficult-to-encode material resulted in chroma quality degrading too + // much relative to luma, and chroma channels ending up being too small + // compared to equivalent 4:4:4 or 4:2:0 encodes. + // A chroma AC delta_q of 6 was selected because encoded chroma channels + // have a much closer size to 4:4:4 and 4:2:0 encodes, and have more + // favorable visual quality characteristics. + // The ramp-down of chroma decrease was put into place to match 4:2:0 + // and 4:4:4 behavior. There were no special considerations on + // SSIMULACRA 2 scores. + chroma_dc_delta_q = 0; + chroma_ac_delta_q = clamp((quant_params->base_qindex / 2), 0, 6); } else if (cm->seq_params->subsampling_x == 0 && cm->seq_params->subsampling_y == 0) { // 4:4:4 subsampling: Constant chroma AC delta_q increase (i.e. improved