diff options
author | Emeric Grange <emeric.grange@gmail.com> | 2012-01-28 01:43:47 +0100 |
---|---|---|
committer | Emeric Grange <emeric.grange@gmail.com> | 2012-06-24 16:57:33 +0200 |
commit | 3a42e334d884678c4a467ed89063b70939e2b5c1 (patch) | |
tree | 316a54ff5c0c2467a1621bafb55bca3b10a255d6 | |
parent | aed02ffe77dbc4ab05b2e63a26939b071ff0206c (diff) |
g3dvl: vp8 move around some code
Signed-off-by: Emeric Grange <emeric.grange@gmail.com>
-rw-r--r-- | src/gallium/auxiliary/vl/vl_vp8_decoder.c | 5 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vl_vp8_decoder.h | 1 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vp8/decodeframe.c | 193 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vp8/decodemv.c | 196 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vp8/findnearmv.c | 43 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vp8/findnearmv.h | 141 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vp8/vp8_decoder.c | 35 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vp8/vp8_decoder.h | 66 |
8 files changed, 330 insertions, 350 deletions
diff --git a/src/gallium/auxiliary/vl/vl_vp8_decoder.c b/src/gallium/auxiliary/vl/vl_vp8_decoder.c index c6461bfeea..46ddb92da0 100644 --- a/src/gallium/auxiliary/vl/vl_vp8_decoder.c +++ b/src/gallium/auxiliary/vl/vl_vp8_decoder.c @@ -234,7 +234,7 @@ vl_vp8_decode_bitstream(struct pipe_video_decoder *decoder, // Start bitstream decoding //vl_vp8_bs_decode(&buf->bs, target, desc, num_buffers, buffers, sizes); - if (vp8_decoder_start(dec->vp8_dec, desc, (const uint8_t *)buffers[dec->current_buffer], sizes[dec->current_buffer], 0)) + if (vp8_decoder_start(dec->vp8_dec, desc, (const uint8_t *)buffers[dec->current_buffer], sizes[dec->current_buffer])) { printf("[G3DVL] Error : decoding error, not a valid VP8 VDPAU frame !\n"); dec->img_ready = 0; @@ -269,7 +269,6 @@ vl_vp8_end_frame(struct pipe_video_decoder *decoder, struct pipe_sampler_view **sampler_views; struct pipe_context *pipe; - int64_t timestamp = 0, timestamp_end = 0; assert(dec && target && picture); @@ -334,7 +333,7 @@ vl_vp8_end_frame(struct pipe_video_decoder *decoder, } // Get the decoded frame - if (vp8_decoder_getframe(dec->vp8_dec, &dec->img_yv12, ×tamp, ×tamp_end)) { + if (vp8_decoder_getframe(dec->vp8_dec, &dec->img_yv12)) { printf("[end_frame] No image to output !\n"); return; } diff --git a/src/gallium/auxiliary/vl/vl_vp8_decoder.h b/src/gallium/auxiliary/vl/vl_vp8_decoder.h index 8d87ecf53a..6ba4044103 100644 --- a/src/gallium/auxiliary/vl/vl_vp8_decoder.h +++ b/src/gallium/auxiliary/vl/vl_vp8_decoder.h @@ -67,6 +67,7 @@ struct vl_vp8_decoder struct pipe_video_buffer *idct_source; struct pipe_video_buffer *mc_source; + struct pipe_video_buffer *lf_source; struct vl_zscan zscan_y, zscan_c; struct vl_idct idct_y, idct_c; diff --git a/src/gallium/auxiliary/vl/vp8/decodeframe.c b/src/gallium/auxiliary/vl/vp8/decodeframe.c index b46aff9789..31ac246d43 100644 --- a/src/gallium/auxiliary/vl/vp8/decodeframe.c +++ b/src/gallium/auxiliary/vl/vp8/decodeframe.c @@ -27,25 +27,25 @@ #include <assert.h> #include <stdio.h> -void mb_init_dequantizer(VP8D_COMP *pbi, MACROBLOCKD *xd) +void mb_init_dequantizer(VP8D_COMP *pbi, MACROBLOCKD *mb) { int i; int QIndex; - MB_MODE_INFO *mbmi = &xd->mode_info_context->mbmi; + MB_MODE_INFO *mbmi = &mb->mode_info_context->mbmi; VP8_COMMON *const pc = &pbi->common; /* Decide whether to use the default or alternate baseline Q value. */ - if (xd->segmentation_enabled) + if (mb->segmentation_enabled) { - if (xd->mb_segement_abs_delta == SEGMENT_ABSDATA) + if (mb->mb_segement_abs_delta == SEGMENT_ABSDATA) { /* Abs Value */ - QIndex = xd->segment_feature_data[MB_LVL_ALT_Q][mbmi->segment_id]; + QIndex = mb->segment_feature_data[MB_LVL_ALT_Q][mbmi->segment_id]; } else { /* Delta Value */ - QIndex = pc->base_qindex + xd->segment_feature_data[MB_LVL_ALT_Q][mbmi->segment_id]; + QIndex = pc->base_qindex + mb->segment_feature_data[MB_LVL_ALT_Q][mbmi->segment_id]; QIndex = (QIndex >= 0) ? ((QIndex <= MAXQ) ? QIndex : MAXQ) : 0; /* Clamp to valid range */ } } @@ -57,15 +57,15 @@ void mb_init_dequantizer(VP8D_COMP *pbi, MACROBLOCKD *xd) /* Set up the block level dequant pointers */ for (i = 0; i < 16; i++) { - xd->block[i].dequant = pc->Y1dequant[QIndex]; + mb->block[i].dequant = pc->Y1dequant[QIndex]; } for (i = 16; i < 24; i++) { - xd->block[i].dequant = pc->UVdequant[QIndex]; + mb->block[i].dequant = pc->UVdequant[QIndex]; } - xd->block[24].dequant = pc->Y2dequant[QIndex]; + mb->block[24].dequant = pc->Y2dequant[QIndex]; } /** @@ -73,18 +73,18 @@ void mb_init_dequantizer(VP8D_COMP *pbi, MACROBLOCKD *xd) * buffer and then copying it to dst buffer, we can write the result directly * to dst buffer. This eliminates unnecessary copy. */ -static void skip_recon_mb(VP8D_COMP *pbi, MACROBLOCKD *xd) +static void skip_recon_mb(VP8D_COMP *pbi, MACROBLOCKD *mb) { - if (xd->mode_info_context->mbmi.ref_frame == INTRA_FRAME) + if (mb->mode_info_context->mbmi.ref_frame == INTRA_FRAME) { - RECON_INVOKE(&pbi->common.rtcd.recon, build_intra_predictors_mbuv_s)(xd); - RECON_INVOKE(&pbi->common.rtcd.recon, build_intra_predictors_mby_s)(xd); + RECON_INVOKE(&pbi->common.rtcd.recon, build_intra_predictors_mbuv_s)(mb); + RECON_INVOKE(&pbi->common.rtcd.recon, build_intra_predictors_mby_s)(mb); } else { - vp8_build_inter16x16_predictors_mb(xd, xd->dst.y_buffer, - xd->dst.u_buffer, xd->dst.v_buffer, - xd->dst.y_stride, xd->dst.uv_stride); + vp8_build_inter16x16_predictors_mb(mb, mb->dst.y_buffer, + mb->dst.u_buffer, mb->dst.v_buffer, + mb->dst.y_stride, mb->dst.uv_stride); } } @@ -98,47 +98,47 @@ static void skip_recon_mb(VP8D_COMP *pbi, MACROBLOCKD *xd) * filtering. The bottom and right edges use 16 pixels plus 2 pixels * left of the central pixel when filtering. */ -static void clamp_mv_to_umv_border(MV *mv, const MACROBLOCKD *xd) +static void clamp_mv_to_umv_border(MV *mv, const MACROBLOCKD *mb) { - if (mv->col < (xd->mb_to_left_edge - (19 << 3))) - mv->col = xd->mb_to_left_edge - (16 << 3); - else if (mv->col > xd->mb_to_right_edge + (18 << 3)) - mv->col = xd->mb_to_right_edge + (16 << 3); - - if (mv->row < (xd->mb_to_top_edge - (19 << 3))) - mv->row = xd->mb_to_top_edge - (16 << 3); - else if (mv->row > xd->mb_to_bottom_edge + (18 << 3)) - mv->row = xd->mb_to_bottom_edge + (16 << 3); + if (mv->col < (mb->mb_to_left_edge - (19 << 3))) + mv->col = mb->mb_to_left_edge - (16 << 3); + else if (mv->col > mb->mb_to_right_edge + (18 << 3)) + mv->col = mb->mb_to_right_edge + (16 << 3); + + if (mv->row < (mb->mb_to_top_edge - (19 << 3))) + mv->row = mb->mb_to_top_edge - (16 << 3); + else if (mv->row > mb->mb_to_bottom_edge + (18 << 3)) + mv->row = mb->mb_to_bottom_edge + (16 << 3); } /** * \note clamp_uvmv_to_umv_border() is a chroma block MVs version of the * function clamp_mv_to_umv_border(). */ -static void clamp_uvmv_to_umv_border(MV *mv, const MACROBLOCKD *xd) +static void clamp_uvmv_to_umv_border(MV *mv, const MACROBLOCKD *mb) { - mv->col = (2*mv->col < (xd->mb_to_left_edge - (19 << 3))) ? (xd->mb_to_left_edge - (16 << 3)) >> 1 : mv->col; - mv->col = (2*mv->col > xd->mb_to_right_edge + (18 << 3)) ? (xd->mb_to_right_edge + (16 << 3)) >> 1 : mv->col; + mv->col = (2*mv->col < (mb->mb_to_left_edge - (19 << 3))) ? (mb->mb_to_left_edge - (16 << 3)) >> 1 : mv->col; + mv->col = (2*mv->col > mb->mb_to_right_edge + (18 << 3)) ? (mb->mb_to_right_edge + (16 << 3)) >> 1 : mv->col; - mv->row = (2*mv->row < (xd->mb_to_top_edge - (19 << 3))) ? (xd->mb_to_top_edge - (16 << 3)) >> 1 : mv->row; - mv->row = (2*mv->row > xd->mb_to_bottom_edge + (18 << 3)) ? (xd->mb_to_bottom_edge + (16 << 3)) >> 1 : mv->row; + mv->row = (2*mv->row < (mb->mb_to_top_edge - (19 << 3))) ? (mb->mb_to_top_edge - (16 << 3)) >> 1 : mv->row; + mv->row = (2*mv->row > mb->mb_to_bottom_edge + (18 << 3)) ? (mb->mb_to_bottom_edge + (16 << 3)) >> 1 : mv->row; } -static void clamp_mvs(MACROBLOCKD *xd) +static void clamp_mvs(MACROBLOCKD *mb) { - if (xd->mode_info_context->mbmi.mode == SPLITMV) + if (mb->mode_info_context->mbmi.mode == SPLITMV) { int i; for (i = 0; i < 16; i++) - clamp_mv_to_umv_border(&xd->block[i].bmi.mv.as_mv, xd); + clamp_mv_to_umv_border(&mb->block[i].bmi.mv.as_mv, mb); for (i = 16; i < 24; i++) - clamp_uvmv_to_umv_border(&xd->block[i].bmi.mv.as_mv, xd); + clamp_uvmv_to_umv_border(&mb->block[i].bmi.mv.as_mv, mb); } else { - clamp_mv_to_umv_border(&xd->mode_info_context->mbmi.mv.as_mv, xd); - clamp_uvmv_to_umv_border(&xd->block[16].bmi.mv.as_mv, xd); + clamp_mv_to_umv_border(&mb->mode_info_context->mbmi.mv.as_mv, mb); + clamp_uvmv_to_umv_border(&mb->block[16].bmi.mv.as_mv, mb); } } @@ -194,59 +194,59 @@ static void vp8_extend_mb_row(YV12_BUFFER_CONFIG *ybf, } } -static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd, unsigned int mb_idx) +static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *mb, unsigned int mb_idx) { int eobtotal = 0; MB_PREDICTION_MODE mode; int i; - if (xd->mode_info_context->mbmi.mb_skip_coeff) + if (mb->mode_info_context->mbmi.mb_skip_coeff) { - vp8_reset_mb_tokens_context(xd); + vp8_reset_mb_tokens_context(mb); } else { - eobtotal = vp8_decode_mb_tokens(pbi, xd); + eobtotal = vp8_decode_mb_tokens(pbi, mb); } /* Perform temporary clamping of the MV to be used for prediction */ - if (xd->mode_info_context->mbmi.need_to_clamp_mvs) + if (mb->mode_info_context->mbmi.need_to_clamp_mvs) { - clamp_mvs(xd); + clamp_mvs(mb); } - mode = xd->mode_info_context->mbmi.mode; + mode = mb->mode_info_context->mbmi.mode; if (eobtotal == 0 && mode != B_PRED && mode != SPLITMV) { /* Special case: Force the loopfilter to skip when eobtotal and * mb_skip_coeff are zero. */ - xd->mode_info_context->mbmi.mb_skip_coeff = 1; + mb->mode_info_context->mbmi.mb_skip_coeff = 1; - skip_recon_mb(pbi, xd); + skip_recon_mb(pbi, mb); return; } - if (xd->segmentation_enabled) - mb_init_dequantizer(pbi, xd); + if (mb->segmentation_enabled) + mb_init_dequantizer(pbi, mb); /* do prediction */ - if (xd->mode_info_context->mbmi.ref_frame == INTRA_FRAME) + if (mb->mode_info_context->mbmi.ref_frame == INTRA_FRAME) { - RECON_INVOKE(&pbi->common.rtcd.recon, build_intra_predictors_mbuv)(xd); + RECON_INVOKE(&pbi->common.rtcd.recon, build_intra_predictors_mbuv)(mb); if (mode != B_PRED) { - RECON_INVOKE(&pbi->common.rtcd.recon, build_intra_predictors_mby)(xd); + RECON_INVOKE(&pbi->common.rtcd.recon, build_intra_predictors_mby)(mb); } else { - vp8_intra_prediction_down_copy(xd); + vp8_intra_prediction_down_copy(mb); } } else { - vp8_build_inter_predictors_mb(xd); + vp8_build_inter_predictors_mb(mb); } /* dequantization and idct */ @@ -254,11 +254,11 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd, unsigned int mb_i { for (i = 0; i < 16; i++) { - BLOCKD *b = &xd->block[i]; + BLOCKD *b = &mb->block[i]; RECON_INVOKE(RTCD_VTABLE(recon), intra4x4_predict) (b, b->bmi.as_mode, b->predictor); - if (xd->eobs[i] > 1) + if (mb->eobs[i] > 1) { DEQUANT_INVOKE(&pbi->dequant, idct_add) (b->qcoeff, b->dequant, b->predictor, @@ -269,6 +269,7 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd, unsigned int mb_i IDCT_INVOKE(RTCD_VTABLE(idct), idct1_scalar_add) (b->qcoeff[0] * b->dequant[0], b->predictor, *(b->base_dst) + b->dst, 16, b->dst_stride); + ((int *)b->qcoeff)[0] = 0; } } @@ -277,18 +278,18 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd, unsigned int mb_i else if (mode == SPLITMV) { DEQUANT_INVOKE(&pbi->dequant, idct_add_y_block) - (xd->qcoeff, xd->block[0].dequant, - xd->predictor, xd->dst.y_buffer, - xd->dst.y_stride, xd->eobs); + (mb->qcoeff, mb->block[0].dequant, + mb->predictor, mb->dst.y_buffer, + mb->dst.y_stride, mb->eobs); } else { - BLOCKD *b = &xd->block[24]; + BLOCKD *b = &mb->block[24]; DEQUANT_INVOKE(&pbi->dequant, block)(b); /* do 2nd order transform on the dc block */ - if (xd->eobs[24] > 1) + if (mb->eobs[24] > 1) { IDCT_INVOKE(RTCD_VTABLE(idct), iwalsh16)(&b->dqcoeff[0], b->diff); ((int *)b->qcoeff)[0] = 0; @@ -307,19 +308,19 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd, unsigned int mb_i } DEQUANT_INVOKE (&pbi->dequant, dc_idct_add_y_block) - (xd->qcoeff, xd->block[0].dequant, - xd->predictor, xd->dst.y_buffer, - xd->dst.y_stride, xd->eobs, xd->block[24].diff); + (mb->qcoeff, mb->block[0].dequant, + mb->predictor, mb->dst.y_buffer, + mb->dst.y_stride, mb->eobs, mb->block[24].diff); } DEQUANT_INVOKE (&pbi->dequant, idct_add_uv_block) - (xd->qcoeff+16*16, xd->block[16].dequant, - xd->predictor+16*16, xd->dst.u_buffer, xd->dst.v_buffer, - xd->dst.uv_stride, xd->eobs+16); + (mb->qcoeff+16*16, mb->block[16].dequant, + mb->predictor+16*16, mb->dst.u_buffer, mb->dst.v_buffer, + mb->dst.uv_stride, mb->eobs+16); } static void -decode_macroblock_row(VP8D_COMP *pbi, VP8_COMMON *pc, int mb_row, MACROBLOCKD *xd) +decode_macroblock_row(VP8D_COMP *pbi, VP8_COMMON *pc, int mb_row, MACROBLOCKD *mb) { int recon_yoffset, recon_uvoffset; int mb_col; @@ -333,69 +334,69 @@ decode_macroblock_row(VP8D_COMP *pbi, VP8_COMMON *pc, int mb_row, MACROBLOCKD *x recon_uvoffset = mb_row * recon_uv_stride * 8; /* Reset above block coeffs */ - xd->above_context = pc->above_context; - xd->up_available = (mb_row != 0); + mb->above_context = pc->above_context; + mb->up_available = (mb_row != 0); - xd->mb_to_top_edge = -((mb_row * 16)) << 3; - xd->mb_to_bottom_edge = ((pc->mb_rows - 1 - mb_row) * 16) << 3; + mb->mb_to_top_edge = -((mb_row * 16)) << 3; + mb->mb_to_bottom_edge = ((pc->mb_rows - 1 - mb_row) * 16) << 3; for (mb_col = 0; mb_col < pc->mb_cols; mb_col++) { /* Distance of Mb to the various image edges. * These are specified to 8th pel as they are always compared to values * that are in 1/8th pel units. */ - xd->mb_to_left_edge = -((mb_col * 16) << 3); - xd->mb_to_right_edge = ((pc->mb_cols - 1 - mb_col) * 16) << 3; + mb->mb_to_left_edge = -((mb_col * 16) << 3); + mb->mb_to_right_edge = ((pc->mb_cols - 1 - mb_col) * 16) << 3; - update_blockd_bmi(xd); + update_blockd_bmi(mb); - xd->dst.y_buffer = pc->yv12_fb[dst_fb_idx].y_buffer + recon_yoffset; - xd->dst.u_buffer = pc->yv12_fb[dst_fb_idx].u_buffer + recon_uvoffset; - xd->dst.v_buffer = pc->yv12_fb[dst_fb_idx].v_buffer + recon_uvoffset; + mb->dst.y_buffer = pc->yv12_fb[dst_fb_idx].y_buffer + recon_yoffset; + mb->dst.u_buffer = pc->yv12_fb[dst_fb_idx].u_buffer + recon_uvoffset; + mb->dst.v_buffer = pc->yv12_fb[dst_fb_idx].v_buffer + recon_uvoffset; - xd->left_available = (mb_col != 0); + mb->left_available = (mb_col != 0); /* Select the appropriate reference frame for this MB */ - if (xd->mode_info_context->mbmi.ref_frame == LAST_FRAME) + if (mb->mode_info_context->mbmi.ref_frame == LAST_FRAME) ref_fb_idx = pc->lst_fb_idx; - else if (xd->mode_info_context->mbmi.ref_frame == GOLDEN_FRAME) + else if (mb->mode_info_context->mbmi.ref_frame == GOLDEN_FRAME) ref_fb_idx = pc->gld_fb_idx; else ref_fb_idx = pc->alt_fb_idx; - xd->pre.y_buffer = pc->yv12_fb[ref_fb_idx].y_buffer + recon_yoffset; - xd->pre.u_buffer = pc->yv12_fb[ref_fb_idx].u_buffer + recon_uvoffset; - xd->pre.v_buffer = pc->yv12_fb[ref_fb_idx].v_buffer + recon_uvoffset; + mb->pre.y_buffer = pc->yv12_fb[ref_fb_idx].y_buffer + recon_yoffset; + mb->pre.u_buffer = pc->yv12_fb[ref_fb_idx].u_buffer + recon_uvoffset; + mb->pre.v_buffer = pc->yv12_fb[ref_fb_idx].v_buffer + recon_uvoffset; - if (xd->mode_info_context->mbmi.ref_frame != INTRA_FRAME) + if (mb->mode_info_context->mbmi.ref_frame != INTRA_FRAME) { /* Propagate errors from reference frames */ - xd->corrupted |= pc->yv12_fb[ref_fb_idx].corrupted; + mb->corrupted |= pc->yv12_fb[ref_fb_idx].corrupted; } - vp8_build_uvmvs(xd, pc->full_pixel); + vp8_build_uvmvs(mb, pc->full_pixel); - decode_macroblock(pbi, xd, mb_row * pc->mb_cols + mb_col); + decode_macroblock(pbi, mb, mb_row * pc->mb_cols + mb_col); /* Check if the boolean decoder has suffered an error */ - xd->corrupted |= vp8dx_bool_error(xd->current_bd); + mb->corrupted |= vp8dx_bool_error(mb->current_bd); recon_yoffset += 16; recon_uvoffset += 8; - ++xd->mode_info_context; /* next mb */ + ++mb->mode_info_context; /* next mb */ - xd->above_context++; + mb->above_context++; } /* Adjust to the next row of mbs */ vp8_extend_mb_row(&pc->yv12_fb[dst_fb_idx], - xd->dst.y_buffer + 16, - xd->dst.u_buffer + 8, - xd->dst.v_buffer + 8); + mb->dst.y_buffer + 16, + mb->dst.u_buffer + 8, + mb->dst.v_buffer + 8); /* Skip prediction column */ - ++xd->mode_info_context; + ++mb->mode_info_context; } static unsigned int token_decoder_readpartitionsize(const unsigned char *cx_size) @@ -763,14 +764,14 @@ int vp8_frame_decode(VP8D_COMP *pbi, struct pipe_vp8_picture_desc *frame_header) memcpy(&xd->pre, &pc->yv12_fb[pc->lst_fb_idx], sizeof(YV12_BUFFER_CONFIG)); memcpy(&xd->dst, &pc->yv12_fb[pc->new_fb_idx], sizeof(YV12_BUFFER_CONFIG)); - /* set up frame new frame for intra coded blocks */ + /* Set up frame new frame for intra coded blocks */ vp8_setup_intra_recon(&pc->yv12_fb[pc->new_fb_idx]); vp8_setup_block_dptrs(xd); vp8_setup_block_doffsets(xd); - /* clear out the coeff buffer */ + /* Clear out the coeff buffer */ memset(xd->qcoeff, 0, sizeof(xd->qcoeff)); /* Read the mb_no_coeff_skip flag */ diff --git a/src/gallium/auxiliary/vl/vp8/decodemv.c b/src/gallium/auxiliary/vl/vp8/decodemv.c index 93d4efaa94..64539a57d9 100644 --- a/src/gallium/auxiliary/vl/vp8/decodemv.c +++ b/src/gallium/auxiliary/vl/vp8/decodemv.c @@ -18,6 +18,92 @@ #include <assert.h> #endif +static int left_block_mv(const MODE_INFO *cur_mb, int b) +{ + if (!(b & 3)) + { + /* On L edge, get from MB to left of us */ + --cur_mb; + + if (cur_mb->mbmi.mode != SPLITMV) + return cur_mb->mbmi.mv.as_int; + + b += 4; + } + + return (cur_mb->bmi + b - 1)->mv.as_int; +} + +static int above_block_mv(const MODE_INFO *cur_mb, int b, int mi_stride) +{ + if (!(b >> 2)) + { + /* On top edge, get from MB above us */ + cur_mb -= mi_stride; + + if (cur_mb->mbmi.mode != SPLITMV) + return cur_mb->mbmi.mv.as_int; + + b += 16; + } + + return (cur_mb->bmi + b - 4)->mv.as_int; +} + +static B_PREDICTION_MODE left_block_mode(const MODE_INFO *cur_mb, int b) +{ + if (!(b & 3)) + { + /* On L edge, get from MB to left of us */ + --cur_mb; + + switch (cur_mb->mbmi.mode) + { + case B_PRED: + return (cur_mb->bmi + b + 3)->as_mode; + case DC_PRED: + return B_DC_PRED; + case V_PRED: + return B_VE_PRED; + case H_PRED: + return B_HE_PRED; + case TM_PRED: + return B_TM_PRED; + default: + return B_DC_PRED; + } + } + + return (cur_mb->bmi + b - 1)->as_mode; +} + +static B_PREDICTION_MODE above_block_mode(const MODE_INFO *cur_mb, int b, int mi_stride) +{ + if (!(b >> 2)) + { + /* On top edge, get from MB above us */ + cur_mb -= mi_stride; + + switch (cur_mb->mbmi.mode) + { + case B_PRED: + return (cur_mb->bmi + b + 12)->as_mode; + case DC_PRED: + return B_DC_PRED; + case V_PRED: + return B_VE_PRED; + case H_PRED: + return B_HE_PRED; + case TM_PRED: + return B_TM_PRED; + default: + return B_DC_PRED; + } + } + + return (cur_mb->bmi + b - 4)->as_mode; +} + static int vp8_read_bmode(BOOL_DECODER *bd, const vp8_prob *p) { const int i = vp8_treed_read(bd, vp8_bmode_tree, p); @@ -46,92 +132,105 @@ static int vp8_read_uv_mode(BOOL_DECODER *bd, const vp8_prob *p) return i; } -static void vp8_read_mb_features(BOOL_DECODER *bd, MB_MODE_INFO *mi, MACROBLOCKD *x) +static void vp8_read_mb_features(BOOL_DECODER *bd, MB_MODE_INFO *mi, MACROBLOCKD *mb) { /* Is segmentation enabled. */ - if (x->segmentation_enabled && x->update_mb_segmentation_map) + if (mb->segmentation_enabled && mb->update_mb_segmentation_map) { /* If so then read the segment id. */ - if (vp8_read(bd, x->mb_segment_tree_probs[0])) - mi->segment_id = (unsigned char)(2 + vp8_read(bd, x->mb_segment_tree_probs[2])); + if (vp8_read(bd, mb->mb_segment_tree_probs[0])) + mi->segment_id = (unsigned char)(2 + vp8_read(bd, mb->mb_segment_tree_probs[2])); else - mi->segment_id = (unsigned char)(vp8_read(bd, x->mb_segment_tree_probs[1])); + mi->segment_id = (unsigned char)(vp8_read(bd, mb->mb_segment_tree_probs[1])); } } -static void vp8_kfread_modes(VP8D_COMP *pbi, MODE_INFO *m, int mb_row, int mb_col) +static void vp8_kfread_modes(VP8D_COMP *pbi, MODE_INFO *mi, int mb_row, int mb_col) { BOOL_DECODER *const bd = &pbi->bd; + MB_PREDICTION_MODE y_mode; const int mis = pbi->common.mode_info_stride; - { - MB_PREDICTION_MODE y_mode; + /* Read the Macroblock segmentation map if it is being updated explicitly this frame (reset to 0 above by default) + * By default on a key frame reset all MBs to segment 0 */ + mi->mbmi.segment_id = 0; - /* Read the Macroblock segmentation map if it is being updated explicitly this frame (reset to 0 above by default) - * By default on a key frame reset all MBs to segment 0 */ - m->mbmi.segment_id = 0; + if (pbi->mb.update_mb_segmentation_map) + vp8_read_mb_features(bd, &mi->mbmi, &pbi->mb); - if (pbi->mb.update_mb_segmentation_map) - vp8_read_mb_features(bd, &m->mbmi, &pbi->mb); + /* Read the macroblock coeff skip flag if this feature is in use, else default to 0 */ + if (pbi->common.mb_no_coeff_skip) + mi->mbmi.mb_skip_coeff = vp8_read(bd, pbi->prob_skip_false); + else + mi->mbmi.mb_skip_coeff = 0; - /* Read the macroblock coeff skip flag if this feature is in use, else default to 0 */ - if (pbi->common.mb_no_coeff_skip) - m->mbmi.mb_skip_coeff = vp8_read(bd, pbi->prob_skip_false); - else - m->mbmi.mb_skip_coeff = 0; + y_mode = (MB_PREDICTION_MODE)vp8_kfread_ymode(bd, pbi->common.kf_ymode_prob); - y_mode = (MB_PREDICTION_MODE)vp8_kfread_ymode(bd, pbi->common.kf_ymode_prob); + mi->mbmi.ref_frame = INTRA_FRAME; - m->mbmi.ref_frame = INTRA_FRAME; + if ((mi->mbmi.mode = y_mode) == B_PRED) + { + int i = 0; - if ((m->mbmi.mode = y_mode) == B_PRED) - { - int i = 0; + do { + const B_PREDICTION_MODE A = above_block_mode(mi, i, mis); + const B_PREDICTION_MODE L = left_block_mode(mi, i); - do - { - const B_PREDICTION_MODE A = above_block_mode(m, i, mis); - const B_PREDICTION_MODE L = left_block_mode(m, i); + mi->bmi[i].as_mode = (B_PREDICTION_MODE)vp8_read_bmode(bd, pbi->common.kf_bmode_prob[A][L]); + } + while (++i < 16); + } - m->bmi[i].as_mode = (B_PREDICTION_MODE)vp8_read_bmode(bd, pbi->common.kf_bmode_prob [A] [L]); - } - while (++i < 16); - } + mi->mbmi.uv_mode = (MB_PREDICTION_MODE)vp8_read_uv_mode(bd, pbi->common.kf_uv_mode_prob); +} - m->mbmi.uv_mode = (MB_PREDICTION_MODE)vp8_read_uv_mode(bd, pbi->common.kf_uv_mode_prob); - } +static unsigned int vp8_check_mv_bounds(int_mv *mv, int mb_to_left_edge, + int mb_to_right_edge, int mb_to_top_edge, + int mb_to_bottom_edge) +{ + unsigned int need_to_clamp; + need_to_clamp = (mv->as_mv.col < mb_to_left_edge) ? 1 : 0; + need_to_clamp |= (mv->as_mv.col > mb_to_right_edge) ? 1 : 0; + need_to_clamp |= (mv->as_mv.row < mb_to_top_edge) ? 1 : 0; + need_to_clamp |= (mv->as_mv.row > mb_to_bottom_edge) ? 1 : 0; + + return need_to_clamp; } static int read_mvcomponent(BOOL_DECODER *bd, const MV_CONTEXT *mvc) { const vp8_prob *const p = (const vp8_prob *)mvc; int x = 0; + int i = 0; - if (vp8_read(bd, p [mvpis_short])) /* Large */ + if (vp8_read(bd, p[mvpis_short])) /* Large */ { - int i = 0; - do { - x += vp8_read(bd, p [MVPbits + i]) << i; + x += vp8_read(bd, p[MVPbits + i]) << i; } while (++i < 3); i = mvlong_width - 1; /* Skip bit 3, which is sometimes implicit */ - do - { - x += vp8_read(bd, p [MVPbits + i]) << i; + do { + x += vp8_read(bd, p[MVPbits + i]) << i; } while (--i > 3); if (!(x & 0xFFF0) || vp8_read(bd, p[MVPbits + 3])) + { x += 8; + } } else /* Small */ + { x = vp8_treed_read(bd, vp8_small_mvtree, p + MVPshort); + } if (x && vp8_read(bd, p[MVPsign])) + { x = -x; + } return x; } @@ -155,7 +254,6 @@ static void read_mvcontexts(BOOL_DECODER *bd, MV_CONTEXT *mvc) if (vp8_read(bd, *up++)) { const vp8_prob x = (vp8_prob)vp8_read_literal(bd, 7); - *p = x ? x << 1 : 1; } } @@ -274,19 +372,23 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi, else mbmi->mb_skip_coeff = 0; - if ((mbmi->ref_frame = (MV_REFERENCE_FRAME) vp8_read(bd, pbi->prob_intra))) /* inter MB */ + if ((mbmi->ref_frame = (MV_REFERENCE_FRAME)vp8_read(bd, pbi->prob_intra))) /* Inter MB */ { int rct[4]; - vp8_prob mv_ref_p [VP8_MVREFS-1]; + vp8_prob mv_ref_p[VP8_MVREFS - 1]; int_mv nearest, nearby, best_mv; if (vp8_read(bd, pbi->prob_last)) { - mbmi->ref_frame = (MV_REFERENCE_FRAME)((int)mbmi->ref_frame + (int)(1 + vp8_read(bd, pbi->prob_gf))); + mbmi->ref_frame = mbmi->ref_frame + (MV_REFERENCE_FRAME)vp8_read(bd, pbi->prob_gf) + 1; } vp8_find_near_mvs(&pbi->mb, mi, &nearest, &nearby, &best_mv, rct, mbmi->ref_frame, pbi->common.ref_frame_sign_bias); + vp8_clamp_mv2(&nearest, &pbi->mb); + vp8_clamp_mv2(&nearby, &pbi->mb); + vp8_clamp_mv2(&best_mv, &pbi->mb); + vp8_mv_ref_probs(mv_ref_p, rct); mbmi->uv_mode = DC_PRED; @@ -402,9 +504,10 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi, { /* Required for left and above block mv */ mbmi->mv.as_int = 0; + mbmi->mode = (MB_PREDICTION_MODE)vp8_read_ymode(bd, pbi->common.fc.ymode_prob); /* MB is intra coded */ - if ((mbmi->mode = (MB_PREDICTION_MODE)vp8_read_ymode(bd, pbi->common.fc.ymode_prob)) == B_PRED) + if (mbmi->mode == B_PRED) { int j = 0; do { @@ -417,6 +520,9 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi, } } +/** + * + */ void vp8_decode_mode_mvs(VP8D_COMP *pbi) { MODE_INFO *mi = pbi->common.mi; diff --git a/src/gallium/auxiliary/vl/vp8/findnearmv.c b/src/gallium/auxiliary/vl/vp8/findnearmv.c index 1ec3dfbd9b..f89360d309 100644 --- a/src/gallium/auxiliary/vl/vp8/findnearmv.c +++ b/src/gallium/auxiliary/vl/vp8/findnearmv.c @@ -21,21 +21,35 @@ const int vp8_mode_contexts[6][4] = {234, 188, 128, 28}, }; +static void mv_bias(int refmb_ref_frame_sign_bias, int refframe, int_mv *mvp, + const int *ref_frame_sign_bias) +{ + MV xmv = mvp->as_mv; + + if (refmb_ref_frame_sign_bias != ref_frame_sign_bias[refframe]) + { + xmv.row *= -1; + xmv.col *= -1; + } + + mvp->as_mv = xmv; +} + /** * Predict motion vectors using those from already-decoded nearby blocks. * Note that we only consider one 4x4 subblock from each candidate 16x16 * macroblock. */ -void vp8_find_near_mvs(MACROBLOCKD *xd, +void vp8_find_near_mvs(MACROBLOCKD *mb, const MODE_INFO *here, int_mv *nearest, int_mv *nearby, int_mv *best_mv, int cnt[4], - int refframe, + int ref_frame, int *ref_frame_sign_bias) { - const MODE_INFO *above = here - xd->mode_info_stride; + const MODE_INFO *above = here - mb->mode_info_stride; const MODE_INFO *left = here - 1; const MODE_INFO *aboveleft = above - 1; int_mv near_mvs[4]; @@ -53,7 +67,7 @@ void vp8_find_near_mvs(MACROBLOCKD *xd, if (above->mbmi.mv.as_int) { (++mv)->as_int = above->mbmi.mv.as_int; - mv_bias(ref_frame_sign_bias[above->mbmi.ref_frame], refframe, mv, ref_frame_sign_bias); + mv_bias(ref_frame_sign_bias[above->mbmi.ref_frame], ref_frame, mv, ref_frame_sign_bias); ++cntx; } @@ -68,7 +82,7 @@ void vp8_find_near_mvs(MACROBLOCKD *xd, int_mv this_mv; this_mv.as_int = left->mbmi.mv.as_int; - mv_bias(ref_frame_sign_bias[left->mbmi.ref_frame], refframe, &this_mv, ref_frame_sign_bias); + mv_bias(ref_frame_sign_bias[left->mbmi.ref_frame], ref_frame, &this_mv, ref_frame_sign_bias); if (this_mv.as_int != mv->as_int) { @@ -90,7 +104,7 @@ void vp8_find_near_mvs(MACROBLOCKD *xd, int_mv this_mv; this_mv.as_int = aboveleft->mbmi.mv.as_int; - mv_bias(ref_frame_sign_bias[aboveleft->mbmi.ref_frame], refframe, &this_mv, ref_frame_sign_bias); + mv_bias(ref_frame_sign_bias[aboveleft->mbmi.ref_frame], ref_frame, &this_mv, ref_frame_sign_bias); if (this_mv.as_int != mv->as_int) { @@ -135,19 +149,14 @@ void vp8_find_near_mvs(MACROBLOCKD *xd, best_mv->as_int = near_mvs[0].as_int; nearest->as_int = near_mvs[CNT_NEAREST].as_int; nearby->as_int = near_mvs[CNT_NEAR].as_int; - - //TODO: move clamp outside findnearmv - vp8_clamp_mv2(nearest, xd); - vp8_clamp_mv2(nearby, xd); - vp8_clamp_mv2(best_mv, xd); } -vp8_prob *vp8_mv_ref_probs(vp8_prob p[VP8_MVREFS-1], const int near_mv_ref_ct[4]) +vp8_prob *vp8_mv_ref_probs(vp8_prob p[VP8_MVREFS - 1], const int near_mv_ref_ct[4]) { - p[0] = vp8_mode_contexts [near_mv_ref_ct[0]] [0]; - p[1] = vp8_mode_contexts [near_mv_ref_ct[1]] [1]; - p[2] = vp8_mode_contexts [near_mv_ref_ct[2]] [2]; - p[3] = vp8_mode_contexts [near_mv_ref_ct[3]] [3]; - /*p[3] = vp8_mode_contexts [near_mv_ref_ct[1] + near_mv_ref_ct[2] + near_mv_ref_ct[3]] [3];*/ + p[0] = vp8_mode_contexts[near_mv_ref_ct[0]][0]; + p[1] = vp8_mode_contexts[near_mv_ref_ct[1]][1]; + p[2] = vp8_mode_contexts[near_mv_ref_ct[2]][2]; + p[3] = vp8_mode_contexts[near_mv_ref_ct[3]][3]; + return p; } diff --git a/src/gallium/auxiliary/vl/vp8/findnearmv.h b/src/gallium/auxiliary/vl/vp8/findnearmv.h index 078ad2ed10..b13cc98808 100644 --- a/src/gallium/auxiliary/vl/vp8/findnearmv.h +++ b/src/gallium/auxiliary/vl/vp8/findnearmv.h @@ -20,35 +20,21 @@ #define LEFT_TOP_MARGIN (16 << 3) #define RIGHT_BOTTOM_MARGIN (16 << 3) -static void mv_bias(int refmb_ref_frame_sign_bias, int refframe, int_mv *mvp, - const int *ref_frame_sign_bias) +static void vp8_clamp_mv2(int_mv *mv, const MACROBLOCKD *mb) { - MV xmv; - xmv = mvp->as_mv; + if (mv->as_mv.col < (mb->mb_to_left_edge - LEFT_TOP_MARGIN)) + mv->as_mv.col = mb->mb_to_left_edge - LEFT_TOP_MARGIN; + else if (mv->as_mv.col > mb->mb_to_right_edge + RIGHT_BOTTOM_MARGIN) + mv->as_mv.col = mb->mb_to_right_edge + RIGHT_BOTTOM_MARGIN; - if (refmb_ref_frame_sign_bias != ref_frame_sign_bias[refframe]) - { - xmv.row *= -1; - xmv.col *= -1; - } - - mvp->as_mv = xmv; + if (mv->as_mv.row < (mb->mb_to_top_edge - LEFT_TOP_MARGIN)) + mv->as_mv.row = mb->mb_to_top_edge - LEFT_TOP_MARGIN; + else if (mv->as_mv.row > mb->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN) + mv->as_mv.row = mb->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN; } -static void vp8_clamp_mv2(int_mv *mv, const MACROBLOCKD *xd) -{ - if (mv->as_mv.col < (xd->mb_to_left_edge - LEFT_TOP_MARGIN)) - mv->as_mv.col = xd->mb_to_left_edge - LEFT_TOP_MARGIN; - else if (mv->as_mv.col > xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN) - mv->as_mv.col = xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN; - - if (mv->as_mv.row < (xd->mb_to_top_edge - LEFT_TOP_MARGIN)) - mv->as_mv.row = xd->mb_to_top_edge - LEFT_TOP_MARGIN; - else if (mv->as_mv.row > xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN) - mv->as_mv.row = xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN; -} - -static void vp8_clamp_mv(int_mv *mv, int mb_to_left_edge, int mb_to_right_edge, +static void vp8_clamp_mv(int_mv *mv, + int mb_to_left_edge, int mb_to_right_edge, int mb_to_top_edge, int mb_to_bottom_edge) { mv->as_mv.col = (mv->as_mv.col < mb_to_left_edge) ? @@ -61,109 +47,12 @@ static void vp8_clamp_mv(int_mv *mv, int mb_to_left_edge, int mb_to_right_edge, mb_to_bottom_edge : mv->as_mv.row; } -static unsigned int vp8_check_mv_bounds(int_mv *mv, int mb_to_left_edge, - int mb_to_right_edge, int mb_to_top_edge, - int mb_to_bottom_edge) -{ - unsigned int need_to_clamp; - need_to_clamp = (mv->as_mv.col < mb_to_left_edge) ? 1 : 0; - need_to_clamp |= (mv->as_mv.col > mb_to_right_edge) ? 1 : 0; - need_to_clamp |= (mv->as_mv.row < mb_to_top_edge) ? 1 : 0; - need_to_clamp |= (mv->as_mv.row > mb_to_bottom_edge) ? 1 : 0; - return need_to_clamp; -} - -void vp8_find_near_mvs(MACROBLOCKD *xd, - const MODE_INFO *here, +void vp8_find_near_mvs(MACROBLOCKD *mb, const MODE_INFO *here, int_mv *nearest, int_mv *nearby, int_mv *best, int near_mv_ref_cts[4], - int refframe, - int *ref_frame_sign_bias); - -vp8_prob *vp8_mv_ref_probs(vp8_prob p[VP8_MVREFS-1], const int near_mv_ref_ct[4]); - -static int left_block_mv(const MODE_INFO *cur_mb, int b) -{ - if (!(b & 3)) - { - /* On L edge, get from MB to left of us */ - --cur_mb; - - if (cur_mb->mbmi.mode != SPLITMV) - return cur_mb->mbmi.mv.as_int; - b += 4; - } - - return (cur_mb->bmi + b - 1)->mv.as_int; -} + int ref_frame, int *ref_frame_sign_bias); -static int above_block_mv(const MODE_INFO *cur_mb, int b, int mi_stride) -{ - if (!(b >> 2)) - { - /* On top edge, get from MB above us */ - cur_mb -= mi_stride; - - if (cur_mb->mbmi.mode != SPLITMV) - return cur_mb->mbmi.mv.as_int; - b += 16; - } - - return (cur_mb->bmi + b - 4)->mv.as_int; -} - -static B_PREDICTION_MODE left_block_mode(const MODE_INFO *cur_mb, int b) -{ - if (!(b & 3)) - { - /* On L edge, get from MB to left of us */ - --cur_mb; - - switch (cur_mb->mbmi.mode) - { - case B_PRED: - return (cur_mb->bmi + b + 3)->as_mode; - case DC_PRED: - return B_DC_PRED; - case V_PRED: - return B_VE_PRED; - case H_PRED: - return B_HE_PRED; - case TM_PRED: - return B_TM_PRED; - default: - return B_DC_PRED; - } - } - - return (cur_mb->bmi + b - 1)->as_mode; -} - -static B_PREDICTION_MODE above_block_mode(const MODE_INFO *cur_mb, int b, int mi_stride) -{ - if (!(b >> 2)) - { - /* On top edge, get from MB above us */ - cur_mb -= mi_stride; - - switch (cur_mb->mbmi.mode) - { - case B_PRED: - return (cur_mb->bmi + b + 12)->as_mode; - case DC_PRED: - return B_DC_PRED; - case V_PRED: - return B_VE_PRED; - case H_PRED: - return B_HE_PRED; - case TM_PRED: - return B_TM_PRED; - default: - return B_DC_PRED; - } - } - - return (cur_mb->bmi + b - 4)->as_mode; -} +vp8_prob *vp8_mv_ref_probs(vp8_prob p[VP8_MVREFS - 1], + const int near_mv_ref_ct[4]); #endif /* FINDNEARMV_H */ diff --git a/src/gallium/auxiliary/vl/vp8/vp8_decoder.c b/src/gallium/auxiliary/vl/vp8/vp8_decoder.c index 0ba924ed0f..0aaf8f38e3 100644 --- a/src/gallium/auxiliary/vl/vp8/vp8_decoder.c +++ b/src/gallium/auxiliary/vl/vp8/vp8_decoder.c @@ -49,10 +49,10 @@ static int swap_frame_buffers(VP8_COMMON *cm) { int err = 0; - /* The alternate reference frame or golden frame can be updated - * using the new, last, or golden/alt ref frame. If it - * is updated using the newly decoded frame it is a refresh. - * An update using the last or golden/alt ref frame is a copy. */ + /* The alternate reference frame or golden frame can be updated using the + * new, last, or golden/alt ref frame. If it is updated using the newly + * decoded frame it is a refresh. An update using the last or golden/alt + * ref frame is a copy. */ if (cm->copy_buffer_to_arf) { int new_fb = 0; @@ -121,16 +121,12 @@ VP8D_PTR vp8_decoder_create() } pbi->common.error.setjmp = 1; - vp8_initialize_common(); - - vp8_create_common(&pbi->common); - pbi->common.current_video_frame = 0; pbi->common.show_frame = 0; - pbi->ready_for_new_data = 1; + vp8_initialize_common(); + vp8_create_common(&pbi->common); vp8_initialize_dequantizer(&pbi->common); - // vp8_loop_filter_init(&pbi->common); pbi->common.error.setjmp = 0; @@ -142,8 +138,7 @@ VP8D_PTR vp8_decoder_create() * Decode one VP8 frame. */ int vp8_decoder_start(VP8D_PTR ptr, struct pipe_vp8_picture_desc *frame_header, - const unsigned char *data, unsigned data_size, - int64_t timestamp_deadline) + const unsigned char *data, unsigned data_size) { VP8D_COMP *pbi = (VP8D_COMP *)ptr; VP8_COMMON *cm = &pbi->common; @@ -207,11 +202,6 @@ int vp8_decoder_start(VP8D_PTR ptr, struct pipe_vp8_picture_desc *frame_header, /* from libvpx : vp8_print_modes_and_motion_vectors(cm->mi, cm->mb_rows, cm->mb_cols, cm->current_video_frame); */ - if (cm->show_frame) - cm->current_video_frame++; - - pbi->ready_for_new_data = 0; - pbi->last_time_stamp = timestamp_deadline; pbi->data_size = 0; pbi->common.error.setjmp = 0; @@ -222,24 +212,15 @@ int vp8_decoder_start(VP8D_PTR ptr, struct pipe_vp8_picture_desc *frame_header, * Return a decoded VP8 frame in a YV12 framebuffer. */ int vp8_decoder_getframe(VP8D_PTR ptr, - YV12_BUFFER_CONFIG *sd, - int64_t *timestamp, - int64_t *timestamp_end) + YV12_BUFFER_CONFIG *sd) { int ret = -1; VP8D_COMP *pbi = (VP8D_COMP *)ptr; - if (pbi->ready_for_new_data == 1) - return ret; - /* ie no raw frame to show!!! */ if (pbi->common.show_frame == 0) return ret; - pbi->ready_for_new_data = 1; - *timestamp = pbi->last_time_stamp; - *timestamp_end = 0; - if (pbi->common.frame_to_show) { *sd = *pbi->common.frame_to_show; diff --git a/src/gallium/auxiliary/vl/vp8/vp8_decoder.h b/src/gallium/auxiliary/vl/vp8/vp8_decoder.h index 3b2235f7cd..d852ba1aff 100644 --- a/src/gallium/auxiliary/vl/vp8/vp8_decoder.h +++ b/src/gallium/auxiliary/vl/vp8/vp8_decoder.h @@ -40,11 +40,11 @@ extern "C" typedef struct { - vp8_prob bmode_prob [VP8_BINTRAMODES-1]; - vp8_prob ymode_prob [VP8_YMODES-1]; /**< interframe intra mode probs */ - vp8_prob uv_mode_prob [VP8_UV_MODES-1]; - vp8_prob sub_mv_ref_prob [VP8_SUBMVREFS-1]; - vp8_prob coef_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES]; + vp8_prob bmode_prob[VP8_BINTRAMODES - 1]; + vp8_prob ymode_prob[VP8_YMODES - 1]; /**< interframe intra mode probs */ + vp8_prob uv_mode_prob[VP8_UV_MODES - 1]; + vp8_prob sub_mv_ref_prob[VP8_SUBMVREFS - 1]; + vp8_prob coef_probs[BLOCK_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES]; MV_CONTEXT mvc[2]; } FRAME_CONTEXT; @@ -89,7 +89,10 @@ typedef struct VP8Common DECLARE_ALIGNED(16, short, Y2dequant[QINDEX_RANGE][16]); DECLARE_ALIGNED(16, short, UVdequant[QINDEX_RANGE][16]); + /* Header content */ + FRAME_TYPE frame_type; int version; + int show_frame; int width; int height; @@ -99,23 +102,30 @@ typedef struct VP8Common YUV_TYPE clr_type; CLAMP_TYPE clamp_type; - YV12_BUFFER_CONFIG *frame_to_show; + INTERPOLATIONFILTER_TYPE mcomp_filter_type; + LOOPFILTER_TYPE filter_type; + + int filter_level; + int last_sharpness_level; + int sharpness_level; + + int refresh_last_frame; /**< Two state 0 = NO, 1 = YES */ + int refresh_golden_frame; /**< Two state 0 = NO, 1 = YES */ + int refresh_alt_ref_frame; /**< Two state 0 = NO, 1 = YES */ + /* Frame buffers */ + YV12_BUFFER_CONFIG *frame_to_show; YV12_BUFFER_CONFIG yv12_fb[NUM_YV12_BUFFERS]; int fb_idx_ref_cnt[NUM_YV12_BUFFERS]; int new_fb_idx, lst_fb_idx, gld_fb_idx, alt_fb_idx; - FRAME_TYPE frame_type; - - int show_frame; - int frame_flags; int MBs; int mb_rows; int mb_cols; int mode_info_stride; - /* profile settings */ + /* Profile settings */ int mb_no_coeff_skip; int no_lpf; int use_bilinear_mc_filter; @@ -139,35 +149,24 @@ typedef struct VP8Common MODE_INFO *mip; /**< Base of allocated array */ MODE_INFO *mi; /**< Corresponds to upper left visible macroblock */ - INTERPOLATIONFILTER_TYPE mcomp_filter_type; - LOOPFILTER_TYPE filter_type; - - int filter_level; - int last_sharpness_level; - int sharpness_level; - - int refresh_last_frame; /**< Two state 0 = NO, 1 = YES */ - int refresh_golden_frame; /**< Two state 0 = NO, 1 = YES */ - int refresh_alt_ref_frame; /**< Two state 0 = NO, 1 = YES */ - int copy_buffer_to_gf; /**< 0 none, 1 Last to GF, 2 ARF to GF */ int copy_buffer_to_arf; /**< 0 none, 1 Last to ARF, 2 GF to ARF */ int refresh_entropy_probs; /**< Two state 0 = NO, 1 = YES */ - int ref_frame_sign_bias [MAX_REF_FRAMES]; /**< Two state 0, 1 */ + int ref_frame_sign_bias[MAX_REF_FRAMES]; /**< Two state 0, 1 */ ENTROPY_CONTEXT_PLANES *above_context; /**< Row of context for each plane */ ENTROPY_CONTEXT_PLANES left_context; /**< (up to) 4 contexts */ /* keyframe block modes are predicted by their above, left neighbors */ - vp8_prob kf_bmode_prob [VP8_BINTRAMODES] [VP8_BINTRAMODES] [VP8_BINTRAMODES-1]; - vp8_prob kf_ymode_prob [VP8_YMODES-1]; /**< keyframe */ - vp8_prob kf_uv_mode_prob [VP8_UV_MODES-1]; + vp8_prob kf_bmode_prob[VP8_BINTRAMODES][VP8_BINTRAMODES][VP8_BINTRAMODES - 1]; + vp8_prob kf_ymode_prob[VP8_YMODES - 1]; /**< keyframe */ + vp8_prob kf_uv_mode_prob[VP8_UV_MODES - 1]; - FRAME_CONTEXT lfc; /**< last frame entropy */ - FRAME_CONTEXT fc; /**< current frame entropy */ + FRAME_CONTEXT lfc; /**< Last frame entropy */ + FRAME_CONTEXT fc; /**< Current frame entropy */ unsigned int current_video_frame; @@ -183,14 +182,11 @@ typedef struct DECLARE_ALIGNED(16, VP8_COMMON, common); BOOL_DECODER bd, bd2; + BOOL_DECODER *mbd; const unsigned char *data; unsigned int data_size; - BOOL_DECODER *mbd; - int64_t last_time_stamp; - int ready_for_new_data; - vp8_prob prob_intra; vp8_prob prob_last; vp8_prob prob_gf; @@ -203,11 +199,9 @@ typedef struct VP8D_PTR vp8_decoder_create(); int vp8_decoder_start(VP8D_PTR comp, struct pipe_vp8_picture_desc *frame_header, - const unsigned char *data, unsigned data_size, - int64_t timestamp_deadline); + const unsigned char *data, unsigned data_size); -int vp8_decoder_getframe(VP8D_PTR comp, YV12_BUFFER_CONFIG *sd, - int64_t *timestamp, int64_t *timestamp_end); +int vp8_decoder_getframe(VP8D_PTR comp, YV12_BUFFER_CONFIG *sd); void vp8_decoder_remove(VP8D_PTR comp); |