From 8e3099aa2b89868fce84b023784ee93e8175714e Mon Sep 17 00:00:00 2001 From: Jingning Han Date: Tue, 19 May 2015 17:17:28 -0700 Subject: [PATCH] Support up to 64 row tile coding This commit allows the codec to use up to row tiles (optionally in combination with up to 64 column tiles per row tile). The minimum tile size is set to be 256x256 pixel block. Change-Id: I811ca93f0c5eba41e190f6c7c0f064d1083f530f --- vp9/decoder/vp9_decodeframe.c | 11 ++++++++++- vp9/encoder/vp9_encodeframe.c | 5 +++++ vp9/encoder/vp9_encoder.c | 12 +++++++++--- vp9/vp9_cx_iface.c | 2 +- 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/vp9/decoder/vp9_decodeframe.c b/vp9/decoder/vp9_decodeframe.c index b887031bf..468a0536a 100644 --- a/vp9/decoder/vp9_decodeframe.c +++ b/vp9/decoder/vp9_decodeframe.c @@ -1885,7 +1885,7 @@ static void setup_tile_info(VP9_COMMON *cm, struct vp9_read_bit_buffer *rb) { if (cm->log2_tile_rows > 10) vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME, - "Invalid number of tile columns"); + "Invalid number of tile rows"); #else cm->log2_tile_rows = vp9_rb_read_bit(rb); if (cm->log2_tile_rows) @@ -1961,7 +1961,11 @@ static const uint8_t *decode_tiles(VP9Decoder *pbi, 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; +#if CONFIG_ROW_TILE + TileBuffer tile_buffers[64][64]; +#else TileBuffer tile_buffers[4][1 << 6]; +#endif int tile_row, tile_col; int mi_row, mi_col; TileData *tile_data = NULL; @@ -1988,8 +1992,13 @@ static const uint8_t *decode_tiles(VP9Decoder *pbi, vp9_loop_filter_frame_init(cm, cm->lf.filter_level); } +#if CONFIG_ROW_TILE + assert(tile_rows <= (1 << 6)); + assert(tile_cols <= (1 << 6)); +#else assert(tile_rows <= 4); assert(tile_cols <= (1 << 6)); +#endif // Note: this memset assumes above_context[0], [1] and [2] // are allocated as part of the same buffer. diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index d93209348..0bf8167ca 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -4536,8 +4536,13 @@ static void encode_tiles(VP9_COMP *cpi) { const int tile_rows = 1 << cm->log2_tile_rows; int tile_col, tile_row; +#if CONFIG_ROW_TILE + TileInfo tile[64][64]; + TOKENEXTRA *tok[64][64]; +#else TileInfo tile[4][1 << 6]; TOKENEXTRA *tok[4][1 << 6]; +#endif TOKENEXTRA *pre_tok = cpi->tok; int tile_tok = 0; diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c index 990101dec..521c370f6 100644 --- a/vp9/encoder/vp9_encoder.c +++ b/vp9/encoder/vp9_encoder.c @@ -572,12 +572,18 @@ void vp9_new_framerate(VP9_COMP *cpi, double framerate) { static void set_tile_limits(VP9_COMP *cpi) { VP9_COMMON *const cm = &cpi->common; - int min_log2_tile_cols, max_log2_tile_cols; - vp9_get_tile_n_bits(cm->mi_cols, &min_log2_tile_cols, &max_log2_tile_cols); + int min_log2_tiles, max_log2_tiles; + vp9_get_tile_n_bits(cm->mi_cols, &min_log2_tiles, &max_log2_tiles); cm->log2_tile_cols = clamp(cpi->oxcf.tile_columns, - min_log2_tile_cols, max_log2_tile_cols); + min_log2_tiles, max_log2_tiles); +#if CONFIG_ROW_TILE + vp9_get_tile_n_bits(cm->mi_rows, &min_log2_tiles, &max_log2_tiles); + cm->log2_tile_rows = clamp(cpi->oxcf.tile_rows, + min_log2_tiles, max_log2_tiles); +#else cm->log2_tile_rows = cpi->oxcf.tile_rows; +#endif } static void init_buffer_indices(VP9_COMP *cpi) { diff --git a/vp9/vp9_cx_iface.c b/vp9/vp9_cx_iface.c index c29ad81b4..b6f071e15 100644 --- a/vp9/vp9_cx_iface.c +++ b/vp9/vp9_cx_iface.c @@ -208,7 +208,7 @@ static vpx_codec_err_t validate_config(vpx_codec_alg_priv_t *ctx, RANGE_CHECK(extra_cfg, cpu_used, -16, 16); RANGE_CHECK_HI(extra_cfg, noise_sensitivity, 6); RANGE_CHECK(extra_cfg, tile_columns, 0, 6); - RANGE_CHECK(extra_cfg, tile_rows, 0, 2); + RANGE_CHECK(extra_cfg, tile_rows, 0, 6); RANGE_CHECK_HI(extra_cfg, sharpness, 7); RANGE_CHECK(extra_cfg, arnr_max_frames, 0, 15); RANGE_CHECK_HI(extra_cfg, arnr_strength, 6);