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,
......
This diff is collapsed.
......@@ -127,8 +127,8 @@ typedef struct AV1Decoder {
int tile_size_bytes;
#if CONFIG_EXT_TILE
int tile_col_size_bytes;
int dec_tile_row, dec_tile_col;
#endif // CONFIG_EXT_TILE
int dec_tile_row, dec_tile_col; // always -1 for non-VR tile encoding
#endif // CONFIG_EXT_TILE
#if CONFIG_ACCOUNTING
int acct_enabled;
Accounting accounting;
......
This diff is collapsed.
......@@ -833,87 +833,103 @@ static void set_tile_info(AV1_COMP *cpi) {
int tg_row_start, tg_col_start;
#endif
#if CONFIG_EXT_TILE
if (cpi->oxcf.large_scale_tile) {
#if CONFIG_EXT_PARTITION
if (cpi->oxcf.superblock_size != AOM_SUPERBLOCK_SIZE_64X64) {
cm->tile_width = clamp(cpi->oxcf.tile_columns, 1, 32);
cm->tile_height = clamp(cpi->oxcf.tile_rows, 1, 32);
cm->tile_width <<= MAX_MIB_SIZE_LOG2;
cm->tile_height <<= MAX_MIB_SIZE_LOG2;
} else {
if (cpi->oxcf.superblock_size != AOM_SUPERBLOCK_SIZE_64X64) {
cm->tile_width = clamp(cpi->oxcf.tile_columns, 1, 32);
cm->tile_height = clamp(cpi->oxcf.tile_rows, 1, 32);
cm->tile_width <<= MAX_MIB_SIZE_LOG2;
cm->tile_height <<= MAX_MIB_SIZE_LOG2;
} else {
cm->tile_width = clamp(cpi->oxcf.tile_columns, 1, 64);
cm->tile_height = clamp(cpi->oxcf.tile_rows, 1, 64);
cm->tile_width <<= MAX_MIB_SIZE_LOG2 - 1;
cm->tile_height <<= MAX_MIB_SIZE_LOG2 - 1;
}
#else
cm->tile_width = clamp(cpi->oxcf.tile_columns, 1, 64);
cm->tile_height = clamp(cpi->oxcf.tile_rows, 1, 64);
cm->tile_width <<= MAX_MIB_SIZE_LOG2 - 1;
cm->tile_height <<= MAX_MIB_SIZE_LOG2 - 1;
}
#else
cm->tile_width = clamp(cpi->oxcf.tile_columns, 1, 64);
cm->tile_height = clamp(cpi->oxcf.tile_rows, 1, 64);
cm->tile_width <<= MAX_MIB_SIZE_LOG2;
cm->tile_height <<= MAX_MIB_SIZE_LOG2;
cm->tile_width <<= MAX_MIB_SIZE_LOG2;
cm->tile_height <<= MAX_MIB_SIZE_LOG2;
#endif // CONFIG_EXT_PARTITION
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);
assert(cm->tile_width >> MAX_MIB_SIZE <= 32);
assert(cm->tile_height >> MAX_MIB_SIZE <= 32);
assert(cm->tile_width >> MAX_MIB_SIZE <= 32);
assert(cm->tile_height >> MAX_MIB_SIZE <= 32);
// 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;
#else
int min_log2_tile_cols, max_log2_tile_cols;
av1_get_tile_n_bits(cm->mi_cols, &min_log2_tile_cols, &max_log2_tile_cols);
cm->tile_rows = 1;
while (cm->tile_rows * cm->tile_height < cm->mi_rows) ++cm->tile_rows;
} else {
#endif // CONFIG_EXT_TILE
int min_log2_tile_cols, max_log2_tile_cols;
av1_get_tile_n_bits(cm->mi_cols, &min_log2_tile_cols, &max_log2_tile_cols);
cm->log2_tile_cols =
clamp(cpi->oxcf.tile_columns, min_log2_tile_cols, max_log2_tile_cols);
cm->log2_tile_rows = cpi->oxcf.tile_rows;
cm->log2_tile_cols =
clamp(cpi->oxcf.tile_columns, min_log2_tile_cols, max_log2_tile_cols);
cm->log2_tile_rows = cpi->oxcf.tile_rows;
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 max 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 max 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);
#if CONFIG_EXT_TILE
}
#endif // CONFIG_EXT_TILE
#if CONFIG_DEPENDENT_HORZTILES
cm->dependent_horz_tiles = cpi->oxcf.dependent_horz_tiles;
#if CONFIG_EXT_TILE
if (cm->tile_rows <= 1) cm->dependent_horz_tiles = 0;
#else
if (cm->log2_tile_rows == 0) cm->dependent_horz_tiles = 0;
#endif
#if CONFIG_TILE_GROUPS
if (cpi->oxcf.mtu == 0) {
cm->num_tg = cpi->oxcf.num_tile_groups;
if (cm->large_scale_tile) {
// May not needed since cpi->oxcf.dependent_horz_tiles is already adjusted.
cm->dependent_horz_tiles = 0;
} else {
// Use a default value for the purposes of weighting costs in probability
// updates
cm->num_tg = DEFAULT_MAX_NUM_TG;
#endif // CONFIG_EXT_TILE
if (cm->log2_tile_rows == 0) cm->dependent_horz_tiles = 0;
#if CONFIG_EXT_TILE
}
num_tiles_in_tg =
(cm->tile_cols * cm->tile_rows + cm->num_tg - 1) / cm->num_tg;
tg_row_start = 0;
tg_col_start = 0;
for (tile_row = 0; tile_row < cm->tile_rows; ++tile_row) {
for (tile_col = 0; tile_col < cm->tile_cols; ++tile_col) {
if ((tile_row * cm->tile_cols + tile_col) % num_tiles_in_tg == 0) {
tg_row_start = tile_row;
tg_col_start = tile_col;
#endif // CONFIG_EXT_TILE
#if CONFIG_TILE_GROUPS
#if CONFIG_EXT_TILE
if (!cm->large_scale_tile) {
#endif // CONFIG_EXT_TILE
if (cpi->oxcf.mtu == 0) {
cm->num_tg = cpi->oxcf.num_tile_groups;
} else {
// Use a default value for the purposes of weighting costs in probability
// updates
cm->num_tg = DEFAULT_MAX_NUM_TG;
}
num_tiles_in_tg =
(cm->tile_cols * cm->tile_rows + cm->num_tg - 1) / cm->num_tg;
tg_row_start = 0;
tg_col_start = 0;
for (tile_row = 0; tile_row < cm->tile_rows; ++tile_row) {
for (tile_col = 0; tile_col < cm->tile_cols; ++tile_col) {
if ((tile_row * cm->tile_cols + tile_col) % num_tiles_in_tg == 0) {
tg_row_start = tile_row;
tg_col_start = tile_col;
}
cm->tile_group_start_row[tile_row][tile_col] = tg_row_start;
cm->tile_group_start_col[tile_row][tile_col] = tg_col_start;
}
cm->tile_group_start_row[tile_row][tile_col] = tg_row_start;
cm->tile_group_start_col[tile_row][tile_col] = tg_col_start;
}
#if CONFIG_EXT_TILE
}
#endif // CONFIG_EXT_TILE
#endif
#endif
......@@ -3959,7 +3975,17 @@ static void superres_post_encode(AV1_COMP *cpi) {
static void loopfilter_frame(AV1_COMP *cpi, AV1_COMMON *cm) {
MACROBLOCKD *xd = &cpi->td.mb.e_mbd;
struct loopfilter *lf = &cm->lf;
if (is_lossless_requested(&cpi->oxcf)) {
int no_loopfilter = 0;
if (is_lossless_requested(&cpi->oxcf)) no_loopfilter = 1;
#if CONFIG_EXT_TILE
// 0 loopfilter level is only necessary if individual tile
// decoding is required.
if (cm->single_tile_decoding) no_loopfilter = 1;
#endif // CONFIG_EXT_TILE
if (no_loopfilter) {
lf->filter_level = 0;
} else {
struct aom_usec_timer timer;
......@@ -4724,7 +4750,8 @@ static void encode_frame_to_data_rate(AV1_COMP *cpi, size_t *size,
#endif
#if CONFIG_EXT_TILE
cm->tile_encoding_mode = cpi->oxcf.tile_encoding_mode;
cm->large_scale_tile = cpi->oxcf.large_scale_tile;
cm->single_tile_decoding = cpi->oxcf.single_tile_decoding;
#endif // CONFIG_EXT_TILE
#if CONFIG_XIPHRC
......
......@@ -294,7 +294,8 @@ typedef struct AV1EncoderConfig {
int ans_window_size_log2;
#endif // CONFIG_ANS && ANS_MAX_SYMBOLS
#if CONFIG_EXT_TILE
unsigned int tile_encoding_mode;
unsigned int large_scale_tile;
unsigned int single_tile_decoding;
#endif // CONFIG_EXT_TILE
unsigned int motion_vector_unit_test;
......
......@@ -200,11 +200,4 @@ void av1_pick_filter_level(const YV12_BUFFER_CONFIG *sd, AV1_COMP *cpi,
lf->filter_level = av1_search_filter_level(
sd, cpi, method == LPF_PICK_FROM_SUBIMAGE, NULL);
}
#if CONFIG_EXT_TILE
// TODO(any): 0 loopfilter level is only necessary if individual tile
// decoding is required. We need to communicate this requirement to this
// code and force loop filter level 0 only if required.
if (cm->tile_encoding_mode) lf->filter_level = 0;
#endif // CONFIG_EXT_TILE
}
......@@ -578,11 +578,6 @@ post_process_cmdline() {
log_echo "var_tx_no_tx_mode requires var_tx, so disabling var_tx_no_tx_mode"
disable_feature var_tx_no_tx_mode
fi
if enabled ext_tile; then
log_echo "ext_tile not compatible with tile_groups, so"
log_echo "disabling tile_groups"
disable_feature tile_groups
fi
if enabled ext_partition_types; then
if enabled fp_mb_stats; then
log_echo "ext_partition_types not compatible with fp_mb_stats;"
......
......@@ -30,8 +30,8 @@ const int kTIleSizeInPixels = (kTileSize << 6);
const int kImgWidth = 704;
const int kImgHeight = 576;
// This test tests "tile_encoding_mode = TILE_VR" case. The TILE_NORMAL case is
// tested by the tile_independence test.
// This test tests large scale tile coding case. Non-large-scale tile coding
// is tested by the tile_independence test.
class AV1ExtTileTest
: public ::libaom_test::CodecTestWith2Params<libaom_test::TestMode, int>,
public ::libaom_test::EncoderTest {
......@@ -84,7 +84,8 @@ class AV1ExtTileTest
// The tile size is 64x64.
encoder->Control(AV1E_SET_TILE_COLUMNS, kTileSize);
encoder->Control(AV1E_SET_TILE_ROWS, kTileSize);
encoder->Control(AV1E_SET_TILE_ENCODING_MODE, 1); // TILE_VR
// TODO(yunqingwang): test single_tile_decoding = 0.
encoder->Control(AV1E_SET_SINGLE_TILE_DECODING, 1);
#if CONFIG_EXT_PARTITION
// Always use 64x64 max partition.
encoder->Control(AV1E_SET_SUPERBLOCK_SIZE, AOM_SUPERBLOCK_SIZE_64X64);
......@@ -186,6 +187,7 @@ TEST_P(AV1ExtTileTest, DecoderResultTest) {
kImgHeight, 30, 1, 0, kLimit);
cfg_.rc_target_bitrate = 500;
cfg_.g_error_resilient = AOM_ERROR_RESILIENT_DEFAULT;
cfg_.large_scale_tile = 1;
cfg_.g_lag_in_frames = 0;
cfg_.g_threads = 1;
......
......@@ -32,7 +32,7 @@ class AVxEncoderThreadTest
cfg.h = 720;
cfg.allow_lowbitdepth = 1;
decoder_ = codec_->CreateDecoder(cfg, 0);
#if CONFIG_AV1 && CONFIG_EXT_TILE
#if CONFIG_AV1