Allow vpxdec to produce target tile reconstruction

This commit allows the vpxdec to produce the target tile
reconstruction as its output. When the provided tile index is -1,
the entire corresponding row/column tiles will be reconstructed.
If the tile index is over the upper limit, the decoder will decode
left-most/bottom tile.

Change-Id: I4c18bdb32099f736f99b8842f7f177a32b3fee09
This commit is contained in:
Jingning Han 2015-05-28 23:16:35 -07:00
parent 89747d09cc
commit f5660af165
2 changed files with 32 additions and 0 deletions

View File

@ -329,6 +329,33 @@ static vpx_codec_err_t decode_one(vpx_codec_alg_priv_t *ctx,
return update_error_state(ctx, &cm->error); return update_error_state(ctx, &cm->error);
yuvconfig2image(&ctx->img, &sd, user_priv); yuvconfig2image(&ctx->img, &sd, user_priv);
#if CONFIG_ROW_TILE
if (ctx->pbi->dec_tile_row >= 0) {
VP9_COMMON *cm = &ctx->pbi->common;
int tile_row = MIN(ctx->pbi->dec_tile_row, cm->tile_rows - 1);
int plane;
ctx->img.planes[0] += tile_row * cm->tile_height * 8 * ctx->img.stride[0];
for (plane = 1; plane < MAX_MB_PLANE; ++plane)
ctx->img.planes[plane] += tile_row * (8 >> ctx->img.y_chroma_shift) *
cm->tile_height * ctx->img.stride[plane];
ctx->img.d_h = MIN(cm->tile_height * 8,
(cm->mi_rows - tile_row * cm->tile_height) * 8);
}
if (ctx->pbi->dec_tile_col >= 0) {
VP9_COMMON *cm = &ctx->pbi->common;
int tile_col = MIN(ctx->pbi->dec_tile_col, cm->tile_cols - 1);
int plane;
ctx->img.planes[0] += tile_col * cm->tile_width * 8;
for (plane = 1; plane < MAX_MB_PLANE; ++plane)
ctx->img.planes[plane] += tile_col * cm->tile_width *
(8 >> ctx->img.x_chroma_shift);
ctx->img.d_w = MIN(cm->tile_width * 8,
(cm->mi_cols - tile_col * cm->tile_width) * 8);
}
#endif
ctx->img.fb_priv = cm->frame_bufs[cm->new_fb_idx].raw_frame_buffer.priv; ctx->img.fb_priv = cm->frame_bufs[cm->new_fb_idx].raw_frame_buffer.priv;
ctx->img_avail = 1; ctx->img_avail = 1;

View File

@ -1014,6 +1014,11 @@ int main_loop(int argc, const char **argv_) {
} }
#endif #endif
#if CONFIG_ROW_TILE && CONFIG_KEY_FRAME_TILE
vpx_input_ctx.width = img->d_w;
vpx_input_ctx.height = img->d_h;
#endif
if (single_file) { if (single_file) {
if (use_y4m) { if (use_y4m) {
char buf[Y4M_BUFFER_SIZE] = {0}; char buf[Y4M_BUFFER_SIZE] = {0};