From: Paul Wilkins Date: Mon, 17 Sep 2018 14:28:23 +0000 (+0100) Subject: Remove multi_arf_allowed variable. X-Git-Tag: v1.8.0~327 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=32f86223ace2cc90c817f5bda197092a75dd4745;p=libvpx Remove multi_arf_allowed variable. Removes deprecated multi_arf_allowed variable and dependent code. Change-Id: Ic1cf341f807c38207e728c48a4c4442387db93ff --- diff --git a/vp9/encoder/vp9_bitstream.c b/vp9/encoder/vp9_bitstream.c index 21a68bf39..b96f59f0c 100644 --- a/vp9/encoder/vp9_bitstream.c +++ b/vp9/encoder/vp9_bitstream.c @@ -910,10 +910,6 @@ int vp9_get_refresh_mask(VP9_COMP *cpi) { } else { int arf_idx = cpi->alt_fb_idx; GF_GROUP *const gf_group = &cpi->twopass.gf_group; - if ((cpi->oxcf.pass == 2) && cpi->multi_arf_allowed) { - const GF_GROUP *const gf_group = &cpi->twopass.gf_group; - arf_idx = gf_group->arf_update_idx[gf_group->index]; - } if (cpi->multi_layer_arf) { for (arf_idx = 0; arf_idx < REF_FRAMES; ++arf_idx) { diff --git a/vp9/encoder/vp9_bitstream.h b/vp9/encoder/vp9_bitstream.h index b296560b9..1948630df 100644 --- a/vp9/encoder/vp9_bitstream.h +++ b/vp9/encoder/vp9_bitstream.h @@ -38,8 +38,8 @@ void vp9_bitstream_encode_tiles_buffer_dealloc(VP9_COMP *const cpi); void vp9_pack_bitstream(VP9_COMP *cpi, uint8_t *dest, size_t *size); static INLINE int vp9_preserve_existing_gf(VP9_COMP *cpi) { - return !cpi->multi_arf_allowed && cpi->refresh_golden_frame && - cpi->rc.is_src_frame_alt_ref && !cpi->use_svc; + return cpi->refresh_golden_frame && cpi->rc.is_src_frame_alt_ref && + !cpi->use_svc; } #ifdef __cplusplus diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c index 3241652f2..aebb62525 100644 --- a/vp9/encoder/vp9_encoder.c +++ b/vp9/encoder/vp9_encoder.c @@ -3017,10 +3017,6 @@ void update_ref_frames(VP9_COMP *cpi) { } else { /* For non key/golden frames */ if (cpi->refresh_alt_ref_frame) { int arf_idx = gf_group->top_arf_idx; - if ((cpi->oxcf.pass == 2) && cpi->multi_arf_allowed) { - const GF_GROUP *const gf_group = &cpi->twopass.gf_group; - arf_idx = gf_group->arf_update_idx[gf_group->index]; - } // Push new ARF into stack. stack_push(gf_group->arf_index_stack, cpi->alt_fb_idx, @@ -6003,7 +5999,6 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags, // will not work properly with svc. // Enable the Jingning's new "multi_layer_arf" code if "enable_auto_arf" // is greater than or equal to 2. - cpi->multi_arf_allowed = 0; if ((oxcf->pass == 2) && !cpi->use_svc && (cpi->oxcf.enable_auto_arf >= 2)) cpi->multi_layer_arf = 1; else @@ -6166,15 +6161,6 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags, cm->cur_frame = &pool->frame_bufs[cm->new_fb_idx]; - if (!cpi->use_svc && cpi->multi_arf_allowed) { - if (cm->frame_type == KEY_FRAME) { - init_buffer_indices(cpi); - } else if (oxcf->pass == 2) { - const GF_GROUP *const gf_group = &cpi->twopass.gf_group; - cpi->alt_fb_idx = gf_group->arf_ref_idx[gf_group->index]; - } - } - // Start with a 0 size frame. *size = 0; diff --git a/vp9/encoder/vp9_encoder.h b/vp9/encoder/vp9_encoder.h index b7f0d0bad..2c0635933 100644 --- a/vp9/encoder/vp9_encoder.h +++ b/vp9/encoder/vp9_encoder.h @@ -689,7 +689,6 @@ typedef struct VP9_COMP { // Indices are: max_tx_size-1, tx_size_ctx, tx_size int tx_size_cost[TX_SIZES - 1][TX_SIZE_CONTEXTS][TX_SIZES]; - int multi_arf_allowed; int multi_arf_enabled; int multi_arf_last_grp_enabled; diff --git a/vp9/encoder/vp9_firstpass.c b/vp9/encoder/vp9_firstpass.c index 6b3cb0757..43df9b70b 100644 --- a/vp9/encoder/vp9_firstpass.c +++ b/vp9/encoder/vp9_firstpass.c @@ -2571,29 +2571,25 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) { active_min_gf_interval = VPXMIN(active_min_gf_interval, rc->max_gf_interval + arf_active_or_kf); - if (cpi->multi_arf_allowed) { - active_max_gf_interval = rc->max_gf_interval; + // The value chosen depends on the active Q range. At low Q we have + // bits to spare and are better with a smaller interval and smaller boost. + // At high Q when there are few bits to spare we are better with a longer + // interval to spread the cost of the GF. + active_max_gf_interval = 12 + arf_active_or_kf + VPXMIN(4, (int_lbq / 6)); + + // We have: active_min_gf_interval <= + // rc->max_gf_interval + arf_active_or_kf. + if (active_max_gf_interval < active_min_gf_interval) { + active_max_gf_interval = active_min_gf_interval; } else { - // The value chosen depends on the active Q range. At low Q we have - // bits to spare and are better with a smaller interval and smaller boost. - // At high Q when there are few bits to spare we are better with a longer - // interval to spread the cost of the GF. - active_max_gf_interval = 12 + arf_active_or_kf + VPXMIN(4, (int_lbq / 6)); - - // We have: active_min_gf_interval <= - // rc->max_gf_interval + arf_active_or_kf. - if (active_max_gf_interval < active_min_gf_interval) { - active_max_gf_interval = active_min_gf_interval; - } else { - active_max_gf_interval = VPXMIN(active_max_gf_interval, - rc->max_gf_interval + arf_active_or_kf); - } - - // Would the active max drop us out just before the near the next kf? - if ((active_max_gf_interval <= rc->frames_to_key) && - (active_max_gf_interval >= (rc->frames_to_key - rc->min_gf_interval))) - active_max_gf_interval = rc->frames_to_key / 2; + active_max_gf_interval = VPXMIN(active_max_gf_interval, + rc->max_gf_interval + arf_active_or_kf); } + + // Would the active max drop us out just before the near the next kf? + if ((active_max_gf_interval <= rc->frames_to_key) && + (active_max_gf_interval >= (rc->frames_to_key - rc->min_gf_interval))) + active_max_gf_interval = rc->frames_to_key / 2; } i = 0; @@ -2695,11 +2691,7 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) { rc->source_alt_ref_pending = 1; // Test to see if multi arf is appropriate. - cpi->multi_arf_enabled = - (cpi->multi_arf_allowed && (rc->baseline_gf_interval >= 6) && - (zero_motion_accumulator < 0.995)) - ? 1 - : 0; + cpi->multi_arf_enabled = 0; } else { rc->gfu_boost = VPXMIN(MAX_GF_BOOST, calc_arf_boost(cpi, 0, (i - 1))); rc->source_alt_ref_pending = 0; diff --git a/vp9/encoder/vp9_temporal_filter.c b/vp9/encoder/vp9_temporal_filter.c index 571ec0f31..54c65bc33 100644 --- a/vp9/encoder/vp9_temporal_filter.c +++ b/vp9/encoder/vp9_temporal_filter.c @@ -840,8 +840,10 @@ static void adjust_arnr_filter(VP9_COMP *cpi, int distance, int group_boost, } // Adjustments for second level arf in multi arf case. - if (cpi->oxcf.pass == 2 && cpi->multi_arf_allowed) - if (gf_group->rf_level[gf_group->index] != GF_ARF_STD) strength >>= 1; + // Leave commented out place holder for possible filtering adjustment with + // new multi-layer arf code. + // if (cpi->oxcf.pass == 2 && cpi->multi_arf_allowed) + // if (gf_group->rf_level[gf_group->index] != GF_ARF_STD) strength >>= 1; // TODO(jingning): Skip temporal filtering for intermediate frames that will // be used as show_existing_frame. Need to further explore the possibility to diff --git a/vp9/vp9_cx_iface.c b/vp9/vp9_cx_iface.c index 67dbc5075..3b2d9a866 100644 --- a/vp9/vp9_cx_iface.c +++ b/vp9/vp9_cx_iface.c @@ -1099,7 +1099,7 @@ static vpx_codec_err_t encoder_encode(vpx_codec_alg_priv_t *ctx, // There's no codec control for multiple alt-refs so check the encoder // instance for its status to determine the compressed data size. data_sz = ctx->cfg.g_w * ctx->cfg.g_h * get_image_bps(img) / 8 * - (cpi->multi_arf_allowed || cpi->multi_layer_arf ? 8 : 2); + (cpi->multi_layer_arf ? 8 : 2); if (data_sz < kMinCompressedSize) data_sz = kMinCompressedSize; if (ctx->cx_data == NULL || ctx->cx_data_sz < data_sz) { ctx->cx_data_sz = data_sz;