Commit eeb08a9b authored by Yunqing Wang's avatar Yunqing Wang

Make EXT_TILE compatible with TILE_GROUPS

Added a 1-bit flag 'large_scale_tile'. If it is 0 that is the default value,
use normal tile coding in TILE_GROUPS. If it is 1, use large-scale tile
coding in EXT_TILE.

At large_scale_tile=1 case, if single-tile-decoding is required, then the
loopfilter is disabled.

Related API and unit tests were modified.

Change-Id: I3ba12dc3d80ccf1ab21543ab3b16c02282c34e3b
parent 7739752a
......@@ -593,6 +593,14 @@ typedef struct aom_codec_enc_cfg {
* equal to kf_max_dist for a fixed interval.
*/
unsigned int kf_max_dist;
/*!\brief Tile coding mode
*
* This value indicates the tile coding mode.
* A value of 0 implies a normal non-large-scale tile coding. A value of 1
* implies a large-scale tile coding.
*/
unsigned int large_scale_tile;
} aom_codec_enc_cfg_t; /**< alias for struct aom_codec_enc_cfg */
/*!\brief Initialize an encoder instance
......
......@@ -538,14 +538,15 @@ enum aome_enc_control_id {
*/
AV1E_SET_DELTAQ_MODE,
/*!\brief Codec control function to set the tile encoding mode to 0 or 1.
/*!\brief Codec control function to set the single tile decoding mode to 0 or
* 1.
*
* 0 means that the tile encoding mode is TILE_NORMAL, and 1 means that the
* tile encoding mode is TILE_VR.
* 0 means that the single tile decoding is off, and 1 means that the single
* tile decoding is on.
*
* Experiment: EXT_TILE
*/
AV1E_SET_TILE_ENCODING_MODE,
AV1E_SET_SINGLE_TILE_DECODING,
/*!\brief Codec control function to enable the extreme motion vector unit test
* in AV1. Please note that this is only used in motion vector unit test.
......@@ -766,8 +767,8 @@ AOM_CTRL_USE_TYPE(AV1E_GET_LEVEL, int *)
AOM_CTRL_USE_TYPE(AV1E_SET_ANS_WINDOW_SIZE_LOG2, unsigned int)
#define AOM_CTRL_AV1E_SET_ANS_WINDOW_SIZE_LOG2
AOM_CTRL_USE_TYPE(AV1E_SET_TILE_ENCODING_MODE, unsigned int)
#define AOM_CTRL_AV1E_SET_TILE_ENCODING_MODE
AOM_CTRL_USE_TYPE(AV1E_SET_SINGLE_TILE_DECODING, unsigned int)
#define AOM_CTRL_AV1E_SET_SINGLE_TILE_DECODING
AOM_CTRL_USE_TYPE(AV1E_ENABLE_MOTION_VECTOR_UNIT_TEST, unsigned int)
#define AOM_CTRL_AV1E_ENABLE_MOTION_VECTOR_UNIT_TEST
......
......@@ -255,19 +255,36 @@ static const arg_def_t error_resilient =
ARG_DEF(NULL, "error-resilient", 1, "Enable error resiliency features");
static const arg_def_t lag_in_frames =
ARG_DEF(NULL, "lag-in-frames", 1, "Max number of frames to lag");
static const arg_def_t *global_args[] = {
&use_yv12, &use_i420, &use_i422, &use_i444, &use_i440,
&usage, &threads, &profile, &width, &height,
#if CONFIG_EXT_TILE
static const arg_def_t large_scale_tile =
ARG_DEF(NULL, "large-scale-tile", 1,
"Large scale tile coding (0: off (default), 1: on)");
#endif // CONFIG_EXT_TILE
static const arg_def_t *global_args[] = { &use_yv12,
&use_i420,
&use_i422,
&use_i444,
&use_i440,
&usage,
&threads,
&profile,
&width,
&height,
#if CONFIG_WEBM_IO
&stereo_mode,
&stereo_mode,
#endif
&timebase, &framerate, &error_resilient,
&timebase,
&framerate,
&error_resilient,
#if CONFIG_HIGHBITDEPTH
&bitdeptharg,
&bitdeptharg,
#endif
&lag_in_frames, NULL
};
&lag_in_frames,
#if CONFIG_EXT_TILE
&large_scale_tile,
#endif // CONFIG_EXT_TILE
NULL };
static const arg_def_t dropframe_thresh =
ARG_DEF(NULL, "drop-frame", 1, "Temporal resampling threshold (buf %)");
......@@ -372,17 +389,16 @@ static const arg_def_t max_intra_rate_pct =
#if CONFIG_AV1_ENCODER
static const arg_def_t cpu_used_av1 =
ARG_DEF(NULL, "cpu-used", 1, "CPU Used (0..8)");
#if CONFIG_EXT_TILE
static const arg_def_t single_tile_decoding =
ARG_DEF(NULL, "single-tile-decoding", 1,
"Single tile decoding (0: off (default), 1: on)");
#endif // CONFIG_EXT_TILE
static const arg_def_t tile_cols =
ARG_DEF(NULL, "tile-columns", 1, "Number of tile columns to use, log2");
static const arg_def_t tile_rows =
ARG_DEF(NULL, "tile-rows", 1,
"Number of tile rows to use, log2 (set to 0 while threads > 1)");
#if CONFIG_EXT_TILE
static const arg_def_t tile_encoding_mode =
ARG_DEF(NULL, "tile-encoding-mode", 1,
"Tile encoding mode (0: normal"
" (default), 1: vr)");
#endif
#if CONFIG_DEPENDENT_HORZTILES
static const arg_def_t tile_dependent_rows =
ARG_DEF(NULL, "tile-dependent-rows", 1, "Enable dependent Tile rows");
......@@ -523,11 +539,11 @@ static const arg_def_t *av1_args[] = { &cpu_used_av1,
&auto_altref,
&sharpness,
&static_thresh,
#if CONFIG_EXT_TILE
&single_tile_decoding,
#endif // CONFIG_EXT_TILE
&tile_cols,
&tile_rows,
#if CONFIG_EXT_TILE
&tile_encoding_mode,
#endif
#if CONFIG_DEPENDENT_HORZTILES
&tile_dependent_rows,
#endif
......@@ -581,11 +597,11 @@ static const int av1_arg_ctrl_map[] = { AOME_SET_CPUUSED,
AOME_SET_ENABLEAUTOALTREF,
AOME_SET_SHARPNESS,
AOME_SET_STATIC_THRESHOLD,
#if CONFIG_EXT_TILE
AV1E_SET_SINGLE_TILE_DECODING,
#endif // CONFIG_EXT_TILE
AV1E_SET_TILE_COLUMNS,
AV1E_SET_TILE_ROWS,
#if CONFIG_EXT_TILE
AV1E_SET_TILE_ENCODING_MODE,
#endif
#if CONFIG_DEPENDENT_HORZTILES
AV1E_SET_TILE_DEPENDENT_ROWS,
#endif
......@@ -1017,6 +1033,10 @@ static int parse_stream_params(struct AvxEncoderConfig *global,
config->cfg.g_error_resilient = arg_parse_uint(&arg);
} else if (arg_match(&arg, &lag_in_frames, argi)) {
config->cfg.g_lag_in_frames = arg_parse_uint(&arg);
#if CONFIG_EXT_TILE
} else if (arg_match(&arg, &large_scale_tile, argi)) {
config->cfg.large_scale_tile = arg_parse_uint(&arg);
#endif // CONFIG_EXT_TILE
} else if (arg_match(&arg, &dropframe_thresh, argi)) {
config->cfg.rc_dropframe_thresh = arg_parse_uint(&arg);
} else if (arg_match(&arg, &resize_mode, argi)) {
......@@ -1233,6 +1253,9 @@ static void show_stream_config(struct stream_state *stream,
SHOW(g_error_resilient);
SHOW(g_pass);
SHOW(g_lag_in_frames);
#if CONFIG_EXT_TILE
SHOW(large_scale_tile);
#endif // CONFIG_EXT_TILE
SHOW(rc_dropframe_thresh);
SHOW(rc_resize_mode);
SHOW(rc_resize_numerator);
......@@ -1390,7 +1413,7 @@ static void initialize_encoder(struct stream_state *stream,
aom_codec_control(&stream->decoder, AV1_SET_DECODE_TILE_COL, -1);
ctx_exit_on_error(&stream->decoder, "Failed to set decode_tile_col");
}
#endif
#endif // CONFIG_EXT_TILE
}
#endif
}
......
......@@ -83,7 +83,7 @@ struct av1_extracfg {
int ans_window_size_log2;
#endif
#if CONFIG_EXT_TILE
unsigned int tile_encoding_mode;
unsigned int single_tile_decoding;
#endif // CONFIG_EXT_TILE
unsigned int motion_vector_unit_test;
......@@ -98,13 +98,8 @@ static struct av1_extracfg default_extra_cfg = {
0, // noise_sensitivity
0, // sharpness
0, // static_thresh
#if CONFIG_EXT_TILE
UINT_MAX, // tile_columns
UINT_MAX, // tile_rows
#else
0, // tile_columns
0, // tile_rows
#endif // CONFIG_EXT_TILE
0, // tile_columns
0, // tile_rows
#if CONFIG_DEPENDENT_HORZTILES
0, // Dependent Horizontal tiles
#endif
......@@ -154,7 +149,7 @@ static struct av1_extracfg default_extra_cfg = {
23, // ans_window_size_log2
#endif
#if CONFIG_EXT_TILE
0, // Tile encoding mode is TILE_NORMAL by default.
0, // Single tile decoding is off by default.
#endif // CONFIG_EXT_TILE
0, // motion_vector_unit_test
......@@ -286,28 +281,34 @@ static aom_codec_err_t validate_config(aom_codec_alg_priv_t *ctx,
RANGE_CHECK(extra_cfg, superblock_size, AOM_SUPERBLOCK_SIZE_64X64,
AOM_SUPERBLOCK_SIZE_DYNAMIC);
#if CONFIG_EXT_TILE
RANGE_CHECK_HI(cfg, large_scale_tile, 1);
RANGE_CHECK_HI(extra_cfg, single_tile_decoding, 1);
if (cfg->large_scale_tile) {
// TODO(any): Waring. If CONFIG_EXT_TILE is true, tile_columns really
// means tile_width, and tile_rows really means tile_hight. The interface
// should be sanitized.
#if CONFIG_EXT_PARTITION
if (extra_cfg->superblock_size != AOM_SUPERBLOCK_SIZE_64X64) {
if (extra_cfg->tile_columns != UINT_MAX)
RANGE_CHECK(extra_cfg, tile_columns, 1, 32);
if (extra_cfg->tile_rows != UINT_MAX)
RANGE_CHECK(extra_cfg, tile_rows, 1, 32);
} else
if (extra_cfg->superblock_size != AOM_SUPERBLOCK_SIZE_64X64) {
if (extra_cfg->tile_columns != 0)
RANGE_CHECK(extra_cfg, tile_columns, 1, 32);
if (extra_cfg->tile_rows != 0) RANGE_CHECK(extra_cfg, tile_rows, 1, 32);
} else {
#endif // CONFIG_EXT_PARTITION
{
if (extra_cfg->tile_columns != UINT_MAX)
RANGE_CHECK(extra_cfg, tile_columns, 1, 64);
if (extra_cfg->tile_rows != UINT_MAX)
RANGE_CHECK(extra_cfg, tile_rows, 1, 64);
if (extra_cfg->tile_columns != 0)
RANGE_CHECK(extra_cfg, tile_columns, 1, 64);
if (extra_cfg->tile_rows != 0) RANGE_CHECK(extra_cfg, tile_rows, 1, 64);
#if CONFIG_EXT_PARTITION
}
#endif // CONFIG_EXT_PARTITION
} else {
#endif // CONFIG_EXT_TILE
RANGE_CHECK_HI(extra_cfg, tile_columns, 6);
RANGE_CHECK_HI(extra_cfg, tile_rows, 2);
#if CONFIG_EXT_TILE
}
RANGE_CHECK_HI(extra_cfg, tile_encoding_mode, 1);
#else
RANGE_CHECK_HI(extra_cfg, tile_columns, 6);
RANGE_CHECK_HI(extra_cfg, tile_rows, 2);
#endif // CONFIG_EXT_TILE
#if CONFIG_DEPENDENT_HORZTILES
RANGE_CHECK_HI(extra_cfg, dependent_horz_tiles, 1);
#endif
......@@ -483,6 +484,10 @@ static aom_codec_err_t set_encoder_config(
#if CONFIG_TILE_GROUPS
oxcf->num_tile_groups = extra_cfg->num_tg;
#if CONFIG_EXT_TILE
// In large-scale tile encoding mode, num_tile_groups is always 1.
if (cfg->large_scale_tile) oxcf->num_tile_groups = 1;
#endif // CONFIG_EXT_TILE
oxcf->mtu = extra_cfg->mtu_size;
#endif
......@@ -563,23 +568,38 @@ static aom_codec_err_t set_encoder_config(
#endif // CONFIG_ANS && ANS_MAX_SYMBOLS
#if CONFIG_EXT_TILE
{
oxcf->large_scale_tile = cfg->large_scale_tile;
oxcf->single_tile_decoding =
(oxcf->large_scale_tile) ? extra_cfg->single_tile_decoding : 0;
if (oxcf->large_scale_tile) {
#if CONFIG_EXT_PARTITION
const unsigned int max =
extra_cfg->superblock_size == AOM_SUPERBLOCK_SIZE_64X64 ? 64 : 32;
#else
const unsigned int max = 64;
#endif // CONFIG_EXT_PARTITION
oxcf->tile_columns = AOMMIN(extra_cfg->tile_columns, max);
oxcf->tile_rows = AOMMIN(extra_cfg->tile_rows, max);
oxcf->tile_encoding_mode = extra_cfg->tile_encoding_mode;
// If tile size is not set, set it to the default value.
const unsigned int tc =
(!extra_cfg->tile_columns) ? UINT_MAX : extra_cfg->tile_columns;
const unsigned int tr =
(!extra_cfg->tile_rows) ? UINT_MAX : extra_cfg->tile_rows;
oxcf->tile_columns = AOMMIN(tc, max);
oxcf->tile_rows = AOMMIN(tr, max);
} else {
#endif // CONFIG_EXT_TILE
oxcf->tile_columns = extra_cfg->tile_columns;
oxcf->tile_rows = extra_cfg->tile_rows;
#if CONFIG_EXT_TILE
}
#else
oxcf->tile_columns = extra_cfg->tile_columns;
oxcf->tile_rows = extra_cfg->tile_rows;
#endif // CONFIG_EXT_TILE
#if CONFIG_DEPENDENT_HORZTILES
oxcf->dependent_horz_tiles = extra_cfg->dependent_horz_tiles;
oxcf->dependent_horz_tiles =
#if CONFIG_EXT_TILE
(cfg->large_scale_tile) ? 0 :
#endif // CONFIG_EXT_TILE
extra_cfg->dependent_horz_tiles;
#endif
#if CONFIG_LOOPFILTERING_ACROSS_TILES
oxcf->loop_filter_across_tiles_enabled =
......@@ -880,10 +900,10 @@ static aom_codec_err_t ctrl_set_frame_parallel_decoding_mode(
}
#if CONFIG_EXT_TILE
static aom_codec_err_t ctrl_set_tile_encoding_mode(aom_codec_alg_priv_t *ctx,
va_list args) {
static aom_codec_err_t ctrl_set_single_tile_decoding(aom_codec_alg_priv_t *ctx,
va_list args) {
struct av1_extracfg extra_cfg = ctx->extra_cfg;
extra_cfg.tile_encoding_mode = CAST(AV1E_SET_TILE_ENCODING_MODE, args);
extra_cfg.single_tile_decoding = CAST(AV1E_SET_SINGLE_TILE_DECODING, args);
return update_extra_cfg(ctx, &extra_cfg);
}
#endif // CONFIG_EXT_TILE
......@@ -1554,7 +1574,7 @@ static aom_codec_ctrl_fn_map_t encoder_ctrl_maps[] = {
{ AV1E_SET_ANS_WINDOW_SIZE_LOG2, ctrl_set_ans_window_size_log2 },
#endif
#if CONFIG_EXT_TILE
{ AV1E_SET_TILE_ENCODING_MODE, ctrl_set_tile_encoding_mode },
{ AV1E_SET_SINGLE_TILE_DECODING, ctrl_set_single_tile_decoding },
#endif // CONFIG_EXT_TILE
{ AV1E_ENABLE_MOTION_VECTOR_UNIT_TEST, ctrl_enable_motion_vector_unit_test },
......@@ -1619,6 +1639,7 @@ static aom_codec_enc_cfg_map_t encoder_usage_cfg_map[] = {
AOM_KF_AUTO, // g_kfmode
0, // kf_min_dist
9999, // kf_max_dist
0, // large_scale_tile
} },
};
......
......@@ -786,7 +786,7 @@ static aom_image_t *decoder_get_frame(aom_codec_alg_priv_t *ctx,
yuvconfig2image(&ctx->img, &sd, frame_worker_data->user_priv);
#if CONFIG_EXT_TILE
if (cm->tile_encoding_mode &&
if (cm->single_tile_decoding &&
frame_worker_data->pbi->dec_tile_row >= 0) {
const int tile_row =
AOMMIN(frame_worker_data->pbi->dec_tile_row, cm->tile_rows - 1);
......@@ -802,7 +802,7 @@ static aom_image_t *decoder_get_frame(aom_codec_alg_priv_t *ctx,
AOMMIN(cm->tile_height, cm->mi_rows - mi_row) * MI_SIZE;
}
if (cm->tile_encoding_mode &&
if (cm->single_tile_decoding &&
frame_worker_data->pbi->dec_tile_col >= 0) {
const int tile_col =
AOMMIN(frame_worker_data->pbi->dec_tile_col, cm->tile_cols - 1);
......
......@@ -54,9 +54,6 @@ extern "C" {
// Maximum number of tile rows and tile columns
#if CONFIG_EXT_TILE
#define TILE_NORMAL 0
#define TILE_VR 1
#define MAX_TILE_ROWS 1024
#define MAX_TILE_COLS 1024
#else
......
......@@ -355,13 +355,12 @@ typedef struct AV1Common {
int error_resilient_mode;
#if !CONFIG_EXT_TILE
int log2_tile_cols, log2_tile_rows;
#endif // !CONFIG_EXT_TILE
int log2_tile_cols, log2_tile_rows; // Used in non-large_scale_tile_coding.
int tile_cols, tile_rows;
int tile_width, tile_height; // In MI units
#if CONFIG_EXT_TILE
unsigned int tile_encoding_mode;
unsigned int large_scale_tile;
unsigned int single_tile_decoding;
#endif // CONFIG_EXT_TILE
#if CONFIG_DEPENDENT_HORZTILES
......
......@@ -46,8 +46,6 @@ void av1_tile_init(TileInfo *tile, const AV1_COMMON *cm, int row, int col) {
#endif
}
#if !CONFIG_EXT_TILE
#if CONFIG_EXT_PARTITION
#define MIN_TILE_WIDTH_MAX_SB 2
#define MAX_TILE_WIDTH_MAX_SB 32
......@@ -76,7 +74,6 @@ void av1_get_tile_n_bits(int mi_cols, int *min_log2_tile_cols,
*max_log2_tile_cols = get_max_log2_tile_cols(max_sb_cols);
assert(*min_log2_tile_cols <= *max_log2_tile_cols);
}
#endif // !CONFIG_EXT_TILE
void av1_update_boundary_info(const struct AV1Common *cm,
const TileInfo *const tile_info, int mi_row,
......
......@@ -3241,91 +3241,98 @@ static void read_tile_info(AV1Decoder *const pbi,
struct aom_read_bit_buffer *const rb) {
AV1_COMMON *const cm = &pbi->common;
#if CONFIG_EXT_TILE
cm->tile_encoding_mode = aom_rb_read_literal(rb, 1);
cm->large_scale_tile = aom_rb_read_literal(rb, 1);
cm->single_tile_decoding = 0;
if (cm->large_scale_tile) {
struct loopfilter *lf = &cm->lf;
// Figure out single_tile_decoding by loopfilter_level.
cm->single_tile_decoding = (!lf->filter_level) ? 1 : 0;
// Read the tile width/height
#if CONFIG_EXT_PARTITION
if (cm->sb_size == BLOCK_128X128) {
cm->tile_width = aom_rb_read_literal(rb, 5) + 1;
cm->tile_height = aom_rb_read_literal(rb, 5) + 1;
} else
if (cm->sb_size == BLOCK_128X128) {
cm->tile_width = aom_rb_read_literal(rb, 5) + 1;
cm->tile_height = aom_rb_read_literal(rb, 5) + 1;
} else {
#endif // CONFIG_EXT_PARTITION
cm->tile_width = aom_rb_read_literal(rb, 6) + 1;
cm->tile_height = aom_rb_read_literal(rb, 6) + 1;
#if CONFIG_EXT_PARTITION
}
#endif // CONFIG_EXT_PARTITION
{
cm->tile_width = aom_rb_read_literal(rb, 6) + 1;
cm->tile_height = aom_rb_read_literal(rb, 6) + 1;
}
#if CONFIG_LOOPFILTERING_ACROSS_TILES
cm->loop_filter_across_tiles_enabled = aom_rb_read_bit(rb);
cm->loop_filter_across_tiles_enabled = aom_rb_read_bit(rb);
#endif // CONFIG_LOOPFILTERING_ACROSS_TILES
cm->tile_width <<= cm->mib_size_log2;
cm->tile_height <<= cm->mib_size_log2;
cm->tile_width <<= cm->mib_size_log2;
cm->tile_height <<= cm->mib_size_log2;
cm->tile_width = AOMMIN(cm->tile_width, cm->mi_cols);
cm->tile_height = AOMMIN(cm->tile_height, cm->mi_rows);
cm->tile_width = AOMMIN(cm->tile_width, cm->mi_cols);
cm->tile_height = AOMMIN(cm->tile_height, cm->mi_rows);
// Get the number of tiles
cm->tile_cols = 1;
while (cm->tile_cols * cm->tile_width < cm->mi_cols) ++cm->tile_cols;
// Get the number of tiles
cm->tile_cols = 1;
while (cm->tile_cols * cm->tile_width < cm->mi_cols) ++cm->tile_cols;
cm->tile_rows = 1;
while (cm->tile_rows * cm->tile_height < cm->mi_rows) ++cm->tile_rows;
cm->tile_rows = 1;
while (cm->tile_rows * cm->tile_height < cm->mi_rows) ++cm->tile_rows;
if (cm->tile_cols * cm->tile_rows > 1) {
// Read the number of bytes used to store tile size
pbi->tile_col_size_bytes = aom_rb_read_literal(rb, 2) + 1;
pbi->tile_size_bytes = aom_rb_read_literal(rb, 2) + 1;
}
if (cm->tile_cols * cm->tile_rows > 1) {
// Read the number of bytes used to store tile size
pbi->tile_col_size_bytes = aom_rb_read_literal(rb, 2) + 1;
pbi->tile_size_bytes = aom_rb_read_literal(rb, 2) + 1;
}
#if CONFIG_DEPENDENT_HORZTILES
if (cm->tile_rows <= 1)
cm->dependent_horz_tiles = aom_rb_read_bit(rb);
else
cm->dependent_horz_tiles = 0;
#endif
#else
int min_log2_tile_cols, max_log2_tile_cols, max_ones;
av1_get_tile_n_bits(cm->mi_cols, &min_log2_tile_cols, &max_log2_tile_cols);
} else {
#endif // CONFIG_EXT_TILE
int min_log2_tile_cols, max_log2_tile_cols, max_ones;
av1_get_tile_n_bits(cm->mi_cols, &min_log2_tile_cols, &max_log2_tile_cols);
// columns
max_ones = max_log2_tile_cols - min_log2_tile_cols;
cm->log2_tile_cols = min_log2_tile_cols;
while (max_ones-- && aom_rb_read_bit(rb)) cm->log2_tile_cols++;
// columns
max_ones = max_log2_tile_cols - min_log2_tile_cols;
cm->log2_tile_cols = min_log2_tile_cols;
while (max_ones-- && aom_rb_read_bit(rb)) cm->log2_tile_cols++;
if (cm->log2_tile_cols > 6)
aom_internal_error(&cm->error, AOM_CODEC_CORRUPT_FRAME,
"Invalid number of tile columns");
if (cm->log2_tile_cols > 6)
aom_internal_error(&cm->error, AOM_CODEC_CORRUPT_FRAME,
"Invalid number of tile columns");
// rows
cm->log2_tile_rows = aom_rb_read_bit(rb);
if (cm->log2_tile_rows) cm->log2_tile_rows += aom_rb_read_bit(rb);
// rows
cm->log2_tile_rows = aom_rb_read_bit(rb);
if (cm->log2_tile_rows) cm->log2_tile_rows += aom_rb_read_bit(rb);
#if CONFIG_DEPENDENT_HORZTILES
if (cm->log2_tile_rows != 0)
cm->dependent_horz_tiles = aom_rb_read_bit(rb);
else
cm->dependent_horz_tiles = 0;
if (cm->log2_tile_rows != 0)
cm->dependent_horz_tiles = aom_rb_read_bit(rb);
else
cm->dependent_horz_tiles = 0;
#endif
#if CONFIG_LOOPFILTERING_ACROSS_TILES
cm->loop_filter_across_tiles_enabled = aom_rb_read_bit(rb);
cm->loop_filter_across_tiles_enabled = aom_rb_read_bit(rb);
#endif // CONFIG_LOOPFILTERING_ACROSS_TILES
cm->tile_cols = 1 << cm->log2_tile_cols;
cm->tile_rows = 1 << cm->log2_tile_rows;
cm->tile_cols = 1 << cm->log2_tile_cols;
cm->tile_rows = 1 << cm->log2_tile_rows;
cm->tile_width = ALIGN_POWER_OF_TWO(cm->mi_cols, MAX_MIB_SIZE_LOG2);
cm->tile_width >>= cm->log2_tile_cols;
cm->tile_height = ALIGN_POWER_OF_TWO(cm->mi_rows, MAX_MIB_SIZE_LOG2);
cm->tile_height >>= cm->log2_tile_rows;
cm->tile_width = ALIGN_POWER_OF_TWO(cm->mi_cols, MAX_MIB_SIZE_LOG2);
cm->tile_width >>= cm->log2_tile_cols;
cm->tile_height = ALIGN_POWER_OF_TWO(cm->mi_rows, MAX_MIB_SIZE_LOG2);
cm->tile_height >>= cm->log2_tile_rows;
// round to integer multiples of superblock size
cm->tile_width = ALIGN_POWER_OF_TWO(cm->tile_width, MAX_MIB_SIZE_LOG2);
cm->tile_height = ALIGN_POWER_OF_TWO(cm->tile_height, MAX_MIB_SIZE_LOG2);
// round to integer multiples of superblock size
cm->tile_width = ALIGN_POWER_OF_TWO(cm->tile_width, MAX_MIB_SIZE_LOG2);
cm->tile_height = ALIGN_POWER_OF_TWO(cm->tile_height, MAX_MIB_SIZE_LOG2);
// tile size magnitude
#if !CONFIG_TILE_GROUPS
if (cm->tile_rows > 1 || cm->tile_cols > 1)
if (cm->tile_rows > 1 || cm->tile_cols > 1)
#endif
pbi->tile_size_bytes = aom_rb_read_literal(rb, 2) + 1;
pbi->tile_size_bytes = aom_rb_read_literal(rb, 2) + 1;
#if CONFIG_EXT_TILE
}
#endif // CONFIG_EXT_TILE
#if CONFIG_TILE_GROUPS
......@@ -3354,13 +3361,11 @@ static int mem_get_varsize(const uint8_t *src, int sz) {
#if CONFIG_EXT_TILE
// Reads the next tile returning its size and adjusting '*data' accordingly
// based on 'is_last'.
static void get_tile_buffer(const uint8_t *const data_end,
struct aom_internal_error_info *error_info,
const uint8_t **data, aom_decrypt_cb decrypt_cb,
void *decrypt_state,
TileBufferDec (*const tile_buffers)[MAX_TILE_COLS],
int tile_size_bytes, int col, int row,
unsigned int tile_encoding_mode) {
static void get_ls_tile_buffer(
const uint8_t *const data_end, struct aom_internal_error_info *error_info,
const uint8_t **data, aom_decrypt_cb decrypt_cb, void *decrypt_state,
TileBufferDec (*const tile_buffers)[MAX_TILE_COLS], int tile_size_bytes,
int col, int row, int tile_copy_mode) {
size_t size;
size_t copy_size = 0;
......@@ -3379,9 +3384,9 @@ static void get_tile_buffer(const uint8_t *const data_end,
size = mem_get_varsize(*data, tile_size_bytes);
}
// If cm->tile_encoding_mode = 1 (i.e. TILE_VR), then the top bit of the tile
// header indicates copy mode.
if (tile_encoding_mode && (size >> (tile_size_bytes * 8 - 1)) == 1) {
// If tile_copy_mode = 1, then the top bit of the tile header indicates copy
// mode.
if (tile_copy_mode && (size >> (tile_size_bytes * 8 - 1)) == 1) {
// The remaining bits in the top byte signal the row offset
int offset = (size >> (tile_size_bytes - 1) * 8) & 0x7f;
......@@ -3410,7 +3415,7 @@ static void get_tile_buffer(const uint8_t *const data_end,
tile_buffers[row][col].raw_data_end = *data;
}
static void get_tile_buffers(
static void get_ls_tile_buffers(
AV1Decoder *pbi, const uint8_t *data, const uint8_t *data_end,
TileBufferDec (*const tile_buffers)[MAX_TILE_COLS]) {
AV1_COMMON *const cm = &pbi->common;
......@@ -3443,7 +3448,9 @@ static void get_tile_buffers(
const int tile_col_size_bytes = pbi->tile_col_size_bytes;
const int tile_size_bytes = pbi->tile_size_bytes;
const int tile_copy_mode =
((AOMMAX(cm->tile_width, cm->tile_height) << MI_SIZE_LOG2) <= 256) ? 1
: 0;
size_t tile_col_size;
int r, c;
......@@ -3475,9 +3482,9 @@ static void get_tile_buffers(
for (r = 0; r < (is_last ? tile_rows : tile_rows_end); ++r) {
tile_buffers[r][c].col = c;
get_tile_buffer(tile_col_data_end[c], &pbi->common.error, &data,
pbi->decrypt_cb, pbi->decrypt_state, tile_buffers,
tile_size_bytes, c, r, cm->tile_encoding_mode);
get_ls_tile_buffer(tile_col_data_end[c], &pbi->common.error, &data,
pbi->decrypt_cb, pbi->decrypt_state, tile_buffers,
tile_size_bytes, c, r, tile_copy_mode);
}
}
......@@ -3490,14 +3497,15 @@ static void get_tile_buffers(
for (r = 0; r < tile_rows; ++r) {
tile_buffers[r][c].col = c;
get_tile_buffer(tile_col_data_end[c], &pbi->common.error, &data,
pbi->decrypt_cb, pbi->decrypt_state, tile_buffers,
tile_size_bytes, c, r, cm->tile_encoding_mode);
get_ls_tile_buffer(tile_col_data_end[c], &pbi->common.error, &data,
pbi->decrypt_cb, pbi->decrypt_state, tile_buffers,
tile_size_bytes, c, r, tile_copy_mode);
}
}