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/common/entropymode.c b/av1/common/entropymode.c index 51bbea7..3a3764d 100644 --- a/av1/common/entropymode.c +++ b/av1/common/entropymode.c
@@ -1086,10 +1086,8 @@ // Features disabled, 0, with delta coding (Default state). av1_clearall_segfeatures(&cm->seg); - cm->current_frame_seg_map = cm->cur_frame->seg_map; - - if (cm->current_frame_seg_map) - memset(cm->current_frame_seg_map, 0, (cm->mi_rows * cm->mi_cols)); + if (cm->cur_frame->seg_map) + memset(cm->cur_frame->seg_map, 0, (cm->mi_rows * cm->mi_cols)); // reset mode ref deltas av1_set_default_ref_deltas(cm->cur_frame->ref_deltas); @@ -1099,7 +1097,6 @@ av1_default_coef_probs(cm); init_mode_probs(cm->fc); av1_init_mv_probs(cm); - av1_init_lv_map(cm); cm->fc->initialized = 1; av1_setup_frame_contexts(cm);
diff --git a/av1/common/onyxc_int.h b/av1/common/onyxc_int.h index 117afb6..d6f7e66 100644 --- a/av1/common/onyxc_int.h +++ b/av1/common/onyxc_int.h
@@ -194,13 +194,6 @@ InternalFrameBufferList int_frame_buffers; } BufferPool; -typedef struct { - int base_ctx_table[2 /*row*/][2 /*col*/][3 /*sig_map*/] - [BASE_CONTEXT_POSITION_NUM + 1]; -} LV_MAP_CTX_TABLE; -typedef int BASE_CTX_TABLE[2 /*col*/][3 /*sig_map*/] - [BASE_CONTEXT_POSITION_NUM + 1]; - typedef struct BitstreamLevel { uint8_t major; uint8_t minor; @@ -337,8 +330,6 @@ int height; int render_width; int render_height; - int last_width; - int last_height; int timing_info_present; aom_timing_info_t timing_info; int buffer_removal_time_present; @@ -348,7 +339,6 @@ uint32_t frame_presentation_time; int largest_tile_id; - size_t largest_tile_size; int context_update_tile_id; // Scale of the current frame with respect to itself. @@ -375,8 +365,6 @@ // decoded) in the buffer pool 'cm->buffer_pool'. int new_fb_idx; - FRAME_TYPE last_frame_type; /* last frame's frame type for motion search.*/ - int show_frame; int showable_frame; // frame can be used as show existing frame in future int show_existing_frame; @@ -384,7 +372,6 @@ int is_reference_frame; int reset_decoder_state; - uint8_t last_intra_only; uint8_t disable_cdf_update; int allow_high_precision_mv; int cur_frame_force_integer_mv; // 0 the default in AOM, 1 only integer @@ -465,8 +452,6 @@ int allow_ref_frame_mvs; uint8_t *last_frame_seg_map; - uint8_t *current_frame_seg_map; - int seg_map_alloc_size; InterpFilter interp_filter; @@ -509,13 +494,10 @@ int fb_of_context_type[REF_FRAMES]; int primary_ref_frame; - aom_bit_depth_t dequant_bit_depth; // bit_depth of current dequantizer - int error_resilient_mode; int force_primary_ref_none; int tile_cols, tile_rows; - int last_tile_cols, last_tile_rows; int max_tile_width_sb; int min_log2_tile_cols; @@ -556,7 +538,6 @@ int ref_frame_id[REF_FRAMES]; int valid_for_referencing[REF_FRAMES]; int invalid_delta_frame_id_minus_1; - LV_MAP_CTX_TABLE coeff_ctx_table; TPL_MV_REF *tpl_mvs; int tpl_mvs_mem_size; // TODO(jingning): This can be combined with sign_bias later.
diff --git a/av1/common/pred_common.h b/av1/common/pred_common.h index f667057..4ddb843 100644 --- a/av1/common/pred_common.h +++ b/av1/common/pred_common.h
@@ -48,16 +48,16 @@ int prev_l = -1; // left segment_id int prev_u = -1; // top segment_id if ((xd->up_available) && (xd->left_available)) { - prev_ul = get_segment_id(cm, cm->current_frame_seg_map, BLOCK_4X4, - mi_row - 1, mi_col - 1); + prev_ul = get_segment_id(cm, cm->cur_frame->seg_map, BLOCK_4X4, mi_row - 1, + mi_col - 1); } if (xd->up_available) { - prev_u = get_segment_id(cm, cm->current_frame_seg_map, BLOCK_4X4, - mi_row - 1, mi_col - 0); + prev_u = get_segment_id(cm, cm->cur_frame->seg_map, BLOCK_4X4, mi_row - 1, + mi_col - 0); } if (xd->left_available) { - prev_l = get_segment_id(cm, cm->current_frame_seg_map, BLOCK_4X4, - mi_row - 0, mi_col - 1); + prev_l = get_segment_id(cm, cm->cur_frame->seg_map, BLOCK_4X4, mi_row - 0, + mi_col - 1); } // Pick CDF index based on number of matching/out-of-bounds segment IDs.
diff --git a/av1/common/tile_common.h b/av1/common/tile_common.h index aa94a4b..7f9544d 100644 --- a/av1/common/tile_common.h +++ b/av1/common/tile_common.h
@@ -25,7 +25,6 @@ typedef struct TileInfo { int mi_row_start, mi_row_end; int mi_col_start, mi_col_end; - int tg_horz_boundary; int tile_row; int tile_col; } TileInfo;
diff --git a/av1/common/txb_common.c b/av1/common/txb_common.c index c96d37c..cb92bd8 100644 --- a/av1/common/txb_common.c +++ b/av1/common/txb_common.c
@@ -453,23 +453,6 @@ av1_nz_map_ctx_offset_64x32, // TX_64x16 }; -void av1_init_lv_map(AV1_COMMON *cm) { - LV_MAP_CTX_TABLE *coeff_ctx_table = &cm->coeff_ctx_table; - for (int row = 0; row < 2; ++row) { - for (int col = 0; col < 2; ++col) { - for (int sig_mag = 0; sig_mag < 3; ++sig_mag) { - for (int count = 0; count < BASE_CONTEXT_POSITION_NUM + 1; ++count) { - if (row == 0 && col == 0 && count > 5) continue; - if ((row == 0 || col == 0) && count > 8) continue; - - coeff_ctx_table->base_ctx_table[row][col][sig_mag][count] = - get_base_ctx_from_count_mag(row, col, count, sig_mag); - } - } - } - } -} - const int16_t k_eob_group_start[12] = { 0, 1, 2, 3, 5, 9, 17, 33, 65, 129, 257, 513 }; const int16_t k_eob_offset_bits[12] = { 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
diff --git a/av1/common/txb_common.h b/av1/common/txb_common.h index 698e95b..533103d 100644 --- a/av1/common/txb_common.h +++ b/av1/common/txb_common.h
@@ -421,6 +421,4 @@ #undef MAX_TX_SIZE_UNIT } -void av1_init_lv_map(AV1_COMMON *cm); - #endif // AOM_AV1_COMMON_TXB_COMMON_H_
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c index 9a1c457..9cf967d 100644 --- a/av1/decoder/decodeframe.c +++ b/av1/decoder/decodeframe.c
@@ -2238,7 +2238,6 @@ cm->v_dc_delta_q = 0; cm->v_ac_delta_q = 0; } - cm->dequant_bit_depth = seq_params->bit_depth; cm->using_qmatrix = aom_rb_read_bit(rb); if (cm->using_qmatrix) { cm->qm_y = aom_rb_read_literal(rb, QM_LEVEL_BITS); @@ -4794,9 +4793,6 @@ "No sequence header"); } - cm->last_frame_type = current_frame->frame_type; - cm->last_intra_only = current_frame->intra_only; - // NOTE: By default all coded frames to be used as a reference cm->is_reference_frame = 1; @@ -5499,8 +5495,6 @@ cm->setup_mi(cm); - cm->current_frame_seg_map = cm->cur_frame->seg_map; - av1_setup_motion_field(cm); av1_setup_block_planes(xd, cm->seq_params.subsampling_x,
diff --git a/av1/decoder/decodemv.c b/av1/decoder/decodemv.c index 7a94717..febee86 100644 --- a/av1/decoder/decodemv.c +++ b/av1/decoder/decodemv.c
@@ -299,7 +299,7 @@ for (int y = 0; y < y_mis; y++) for (int x = 0; x < x_mis; x++) - cm->current_frame_seg_map[mi_offset + y * cm->mi_cols + x] = segment_id; + cm->cur_frame->seg_map[mi_offset + y * cm->mi_cols + x] = segment_id; } static int read_intra_segment_id(AV1_COMMON *const cm, @@ -355,7 +355,7 @@ if (!seg->enabled) return 0; // Default for disabled segmentation if (!seg->update_map) { - copy_segment_id(cm, cm->last_frame_seg_map, cm->current_frame_seg_map, + copy_segment_id(cm, cm->last_frame_seg_map, cm->cur_frame->seg_map, mi_offset, x_mis, y_mis); return get_predicted_segment_id(cm, mi_offset, x_mis, y_mis); }
diff --git a/av1/decoder/decoder.c b/av1/decoder/decoder.c index 773305d..8ac836f 100644 --- a/av1/decoder/decoder.c +++ b/av1/decoder/decoder.c
@@ -108,7 +108,6 @@ pbi->common.buffer_pool = pool; cm->seq_params.bit_depth = AOM_BITS_8; - cm->dequant_bit_depth = AOM_BITS_8; cm->alloc_mi = av1_dec_alloc_mi; cm->free_mi = dec_free_mi; @@ -541,10 +540,6 @@ } // Update progress in frame parallel decode. - cm->last_width = cm->width; - cm->last_height = cm->height; - cm->last_tile_cols = cm->tile_cols; - cm->last_tile_rows = cm->tile_rows; cm->error.setjmp = 0; return 0;
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;