From ce3a8a6e379cae2ffc3551174e8b0f88d382ac18 Mon Sep 17 00:00:00 2001 From: Jingning Han Date: Tue, 30 Apr 2013 10:16:09 -0700 Subject: [PATCH] Migrating SPLITMV_4X4 decoding into decode_atom Separate the decoding process of 4x4 block based coding (both intra and inter) from decode_mb and move it into decode_atom_. This allows to further move the rest per 16x16 block decoding of decode_mb into decode_sb, and hence eventually deprecating decode_mb when SB8X8 is enabled. Change-Id: I678cb8007d8a57b792d7a23020edb0c74fbf4237 --- vp9/decoder/vp9_decodframe.c | 54 +++++++++++++++++++++++++++++++++++++------ vp9/encoder/vp9_encodeframe.c | 1 - 2 files changed, 47 insertions(+), 8 deletions(-) diff --git a/vp9/decoder/vp9_decodframe.c b/vp9/decoder/vp9_decodframe.c index 27eb4b1..0e9a371 100644 --- a/vp9/decoder/vp9_decodframe.c +++ b/vp9/decoder/vp9_decodframe.c @@ -442,6 +442,41 @@ static void decode_atom_intra(VP9D_COMP *pbi, MACROBLOCKD *xd, foreach_transformed_block_uv(xd, bsize, decode_block, xd); } +static void decode_atom(VP9D_COMP *pbi, MACROBLOCKD *xd, + int mi_row, int mi_col, + vp9_reader *r, BLOCK_SIZE_TYPE bsize) { + MB_MODE_INFO *const mbmi = &xd->mode_info_context->mbmi; + + if (pbi->common.frame_type != KEY_FRAME) + vp9_setup_interp_filters(xd, mbmi->interp_filter, &pbi->common); + + // prediction + if (mbmi->ref_frame == INTRA_FRAME) + vp9_build_intra_predictors_sbuv_s(xd, bsize); + else + vp9_build_inter_predictors_sb(xd, mi_row, mi_col, bsize); + + if (mbmi->mb_skip_coeff) { + vp9_reset_sb_tokens_context(xd, bsize); + } else { + // re-initialize macroblock dequantizer before detokenization + if (xd->segmentation_enabled) + mb_init_dequantizer(&pbi->common, xd); + + if (!vp9_reader_has_error(r)) { +#if CONFIG_NEWBINTRAMODES + if (mbmi->mode != I4X4_PRED) +#endif + vp9_decode_tokens(pbi, xd, r, bsize); + } + } + + if (mbmi->ref_frame == INTRA_FRAME) + decode_atom_intra(pbi, xd, r, bsize); + else + foreach_transformed_block(xd, bsize, decode_block, xd); +} + static void decode_sb(VP9D_COMP *pbi, MACROBLOCKD *xd, int mi_row, int mi_col, vp9_reader *r, BLOCK_SIZE_TYPE bsize) { const int bwl = mi_width_log2(bsize), bhl = mi_height_log2(bsize); @@ -550,12 +585,7 @@ static void decode_mb(VP9D_COMP *pbi, MACROBLOCKD *xd, } else if (tx_size == TX_8X8) { decode_8x8(xd); } else { - if (mbmi->mode == I4X4_PRED) - // TODO(jingning): we need to move this to decode_atom later and - // deprecate decode_mb, when SB8X8 is on. - decode_atom_intra(pbi, xd, r, BLOCK_SIZE_MB16X16); - else - decode_4x4(pbi, xd, r); + decode_4x4(pbi, xd, r); } } @@ -684,7 +714,17 @@ static void decode_modes_b(VP9D_COMP *pbi, int mi_row, int mi_col, if (bsize > BLOCK_SIZE_MB16X16) { decode_sb(pbi, xd, mi_row, mi_col, r, bsize); } else { - decode_mb(pbi, xd, mi_row, mi_col, r); + // TODO(jingning): In transition of separating functionalities of decode_mb + // into decode_sb and decode_atom. Will remove decode_mb and clean this up + // when SB8X8 is on. + if (xd->mode_info_context->mbmi.mode == I4X4_PRED || + (xd->mode_info_context->mbmi.mode == SPLITMV && + xd->mode_info_context->mbmi.partitioning == PARTITIONING_4X4)) + decode_atom(pbi, xd, mi_row, mi_col, r, bsize); + else + // TODO(jingning): decode_mb still carries deocding process of I8X8_PRED + // and SPLITMV of 8x8, 16x8, and 8x16. To be migrated into decode_sb. + decode_mb(pbi, xd, mi_row, mi_col, r); } xd->corrupted |= vp9_reader_has_error(r); diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index d40c604..52065df 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -2103,7 +2103,6 @@ static void encode_macroblock(VP9_COMP *cpi, TOKENEXTRA **t, #if CONFIG_SB8X8 int y, x; #endif - if (mbmi->mode != I4X4_PRED && mbmi->mode != I8X8_PRED && mbmi->mode != SPLITMV && cpi->common.txfm_mode >= ALLOW_16X16) { mbmi->txfm_size = TX_16X16; -- 2.7.4