Remove NO_FRAME_CONTEXT_SIGNALING config flag This tool is fully adopted. Change-Id: I3387f94008ef766abc60bd053936278610ff3bb1
diff --git a/av1/common/entropymode.c b/av1/common/entropymode.c index 4f69ddb..6d04efd 100644 --- a/av1/common/entropymode.c +++ b/av1/common/entropymode.c
@@ -1165,23 +1165,12 @@ } void av1_setup_frame_contexts(AV1_COMMON *cm) { -#if CONFIG_NO_FRAME_CONTEXT_SIGNALING // Store the frame context into a special slot (not associated with any // reference buffer), so that we can set up cm->pre_fc correctly later // This function must ONLY be called when cm->fc has been initialized with // default probs, either by av1_setup_past_independence or after manually // initializing them cm->frame_contexts[FRAME_CONTEXT_DEFAULTS] = *cm->fc; -#else - if (cm->frame_type == KEY_FRAME || cm->error_resilient_mode || - cm->reset_frame_context == RESET_FRAME_CONTEXT_ALL) { - // Reset all frame contexts. - for (int i = 0; i < FRAME_CONTEXTS; ++i) cm->frame_contexts[i] = *cm->fc; - } else if (cm->reset_frame_context == RESET_FRAME_CONTEXT_CURRENT) { - // Reset only the frame context specified in the frame header. - cm->frame_contexts[cm->frame_context_idx] = *cm->fc; - } -#endif // CONFIG_NO_FRAME_CONTEXT_SIGNALING } void av1_setup_past_independence(AV1_COMMON *cm) { @@ -1222,7 +1211,4 @@ if (frame_is_intra_only(cm) && cm->prev_mip) memset(cm->prev_mip, 0, cm->mi_stride * cm->mi_rows * sizeof(*cm->prev_mip)); -#if !CONFIG_NO_FRAME_CONTEXT_SIGNALING - cm->frame_context_idx = 0; -#endif // !CONFIG_NO_FRAME_CONTEXT_SIGNALING }
diff --git a/av1/common/onyxc_int.h b/av1/common/onyxc_int.h index 47d3cbd..9227f4e 100644 --- a/av1/common/onyxc_int.h +++ b/av1/common/onyxc_int.h
@@ -69,18 +69,11 @@ #define FRAME_ID_LENGTH 15 #define DELTA_FRAME_ID_LENGTH 14 -#if CONFIG_NO_FRAME_CONTEXT_SIGNALING #define FRAME_CONTEXTS (FRAME_BUFFERS + 1) // Extra frame context which is always kept at default values #define FRAME_CONTEXT_DEFAULTS (FRAME_CONTEXTS - 1) #define PRIMARY_REF_BITS 3 #define PRIMARY_REF_NONE 7 -#else - -#define FRAME_CONTEXTS_LOG2 3 - -#define FRAME_CONTEXTS (1 << FRAME_CONTEXTS_LOG2) -#endif // CONFIG_NO_FRAME_CONTEXT_SIGNALING #define NUM_PING_PONG_BUFFERS 2 @@ -96,14 +89,6 @@ REFERENCE_MODES = 3, } REFERENCE_MODE; -#if !CONFIG_NO_FRAME_CONTEXT_SIGNALING -typedef enum { - RESET_FRAME_CONTEXT_NONE = 0, - RESET_FRAME_CONTEXT_CURRENT = 1, - RESET_FRAME_CONTEXT_ALL = 2, -} RESET_FRAME_CONTEXT_MODE; -#endif - typedef enum { /** * Frame context updates are disabled @@ -326,11 +311,6 @@ int allow_interintra_compound; int allow_masked_compound; -#if !CONFIG_NO_FRAME_CONTEXT_SIGNALING - // Flag signaling which frame contexts should be reset to default values. - RESET_FRAME_CONTEXT_MODE reset_frame_context; -#endif - // MBs, mb_rows/cols is in 16-pixel units; mi_rows/cols is in // MODE_INFO (8-pixel) units. int MBs; @@ -461,10 +441,8 @@ FRAME_CONTEXT *frame_contexts; // FRAME_CONTEXTS FRAME_CONTEXT *pre_fc; // Context referenced in this frame unsigned int frame_context_idx; /* Context to use/update */ -#if CONFIG_NO_FRAME_CONTEXT_SIGNALING int fb_of_context_type[REF_FRAMES]; int primary_ref_frame; -#endif FRAME_COUNTS counts; unsigned int frame_offset;
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c index 48a11a6..8307cfd 100644 --- a/av1/decoder/decodeframe.c +++ b/av1/decoder/decodeframe.c
@@ -2604,10 +2604,6 @@ pbi->need_resync = 0; } -#if !CONFIG_NO_FRAME_CONTEXT_SIGNALING - cm->reset_frame_context = RESET_FRAME_CONTEXT_ALL; -#endif // !CONFIG_NO_FRAME_CONTEXT_SIGNALING - cm->cur_frame->intra_only = 1; if (cm->seq_params.frame_id_numbers_present_flag) { @@ -2815,9 +2811,7 @@ #if CONFIG_FRAME_REFS_SIGNALING cm->frame_refs_short_signaling = 0; #endif // CONFIG_FRAME_REFS_SIGNALING -#if CONFIG_NO_FRAME_CONTEXT_SIGNALING cm->primary_ref_frame = PRIMARY_REF_NONE; -#endif // CONFIG_NO_FRAME_CONTEXT_SIGNALING #if CONFIG_EXPLICIT_ORDER_HINT cm->frame_offset = @@ -2892,28 +2886,6 @@ #endif // CONFIG_EXPLICIT_ORDER_HINT if (cm->intra_only || cm->error_resilient_mode) cm->use_prev_frame_mvs = 0; -#if CONFIG_NO_FRAME_CONTEXT_SIGNALING -// The only way to reset all frame contexts to their default values is with a -// keyframe. -#else - if (cm->error_resilient_mode) { - cm->reset_frame_context = RESET_FRAME_CONTEXT_ALL; - } else { - if (cm->intra_only) { - cm->reset_frame_context = aom_rb_read_bit(rb) - ? RESET_FRAME_CONTEXT_ALL - : RESET_FRAME_CONTEXT_CURRENT; - } else { - cm->reset_frame_context = aom_rb_read_bit(rb) - ? RESET_FRAME_CONTEXT_CURRENT - : RESET_FRAME_CONTEXT_NONE; - if (cm->reset_frame_context == RESET_FRAME_CONTEXT_CURRENT) - cm->reset_frame_context = aom_rb_read_bit(rb) - ? RESET_FRAME_CONTEXT_ALL - : RESET_FRAME_CONTEXT_CURRENT; - } - } -#endif if (cm->intra_only) { #if CONFIG_FILM_GRAIN @@ -3102,11 +3074,6 @@ } else { cm->refresh_frame_context = REFRESH_FRAME_CONTEXT_DISABLED; } -#if !CONFIG_NO_FRAME_CONTEXT_SIGNALING - // This flag will be overridden by the call to av1_setup_past_independence - // below, forcing the use of context 0 for those frame types. - cm->frame_context_idx = aom_rb_read_literal(rb, FRAME_CONTEXTS_LOG2); -#else if (!cm->error_resilient_mode && !frame_is_intra_only(cm)) { cm->primary_ref_frame = aom_rb_read_literal(rb, PRIMARY_REF_BITS); if (cm->primary_ref_frame != PRIMARY_REF_NONE && @@ -3116,7 +3083,6 @@ "frame context is unavailable."); } } -#endif // Generate next_ref_frame_map. lock_buffer_pool(pool); @@ -3168,9 +3134,7 @@ if (frame_is_intra_only(cm) || cm->error_resilient_mode) { av1_setup_past_independence(cm); av1_setup_frame_contexts(cm); - } -#if CONFIG_NO_FRAME_CONTEXT_SIGNALING - else if (cm->primary_ref_frame == PRIMARY_REF_NONE) { + } else if (cm->primary_ref_frame == PRIMARY_REF_NONE) { // The default coefficient CDFs depend on base_qindex. So, in order to // ensure that we don't depend on the frame decoding order, we explicitly // reset the coefficient CDFs with the value of base_qindex for this frame. @@ -3178,7 +3142,6 @@ av1_default_coef_probs(cm); cm->frame_contexts[FRAME_CONTEXT_DEFAULTS] = *cm->fc; } -#endif // CONFIG_NO_FRAME_CONTEXT_SIGNALING setup_segmentation(cm, rb); @@ -3436,17 +3399,9 @@ *p_data_end = data + aom_rb_bytes_read(&rb); #if CONFIG_FWD_KF if (cm->reset_decoder_state) { -#if CONFIG_NO_FRAME_CONTEXT_SIGNALING // Use the default frame context values. *cm->fc = cm->frame_contexts[FRAME_CONTEXT_DEFAULTS]; cm->pre_fc = &cm->frame_contexts[FRAME_CONTEXT_DEFAULTS]; -#else - // NOTE: cm->frame_context_idx has been set to zero in - // av1_setup_past_independence(). - assert(cm->frame_context_idx == 0); - *cm->fc = cm->frame_contexts[cm->frame_context_idx]; - cm->pre_fc = &cm->frame_contexts[cm->frame_context_idx]; -#endif // CONFIG_NO_FRAME_CONTEXT_SIGNALING if (!cm->fc->initialized) aom_internal_error(&cm->error, AOM_CODEC_CORRUPT_FRAME, "Uninitialized entropy context."); @@ -3464,7 +3419,6 @@ av1_setup_motion_field(cm); av1_setup_block_planes(xd, cm->subsampling_x, cm->subsampling_y, num_planes); -#if CONFIG_NO_FRAME_CONTEXT_SIGNALING if (cm->primary_ref_frame == PRIMARY_REF_NONE) { // use the default frame context values *cm->fc = cm->frame_contexts[FRAME_CONTEXT_DEFAULTS]; @@ -3473,10 +3427,6 @@ *cm->fc = cm->frame_contexts[cm->frame_refs[cm->primary_ref_frame].idx]; cm->pre_fc = &cm->frame_contexts[cm->frame_refs[cm->primary_ref_frame].idx]; } -#else - *cm->fc = cm->frame_contexts[cm->frame_context_idx]; - cm->pre_fc = &cm->frame_contexts[cm->frame_context_idx]; -#endif // CONFIG_NO_FRAME_CONTEXT_SIGNALING if (!cm->fc->initialized) aom_internal_error(&cm->error, AOM_CODEC_CORRUPT_FRAME, "Uninitialized entropy context."); @@ -3580,11 +3530,6 @@ // Non frame parallel update frame context here. if (!cm->large_scale_tile) { -#if CONFIG_NO_FRAME_CONTEXT_SIGNALING cm->frame_contexts[cm->new_fb_idx] = *cm->fc; -#else - if (!cm->error_resilient_mode) - cm->frame_contexts[cm->frame_context_idx] = *cm->fc; -#endif } }
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c index bfc6734..96c0dd0 100644 --- a/av1/encoder/bitstream.c +++ b/av1/encoder/bitstream.c
@@ -3084,10 +3084,8 @@ if (cm->allow_screen_content_tools && (av1_superres_unscaled(cm) || !NO_FILTER_FOR_IBC)) aom_wb_write_bit(wb, cm->allow_intrabc); -#if CONFIG_NO_FRAME_CONTEXT_SIGNALING // all eight fbs are refreshed, pick one that will live long enough cm->fb_of_context_type[REGULAR_FRAME] = 0; -#endif } else { #if CONFIG_EXPLICIT_ORDER_HINT // Write all ref frame order hints if error_resilient_mode == 1 @@ -3106,16 +3104,7 @@ #endif // CONFIG_EXPLICIT_ORDER_HINT if (cm->frame_type == INTRA_ONLY_FRAME) { -#if !CONFIG_NO_FRAME_CONTEXT_SIGNALING - if (!cm->error_resilient_mode) { - if (cm->intra_only) { - aom_wb_write_bit(wb, - cm->reset_frame_context == RESET_FRAME_CONTEXT_ALL); - } - } -#endif cpi->refresh_frame_mask = get_refresh_mask(cpi); -#if CONFIG_NO_FRAME_CONTEXT_SIGNALING int updated_fb = -1; for (int i = 0; i < REF_FRAMES; i++) { // If more than one frame is refreshed, it doesn't matter which one @@ -3127,7 +3116,6 @@ } assert(updated_fb >= 0); cm->fb_of_context_type[cm->frame_context_idx] = updated_fb; -#endif if (cm->intra_only) { aom_wb_write_literal(wb, cpi->refresh_frame_mask, REF_FRAMES); write_frame_size(cm, frame_size_override_flag, wb); @@ -3140,22 +3128,11 @@ } else if (cm->frame_type == INTER_FRAME || cm->frame_type == S_FRAME) { MV_REFERENCE_FRAME ref_frame; -#if !CONFIG_NO_FRAME_CONTEXT_SIGNALING - if (!cm->error_resilient_mode) { - aom_wb_write_bit(wb, - cm->reset_frame_context != RESET_FRAME_CONTEXT_NONE); - if (cm->reset_frame_context != RESET_FRAME_CONTEXT_NONE) - aom_wb_write_bit(wb, - cm->reset_frame_context == RESET_FRAME_CONTEXT_ALL); - } -#endif - if (cm->frame_type == INTER_FRAME) { cpi->refresh_frame_mask = get_refresh_mask(cpi); aom_wb_write_literal(wb, cpi->refresh_frame_mask, REF_FRAMES); } -#if CONFIG_NO_FRAME_CONTEXT_SIGNALING int updated_fb = -1; for (int i = 0; i < REF_FRAMES; i++) { // If more than one frame is refreshed, it doesn't matter which one @@ -3169,7 +3146,6 @@ if (updated_fb >= 0) { cm->fb_of_context_type[cm->frame_context_idx] = updated_fb; } -#endif if (!cpi->refresh_frame_mask) { // NOTE: "cpi->refresh_frame_mask == 0" indicates that the coded frame @@ -3258,13 +3234,9 @@ aom_wb_write_bit( wb, cm->refresh_frame_context == REFRESH_FRAME_CONTEXT_DISABLED); } -#if !CONFIG_NO_FRAME_CONTEXT_SIGNALING - aom_wb_write_literal(wb, cm->frame_context_idx, FRAME_CONTEXTS_LOG2); -#else if (!cm->error_resilient_mode && !frame_is_intra_only(cm)) { aom_wb_write_literal(wb, cm->primary_ref_frame, PRIMARY_REF_BITS); } -#endif #if CONFIG_TILE_INFO_FIRST write_tile_info(cm, saved_wb, wb); #endif // CONFIG_TILE_INFO_FIRST
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c index 12e3b79..363a449 100644 --- a/av1/encoder/encoder.c +++ b/av1/encoder/encoder.c
@@ -306,18 +306,14 @@ if (cm->prev_frame) cm->last_frame_seg_map = cm->prev_frame->seg_map; cm->current_frame_seg_map = cm->cur_frame->seg_map; #endif -#if CONFIG_NO_FRAME_CONTEXT_SIGNALING cm->primary_ref_frame = PRIMARY_REF_NONE; -#endif // CONFIG_NO_FRAME_CONTEXT_SIGNALING if (frame_is_intra_only(cm) || cm->error_resilient_mode) { av1_setup_past_independence(cm); -#if CONFIG_NO_FRAME_CONTEXT_SIGNALING for (int i = 0; i < REF_FRAMES; i++) { cm->fb_of_context_type[i] = -1; } cm->fb_of_context_type[REGULAR_FRAME] = get_ref_frame_map_idx(cpi, GOLDEN_FRAME); -#endif } else if (!cm->large_scale_tile) { // for large scale tile we leave the default PRIMARY_REF_NONE const GF_GROUP *gf_group = &cpi->twopass.gf_group; @@ -333,7 +329,6 @@ cm->frame_context_idx = BRF_FRAME; else cm->frame_context_idx = REGULAR_FRAME; -#if CONFIG_NO_FRAME_CONTEXT_SIGNALING int wanted_fb = cm->fb_of_context_type[cm->frame_context_idx]; for (int ref_frame = LAST_FRAME; ref_frame <= ALTREF_FRAME; ref_frame++) { int fb = get_ref_frame_map_idx(cpi, ref_frame); @@ -341,7 +336,6 @@ cm->primary_ref_frame = ref_frame - LAST_FRAME; } } -#endif } if (cm->frame_type == KEY_FRAME) { @@ -350,13 +344,8 @@ av1_zero(cpi->interp_filter_selected); set_sb_size(&cm->seq_params, select_sb_size(cpi)); set_use_reference_buffer(cm, 0); -#if CONFIG_NO_FRAME_CONTEXT_SIGNALING cm->pre_fc = &cm->frame_contexts[FRAME_CONTEXT_DEFAULTS]; -#else - cm->pre_fc = &cm->frame_contexts[cm->frame_context_idx]; -#endif // CONFIG_NO_FRAME_CONTEXT_SIGNALING } else { -#if CONFIG_NO_FRAME_CONTEXT_SIGNALING if (cm->primary_ref_frame == PRIMARY_REF_NONE || cm->frame_refs[cm->primary_ref_frame].idx < 0) { *cm->fc = cm->frame_contexts[FRAME_CONTEXT_DEFAULTS]; @@ -369,10 +358,6 @@ cm->pre_fc = &cm->frame_contexts[cm->frame_refs[cm->primary_ref_frame].idx]; } -#else - *cm->fc = cm->frame_contexts[cm->frame_context_idx]; - cm->pre_fc = &cm->frame_contexts[cm->frame_context_idx]; -#endif // CONFIG_NO_FRAME_CONTEXT_SIGNALING av1_zero(cpi->interp_filter_selected[0]); } @@ -2476,10 +2461,6 @@ if (oxcf->large_scale_tile) cm->refresh_frame_context = REFRESH_FRAME_CONTEXT_DISABLED; -#if !CONFIG_NO_FRAME_CONTEXT_SIGNALING - cm->reset_frame_context = RESET_FRAME_CONTEXT_NONE; -#endif - if (x->palette_buffer == NULL) { CHECK_MEM_ERROR(cm, x->palette_buffer, aom_memalign(16, sizeof(*x->palette_buffer))); @@ -4476,15 +4457,12 @@ if (frame_is_intra_only(cm) || cm->error_resilient_mode) { av1_default_coef_probs(cm); av1_setup_frame_contexts(cm); - } -#if CONFIG_NO_FRAME_CONTEXT_SIGNALING - else if (cm->primary_ref_frame == PRIMARY_REF_NONE || - cm->frame_refs[cm->primary_ref_frame].idx < 0) { + } else if (cm->primary_ref_frame == PRIMARY_REF_NONE || + cm->frame_refs[cm->primary_ref_frame].idx < 0) { *cm->fc = cm->frame_contexts[FRAME_CONTEXT_DEFAULTS]; av1_default_coef_probs(cm); cm->frame_contexts[FRAME_CONTEXT_DEFAULTS] = *cm->fc; } -#endif // Variance adaptive and in frame q adjustment experiments are mutually // exclusive. @@ -5051,21 +5029,7 @@ // The alternate reference frame cannot be active for a key frame. cpi->rc.source_alt_ref_active = 0; - cm->error_resilient_mode = oxcf->error_resilient_mode; - -#if !CONFIG_NO_FRAME_CONTEXT_SIGNALING - // By default, encoder assumes decoder can use prev_mi. - if (cm->error_resilient_mode) { - cm->reset_frame_context = RESET_FRAME_CONTEXT_NONE; - cm->refresh_frame_context = REFRESH_FRAME_CONTEXT_DISABLED; - } else if (cm->intra_only) { - // Only reset the current context. - cm->reset_frame_context = RESET_FRAME_CONTEXT_CURRENT; - } - if (cpi->oxcf.large_scale_tile) - cm->refresh_frame_context = REFRESH_FRAME_CONTEXT_DISABLED; -#endif // !CONFIG_NO_FRAME_CONTEXT_SIGNALING } if (cpi->oxcf.mtu == 0) { cm->num_tg = cpi->oxcf.num_tile_groups; @@ -5848,10 +5812,7 @@ else cpi->multi_arf_allowed = 0; -// Normal defaults -#if !CONFIG_NO_FRAME_CONTEXT_SIGNALING - cm->reset_frame_context = RESET_FRAME_CONTEXT_NONE; -#endif + // Normal defaults cm->refresh_frame_context = (oxcf->error_resilient_mode || oxcf->frame_parallel_decoding_mode) ? REFRESH_FRAME_CONTEXT_DISABLED @@ -6180,12 +6141,7 @@ #endif if (!cm->large_scale_tile) { -#if CONFIG_NO_FRAME_CONTEXT_SIGNALING cm->frame_contexts[cm->new_fb_idx] = *cm->fc; -#else - if (!cm->error_resilient_mode) - cm->frame_contexts[cm->frame_context_idx] = *cm->fc; -#endif // CONFIG_NO_FRAME_CONTEXT_SIGNALING } #define EXT_TILE_DEBUG 0
diff --git a/build/cmake/aom_config_defaults.cmake b/build/cmake/aom_config_defaults.cmake index 980c8a5..4088628 100644 --- a/build/cmake/aom_config_defaults.cmake +++ b/build/cmake/aom_config_defaults.cmake
@@ -110,7 +110,6 @@ set(CONFIG_LOWPRECISION_BLEND 1 CACHE NUMBER "AV1 experiment flag.") set(CONFIG_MAX_TILE 1 CACHE NUMBER "AV1 experiment flag.") set(CONFIG_MONO_VIDEO 1 CACHE NUMBER "AV1 experiment flag.") -set(CONFIG_NO_FRAME_CONTEXT_SIGNALING 1 CACHE NUMBER "AV1 experiment flag.") set(CONFIG_OBU_FRAME 1 CACHE NUMBER "AV1 experiment flag.") set(CONFIG_OBU_NO_IVF 0 CACHE NUMBER "AV1 experiment flag.") set(CONFIG_OBU_REDUNDANT_FRAME_HEADER 0 CACHE NUMBER "AV1 experiment flag.")