Remove unused variables from AV1_COMMON & AV1_COMP
Remove a number of variables from AV1_COMMON and AV1_COMP which were
* Never used
* Assigned to but never read
* Assigned and read but had no effect
* Duplicates of other variables
This forms part of wider restructuring and refactoring in order to
achieve a clean API separation at the entry to the low-level encoder.
BUG=aomedia:2244
Change-Id: I874e4cb2a050cf1b477b1999de7b1484aa0d0216
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index df79b79..cf5bba7 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -460,7 +460,7 @@
// changing from lossless to lossy.
assert(is_inter_block(mbmi) || !cpi->has_lossless_segment);
- set_spatial_segment_id(cm, cm->current_frame_seg_map, mbmi->sb_type, mi_row,
+ set_spatial_segment_id(cm, cm->cur_frame->seg_map, mbmi->sb_type, mi_row,
mi_col, pred);
set_spatial_segment_id(cm, cpi->segmentation_map, mbmi->sb_type, mi_row,
mi_col, pred);
@@ -473,7 +473,7 @@
av1_neg_interleave(mbmi->segment_id, pred, seg->last_active_segid + 1);
aom_cdf_prob *pred_cdf = segp->spatial_pred_seg_cdf[cdf_num];
aom_write_symbol(w, coded_id, pred_cdf, MAX_SEGMENTS);
- set_spatial_segment_id(cm, cm->current_frame_seg_map, mbmi->sb_type, mi_row,
+ set_spatial_segment_id(cm, cm->cur_frame->seg_map, mbmi->sb_type, mi_row,
mi_col, mbmi->segment_id);
}
@@ -925,7 +925,7 @@
write_segment_id(cpi, mbmi, w, seg, segp, mi_row, mi_col, 0);
}
if (pred_flag) {
- set_spatial_segment_id(cm, cm->current_frame_seg_map, mbmi->sb_type,
+ set_spatial_segment_id(cm, cm->cur_frame->seg_map, mbmi->sb_type,
mi_row, mi_col, mbmi->segment_id);
}
} else {
@@ -3270,7 +3270,7 @@
write_tx_mode(cm, &cm->tx_mode, wb);
- if (cpi->allow_comp_inter_inter) {
+ if (!frame_is_intra_only(cm)) {
const int use_hybrid_pred =
current_frame->reference_mode == REFERENCE_MODE_SELECT;
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index d32be49..9ce494a 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -5834,7 +5834,6 @@
cm->last_frame_seg_map = cm->prev_frame->seg_map;
else
cm->last_frame_seg_map = NULL;
- cm->current_frame_seg_map = cm->cur_frame->seg_map;
if (cm->allow_intrabc || cm->coded_lossless) {
av1_set_default_ref_deltas(cm->lf.ref_deltas);
av1_set_default_mode_deltas(cm->lf.mode_deltas);
@@ -5995,9 +5994,6 @@
check_skip_mode_enabled(cpi);
{
- struct aom_usec_timer emr_timer;
- aom_usec_timer_start(&emr_timer);
-
#if CONFIG_FP_MB_STATS
if (cpi->use_fp_mb_stats) {
input_fpmb_stats(&cpi->twopass.firstpass_mb_stats, cm,
@@ -6019,9 +6015,6 @@
else
encode_tiles(cpi);
}
-
- aom_usec_timer_mark(&emr_timer);
- cpi->time_encode_sb_row += aom_usec_timer_elapsed(&emr_timer);
}
// If intrabc is allowed but never selected, reset the allow_intrabc flag.
@@ -6075,8 +6068,6 @@
(void)num_planes;
#endif
- cpi->allow_comp_inter_inter = !frame_is_intra_only(cm);
-
if (cpi->sf.frame_parameter_update) {
int i;
RD_OPT *const rd_opt = &cpi->rd;
@@ -6098,7 +6089,7 @@
/* prediction (compound, single or hybrid) mode selection */
// NOTE: "is_alt_ref" is true only for OVERLAY/INTNL_OVERLAY frames
- if (is_alt_ref || !cpi->allow_comp_inter_inter)
+ if (is_alt_ref || frame_is_intra_only(cm))
current_frame->reference_mode = SINGLE_REFERENCE;
else
current_frame->reference_mode = REFERENCE_MODE_SELECT;
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c
index d15ea10..312d836 100644
--- a/av1/encoder/encoder.c
+++ b/av1/encoder/encoder.c
@@ -809,7 +809,7 @@
static void update_reference_segmentation_map(AV1_COMP *cpi) {
AV1_COMMON *const cm = &cpi->common;
MB_MODE_INFO **mi_4x4_ptr = cm->mi_grid_visible;
- uint8_t *cache_ptr = cm->current_frame_seg_map;
+ uint8_t *cache_ptr = cm->cur_frame->seg_map;
int row, col;
for (row = 0; row < cm->mi_rows; row++) {
@@ -981,7 +981,6 @@
cpi->remapped_ref_idx[fb_idx] = fb_idx;
cpi->rate_index = 0;
cpi->rate_size = 0;
- cpi->cur_poc = -1;
}
static INLINE int does_level_match(int width, int height, double fps,
@@ -5129,9 +5128,6 @@
*frame_flags = cpi->frame_flags & ~FRAMEFLAGS_KEY;
- // Update the frame type
- cm->last_frame_type = current_frame->frame_type;
-
// Since we allocate a spot for the OVERLAY frame in the gf group, we need
// to do post-encoding update accordingly.
if (cpi->rc.is_src_frame_alt_ref) {
@@ -5241,9 +5237,6 @@
return AOM_CODEC_ERROR;
}
- cm->last_tile_cols = cm->tile_cols;
- cm->last_tile_rows = cm->tile_rows;
-
#ifdef OUTPUT_YUV_SKINMAP
if (cpi->common.current_frame.frame_number > 1) {
av1_compute_skin_map(cpi, yuv_skinmap_file);
@@ -5332,7 +5325,7 @@
if (cm->seg.update_map) {
update_reference_segmentation_map(cpi);
} else if (cm->last_frame_seg_map) {
- memcpy(cm->current_frame_seg_map, cm->last_frame_seg_map,
+ memcpy(cm->cur_frame->seg_map, cm->last_frame_seg_map,
cm->mi_cols * cm->mi_rows * sizeof(uint8_t));
}
}
@@ -5367,8 +5360,6 @@
else
cpi->frame_flags &= ~FRAMEFLAGS_BWDREF;
- cm->last_frame_type = current_frame->frame_type;
-
av1_rc_postencode_update(cpi, *size);
if (current_frame->frame_type == KEY_FRAME) {
@@ -5399,13 +5390,6 @@
++current_frame->frame_number;
}
- // NOTE: Shall not refer to any frame not used as reference.
- if (cm->is_reference_frame) {
- // keep track of the last coded dimensions
- cm->last_width = cm->width;
- cm->last_height = cm->height;
- }
-
return AOM_CODEC_OK;
}
@@ -6858,7 +6842,6 @@
cpi->common.current_frame_id = -1;
}
- cpi->cur_poc++;
if (oxcf->pass != 1 && cpi->common.allow_screen_content_tools &&
!frame_is_intra_only(cm)) {
if (cpi->common.seq_params.force_integer_mv == 2) {
diff --git a/av1/encoder/encoder.h b/av1/encoder/encoder.h
index 35567e2..f824af0 100644
--- a/av1/encoder/encoder.h
+++ b/av1/encoder/encoder.h
@@ -288,7 +288,6 @@
int max_threads;
aom_fixed_buf_t two_pass_stats_in;
- struct aom_codec_pkt_list *output_pkt_list;
#if CONFIG_FP_MB_STATS
aom_fixed_buf_t firstpass_mb_stats_in;
@@ -304,15 +303,12 @@
int color_range;
int render_width;
int render_height;
- aom_timing_info_type_t timing_info_type;
int timing_info_present;
aom_timing_info_t timing_info;
int decoder_model_info_present_flag;
int display_model_info_present_flag;
int buffer_removal_time_present;
aom_dec_model_info_t buffer_model;
- aom_dec_model_op_parameters_t op_params[MAX_NUM_OPERATING_POINTS + 1];
- aom_op_timing_info_t op_frame_timing[MAX_NUM_OPERATING_POINTS + 1];
int film_grain_test_vector;
const char *film_grain_table_filename;
@@ -618,7 +614,6 @@
int rate_index;
hash_table *previous_hash_table;
int previous_index;
- int cur_poc; // DebugInfo
unsigned int row_mt;
int scaled_ref_idx[INTER_REFS_PER_FRAME];
@@ -726,7 +721,6 @@
unsigned int max_mv_magnitude;
int mv_step_param;
- int allow_comp_inter_inter;
int all_one_sided_refs;
uint8_t *segmentation_map;
@@ -740,7 +734,6 @@
uint64_t time_receive_data;
uint64_t time_compress_data;
uint64_t time_pick_lpf;
- uint64_t time_encode_sb_row;
#if CONFIG_FP_MB_STATS
int use_fp_mb_stats;
@@ -804,7 +797,6 @@
int allocated_tiles; // Keep track of memory allocated for tiles.
TOKENEXTRA *tile_tok[MAX_TILE_ROWS][MAX_TILE_COLS];
- unsigned int tok_count[MAX_TILE_ROWS][MAX_TILE_COLS];
TOKENLIST *tplist[MAX_TILE_ROWS][MAX_TILE_COLS];
TileBufferEnc tile_buffers[MAX_TILE_ROWS][MAX_TILE_COLS];
@@ -812,7 +804,6 @@
int resize_state;
int resize_avg_qp;
int resize_buffer_underflow;
- int resize_count;
// Sequence parameters have been transmitted already and locked
// or not. Once locked av1_change_config cannot change the seq
@@ -833,7 +824,6 @@
int arf_pos_in_gf[MAX_EXT_ARFS + 1];
int arf_pos_for_ovrly[MAX_EXT_ARFS + 1];
int global_motion_search_done;
- tran_low_t *tcoeff_buf[MAX_MB_PLANE];
int extra_arf_allowed;
// A flag to indicate if intrabc is ever used in current frame.
int intrabc_used;
@@ -842,11 +832,6 @@
int dv_joint_cost[MV_JOINTS];
int has_lossless_segment;
- // For frame refs short signaling:
- // A mapping of each reference frame from its encoder side value to the
- // decoder side value obtained following the short signaling procedure.
- int ref_conv[REF_FRAMES];
-
// Factors to control gating of compound type selection based on best
// approximate rd so far
int max_comp_type_rd_threshold_mul;
diff --git a/av1/encoder/encodetxb.c b/av1/encoder/encodetxb.c
index a0c6ec1..4c2f825 100644
--- a/av1/encoder/encodetxb.c
+++ b/av1/encoder/encodetxb.c
@@ -1763,10 +1763,9 @@
assert(width == (1 << bwl));
const int tx_type_cost = get_tx_type_cost(cm, x, xd, plane, tx_size, tx_type);
TxbInfo txb_info = {
- qcoeff, levels, dqcoeff, tcoeff, dequant, shift,
- tx_size, txs_ctx, tx_type, bwl, width, height,
- eob, seg_eob, scan_order, txb_ctx, rdmult, &cm->coeff_ctx_table,
- iqmatrix, tx_type_cost,
+ qcoeff, levels, dqcoeff, tcoeff, dequant, shift, tx_size,
+ txs_ctx, tx_type, bwl, width, height, eob, seg_eob,
+ scan_order, txb_ctx, rdmult, iqmatrix, tx_type_cost,
};
// Hash based trellis (hbt) speed feature: avoid expensive optimize_txb calls
diff --git a/av1/encoder/encodetxb.h b/av1/encoder/encodetxb.h
index 4ee41ce..bfc49de 100644
--- a/av1/encoder/encodetxb.h
+++ b/av1/encoder/encodetxb.h
@@ -42,7 +42,6 @@
const SCAN_ORDER *scan_order;
TXB_CTX *txb_ctx;
int64_t rdmult;
- const LV_MAP_CTX_TABLE *coeff_ctx_table;
const qm_val_t *iqmatrix;
int tx_type_cost;
} TxbInfo;
diff --git a/av1/encoder/firstpass.c b/av1/encoder/firstpass.c
index 5117c67..7d3163d 100644
--- a/av1/encoder/firstpass.c
+++ b/av1/encoder/firstpass.c
@@ -589,7 +589,6 @@
}
av1_init_mv_probs(cm);
- av1_init_lv_map(cm);
av1_initialize_rd_consts(cpi);
// Tiling is ignored in the first pass.
diff --git a/av1/encoder/firstpass.h b/av1/encoder/firstpass.h
index 7c40615..388a45c 100644
--- a/av1/encoder/firstpass.h
+++ b/av1/encoder/firstpass.h
@@ -122,9 +122,6 @@
#endif // USE_SYMM_MULTI_LAYER
unsigned char brf_src_offset[MAX_STATIC_GF_GROUP_LENGTH + 1];
unsigned char bidir_pred_enabled[MAX_STATIC_GF_GROUP_LENGTH + 1];
- unsigned char ref_fb_idx_map[MAX_STATIC_GF_GROUP_LENGTH + 1][REF_FRAMES];
- unsigned char refresh_idx[MAX_STATIC_GF_GROUP_LENGTH + 1];
- unsigned char refresh_flag[MAX_STATIC_GF_GROUP_LENGTH + 1];
int bit_allocation[MAX_STATIC_GF_GROUP_LENGTH + 1];
} GF_GROUP;
diff --git a/av1/encoder/ratectrl.h b/av1/encoder/ratectrl.h
index ea8975d..36c386a 100644
--- a/av1/encoder/ratectrl.h
+++ b/av1/encoder/ratectrl.h
@@ -94,7 +94,6 @@
int last_kf_qindex; // Q index of the last key frame coded.
int gfu_boost;
- int last_boost;
int kf_boost;
double rate_correction_factors[RATE_FACTOR_LEVELS];
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index 8047f61..964d5f7 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -11130,7 +11130,7 @@
const int comp_pred = ref_frame[1] > INTRA_FRAME;
if (comp_pred) {
- if (!cpi->allow_comp_inter_inter) return 1;
+ if (frame_is_intra_only(cm)) return 1;
if (current_frame->reference_mode == SINGLE_REFERENCE) return 1;