]> granicus.if.org Git - libvpx/commitdiff
Add cheap show-buffer operation
authorJohn Koleszar <jkoleszar@google.com>
Wed, 3 Oct 2012 19:11:05 +0000 (12:11 -0700)
committerJohn Koleszar <jkoleszar@google.com>
Fri, 7 Jun 2013 07:48:03 +0000 (00:48 -0700)
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

vp9/decoder/vp9_decodframe.c
vp9/encoder/vp9_bitstream.c

index 632560798ec0e0636f43f65b94148e8feee61d87..aae423f373c7765abb1c6505086026d7ffdd3538 100644 (file)
@@ -926,10 +926,17 @@ size_t read_uncompressed_header(VP9D_COMP *pbi,
   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 @@ int vp9_decode_frame(VP9D_COMP *pbi, const uint8_t **p_data_end) {
   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;
index c0da212f4053ae9bd96ad9da3c920e6889ae383a..6caec080f37883b1e20d0a9632f1bbb7bbaa9de1 100644 (file)
@@ -1327,10 +1327,10 @@ void write_uncompressed_header(VP9_COMP *cpi,
   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);