shithub: libvpx

Download patch

ref: 2584a5e5e5b2c8bb0659944083efd55378303b0c
parent: e5b956f620ffc3b84c71b88e41e67c15095f7c1c
author: John Koleszar <jkoleszar@google.com>
date: Wed Oct 3 08:11:05 EDT 2012

Add cheap show-buffer operation

Adds the ability to have the decoder show one of the existing reference
frames directly, without having to code it indirectly as a series of
skip blocks.

Change-Id: Ib6c26c5f6a8709863cf304ab890db8559687d25e

--- a/vp9/decoder/vp9_decodframe.c
+++ b/vp9/decoder/vp9_decodframe.c
@@ -926,10 +926,17 @@
   cm->version = vp9_rb_read_bit(rb);
   RESERVED;
 
+  if (vp9_rb_read_bit(rb)) {
+    // show an existing frame directly
+    int frame_to_show = cm->ref_frame_map[vp9_rb_read_literal(rb, 3)];
+    ref_cnt_fb(cm->fb_idx_ref_cnt, &cm->new_fb_idx, frame_to_show);
+    pbi->refresh_frame_flags = 0;
+    cm->filter_level = 0;
+    return 0;
+  }
   cm->frame_type = (FRAME_TYPE) vp9_rb_read_bit(rb);
   cm->show_frame = vp9_rb_read_bit(rb);
   scaling_active = vp9_rb_read_bit(rb);
-  RESERVED;
 
   if (cm->frame_type == KEY_FRAME) {
     if (vp9_rb_read_literal(rb, 8) != SYNC_CODE_0 ||
@@ -1038,6 +1045,11 @@
   const int keyframe = pc->frame_type == KEY_FRAME;
   YV12_BUFFER_CONFIG *new_fb = &pc->yv12_fb[pc->new_fb_idx];
 
+  if (!first_partition_size) {
+    // showing a frame directly
+    *p_data_end = data + 1;
+    return 0;
+  }
   data += vp9_rb_bytes_read(&rb);
   xd->corrupted = 0;
   new_fb->corrupted = 0;
--- a/vp9/encoder/vp9_bitstream.c
+++ b/vp9/encoder/vp9_bitstream.c
@@ -1327,10 +1327,10 @@
   vp9_wb_write_bit(wb, cm->version);
   vp9_wb_write_bit(wb, 0);
 
+  vp9_wb_write_bit(wb, 0);
   vp9_wb_write_bit(wb, cm->frame_type);
   vp9_wb_write_bit(wb, cm->show_frame);
   vp9_wb_write_bit(wb, scaling_active);
-  vp9_wb_write_bit(wb, 0);
 
   if (cm->frame_type == KEY_FRAME) {
     vp9_wb_write_literal(wb, SYNC_CODE_0, 8);
--