]> granicus.if.org Git - libvpx/commitdiff
Removing redundant references to VP9D_COMP struct.
authorDmitry Kovalev <dkovalev@google.com>
Tue, 25 Mar 2014 21:21:26 +0000 (14:21 -0700)
committerDmitry Kovalev <dkovalev@google.com>
Tue, 25 Mar 2014 21:21:26 +0000 (14:21 -0700)
Change-Id: I4c4772c0e6aca2c7d7085a72412ac8dba8874a3d

vp9/decoder/vp9_decodeframe.c
vp9/vp9_dx_iface.c

index 0b776c30c79666912a200411f3a92d6faba4212f..134749fe64575b5d307b0587b107309ed1997d6b 100644 (file)
@@ -619,9 +619,7 @@ static void setup_display_size(VP9_COMMON *cm, struct vp9_read_bit_buffer *rb) {
     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 apply_frame_size(VP9D_COMP *pbi, int width, int height) {
   }
 }
 
-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 @@ static void setup_frame_size_with_refs(VP9D_COMP *pbi,
     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 @@ static const uint8_t *decode_tiles(VP9D_COMP *pbi,
 
       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 @@ static const uint8_t *decode_tiles_mt(VP9D_COMP *pbi,
 
       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 @@ static size_t read_uncompressed_header(VP9D_COMP *pbi,
       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 @@ static size_t read_uncompressed_header(VP9D_COMP *pbi,
       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 @@ static size_t read_uncompressed_header(VP9D_COMP *pbi,
         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);
index 2f42a4154d2cef45e07192924bfd6e47ff578a00..7f74e5c4b0e20842c9b7c96482e466dd15fa2a6d 100644 (file)
@@ -324,6 +324,8 @@ static vpx_codec_err_t decode_one(vpx_codec_alg_priv_t *ctx,
   }
 
   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};
@@ -348,15 +350,11 @@ static vpx_codec_err_t decode_one(vpx_codec_alg_priv_t *ctx,
 #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;
@@ -653,12 +651,13 @@ static vpx_codec_err_t set_dbg_options(vpx_codec_alg_priv_t *ctx, int ctrl_id,
 
 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;
@@ -671,9 +670,8 @@ static vpx_codec_err_t get_frame_corrupted(vpx_codec_alg_priv_t *ctx,
   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;
@@ -687,10 +685,10 @@ static vpx_codec_err_t get_display_size(vpx_codec_alg_priv_t *ctx,
   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;
     }