shithub: libvpx

Download patch

ref: 5372f1e41e8f32b34e34bf2ef012a1d37542abad
parent: 1c875f11f2efacf13ba4a00cdb98642379feaac8
parent: affd9921e405063ed7815f412b15e634c8c9cfca
author: Yunqing Wang <[email protected]>
date: Thu Jul 11 11:07:35 EDT 2019

Merge "Set up frame contexts based on frame type"

--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -814,7 +814,17 @@
   if (frame_is_intra_only(cm) || cm->error_resilient_mode) {
     vp9_setup_past_independence(cm);
   } else {
-    if (!cpi->use_svc) cm->frame_context_idx = cpi->refresh_alt_ref_frame;
+    if (!cpi->use_svc) {
+      const int boost_frame =
+          !cpi->rc.is_src_frame_alt_ref &&
+          (cpi->refresh_golden_frame || cpi->refresh_alt_ref_frame);
+      if (boost_frame)
+        cm->frame_context_idx = 1;
+      else if (cpi->rc.is_src_frame_alt_ref)
+        cm->frame_context_idx = 2;
+      else
+        cm->frame_context_idx = 3;
+    }
   }
 
   // TODO(jingning): Overwrite the frame_context_idx index in multi-layer ARF