Commit e0b5ae8c authored by Brennan Shacklett's avatar Brennan Shacklett Committed by Yaowu Xu

Remove multiple coefficient buffers from PICK_MODE_CONTEXT

This commit is a manual cherry-pick from aom/master:
45592a39

Only part of the changes apply in nextgenv2

Change-Id: I1e22514c6fe5af556710254278f2f8a5805db999
parent 973d4d56
...@@ -26,7 +26,7 @@ static void alloc_mode_context(AV1_COMMON *cm, int num_4x4_blk, ...@@ -26,7 +26,7 @@ static void alloc_mode_context(AV1_COMMON *cm, int num_4x4_blk,
PICK_MODE_CONTEXT *ctx) { PICK_MODE_CONTEXT *ctx) {
const int num_blk = (num_4x4_blk < 4 ? 4 : num_4x4_blk); const int num_blk = (num_4x4_blk < 4 ? 4 : num_4x4_blk);
const int num_pix = num_blk << 4; const int num_pix = num_blk << 4;
int i, k; int i;
ctx->num_4x4_blk = num_blk; ctx->num_4x4_blk = num_blk;
#if CONFIG_EXT_PARTITION_TYPES #if CONFIG_EXT_PARTITION_TYPES
ctx->partition = partition; ctx->partition = partition;
...@@ -36,16 +36,14 @@ static void alloc_mode_context(AV1_COMMON *cm, int num_4x4_blk, ...@@ -36,16 +36,14 @@ static void alloc_mode_context(AV1_COMMON *cm, int num_4x4_blk,
#if CONFIG_VAR_TX #if CONFIG_VAR_TX
CHECK_MEM_ERROR(cm, ctx->blk_skip[i], aom_calloc(num_blk, sizeof(uint8_t))); CHECK_MEM_ERROR(cm, ctx->blk_skip[i], aom_calloc(num_blk, sizeof(uint8_t)));
#endif #endif
for (k = 0; k < 3; ++k) { CHECK_MEM_ERROR(cm, ctx->coeff[i],
CHECK_MEM_ERROR(cm, ctx->coeff[i][k], aom_memalign(32, num_pix * sizeof(*ctx->coeff[i])));
aom_memalign(32, num_pix * sizeof(*ctx->coeff[i][k]))); CHECK_MEM_ERROR(cm, ctx->qcoeff[i],
CHECK_MEM_ERROR(cm, ctx->qcoeff[i][k], aom_memalign(32, num_pix * sizeof(*ctx->qcoeff[i])));
aom_memalign(32, num_pix * sizeof(*ctx->qcoeff[i][k]))); CHECK_MEM_ERROR(cm, ctx->dqcoeff[i],
CHECK_MEM_ERROR(cm, ctx->dqcoeff[i][k], aom_memalign(32, num_pix * sizeof(*ctx->dqcoeff[i])));
aom_memalign(32, num_pix * sizeof(*ctx->dqcoeff[i][k]))); CHECK_MEM_ERROR(cm, ctx->eobs[i],
CHECK_MEM_ERROR(cm, ctx->eobs[i][k], aom_memalign(32, num_blk * sizeof(*ctx->eobs[i])));
aom_memalign(32, num_blk * sizeof(*ctx->eobs[i][k])));
}
#if CONFIG_PVQ #if CONFIG_PVQ
CHECK_MEM_ERROR(cm, ctx->pvq_ref_coeff[i], CHECK_MEM_ERROR(cm, ctx->pvq_ref_coeff[i],
aom_memalign(32, num_pix * sizeof(*ctx->pvq_ref_coeff[i]))); aom_memalign(32, num_pix * sizeof(*ctx->pvq_ref_coeff[i])));
...@@ -64,26 +62,24 @@ static void alloc_mode_context(AV1_COMMON *cm, int num_4x4_blk, ...@@ -64,26 +62,24 @@ static void alloc_mode_context(AV1_COMMON *cm, int num_4x4_blk,
} }
static void free_mode_context(PICK_MODE_CONTEXT *ctx) { static void free_mode_context(PICK_MODE_CONTEXT *ctx) {
int i, k; int i;
for (i = 0; i < MAX_MB_PLANE; ++i) { for (i = 0; i < MAX_MB_PLANE; ++i) {
#if CONFIG_VAR_TX #if CONFIG_VAR_TX
aom_free(ctx->blk_skip[i]); aom_free(ctx->blk_skip[i]);
ctx->blk_skip[i] = 0; ctx->blk_skip[i] = 0;
#endif #endif
for (k = 0; k < 3; ++k) { aom_free(ctx->coeff[i]);
aom_free(ctx->coeff[i][k]); ctx->coeff[i] = 0;
ctx->coeff[i][k] = 0; aom_free(ctx->qcoeff[i]);
aom_free(ctx->qcoeff[i][k]); ctx->qcoeff[i] = 0;
ctx->qcoeff[i][k] = 0; aom_free(ctx->dqcoeff[i]);
aom_free(ctx->dqcoeff[i][k]); ctx->dqcoeff[i] = 0;
ctx->dqcoeff[i][k] = 0;
#if CONFIG_PVQ #if CONFIG_PVQ
aom_free(ctx->pvq_ref_coeff[i]); aom_free(ctx->pvq_ref_coeff[i]);
ctx->pvq_ref_coeff[i] = 0; ctx->pvq_ref_coeff[i] = 0;
#endif #endif
aom_free(ctx->eobs[i][k]); aom_free(ctx->eobs[i]);
ctx->eobs[i][k] = 0; ctx->eobs[i] = 0;
}
} }
#if CONFIG_PALETTE #if CONFIG_PALETTE
......
...@@ -35,13 +35,13 @@ typedef struct { ...@@ -35,13 +35,13 @@ typedef struct {
#endif #endif
// dual buffer pointers, 0: in use, 1: best in store // dual buffer pointers, 0: in use, 1: best in store
tran_low_t *coeff[MAX_MB_PLANE][3]; tran_low_t *coeff[MAX_MB_PLANE];
tran_low_t *qcoeff[MAX_MB_PLANE][3]; tran_low_t *qcoeff[MAX_MB_PLANE];
tran_low_t *dqcoeff[MAX_MB_PLANE][3]; tran_low_t *dqcoeff[MAX_MB_PLANE];
#if CONFIG_PVQ #if CONFIG_PVQ
tran_low_t *pvq_ref_coeff[MAX_MB_PLANE]; tran_low_t *pvq_ref_coeff[MAX_MB_PLANE];
#endif #endif
uint16_t *eobs[MAX_MB_PLANE][3]; uint16_t *eobs[MAX_MB_PLANE];
int num_4x4_blk; int num_4x4_blk;
int skip; int skip;
......
...@@ -1036,7 +1036,6 @@ static void update_state(const AV1_COMP *const cpi, ThreadData *td, ...@@ -1036,7 +1036,6 @@ static void update_state(const AV1_COMP *const cpi, ThreadData *td,
const int mis = cm->mi_stride; const int mis = cm->mi_stride;
const int mi_width = num_8x8_blocks_wide_lookup[bsize]; const int mi_width = num_8x8_blocks_wide_lookup[bsize];
const int mi_height = num_8x8_blocks_high_lookup[bsize]; const int mi_height = num_8x8_blocks_high_lookup[bsize];
int max_plane;
#if CONFIG_REF_MV #if CONFIG_REF_MV
int8_t rf_type; int8_t rf_type;
...@@ -1086,24 +1085,15 @@ static void update_state(const AV1_COMP *const cpi, ThreadData *td, ...@@ -1086,24 +1085,15 @@ static void update_state(const AV1_COMP *const cpi, ThreadData *td,
} }
} }
max_plane = is_inter_block(mbmi) ? MAX_MB_PLANE : 1; for (i = 0; i < MAX_MB_PLANE; ++i) {
for (i = 0; i < max_plane; ++i) { p[i].coeff = ctx->coeff[i];
p[i].coeff = ctx->coeff[i][1]; p[i].qcoeff = ctx->qcoeff[i];
p[i].qcoeff = ctx->qcoeff[i][1]; pd[i].dqcoeff = ctx->dqcoeff[i];
pd[i].dqcoeff = ctx->dqcoeff[i][1];
p[i].eobs = ctx->eobs[i][1];
}
for (i = max_plane; i < MAX_MB_PLANE; ++i) {
p[i].coeff = ctx->coeff[i][2];
p[i].qcoeff = ctx->qcoeff[i][2];
pd[i].dqcoeff = ctx->dqcoeff[i][2];
#if CONFIG_PVQ #if CONFIG_PVQ
pd[i].pvq_ref_coeff = ctx->pvq_ref_coeff[i]; pd[i].pvq_ref_coeff = ctx->pvq_ref_coeff[i];
#endif #endif
p[i].eobs = ctx->eobs[i][2]; p[i].eobs = ctx->eobs[i];
} }
#if CONFIG_PALETTE #if CONFIG_PALETTE
for (i = 0; i < 2; ++i) pd[i].color_index_map = ctx->color_index_map[i]; for (i = 0; i < 2; ++i) pd[i].color_index_map = ctx->color_index_map[i];
#endif // CONFIG_PALETTE #endif // CONFIG_PALETTE
...@@ -1484,10 +1474,10 @@ static void update_state_sb_supertx(const AV1_COMP *const cpi, ThreadData *td, ...@@ -1484,10 +1474,10 @@ static void update_state_sb_supertx(const AV1_COMP *const cpi, ThreadData *td,
for (i = 0; i < MAX_MB_PLANE; ++i) { for (i = 0; i < MAX_MB_PLANE; ++i) {
if (pmc != NULL) { if (pmc != NULL) {
p[i].coeff = pmc->coeff[i][1]; p[i].coeff = pmc->coeff[i];
p[i].qcoeff = pmc->qcoeff[i][1]; p[i].qcoeff = pmc->qcoeff[i];
pd[i].dqcoeff = pmc->dqcoeff[i][1]; pd[i].dqcoeff = pmc->dqcoeff[i];
p[i].eobs = pmc->eobs[i][1]; p[i].eobs = pmc->eobs[i];
} else { } else {
// These should never be used // These should never be used
p[i].coeff = NULL; p[i].coeff = NULL;
...@@ -1661,13 +1651,13 @@ static void rd_pick_sb_modes(const AV1_COMP *const cpi, TileDataEnc *tile_data, ...@@ -1661,13 +1651,13 @@ static void rd_pick_sb_modes(const AV1_COMP *const cpi, TileDataEnc *tile_data,
#endif #endif
for (i = 0; i < MAX_MB_PLANE; ++i) { for (i = 0; i < MAX_MB_PLANE; ++i) {
p[i].coeff = ctx->coeff[i][0]; p[i].coeff = ctx->coeff[i];
p[i].qcoeff = ctx->qcoeff[i][0]; p[i].qcoeff = ctx->qcoeff[i];
pd[i].dqcoeff = ctx->dqcoeff[i][0]; pd[i].dqcoeff = ctx->dqcoeff[i];
#if CONFIG_PVQ #if CONFIG_PVQ
pd[i].pvq_ref_coeff = ctx->pvq_ref_coeff[i]; pd[i].pvq_ref_coeff = ctx->pvq_ref_coeff[i];
#endif #endif
p[i].eobs = ctx->eobs[i][0]; p[i].eobs = ctx->eobs[i];
} }
#if CONFIG_PALETTE #if CONFIG_PALETTE
......
...@@ -562,13 +562,13 @@ void av1_first_pass(AV1_COMP *cpi, const struct lookahead_entry *source) { ...@@ -562,13 +562,13 @@ void av1_first_pass(AV1_COMP *cpi, const struct lookahead_entry *source) {
#endif #endif
for (i = 0; i < MAX_MB_PLANE; ++i) { for (i = 0; i < MAX_MB_PLANE; ++i) {
p[i].coeff = ctx->coeff[i][1]; p[i].coeff = ctx->coeff[i];
p[i].qcoeff = ctx->qcoeff[i][1]; p[i].qcoeff = ctx->qcoeff[i];
pd[i].dqcoeff = ctx->dqcoeff[i][1]; pd[i].dqcoeff = ctx->dqcoeff[i];
#if CONFIG_PVQ #if CONFIG_PVQ
pd[i].pvq_ref_coeff = ctx->pvq_ref_coeff[i]; pd[i].pvq_ref_coeff = ctx->pvq_ref_coeff[i];
#endif #endif
p[i].eobs = ctx->eobs[i][1]; p[i].eobs = ctx->eobs[i];
} }
av1_init_mv_probs(cm); av1_init_mv_probs(cm);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment