From: John Koleszar Date: Wed, 3 Oct 2012 19:11:05 +0000 (-0700) Subject: Add cheap show-buffer operation X-Git-Tag: v1.3.0~1104^2~51^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2584a5e5e5b2c8bb0659944083efd55378303b0c;p=libvpx 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 --- diff --git a/vp9/decoder/vp9_decodframe.c b/vp9/decoder/vp9_decodframe.c index 632560798..aae423f37 100644 --- a/vp9/decoder/vp9_decodframe.c +++ b/vp9/decoder/vp9_decodframe.c @@ -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; diff --git a/vp9/encoder/vp9_bitstream.c b/vp9/encoder/vp9_bitstream.c index c0da212f4..6caec080f 100644 --- a/vp9/encoder/vp9_bitstream.c +++ b/vp9/encoder/vp9_bitstream.c @@ -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);