summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmeric Grange <emeric.grange@gmail.com>2012-01-29 00:25:34 +0100
committerEmeric Grange <emeric.grange@gmail.com>2012-06-24 16:57:33 +0200
commit00e97fab5f178df88356d556cd2bebff1a4d78d8 (patch)
tree051afa204b97a302098e2424b3c78733f0875b9c
parent3842a786de10309bb55246eaa8d740f1cabadeed (diff)
g3dvl: finish merging VP8_COMMON and VP8D_COMP structures, plus some minor cleanups
Signed-off-by: Emeric Grange <emeric.grange@gmail.com>
-rw-r--r--src/gallium/auxiliary/vl/vl_vp8_decoder.h2
-rw-r--r--src/gallium/auxiliary/vl/vp8/alloccommon.c149
-rw-r--r--src/gallium/auxiliary/vl/vp8/alloccommon.h10
-rw-r--r--src/gallium/auxiliary/vl/vp8/decodeframe.c372
-rw-r--r--src/gallium/auxiliary/vl/vp8/decodemv.c120
-rw-r--r--src/gallium/auxiliary/vl/vp8/decodemv.h2
-rw-r--r--src/gallium/auxiliary/vl/vp8/dequantize_common.c14
-rw-r--r--src/gallium/auxiliary/vl/vp8/dequantize_common.h2
-rw-r--r--src/gallium/auxiliary/vl/vp8/entropy.c4
-rw-r--r--src/gallium/auxiliary/vl/vp8/vp8_decoder.c153
-rw-r--r--src/gallium/auxiliary/vl/vp8/vp8_decoder.h74
11 files changed, 444 insertions, 458 deletions
diff --git a/src/gallium/auxiliary/vl/vl_vp8_decoder.h b/src/gallium/auxiliary/vl/vl_vp8_decoder.h
index 64fd9bace0..15c77a8ccd 100644
--- a/src/gallium/auxiliary/vl/vl_vp8_decoder.h
+++ b/src/gallium/auxiliary/vl/vl_vp8_decoder.h
@@ -79,7 +79,7 @@ struct vl_vp8_decoder
struct vl_vp8_buffer *dec_buffers[4];
// VP8 decoder context
- VP8D_COMP *vp8_dec;
+ VP8_COMMON *vp8_dec;
YV12_BUFFER_CONFIG img_yv12;
unsigned startcode;
diff --git a/src/gallium/auxiliary/vl/vp8/alloccommon.c b/src/gallium/auxiliary/vl/vp8/alloccommon.c
index 691b3a155c..4709b2159a 100644
--- a/src/gallium/auxiliary/vl/vp8/alloccommon.c
+++ b/src/gallium/auxiliary/vl/vp8/alloccommon.c
@@ -31,25 +31,25 @@ static void update_mode_info_border(MODE_INFO *mi, int rows, int cols)
}
}
-static void vp8_de_alloc_frame_buffers(VP8_COMMON *oci)
+void vp8_dealloc_frame_buffers(VP8_COMMON *common)
{
int i;
for (i = 0; i < NUM_YV12_BUFFERS; i++)
- vp8_yv12_de_alloc_frame_buffer(&oci->yv12_fb[i]);
+ vp8_yv12_de_alloc_frame_buffer(&common->yv12_fb[i]);
- vpx_free(oci->above_context);
- vpx_free(oci->mip);
+ vpx_free(common->above_context);
+ vpx_free(common->mip);
- oci->above_context = 0;
- oci->mip = 0;
+ common->above_context = 0;
+ common->mip = 0;
}
-int vp8_alloc_frame_buffers(VP8_COMMON *oci, int width, int height)
+int vp8_alloc_frame_buffers(VP8_COMMON *common, int width, int height)
{
int i;
- vp8_de_alloc_frame_buffers(oci);
+ vp8_dealloc_frame_buffers(common);
/* our internal buffers are always multiples of 16 */
if ((width & 0xf) != 0)
@@ -60,48 +60,48 @@ int vp8_alloc_frame_buffers(VP8_COMMON *oci, int width, int height)
for (i = 0; i < NUM_YV12_BUFFERS; i++)
{
- oci->fb_idx_ref_cnt[i] = 0;
- oci->yv12_fb[i].flags = 0;
- if (vp8_yv12_alloc_frame_buffer(&oci->yv12_fb[i], width, height, VP8BORDERINPIXELS) < 0)
+ common->fb_idx_ref_cnt[i] = 0;
+ common->yv12_fb[i].flags = 0;
+ if (vp8_yv12_alloc_frame_buffer(&common->yv12_fb[i], width, height, VP8BORDERINPIXELS) < 0)
{
- vp8_de_alloc_frame_buffers(oci);
+ vp8_dealloc_frame_buffers(common);
return 1;
}
}
- oci->new_fb_idx = 0;
- oci->lst_fb_idx = 1;
- oci->gld_fb_idx = 2;
- oci->alt_fb_idx = 3;
+ common->new_fb_idx = 0;
+ common->lst_fb_idx = 1;
+ common->gld_fb_idx = 2;
+ common->alt_fb_idx = 3;
- oci->fb_idx_ref_cnt[0] = 1;
- oci->fb_idx_ref_cnt[1] = 1;
- oci->fb_idx_ref_cnt[2] = 1;
- oci->fb_idx_ref_cnt[3] = 1;
+ common->fb_idx_ref_cnt[0] = 1;
+ common->fb_idx_ref_cnt[1] = 1;
+ common->fb_idx_ref_cnt[2] = 1;
+ common->fb_idx_ref_cnt[3] = 1;
- oci->mb_rows = height >> 4;
- oci->mb_cols = width >> 4;
- oci->MBs = oci->mb_rows * oci->mb_cols;
- oci->mode_info_stride = oci->mb_cols + 1;
- oci->mip = vpx_calloc((oci->mb_cols + 1) * (oci->mb_rows + 1), sizeof(MODE_INFO));
+ common->mb_rows = height >> 4;
+ common->mb_cols = width >> 4;
+ common->MBs = common->mb_rows * common->mb_cols;
+ common->mode_info_stride = common->mb_cols + 1;
+ common->mip = vpx_calloc((common->mb_cols + 1) * (common->mb_rows + 1), sizeof(MODE_INFO));
- if (!oci->mip)
+ if (!common->mip)
{
- vp8_de_alloc_frame_buffers(oci);
+ vp8_dealloc_frame_buffers(common);
return 1;
}
- oci->mi = oci->mip + oci->mode_info_stride + 1;
+ common->mi = common->mip + common->mode_info_stride + 1;
- oci->above_context = vpx_calloc(sizeof(ENTROPY_CONTEXT_PLANES) * oci->mb_cols, 1);
+ common->above_context = vpx_calloc(sizeof(ENTROPY_CONTEXT_PLANES) * common->mb_cols, 1);
- if (!oci->above_context)
+ if (!common->above_context)
{
- vp8_de_alloc_frame_buffers(oci);
+ vp8_dealloc_frame_buffers(common);
return 1;
}
- update_mode_info_border(oci->mi, oci->mb_rows, oci->mb_cols);
+ update_mode_info_border(common->mi, common->mb_rows, common->mb_cols);
return 0;
}
@@ -110,74 +110,67 @@ int vp8_alloc_frame_buffers(VP8_COMMON *oci, int width, int height)
* Initialize version specific parameters.
* The VP8 "version" field is the equivalent of the mpeg "profile".
*/
-void vp8_setup_version(VP8_COMMON *cm)
+void vp8_setup_version(VP8_COMMON *common)
{
- switch (cm->version)
+ switch (common->version)
{
case 0:
- cm->no_lpf = 0;
- cm->filter_type = NORMAL_LOOPFILTER;
- cm->use_bilinear_mc_filter = 0;
- cm->full_pixel = 0;
+ common->no_lpf = 0;
+ common->filter_type = NORMAL_LOOPFILTER;
+ common->use_bilinear_mc_filter = 0;
+ common->full_pixel = 0;
break;
case 1:
- cm->no_lpf = 0;
- cm->filter_type = SIMPLE_LOOPFILTER;
- cm->use_bilinear_mc_filter = 1;
- cm->full_pixel = 0;
+ common->no_lpf = 0;
+ common->filter_type = SIMPLE_LOOPFILTER;
+ common->use_bilinear_mc_filter = 1;
+ common->full_pixel = 0;
break;
case 2:
- cm->no_lpf = 1;
- cm->filter_type = NORMAL_LOOPFILTER;
- cm->use_bilinear_mc_filter = 1;
- cm->full_pixel = 0;
+ common->no_lpf = 1;
+ common->filter_type = NORMAL_LOOPFILTER;
+ common->use_bilinear_mc_filter = 1;
+ common->full_pixel = 0;
break;
case 3:
- cm->no_lpf = 1;
- cm->filter_type = SIMPLE_LOOPFILTER;
- cm->use_bilinear_mc_filter = 1;
- cm->full_pixel = 1;
+ common->no_lpf = 1;
+ common->filter_type = SIMPLE_LOOPFILTER;
+ common->use_bilinear_mc_filter = 1;
+ common->full_pixel = 1;
break;
default:
/* 4,5,6,7 are reserved for future use */
- cm->no_lpf = 0;
- cm->filter_type = NORMAL_LOOPFILTER;
- cm->use_bilinear_mc_filter = 0;
- cm->full_pixel = 0;
+ common->no_lpf = 0;
+ common->filter_type = NORMAL_LOOPFILTER;
+ common->use_bilinear_mc_filter = 0;
+ common->full_pixel = 0;
break;
}
}
-void vp8_create_common(VP8_COMMON *oci)
+void vp8_initialize_common(VP8_COMMON *common)
{
- vp8_default_coef_probs(oci);
- vp8_init_mbmode_probs(oci);
- vp8_default_bmode_probs(oci->fc.bmode_prob);
-
- oci->mb_no_coeff_skip = 1;
- oci->no_lpf = 0;
- oci->filter_type = NORMAL_LOOPFILTER;
- oci->use_bilinear_mc_filter = 0;
- oci->full_pixel = 0;
- oci->multi_token_partition = ONE_PARTITION;
- oci->clr_type = REG_YUV;
- oci->clamp_type = RECON_CLAMP_REQUIRED;
+ vp8_default_coef_probs(common);
+ vp8_init_mbmode_probs(common);
+ vp8_default_bmode_probs(common->fc.bmode_prob);
+
+ common->mb_no_coeff_skip = 1;
+ common->no_lpf = 0;
+ common->filter_type = NORMAL_LOOPFILTER;
+ common->use_bilinear_mc_filter = 0;
+ common->full_pixel = 0;
+ common->multi_token_partition = ONE_PARTITION;
+ common->clr_type = REG_YUV;
+ common->clamp_type = RECON_CLAMP_REQUIRED;
/* Initialise reference frame sign bias structure to defaults */
- memset(oci->ref_frame_sign_bias, 0, sizeof(oci->ref_frame_sign_bias));
+ memset(common->ref_frame_sign_bias, 0, sizeof(common->ref_frame_sign_bias));
/* Default disable buffer to buffer copying */
- oci->copy_buffer_to_gf = 0;
- oci->copy_buffer_to_arf = 0;
-}
+ common->copy_buffer_to_gf = 0;
+ common->copy_buffer_to_arf = 0;
-void vp8_remove_common(VP8_COMMON *oci)
-{
- vp8_de_alloc_frame_buffers(oci);
-}
-
-void vp8_initialize_common()
-{
+ /* */
vp8_coef_tree_initialize();
vp8_entropy_mode_init();
vp8_init_scan_order_mask();
diff --git a/src/gallium/auxiliary/vl/vp8/alloccommon.h b/src/gallium/auxiliary/vl/vp8/alloccommon.h
index da96df8602..9744415d94 100644
--- a/src/gallium/auxiliary/vl/vp8/alloccommon.h
+++ b/src/gallium/auxiliary/vl/vp8/alloccommon.h
@@ -14,10 +14,10 @@
#include "vp8_decoder.h"
-void vp8_create_common(VP8_COMMON *oci);
-void vp8_remove_common(VP8_COMMON *oci);
-int vp8_alloc_frame_buffers(VP8_COMMON *oci, int width, int height);
-void vp8_setup_version(VP8_COMMON *oci);
-void vp8_initialize_common();
+void vp8_initialize_common(VP8_COMMON *common);
+
+int vp8_alloc_frame_buffers(VP8_COMMON *common, int width, int height);
+void vp8_dealloc_frame_buffers(VP8_COMMON *common);
+void vp8_setup_version(VP8_COMMON *common);
#endif /* ALLOCCOMMON_H */
diff --git a/src/gallium/auxiliary/vl/vp8/decodeframe.c b/src/gallium/auxiliary/vl/vp8/decodeframe.c
index b2e2fab871..56827ff610 100644
--- a/src/gallium/auxiliary/vl/vp8/decodeframe.c
+++ b/src/gallium/auxiliary/vl/vp8/decodeframe.c
@@ -195,11 +195,11 @@ static void vp8_extend_mb_row(YV12_BUFFER_CONFIG *ybf,
}
}
-static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *mb, unsigned int mb_idx)
+static void decode_macroblock(VP8_COMMON *common, MACROBLOCKD *mb, unsigned int mb_idx)
{
+ int i;
int eobtotal = 0;
MB_PREDICTION_MODE mode;
- int i;
if (mb->mode_info_context->mbmi.mb_skip_coeff)
{
@@ -207,7 +207,7 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *mb, unsigned int mb_i
}
else
{
- eobtotal = vp8_decode_mb_tokens(&pbi->common, mb);
+ eobtotal = vp8_decode_mb_tokens(common, mb);
}
/* Perform temporary clamping of the MV to be used for prediction */
@@ -224,21 +224,21 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *mb, unsigned int mb_i
* mb_skip_coeff are zero. */
mb->mode_info_context->mbmi.mb_skip_coeff = 1;
- skip_recon_mb(&pbi->common, mb);
+ skip_recon_mb(common, mb);
return;
}
if (mb->segmentation_enabled)
- mb_init_dequantizer(&pbi->common, mb);
+ mb_init_dequantizer(common, mb);
/* do prediction */
if (mb->mode_info_context->mbmi.ref_frame == INTRA_FRAME)
{
- RECON_INVOKE(&pbi->common.rtcd.recon, build_intra_predictors_mbuv)(mb);
+ RECON_INVOKE(&common->rtcd.recon, build_intra_predictors_mbuv)(mb);
if (mode != B_PRED)
{
- RECON_INVOKE(&pbi->common.rtcd.recon, build_intra_predictors_mby)(mb);
+ RECON_INVOKE(&common->rtcd.rtcd.recon, build_intra_predictors_mby)(mb);
}
else
{
@@ -261,7 +261,7 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *mb, unsigned int mb_i
if (mb->eobs[i] > 1)
{
- DEQUANT_INVOKE(&pbi->dequant, idct_add)
+ DEQUANT_INVOKE(&common->dequant, idct_add)
(b->qcoeff, b->dequant, b->predictor,
*(b->base_dst) + b->dst, 16, b->dst_stride);
}
@@ -278,7 +278,7 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *mb, unsigned int mb_i
}
else if (mode == SPLITMV)
{
- DEQUANT_INVOKE(&pbi->dequant, idct_add_y_block)
+ DEQUANT_INVOKE(&common->dequant, idct_add_y_block)
(mb->qcoeff, mb->block[0].dequant,
mb->predictor, mb->dst.y_buffer,
mb->dst.y_stride, mb->eobs);
@@ -287,7 +287,7 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *mb, unsigned int mb_i
{
BLOCKD *b = &mb->block[24];
- DEQUANT_INVOKE(&pbi->dequant, block)(b);
+ DEQUANT_INVOKE(&common->dequant, block)(b);
/* do 2nd order transform on the dc block */
if (mb->eobs[24] > 1)
@@ -308,76 +308,76 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *mb, unsigned int mb_i
((int *)b->qcoeff)[0] = 0;
}
- DEQUANT_INVOKE (&pbi->dequant, dc_idct_add_y_block)
+ DEQUANT_INVOKE (&common->dequant, dc_idct_add_y_block)
(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)
+ DEQUANT_INVOKE (&common->dequant, idct_add_uv_block)
(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 *mb)
+decode_macroblock_row(VP8_COMMON *common, int mb_row, MACROBLOCKD *mb)
{
int recon_yoffset, recon_uvoffset;
int mb_col;
- int ref_fb_idx = pc->lst_fb_idx;
- int dst_fb_idx = pc->new_fb_idx;
- int recon_y_stride = pc->yv12_fb[ref_fb_idx].y_stride;
- int recon_uv_stride = pc->yv12_fb[ref_fb_idx].uv_stride;
+ int ref_fb_idx = common->lst_fb_idx;
+ int dst_fb_idx = common->new_fb_idx;
+ int recon_y_stride = common->yv12_fb[ref_fb_idx].y_stride;
+ int recon_uv_stride = common->yv12_fb[ref_fb_idx].uv_stride;
- memset(&pc->left_context, 0, sizeof(pc->left_context));
+ memset(&common->left_context, 0, sizeof(common->left_context));
recon_yoffset = mb_row * recon_y_stride * 16;
recon_uvoffset = mb_row * recon_uv_stride * 8;
/* Reset above block coeffs */
- mb->above_context = pc->above_context;
+ mb->above_context = common->above_context;
mb->up_available = (mb_row != 0);
mb->mb_to_top_edge = -((mb_row * 16)) << 3;
- mb->mb_to_bottom_edge = ((pc->mb_rows - 1 - mb_row) * 16) << 3;
+ mb->mb_to_bottom_edge = ((common->mb_rows - 1 - mb_row) * 16) << 3;
- for (mb_col = 0; mb_col < pc->mb_cols; mb_col++)
+ for (mb_col = 0; mb_col < common->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. */
mb->mb_to_left_edge = -((mb_col * 16) << 3);
- mb->mb_to_right_edge = ((pc->mb_cols - 1 - mb_col) * 16) << 3;
+ mb->mb_to_right_edge = ((common->mb_cols - 1 - mb_col) * 16) << 3;
update_blockd_bmi(mb);
- 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;
+ mb->dst.y_buffer = common->yv12_fb[dst_fb_idx].y_buffer + recon_yoffset;
+ mb->dst.u_buffer = common->yv12_fb[dst_fb_idx].u_buffer + recon_uvoffset;
+ mb->dst.v_buffer = common->yv12_fb[dst_fb_idx].v_buffer + recon_uvoffset;
mb->left_available = (mb_col != 0);
/* Select the appropriate reference frame for this MB */
if (mb->mode_info_context->mbmi.ref_frame == LAST_FRAME)
- ref_fb_idx = pc->lst_fb_idx;
+ ref_fb_idx = common->lst_fb_idx;
else if (mb->mode_info_context->mbmi.ref_frame == GOLDEN_FRAME)
- ref_fb_idx = pc->gld_fb_idx;
+ ref_fb_idx = common->gld_fb_idx;
else
- ref_fb_idx = pc->alt_fb_idx;
+ ref_fb_idx = common->alt_fb_idx;
- 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;
+ mb->pre.y_buffer = common->yv12_fb[ref_fb_idx].y_buffer + recon_yoffset;
+ mb->pre.u_buffer = common->yv12_fb[ref_fb_idx].u_buffer + recon_uvoffset;
+ mb->pre.v_buffer = common->yv12_fb[ref_fb_idx].v_buffer + recon_uvoffset;
if (mb->mode_info_context->mbmi.ref_frame != INTRA_FRAME)
{
/* Propagate errors from reference frames */
- mb->corrupted |= pc->yv12_fb[ref_fb_idx].corrupted;
+ mb->corrupted |= common->yv12_fb[ref_fb_idx].corrupted;
}
- vp8_build_uvmvs(mb, pc->full_pixel);
+ vp8_build_uvmvs(mb, common->full_pixel);
- decode_macroblock(pbi, mb, mb_row * pc->mb_cols + mb_col);
+ decode_macroblock(common, mb, mb_row * common->mb_cols + mb_col);
/* Check if the boolean decoder has suffered an error */
mb->corrupted |= vp8dx_bool_error(mb->current_bd);
@@ -391,7 +391,7 @@ decode_macroblock_row(VP8D_COMP *pbi, VP8_COMMON *pc, int mb_row, MACROBLOCKD *m
}
/* Adjust to the next row of mbs */
- vp8_extend_mb_row(&pc->yv12_fb[dst_fb_idx],
+ vp8_extend_mb_row(&common->yv12_fb[dst_fb_idx],
mb->dst.y_buffer + 16,
mb->dst.u_buffer + 8,
mb->dst.v_buffer + 8);
@@ -406,37 +406,36 @@ static unsigned int token_decoder_readpartitionsize(const unsigned char *cx_size
return size;
}
-static void token_decoder_setup(VP8D_COMP *pbi,
+static void token_decoder_setup(VP8_COMMON *common,
const unsigned char *cx_data)
{
int num_part;
int i;
- VP8_COMMON *pc = &pbi->common;
- const unsigned char *user_data_end = pbi->data + pbi->data_size;
+ const unsigned char *user_data_end = common->data + common->data_size;
/* Set up pointers to the first partition */
- BOOL_DECODER *bool_decoder = &pbi->bd2;
+ BOOL_DECODER *bool_decoder = &common->bd2;
const unsigned char *partition = cx_data;
/* Parse number of token partitions to use */
- const TOKEN_PARTITION multi_token_partition = (TOKEN_PARTITION)vp8_read_literal(&pbi->bd, 2);
+ const TOKEN_PARTITION multi_token_partition = (TOKEN_PARTITION)vp8_read_literal(&common->bd, 2);
/* Only update the multi_token_partition field if we are sure the value is correct. */
- if (!vp8dx_bool_error(&pbi->bd))
- pc->multi_token_partition = multi_token_partition;
+ if (!vp8dx_bool_error(&common->bd))
+ common->multi_token_partition = multi_token_partition;
- num_part = 1 << pc->multi_token_partition;
+ num_part = 1 << common->multi_token_partition;
if (num_part > 1)
{
- pbi->mbd = vpx_memalign(32, num_part * sizeof(BOOL_DECODER));
- if (!pbi->mbd)
+ common->mbd = vpx_memalign(32, num_part * sizeof(BOOL_DECODER));
+ if (!common->mbd)
{
// Memory allocation failed
assert(0);
}
- bool_decoder = pbi->mbd;
+ bool_decoder = common->mbd;
partition += 3 * (num_part - 1);
}
@@ -458,14 +457,14 @@ static void token_decoder_setup(VP8D_COMP *pbi,
if (partition + partition_size > user_data_end ||
partition + partition_size < partition)
{
- vpx_internal_error(&pc->error, VPX_CODEC_CORRUPT_FRAME,
+ vpx_internal_error(&common->error, VPX_CODEC_CORRUPT_FRAME,
"Truncated packet or corrupt partition "
"%d length", i + 1);
}
if (vp8dx_start_decode(bool_decoder, partition, partition_size))
{
- vpx_internal_error(&pc->error, VPX_CODEC_MEM_ERROR,
+ vpx_internal_error(&common->error, VPX_CODEC_MEM_ERROR,
"Failed to allocate bool decoder %d", i + 1);
}
@@ -475,147 +474,143 @@ static void token_decoder_setup(VP8D_COMP *pbi,
}
}
-static void token_decoder_stop(VP8D_COMP *pbi)
+static void token_decoder_stop(VP8_COMMON *common)
{
- VP8_COMMON *pc = &pbi->common;
-
- if (pc->multi_token_partition != ONE_PARTITION)
+ if (common->multi_token_partition != ONE_PARTITION)
{
- vpx_free(pbi->mbd);
- pbi->mbd = NULL;
+ vpx_free(common->mbd);
+ common->mbd = NULL;
}
}
-static void vp8_frame_init(VP8D_COMP *pbi)
+static void vp8_frame_init(VP8_COMMON *common)
{
- VP8_COMMON *const pc = &pbi->common;
- MACROBLOCKD *const xd = &pbi->mb;
+ MACROBLOCKD *const mb = &common->mb;
- if (pc->frame_type == KEY_FRAME)
+ if (common->frame_type == KEY_FRAME)
{
/* Various keyframe initializations. */
- memcpy(pc->fc.mvc, vp8_default_mv_context, sizeof(vp8_default_mv_context));
+ memcpy(common->fc.mvc, vp8_default_mv_context, sizeof(vp8_default_mv_context));
- vp8_init_mbmode_probs(pc);
+ vp8_init_mbmode_probs(common);
- vp8_default_coef_probs(pc);
- vp8_kf_default_bmode_probs(pc->kf_bmode_prob);
+ vp8_default_coef_probs(common);
+ vp8_kf_default_bmode_probs(common->kf_bmode_prob);
/* Reset the segment feature data to 0 with delta coding (Default state). */
- memset(xd->segment_feature_data, 0, sizeof(xd->segment_feature_data));
- xd->mb_segement_abs_delta = SEGMENT_DELTADATA;
+ memset(mb->segment_feature_data, 0, sizeof(mb->segment_feature_data));
+ mb->mb_segement_abs_delta = SEGMENT_DELTADATA;
/* Reset the mode ref deltasa for loop filter. */
- memset(xd->ref_lf_deltas, 0, sizeof(xd->ref_lf_deltas));
- memset(xd->mode_lf_deltas, 0, sizeof(xd->mode_lf_deltas));
+ memset(mb->ref_lf_deltas, 0, sizeof(mb->ref_lf_deltas));
+ memset(mb->mode_lf_deltas, 0, sizeof(mb->mode_lf_deltas));
/* All buffers are implicitly updated on key frames. */
- pc->refresh_golden_frame = 1;
- pc->refresh_alt_ref_frame = 1;
- pc->copy_buffer_to_gf = 0;
- pc->copy_buffer_to_arf = 0;
+ common->refresh_golden_frame = 1;
+ common->refresh_alt_ref_frame = 1;
+ common->copy_buffer_to_gf = 0;
+ common->copy_buffer_to_arf = 0;
/* Note that Golden and Altref modes cannot be used on a key frame so
* ref_frame_sign_bias[] is undefined and meaningless. */
- pc->ref_frame_sign_bias[GOLDEN_FRAME] = 0;
- pc->ref_frame_sign_bias[ALTREF_FRAME] = 0;
+ common->ref_frame_sign_bias[GOLDEN_FRAME] = 0;
+ common->ref_frame_sign_bias[ALTREF_FRAME] = 0;
}
else
{
- if (pc->use_bilinear_mc_filter)
+ if (common->use_bilinear_mc_filter)
{
- pc->mcomp_filter_type = BILINEAR;
- xd->filter_predict4x4 = FILTER_INVOKE(RTCD_VTABLE(filter), bilinear4x4);
- xd->filter_predict8x4 = FILTER_INVOKE(RTCD_VTABLE(filter), bilinear8x4);
- xd->filter_predict8x8 = FILTER_INVOKE(RTCD_VTABLE(filter), bilinear8x8);
- xd->filter_predict16x16 = FILTER_INVOKE(RTCD_VTABLE(filter), bilinear16x16);
+ common->mcomp_filter_type = BILINEAR;
+ mb->filter_predict4x4 = FILTER_INVOKE(RTCD_VTABLE(filter), bilinear4x4);
+ mb->filter_predict8x4 = FILTER_INVOKE(RTCD_VTABLE(filter), bilinear8x4);
+ mb->filter_predict8x8 = FILTER_INVOKE(RTCD_VTABLE(filter), bilinear8x8);
+ mb->filter_predict16x16 = FILTER_INVOKE(RTCD_VTABLE(filter), bilinear16x16);
}
else
{
- pc->mcomp_filter_type = SIXTAP;
- xd->filter_predict4x4 = FILTER_INVOKE(RTCD_VTABLE(filter), sixtap4x4);
- xd->filter_predict8x4 = FILTER_INVOKE(RTCD_VTABLE(filter), sixtap8x4);
- xd->filter_predict8x8 = FILTER_INVOKE(RTCD_VTABLE(filter), sixtap8x8);
- xd->filter_predict16x16 = FILTER_INVOKE(RTCD_VTABLE(filter), sixtap16x16);
+ common->mcomp_filter_type = SIXTAP;
+ mb->filter_predict4x4 = FILTER_INVOKE(RTCD_VTABLE(filter), sixtap4x4);
+ mb->filter_predict8x4 = FILTER_INVOKE(RTCD_VTABLE(filter), sixtap8x4);
+ mb->filter_predict8x8 = FILTER_INVOKE(RTCD_VTABLE(filter), sixtap8x8);
+ mb->filter_predict16x16 = FILTER_INVOKE(RTCD_VTABLE(filter), sixtap16x16);
}
}
- xd->left_context = &pc->left_context;
- xd->mode_info_context = pc->mi;
- xd->frame_type = pc->frame_type;
- xd->mode_info_context->mbmi.mode = DC_PRED;
- xd->mode_info_stride = pc->mode_info_stride;
- xd->corrupted = 0; /* init without corruption */
+ mb->left_context = &common->left_context;
+ mb->mode_info_context = common->mi;
+ mb->frame_type = common->frame_type;
+ mb->mode_info_context->mbmi.mode = DC_PRED;
+ mb->mode_info_stride = common->mode_info_stride;
+ mb->corrupted = 0; /* init without corruption */
}
-int vp8_frame_decode(VP8D_COMP *pbi, struct pipe_vp8_picture_desc *frame_header)
+int vp8_frame_decode(VP8_COMMON *common, struct pipe_vp8_picture_desc *frame_header)
{
- BOOL_DECODER *const bd = &pbi->bd;
- VP8_COMMON *const pc = &pbi->common;
- MACROBLOCKD *const xd = &pbi->mb;
- const unsigned char *data = pbi->data;
- const unsigned char *data_end = data + pbi->data_size;
+ BOOL_DECODER *const bd = &common->bd;
+ MACROBLOCKD *const mb = &common->mb;
+ const unsigned char *data = common->data;
+ const unsigned char *data_end = data + common->data_size;
ptrdiff_t first_partition_length_in_bytes = (ptrdiff_t)frame_header->first_partition_size;
int mb_row;
int i, j, k, l;
/* Start with no corruption of current frame */
- xd->corrupted = 0;
- pc->yv12_fb[pc->new_fb_idx].corrupted = 0;
+ mb->corrupted = 0;
+ common->yv12_fb[common->new_fb_idx].corrupted = 0;
- pc->frame_type = (FRAME_TYPE)frame_header->key_frame;
- pc->version = (int)frame_header->base.profile;
- pc->show_frame = (int)frame_header->show_frame;
+ common->frame_type = (FRAME_TYPE)frame_header->key_frame;
+ common->version = (int)frame_header->base.profile;
+ common->show_frame = (int)frame_header->show_frame;
- vp8_setup_version(pc);
+ vp8_setup_version(common);
- if (pc->frame_type == KEY_FRAME)
+ if (common->frame_type == KEY_FRAME)
{
- if (pc->width != frame_header->width ||
- pc->height != frame_header->height)
+ if (common->width != frame_header->width ||
+ common->height != frame_header->height)
{
- if (vp8_alloc_frame_buffers(pc, frame_header->width, frame_header->height))
+ if (vp8_alloc_frame_buffers(common, frame_header->width, frame_header->height))
{
- vpx_internal_error(&pc->error, VPX_CODEC_MEM_ERROR,
+ vpx_internal_error(&common->error, VPX_CODEC_MEM_ERROR,
"Failed to allocate frame buffers");
}
}
- pc->width = frame_header->width;
- pc->horiz_scale = frame_header->horizontal_scale;
- pc->height = frame_header->height;
- pc->vert_scale = frame_header->vertical_scale;
+ common->width = frame_header->width;
+ common->horiz_scale = frame_header->horizontal_scale;
+ common->height = frame_header->height;
+ common->vert_scale = frame_header->vertical_scale;
}
- vp8_frame_init(pbi);
+ vp8_frame_init(common);
if (vp8dx_start_decode(bd, data, data_end - data))
{
- vpx_internal_error(&pc->error, VPX_CODEC_MEM_ERROR,
+ vpx_internal_error(&common->error, VPX_CODEC_MEM_ERROR,
"Failed to allocate bool decoder 0");
}
- if (pc->frame_type == KEY_FRAME)
+ if (common->frame_type == KEY_FRAME)
{
- pc->clr_type = (YUV_TYPE)vp8_read_bit(bd);
- pc->clamp_type = (CLAMP_TYPE)vp8_read_bit(bd);
+ common->clr_type = (YUV_TYPE)vp8_read_bit(bd);
+ common->clamp_type = (CLAMP_TYPE)vp8_read_bit(bd);
}
/* Is segmentation enabled */
- xd->segmentation_enabled = (unsigned char)vp8_read_bit(bd);
+ mb->segmentation_enabled = (unsigned char)vp8_read_bit(bd);
- if (xd->segmentation_enabled)
+ if (mb->segmentation_enabled)
{
/* Signal whether or not the segmentation map is being explicitly updated this frame. */
- xd->update_mb_segmentation_map = (unsigned char)vp8_read_bit(bd);
- xd->update_mb_segmentation_data = (unsigned char)vp8_read_bit(bd);
+ mb->update_mb_segmentation_map = (unsigned char)vp8_read_bit(bd);
+ mb->update_mb_segmentation_data = (unsigned char)vp8_read_bit(bd);
- if (xd->update_mb_segmentation_data)
+ if (mb->update_mb_segmentation_data)
{
- xd->mb_segement_abs_delta = (unsigned char)vp8_read_bit(bd);
+ mb->mb_segement_abs_delta = (unsigned char)vp8_read_bit(bd);
- memset(xd->segment_feature_data, 0, sizeof(xd->segment_feature_data));
+ memset(mb->segment_feature_data, 0, sizeof(mb->segment_feature_data));
/* For each segmentation feature (Quant and loop filter level) */
for (i = 0; i < MB_LVL_MAX; i++)
@@ -625,58 +620,58 @@ int vp8_frame_decode(VP8D_COMP *pbi, struct pipe_vp8_picture_desc *frame_header)
/* Frame level data */
if (vp8_read_bit(bd))
{
- xd->segment_feature_data[i][j] = (signed char)vp8_read_literal(bd, vp8_mb_feature_data_bits[i]);
+ mb->segment_feature_data[i][j] = (signed char)vp8_read_literal(bd, vp8_mb_feature_data_bits[i]);
if (vp8_read_bit(bd))
- xd->segment_feature_data[i][j] = -xd->segment_feature_data[i][j];
+ mb->segment_feature_data[i][j] = -mb->segment_feature_data[i][j];
}
else
- xd->segment_feature_data[i][j] = 0;
+ mb->segment_feature_data[i][j] = 0;
}
}
}
- if (xd->update_mb_segmentation_map)
+ if (mb->update_mb_segmentation_map)
{
/* Which macro block level features are enabled */
- memset(xd->mb_segment_tree_probs, 255, sizeof(xd->mb_segment_tree_probs));
+ memset(mb->mb_segment_tree_probs, 255, sizeof(mb->mb_segment_tree_probs));
/* Read the probs used to decode the segment id for each macro block. */
for (i = 0; i < MB_FEATURE_TREE_PROBS; i++)
{
/* If not explicitly set value is defaulted to 255 by memset above. */
if (vp8_read_bit(bd))
- xd->mb_segment_tree_probs[i] = (vp8_prob)vp8_read_literal(bd, 8);
+ mb->mb_segment_tree_probs[i] = (vp8_prob)vp8_read_literal(bd, 8);
}
}
}
/* Read the loop filter level and type */
- pc->filter_type = (LOOPFILTER_TYPE)vp8_read_bit(bd);
- pc->filter_level = vp8_read_literal(bd, 6);
- pc->sharpness_level = vp8_read_literal(bd, 3);
+ common->filter_type = (LOOPFILTER_TYPE)vp8_read_bit(bd);
+ common->filter_level = vp8_read_literal(bd, 6);
+ common->sharpness_level = vp8_read_literal(bd, 3);
/* Read in loop filter deltas applied at the MB level based on mode or ref frame. */
- xd->mode_ref_lf_delta_update = 0;
- xd->mode_ref_lf_delta_enabled = (unsigned char)vp8_read_bit(bd);
+ mb->mode_ref_lf_delta_update = 0;
+ mb->mode_ref_lf_delta_enabled = (unsigned char)vp8_read_bit(bd);
- if (xd->mode_ref_lf_delta_enabled)
+ if (mb->mode_ref_lf_delta_enabled)
{
/* Do the deltas need to be updated */
- xd->mode_ref_lf_delta_update = (unsigned char)vp8_read_bit(bd);
+ mb->mode_ref_lf_delta_update = (unsigned char)vp8_read_bit(bd);
- if (xd->mode_ref_lf_delta_update)
+ if (mb->mode_ref_lf_delta_update)
{
/* Send update */
for (i = 0; i < MAX_REF_LF_DELTAS; i++)
{
if (vp8_read_bit(bd))
{
- xd->ref_lf_deltas[i] = (signed char)vp8_read_literal(bd, 6);
+ mb->ref_lf_deltas[i] = (signed char)vp8_read_literal(bd, 6);
/* Apply sign */
if (vp8_read_bit(bd))
- xd->ref_lf_deltas[i] = xd->ref_lf_deltas[i] * -1;
+ mb->ref_lf_deltas[i] = mb->ref_lf_deltas[i] * -1;
}
}
@@ -685,68 +680,67 @@ int vp8_frame_decode(VP8D_COMP *pbi, struct pipe_vp8_picture_desc *frame_header)
{
if (vp8_read_bit(bd))
{
- xd->mode_lf_deltas[i] = (signed char)vp8_read_literal(bd, 6);
+ mb->mode_lf_deltas[i] = (signed char)vp8_read_literal(bd, 6);
/* Apply sign */
if (vp8_read_bit(bd))
- xd->mode_lf_deltas[i] = xd->mode_lf_deltas[i] * -1;
+ mb->mode_lf_deltas[i] = mb->mode_lf_deltas[i] * -1;
}
}
}
}
- token_decoder_setup(pbi, data + first_partition_length_in_bytes);
- xd->current_bd = &pbi->bd2;
+ token_decoder_setup(common, data + first_partition_length_in_bytes);
+ mb->current_bd = &common->bd2;
/* Read the default quantizers. */
{
- int Q = vp8_read_literal(bd, 7); /* AC 1st order Q = default */
int q_update = 0;
- pc->base_qindex = Q;
- pc->y1dc_delta_q = get_delta_q(bd, pc->y1dc_delta_q, &q_update);
- pc->y2dc_delta_q = get_delta_q(bd, pc->y2dc_delta_q, &q_update);
- pc->y2ac_delta_q = get_delta_q(bd, pc->y2ac_delta_q, &q_update);
- pc->uvdc_delta_q = get_delta_q(bd, pc->uvdc_delta_q, &q_update);
- pc->uvac_delta_q = get_delta_q(bd, pc->uvac_delta_q, &q_update);
+ common->base_qindex = vp8_read_literal(bd, 7); /* AC 1st order Q = default */
+ common->y1dc_delta_q = get_delta_q(bd, common->y1dc_delta_q, &q_update);
+ common->y2dc_delta_q = get_delta_q(bd, common->y2dc_delta_q, &q_update);
+ common->y2ac_delta_q = get_delta_q(bd, common->y2ac_delta_q, &q_update);
+ common->uvdc_delta_q = get_delta_q(bd, common->uvdc_delta_q, &q_update);
+ common->uvac_delta_q = get_delta_q(bd, common->uvac_delta_q, &q_update);
if (q_update)
- vp8_initialize_dequantizer(&pbi->common);
+ vp8_initialize_dequantizer(common);
/* MB level dequantizer setup */
- mb_init_dequantizer(&pbi->common, &pbi->mb);
+ mb_init_dequantizer(common, &common->mb);
}
/* Determine if the golden frame or ARF buffer should be updated and how.
* For all non key frames the GF and ARF refresh flags and sign bias
* flags must be set explicitly. */
- if (pc->frame_type != KEY_FRAME)
+ if (common->frame_type != KEY_FRAME)
{
/* Should the GF or ARF be updated from the current frame. */
- pc->refresh_golden_frame = vp8_read_bit(bd);
- pc->refresh_alt_ref_frame = vp8_read_bit(bd);
+ common->refresh_golden_frame = vp8_read_bit(bd);
+ common->refresh_alt_ref_frame = vp8_read_bit(bd);
/* Buffer to buffer copy flags. */
- pc->copy_buffer_to_gf = 0;
- pc->copy_buffer_to_arf = 0;
+ common->copy_buffer_to_gf = 0;
+ common->copy_buffer_to_arf = 0;
- if (!pc->refresh_golden_frame)
- pc->copy_buffer_to_gf = vp8_read_literal(bd, 2);
+ if (!common->refresh_golden_frame)
+ common->copy_buffer_to_gf = vp8_read_literal(bd, 2);
- if (!pc->refresh_alt_ref_frame)
- pc->copy_buffer_to_arf = vp8_read_literal(bd, 2);
+ if (!common->refresh_alt_ref_frame)
+ common->copy_buffer_to_arf = vp8_read_literal(bd, 2);
- pc->ref_frame_sign_bias[GOLDEN_FRAME] = vp8_read_bit(bd);
- pc->ref_frame_sign_bias[ALTREF_FRAME] = vp8_read_bit(bd);
+ common->ref_frame_sign_bias[GOLDEN_FRAME] = vp8_read_bit(bd);
+ common->ref_frame_sign_bias[ALTREF_FRAME] = vp8_read_bit(bd);
}
- pc->refresh_entropy_probs = vp8_read_bit(bd);
- if (pc->refresh_entropy_probs == 0)
+ common->refresh_entropy_probs = vp8_read_bit(bd);
+ if (common->refresh_entropy_probs == 0)
{
- memcpy(&pc->lfc, &pc->fc, sizeof(pc->fc));
+ memcpy(&common->lfc, &common->fc, sizeof(common->fc));
}
- pc->refresh_last_frame = (pc->frame_type == KEY_FRAME || vp8_read_bit(bd));
+ common->refresh_last_frame = (common->frame_type == KEY_FRAME || vp8_read_bit(bd));
/* Read coef probability tree */
for (i = 0; i < BLOCK_TYPES; i++)
@@ -754,7 +748,7 @@ int vp8_frame_decode(VP8D_COMP *pbi, struct pipe_vp8_picture_desc *frame_header)
for (k = 0; k < PREV_COEF_CONTEXTS; k++)
for (l = 0; l < ENTROPY_NODES; l++)
{
- vp8_prob *const p = pc->fc.coef_probs[i][j][k] + l;
+ vp8_prob *const p = common->fc.coef_probs[i][j][k] + l;
if (vp8_read(bd, vp8_coef_update_probs[i][j][k][l]))
{
@@ -762,68 +756,68 @@ 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));
+ memcpy(&mb->pre, &common->yv12_fb[common->lst_fb_idx], sizeof(YV12_BUFFER_CONFIG));
+ memcpy(&mb->dst, &common->yv12_fb[common->new_fb_idx], sizeof(YV12_BUFFER_CONFIG));
/* Set up frame new frame for intra coded blocks */
- vp8_setup_intra_recon(&pc->yv12_fb[pc->new_fb_idx]);
+ vp8_setup_intra_recon(&common->yv12_fb[common->new_fb_idx]);
- vp8_setup_block_dptrs(xd);
+ vp8_setup_block_dptrs(mb);
- vp8_setup_block_doffsets(xd);
+ vp8_setup_block_doffsets(mb);
/* Clear out the coeff buffer */
- memset(xd->qcoeff, 0, sizeof(xd->qcoeff));
+ memset(mb->qcoeff, 0, sizeof(mb->qcoeff));
/* Read the mb_no_coeff_skip flag */
- pc->mb_no_coeff_skip = vp8_read_bit(bd);
+ common->mb_no_coeff_skip = vp8_read_bit(bd);
- vp8_decode_mode_mvs(pbi);
+ vp8_decode_mode_mvs(common);
- memset(pc->above_context, 0, sizeof(ENTROPY_CONTEXT_PLANES) * pc->mb_cols);
+ memset(common->above_context, 0, sizeof(ENTROPY_CONTEXT_PLANES) * common->mb_cols);
{
int ibc = 0;
- int num_part = 1 << pc->multi_token_partition;
+ int num_part = 1 << common->multi_token_partition;
/* Decode the individual macro block */
- for (mb_row = 0; mb_row < pc->mb_rows; mb_row++)
+ for (mb_row = 0; mb_row < common->mb_rows; mb_row++)
{
if (num_part > 1)
{
- xd->current_bd = &pbi->mbd[ibc];
+ mb->current_bd = &common->mbd[ibc];
ibc++;
if (ibc == num_part)
ibc = 0;
}
- decode_macroblock_row(pbi, pc, mb_row, xd);
+ decode_macroblock_row(common, mb_row, mb);
}
}
- token_decoder_stop(pbi);
+ token_decoder_stop(common);
/* Collect information about decoder corruption. */
/* 1. Check first boolean decoder for errors. */
- pc->yv12_fb[pc->new_fb_idx].corrupted = vp8dx_bool_error(bd);
+ common->yv12_fb[common->new_fb_idx].corrupted = vp8dx_bool_error(bd);
/* 2. Check the macroblock information */
- pc->yv12_fb[pc->new_fb_idx].corrupted |= xd->corrupted;
+ common->yv12_fb[common->new_fb_idx].corrupted |= mb->corrupted;
/* printf("Decoder: Frame Decoded, Size Roughly:%d bytes \n", bc->pos+pbi->bc2.pos); */
/* If this was a kf or Gf note the Q used */
- if (pc->frame_type == KEY_FRAME ||
- pc->refresh_golden_frame ||
- pc->refresh_alt_ref_frame)
+ if (common->frame_type == KEY_FRAME ||
+ common->refresh_golden_frame ||
+ common->refresh_alt_ref_frame)
{
- pc->last_kf_gf_q = pc->base_qindex;
+ common->last_kf_gf_q = common->base_qindex;
}
- if (pc->refresh_entropy_probs == 0)
+ if (common->refresh_entropy_probs == 0)
{
- memcpy(&pc->fc, &pc->lfc, sizeof(pc->fc));
+ memcpy(&common->fc, &common->lfc, sizeof(common->fc));
}
return 0;
diff --git a/src/gallium/auxiliary/vl/vp8/decodemv.c b/src/gallium/auxiliary/vl/vp8/decodemv.c
index 64539a57d9..688099b3b6 100644
--- a/src/gallium/auxiliary/vl/vp8/decodemv.c
+++ b/src/gallium/auxiliary/vl/vp8/decodemv.c
@@ -145,26 +145,26 @@ static void vp8_read_mb_features(BOOL_DECODER *bd, MB_MODE_INFO *mi, MACROBLOCKD
}
}
-static void vp8_kfread_modes(VP8D_COMP *pbi, MODE_INFO *mi, int mb_row, int mb_col)
+static void vp8_kfread_modes(VP8_COMMON *common, MODE_INFO *mi, int mb_row, int mb_col)
{
- BOOL_DECODER *const bd = &pbi->bd;
+ BOOL_DECODER *const bd = &common->bd;
MB_PREDICTION_MODE y_mode;
- const int mis = pbi->common.mode_info_stride;
+ const int mis = common->mode_info_stride;
/* 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;
- if (pbi->mb.update_mb_segmentation_map)
- vp8_read_mb_features(bd, &mi->mbmi, &pbi->mb);
+ if (common->mb.update_mb_segmentation_map)
+ vp8_read_mb_features(bd, &mi->mbmi, &common->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);
+ if (common->mb_no_coeff_skip)
+ mi->mbmi.mb_skip_coeff = vp8_read(bd, common->prob_skip_false);
else
mi->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, common->kf_ymode_prob);
mi->mbmi.ref_frame = INTRA_FRAME;
@@ -176,12 +176,12 @@ static void vp8_kfread_modes(VP8D_COMP *pbi, MODE_INFO *mi, int mb_row, int mb_c
const B_PREDICTION_MODE A = above_block_mode(mi, i, mis);
const B_PREDICTION_MODE L = left_block_mode(mi, i);
- mi->bmi[i].as_mode = (B_PREDICTION_MODE)vp8_read_bmode(bd, pbi->common.kf_bmode_prob[A][L]);
+ mi->bmi[i].as_mode = (B_PREDICTION_MODE)vp8_read_bmode(bd, 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);
+ mi->mbmi.uv_mode = (MB_PREDICTION_MODE)vp8_read_uv_mode(bd, common->kf_uv_mode_prob);
}
static unsigned int vp8_check_mv_bounds(int_mv *mv, int mb_to_left_edge,
@@ -294,26 +294,26 @@ static const unsigned char mbsplit_offset[4][16] =
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}
};
-static void mb_mode_mv_init(VP8D_COMP *pbi)
+static void mb_mode_mv_init(VP8_COMMON *common)
{
- BOOL_DECODER *const bd = &pbi->bd;
- MV_CONTEXT *const mvc = pbi->common.fc.mvc;
+ BOOL_DECODER *const bd = &common->bd;
+ MV_CONTEXT *const mvc = common->fc.mvc;
- pbi->prob_skip_false = 0;
- if (pbi->common.mb_no_coeff_skip)
- pbi->prob_skip_false = (vp8_prob)vp8_read_literal(bd, 8);
+ common->prob_skip_false = 0;
+ if (common->mb_no_coeff_skip)
+ common->prob_skip_false = (vp8_prob)vp8_read_literal(bd, 8);
- if (pbi->common.frame_type != KEY_FRAME)
+ if (common->frame_type != KEY_FRAME)
{
- pbi->prob_intra = (vp8_prob)vp8_read_literal(bd, 8);
- pbi->prob_last = (vp8_prob)vp8_read_literal(bd, 8);
- pbi->prob_gf = (vp8_prob)vp8_read_literal(bd, 8);
+ common->prob_intra = (vp8_prob)vp8_read_literal(bd, 8);
+ common->prob_last = (vp8_prob)vp8_read_literal(bd, 8);
+ common->prob_gf = (vp8_prob)vp8_read_literal(bd, 8);
if (vp8_read_bit(bd))
{
int i = 0;
do {
- pbi->common.fc.ymode_prob[i] = (vp8_prob)vp8_read_literal(bd, 8);
+ common->fc.ymode_prob[i] = (vp8_prob)vp8_read_literal(bd, 8);
}
while (++i < 4);
}
@@ -322,7 +322,7 @@ static void mb_mode_mv_init(VP8D_COMP *pbi)
{
int i = 0;
do {
- pbi->common.fc.uv_mode_prob[i] = (vp8_prob)vp8_read_literal(bd, 8);
+ common->fc.uv_mode_prob[i] = (vp8_prob)vp8_read_literal(bd, 8);
}
while (++i < 3);
}
@@ -331,12 +331,13 @@ static void mb_mode_mv_init(VP8D_COMP *pbi)
}
}
-static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
- int mb_row, int mb_col)
+static void read_mb_modes_mv(VP8_COMMON *common,
+ MODE_INFO *mi, MB_MODE_INFO *mbmi,
+ int mb_row, int mb_col)
{
- BOOL_DECODER *const bd = &pbi->bd;
- MV_CONTEXT *const mvc = pbi->common.fc.mvc;
- const int mis = pbi->common.mode_info_stride;
+ BOOL_DECODER *const bd = &common->bd;
+ MV_CONTEXT *const mvc = common->fc.mvc;
+ const int mis = common->mode_info_stride;
int_mv *const mv = &mbmi->mv;
int mb_to_left_edge;
@@ -344,8 +345,8 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
int mb_to_top_edge;
int mb_to_bottom_edge;
- mb_to_top_edge = pbi->mb.mb_to_top_edge;
- mb_to_bottom_edge = pbi->mb.mb_to_bottom_edge;
+ mb_to_top_edge = common->mb.mb_to_top_edge;
+ mb_to_bottom_edge = common->mb.mb_to_bottom_edge;
mb_to_top_edge -= LEFT_TOP_MARGIN;
mb_to_bottom_edge += RIGHT_BOTTOM_MARGIN;
@@ -354,40 +355,40 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
/* Distance of Mb to the various image edges.
* These specified to 8th pel as they are always compared to MV values that
* are in 1/8th pel units */
- pbi->mb.mb_to_left_edge =
+ common->mb.mb_to_left_edge =
mb_to_left_edge = -((mb_col * 16) << 3);
mb_to_left_edge -= LEFT_TOP_MARGIN;
- pbi->mb.mb_to_right_edge =
- mb_to_right_edge = ((pbi->common.mb_cols - 1 - mb_col) * 16) << 3;
+ common->mb.mb_to_right_edge =
+ mb_to_right_edge = ((common->mb_cols - 1 - mb_col) * 16) << 3;
mb_to_right_edge += RIGHT_BOTTOM_MARGIN;
/* If required read in new segmentation data for this MB */
- if (pbi->mb.update_mb_segmentation_map)
- vp8_read_mb_features(bd, mbmi, &pbi->mb);
+ if (common->mb.update_mb_segmentation_map)
+ vp8_read_mb_features(bd, mbmi, &common->mb);
/* Read the macroblock coeff skip flag if this feature is in use, else default to 0 */
- if (pbi->common.mb_no_coeff_skip)
- mbmi->mb_skip_coeff = vp8_read(bd, pbi->prob_skip_false);
+ if (common->mb_no_coeff_skip)
+ mbmi->mb_skip_coeff = vp8_read(bd, common->prob_skip_false);
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, common->prob_intra))) /* Inter MB */
{
int rct[4];
vp8_prob mv_ref_p[VP8_MVREFS - 1];
int_mv nearest, nearby, best_mv;
- if (vp8_read(bd, pbi->prob_last))
+ if (vp8_read(bd, common->prob_last))
{
- mbmi->ref_frame = mbmi->ref_frame + (MV_REFERENCE_FRAME)vp8_read(bd, pbi->prob_gf) + 1;
+ mbmi->ref_frame = mbmi->ref_frame + (MV_REFERENCE_FRAME)vp8_read(bd, common->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_find_near_mvs(&common->mb, mi, &nearest, &nearby, &best_mv, rct, mbmi->ref_frame, 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_clamp_mv2(&nearest, &common->mb);
+ vp8_clamp_mv2(&nearby, &common->mb);
+ vp8_clamp_mv2(&best_mv, &common->mb);
vp8_mv_ref_probs(mv_ref_p, rct);
@@ -405,9 +406,8 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
{
int_mv leftmv, abovemv;
int_mv blockmv;
- int k; /* First block in subset j */
+ int k = mbsplit_offset[s][j]; /* First block in subset j */
int mv_contz;
- k = mbsplit_offset[s][j];
leftmv.as_int = left_block_mv(mi, k);
abovemv.as_int = above_block_mv(mi, k, mis);
@@ -504,53 +504,53 @@ 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);
+ mbmi->mode = (MB_PREDICTION_MODE)vp8_read_ymode(bd, common->fc.ymode_prob);
/* MB is intra coded */
if (mbmi->mode == B_PRED)
{
int j = 0;
do {
- mi->bmi[j].as_mode = (B_PREDICTION_MODE)vp8_read_bmode(bd, pbi->common.fc.bmode_prob);
+ mi->bmi[j].as_mode = (B_PREDICTION_MODE)vp8_read_bmode(bd, common->fc.bmode_prob);
}
while (++j < 16);
}
- mbmi->uv_mode = (MB_PREDICTION_MODE)vp8_read_uv_mode(bd, pbi->common.fc.uv_mode_prob);
+ mbmi->uv_mode = (MB_PREDICTION_MODE)vp8_read_uv_mode(bd, common->fc.uv_mode_prob);
}
}
/**
*
*/
-void vp8_decode_mode_mvs(VP8D_COMP *pbi)
+void vp8_decode_mode_mvs(VP8_COMMON *common)
{
- MODE_INFO *mi = pbi->common.mi;
+ MODE_INFO *mi = common->mi;
int mb_row = -1;
- mb_mode_mv_init(pbi);
+ mb_mode_mv_init(common);
- while (++mb_row < pbi->common.mb_rows)
+ while (++mb_row < common->mb_rows)
{
int mb_col = -1;
int mb_to_top_edge;
int mb_to_bottom_edge;
- pbi->mb.mb_to_top_edge =
+ common->mb.mb_to_top_edge =
mb_to_top_edge = -((mb_row * 16)) << 3;
mb_to_top_edge -= LEFT_TOP_MARGIN;
- pbi->mb.mb_to_bottom_edge =
- mb_to_bottom_edge = ((pbi->common.mb_rows - 1 - mb_row) * 16) << 3;
+ common->mb.mb_to_bottom_edge =
+ mb_to_bottom_edge = ((common->mb_rows - 1 - mb_row) * 16) << 3;
mb_to_bottom_edge += RIGHT_BOTTOM_MARGIN;
- while (++mb_col < pbi->common.mb_cols)
+ while (++mb_col < common->mb_cols)
{
- /*read_mb_modes_mv(pbi, xd->mode_info_context, &xd->mode_info_context->mbmi, mb_row, mb_col);*/
- if (pbi->common.frame_type == KEY_FRAME)
- vp8_kfread_modes(pbi, mi, mb_row, mb_col);
+ /*read_mb_modes_mv(common, mb->mode_info_context, &mb->mode_info_context->mbmi, mb_row, mb_col);*/
+ if (common->frame_type == KEY_FRAME)
+ vp8_kfread_modes(common, mi, mb_row, mb_col);
else
- read_mb_modes_mv(pbi, mi, &mi->mbmi, mb_row, mb_col);
+ read_mb_modes_mv(common, mi, &mi->mbmi, mb_row, mb_col);
mi++; /* Next macroblock */
}
diff --git a/src/gallium/auxiliary/vl/vp8/decodemv.h b/src/gallium/auxiliary/vl/vp8/decodemv.h
index 2bd2ce874c..9cb1c35c0c 100644
--- a/src/gallium/auxiliary/vl/vp8/decodemv.h
+++ b/src/gallium/auxiliary/vl/vp8/decodemv.h
@@ -14,6 +14,6 @@
#include "vp8_decoder.h"
-void vp8_decode_mode_mvs(VP8D_COMP *);
+void vp8_decode_mode_mvs(VP8_COMMON *common);
#endif /* DECODEMV_H */
diff --git a/src/gallium/auxiliary/vl/vp8/dequantize_common.c b/src/gallium/auxiliary/vl/vp8/dequantize_common.c
index f2fc687766..384cab66a6 100644
--- a/src/gallium/auxiliary/vl/vp8/dequantize_common.c
+++ b/src/gallium/auxiliary/vl/vp8/dequantize_common.c
@@ -135,25 +135,25 @@ static int vp8_ac_uv_quant(int QIndex, int Delta)
return retval;
}
-void vp8_initialize_dequantizer(VP8_COMMON *pc)
+void vp8_initialize_dequantizer(VP8_COMMON *common)
{
int i;
int Q;
for (Q = 0; Q < QINDEX_RANGE; Q++)
{
- pc->Y1dequant[Q][0] = (short)vp8_dc_quant(Q, pc->y1dc_delta_q);
- pc->Y2dequant[Q][0] = (short)vp8_dc2quant(Q, pc->y2dc_delta_q);
- pc->UVdequant[Q][0] = (short)vp8_dc_uv_quant(Q, pc->uvdc_delta_q);
+ common->Y1dequant[Q][0] = (short)vp8_dc_quant(Q, common->y1dc_delta_q);
+ common->Y2dequant[Q][0] = (short)vp8_dc2quant(Q, common->y2dc_delta_q);
+ common->UVdequant[Q][0] = (short)vp8_dc_uv_quant(Q, common->uvdc_delta_q);
/* All the ac values = ; */
for (i = 1; i < 16; i++)
{
int rc = vp8_default_zig_zag1d[i];
- pc->Y1dequant[Q][rc] = (short)vp8_ac_yquant(Q);
- pc->Y2dequant[Q][rc] = (short)vp8_ac2quant(Q, pc->y2ac_delta_q);
- pc->UVdequant[Q][rc] = (short)vp8_ac_uv_quant(Q, pc->uvac_delta_q);
+ common->Y1dequant[Q][rc] = (short)vp8_ac_yquant(Q);
+ common->Y2dequant[Q][rc] = (short)vp8_ac2quant(Q, common->y2ac_delta_q);
+ common->UVdequant[Q][rc] = (short)vp8_ac_uv_quant(Q, common->uvac_delta_q);
}
}
}
diff --git a/src/gallium/auxiliary/vl/vp8/dequantize_common.h b/src/gallium/auxiliary/vl/vp8/dequantize_common.h
index ca575365f5..e55e9b5443 100644
--- a/src/gallium/auxiliary/vl/vp8/dequantize_common.h
+++ b/src/gallium/auxiliary/vl/vp8/dequantize_common.h
@@ -15,6 +15,6 @@
#include "blockd.h"
#include "vp8_decoder.h"
-void vp8_initialize_dequantizer(VP8_COMMON *pc);
+void vp8_initialize_dequantizer(VP8_COMMON *common);
#endif /* DEQUANTIZE_COMMON_H */
diff --git a/src/gallium/auxiliary/vl/vp8/entropy.c b/src/gallium/auxiliary/vl/vp8/entropy.c
index d6f980c1f7..e011300f29 100644
--- a/src/gallium/auxiliary/vl/vp8/entropy.c
+++ b/src/gallium/auxiliary/vl/vp8/entropy.c
@@ -128,7 +128,7 @@ void vp8_init_scan_order_mask()
}
}
-void vp8_default_coef_probs(VP8_COMMON *pc)
+void vp8_default_coef_probs(VP8_COMMON *common)
{
int h = 0;
do
@@ -143,7 +143,7 @@ void vp8_default_coef_probs(VP8_COMMON *pc)
vp8_tree_probs_from_distribution(MAX_ENTROPY_TOKENS,
vp8_coef_encodings,
vp8_coef_tree,
- pc->fc.coef_probs[h][i][k],
+ common->fc.coef_probs[h][i][k],
branch_ct,
vp8_default_coef_counts[h][i][k],
256,
diff --git a/src/gallium/auxiliary/vl/vp8/vp8_decoder.c b/src/gallium/auxiliary/vl/vp8/vp8_decoder.c
index dfefb91883..aeb3e8d4e7 100644
--- a/src/gallium/auxiliary/vl/vp8/vp8_decoder.c
+++ b/src/gallium/auxiliary/vl/vp8/vp8_decoder.c
@@ -19,15 +19,15 @@
#include "dequantize_common.h"
#include "detokenize.h"
-static int get_free_fb(VP8_COMMON *cm)
+static int get_free_fb(VP8_COMMON *common)
{
int i;
for (i = 0; i < NUM_YV12_BUFFERS; i++)
- if (cm->fb_idx_ref_cnt[i] == 0)
+ if (common->fb_idx_ref_cnt[i] == 0)
break;
assert(i < NUM_YV12_BUFFERS);
- cm->fb_idx_ref_cnt[i] = 1;
+ common->fb_idx_ref_cnt[i] = 1;
return i;
}
@@ -45,7 +45,7 @@ static void ref_cnt_fb(int *buf, int *idx, int new_idx)
/**
* If any buffer copy / swapping is signalled it should be done here.
*/
-static int swap_frame_buffers(VP8_COMMON *cm)
+static int swap_frame_buffers(VP8_COMMON *common)
{
int err = 0;
@@ -53,50 +53,50 @@ static int swap_frame_buffers(VP8_COMMON *cm)
* 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)
+ if (common->copy_buffer_to_arf)
{
int new_fb = 0;
- if (cm->copy_buffer_to_arf == 1)
- new_fb = cm->lst_fb_idx;
- else if (cm->copy_buffer_to_arf == 2)
- new_fb = cm->gld_fb_idx;
+ if (common->copy_buffer_to_arf == 1)
+ new_fb = common->lst_fb_idx;
+ else if (common->copy_buffer_to_arf == 2)
+ new_fb = common->gld_fb_idx;
else
err = -1;
- ref_cnt_fb(cm->fb_idx_ref_cnt, &cm->alt_fb_idx, new_fb);
+ ref_cnt_fb(common->fb_idx_ref_cnt, &common->alt_fb_idx, new_fb);
}
- if (cm->copy_buffer_to_gf)
+ if (common->copy_buffer_to_gf)
{
int new_fb = 0;
- if (cm->copy_buffer_to_gf == 1)
- new_fb = cm->lst_fb_idx;
- else if (cm->copy_buffer_to_gf == 2)
- new_fb = cm->alt_fb_idx;
+ if (common->copy_buffer_to_gf == 1)
+ new_fb = common->lst_fb_idx;
+ else if (common->copy_buffer_to_gf == 2)
+ new_fb = common->alt_fb_idx;
else
err = -1;
- ref_cnt_fb(cm->fb_idx_ref_cnt, &cm->gld_fb_idx, new_fb);
+ ref_cnt_fb(common->fb_idx_ref_cnt, &common->gld_fb_idx, new_fb);
}
- if (cm->refresh_golden_frame)
- ref_cnt_fb(cm->fb_idx_ref_cnt, &cm->gld_fb_idx, cm->new_fb_idx);
+ if (common->refresh_golden_frame)
+ ref_cnt_fb(common->fb_idx_ref_cnt, &common->gld_fb_idx, common->new_fb_idx);
- if (cm->refresh_alt_ref_frame)
- ref_cnt_fb(cm->fb_idx_ref_cnt, &cm->alt_fb_idx, cm->new_fb_idx);
+ if (common->refresh_alt_ref_frame)
+ ref_cnt_fb(common->fb_idx_ref_cnt, &common->alt_fb_idx, common->new_fb_idx);
- if (cm->refresh_last_frame)
+ if (common->refresh_last_frame)
{
- ref_cnt_fb(cm->fb_idx_ref_cnt, &cm->lst_fb_idx, cm->new_fb_idx);
+ ref_cnt_fb(common->fb_idx_ref_cnt, &common->lst_fb_idx, common->new_fb_idx);
- cm->frame_to_show = &cm->yv12_fb[cm->lst_fb_idx];
+ common->frame_to_show = &common->yv12_fb[common->lst_fb_idx];
}
else
- cm->frame_to_show = &cm->yv12_fb[cm->new_fb_idx];
+ common->frame_to_show = &common->yv12_fb[common->new_fb_idx];
- cm->fb_idx_ref_cnt[cm->new_fb_idx]--;
+ common->fb_idx_ref_cnt[common->new_fb_idx]--;
return err;
}
@@ -104,87 +104,86 @@ static int swap_frame_buffers(VP8_COMMON *cm)
/**
* Create a VP8 decoder instance.
*/
-VP8D_COMP *vp8_decoder_create()
+VP8_COMMON *vp8_decoder_create()
{
- VP8D_COMP *pbi = vpx_memalign(32, sizeof(VP8D_COMP));
+ VP8_COMMON *common = vpx_memalign(32, sizeof(VP8_COMMON));
- if (!pbi)
+ if (!common)
return NULL;
- memset(pbi, 0, sizeof(VP8D_COMP));
+ memset(common, 0, sizeof(VP8_COMMON));
- if (setjmp(pbi->common.error.jmp))
+ if (setjmp(common->error.jmp))
{
- pbi->common.error.setjmp = 0;
- vp8_decoder_remove(pbi);
+ common->error.setjmp = 0;
+ vp8_decoder_remove(common);
return 0;
}
- pbi->common.error.setjmp = 1;
- pbi->common.show_frame = 0;
+ common->error.setjmp = 1;
+ common->show_frame = 0;
- vp8_initialize_common();
- vp8_create_common(&pbi->common);
- vp8_initialize_dequantizer(&pbi->common);
- // vp8_loop_filter_init(&pbi->common);
+ vp8_initialize_common(common);
+ vp8_initialize_dequantizer(common);
+ //vp8_initialize_loopfilter(common);
- pbi->common.error.setjmp = 0;
+ common->error.setjmp = 0;
- return pbi;
+ return common;
}
/**
* Decode one VP8 frame.
*/
-int vp8_decoder_start(VP8D_COMP *pbi, struct pipe_vp8_picture_desc *frame_header,
+int vp8_decoder_start(VP8_COMMON *common,
+ struct pipe_vp8_picture_desc *frame_header,
const unsigned char *data, unsigned data_size)
{
- VP8_COMMON *cm = &pbi->common;
int retcode = 0;
- pbi->common.error.error_code = VPX_CODEC_OK;
+ common->error.error_code = VPX_CODEC_OK;
{
- pbi->data = data;
- pbi->data_size = data_size;
+ common->data = data;
+ common->data_size = data_size;
- cm->new_fb_idx = get_free_fb(cm);
+ common->new_fb_idx = get_free_fb(common);
- if (setjmp(pbi->common.error.jmp))
+ if (setjmp(common->error.jmp))
{
- pbi->common.error.setjmp = 0;
+ common->error.setjmp = 0;
/* We do not know if the missing frame(s) was supposed to update
* any of the reference buffers, but we act conservative and
* mark only the last buffer as corrupted. */
- cm->yv12_fb[cm->lst_fb_idx].corrupted = 1;
+ common->yv12_fb[common->lst_fb_idx].corrupted = 1;
- if (cm->fb_idx_ref_cnt[cm->new_fb_idx] > 0)
- cm->fb_idx_ref_cnt[cm->new_fb_idx]--;
+ if (common->fb_idx_ref_cnt[common->new_fb_idx] > 0)
+ common->fb_idx_ref_cnt[common->new_fb_idx]--;
return -1;
}
- pbi->common.error.setjmp = 1;
+ common->error.setjmp = 1;
}
- retcode = vp8_frame_decode(pbi, frame_header);
+ retcode = vp8_frame_decode(common, frame_header);
if (retcode < 0)
{
- pbi->common.error.error_code = VPX_CODEC_ERROR;
- pbi->common.error.setjmp = 0;
- if (cm->fb_idx_ref_cnt[cm->new_fb_idx] > 0)
- cm->fb_idx_ref_cnt[cm->new_fb_idx]--;
+ common->error.error_code = VPX_CODEC_ERROR;
+ common->error.setjmp = 0;
+ if (common->fb_idx_ref_cnt[common->new_fb_idx] > 0)
+ common->fb_idx_ref_cnt[common->new_fb_idx]--;
return retcode;
}
{
- if (swap_frame_buffers(cm))
+ if (swap_frame_buffers(common))
{
- pbi->common.error.error_code = VPX_CODEC_ERROR;
- pbi->common.error.setjmp = 0;
+ common->error.error_code = VPX_CODEC_ERROR;
+ common->error.setjmp = 0;
return -1;
}
@@ -192,16 +191,16 @@ int vp8_decoder_start(VP8D_COMP *pbi, struct pipe_vp8_picture_desc *frame_header
if (cm->filter_level)
{
// Apply the loop filter if appropriate.
- vp8_loop_filter_frame(cm, &pbi->mb);
+ vp8_loop_filter_frame(common, &mb);
}
*/
- vp8_yv12_extend_frame_borders(cm->frame_to_show);
+ vp8_yv12_extend_frame_borders(common->frame_to_show);
}
/* from libvpx : vp8_print_modes_and_motion_vectors(cm->mi, cm->mb_rows, cm->mb_cols, current_video_frame); */
- pbi->data_size = 0;
- pbi->common.error.setjmp = 0;
+ common->data_size = 0;
+ common->error.setjmp = 0;
return retcode;
}
@@ -209,22 +208,22 @@ int vp8_decoder_start(VP8D_COMP *pbi, struct pipe_vp8_picture_desc *frame_header
/**
* Return a decoded VP8 frame in a YV12 framebuffer.
*/
-int vp8_decoder_getframe(VP8D_COMP *pbi,
+int vp8_decoder_getframe(VP8_COMMON *common,
YV12_BUFFER_CONFIG *sd)
{
int ret = -1;
/* ie no raw frame to show!!! */
- if (pbi->common.show_frame == 0)
+ if (common->show_frame == 0)
return ret;
- if (pbi->common.frame_to_show)
+ if (common->frame_to_show)
{
- *sd = *pbi->common.frame_to_show;
- sd->clrtype = pbi->common.clr_type;
- sd->y_width = pbi->common.width;
- sd->y_height = pbi->common.height;
- sd->uv_height = pbi->common.height / 2;
+ *sd = *common->frame_to_show;
+ sd->clrtype = common->clr_type;
+ sd->y_width = common->width;
+ sd->y_height = common->height;
+ sd->uv_height = common->height / 2;
ret = 0;
}
@@ -235,12 +234,12 @@ int vp8_decoder_getframe(VP8D_COMP *pbi,
/**
* Destroy a VP8 decoder instance.
*/
-void vp8_decoder_remove(VP8D_COMP *pbi)
+void vp8_decoder_remove(VP8_COMMON *common)
{
- if (!pbi)
+ if (!common)
return;
- vp8_remove_common(&pbi->common);
- vpx_free(pbi->mbd);
- vpx_free(pbi);
+ vp8_dealloc_frame_buffers(common);
+ vpx_free(common->mbd);
+ vpx_free(common);
}
diff --git a/src/gallium/auxiliary/vl/vp8/vp8_decoder.h b/src/gallium/auxiliary/vl/vp8/vp8_decoder.h
index 58f9b6454e..f7f1add6f7 100644
--- a/src/gallium/auxiliary/vl/vp8/vp8_decoder.h
+++ b/src/gallium/auxiliary/vl/vp8/vp8_decoder.h
@@ -83,6 +83,14 @@ typedef struct VP8Common
{
struct vpx_internal_error_info error;
+ /* Bitstream data */
+ const unsigned char *data;
+ unsigned int data_size;
+
+ /* Boolean decoder */
+ BOOL_DECODER *mbd;
+ BOOL_DECODER bd, bd2;
+
/* Header content */
FRAME_TYPE frame_type;
int version;
@@ -108,17 +116,6 @@ typedef struct VP8Common
int refresh_alt_ref_frame; /**< Two state 0 = NO, 1 = YES */
int refresh_entropy_probs; /**< 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;
-
- int frame_flags;
- int MBs;
- int mb_rows;
- int mb_cols;
- int mode_info_stride;
/* Profile settings */
int mb_no_coeff_skip;
@@ -140,6 +137,20 @@ typedef struct VP8Common
int uvdc_delta_q;
int uvac_delta_q;
+ /* Macroblock */
+ DECLARE_ALIGNED(16, MACROBLOCKD, mb);
+
+ int MBs;
+ int mb_rows;
+ int mb_cols;
+ int mode_info_stride;
+
+ /* 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;
+
/* We allocate a MODE_INFO struct for each macroblock, together with
an extra row on top and column on the left to simplify prediction. */
@@ -151,52 +162,41 @@ typedef struct VP8Common
int ref_frame_sign_bias[MAX_REF_FRAMES]; /**< Two state 0, 1 */
+ /* keyframe block modes are predicted by their above, left neighbors */
+
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 prob_intra;
+ vp8_prob prob_last;
+ vp8_prob prob_gf;
+ vp8_prob prob_skip_false;
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 */
TOKEN_PARTITION multi_token_partition;
} VP8_COMMON;
-typedef struct
-{
- DECLARE_ALIGNED(16, MACROBLOCKD, mb);
- DECLARE_ALIGNED(16, VP8_COMMON, common);
-
- BOOL_DECODER bd, bd2;
- BOOL_DECODER *mbd;
-
- const unsigned char *data;
- unsigned int data_size;
-
- vp8_prob prob_intra;
- vp8_prob prob_last;
- vp8_prob prob_gf;
- vp8_prob prob_skip_false;
-
-} VP8D_COMP;
-
/* ************************************************************************** */
-VP8D_COMP *vp8_decoder_create();
+VP8_COMMON *vp8_decoder_create();
-int vp8_decoder_start(VP8D_COMP *pbi, struct pipe_vp8_picture_desc *frame_header,
+int vp8_decoder_start(VP8_COMMON *common,
+ struct pipe_vp8_picture_desc *frame_header,
const unsigned char *data, unsigned data_size);
-int vp8_decoder_getframe(VP8D_COMP *pbi, YV12_BUFFER_CONFIG *sd);
+int vp8_decoder_getframe(VP8_COMMON *common, YV12_BUFFER_CONFIG *sd);
-void vp8_decoder_remove(VP8D_COMP *pbi);
+void vp8_decoder_remove(VP8_COMMON *common);
-int vp8_frame_decode(VP8D_COMP *pbi, struct pipe_vp8_picture_desc *frame_header);
+int vp8_frame_decode(VP8_COMMON *common,
+ struct pipe_vp8_picture_desc *frame_header);
#ifdef __cplusplus
}