shithub: dav1d

Download patch

ref: b3be34bf7ec86d772bbd85cc8afd502ad4af83d3
parent: 19ba5a9431f2ed19c129d3e657df6290ddb97dfe
author: Ronald S. Bultje <rsbultje@gmail.com>
date: Tue Sep 25 09:02:48 EDT 2018

Don't read filmgrain parameters for never-visible frames.

Also a tiny fix to ensure that frame-difference is always evaluated
in the correct wraparound order.

--- a/src/env.h
+++ b/src/env.h
@@ -307,7 +307,7 @@
                                    const int yb4, const int xb4)
 {
     const unsigned d0 = abs(get_poc_diff(order_hint_n_bits, ref0poc, poc));
-    const unsigned d1 = abs(get_poc_diff(order_hint_n_bits, ref1poc, poc));
+    const unsigned d1 = abs(get_poc_diff(order_hint_n_bits, poc, ref1poc));
     const int offset = d0 == d1;
     const int a_ctx = a->comp_type[xb4] >= COMP_INTER_AVG ||
                       a->ref[0][xb4] == 6;
--- a/src/obu.c
+++ b/src/obu.c
@@ -862,7 +862,9 @@
            (gb->ptr - init_ptr) * 8 - gb->bits_left);
 #endif
 
-    hdr->film_grain.present = seqhdr->film_grain_present && get_bits(gb, 1);
+    hdr->film_grain.present = seqhdr->film_grain_present &&
+                              (hdr->show_frame || hdr->showable_frame) &&
+                              get_bits(gb, 1);
     if (hdr->film_grain.present) {
         hdr->film_grain.seed = get_bits(gb, 16);
         hdr->film_grain.update = hdr->frame_type != INTER_FRAME || get_bits(gb, 1);