ref: 6f139773a24fc5560a155d156a698e6aa5f1c345
parent: 94800ae0ceae43188fbaeefa78c5e8649171f833
parent: 9366624cc418d4e122aa32d21598ed51a3c022c1
author: Dmitry Kovalev <dkovalev@google.com>
date: Tue Mar 25 12:56:33 EDT 2014
Merge "Removing redundant references to VP9D_COMP struct."
--- a/vp9/decoder/vp9_decodeframe.c
+++ b/vp9/decoder/vp9_decodeframe.c
@@ -619,9 +619,7 @@
read_frame_size(rb, &cm->display_width, &cm->display_height);
}
-static void apply_frame_size(VP9D_COMP *pbi, int width, int height) {
- VP9_COMMON *cm = &pbi->common;
-
+static void apply_frame_size(VP9_COMMON *cm, int width, int height) {
if (cm->width != width || cm->height != height) {
// Change in frame size.
// TODO(agrange) Don't test width/height, check overall size.
@@ -648,18 +646,15 @@
}
}
-static void setup_frame_size(VP9D_COMP *pbi,
- struct vp9_read_bit_buffer *rb) {
+static void setup_frame_size(VP9_COMMON *cm, struct vp9_read_bit_buffer *rb) {
int width, height;
read_frame_size(rb, &width, &height);
- apply_frame_size(pbi, width, height);
- setup_display_size(&pbi->common, rb);
+ apply_frame_size(cm, width, height);
+ setup_display_size(cm, rb);
}
-static void setup_frame_size_with_refs(VP9D_COMP *pbi,
+static void setup_frame_size_with_refs(VP9_COMMON *cm,
struct vp9_read_bit_buffer *rb) {
- VP9_COMMON *const cm = &pbi->common;
-
int width, height;
int found = 0, i;
for (i = 0; i < REFS_PER_FRAME; ++i) {
@@ -679,13 +674,12 @@
vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME,
"Referenced frame with invalid size");
- apply_frame_size(pbi, width, height);
+ apply_frame_size(cm, width, height);
setup_display_size(cm, rb);
}
-static void setup_tile_context(VP9D_COMP *const pbi, MACROBLOCKD *const xd,
+static void setup_tile_context(VP9_COMMON *cm, MACROBLOCKD *const xd,
int tile_row, int tile_col) {
- VP9_COMMON *const cm = &pbi->common;
int i;
for (i = 0; i < MAX_MB_PLANE; ++i)
@@ -849,7 +843,7 @@
vp9_tile_init(&tile, cm, tile_row, col);
setup_token_decoder(buf->data, data_end, buf->size, &cm->error, &r);
- setup_tile_context(pbi, xd, tile_row, col);
+ setup_tile_context(cm, xd, tile_row, col);
decode_tile(pbi, &tile, &r);
if (last_tile)
@@ -997,7 +991,7 @@
setup_token_decoder(buf->data, data_end, buf->size, &cm->error,
&tile_data->bit_reader);
- setup_tile_context(pbi, &tile_data->xd, 0, buf->col);
+ setup_tile_context(cm, &tile_data->xd, 0, buf->col);
setup_tile_macroblockd(tile_data);
worker->had_error = 0;
@@ -1114,7 +1108,7 @@
cm->frame_refs[i].buf = get_frame_new_buffer(cm);
}
- setup_frame_size(pbi, rb);
+ setup_frame_size(cm, rb);
} else {
cm->intra_only = cm->show_frame ? 0 : vp9_rb_read_bit(rb);
@@ -1125,7 +1119,7 @@
check_sync_code(cm, rb);
pbi->refresh_frame_flags = vp9_rb_read_literal(rb, REF_FRAMES);
- setup_frame_size(pbi, rb);
+ setup_frame_size(cm, rb);
} else {
pbi->refresh_frame_flags = vp9_rb_read_literal(rb, REF_FRAMES);
@@ -1137,7 +1131,7 @@
cm->ref_frame_sign_bias[LAST_FRAME + i] = vp9_rb_read_bit(rb);
}
- setup_frame_size_with_refs(pbi, rb);
+ setup_frame_size_with_refs(cm, rb);
cm->allow_high_precision_mv = vp9_rb_read_bit(rb);
cm->interp_filter = read_interp_filter(rb);
--- a/vp9/vp9_dx_iface.c
+++ b/vp9/vp9_dx_iface.c
@@ -325,6 +325,8 @@
}
if (!res && ctx->pbi) {
+ VP9D_COMP *const pbi = ctx->pbi;
+ VP9_COMMON *const cm = &pbi->common;
YV12_BUFFER_CONFIG sd;
int64_t time_stamp = 0, time_end_stamp = 0;
vp9_ppflags_t flags = {0};
@@ -349,15 +351,11 @@
#endif
}
- if (vp9_receive_compressed_data(ctx->pbi, data_sz, data, deadline)) {
- VP9D_COMP *pbi = (VP9D_COMP*)ctx->pbi;
- res = update_error_state(ctx, &pbi->common.error);
- }
+ if (vp9_receive_compressed_data(pbi, data_sz, data, deadline))
+ res = update_error_state(ctx, &cm->error);
- if (!res && 0 == vp9_get_raw_frame(ctx->pbi, &sd, &time_stamp,
+ if (!res && 0 == vp9_get_raw_frame(pbi, &sd, &time_stamp,
&time_end_stamp, &flags)) {
- VP9D_COMP *const pbi = (VP9D_COMP*)ctx->pbi;
- VP9_COMMON *const cm = &pbi->common;
yuvconfig2image(&ctx->img, &sd, user_priv);
ctx->img.fb_priv = cm->frame_bufs[cm->new_fb_idx].raw_frame_buffer.priv;
@@ -654,12 +652,13 @@
static vpx_codec_err_t get_last_ref_updates(vpx_codec_alg_priv_t *ctx,
int ctrl_id, va_list args) {
- int *update_info = va_arg(args, int *);
- VP9D_COMP *pbi = (VP9D_COMP*)ctx->pbi;
+ int *const update_info = va_arg(args, int *);
if (update_info) {
- *update_info = pbi->refresh_frame_flags;
-
+ if (ctx->pbi)
+ *update_info = ctx->pbi->refresh_frame_flags;
+ else
+ return VPX_CODEC_ERROR;
return VPX_CODEC_OK;
} else {
return VPX_CODEC_INVALID_PARAM;
@@ -672,9 +671,8 @@
int *corrupted = va_arg(args, int *);
if (corrupted) {
- VP9D_COMP *pbi = (VP9D_COMP*)ctx->pbi;
- if (pbi)
- *corrupted = pbi->common.frame_to_show->corrupted;
+ if (ctx->pbi)
+ *corrupted = ctx->pbi->common.frame_to_show->corrupted;
else
return VPX_CODEC_ERROR;
return VPX_CODEC_OK;
@@ -688,10 +686,10 @@
int *const display_size = va_arg(args, int *);
if (display_size) {
- const VP9D_COMP *const pbi = (VP9D_COMP*)ctx->pbi;
- if (pbi) {
- display_size[0] = pbi->common.display_width;
- display_size[1] = pbi->common.display_height;
+ if (ctx->pbi) {
+ const VP9_COMMON *const cm = &ctx->pbi->common;
+ display_size[0] = cm->display_width;
+ display_size[1] = cm->display_height;
} else {
return VPX_CODEC_ERROR;
}
--
⑨