Commit 180acb91 authored by Brennan Shacklett's avatar Brennan Shacklett

Remove x->zcoeff_blk

This was removed in nextgenv2 and doesn't seem to have a noticeable
effect on speed anymore.

These AWCY results show a slight rate reduction on most clips by
removing it:
https://arewecompressedyet.com/?r%5B%5D=master2016-08-19T23-38-10.258Z&r%5B%5D=nozcoeff2016-08-19T23-33-12.919Z&s=objective-1-fast

Change-Id: I8f4bba091b8807a8a0828a07a4f609ec9c569508
parent 8e67697f
......@@ -126,10 +126,6 @@ struct macroblock {
int mv_row_min;
int mv_row_max;
// Notes transform blocks where no coefficents are coded.
// Set during mode selection. Read during block encoding.
uint8_t zcoeff_blk[TX_SIZES][256];
int skip;
// note that token_costs is the cost when eob node is skipped
......
......@@ -23,7 +23,6 @@ static void alloc_mode_context(AV1_COMMON *cm, int num_4x4_blk,
int i, k;
ctx->num_4x4_blk = num_blk;
CHECK_MEM_ERROR(cm, ctx->zcoeff_blk, aom_calloc(num_blk, sizeof(uint8_t)));
for (i = 0; i < MAX_MB_PLANE; ++i) {
for (k = 0; k < 3; ++k) {
CHECK_MEM_ERROR(cm, ctx->coeff[i][k],
......@@ -44,8 +43,6 @@ static void alloc_mode_context(AV1_COMMON *cm, int num_4x4_blk,
static void free_mode_context(PICK_MODE_CONTEXT *ctx) {
int i, k;
aom_free(ctx->zcoeff_blk);
ctx->zcoeff_blk = 0;
for (i = 0; i < MAX_MB_PLANE; ++i) {
for (k = 0; k < 3; ++k) {
aom_free(ctx->coeff[i][k]);
......
......@@ -27,7 +27,6 @@ struct ThreadData;
typedef struct {
MODE_INFO mic;
MB_MODE_INFO_EXT mbmi_ext;
uint8_t *zcoeff_blk;
uint8_t *color_index_map[2];
tran_low_t *coeff[MAX_MB_PLANE][3];
tran_low_t *qcoeff[MAX_MB_PLANE][3];
......
......@@ -979,8 +979,6 @@ static void update_state(const AV1_COMP *const cpi, ThreadData *td,
}
x->skip = ctx->skip;
memcpy(x->zcoeff_blk[mbmi->tx_size], ctx->zcoeff_blk,
sizeof(ctx->zcoeff_blk[0]) * ctx->num_4x4_blk);
if (!output_enabled) return;
......
......@@ -734,14 +734,6 @@ static void encode_block(int plane, int block, int blk_row, int blk_col,
a = &ctx->ta[plane][blk_col];
l = &ctx->tl[plane][blk_row];
// TODO(jingning): per transformed block zero forcing only enabled for
// luma component. will integrate chroma components as well.
if (x->zcoeff_blk[tx_size][block] && plane == 0) {
p->eobs[block] = 0;
*a = *l = 0;
return;
}
if (x->quant_fp) {
// Encoding process for rtc mode
if (x->skip_txfm[0] == SKIP_TXFM_AC_DC && plane == 0) {
......
......@@ -611,10 +611,6 @@ static void block_rd_txfm(int plane, int block, int blk_row, int blk_col,
// TODO(jingning): temporarily enabled only for luma component
rd = AOMMIN(rd1, rd2);
if (plane == 0)
x->zcoeff_blk[tx_size][block] =
!x->plane[plane].eobs[block] ||
(rd1 > rd2 && !xd->lossless[mbmi->segment_id]);
args->this_rate += rate;
args->this_dist += dist;
......@@ -682,8 +678,6 @@ static void choose_largest_tx_size(const AV1_COMP *const cpi, MACROBLOCK *x,
int s0 = av1_cost_bit(skip_prob, 0);
int s1 = av1_cost_bit(skip_prob, 1);
const int is_inter = is_inter_block(mbmi);
uint8_t zcoeff_blk[256];
int num_4x4_blks = 1 << (num_pels_log2_lookup[bs] - 4);
*distortion = INT64_MAX;
*rate = INT_MAX;
......@@ -717,10 +711,8 @@ static void choose_largest_tx_size(const AV1_COMP *const cpi, MACROBLOCK *x,
*rate = r;
*skip = s;
*sse = psse;
memcpy(zcoeff_blk, x->zcoeff_blk[mbmi->tx_size], num_4x4_blks);
}
}
memcpy(x->zcoeff_blk[mbmi->tx_size], zcoeff_blk, num_4x4_blks);
} else {
txfm_rd_in_plane(x, rate, distortion, skip, sse, ref_best_rd, 0, bs,
mbmi->tx_size, cpi->sf.use_fast_coef_costing);
......@@ -761,8 +753,6 @@ static void choose_tx_size_from_rd(const AV1_COMP *const cpi, MACROBLOCK *x,
const int tx_select = cm->tx_mode == TX_MODE_SELECT;
TX_TYPE tx_type, best_tx_type = DCT_DCT;
const int is_inter = is_inter_block(mbmi);
uint8_t zcoeff_blk[TX_SIZES][256];
int num_4x4_blks = 1 << (num_pels_log2_lookup[bs] - 4);
const aom_prob *tx_probs = get_tx_probs2(max_tx_size, xd, &cm->fc->tx_probs);
assert(skip_prob > 0);
......@@ -848,7 +838,6 @@ static void choose_tx_size_from_rd(const AV1_COMP *const cpi, MACROBLOCK *x,
*skip = s;
*psse = sse;
best_tx_type = mbmi->tx_type;
memcpy(zcoeff_blk, x->zcoeff_blk[n], num_4x4_blks);
}
}
}
......@@ -857,9 +846,6 @@ static void choose_tx_size_from_rd(const AV1_COMP *const cpi, MACROBLOCK *x,
mbmi->tx_type = best_tx_type;
if (mbmi->tx_size >= TX_32X32) assert(mbmi->tx_type == DCT_DCT);
if (best_tx < TX_SIZES)
memcpy(x->zcoeff_blk[best_tx], zcoeff_blk, num_4x4_blks);
}
static void super_block_yrd(const AV1_COMP *const cpi, MACROBLOCK *x, int *rate,
......@@ -4287,7 +4273,6 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
int_mv backup_mv = frame_mv[NEARMV][ref_frame];
MB_MODE_INFO backup_mbmi = *mbmi;
int backup_skip = x->skip;
uint8_t backup_zcoeff_blk[256];
int64_t tmp_ref_rd = this_rd;
int ref_idx;
// TODO(jingning): This should be deprecated shortly.
......@@ -4302,9 +4287,6 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
backup_fmv[0] = frame_mv[NEWMV][ref_frame];
if (comp_pred) backup_fmv[1] = frame_mv[NEWMV][second_ref_frame];
memcpy(backup_zcoeff_blk, x->zcoeff_blk[mbmi->tx_size],
sizeof(backup_zcoeff_blk[0]) * ctx->num_4x4_blk);
rate2 += cpi->drl_mode_cost[drl_ctx][0];
if (this_rd < INT64_MAX) {
......@@ -4407,13 +4389,9 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
tmp_ref_rd = tmp_alt_rd;
backup_mbmi = *mbmi;
backup_skip = x->skip;
memcpy(backup_zcoeff_blk, x->zcoeff_blk[mbmi->tx_size],
sizeof(backup_zcoeff_blk[0]) * ctx->num_4x4_blk);
} else {
*mbmi = backup_mbmi;
x->skip = backup_skip;
memcpy(x->zcoeff_blk[mbmi->tx_size], backup_zcoeff_blk,
sizeof(backup_zcoeff_blk[0]) * ctx->num_4x4_blk);
}
}
frame_mv[NEARMV][ref_frame] = backup_mv;
......@@ -4526,8 +4504,6 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
best_mode_skippable = skippable;
if (!x->select_tx_size) swap_block_ptr(x, ctx, 1, 0, 0, max_plane);
memcpy(ctx->zcoeff_blk, x->zcoeff_blk[mbmi->tx_size],
sizeof(ctx->zcoeff_blk[0]) * ctx->num_4x4_blk);
}
}
......@@ -4870,7 +4846,6 @@ void av1_rd_pick_inter_mode_sub8x8(const AV1_COMP *cpi, TileDataEnc *tile_data,
int internal_active_edge =
av1_active_edge_sb(cpi, mi_row, mi_col) && av1_internal_image_edge(cpi);
memset(x->zcoeff_blk[TX_4X4], 0, 4);
av1_zero(best_mbmode);
for (i = 0; i < 4; i++) {
......@@ -5162,7 +5137,6 @@ void av1_rd_pick_inter_mode_sub8x8(const AV1_COMP *cpi, TileDataEnc *tile_data,
tmp_best_mbmode = *mbmi;
for (i = 0; i < 4; i++) {
tmp_best_bmodes[i] = xd->mi[0]->bmi[i];
x->zcoeff_blk[TX_4X4][i] = !x->plane[0].eobs[i];
}
pred_exists = 1;
if (switchable_filter_index == 0 && sf->use_rd_breakout &&
......@@ -5306,8 +5280,6 @@ void av1_rd_pick_inter_mode_sub8x8(const AV1_COMP *cpi, TileDataEnc *tile_data,
best_mbmode = *mbmi;
best_skip2 = this_skip2;
if (!x->select_tx_size) swap_block_ptr(x, ctx, 1, 0, 0, max_plane);
memcpy(ctx->zcoeff_blk, x->zcoeff_blk[TX_4X4],
sizeof(ctx->zcoeff_blk[0]) * ctx->num_4x4_blk);
for (i = 0; i < 4; i++) best_bmodes[i] = xd->mi[0]->bmi[i];
}
......
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