shithub: dav1d

Download patch

ref: 2532642bbbdfcc77140846e1403a6b393eaba974
parent: 066b02c2d8926222ff547679b900573de7415713
author: Rupert Swarbrick <[email protected]>
date: Wed Oct 17 14:16:00 EDT 2018

Fix how we read the UV quantization level

See section 5.9.12 of the AV1 spec. The flag controlling U and V share
a quantization level wasn't being read.

--- a/src/obu.c
+++ b/src/obu.c
@@ -523,9 +523,13 @@
     hdr->quant.yac = dav1d_get_bits(gb, 8);
     hdr->quant.ydc_delta = dav1d_get_bits(gb, 1) ? dav1d_get_sbits(gb, 6) : 0;
     if (seqhdr->layout != DAV1D_PIXEL_LAYOUT_I400) {
+        // If the sequence header says that delta_q might be different
+        // for U, V, we must check whether it actually is for this
+        // frame.
+        int diff_uv_delta = seqhdr->separate_uv_delta_q ? dav1d_get_bits(gb, 1) : 0;
         hdr->quant.udc_delta = dav1d_get_bits(gb, 1) ? dav1d_get_sbits(gb, 6) : 0;
         hdr->quant.uac_delta = dav1d_get_bits(gb, 1) ? dav1d_get_sbits(gb, 6) : 0;
-        if (seqhdr->separate_uv_delta_q) {
+        if (diff_uv_delta) {
             hdr->quant.vdc_delta = dav1d_get_bits(gb, 1) ? dav1d_get_sbits(gb, 6) : 0;
             hdr->quant.vac_delta = dav1d_get_bits(gb, 1) ? dav1d_get_sbits(gb, 6) : 0;
         } else {