enable interleaved decoding of mode and mv

Previouly, the decoding of mode and motion vector are done a per frame
basis followed by residue decoding and reconstuction. The commit added
the option to allow decoder to interleave the decoding of mode and mvs
with the residue decoding on a per MB basis.

Change-Id: Ia5316f4a7af9ba7f155c92b5a6fc97201b653571
This commit is contained in:
Yaowu Xu 2012-08-03 12:31:38 -07:00
parent 236597fd56
commit 2e73f901d5
4 changed files with 37 additions and 8 deletions

View File

@ -596,6 +596,7 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
// Make sure the MACROBLOCKD mode info pointer is pointed at the
// correct entry for the current macroblock.
xd->mode_info_context = mi;
xd->prev_mode_info_context = prev_mi;
// Read the macroblock segment id.
read_mb_segment_id(pbi, mb_row, mb_col);
@ -996,8 +997,6 @@ void vp8_decode_mode_mvs(VP8D_COMP *pbi) {
for (sb_col = 0; sb_col < sb_cols; sb_col++) {
for (i = 0; i < 4; i++) {
int mb_to_top_edge;
int mb_to_bottom_edge;
int dy = row_delta[i];
int dx = col_delta[i];
@ -1016,13 +1015,9 @@ void vp8_decode_mode_mvs(VP8D_COMP *pbi) {
xd->mode_info_context = mi;
xd->prev_mode_info_context = prev_mi;
pbi->mb.mb_to_top_edge = mb_to_top_edge = -((mb_row * 16)) << 3;
mb_to_top_edge -= LEFT_TOP_MARGIN;
pbi->mb.mb_to_top_edge = -((mb_row * 16)) << 3;
pbi->mb.mb_to_bottom_edge =
mb_to_bottom_edge =
((pbi->common.mb_rows - 1 - mb_row) * 16) << 3;
mb_to_bottom_edge += RIGHT_BOTTOM_MARGIN;
if (cm->frame_type == KEY_FRAME)
vp8_kfread_modes(pbi, mi, mb_row, mb_col);
@ -1042,3 +1037,22 @@ void vp8_decode_mode_mvs(VP8D_COMP *pbi) {
prev_mi += cm->mode_info_stride + (1 - (cm->mb_cols & 0x1));
}
}
void vpx_decode_mode_mvs_init(VP8D_COMP *pbi){
VP8_COMMON *cm = &pbi->common;
mb_mode_mv_init(pbi);
if (cm->frame_type == KEY_FRAME &&!cm->kf_ymode_probs_update)
cm->kf_ymode_probs_index = vp8_read_literal(&pbi->bc, 3);
}
void vpx_decode_mb_mode_mv(VP8D_COMP *pbi,
MACROBLOCKD *xd,
int mb_row,
int mb_col){
MODE_INFO *mi = xd->mode_info_context;
MODE_INFO *prev_mi = xd->prev_mode_info_context;
if (pbi->common.frame_type == KEY_FRAME)
vp8_kfread_modes(pbi, mi, mb_row, mb_col);
else
read_mb_modes_mv(pbi, mi, &mi->mbmi, prev_mi, mb_row, mb_col);
}

View File

@ -623,6 +623,7 @@ decode_sb_row(VP8D_COMP *pbi, VP8_COMMON *pc, int mbrow, MACROBLOCKD *xd) {
mb_row += dy;
mb_col += dx;
xd->mode_info_context += offset_extended;
xd->prev_mode_info_context += offset_extended;
continue;
}
@ -650,6 +651,9 @@ decode_sb_row(VP8D_COMP *pbi, VP8_COMMON *pc, int mbrow, MACROBLOCKD *xd) {
xd->up_available = (mb_row != 0);
xd->left_available = (mb_col != 0);
if(pbi->interleaved_decoding)
vpx_decode_mb_mode_mv(pbi, xd, mb_row, mb_col);
update_blockd_bmi(xd);
recon_yoffset = (mb_row * recon_y_stride * 16) + (mb_col * 16);
@ -708,6 +712,7 @@ decode_sb_row(VP8D_COMP *pbi, VP8_COMMON *pc, int mbrow, MACROBLOCKD *xd) {
// skip to next MB
xd->mode_info_context += offset_extended;
xd->prev_mode_info_context += offset_extended;
mb_row += dy;
mb_col += dx;
}
@ -715,6 +720,7 @@ decode_sb_row(VP8D_COMP *pbi, VP8_COMMON *pc, int mbrow, MACROBLOCKD *xd) {
/* skip prediction column */
xd->mode_info_context += 1 - (pc->mb_cols & 0x1) + xd->mode_info_stride;
xd->prev_mode_info_context += 1 - (pc->mb_cols & 0x1) + xd->mode_info_stride;
}
static unsigned int read_partition_size(const unsigned char *cx_size) {
@ -823,6 +829,7 @@ static void init_frame(VP8D_COMP *pbi) {
xd->left_context = &pc->left_context;
xd->mode_info_context = pc->mi;
xd->prev_mode_info_context = pc->prev_mi;
xd->frame_type = pc->frame_type;
xd->mode_info_context->mbmi.mode = DC_PRED;
xd->mode_info_stride = pc->mode_info_stride;
@ -1404,12 +1411,16 @@ int vp8_decode_frame(VP8D_COMP *pbi) {
/* Read the mb_no_coeff_skip flag */
pc->mb_no_coeff_skip = (int)vp8_read_bit(bc);
vp8_decode_mode_mvs(pbi);
if(pbi->interleaved_decoding)
vpx_decode_mode_mvs_init(pbi);
else
vp8_decode_mode_mvs(pbi);
vpx_memset(pc->above_context, 0, sizeof(ENTROPY_CONTEXT_PLANES) * pc->mb_cols);
// Resset the macroblock mode info context to the start of the list
xd->mode_info_context = pc->mi;
xd->prev_mode_info_context = pc->prev_mi;
/* Decode a row of superblocks */
for (mb_row = 0; mb_row < pc->mb_rows; mb_row += 2) {

View File

@ -149,6 +149,8 @@ VP8D_PTR vp8dx_create_decompressor(VP8D_CONFIG *oxcf) {
pbi->decoded_key_frame = 0;
pbi->interleaved_decoding = 1;
return (VP8D_PTR) pbi;
}

View File

@ -91,6 +91,8 @@ typedef struct VP8Decompressor {
int decoded_key_frame;
int interleaved_decoding;
} VP8D_COMP;
int vp8_decode_frame(VP8D_COMP *cpi);