Commit 4ec84aba authored by Imdad Sardharwalla's avatar Imdad Sardharwalla

Move sb_size to sequence header

sb_size, mib_size and mib_size_log2 have been moved from the AV1_COMMON struct
to the SequenceHeader struct, as they are sequence-level parameters. sb_size is
now written to and read from the end of the sequence header.

BUG=aomedia:996

Change-Id: I9d450518a1b898677976acd80088b8ea9ee9d7ce
parent bde9cd8a
......@@ -1383,7 +1383,8 @@ static void get_filter_level_and_masks_non420(
// Determine the vertical edges that need filtering
int idx_c;
for (idx_c = 0; idx_c < cm->mib_size && mi_col + idx_c < cm->mi_cols;
for (idx_c = 0;
idx_c < cm->seq_params.mib_size && mi_col + idx_c < cm->mi_cols;
idx_c += col_step) {
const MODE_INFO *mi = mib[idx_r * cm->mi_stride + idx_c];
const MB_MODE_INFO *mbmi = &mi[0].mbmi;
......@@ -1565,7 +1566,8 @@ void av1_filter_block_plane_non420_ver(AV1_COMMON *const cm,
uint8_t lfl[MAX_MIB_SIZE][MAX_MIB_SIZE] = { { 0 } };
int idx_r;
for (idx_r = 0; idx_r < cm->mib_size && mi_row + idx_r < cm->mi_rows;
for (idx_r = 0;
idx_r < cm->seq_params.mib_size && mi_row + idx_r < cm->mi_rows;
idx_r += row_step) {
unsigned int mask_4x4_int;
FilterMasks col_masks;
......@@ -1614,7 +1616,8 @@ void av1_filter_block_plane_non420_hor(AV1_COMMON *const cm,
uint8_t lfl[MAX_MIB_SIZE][MAX_MIB_SIZE] = { { 0 } };
int idx_r;
for (idx_r = 0; idx_r < cm->mib_size && mi_row + idx_r < cm->mi_rows;
for (idx_r = 0;
idx_r < cm->seq_params.mib_size && mi_row + idx_r < cm->mi_rows;
idx_r += row_step) {
unsigned int mask_4x4_int;
FilterMasks row_masks;
......@@ -1663,7 +1666,7 @@ void av1_filter_block_plane_ss00_ver(AV1_COMMON *const cm,
assert(plane->subsampling_x == 0 && plane->subsampling_y == 0);
// Vertical pass: do 2 rows at one time
for (r = 0; r < cm->mib_size && mi_row + r < cm->mi_rows; r += 2) {
for (r = 0; r < cm->seq_params.mib_size && mi_row + r < cm->mi_rows; r += 2) {
unsigned int mask_16x16_l = mask_16x16 & 0xffff;
unsigned int mask_8x8_l = mask_8x8 & 0xffff;
unsigned int mask_4x4_l = mask_4x4 & 0xffff;
......@@ -1704,7 +1707,7 @@ void av1_filter_block_plane_ss00_hor(AV1_COMMON *const cm,
assert(plane->subsampling_x == 0 && plane->subsampling_y == 0);
for (r = 0; r < cm->mib_size && mi_row + r < cm->mi_rows; r++) {
for (r = 0; r < cm->seq_params.mib_size && mi_row + r < cm->mi_rows; r++) {
unsigned int mask_16x16_r;
unsigned int mask_8x8_r;
unsigned int mask_4x4_r;
......@@ -1756,8 +1759,8 @@ void av1_filter_block_plane_ss11_ver(AV1_COMMON *const cm,
memset(lfm->lfl_uv, 0, sizeof(lfm->lfl_uv));
// Vertical pass: do 2 rows at one time
for (r = 0; r < cm->mib_size && mi_row + r < cm->mi_rows; r += 4) {
for (c = 0; c < (cm->mib_size >> 1); c++) {
for (r = 0; r < cm->seq_params.mib_size && mi_row + r < cm->mi_rows; r += 4) {
for (c = 0; c < (cm->seq_params.mib_size >> 1); c++) {
lfm->lfl_uv[r >> 1][c] = lfm->lfl_y[r][c << 1];
lfm->lfl_uv[(r + 2) >> 1][c] = lfm->lfl_y[r + 2][c << 1];
}
......@@ -1808,14 +1811,14 @@ void av1_filter_block_plane_ss11_hor(AV1_COMMON *const cm,
// re-porpulate the filter level for uv, same as the code for vertical
// filter in av1_filter_block_plane_ss11_ver
for (r = 0; r < cm->mib_size && mi_row + r < cm->mi_rows; r += 4) {
for (c = 0; c < (cm->mib_size >> 1); c++) {
for (r = 0; r < cm->seq_params.mib_size && mi_row + r < cm->mi_rows; r += 4) {
for (c = 0; c < (cm->seq_params.mib_size >> 1); c++) {
lfm->lfl_uv[r >> 1][c] = lfm->lfl_y[r][c << 1];
lfm->lfl_uv[(r + 2) >> 1][c] = lfm->lfl_y[r + 2][c << 1];
}
}
for (r = 0; r < cm->mib_size && mi_row + r < cm->mi_rows; r += 2) {
for (r = 0; r < cm->seq_params.mib_size && mi_row + r < cm->mi_rows; r += 2) {
const int skip_border_4x4_r = mi_row + r == cm->mi_rows - 1;
const unsigned int mask_4x4_int_r =
skip_border_4x4_r ? 0 : (mask_4x4_int & 0xf);
......@@ -2369,13 +2372,14 @@ void av1_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer, AV1_COMMON *cm,
#if !CONFIG_PARALLEL_DEBLOCKING
for (int i = 0; i < nplanes; ++i)
memset(cm->top_txfm_context[i], TX_32X32, cm->mi_cols << TX_UNIT_WIDE_LOG2);
for (mi_row = start; mi_row < stop; mi_row += cm->mib_size) {
for (mi_row = start; mi_row < stop; mi_row += cm->seq_params.mib_size) {
MODE_INFO **mi = cm->mi_grid_visible + mi_row * cm->mi_stride;
for (int i = 0; i < nplanes; ++i)
memset(cm->left_txfm_context[i], TX_32X32,
MAX_MIB_SIZE << TX_UNIT_HIGH_LOG2);
for (mi_col = 0; mi_col < cm->mi_cols; mi_col += cm->mib_size) {
av1_setup_dst_planes(planes, cm->sb_size, frame_buffer, mi_row, mi_col);
for (mi_col = 0; mi_col < cm->mi_cols; mi_col += cm->seq_params.mib_size) {
av1_setup_dst_planes(planes, cm->seq_params.sb_size, frame_buffer, mi_row,
mi_col);
for (plane = plane_start; plane < plane_end; ++plane) {
av1_filter_block_plane_non420_ver(cm, &planes[plane], mi + mi_col,
......@@ -2390,8 +2394,8 @@ void av1_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer, AV1_COMMON *cm,
// filter all vertical edges in every 64x64 super block
for (mi_row = start; mi_row < stop; mi_row += MAX_MIB_SIZE) {
for (mi_col = col_start; mi_col < col_end; mi_col += MAX_MIB_SIZE) {
av1_setup_dst_planes(planes, cm->sb_size, frame_buffer, mi_row, mi_col,
num_planes);
av1_setup_dst_planes(planes, cm->seq_params.sb_size, frame_buffer, mi_row,
mi_col, num_planes);
for (plane = plane_start; plane < plane_end; ++plane) {
av1_filter_block_plane_vert(cm, plane, &planes[plane], mi_row, mi_col);
}
......@@ -2401,8 +2405,8 @@ void av1_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer, AV1_COMMON *cm,
// filter all horizontal edges in every 64x64 super block
for (mi_row = start; mi_row < stop; mi_row += MAX_MIB_SIZE) {
for (mi_col = col_start; mi_col < col_end; mi_col += MAX_MIB_SIZE) {
av1_setup_dst_planes(planes, cm->sb_size, frame_buffer, mi_row, mi_col,
num_planes);
av1_setup_dst_planes(planes, cm->seq_params.sb_size, frame_buffer, mi_row,
mi_col, num_planes);
for (plane = plane_start; plane < plane_end; ++plane) {
av1_filter_block_plane_horz(cm, plane, &planes[plane], mi_row, mi_col);
}
......
......@@ -166,7 +166,8 @@ void av1_cdef_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm,
int coeff_shift = AOMMAX(cm->bit_depth - 8, 0);
const int nvfb = (cm->mi_rows + MI_SIZE_64X64 - 1) / MI_SIZE_64X64;
const int nhfb = (cm->mi_cols + MI_SIZE_64X64 - 1) / MI_SIZE_64X64;
av1_setup_dst_planes(xd->plane, cm->sb_size, frame, 0, 0, num_planes);
av1_setup_dst_planes(xd->plane, cm->seq_params.sb_size, frame, 0, 0,
num_planes);
row_cdef = aom_malloc(sizeof(*row_cdef) * (nhfb + 2) * 2);
memset(row_cdef, 1, sizeof(*row_cdef) * (nhfb + 2) * 2);
prev_row_cdef = row_cdef + 1;
......
......@@ -384,7 +384,7 @@ static uint8_t scan_blk_mbmi(const AV1_COMMON *cm, const MACROBLOCKD *xd,
static int has_top_right(const AV1_COMMON *cm, const MACROBLOCKD *xd,
int mi_row, int mi_col, int bs) {
const int sb_mi_size = mi_size_wide[cm->sb_size];
const int sb_mi_size = mi_size_wide[cm->seq_params.sb_size];
const int mask_row = mi_row & (sb_mi_size - 1);
const int mask_col = mi_col & (sb_mi_size - 1);
......@@ -434,7 +434,7 @@ static int has_top_right(const AV1_COMMON *cm, const MACROBLOCKD *xd,
static int check_sb_border(const AV1_COMMON *cm, const int mi_row,
const int mi_col, const int row_offset,
const int col_offset) {
const int sb_mi_size = mi_size_wide[cm->sb_size];
const int sb_mi_size = mi_size_wide[cm->seq_params.sb_size];
const int row = mi_row & (sb_mi_size - 1);
const int col = mi_col & (sb_mi_size - 1);
......@@ -989,7 +989,7 @@ static void find_mv_refs_idx(const AV1_COMMON *cm, const MACROBLOCKD *xd,
int16_t *mode_context, int_mv zeromv,
uint8_t refmv_count) {
const int *ref_sign_bias = cm->ref_frame_sign_bias;
const int sb_mi_size = mi_size_wide[cm->sb_size];
const int sb_mi_size = mi_size_wide[cm->seq_params.sb_size];
int i;
int context_counter = 0;
......
......@@ -222,6 +222,9 @@ typedef struct SequenceHeader {
int frame_id_numbers_present_flag;
int frame_id_length;
int delta_frame_id_length;
BLOCK_SIZE sb_size; // Size of the superblock used for this frame
int mib_size; // Size of the superblock in units of MI blocks
int mib_size_log2; // Log 2 of above.
#if CONFIG_MONO_VIDEO
int monochrome;
#endif // CONFIG_MONO_VIDEO
......@@ -553,9 +556,6 @@ typedef struct AV1Common {
int film_grain_params_present;
aom_film_grain_t film_grain_params;
#endif
BLOCK_SIZE sb_size; // Size of the superblock used for this frame
int mib_size; // Size of the superblock in units of MI blocks
int mib_size_log2; // Log 2 of above.
int cdef_pri_damping;
int cdef_sec_damping;
int nb_cdef_strengths;
......@@ -746,11 +746,11 @@ static INLINE void ensure_mv_buffer(RefCntBuffer *buf, AV1_COMMON *cm) {
}
static INLINE int mi_cols_aligned_to_sb(const AV1_COMMON *cm) {
return ALIGN_POWER_OF_TWO(cm->mi_cols, cm->mib_size_log2);
return ALIGN_POWER_OF_TWO(cm->mi_cols, cm->seq_params.mib_size_log2);
}
static INLINE int mi_rows_aligned_to_sb(const AV1_COMMON *cm) {
return ALIGN_POWER_OF_TWO(cm->mi_rows, cm->mib_size_log2);
return ALIGN_POWER_OF_TWO(cm->mi_rows, cm->seq_params.mib_size_log2);
}
static INLINE int frame_is_intra_only(const AV1_COMMON *const cm) {
......@@ -1180,7 +1180,8 @@ static INLINE void av1_zero_above_context(AV1_COMMON *const cm,
int mi_col_start, int mi_col_end) {
const int num_planes = av1_num_planes(cm);
const int width = mi_col_end - mi_col_start;
const int aligned_width = ALIGN_POWER_OF_TWO(width, cm->mib_size_log2);
const int aligned_width =
ALIGN_POWER_OF_TWO(width, cm->seq_params.mib_size_log2);
const int offset_y = mi_col_start << (MI_SIZE_LOG2 - tx_size_wide_log2[0]);
const int width_y = aligned_width << (MI_SIZE_LOG2 - tx_size_wide_log2[0]);
......@@ -1377,10 +1378,11 @@ static INLINE void set_use_reference_buffer(AV1_COMMON *const cm, int use) {
#endif
}
static INLINE void set_sb_size(AV1_COMMON *const cm, BLOCK_SIZE sb_size) {
cm->sb_size = sb_size;
cm->mib_size = mi_size_wide[cm->sb_size];
cm->mib_size_log2 = b_width_log2_lookup[cm->sb_size];
static INLINE void set_sb_size(SequenceHeader *const seq_params,
BLOCK_SIZE sb_size) {
seq_params->sb_size = sb_size;
seq_params->mib_size = mi_size_wide[seq_params->sb_size];
seq_params->mib_size_log2 = b_width_log2_lookup[seq_params->sb_size];
}
static INLINE int all_lossless(const AV1_COMMON *cm, const MACROBLOCKD *xd) {
......
......@@ -284,7 +284,7 @@ static int has_top_right(const AV1_COMMON *cm, BLOCK_SIZE bsize, int mi_row,
const int bw_in_mi_log2 = mi_width_log2_lookup[bsize];
const int bh_in_mi_log2 = mi_height_log2_lookup[bsize];
const int sb_mi_size = mi_size_high[cm->sb_size];
const int sb_mi_size = mi_size_high[cm->seq_params.sb_size];
const int blk_row_in_sb = (mi_row & (sb_mi_size - 1)) >> bh_in_mi_log2;
const int blk_col_in_sb = (mi_col & (sb_mi_size - 1)) >> bw_in_mi_log2;
......@@ -526,7 +526,7 @@ static int has_bottom_left(const AV1_COMMON *cm, BLOCK_SIZE bsize, int mi_row,
const int bw_in_mi_log2 = mi_width_log2_lookup[bsize];
const int bh_in_mi_log2 = mi_height_log2_lookup[bsize];
const int sb_mi_size = mi_size_high[cm->sb_size];
const int sb_mi_size = mi_size_high[cm->seq_params.sb_size];
const int blk_row_in_sb = (mi_row & (sb_mi_size - 1)) >> bh_in_mi_log2;
const int blk_col_in_sb = (mi_col & (sb_mi_size - 1)) >> bw_in_mi_log2;
......
......@@ -1537,7 +1537,7 @@ int av1_loop_restoration_corners_in_sb(const struct AV1Common *cm, int plane,
int *rrow1, int *tile_tl_idx) {
assert(rcol0 && rcol1 && rrow0 && rrow1);
if (bsize != cm->sb_size) return 0;
if (bsize != cm->seq_params.sb_size) return 0;
if (cm->rst_info[plane].frame_restoration_type == RESTORE_NONE) return 0;
const int is_uv = plane > 0;
......@@ -1545,7 +1545,7 @@ int av1_loop_restoration_corners_in_sb(const struct AV1Common *cm, int plane,
// Which tile contains the superblock? Find that tile's top-left in mi-units,
// together with the tile's size in pixels.
#if CONFIG_MAX_TILE
const int mib_log2 = cm->mib_size_log2;
const int mib_log2 = cm->seq_params.mib_size_log2;
const int tile_row = get_tile_idx(cm->tile_row_start_sb, mi_row, mib_log2);
const int tile_col = get_tile_idx(cm->tile_col_start_sb, mi_col, mib_log2);
#else
......
......@@ -151,16 +151,16 @@ static int loop_filter_ver_row_worker(AV1LfSync *const lf_sync,
enum lf_path path = get_loop_filter_path(lf_data->y_only, lf_data->planes);
#endif
for (mi_row = lf_data->start; mi_row < lf_data->stop;
mi_row += lf_sync->num_workers * lf_data->cm->mib_size) {
mi_row += lf_sync->num_workers * lf_data->cm->seq_params.mib_size) {
MODE_INFO **const mi =
lf_data->cm->mi_grid_visible + mi_row * lf_data->cm->mi_stride;
for (mi_col = 0; mi_col < lf_data->cm->mi_cols;
mi_col += lf_data->cm->mib_size) {
mi_col += lf_data->cm->seq_params.mib_size) {
LOOP_FILTER_MASK lfm;
int plane;
av1_setup_dst_planes(lf_data->planes, lf_data->cm->sb_size,
av1_setup_dst_planes(lf_data->planes, lf_data->cm->seq_params.sb_size,
lf_data->frame_buffer, mi_row, mi_col,
av1_num_planes(lf_data->cm));
av1_setup_mask(lf_data->cm, mi_row, mi_col, mi + mi_col,
......@@ -184,22 +184,22 @@ static int loop_filter_ver_row_worker(AV1LfSync *const lf_sync,
static int loop_filter_hor_row_worker(AV1LfSync *const lf_sync,
LFWorkerData *const lf_data) {
const int num_planes = lf_data->y_only ? 1 : MAX_MB_PLANE;
const int sb_cols =
mi_cols_aligned_to_sb(lf_data->cm) >> lf_data->cm->mib_size_log2;
const int sb_cols = mi_cols_aligned_to_sb(lf_data->cm) >>
lf_data->cm->seq_params.mib_size_log2;
int mi_row, mi_col;
#if !CONFIG_EXT_PARTITION_TYPES
enum lf_path path = get_loop_filter_path(lf_data->y_only, lf_data->planes);
#endif
for (mi_row = lf_data->start; mi_row < lf_data->stop;
mi_row += lf_sync->num_workers * lf_data->cm->mib_size) {
mi_row += lf_sync->num_workers * lf_data->cm->seq_params.mib_size) {
MODE_INFO **const mi =
lf_data->cm->mi_grid_visible + mi_row * lf_data->cm->mi_stride;
for (mi_col = 0; mi_col < lf_data->cm->mi_cols;
mi_col += lf_data->cm->mib_size) {
const int r = mi_row >> lf_data->cm->mib_size_log2;
const int c = mi_col >> lf_data->cm->mib_size_log2;
mi_col += lf_data->cm->seq_params.mib_size) {
const int r = mi_row >> lf_data->cm->seq_params.mib_size_log2;
const int c = mi_col >> lf_data->cm->seq_params.mib_size_log2;
LOOP_FILTER_MASK lfm;
int plane;
......@@ -207,7 +207,7 @@ static int loop_filter_hor_row_worker(AV1LfSync *const lf_sync,
// the outer loop to column-based and remove the synchronizations here.
sync_read(lf_sync, r, c);
av1_setup_dst_planes(lf_data->planes, lf_data->cm->sb_size,
av1_setup_dst_planes(lf_data->planes, lf_data->cm->seq_params.sb_size,
lf_data->frame_buffer, mi_row, mi_col,
av1_num_planes(lf_data->cm));
av1_setup_mask(lf_data->cm, mi_row, mi_col, mi + mi_col,
......@@ -230,8 +230,8 @@ static int loop_filter_hor_row_worker(AV1LfSync *const lf_sync,
static int loop_filter_row_worker(AV1LfSync *const lf_sync,
LFWorkerData *const lf_data) {
const int num_planes = lf_data->y_only ? 1 : MAX_MB_PLANE;
const int sb_cols =
mi_cols_aligned_to_sb(lf_data->cm) >> lf_data->cm->mib_size_log2;
const int sb_cols = mi_cols_aligned_to_sb(lf_data->cm) >>
lf_data->cm->seq_params.mib_size_log2;
int mi_row, mi_col;
#if !CONFIG_EXT_PARTITION_TYPES
enum lf_path path = get_loop_filter_path(lf_data->y_only, lf_data->planes);
......@@ -245,14 +245,14 @@ static int loop_filter_row_worker(AV1LfSync *const lf_sync,
#endif // CONFIG_EXT_PARTITION
for (mi_row = lf_data->start; mi_row < lf_data->stop;
mi_row += lf_sync->num_workers * lf_data->cm->mib_size) {
mi_row += lf_sync->num_workers * lf_data->cm->seq_params.mib_size) {
MODE_INFO **const mi =
lf_data->cm->mi_grid_visible + mi_row * lf_data->cm->mi_stride;
for (mi_col = 0; mi_col < lf_data->cm->mi_cols;
mi_col += lf_data->cm->mib_size) {
const int r = mi_row >> lf_data->cm->mib_size_log2;
const int c = mi_col >> lf_data->cm->mib_size_log2;
mi_col += lf_data->cm->seq_params.mib_size) {
const int r = mi_row >> lf_data->cm->seq_params.mib_size_log2;
const int c = mi_col >> lf_data->cm->seq_params.mib_size_log2;
#if !CONFIG_EXT_PARTITION_TYPES
LOOP_FILTER_MASK lfm;
#endif
......@@ -260,7 +260,7 @@ static int loop_filter_row_worker(AV1LfSync *const lf_sync,
sync_read(lf_sync, r, c);
av1_setup_dst_planes(lf_data->planes, lf_data->cm->sb_size,
av1_setup_dst_planes(lf_data->planes, lf_data->cm->seq_params.sb_size,
lf_data->frame_buffer, mi_row, mi_col);
#if CONFIG_EXT_PARTITION_TYPES
for (plane = 0; plane < num_planes; ++plane) {
......@@ -300,7 +300,7 @@ static void loop_filter_rows_mt(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm,
const AVxWorkerInterface *const winterface = aom_get_worker_interface();
// Number of superblock rows and cols
const int sb_rows = mi_rows_aligned_to_sb(cm) >> cm->mib_size_log2;
const int sb_rows = mi_rows_aligned_to_sb(cm) >> cm->seq_params.mib_size_log2;
// Decoder may allocate more threads than number of tiles based on user's
// input.
const int tile_cols = cm->tile_cols;
......@@ -338,7 +338,7 @@ static void loop_filter_rows_mt(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm,
// Loopfilter data
av1_loop_filter_data_reset(lf_data, frame, cm, planes);
lf_data->start = start + i * cm->mib_size;
lf_data->start = start + i * cm->seq_params.mib_size;
lf_data->stop = stop;
lf_data->y_only = y_only;
......@@ -367,7 +367,7 @@ static void loop_filter_rows_mt(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm,
// Loopfilter data
av1_loop_filter_data_reset(lf_data, frame, cm, planes);
lf_data->start = start + i * cm->mib_size;
lf_data->start = start + i * cm->seq_params.mib_size;
lf_data->stop = stop;
lf_data->y_only = y_only;
......@@ -397,7 +397,7 @@ static void loop_filter_rows_mt(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm,
// Loopfilter data
av1_loop_filter_data_reset(lf_data, frame, cm, planes);
lf_data->start = start + i * cm->mib_size;
lf_data->start = start + i * cm->seq_params.mib_size;
lf_data->stop = stop;
lf_data->y_only = y_only;
......
......@@ -58,10 +58,10 @@ static int tile_log2(int blk_size, int target) {
}
void av1_get_tile_limits(AV1_COMMON *const cm) {
int mi_cols = ALIGN_POWER_OF_TWO(cm->mi_cols, cm->mib_size_log2);
int mi_rows = ALIGN_POWER_OF_TWO(cm->mi_rows, cm->mib_size_log2);
int sb_cols = mi_cols >> cm->mib_size_log2;
int sb_rows = mi_rows >> cm->mib_size_log2;
int mi_cols = ALIGN_POWER_OF_TWO(cm->mi_cols, cm->seq_params.mib_size_log2);
int mi_rows = ALIGN_POWER_OF_TWO(cm->mi_rows, cm->seq_params.mib_size_log2);
int sb_cols = mi_cols >> cm->seq_params.mib_size_log2;
int sb_rows = mi_rows >> cm->seq_params.mib_size_log2;
cm->min_log2_tile_cols = tile_log2(MAX_TILE_WIDTH_SB, sb_cols);
cm->max_log2_tile_cols = tile_log2(1, AOMMIN(sb_cols, MAX_TILE_COLS));
......@@ -73,10 +73,10 @@ void av1_get_tile_limits(AV1_COMMON *const cm) {
}
void av1_calculate_tile_cols(AV1_COMMON *const cm) {
int mi_cols = ALIGN_POWER_OF_TWO(cm->mi_cols, cm->mib_size_log2);
int mi_rows = ALIGN_POWER_OF_TWO(cm->mi_rows, cm->mib_size_log2);
int sb_cols = mi_cols >> cm->mib_size_log2;
int sb_rows = mi_rows >> cm->mib_size_log2;
int mi_cols = ALIGN_POWER_OF_TWO(cm->mi_cols, cm->seq_params.mib_size_log2);
int mi_rows = ALIGN_POWER_OF_TWO(cm->mi_rows, cm->seq_params.mib_size_log2);
int sb_cols = mi_cols >> cm->seq_params.mib_size_log2;
int sb_rows = mi_rows >> cm->seq_params.mib_size_log2;
int i;
if (cm->uniform_tile_spacing_flag) {
......@@ -108,8 +108,8 @@ void av1_calculate_tile_cols(AV1_COMMON *const cm) {
}
void av1_calculate_tile_rows(AV1_COMMON *const cm) {
int mi_rows = ALIGN_POWER_OF_TWO(cm->mi_rows, cm->mib_size_log2);
int sb_rows = mi_rows >> cm->mib_size_log2;
int mi_rows = ALIGN_POWER_OF_TWO(cm->mi_rows, cm->seq_params.mib_size_log2);
int sb_rows = mi_rows >> cm->seq_params.mib_size_log2;
int start_sb, size_sb, i;
if (cm->uniform_tile_spacing_flag) {
......@@ -140,8 +140,9 @@ void av1_calculate_tile_rows(AV1_COMMON *const cm) {
void av1_tile_set_row(TileInfo *tile, const AV1_COMMON *cm, int row) {
assert(row < cm->tile_rows);
int mi_row_start = cm->tile_row_start_sb[row] << cm->mib_size_log2;
int mi_row_end = cm->tile_row_start_sb[row + 1] << cm->mib_size_log2;
int mi_row_start = cm->tile_row_start_sb[row] << cm->seq_params.mib_size_log2;
int mi_row_end = cm->tile_row_start_sb[row + 1]
<< cm->seq_params.mib_size_log2;
tile->mi_row_start = mi_row_start;
tile->mi_row_end = AOMMIN(mi_row_end, cm->mi_rows);
assert(tile->mi_row_end > tile->mi_row_start);
......@@ -149,8 +150,9 @@ void av1_tile_set_row(TileInfo *tile, const AV1_COMMON *cm, int row) {
void av1_tile_set_col(TileInfo *tile, const AV1_COMMON *cm, int col) {
assert(col < cm->tile_cols);
int mi_col_start = cm->tile_col_start_sb[col] << cm->mib_size_log2;
int mi_col_end = cm->tile_col_start_sb[col + 1] << cm->mib_size_log2;
int mi_col_start = cm->tile_col_start_sb[col] << cm->seq_params.mib_size_log2;
int mi_col_end = cm->tile_col_start_sb[col + 1]
<< cm->seq_params.mib_size_log2;
tile->mi_col_start = mi_col_start;
tile->mi_col_end = AOMMIN(mi_col_end, cm->mi_cols);
assert(tile->mi_col_end > tile->mi_col_start);
......
......@@ -1260,12 +1260,13 @@ static void setup_frame_size(AV1_COMMON *cm, struct aom_read_bit_buffer *rb) {
pool->frame_bufs[cm->new_fb_idx].buf.render_height = cm->render_height;
}
static void setup_sb_size(AV1_COMMON *cm, struct aom_read_bit_buffer *rb) {
static void setup_sb_size(SequenceHeader *seq_params,
struct aom_read_bit_buffer *rb) {
(void)rb;
#if CONFIG_EXT_PARTITION
set_sb_size(cm, aom_rb_read_bit(rb) ? BLOCK_128X128 : BLOCK_64X64);
set_sb_size(seq_params, aom_rb_read_bit(rb) ? BLOCK_128X128 : BLOCK_64X64);
#else
set_sb_size(cm, BLOCK_64X64);
set_sb_size(seq_params, BLOCK_64X64);
#endif // CONFIG_EXT_PARTITION
}
......@@ -1411,10 +1412,10 @@ static int rb_read_uniform(struct aom_read_bit_buffer *const rb, int n) {
static void read_tile_info_max_tile(AV1_COMMON *const cm,
struct aom_read_bit_buffer *const rb) {
int width_mi = ALIGN_POWER_OF_TWO(cm->mi_cols, cm->mib_size_log2);
int height_mi = ALIGN_POWER_OF_TWO(cm->mi_rows, cm->mib_size_log2);
int width_sb = width_mi >> cm->mib_size_log2;
int height_sb = height_mi >> cm->mib_size_log2;
int width_mi = ALIGN_POWER_OF_TWO(cm->mi_cols, cm->seq_params.mib_size_log2);
int height_mi = ALIGN_POWER_OF_TWO(cm->mi_rows, cm->seq_params.mib_size_log2);
int width_sb = width_mi >> cm->seq_params.mib_size_log2;
int height_sb = height_mi >> cm->seq_params.mib_size_log2;
av1_get_tile_limits(cm);
cm->uniform_tile_spacing_flag = aom_rb_read_bit(rb);
......@@ -1498,7 +1499,7 @@ static void read_tile_info(AV1Decoder *const pbi,
;
// Read the tile width/height
#if CONFIG_EXT_PARTITION
if (cm->sb_size == BLOCK_128X128) {
if (cm->seq_params.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 {
......@@ -1509,8 +1510,8 @@ static void read_tile_info(AV1Decoder *const pbi,
}
#endif // CONFIG_EXT_PARTITION
cm->tile_width <<= cm->mib_size_log2;
cm->tile_height <<= cm->mib_size_log2;
cm->tile_width <<= cm->seq_params.mib_size_log2;
cm->tile_height <<= cm->seq_params.mib_size_log2;
cm->tile_width = AOMMIN(cm->tile_width, cm->mi_cols);
cm->tile_height = AOMMIN(cm->tile_height, cm->mi_rows);
......@@ -1553,11 +1554,11 @@ static void read_tile_info(AV1Decoder *const pbi,
#if CONFIG_MAX_TILE
for (int i = 0; i <= cm->tile_cols; i++) {
cm->tile_col_start_sb[i] =
((i * cm->tile_width - 1) >> cm->mib_size_log2) + 1;
((i * cm->tile_width - 1) >> cm->seq_params.mib_size_log2) + 1;
}
for (int i = 0; i <= cm->tile_rows; i++) {
cm->tile_row_start_sb[i] =
((i * cm->tile_height - 1) >> cm->mib_size_log2) + 1;
((i * cm->tile_height - 1) >> cm->seq_params.mib_size_log2) + 1;
}
#endif // CONFIG_MAX_TILE
} else {
......@@ -2066,13 +2067,13 @@ static const uint8_t *decode_tiles(AV1Decoder *pbi, const uint8_t *data,
#endif // CONFIG_LOOPFILTERING_ACROSS_TILES
for (mi_row = tile_info.mi_row_start; mi_row < tile_info.mi_row_end;
mi_row += cm->mib_size) {
mi_row += cm->seq_params.mib_size) {
av1_zero_left_context(&td->xd);
for (int mi_col = tile_info.mi_col_start; mi_col < tile_info.mi_col_end;
mi_col += cm->mib_size) {
mi_col += cm->seq_params.mib_size) {
decode_partition(pbi, &td->xd, mi_row, mi_col, &td->bit_reader,
cm->sb_size);
cm->seq_params.sb_size);
}
aom_merge_corrupted_flag(&pbi->mb.corrupted, td->xd.corrupted);
if (pbi->mb.corrupted)
......@@ -2088,7 +2089,8 @@ static const uint8_t *decode_tiles(AV1Decoder *pbi, const uint8_t *data,
// After loopfiltering, the last 7 row pixels in each superblock row may
// still be changed by the longest loopfilter of the next superblock row.
if (cm->frame_parallel_decode)
av1_frameworker_broadcast(pbi->cur_buf, mi_row << cm->mib_size_log2);
av1_frameworker_broadcast(pbi->cur_buf,
mi_row << cm->seq_params.mib_size_log2);
}
#if CONFIG_INTRABC
......@@ -2378,6 +2380,8 @@ void read_sequence_header(SequenceHeader *seq_params,
seq_params->frame_id_length =
aom_rb_read_literal(rb, 3) + seq_params->delta_frame_id_length + 1;
}
setup_sb_size(seq_params, rb);
}
#endif // CONFIG_REFERENCE_BUFFER || CONFIG_OBU
......@@ -2775,7 +2779,6 @@ static int read_uncompressed_header(AV1Decoder *pbi,
#else
setup_frame_size(cm, rb);
#endif
setup_sb_size(cm, rb);
if (pbi->need_resync) {
memset(&cm->ref_frame_map, -1, sizeof(cm->ref_frame_map));
......@@ -2843,7 +2846,6 @@ static int read_uncompressed_header(AV1Decoder *pbi,
#else
setup_frame_size(cm, rb);
#endif
setup_sb_size(cm, rb);
if (pbi->need_resync) {
memset(&cm->ref_frame_map, -1, sizeof(cm->ref_frame_map));
pbi->need_resync = 0;
......
......@@ -44,8 +44,8 @@ static void read_cdef(AV1_COMMON *cm, aom_reader *r, MB_MODE_INFO *const mbmi,
if (cm->all_lossless) return;
const int m = ~((1 << (6 - MI_SIZE_LOG2)) - 1);
if (!(mi_col & (cm->mib_size - 1)) &&
!(mi_row & (cm->mib_size - 1))) { // Top left?
if (!(mi_col & (cm->seq_params.mib_size - 1)) &&
!(mi_row & (cm->seq_params.mib_size - 1))) { // Top left?
#if CONFIG_EXT_PARTITION
cm->cdef_preset[0] = cm->cdef_preset[1] = cm->cdef_preset[2] =
cm->cdef_preset[3] = -1;
......@@ -56,7 +56,7 @@ static void read_cdef(AV1_COMMON *cm, aom_reader *r, MB_MODE_INFO *const mbmi,
// Read CDEF param at first a non-skip coding block
#if CONFIG_EXT_PARTITION
const int mask = 1 << (6 - MI_SIZE_LOG2);
const int index = cm->sb_size == BLOCK_128X128
const int index = cm->seq_params.sb_size == BLOCK_128X128
? !!(mi_col & mask) + 2 * !!(mi_row & mask)
: 0;
cm->mi_grid_visible[(mi_row & m) * cm->mi_stride + (mi_col & m)]
......@@ -77,13 +77,14 @@ static int read_delta_qindex(AV1_COMMON *cm, MACROBLOCKD *xd, aom_reader *r,
MB_MODE_INFO *const mbmi, int mi_col, int mi_row) {
int sign, abs, reduced_delta_qindex = 0;
BLOCK_SIZE bsize = mbmi->sb_type;
const int b_col = mi_col & (cm->mib_size - 1);
const int b_row = mi_row & (cm->mib_size - 1);
const int b_col = mi_col & (cm->seq_params.mib_size - 1);
const int b_row = mi_row & (cm->seq_params.mib_size - 1);
const int read_delta_q_flag = (b_col == 0 && b_row == 0);
FRAME_CONTEXT *ec_ctx = xd->tile_ctx;
(void)cm;
if ((bsize != cm->sb_size || mbmi->skip == 0) && read_delta_q_flag) {
if ((bsize != cm->seq_params.sb_size || mbmi->skip == 0) &&
read_delta_q_flag) {
abs = aom_read_symbol(r, ec_ctx->delta_q_cdf, DELTA_Q_PROBS + 1, ACCT_STR);
const int smallval = (abs < DELTA_Q_SMALL);
......@@ -112,13 +113,14 @@ static int read_delta_lflevel(AV1_COMMON *cm, MACROBLOCKD *xd, aom_reader *r,
int mi_row) {
int sign, abs, reduced_delta_lflevel = 0;
BLOCK_SIZE bsize = mbmi->sb_type;
const int b_col = mi_col & (cm->mib_size - 1);
const int b_row = mi_row & (cm->mib_size - 1);
const int b_col = mi_col & (cm->seq_params.mib_size - 1);
const int b_row = mi_row & (cm->seq_params.mib_size - 1);
const int read_delta_lf_flag = (b_col == 0 && b_row == 0);
FRAME_CONTEXT *ec_ctx = xd->tile_ctx;
(void)cm;
if ((bsize != cm->sb_size || mbmi->skip == 0) && read_delta_lf_flag) {
if ((bsize != cm->seq_params.sb_size || mbmi->skip == 0) &&
read_delta_lf_flag) {
#if CONFIG_LOOPFILTER_LE