]> granicus.if.org Git - libvpx/commitdiff
Removing qcoeff buffers from the decoder.
authorDmitry Kovalev <dkovalev@google.com>
Wed, 27 Nov 2013 02:52:10 +0000 (18:52 -0800)
committerDmitry Kovalev <dkovalev@google.com>
Wed, 27 Nov 2013 02:52:10 +0000 (18:52 -0800)
We only need qcoeff buffers in the encoder. Reducing TileWorkerData struct
and VP9Decompressor struct sizes by 24K.

Change-Id: Id148868461f7ffa3d3dd634b371503ae9c57e207

vp9/common/vp9_blockd.h
vp9/decoder/vp9_decodeframe.c
vp9/decoder/vp9_onyxd_if.c
vp9/decoder/vp9_onyxd_int.h
vp9/encoder/vp9_block.h
vp9/encoder/vp9_encodeframe.c
vp9/encoder/vp9_encodemb.c
vp9/encoder/vp9_firstpass.c
vp9/encoder/vp9_quantize.c
vp9/encoder/vp9_rdopt.c
vp9/encoder/vp9_tokenize.c

index 37da92bd3382447fc6b7ca36a62a556423fc68f2..7d21dfdc0fd52073f85b98f8e14a12790625d38e 100644 (file)
@@ -198,7 +198,6 @@ struct buf_2d {
 };
 
 struct macroblockd_plane {
-  int16_t *qcoeff;
   int16_t *dqcoeff;
   uint16_t *eobs;
   PLANE_TYPE plane_type;
index 097ffb1da8fca3a0a60bd35edb381a03ecfb9c8b..bcd51f5f8e659be78d8cf971d2c77b0c0e5a7609 100644 (file)
@@ -42,7 +42,6 @@ typedef struct TileWorkerData {
   vp9_reader bit_reader;
   DECLARE_ALIGNED(16, MACROBLOCKD, xd);
   DECLARE_ALIGNED(16, unsigned char, token_cache[1024]);
-  DECLARE_ALIGNED(16, int16_t,  qcoeff[MAX_MB_PLANE][64 * 64]);
   DECLARE_ALIGNED(16, int16_t,  dqcoeff[MAX_MB_PLANE][64 * 64]);
   DECLARE_ALIGNED(16, uint16_t, eobs[MAX_MB_PLANE][256]);
 } TileWorkerData;
@@ -952,7 +951,6 @@ static void setup_tile_macroblockd(TileWorkerData *const tile_data) {
   int i;
 
   for (i = 0; i < MAX_MB_PLANE; ++i) {
-    pd[i].qcoeff  = tile_data->qcoeff[i];
     pd[i].dqcoeff = tile_data->dqcoeff[i];
     pd[i].eobs    = tile_data->eobs[i];
     vpx_memset(xd->plane[i].dqcoeff, 0, 64 * 64 * sizeof(int16_t));
index 7c0f91d88aeebfbdb172777262df33e46366df10..740ad72cb69ded7debf4a86d7eca34758d0407bf 100644 (file)
@@ -113,7 +113,6 @@ static void init_macroblockd(VP9D_COMP *const pbi) {
   int i;
 
   for (i = 0; i < MAX_MB_PLANE; ++i) {
-    pd[i].qcoeff  = pbi->qcoeff[i];
     pd[i].dqcoeff = pbi->dqcoeff[i];
     pd[i].eobs    = pbi->eobs[i];
   }
index d3d29e98dedc1086cd7894c55a5e4e43084e796d..3d1b97b2d39703265b0b99222a605ee322db40e5 100644 (file)
@@ -22,7 +22,6 @@ typedef struct VP9Decompressor {
 
   DECLARE_ALIGNED(16, VP9_COMMON, common);
 
-  DECLARE_ALIGNED(16, int16_t,  qcoeff[MAX_MB_PLANE][64 * 64]);
   DECLARE_ALIGNED(16, int16_t,  dqcoeff[MAX_MB_PLANE][64 * 64]);
   DECLARE_ALIGNED(16, uint16_t, eobs[MAX_MB_PLANE][256]);
 
index 444597067337329fa858857426938885d732ebe5..71f7e7a52b7a9a3bb1cd2882e2f9b1371bace4c6 100644 (file)
@@ -69,6 +69,7 @@ typedef struct {
 
 struct macroblock_plane {
   DECLARE_ALIGNED(16, int16_t, src_diff[64 * 64]);
+  int16_t *qcoeff;
   int16_t *coeff;
   struct buf_2d src;
 
index 18cfddd55abc7133a7de00f4a2f77c57f20bc8ad..38c753849d547ebc62db3216d511c48b35f1ee4a 100644 (file)
@@ -439,14 +439,14 @@ static void update_state(VP9_COMP *cpi, PICK_MODE_CONTEXT *ctx,
   max_plane = is_inter_block(mbmi) ? MAX_MB_PLANE : 1;
   for (i = 0; i < max_plane; ++i) {
     p[i].coeff = ctx->coeff_pbuf[i][1];
-    pd[i].qcoeff = ctx->qcoeff_pbuf[i][1];
+    p[i].qcoeff = ctx->qcoeff_pbuf[i][1];
     pd[i].dqcoeff = ctx->dqcoeff_pbuf[i][1];
     pd[i].eobs = ctx->eobs_pbuf[i][1];
   }
 
   for (i = max_plane; i < MAX_MB_PLANE; ++i) {
     p[i].coeff = ctx->coeff_pbuf[i][2];
-    pd[i].qcoeff = ctx->qcoeff_pbuf[i][2];
+    p[i].qcoeff = ctx->qcoeff_pbuf[i][2];
     pd[i].dqcoeff = ctx->dqcoeff_pbuf[i][2];
     pd[i].eobs = ctx->eobs_pbuf[i][2];
   }
@@ -675,7 +675,7 @@ static void pick_sb_modes(VP9_COMP *cpi, const TileInfo *const tile,
 
   for (i = 0; i < MAX_MB_PLANE; ++i) {
     p[i].coeff = ctx->coeff_pbuf[i][0];
-    pd[i].qcoeff = ctx->qcoeff_pbuf[i][0];
+    p[i].qcoeff = ctx->qcoeff_pbuf[i][0];
     pd[i].dqcoeff = ctx->dqcoeff_pbuf[i][0];
     pd[i].eobs = ctx->eobs_pbuf[i][0];
   }
index bd9678afb1591294a43dc607babe0eb5ac176372..83f87b0665adcf924ade7ad091f23137c57d11ff 100644 (file)
@@ -136,6 +136,7 @@ static void optimize_b(MACROBLOCK *mb,
                        ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l,
                        TX_SIZE tx_size) {
   MACROBLOCKD *const xd = &mb->e_mbd;
+  struct macroblock_plane *p = &mb->plane[plane];
   struct macroblockd_plane *pd = &xd->plane[plane];
   const int ref = is_inter_block(&xd->mi_8x8[0]->mbmi);
   vp9_token_state tokens[1025][2];
@@ -163,7 +164,7 @@ static void optimize_b(MACROBLOCK *mb,
 
   assert((!type && !plane) || (type && plane));
   dqcoeff_ptr = BLOCK_OFFSET(pd->dqcoeff, block);
-  qcoeff_ptr = BLOCK_OFFSET(pd->qcoeff, block);
+  qcoeff_ptr = BLOCK_OFFSET(p->qcoeff, block);
   assert(eob <= default_eob);
 
   /* Now set up a Viterbi trellis to evaluate alternative roundings. */
@@ -368,7 +369,7 @@ void vp9_xform_quant(int plane, int block, BLOCK_SIZE plane_bsize,
   struct macroblock_plane *const p = &x->plane[plane];
   struct macroblockd_plane *const pd = &xd->plane[plane];
   int16_t *coeff = BLOCK_OFFSET(p->coeff, block);
-  int16_t *qcoeff = BLOCK_OFFSET(pd->qcoeff, block);
+  int16_t *qcoeff = BLOCK_OFFSET(p->qcoeff, block);
   int16_t *dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
   const scan_order *so;
   uint16_t *eob = &pd->eobs[block];
@@ -530,7 +531,7 @@ void vp9_encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
   struct macroblock_plane *const p = &x->plane[plane];
   struct macroblockd_plane *const pd = &xd->plane[plane];
   int16_t *coeff = BLOCK_OFFSET(p->coeff, block);
-  int16_t *qcoeff = BLOCK_OFFSET(pd->qcoeff, block);
+  int16_t *qcoeff = BLOCK_OFFSET(p->qcoeff, block);
   int16_t *dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
   const scan_order *so;
   TX_TYPE tx_type;
index 924f9f3246c10d93862fb5a1de0ebf531857ce5a..930e2f82b6f72944f0c9bb653eb5ccffec6f0c34 100644 (file)
@@ -530,7 +530,7 @@ void vp9_first_pass(VP9_COMP *cpi) {
 
   for (i = 0; i < MAX_MB_PLANE; ++i) {
     p[i].coeff = ctx->coeff_pbuf[i][1];
-    pd[i].qcoeff = ctx->qcoeff_pbuf[i][1];
+    p[i].qcoeff = ctx->qcoeff_pbuf[i][1];
     pd[i].dqcoeff = ctx->dqcoeff_pbuf[i][1];
     pd[i].eobs = ctx->eobs_pbuf[i][1];
   }
index d24be96f64fa35841bdd1049078bc2662fb5ecf5..698130aedfb44ae4e702e3593a3c124eb7d10a7b 100644 (file)
@@ -173,7 +173,7 @@ void vp9_regular_quantize_b_4x4(MACROBLOCK *x, int y_blocks, int b_idx,
   vp9_quantize_b(BLOCK_OFFSET(p->coeff, pb_idx.block),
            16, x->skip_block,
            p->zbin, p->round, p->quant, p->quant_shift,
-           BLOCK_OFFSET(pd->qcoeff, pb_idx.block),
+           BLOCK_OFFSET(p->qcoeff, pb_idx.block),
            BLOCK_OFFSET(pd->dqcoeff, pb_idx.block),
            pd->dequant, p->zbin_extra, &pd->eobs[pb_idx.block], scan, iscan);
 }
index 43b7d6b7c93ffd1bbfce4dcc546e71da80b15657..0c61b0d9f5296cc2277b6424381447fdf90bbead 100644 (file)
@@ -514,11 +514,12 @@ static INLINE int cost_coeffs(MACROBLOCK *x,
                               const int16_t *scan, const int16_t *nb) {
   MACROBLOCKD *const xd = &x->e_mbd;
   MB_MODE_INFO *mbmi = &xd->mi_8x8[0]->mbmi;
+  struct macroblock_plane *p = &x->plane[plane];
   struct macroblockd_plane *pd = &xd->plane[plane];
   const PLANE_TYPE type = pd->plane_type;
   const int16_t *band_count = &band_counts[tx_size][1];
   const int eob = pd->eobs[block];
-  const int16_t *const qcoeff_ptr = BLOCK_OFFSET(pd->qcoeff, block);
+  const int16_t *const qcoeff_ptr = BLOCK_OFFSET(p->qcoeff, block);
   const int ref = mbmi->ref_frame[0] != INTRA_FRAME;
   unsigned int (*token_costs)[2][PREV_COEF_CONTEXTS][MAX_ENTROPY_TOKENS] =
                    x->token_costs[tx_size][type][ref];
@@ -1380,7 +1381,7 @@ static int64_t rd_pick_intra_sbuv_mode(VP9_COMP *cpi, MACROBLOCK *x,
         struct macroblockd_plane *const pd = x->e_mbd.plane;
         for (i = 1; i < MAX_MB_PLANE; ++i) {
           p[i].coeff    = ctx->coeff_pbuf[i][2];
-          pd[i].qcoeff  = ctx->qcoeff_pbuf[i][2];
+          p[i].qcoeff  = ctx->qcoeff_pbuf[i][2];
           pd[i].dqcoeff = ctx->dqcoeff_pbuf[i][2];
           pd[i].eobs    = ctx->eobs_pbuf[i][2];
 
@@ -1390,7 +1391,7 @@ static int64_t rd_pick_intra_sbuv_mode(VP9_COMP *cpi, MACROBLOCK *x,
           ctx->eobs_pbuf[i][2]    = ctx->eobs_pbuf[i][0];
 
           ctx->coeff_pbuf[i][0]   = p[i].coeff;
-          ctx->qcoeff_pbuf[i][0]  = pd[i].qcoeff;
+          ctx->qcoeff_pbuf[i][0]  = p[i].qcoeff;
           ctx->dqcoeff_pbuf[i][0] = pd[i].dqcoeff;
           ctx->eobs_pbuf[i][0]    = pd[i].eobs;
         }
@@ -3057,7 +3058,7 @@ static void swap_block_ptr(MACROBLOCK *x, PICK_MODE_CONTEXT *ctx,
 
   for (i = 0; i < max_plane; ++i) {
     p[i].coeff    = ctx->coeff_pbuf[i][1];
-    pd[i].qcoeff  = ctx->qcoeff_pbuf[i][1];
+    p[i].qcoeff  = ctx->qcoeff_pbuf[i][1];
     pd[i].dqcoeff = ctx->dqcoeff_pbuf[i][1];
     pd[i].eobs    = ctx->eobs_pbuf[i][1];
 
@@ -3067,7 +3068,7 @@ static void swap_block_ptr(MACROBLOCK *x, PICK_MODE_CONTEXT *ctx,
     ctx->eobs_pbuf[i][1]    = ctx->eobs_pbuf[i][0];
 
     ctx->coeff_pbuf[i][0]   = p[i].coeff;
-    ctx->qcoeff_pbuf[i][0]  = pd[i].qcoeff;
+    ctx->qcoeff_pbuf[i][0]  = p[i].qcoeff;
     ctx->dqcoeff_pbuf[i][0] = pd[i].dqcoeff;
     ctx->eobs_pbuf[i][0]    = pd[i].eobs;
   }
index 3f1cc6fe865678282a5963dc5805b61a46dd8d50..1aaf72e409aa8cfc99ee6f3dcf0b23c07640a303 100644 (file)
@@ -108,7 +108,8 @@ static void tokenize_b(int plane, int block, BLOCK_SIZE plane_bsize,
   TOKENEXTRA *t = *tp;        /* store tokens starting here */
   const int eob = pd->eobs[block];
   const PLANE_TYPE type = pd->plane_type;
-  const int16_t *qcoeff_ptr = BLOCK_OFFSET(pd->qcoeff, block);
+  struct macroblock_plane *p = &cpi->mb.plane[plane];
+  const int16_t *qcoeff_ptr = BLOCK_OFFSET(p->qcoeff, block);
 
   const int segment_id = mbmi->segment_id;
   const int16_t *scan, *nb;