shithub: libvpx

Download patch

ref: 6d482706ef07b0f515f167bc7b7728ff1a510700
parent: 1761a6b55a0138ad12e3d9e7a5bfc415a7f6b538
author: John Koleszar <jkoleszar@google.com>
date: Tue Nov 13 10:18:47 EST 2012

SEG_LVL_MODE: don't code ref_frame if it's implicit

If the SEG_LVL_MODE is an intra mode, then the reference frame must be
INTRA_FRAME.

Change-Id: I2cdeeac3780c077c74b39ce89a528bc280674231

--- a/vp9/decoder/decodemv.c
+++ b/vp9/decoder/decodemv.c
@@ -717,7 +717,11 @@
   }
 
   // Read the reference frame
-  mbmi->ref_frame = read_ref_frame(pbi, bc, mbmi->segment_id);
+  if (vp9_segfeature_active(xd, mbmi->segment_id, SEG_LVL_MODE)
+      && vp9_get_segdata(xd, mbmi->segment_id, SEG_LVL_MODE) < NEARESTMV)
+    mbmi->ref_frame = INTRA_FRAME;
+  else
+    mbmi->ref_frame = read_ref_frame(pbi, bc, mbmi->segment_id);
 
   // If reference frame is an Inter frame
   if (mbmi->ref_frame) {
--- a/vp9/encoder/bitstream.c
+++ b/vp9/encoder/bitstream.c
@@ -863,7 +863,12 @@
         }
 
         // Encode the reference frame.
-        encode_ref_frame(bc, pc, xd, segment_id, rf);
+        if (!vp9_segfeature_active(xd, segment_id, SEG_LVL_MODE)
+            || vp9_get_segdata(xd, segment_id, SEG_LVL_MODE) >= NEARESTMV) {
+          encode_ref_frame(bc, pc, xd, segment_id, rf);
+        } else {
+          assert(rf == INTRA_FRAME);
+        }
 
         if (rf == INTRA_FRAME) {
 #ifdef ENTROPY_STATS
--