ref: d3a2e55af41ea85be57ec68870e1ccd81cb3020d
parent: b60293e1ce9bc1b392e9e6652f17bb44bf9699b2
author: Dmitry Kovalev <dkovalev@google.com>
date: Tue Nov 26 13:52:10 EST 2013
Removing qcoeff buffers from the decoder. We only need qcoeff buffers in the encoder. Reducing TileWorkerData struct and VP9Decompressor struct sizes by 24K. Change-Id: Id148868461f7ffa3d3dd634b371503ae9c57e207
--- a/vp9/common/vp9_blockd.h
+++ b/vp9/common/vp9_blockd.h
@@ -198,7 +198,6 @@
};
struct macroblockd_plane {
- int16_t *qcoeff;
int16_t *dqcoeff;
uint16_t *eobs;
PLANE_TYPE plane_type;
--- a/vp9/decoder/vp9_decodeframe.c
+++ b/vp9/decoder/vp9_decodeframe.c
@@ -42,7 +42,6 @@
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 @@
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));
--- a/vp9/decoder/vp9_onyxd_if.c
+++ b/vp9/decoder/vp9_onyxd_if.c
@@ -113,7 +113,6 @@
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];
}
--- a/vp9/decoder/vp9_onyxd_int.h
+++ b/vp9/decoder/vp9_onyxd_int.h
@@ -22,7 +22,6 @@
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]);
--- a/vp9/encoder/vp9_block.h
+++ b/vp9/encoder/vp9_block.h
@@ -69,6 +69,7 @@
struct macroblock_plane {
DECLARE_ALIGNED(16, int16_t, src_diff[64 * 64]);
+ int16_t *qcoeff;
int16_t *coeff;
struct buf_2d src;
--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -439,7 +439,7 @@
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];
}
@@ -446,7 +446,7 @@
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 @@
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];
}
--- a/vp9/encoder/vp9_encodemb.c
+++ b/vp9/encoder/vp9_encodemb.c
@@ -136,6 +136,7 @@
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 @@
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 @@
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 @@
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;
--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -530,7 +530,7 @@
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];
}
--- a/vp9/encoder/vp9_quantize.c
+++ b/vp9/encoder/vp9_quantize.c
@@ -173,7 +173,7 @@
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);
}
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -514,11 +514,12 @@
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 @@
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 @@
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 @@
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 @@
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;
}
--- a/vp9/encoder/vp9_tokenize.c
+++ b/vp9/encoder/vp9_tokenize.c
@@ -108,7 +108,8 @@
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;
--
⑨