Commit c2502b55 authored by Yunqing Wang's avatar Yunqing Wang

Make ext_tile compatible with reference_buffer

In ext_tile experiment, when cm->large_scale_tile is 1, prev_frame_id can be
the same as current_frame_id, which is prohibited in reference_buffer
experiment and causes "CORRUPT_FRAME" error to be reported.

In this patch, enable/disable reference_buffer according to large_scale_tile
value, and thus make these 2 experiments compatible.

Change-Id: If64943acb91e7a7b859db4e2ac62581e9b53ef85
parent 5b70174f
...@@ -224,6 +224,9 @@ static aom_codec_err_t decoder_peek_si_internal( ...@@ -224,6 +224,9 @@ static aom_codec_err_t decoder_peek_si_internal(
struct aom_read_bit_buffer rb = { data, data + data_sz, 0, NULL, NULL }; struct aom_read_bit_buffer rb = { data, data + data_sz, 0, NULL, NULL };
const int frame_marker = aom_rb_read_literal(&rb, 2); const int frame_marker = aom_rb_read_literal(&rb, 2);
const BITSTREAM_PROFILE profile = av1_read_profile(&rb); const BITSTREAM_PROFILE profile = av1_read_profile(&rb);
#if CONFIG_EXT_TILE
unsigned int large_scale_tile;
#endif // CONFIG_EXT_TILE
if (frame_marker != AOM_FRAME_MARKER) return AOM_CODEC_UNSUP_BITSTREAM; if (frame_marker != AOM_FRAME_MARKER) return AOM_CODEC_UNSUP_BITSTREAM;
...@@ -232,6 +235,10 @@ static aom_codec_err_t decoder_peek_si_internal( ...@@ -232,6 +235,10 @@ static aom_codec_err_t decoder_peek_si_internal(
if ((profile >= 2 && data_sz <= 1) || data_sz < 1) if ((profile >= 2 && data_sz <= 1) || data_sz < 1)
return AOM_CODEC_UNSUP_BITSTREAM; return AOM_CODEC_UNSUP_BITSTREAM;
#if CONFIG_EXT_TILE
large_scale_tile = aom_rb_read_literal(&rb, 1);
#endif // CONFIG_EXT_TILE
if (aom_rb_read_bit(&rb)) { // show an existing frame if (aom_rb_read_bit(&rb)) { // show an existing frame
aom_rb_read_literal(&rb, 3); // Frame buffer to show. aom_rb_read_literal(&rb, 3); // Frame buffer to show.
return AOM_CODEC_OK; return AOM_CODEC_OK;
...@@ -248,6 +255,9 @@ static aom_codec_err_t decoder_peek_si_internal( ...@@ -248,6 +255,9 @@ static aom_codec_err_t decoder_peek_si_internal(
int frame_id_len; int frame_id_len;
SequenceHeader seq_params; SequenceHeader seq_params;
read_sequence_header(&seq_params); read_sequence_header(&seq_params);
#if CONFIG_EXT_TILE
if (large_scale_tile) seq_params.frame_id_numbers_present_flag = 0;
#endif // CONFIG_EXT_TILE
if (seq_params.frame_id_numbers_present_flag) { if (seq_params.frame_id_numbers_present_flag) {
frame_id_len = seq_params.frame_id_length_minus7 + 7; frame_id_len = seq_params.frame_id_length_minus7 + 7;
aom_rb_read_literal(&rb, frame_id_len); aom_rb_read_literal(&rb, frame_id_len);
......
...@@ -3273,7 +3273,6 @@ static void read_tile_info(AV1Decoder *const pbi, ...@@ -3273,7 +3273,6 @@ static void read_tile_info(AV1Decoder *const pbi,
struct aom_read_bit_buffer *const rb) { struct aom_read_bit_buffer *const rb) {
AV1_COMMON *const cm = &pbi->common; AV1_COMMON *const cm = &pbi->common;
#if CONFIG_EXT_TILE #if CONFIG_EXT_TILE
cm->large_scale_tile = aom_rb_read_literal(rb, 1);
cm->single_tile_decoding = 0; cm->single_tile_decoding = 0;
if (cm->large_scale_tile) { if (cm->large_scale_tile) {
struct loopfilter *lf = &cm->lf; struct loopfilter *lf = &cm->lf;
...@@ -4422,6 +4421,13 @@ static size_t read_uncompressed_header(AV1Decoder *pbi, ...@@ -4422,6 +4421,13 @@ static size_t read_uncompressed_header(AV1Decoder *pbi,
aom_internal_error(&cm->error, AOM_CODEC_UNSUP_BITSTREAM, aom_internal_error(&cm->error, AOM_CODEC_UNSUP_BITSTREAM,
"Unsupported bitstream profile"); "Unsupported bitstream profile");
#if CONFIG_EXT_TILE
cm->large_scale_tile = aom_rb_read_literal(rb, 1);
#if CONFIG_REFERENCE_BUFFER
if (cm->large_scale_tile) pbi->seq_params.frame_id_numbers_present_flag = 0;
#endif // CONFIG_REFERENCE_BUFFER
#endif // CONFIG_EXT_TILE
cm->show_existing_frame = aom_rb_read_bit(rb); cm->show_existing_frame = aom_rb_read_bit(rb);
if (cm->show_existing_frame) { if (cm->show_existing_frame) {
......
...@@ -3561,7 +3561,6 @@ static void fix_interp_filter(AV1_COMMON *cm, FRAME_COUNTS *counts) { ...@@ -3561,7 +3561,6 @@ static void fix_interp_filter(AV1_COMMON *cm, FRAME_COUNTS *counts) {
static void write_tile_info(const AV1_COMMON *const cm, static void write_tile_info(const AV1_COMMON *const cm,
struct aom_write_bit_buffer *wb) { struct aom_write_bit_buffer *wb) {
#if CONFIG_EXT_TILE #if CONFIG_EXT_TILE
aom_wb_write_literal(wb, cm->large_scale_tile, 1);
if (cm->large_scale_tile) { if (cm->large_scale_tile) {
const int tile_width = const int tile_width =
ALIGN_POWER_OF_TWO(cm->tile_width, cm->mib_size_log2) >> ALIGN_POWER_OF_TWO(cm->tile_width, cm->mib_size_log2) >>
...@@ -4165,9 +4164,17 @@ static void write_bitdepth_colorspace_sampling( ...@@ -4165,9 +4164,17 @@ static void write_bitdepth_colorspace_sampling(
} }
#if CONFIG_REFERENCE_BUFFER #if CONFIG_REFERENCE_BUFFER
void write_sequence_header(SequenceHeader *seq_params) { void write_sequence_header(
#if CONFIG_EXT_TILE
AV1_COMMON *const cm,
#endif // CONFIG_EXT_TILE
SequenceHeader *seq_params) {
/* Placeholder for actually writing to the bitstream */ /* Placeholder for actually writing to the bitstream */
seq_params->frame_id_numbers_present_flag = FRAME_ID_NUMBERS_PRESENT_FLAG; seq_params->frame_id_numbers_present_flag =
#if CONFIG_EXT_TILE
cm->large_scale_tile ? 0 :
#endif // CONFIG_EXT_TILE
FRAME_ID_NUMBERS_PRESENT_FLAG;
seq_params->frame_id_length_minus7 = FRAME_ID_LENGTH_MINUS7; seq_params->frame_id_length_minus7 = FRAME_ID_LENGTH_MINUS7;
seq_params->delta_frame_id_length_minus2 = DELTA_FRAME_ID_LENGTH_MINUS2; seq_params->delta_frame_id_length_minus2 = DELTA_FRAME_ID_LENGTH_MINUS2;
} }
...@@ -4206,13 +4213,21 @@ static void write_uncompressed_header(AV1_COMP *cpi, ...@@ -4206,13 +4213,21 @@ static void write_uncompressed_header(AV1_COMP *cpi,
#if CONFIG_REFERENCE_BUFFER #if CONFIG_REFERENCE_BUFFER
/* TODO: Move outside frame loop or inside key-frame branch */ /* TODO: Move outside frame loop or inside key-frame branch */
write_sequence_header(&cpi->seq_params); write_sequence_header(
#if CONFIG_EXT_TILE
cm,
#endif // CONFIG_EXT_TILE
&cpi->seq_params);
#endif #endif
aom_wb_write_literal(wb, AOM_FRAME_MARKER, 2); aom_wb_write_literal(wb, AOM_FRAME_MARKER, 2);
write_profile(cm->profile, wb); write_profile(cm->profile, wb);
#if CONFIG_EXT_TILE
aom_wb_write_literal(wb, cm->large_scale_tile, 1);
#endif // CONFIG_EXT_TILE
#if CONFIG_EXT_REFS #if CONFIG_EXT_REFS
// NOTE: By default all coded frames to be used as a reference // NOTE: By default all coded frames to be used as a reference
cm->is_reference_frame = 1; cm->is_reference_frame = 1;
......
...@@ -19,7 +19,11 @@ extern "C" { ...@@ -19,7 +19,11 @@ extern "C" {
#include "av1/encoder/encoder.h" #include "av1/encoder/encoder.h"
#if CONFIG_REFERENCE_BUFFER #if CONFIG_REFERENCE_BUFFER
void write_sequence_header(SequenceHeader *seq_params); void write_sequence_header(
#if CONFIG_EXT_TILE
AV1_COMMON *const cm,
#endif // CONFIG_EXT_TILE
SequenceHeader *seq_params);
#endif #endif
void av1_pack_bitstream(AV1_COMP *const cpi, uint8_t *dest, size_t *size); void av1_pack_bitstream(AV1_COMP *const cpi, uint8_t *dest, size_t *size);
......
...@@ -574,11 +574,6 @@ post_process_cmdline() { ...@@ -574,11 +574,6 @@ post_process_cmdline() {
disable_feature lgt disable_feature lgt
enable_feature lowbitdepth enable_feature lowbitdepth
fi fi
if enabled ext_tile; then
log_echo "ext_tile not compatible with reference_buffer, so"
log_echo "disabling reference_buffer"
disable_feature reference_buffer
fi
if enabled var_tx_no_tx_mode && ! enabled var_tx; then if enabled var_tx_no_tx_mode && ! enabled var_tx; then
log_echo "var_tx_no_tx_mode requires var_tx, so disabling var_tx_no_tx_mode" log_echo "var_tx_no_tx_mode requires var_tx, so disabling var_tx_no_tx_mode"
disable_feature var_tx_no_tx_mode disable_feature var_tx_no_tx_mode
......
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