shithub: libvpx

Download patch

ref: 6f361f58410941e09dfebf9063ba222dfcb98e75
parent: 4c021c1d542ac5af2f63fcee5637d0e468cdc058
parent: 9e5bb9598c57eccd9115080e1a6b1375b82a77e3
author: Adrian Grange <[email protected]>
date: Thu May 30 06:56:25 EDT 2013

Merge "Add intra_only and reset_frame_context flags" into experimental

--- a/vp9/common/vp9_onyxc_int.h
+++ b/vp9/common/vp9_onyxc_int.h
@@ -154,6 +154,12 @@
   int show_frame;
   int last_show_frame;
 
+  // Flag signaling that the frame is encoded using only INTRA modes.
+  int intra_only;
+
+  // Flag signaling that the frame context should be reset to default values.
+  int reset_frame_context;
+
   int frame_flags;
   // MBs, mb_rows/cols is in 16-pixel units; mi_rows/cols is in
   // MODE_INFO (8-pixel) units.
--- a/vp9/decoder/vp9_decodframe.c
+++ b/vp9/decoder/vp9_decodframe.c
@@ -955,16 +955,25 @@
                            "Invalid frame sync code");
     }
   }
+
   setup_frame_size(pbi, scaling_active, rb);
 
+  if (!cm->show_frame) {
+    cm->intra_only = vp9_rb_read_bit(rb);
+  } else {
+    cm->intra_only = 0;
+  }
+
   cm->frame_context_idx = vp9_rb_read_literal(rb, NUM_FRAME_CONTEXTS_LG2);
   cm->clr_type = (YUV_TYPE)vp9_rb_read_bit(rb);
 
   cm->error_resilient_mode = vp9_rb_read_bit(rb);
   if (!cm->error_resilient_mode) {
+    cm->reset_frame_context = vp9_rb_read_bit(rb);
     cm->refresh_frame_context = vp9_rb_read_bit(rb);
     cm->frame_parallel_decoding_mode = vp9_rb_read_bit(rb);
   } else {
+    cm->reset_frame_context = 0;
     cm->refresh_frame_context = 0;
     cm->frame_parallel_decoding_mode = 1;
   }
--- a/vp9/encoder/vp9_bitstream.c
+++ b/vp9/encoder/vp9_bitstream.c
@@ -1490,7 +1490,6 @@
   }
 }
 
-
 void write_uncompressed_header(VP9_COMMON *cm,
                                struct vp9_write_bit_buffer *wb) {
   const int scaling_active = cm->width != cm->display_width ||
@@ -1517,11 +1516,16 @@
   vp9_wb_write_literal(wb, cm->width, 16);
   vp9_wb_write_literal(wb, cm->height, 16);
 
+  if (!cm->show_frame) {
+      vp9_wb_write_bit(wb, cm->intra_only);
+  }
+
   vp9_wb_write_literal(wb, cm->frame_context_idx, NUM_FRAME_CONTEXTS_LG2);
   vp9_wb_write_bit(wb, cm->clr_type);
 
   vp9_wb_write_bit(wb, cm->error_resilient_mode);
   if (!cm->error_resilient_mode) {
+    vp9_wb_write_bit(wb, cm->reset_frame_context);
     vp9_wb_write_bit(wb, cm->refresh_frame_context);
     vp9_wb_write_bit(wb, cm->frame_parallel_decoding_mode);
   }
--- a/vp9/encoder/vp9_onyx_if.c
+++ b/vp9/encoder/vp9_onyx_if.c
@@ -1190,6 +1190,7 @@
   cpi->refresh_golden_frame = 0;
   cpi->refresh_last_frame = 1;
   cm->refresh_frame_context = 1;
+  cm->reset_frame_context = 0;
 
   setup_features(cpi);
   cpi->mb.e_mbd.allow_high_precision_mv = 0;   // Default mv precision adaptation
@@ -2617,6 +2618,7 @@
       (cpi->oxcf.frame_parallel_decoding_mode != 0);
     if (cm->error_resilient_mode) {
       cm->frame_parallel_decoding_mode = 1;
+      cm->reset_frame_context = 0;
       cm->refresh_frame_context = 0;
     }
   }
@@ -3671,6 +3673,7 @@
       }
 
       cm->show_frame = 0;
+      cm->intra_only = 0;
       cpi->refresh_alt_ref_frame = 1;
       cpi->refresh_golden_frame = 0;
       cpi->refresh_last_frame = 0;
@@ -3875,6 +3878,7 @@
     cpi->droppable = !frame_is_reference(cpi);
 
     // return to normal state
+    cm->reset_frame_context = 0;
     cm->refresh_frame_context = 1;
     cpi->refresh_alt_ref_frame = 0;
     cpi->refresh_golden_frame = 0;