Merge "Make internal codec support arbitrary tile size" into nextgen
This commit is contained in:
commit
bae6229884
@ -208,6 +208,8 @@ typedef struct VP9Common {
|
||||
int frame_parallel_decoding_mode;
|
||||
|
||||
int log2_tile_cols, log2_tile_rows;
|
||||
int tile_cols, tile_rows;
|
||||
int tile_width, tile_height;
|
||||
|
||||
// Private data associated with the frame buffer callbacks.
|
||||
void *cb_priv;
|
||||
|
@ -31,10 +31,19 @@ void vp9_tile_set_col(TileInfo *tile, const VP9_COMMON *cm, int col) {
|
||||
tile->mi_col_end = get_tile_offset(col + 1, cm->mi_cols, cm->log2_tile_cols);
|
||||
}
|
||||
|
||||
#if CONFIG_ROW_TILE
|
||||
void vp9_tile_init(TileInfo *tile, const VP9_COMMON *cm, int row, int col) {
|
||||
tile->mi_row_start = row * cm->tile_height;
|
||||
tile->mi_row_end = MIN(tile->mi_row_start + cm->tile_height, cm->mi_rows);
|
||||
tile->mi_col_start = col * cm->tile_width;
|
||||
tile->mi_col_end = MIN(tile->mi_col_start + cm->tile_width, cm->mi_cols);
|
||||
}
|
||||
#else
|
||||
void vp9_tile_init(TileInfo *tile, const VP9_COMMON *cm, int row, int col) {
|
||||
vp9_tile_set_row(tile, cm, row);
|
||||
vp9_tile_set_col(tile, cm, col);
|
||||
}
|
||||
#endif
|
||||
|
||||
void vp9_get_tile_n_bits(int mi_cols,
|
||||
int *min_log2_tile_cols, int *max_log2_tile_cols) {
|
||||
|
@ -1891,6 +1891,15 @@ static void setup_tile_info(VP9_COMMON *cm, struct vp9_read_bit_buffer *rb) {
|
||||
if (cm->log2_tile_rows)
|
||||
cm->log2_tile_rows += vp9_rb_read_bit(rb);
|
||||
#endif
|
||||
|
||||
cm->tile_cols = 1 << cm->log2_tile_cols;
|
||||
cm->tile_rows = 1 << cm->log2_tile_rows;
|
||||
|
||||
cm->tile_width = (mi_cols_aligned_to_sb(cm->mi_cols) >> cm->log2_tile_cols);
|
||||
cm->tile_height = (mi_cols_aligned_to_sb(cm->mi_rows) >> cm->log2_tile_rows);
|
||||
// round to integer multiples of 8
|
||||
cm->tile_width = mi_cols_aligned_to_sb(cm->tile_width);
|
||||
cm->tile_height = mi_cols_aligned_to_sb(cm->tile_height);
|
||||
}
|
||||
|
||||
// Reads the next tile returning its size and adjusting '*data' accordingly
|
||||
@ -1953,8 +1962,8 @@ static const uint8_t *decode_tiles(VP9Decoder *pbi,
|
||||
VP9_COMMON *const cm = &pbi->common;
|
||||
const VP9WorkerInterface *const winterface = vp9_get_worker_interface();
|
||||
const int aligned_cols = mi_cols_aligned_to_sb(cm->mi_cols);
|
||||
const int tile_cols = 1 << cm->log2_tile_cols;
|
||||
const int tile_rows = 1 << cm->log2_tile_rows;
|
||||
const int tile_cols = cm->tile_cols;
|
||||
const int tile_rows = cm->tile_rows;
|
||||
#if CONFIG_ROW_TILE
|
||||
TileBuffer (*tile_buffers)[1024] = pbi->tile_buffers;
|
||||
#else
|
||||
@ -2037,10 +2046,15 @@ static const uint8_t *decode_tiles(VP9Decoder *pbi,
|
||||
|
||||
for (tile_row = 0; tile_row < tile_rows; ++tile_row) {
|
||||
TileInfo tile;
|
||||
#if !CONFIG_ROW_TILE
|
||||
vp9_tile_set_row(&tile, cm, tile_row);
|
||||
#endif
|
||||
for (tile_col = 0; tile_col < tile_cols; ++tile_col) {
|
||||
#if CONFIG_ROW_TILE
|
||||
vp9_tile_init(&tile, cm, tile_row, tile_col);
|
||||
#else
|
||||
vp9_tile_set_col(&tile, cm, tile_col);
|
||||
|
||||
#endif
|
||||
for (mi_row = tile.mi_row_start; mi_row < tile.mi_row_end;
|
||||
mi_row += MI_BLOCK_SIZE) {
|
||||
const int col = pbi->inv_tile_order ?
|
||||
@ -2141,8 +2155,8 @@ static const uint8_t *decode_tiles_mt(VP9Decoder *pbi,
|
||||
const VP9WorkerInterface *const winterface = vp9_get_worker_interface();
|
||||
const uint8_t *bit_reader_end = NULL;
|
||||
const int aligned_mi_cols = mi_cols_aligned_to_sb(cm->mi_cols);
|
||||
const int tile_cols = 1 << cm->log2_tile_cols;
|
||||
const int tile_rows = 1 << cm->log2_tile_rows;
|
||||
const int tile_cols = cm->tile_cols;
|
||||
const int tile_rows = cm->tile_rows;
|
||||
const int num_workers = MIN(pbi->max_threads & ~1, tile_cols);
|
||||
TileBuffer tile_buffers[1][1024];
|
||||
int n;
|
||||
@ -2791,8 +2805,8 @@ void vp9_decode_frame(VP9Decoder *pbi,
|
||||
uint8_t clear_data[MAX_VP9_HEADER_SIZE];
|
||||
const size_t first_partition_size = read_uncompressed_header(pbi,
|
||||
init_read_bit_buffer(pbi, &rb, data, data_end, clear_data));
|
||||
const int tile_rows = 1 << cm->log2_tile_rows;
|
||||
const int tile_cols = 1 << cm->log2_tile_cols;
|
||||
const int tile_rows = cm->tile_rows;
|
||||
const int tile_cols = cm->tile_cols;
|
||||
YV12_BUFFER_CONFIG *const new_fb = get_frame_new_buffer(cm);
|
||||
xd->cur_buf = new_fb;
|
||||
#if CONFIG_GLOBAL_MOTION
|
||||
|
@ -141,7 +141,7 @@ void vp9_loop_filter_frame_mt(YV12_BUFFER_CONFIG *frame,
|
||||
const VP9WorkerInterface *const winterface = vp9_get_worker_interface();
|
||||
// Number of superblock rows and cols
|
||||
const int sb_rows = mi_cols_aligned_to_sb(cm->mi_rows) >> MI_BLOCK_SIZE_LOG2;
|
||||
const int tile_cols = 1 << cm->log2_tile_cols;
|
||||
const int tile_cols = cm->tile_cols;
|
||||
const int num_workers = MIN(pbi->max_threads & ~1, tile_cols);
|
||||
int i;
|
||||
|
||||
|
@ -1926,8 +1926,8 @@ static size_t encode_tiles(VP9_COMP *cpi, uint8_t *data_ptr) {
|
||||
int tile_row, tile_col;
|
||||
TOKENEXTRA *tok[4][1 << 6], *tok_end;
|
||||
size_t total_size = 0;
|
||||
const int tile_cols = 1 << cm->log2_tile_cols;
|
||||
const int tile_rows = 1 << cm->log2_tile_rows;
|
||||
const int tile_cols = cm->tile_cols;
|
||||
const int tile_rows = cm->tile_rows;
|
||||
TileInfo tile[4][1 << 6];
|
||||
TOKENEXTRA *pre_tok = cpi->tok;
|
||||
int tile_tok = 0;
|
||||
|
@ -4532,8 +4532,8 @@ static int get_skip_encode_frame(const VP9_COMMON *cm) {
|
||||
|
||||
static void encode_tiles(VP9_COMP *cpi) {
|
||||
const VP9_COMMON *const cm = &cpi->common;
|
||||
const int tile_cols = 1 << cm->log2_tile_cols;
|
||||
const int tile_rows = 1 << cm->log2_tile_rows;
|
||||
const int tile_cols = cm->tile_cols;
|
||||
const int tile_rows = cm->tile_rows;
|
||||
|
||||
int tile_col, tile_row;
|
||||
#if CONFIG_ROW_TILE
|
||||
@ -4549,7 +4549,6 @@ static void encode_tiles(VP9_COMP *cpi) {
|
||||
for (tile_row = 0; tile_row < tile_rows; ++tile_row) {
|
||||
for (tile_col = 0; tile_col < tile_cols; ++tile_col) {
|
||||
vp9_tile_init(&tile[tile_row][tile_col], cm, tile_row, tile_col);
|
||||
|
||||
tok[tile_row][tile_col] = pre_tok + tile_tok;
|
||||
pre_tok = tok[tile_row][tile_col];
|
||||
tile_tok = allocated_tokens(tile[tile_row][tile_col]);
|
||||
|
@ -584,6 +584,15 @@ static void set_tile_limits(VP9_COMP *cpi) {
|
||||
#else
|
||||
cm->log2_tile_rows = cpi->oxcf.tile_rows;
|
||||
#endif
|
||||
|
||||
cm->tile_cols = 1 << cm->log2_tile_cols;
|
||||
cm->tile_rows = 1 << cm->log2_tile_rows;
|
||||
|
||||
cm->tile_width = (mi_cols_aligned_to_sb(cm->mi_cols) >> cm->log2_tile_cols);
|
||||
cm->tile_height = (mi_cols_aligned_to_sb(cm->mi_rows) >> cm->log2_tile_rows);
|
||||
// round to integer multiples of 8
|
||||
cm->tile_width = mi_cols_aligned_to_sb(cm->tile_width);
|
||||
cm->tile_height = mi_cols_aligned_to_sb(cm->tile_height);
|
||||
}
|
||||
|
||||
static void init_buffer_indices(VP9_COMP *cpi) {
|
||||
|
@ -222,7 +222,7 @@ void vp9_choose_segmap_coding_method(VP9_COMMON *cm, MACROBLOCKD *xd) {
|
||||
|
||||
// First of all generate stats regarding how well the last segment map
|
||||
// predicts this one
|
||||
for (tile_col = 0; tile_col < 1 << cm->log2_tile_cols; tile_col++) {
|
||||
for (tile_col = 0; tile_col < cm->tile_cols; tile_col++) {
|
||||
TileInfo tile;
|
||||
MODE_INFO *mi_ptr;
|
||||
vp9_tile_init(&tile, cm, 0, tile_col);
|
||||
|
Loading…
x
Reference in New Issue
Block a user