Commit fcbb884e authored by Yaowu Xu's avatar Yaowu Xu Committed by Gerrit Code Review
Browse files

Merge "enable interleaved decoding of mode and mv" into experimental

parents 0b693c77 2e73f901
...@@ -588,6 +588,7 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi, ...@@ -588,6 +588,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 // Make sure the MACROBLOCKD mode info pointer is pointed at the
// correct entry for the current macroblock. // correct entry for the current macroblock.
xd->mode_info_context = mi; xd->mode_info_context = mi;
xd->prev_mode_info_context = prev_mi;
// Read the macroblock segment id. // Read the macroblock segment id.
read_mb_segment_id(pbi, mb_row, mb_col); read_mb_segment_id(pbi, mb_row, mb_col);
...@@ -976,8 +977,6 @@ void vp8_decode_mode_mvs(VP8D_COMP *pbi) { ...@@ -976,8 +977,6 @@ void vp8_decode_mode_mvs(VP8D_COMP *pbi) {
for (sb_col = 0; sb_col < sb_cols; sb_col++) { for (sb_col = 0; sb_col < sb_cols; sb_col++) {
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
int mb_to_top_edge;
int mb_to_bottom_edge;
int dy = row_delta[i]; int dy = row_delta[i];
int dx = col_delta[i]; int dx = col_delta[i];
...@@ -996,13 +995,9 @@ void vp8_decode_mode_mvs(VP8D_COMP *pbi) { ...@@ -996,13 +995,9 @@ void vp8_decode_mode_mvs(VP8D_COMP *pbi) {
xd->mode_info_context = mi; xd->mode_info_context = mi;
xd->prev_mode_info_context = prev_mi; xd->prev_mode_info_context = prev_mi;
pbi->mb.mb_to_top_edge = mb_to_top_edge = -((mb_row * 16)) << 3; pbi->mb.mb_to_top_edge = -((mb_row * 16)) << 3;
mb_to_top_edge -= LEFT_TOP_MARGIN;
pbi->mb.mb_to_bottom_edge = pbi->mb.mb_to_bottom_edge =
mb_to_bottom_edge =
((pbi->common.mb_rows - 1 - mb_row) * 16) << 3; ((pbi->common.mb_rows - 1 - mb_row) * 16) << 3;
mb_to_bottom_edge += RIGHT_BOTTOM_MARGIN;
if (cm->frame_type == KEY_FRAME) if (cm->frame_type == KEY_FRAME)
vp8_kfread_modes(pbi, mi, mb_row, mb_col); vp8_kfread_modes(pbi, mi, mb_row, mb_col);
...@@ -1022,3 +1017,22 @@ void vp8_decode_mode_mvs(VP8D_COMP *pbi) { ...@@ -1022,3 +1017,22 @@ void vp8_decode_mode_mvs(VP8D_COMP *pbi) {
prev_mi += cm->mode_info_stride + (1 - (cm->mb_cols & 0x1)); 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);
}
...@@ -604,6 +604,7 @@ decode_sb_row(VP8D_COMP *pbi, VP8_COMMON *pc, int mbrow, MACROBLOCKD *xd) { ...@@ -604,6 +604,7 @@ decode_sb_row(VP8D_COMP *pbi, VP8_COMMON *pc, int mbrow, MACROBLOCKD *xd) {
mb_row += dy; mb_row += dy;
mb_col += dx; mb_col += dx;
xd->mode_info_context += offset_extended; xd->mode_info_context += offset_extended;
xd->prev_mode_info_context += offset_extended;
continue; continue;
} }
...@@ -631,6 +632,9 @@ decode_sb_row(VP8D_COMP *pbi, VP8_COMMON *pc, int mbrow, MACROBLOCKD *xd) { ...@@ -631,6 +632,9 @@ decode_sb_row(VP8D_COMP *pbi, VP8_COMMON *pc, int mbrow, MACROBLOCKD *xd) {
xd->up_available = (mb_row != 0); xd->up_available = (mb_row != 0);
xd->left_available = (mb_col != 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); update_blockd_bmi(xd);
recon_yoffset = (mb_row * recon_y_stride * 16) + (mb_col * 16); recon_yoffset = (mb_row * recon_y_stride * 16) + (mb_col * 16);
...@@ -689,6 +693,7 @@ decode_sb_row(VP8D_COMP *pbi, VP8_COMMON *pc, int mbrow, MACROBLOCKD *xd) { ...@@ -689,6 +693,7 @@ decode_sb_row(VP8D_COMP *pbi, VP8_COMMON *pc, int mbrow, MACROBLOCKD *xd) {
// skip to next MB // skip to next MB
xd->mode_info_context += offset_extended; xd->mode_info_context += offset_extended;
xd->prev_mode_info_context += offset_extended;
mb_row += dy; mb_row += dy;
mb_col += dx; mb_col += dx;
} }
...@@ -696,6 +701,7 @@ decode_sb_row(VP8D_COMP *pbi, VP8_COMMON *pc, int mbrow, MACROBLOCKD *xd) { ...@@ -696,6 +701,7 @@ decode_sb_row(VP8D_COMP *pbi, VP8_COMMON *pc, int mbrow, MACROBLOCKD *xd) {
/* skip prediction column */ /* skip prediction column */
xd->mode_info_context += 1 - (pc->mb_cols & 0x1) + xd->mode_info_stride; 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) { static unsigned int read_partition_size(const unsigned char *cx_size) {
...@@ -802,6 +808,7 @@ static void init_frame(VP8D_COMP *pbi) { ...@@ -802,6 +808,7 @@ static void init_frame(VP8D_COMP *pbi) {
xd->left_context = &pc->left_context; xd->left_context = &pc->left_context;
xd->mode_info_context = pc->mi; xd->mode_info_context = pc->mi;
xd->prev_mode_info_context = pc->prev_mi;
xd->frame_type = pc->frame_type; xd->frame_type = pc->frame_type;
xd->mode_info_context->mbmi.mode = DC_PRED; xd->mode_info_context->mbmi.mode = DC_PRED;
xd->mode_info_stride = pc->mode_info_stride; xd->mode_info_stride = pc->mode_info_stride;
...@@ -1332,12 +1339,16 @@ int vp8_decode_frame(VP8D_COMP *pbi) { ...@@ -1332,12 +1339,16 @@ int vp8_decode_frame(VP8D_COMP *pbi) {
/* Read the mb_no_coeff_skip flag */ /* Read the mb_no_coeff_skip flag */
pc->mb_no_coeff_skip = (int)vp8_read_bit(bc); 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); 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 // Resset the macroblock mode info context to the start of the list
xd->mode_info_context = pc->mi; xd->mode_info_context = pc->mi;
xd->prev_mode_info_context = pc->prev_mi;
/* Decode a row of superblocks */ /* Decode a row of superblocks */
for (mb_row = 0; mb_row < pc->mb_rows; mb_row += 2) { for (mb_row = 0; mb_row < pc->mb_rows; mb_row += 2) {
......
...@@ -149,6 +149,8 @@ VP8D_PTR vp8dx_create_decompressor(VP8D_CONFIG *oxcf) { ...@@ -149,6 +149,8 @@ VP8D_PTR vp8dx_create_decompressor(VP8D_CONFIG *oxcf) {
pbi->decoded_key_frame = 0; pbi->decoded_key_frame = 0;
pbi->interleaved_decoding = 1;
return (VP8D_PTR) pbi; return (VP8D_PTR) pbi;
} }
......
...@@ -91,6 +91,8 @@ typedef struct VP8Decompressor { ...@@ -91,6 +91,8 @@ typedef struct VP8Decompressor {
int decoded_key_frame; int decoded_key_frame;
int interleaved_decoding;
} VP8D_COMP; } VP8D_COMP;
int vp8_decode_frame(VP8D_COMP *cpi); int vp8_decode_frame(VP8D_COMP *cpi);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment