Commit 2584a5e5 authored by John Koleszar's avatar John Koleszar
Browse files

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
parent e5b956f6
......@@ -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;
......
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment