Add intra_only and reset_frame_context flags
Added two flags to the frame header: intra_only: Signals that the frame is encoded using only INTRA coding modes. reset_frame_context: Indicates that the coding context specified in the frame header should be reset to default values before the frame is encoded/decoded. Change-Id: I182d46f1f84fb67a13c46ad767f246a38d7861a2
This commit is contained in:
parent
38cb616fbf
commit
9e5bb9598c
@ -154,6 +154,12 @@ typedef struct VP9Common {
|
||||
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.
|
||||
|
@ -955,16 +955,25 @@ size_t read_uncompressed_header(VP9D_COMP *pbi,
|
||||
"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;
|
||||
}
|
||||
|
@ -1482,7 +1482,6 @@ static void encode_segmentation(VP9_COMP *cpi, vp9_writer *w) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void write_uncompressed_header(VP9_COMMON *cm,
|
||||
struct vp9_write_bit_buffer *wb) {
|
||||
const int scaling_active = cm->width != cm->display_width ||
|
||||
@ -1509,11 +1508,16 @@ void write_uncompressed_header(VP9_COMMON *cm,
|
||||
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);
|
||||
}
|
||||
|
@ -1191,6 +1191,7 @@ void vp9_change_config(VP9_PTR ptr, VP9_CONFIG *oxcf) {
|
||||
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
|
||||
@ -2618,6 +2619,7 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
|
||||
(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;
|
||||
}
|
||||
}
|
||||
@ -3675,6 +3677,7 @@ int vp9_get_compressed_data(VP9_PTR ptr, unsigned int *frame_flags,
|
||||
}
|
||||
|
||||
cm->show_frame = 0;
|
||||
cm->intra_only = 0;
|
||||
cpi->refresh_alt_ref_frame = 1;
|
||||
cpi->refresh_golden_frame = 0;
|
||||
cpi->refresh_last_frame = 0;
|
||||
@ -3879,6 +3882,7 @@ int vp9_get_compressed_data(VP9_PTR ptr, unsigned int *frame_flags,
|
||||
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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user