Configure selective tile decoding

Add decoder control to extract single tile from key frame.

Change-Id: Id018bf267d748bfd96a6261055de4194f632190c
This commit is contained in:
Jingning Han 2015-05-26 17:09:34 -07:00
parent f7a39d7f08
commit f00bf10de0
4 changed files with 39 additions and 0 deletions

View File

@ -68,6 +68,7 @@ typedef struct VP9Decoder {
#if CONFIG_ROW_TILE #if CONFIG_ROW_TILE
TileBuffer tile_buffers[1024][1024]; TileBuffer tile_buffers[1024][1024];
int dec_tile_row, dec_tile_col;
#endif #endif
} VP9Decoder; } VP9Decoder;

View File

@ -309,6 +309,16 @@ static vpx_codec_err_t decode_one(vpx_codec_alg_priv_t *ctx,
cm = &ctx->pbi->common; cm = &ctx->pbi->common;
#if CONFIG_ROW_TILE
#if CONFIG_KEY_FRAME_TILE
ctx->pbi->dec_tile_row = ctx->cfg.tile_row;
ctx->pbi->dec_tile_col = ctx->cfg.tile_col;
#else
ctx->pbi->dec_tile_row = -1;
ctx->pbi->dec_tile_col = -1;
#endif
#endif
if (vp9_receive_compressed_data(ctx->pbi, data_sz, data)) if (vp9_receive_compressed_data(ctx->pbi, data_sz, data))
return update_error_state(ctx, &cm->error); return update_error_state(ctx, &cm->error);

View File

@ -108,6 +108,10 @@ extern "C" {
unsigned int threads; /**< Maximum number of threads to use, default 1 */ unsigned int threads; /**< Maximum number of threads to use, default 1 */
unsigned int w; /**< Width */ unsigned int w; /**< Width */
unsigned int h; /**< Height */ unsigned int h; /**< Height */
int tile_row; /**< The index of row tile to be decoded.
Value -1 means to decode all row tiles. */
int tile_col; /**< The index of column tile to be decoded.
Value -1 means to decode all column tiles */
} vpx_codec_dec_cfg_t; /**< alias for struct vpx_codec_dec_cfg */ } vpx_codec_dec_cfg_t; /**< alias for struct vpx_codec_dec_cfg */

View File

@ -91,6 +91,12 @@ static const arg_def_t md5arg = ARG_DEF(
static const arg_def_t outbitdeptharg = ARG_DEF( static const arg_def_t outbitdeptharg = ARG_DEF(
NULL, "output-bit-depth", 1, "Output bit-depth for decoded frames"); NULL, "output-bit-depth", 1, "Output bit-depth for decoded frames");
#endif #endif
#if CONFIG_ROW_TILE && CONFIG_KEY_FRAME_TILE
static const arg_def_t tiler = ARG_DEF(
NULL, "tile-row", 1, "Row tile index");
static const arg_def_t tilec = ARG_DEF(
NULL, "tile-column", 1, "Column tile index");
#endif
static const arg_def_t *all_args[] = { static const arg_def_t *all_args[] = {
&codecarg, &use_yv12, &use_i420, &flipuvarg, &rawvideo, &noblitarg, &codecarg, &use_yv12, &use_i420, &flipuvarg, &rawvideo, &noblitarg,
@ -99,6 +105,9 @@ static const arg_def_t *all_args[] = {
&md5arg, &error_concealment, &continuearg, &md5arg, &error_concealment, &continuearg,
#if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
&outbitdeptharg, &outbitdeptharg,
#endif
#if CONFIG_ROW_TILE && CONFIG_KEY_FRAME_TILE
&tiler, &tilec,
#endif #endif
NULL NULL
}; };
@ -561,6 +570,10 @@ int main_loop(int argc, const char **argv_) {
#if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
int output_bit_depth = 0; int output_bit_depth = 0;
#endif #endif
#if CONFIG_ROW_TILE && CONFIG_KEY_FRAME_TILE
int tile_row = -1;
int tile_col = -1;
#endif
#if CONFIG_VP8_DECODER #if CONFIG_VP8_DECODER
vp8_postproc_cfg_t vp8_pp_cfg = {0}; vp8_postproc_cfg_t vp8_pp_cfg = {0};
int vp8_dbg_color_ref_frame = 0; int vp8_dbg_color_ref_frame = 0;
@ -655,6 +668,12 @@ int main_loop(int argc, const char **argv_) {
output_bit_depth = arg_parse_uint(&arg); output_bit_depth = arg_parse_uint(&arg);
} }
#endif #endif
#if CONFIG_ROW_TILE && CONFIG_KEY_FRAME_TILE
else if (arg_match(&arg, &tiler, argi))
tile_row = arg_parse_uint(&arg);
else if (arg_match(&arg, &tilec, argi))
tile_col = arg_parse_uint(&arg);
#endif
#if CONFIG_VP8_DECODER #if CONFIG_VP8_DECODER
else if (arg_match(&arg, &addnoise_level, argi)) { else if (arg_match(&arg, &addnoise_level, argi)) {
postproc = 1; postproc = 1;
@ -793,6 +812,11 @@ int main_loop(int argc, const char **argv_) {
if (!interface) if (!interface)
interface = get_vpx_decoder_by_index(0); interface = get_vpx_decoder_by_index(0);
#if CONFIG_ROW_TILE && CONFIG_KEY_FRAME_TILE
cfg.tile_row = tile_row;
cfg.tile_col = tile_col;
#endif
dec_flags = (postproc ? VPX_CODEC_USE_POSTPROC : 0) | dec_flags = (postproc ? VPX_CODEC_USE_POSTPROC : 0) |
(ec_enabled ? VPX_CODEC_USE_ERROR_CONCEALMENT : 0); (ec_enabled ? VPX_CODEC_USE_ERROR_CONCEALMENT : 0);
if (vpx_codec_dec_init(&decoder, interface->codec_interface(), if (vpx_codec_dec_init(&decoder, interface->codec_interface(),