Commit 38e6cb8c authored by Dmitry Kovalev's avatar Dmitry Kovalev Committed by Gerrit Code Review

Merge "Cleaning up vp9_tile_common.{h, c} files."

parents 38144ed8 f91ac9b4
......@@ -15,46 +15,37 @@
#define MIN_TILE_WIDTH_B64 4
#define MAX_TILE_WIDTH_B64 64
static int to_sbs(n_mis) {
return mi_cols_aligned_to_sb(n_mis) >> MI_BLOCK_SIZE_LOG2;
static int get_tile_offset(int idx, int mis, int log2) {
const int sb_cols = mi_cols_aligned_to_sb(mis) >> MI_BLOCK_SIZE_LOG2;
const int offset = ((idx * sb_cols) >> log2) << MI_BLOCK_SIZE_LOG2;
return MIN(offset, mis);
}
static void get_tile_offsets(int *min_tile_off, int *max_tile_off,
int tile_idx, int log2_n_tiles, int n_mis) {
const int n_sbs = to_sbs(n_mis);
const int sb_off1 = (tile_idx * n_sbs) >> log2_n_tiles;
const int sb_off2 = ((tile_idx + 1) * n_sbs) >> log2_n_tiles;
*min_tile_off = MIN(sb_off1 << 3, n_mis);
*max_tile_off = MIN(sb_off2 << 3, n_mis);
}
void vp9_tile_init(TileInfo *tile, const VP9_COMMON *cm,
int row_idx, int col_idx) {
get_tile_offsets(&tile->mi_row_start, &tile->mi_row_end,
row_idx, cm->log2_tile_rows, cm->mi_rows);
get_tile_offsets(&tile->mi_col_start, &tile->mi_col_end,
col_idx, cm->log2_tile_cols, cm->mi_cols);
void vp9_tile_init(TileInfo *tile, const VP9_COMMON *cm, int row, int col) {
tile->mi_row_start = get_tile_offset(row, cm->mi_rows, cm->log2_tile_rows);
tile->mi_row_end = get_tile_offset(row + 1, cm->mi_rows, cm->log2_tile_rows);
tile->mi_col_start = get_tile_offset(col, cm->mi_cols, cm->log2_tile_cols);
tile->mi_col_end = get_tile_offset(col + 1, cm->mi_cols, cm->log2_tile_cols);
}
void vp9_get_tile_n_bits(int mi_cols,
int *min_log2_tile_cols, int *max_log2_tile_cols) {
const int sb_cols = to_sbs(mi_cols);
int min_log2_n_tiles, max_log2_n_tiles;
const int sb_cols = mi_cols_aligned_to_sb(mi_cols) >> MI_BLOCK_SIZE_LOG2;
int min_log2 = 0, max_log2 = 0;
for (max_log2_n_tiles = 0;
(sb_cols >> max_log2_n_tiles) >= MIN_TILE_WIDTH_B64;
max_log2_n_tiles++) {}
max_log2_n_tiles--;
if (max_log2_n_tiles < 0)
max_log2_n_tiles = 0;
// max
while ((sb_cols >> max_log2) >= MIN_TILE_WIDTH_B64)
++max_log2;
--max_log2;
if (max_log2 < 0)
max_log2 = 0;
for (min_log2_n_tiles = 0;
(MAX_TILE_WIDTH_B64 << min_log2_n_tiles) < sb_cols;
min_log2_n_tiles++) {}
// min
while ((MAX_TILE_WIDTH_B64 << min_log2) < sb_cols)
++min_log2;
assert(min_log2_n_tiles <= max_log2_n_tiles);
assert(min_log2 <= max_log2);
*min_log2_tile_cols = min_log2_n_tiles;
*max_log2_tile_cols = max_log2_n_tiles;
*min_log2_tile_cols = min_log2;
*max_log2_tile_cols = max_log2;
}
......@@ -18,10 +18,10 @@ typedef struct TileInfo {
int mi_col_start, mi_col_end;
} TileInfo;
// initializes 'tile->mi_(row|col)_(start|end)' for (row_idx, col_idx) based on
// initializes 'tile->mi_(row|col)_(start|end)' for (row, col) based on
// 'cm->log2_tile_(rows|cols)' & 'cm->mi_(rows|cols)'
void vp9_tile_init(TileInfo *tile, const struct VP9Common *cm,
int row_idx, int col_idx);
int row, int col);
void vp9_get_tile_n_bits(int mi_cols,
int *min_log2_tile_cols, int *max_log2_tile_cols);
......
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