Remove config flag CONFIG_LOOPFILTER_LEVEL This tool is fully adopted. Change-Id: I3a84dbd20a93874345cfed8a3410cda30269214e
diff --git a/av1/common/av1_loopfilter.c b/av1/common/av1_loopfilter.c index 2c31bf9..f4868fe 100644 --- a/av1/common/av1_loopfilter.c +++ b/av1/common/av1_loopfilter.c
@@ -21,7 +21,6 @@ #include "av1/common/reconinter.h" #include "av1/common/seg_common.h" -#if CONFIG_LOOPFILTER_LEVEL static const SEG_LVL_FEATURES seg_lvl_lf_lut[MAX_MB_PLANE][2] = { { SEG_LVL_ALT_LF_Y_V, SEG_LVL_ALT_LF_Y_H }, { SEG_LVL_ALT_LF_U, SEG_LVL_ALT_LF_U }, @@ -33,7 +32,6 @@ { 0, 1 }, { 2, 2 }, { 3, 3 } }; #endif // CONFIG_EXT_DELTA_Q -#endif // CONFIG_LOOPFILTER_LEVEL extern void aom_highbd_lpf_horizontal_6_c(uint16_t *s, int p, const uint8_t *blimit, @@ -300,13 +298,10 @@ #if CONFIG_EXT_DELTA_Q static uint8_t get_filter_level(const AV1_COMMON *cm, const loop_filter_info_n *lfi_n, -#if CONFIG_LOOPFILTER_LEVEL const int dir_idx, int plane, -#endif const MB_MODE_INFO *mbmi) { const int segment_id = mbmi->segment_id; if (cm->delta_lf_present_flag) { -#if CONFIG_LOOPFILTER_LEVEL int delta_lf; if (cm->delta_lf_multi) { const int delta_lf_idx = delta_lf_id_lut[plane][dir_idx]; @@ -316,23 +311,12 @@ } int lvl_seg = clamp(delta_lf + cm->lf.filter_level[dir_idx], 0, MAX_LOOP_FILTER); -#else - int lvl_seg = clamp(mbmi->current_delta_lf_from_base + cm->lf.filter_level, - 0, MAX_LOOP_FILTER); -#endif -#if CONFIG_LOOPFILTER_LEVEL assert(plane >= 0 && plane <= 2); const int seg_lf_feature_id = seg_lvl_lf_lut[plane][dir_idx]; if (segfeature_active(&cm->seg, segment_id, seg_lf_feature_id)) { const int data = get_segdata(&cm->seg, segment_id, seg_lf_feature_id); lvl_seg = clamp(lvl_seg + data, 0, MAX_LOOP_FILTER); } -#else - if (segfeature_active(&cm->seg, segment_id, SEG_LVL_ALT_LF)) { - const int data = get_segdata(&cm->seg, segment_id, SEG_LVL_ALT_LF); - lvl_seg = clamp(lvl_seg + data, 0, MAX_LOOP_FILTER); - } -#endif // CONFIG_LOOPFILTER_LEVEL if (cm->lf.mode_ref_delta_enabled) { const int scale = 1 << (lvl_seg >> 5); @@ -343,12 +327,8 @@ } return lvl_seg; } else { -#if CONFIG_LOOPFILTER_LEVEL return lfi_n ->lvl[segment_id][dir_idx][mbmi->ref_frame[0]][mode_lf_lut[mbmi->mode]]; -#else - return lfi_n->lvl[segment_id][mbmi->ref_frame[0]][mode_lf_lut[mbmi->mode]]; -#endif } } #else @@ -375,12 +355,7 @@ } void av1_loop_filter_frame_init(AV1_COMMON *cm, int default_filt_lvl, - int default_filt_lvl_r -#if CONFIG_LOOPFILTER_LEVEL - , - int plane -#endif -) { + int default_filt_lvl_r, int plane) { int seg_id; // n_shift is the multiplier for lf_deltas // the multiplier is 1 for when filter_lvl is between 0 and 31; @@ -398,31 +373,19 @@ for (seg_id = 0; seg_id < MAX_SEGMENTS; seg_id++) { for (int dir = 0; dir < 2; ++dir) { int lvl_seg = (dir == 0) ? default_filt_lvl : default_filt_lvl_r; -#if CONFIG_LOOPFILTER_LEVEL assert(plane >= 0 && plane <= 2); const int seg_lf_feature_id = seg_lvl_lf_lut[plane][dir]; if (segfeature_active(seg, seg_id, seg_lf_feature_id)) { const int data = get_segdata(&cm->seg, seg_id, seg_lf_feature_id); lvl_seg = clamp(lvl_seg + data, 0, MAX_LOOP_FILTER); } -#else - if (segfeature_active(seg, seg_id, SEG_LVL_ALT_LF)) { - const int data = get_segdata(seg, seg_id, SEG_LVL_ALT_LF); - lvl_seg = clamp(lvl_seg + data, 0, MAX_LOOP_FILTER); - } -#endif // CONFIG_LOOPFILTER_LEVEL if (!lf->mode_ref_delta_enabled) { -// we could get rid of this if we assume that deltas are set to -// zero when not in use; encoder always uses deltas -#if CONFIG_LOOPFILTER_LEVEL + // we could get rid of this if we assume that deltas are set to + // zero when not in use; encoder always uses deltas memset(lfi->lvl[seg_id][dir], lvl_seg, sizeof(lfi->lvl[seg_id][dir])); -#else - memset(lfi->lvl[seg_id], lvl_seg, sizeof(lfi->lvl[seg_id])); -#endif // CONFIG_LOOPFILTER_LEVEL } else { int ref, mode; -#if CONFIG_LOOPFILTER_LEVEL const int scale = 1 << (lvl_seg >> 5); const int intra_lvl = lvl_seg + lf->ref_deltas[INTRA_FRAME] * scale; lfi->lvl[seg_id][dir][INTRA_FRAME][0] = @@ -436,19 +399,6 @@ clamp(inter_lvl, 0, MAX_LOOP_FILTER); } } -#else - const int scale = 1 << (default_filt_lvl >> 5); - const int intra_lvl = lvl_seg + lf->ref_deltas[INTRA_FRAME] * scale; - lfi->lvl[seg_id][INTRA_FRAME][0] = clamp(intra_lvl, 0, MAX_LOOP_FILTER); - - for (ref = LAST_FRAME; ref < TOTAL_REFS_PER_FRAME; ++ref) { - for (mode = 0; mode < MAX_MODE_LF_DELTAS; ++mode) { - const int inter_lvl = lvl_seg + lf->ref_deltas[ref] * scale + - lf->mode_deltas[mode] * scale; - lfi->lvl[seg_id][ref][mode] = clamp(inter_lvl, 0, MAX_LOOP_FILTER); - } - } -#endif } } } @@ -858,12 +808,8 @@ const TX_SIZE tx_size_uv_left = txsize_horz_map[tx_size_uv_actual]; const TX_SIZE tx_size_uv_above = txsize_vert_map[tx_size_uv_actual]; #if CONFIG_EXT_DELTA_Q -#if CONFIG_LOOPFILTER_LEVEL const int filter_level = get_filter_level(cm, lfi_n, 0, 0, mbmi); #else - const int filter_level = get_filter_level(cm, lfi_n, mbmi); -#endif -#else const int filter_level = get_filter_level(lfi_n, mbmi); (void)cm; #endif @@ -948,12 +894,8 @@ const TX_SIZE tx_size_y_above = txsize_vert_map[mbmi->tx_size]; const BLOCK_SIZE block_size = mbmi->sb_type; #if CONFIG_EXT_DELTA_Q -#if CONFIG_LOOPFILTER_LEVEL const int filter_level = get_filter_level(cm, lfi_n, 0, 0, mbmi); #else - const int filter_level = get_filter_level(cm, lfi_n, mbmi); -#endif -#else const int filter_level = get_filter_level(lfi_n, mbmi); (void)cm; #endif @@ -1413,13 +1355,9 @@ // Filter level can vary per MI #if CONFIG_EXT_DELTA_Q -#if CONFIG_LOOPFILTER_LEVEL if (!(lfl_r[c_step] = get_filter_level(cm, &cm->lf_info, 0, 0, mbmi))) continue; #else - if (!(lfl_r[c_step] = get_filter_level(cm, &cm->lf_info, mbmi))) continue; -#endif -#else if (!(lfl_r[c_step] = get_filter_level(&cm->lf_info, mbmi))) continue; #endif @@ -2024,13 +1962,9 @@ plane, plane_ptr); #if CONFIG_EXT_DELTA_Q -#if CONFIG_LOOPFILTER_LEVEL const uint32_t curr_level = get_filter_level(cm, &cm->lf_info, edge_dir, plane, mbmi); #else - const uint32_t curr_level = get_filter_level(cm, &cm->lf_info, mbmi); -#endif -#else const uint32_t curr_level = get_filter_level(&cm->lf_info, mbmi); #endif // CONFIG_EXT_DELTA_Q @@ -2068,15 +2002,10 @@ mi_prev, edge_dir, pv_row, pv_col, plane, plane_ptr); #if CONFIG_EXT_DELTA_Q -#if CONFIG_LOOPFILTER_LEVEL const uint32_t pv_lvl = get_filter_level(cm, &cm->lf_info, edge_dir, plane, &mi_prev->mbmi); #else const uint32_t pv_lvl = - get_filter_level(cm, &cm->lf_info, &mi_prev->mbmi); -#endif -#else - const uint32_t pv_lvl = get_filter_level(&cm->lf_info, &mi_prev->mbmi); #endif // CONFIG_EXT_DELTA_Q @@ -2286,18 +2215,12 @@ struct macroblockd_plane *planes, int start, int stop, int y_only) { const int num_planes = av1_num_planes(cm); -#if CONFIG_LOOPFILTER_LEVEL // y_only no longer has its original meaning. // Here it means which plane to filter // when y_only = {0, 1, 2}, it means we are searching for filter level for // Y/U/V plane individually. const int plane_start = y_only; const int plane_end = plane_start + 1; -#else - const int nplanes = y_only ? 1 : num_planes; - const int plane_start = 0; - const int plane_end = nplanes; -#endif // CONFIG_LOOPFILTER_LEVEL const int col_start = 0; const int col_end = cm->mi_cols; int mi_row, mi_col; @@ -2328,24 +2251,14 @@ void av1_loop_filter_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm, MACROBLOCKD *xd, int frame_filter_level, -#if CONFIG_LOOPFILTER_LEVEL - int frame_filter_level_r, -#endif - int y_only, int partial_frame) { + int frame_filter_level_r, int y_only, + int partial_frame) { int start_mi_row, end_mi_row, mi_rows_to_filter; #if CONFIG_EXT_DELTA_Q -#if CONFIG_LOOPFILTER_LEVEL int orig_filter_level[2] = { cm->lf.filter_level[0], cm->lf.filter_level[1] }; -#else - int orig_filter_level = cm->lf.filter_level; -#endif #endif -#if CONFIG_LOOPFILTER_LEVEL if (!frame_filter_level && !frame_filter_level_r) return; -#else - if (!frame_filter_level) return; -#endif start_mi_row = 0; mi_rows_to_filter = cm->mi_rows; if (partial_frame && cm->mi_rows > 8) { @@ -2354,33 +2267,21 @@ mi_rows_to_filter = AOMMAX(cm->mi_rows / 8, 8); } end_mi_row = start_mi_row + mi_rows_to_filter; -#if CONFIG_LOOPFILTER_LEVEL // TODO(chengchen): refactor the code such that y_only has its matching // meaning. Now it means the plane to be filtered in this experiment. av1_loop_filter_frame_init(cm, frame_filter_level, frame_filter_level_r, y_only); -#else - av1_loop_filter_frame_init(cm, frame_filter_level, frame_filter_level); -#endif #if CONFIG_EXT_DELTA_Q -#if CONFIG_LOOPFILTER_LEVEL cm->lf.filter_level[0] = frame_filter_level; cm->lf.filter_level[1] = frame_filter_level_r; -#else - cm->lf.filter_level = frame_filter_level; -#endif #endif av1_loop_filter_rows(frame, cm, xd->plane, start_mi_row, end_mi_row, y_only); #if CONFIG_EXT_DELTA_Q -#if CONFIG_LOOPFILTER_LEVEL cm->lf.filter_level[0] = orig_filter_level[0]; cm->lf.filter_level[1] = orig_filter_level[1]; -#else - cm->lf.filter_level = orig_filter_level; -#endif #endif }
diff --git a/av1/common/av1_loopfilter.h b/av1/common/av1_loopfilter.h index a4e2cae..7770d8c 100644 --- a/av1/common/av1_loopfilter.h +++ b/av1/common/av1_loopfilter.h
@@ -36,13 +36,9 @@ }; struct loopfilter { -#if CONFIG_LOOPFILTER_LEVEL int filter_level[2]; int filter_level_u; int filter_level_v; -#else - int filter_level; -#endif int sharpness_level; int last_sharpness_level; @@ -70,11 +66,7 @@ typedef struct { loop_filter_thresh lfthr[MAX_LOOP_FILTER + 1]; -#if CONFIG_LOOPFILTER_LEVEL uint8_t lvl[MAX_SEGMENTS][2][TOTAL_REFS_PER_FRAME][MAX_MODE_LF_DELTAS]; -#else - uint8_t lvl[MAX_SEGMENTS][TOTAL_REFS_PER_FRAME][MAX_MODE_LF_DELTAS]; -#endif } loop_filter_info_n; // This structure holds bit masks for all 8x8 blocks in a 64x64 region. @@ -138,19 +130,11 @@ // av1_loop_filter_frame() // calls this function directly. void av1_loop_filter_frame_init(struct AV1Common *cm, int default_filt_lvl, - int default_filt_lvl_r -#if CONFIG_LOOPFILTER_LEVEL - , - int plane -#endif -); + int default_filt_lvl_r, int plane); void av1_loop_filter_frame(YV12_BUFFER_CONFIG *frame, struct AV1Common *cm, struct macroblockd *mbd, int filter_level, -#if CONFIG_LOOPFILTER_LEVEL - int filter_level_r, -#endif - int y_only, int partial_frame); + int filter_level_r, int y_only, int partial_frame); // Apply the loop filter to [start, stop) macro block rows in frame_buffer. void av1_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer,
diff --git a/av1/common/blockd.h b/av1/common/blockd.h index 1d834ca..668b1c5 100644 --- a/av1/common/blockd.h +++ b/av1/common/blockd.h
@@ -289,9 +289,7 @@ int current_q_index; #if CONFIG_EXT_DELTA_Q int current_delta_lf_from_base; -#if CONFIG_LOOPFILTER_LEVEL int curr_delta_lf[FRAME_LF_COUNT]; -#endif // CONFIG_LOOPFILTER_LEVEL #endif #if CONFIG_RD_DEBUG RD_STATS rd_stats; @@ -641,7 +639,6 @@ // superblock's actual lf and current lf. int prev_delta_lf_from_base; int current_delta_lf_from_base; -#if CONFIG_LOOPFILTER_LEVEL // For this experiment, we have four frame filter levels for different plane // and direction. So, to support the per superblock update, we need to add // a few more params as below. @@ -657,7 +654,6 @@ // SEG_LVL_ALT_LF_V = 4; int prev_delta_lf[FRAME_LF_COUNT]; int curr_delta_lf[FRAME_LF_COUNT]; -#endif // CONFIG_LOOPFILTER_LEVEL #endif DECLARE_ALIGNED(16, uint8_t, seg_mask[2 * MAX_SB_SQUARE]);
diff --git a/av1/common/entropy.c b/av1/common/entropy.c index 4d257a4..9d6cc00 100644 --- a/av1/common/entropy.c +++ b/av1/common/entropy.c
@@ -718,10 +718,8 @@ AVERAGE_TILE_CDFS(delta_q_cdf) #if CONFIG_EXT_DELTA_Q AVERAGE_TILE_CDFS(delta_lf_cdf) -#if CONFIG_LOOPFILTER_LEVEL AVERAGE_TILE_CDFS(delta_lf_multi_cdf) #endif -#endif AVERAGE_TILE_CDFS(skip_cdfs) AVERAGE_TILE_CDFS(txfm_partition_cdf)
diff --git a/av1/common/entropymode.c b/av1/common/entropymode.c index 4f69604..953e175 100644 --- a/av1/common/entropymode.c +++ b/av1/common/entropymode.c
@@ -183,13 +183,11 @@ AOM_CDF4(28160, 32120, 32677) }; #if CONFIG_EXT_DELTA_Q -#if CONFIG_LOOPFILTER_LEVEL static const aom_cdf_prob default_delta_lf_multi_cdf[FRAME_LF_COUNT][CDF_SIZE( DELTA_LF_PROBS + 1)] = { { AOM_CDF4(28160, 32120, 32677) }, { AOM_CDF4(28160, 32120, 32677) }, { AOM_CDF4(28160, 32120, 32677) }, { AOM_CDF4(28160, 32120, 32677) } }; -#endif // CONFIG_LOOPFILTER_LEVEL static const aom_cdf_prob default_delta_lf_cdf[CDF_SIZE(DELTA_LF_PROBS + 1)] = { AOM_CDF4(28160, 32120, 32677) }; @@ -1303,9 +1301,7 @@ av1_copy(fc->delta_q_cdf, default_delta_q_cdf); #if CONFIG_EXT_DELTA_Q av1_copy(fc->delta_lf_cdf, default_delta_lf_cdf); -#if CONFIG_LOOPFILTER_LEVEL av1_copy(fc->delta_lf_multi_cdf, default_delta_lf_multi_cdf); -#endif // CONFIG_LOOPFILTER_LEVEL #endif #if CONFIG_CFL av1_copy(fc->cfl_sign_cdf, default_cfl_sign_cdf);
diff --git a/av1/common/entropymode.h b/av1/common/entropymode.h index 8fa3377..2001c01 100644 --- a/av1/common/entropymode.h +++ b/av1/common/entropymode.h
@@ -188,9 +188,7 @@ [CDF_SIZE(MAX_TX_DEPTH + 1)]; aom_cdf_prob delta_q_cdf[CDF_SIZE(DELTA_Q_PROBS + 1)]; #if CONFIG_EXT_DELTA_Q -#if CONFIG_LOOPFILTER_LEVEL aom_cdf_prob delta_lf_multi_cdf[FRAME_LF_COUNT][CDF_SIZE(DELTA_LF_PROBS + 1)]; -#endif // CONFIG_LOOPFILTER_LEVEL aom_cdf_prob delta_lf_cdf[CDF_SIZE(DELTA_LF_PROBS + 1)]; #endif aom_cdf_prob intra_ext_tx_cdf[EXT_TX_SETS_INTRA][EXT_TX_SIZES][INTRA_MODES] @@ -287,9 +285,7 @@ #endif // CONFIG_JNT_COMP unsigned int delta_q[DELTA_Q_PROBS][2]; #if CONFIG_EXT_DELTA_Q -#if CONFIG_LOOPFILTER_LEVEL unsigned int delta_lf_multi[FRAME_LF_COUNT][DELTA_LF_PROBS][2]; -#endif // CONFIG_LOOPFILTER_LEVEL unsigned int delta_lf[DELTA_LF_PROBS][2]; #endif #if CONFIG_ENTROPY_STATS
diff --git a/av1/common/enums.h b/av1/common/enums.h index 073ef56..2a42433 100644 --- a/av1/common/enums.h +++ b/av1/common/enums.h
@@ -78,12 +78,10 @@ #define FRAME_OFFSET_BITS 5 #define MAX_FRAME_DISTANCE ((1 << FRAME_OFFSET_BITS) - 1) -#if CONFIG_LOOPFILTER_LEVEL // 4 frame filter levels: y plane vertical, y plane horizontal, // u plane, and v plane #define FRAME_LF_COUNT 4 #define DEFAULT_DELTA_LF_MULTI 0 -#endif // CONFIG_LOOPFILTER_LEVEL #if CONFIG_JNT_COMP typedef enum COMPOUND_DIST_WEIGHT_MODE {
diff --git a/av1/common/onyxc_int.h b/av1/common/onyxc_int.h index 5fb3e27..28ebcb2 100644 --- a/av1/common/onyxc_int.h +++ b/av1/common/onyxc_int.h
@@ -581,12 +581,10 @@ int delta_lf_present_flag; // Resolution of delta lf level int delta_lf_res; -#if CONFIG_LOOPFILTER_LEVEL // This is a flag for number of deltas of loop filter level // 0: use 1 delta, for y_vertical, y_horizontal, u, and v // 1: use separate deltas for each filter level int delta_lf_multi; -#endif // CONFIG_LOOPFILTER_LEVEL #endif int num_tg; #if CONFIG_REFERENCE_BUFFER
diff --git a/av1/common/seg_common.c b/av1/common/seg_common.c index 494a391..a81196b 100644 --- a/av1/common/seg_common.c +++ b/av1/common/seg_common.c
@@ -16,18 +16,11 @@ #include "av1/common/seg_common.h" #include "av1/common/quant_common.h" -#if CONFIG_LOOPFILTER_LEVEL static const int seg_feature_data_signed[SEG_LVL_MAX] = { 1, 1, 1, 1, 1, 0, 0 }; static const int seg_feature_data_max[SEG_LVL_MAX] = { MAXQ, MAX_LOOP_FILTER, MAX_LOOP_FILTER, MAX_LOOP_FILTER, MAX_LOOP_FILTER, 7, 0 }; -#else -static const int seg_feature_data_signed[SEG_LVL_MAX] = { 1, 1, 0, 0 }; - -static const int seg_feature_data_max[SEG_LVL_MAX] = { MAXQ, MAX_LOOP_FILTER, 7, - 0 }; -#endif // CONFIG_LOOPFILTER_LEVEL // These functions provide access to new segment level features. // Eventually these function may be "optimized out" but for the moment,
diff --git a/av1/common/seg_common.h b/av1/common/seg_common.h index 0e8717b..b76c672 100644 --- a/av1/common/seg_common.h +++ b/av1/common/seg_common.h
@@ -26,7 +26,6 @@ #define SPATIAL_PREDICTION_PROBS 3 #endif -#if CONFIG_LOOPFILTER_LEVEL typedef enum { SEG_LVL_ALT_Q, // Use alternate Quantizer .... SEG_LVL_ALT_LF_Y_V, // Use alternate loop filter value on y plane vertical @@ -40,19 +39,6 @@ #endif SEG_LVL_MAX } SEG_LVL_FEATURES; -#else // CONFIG_LOOPFILTER_LEVEL -// Segment level features. -typedef enum { - SEG_LVL_ALT_Q = 0, // Use alternate Quantizer .... - SEG_LVL_ALT_LF = 1, // Use alternate loop filter value... - SEG_LVL_REF_FRAME = 2, // Optional Segment reference frame - SEG_LVL_SKIP = 3, // Optional Segment (0,0) + skip mode -#if CONFIG_SEGMENT_GLOBALMV - SEG_LVL_GLOBALMV = 4, -#endif - SEG_LVL_MAX -} SEG_LVL_FEATURES; -#endif // CONFIG_LOOPFILTER_LEVEL struct segmentation { uint8_t enabled;
diff --git a/av1/common/thread_common.c b/av1/common/thread_common.c index 46d29cb..9daf11f 100644 --- a/av1/common/thread_common.c +++ b/av1/common/thread_common.c
@@ -324,10 +324,7 @@ void av1_loop_filter_frame_mt(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm, struct macroblockd_plane *planes, - int frame_filter_level, -#if CONFIG_LOOPFILTER_LEVEL - int frame_filter_level_r, -#endif + int frame_filter_level, int frame_filter_level_r, int y_only, int partial_frame, AVxWorker *workers, int num_workers, AV1LfSync *lf_sync) { int start_mi_row, end_mi_row, mi_rows_to_filter; @@ -342,12 +339,8 @@ mi_rows_to_filter = AOMMAX(cm->mi_rows / 8, 8); } end_mi_row = start_mi_row + mi_rows_to_filter; -#if CONFIG_LOOPFILTER_LEVEL av1_loop_filter_frame_init(cm, frame_filter_level, frame_filter_level_r, y_only); -#else - av1_loop_filter_frame_init(cm, frame_filter_level, frame_filter_level); -#endif // CONFIG_LOOPFILTER_LEVEL loop_filter_rows_mt(frame, cm, planes, start_mi_row, end_mi_row, y_only, workers, num_workers, lf_sync); }
diff --git a/av1/common/thread_common.h b/av1/common/thread_common.h index 7eddc66..730d916 100644 --- a/av1/common/thread_common.h +++ b/av1/common/thread_common.h
@@ -50,10 +50,7 @@ // Multi-threaded loopfilter that uses the tile threads. void av1_loop_filter_frame_mt(YV12_BUFFER_CONFIG *frame, struct AV1Common *cm, struct macroblockd_plane *planes, - int frame_filter_level, -#if CONFIG_LOOPFILTER_LEVEL - int frame_filter_level_r, -#endif + int frame_filter_level, int frame_filter_level_r, int y_only, int partial_frame, AVxWorker *workers, int num_workers, AV1LfSync *lf_sync);
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c index 21164fd..32afd66 100644 --- a/av1/decoder/decodeframe.c +++ b/av1/decoder/decodeframe.c
@@ -1016,7 +1016,6 @@ if (cm->allow_intrabc && NO_FILTER_FOR_IBC) return; #endif // CONFIG_INTRABC struct loopfilter *lf = &cm->lf; -#if CONFIG_LOOPFILTER_LEVEL lf->filter_level[0] = aom_rb_read_literal(rb, 6); lf->filter_level[1] = aom_rb_read_literal(rb, 6); if (num_planes > 1) { @@ -1025,9 +1024,6 @@ lf->filter_level_v = aom_rb_read_literal(rb, 6); } } -#else - lf->filter_level = aom_rb_read_literal(rb, 6); -#endif lf->sharpness_level = aom_rb_read_literal(rb, 3); // Read in loop filter deltas applied at the MB level based on mode or ref @@ -1490,12 +1486,8 @@ if (cm->large_scale_tile) { struct loopfilter *lf = &cm->lf; -// Figure out single_tile_decoding by loopfilter_level. -#if CONFIG_LOOPFILTER_LEVEL + // Figure out single_tile_decoding by loopfilter_level. const int no_loopfilter = !(lf->filter_level[0] || lf->filter_level[1]); -#else - const int no_loopfilter = !lf->filter_level; -#endif const int no_cdef = cm->cdef_bits == 0 && cm->cdef_strengths[0] == 0 && cm->cdef_uv_strengths[0] == 0; #if CONFIG_LOOP_RESTORATION @@ -1888,9 +1880,6 @@ int endTile) { AV1_COMMON *const cm = &pbi->common; const int num_planes = av1_num_planes(cm); -#if !CONFIG_LOOPFILTER_LEVEL - const AVxWorkerInterface *const winterface = aom_get_worker_interface(); -#endif const int tile_cols = cm->tile_cols; const int tile_rows = cm->tile_rows; const int n_tiles = tile_cols * tile_rows; @@ -1932,27 +1921,6 @@ } #endif // CONFIG_EXT_TILE -#if !CONFIG_LOOPFILTER_LEVEL - if (cm->lf.filter_level && !cm->skip_loop_filter && - pbi->lf_worker.data1 == NULL) { - CHECK_MEM_ERROR(cm, pbi->lf_worker.data1, - aom_memalign(32, sizeof(LFWorkerData))); - pbi->lf_worker.hook = (AVxWorkerHook)av1_loop_filter_worker; - if (pbi->max_threads > 1 && !winterface->reset(&pbi->lf_worker)) { - aom_internal_error(&cm->error, AOM_CODEC_ERROR, - "Loop filter thread creation failed"); - } - } - - if (cm->lf.filter_level && !cm->skip_loop_filter) { - LFWorkerData *const lf_data = (LFWorkerData *)pbi->lf_worker.data1; - // Be sure to sync as we might be resuming after a failed frame decode. - winterface->sync(&pbi->lf_worker); - av1_loop_filter_data_reset(lf_data, get_frame_new_buffer(cm), cm, - pbi->mb.plane); - } -#endif // CONFIG_LOOPFILTER_LEVEL - assert(tile_rows <= MAX_TILE_ROWS); assert(tile_cols <= MAX_TILE_COLS); @@ -2080,7 +2048,6 @@ { // Loopfilter the whole frame. if (endTile == cm->tile_rows * cm->tile_cols - 1) -#if CONFIG_LOOPFILTER_LEVEL if (cm->lf.filter_level[0] || cm->lf.filter_level[1]) { av1_loop_filter_frame(get_frame_new_buffer(cm), cm, &pbi->mb, cm->lf.filter_level[0], cm->lf.filter_level[1], 0, @@ -2094,10 +2061,6 @@ 0); } } -#else - av1_loop_filter_frame(get_frame_new_buffer(cm), cm, &pbi->mb, - cm->lf.filter_level, 0, 0); -#endif // CONFIG_LOOPFILTER_LEVEL } if (cm->frame_parallel_decode) av1_frameworker_broadcast(pbi->cur_buf, INT_MAX); @@ -2657,12 +2620,8 @@ #endif // CONFIG_FWD_KF unlock_buffer_pool(pool); -#if CONFIG_LOOPFILTER_LEVEL cm->lf.filter_level[0] = 0; cm->lf.filter_level[1] = 0; -#else - cm->lf.filter_level = 0; -#endif cm->show_frame = 1; #if CONFIG_FILM_GRAIN @@ -3083,12 +3042,8 @@ if (cm->allow_intrabc && NO_FILTER_FOR_IBC) { // Set parameters corresponding to no filtering. struct loopfilter *lf = &cm->lf; -#if CONFIG_LOOPFILTER_LEVEL lf->filter_level[0] = 0; lf->filter_level[1] = 0; -#else - lf->filter_level = 0; -#endif cm->cdef_bits = 0; cm->cdef_strengths[0] = 0; cm->nb_cdef_strengths = 1; @@ -3133,9 +3088,7 @@ #if CONFIG_EXT_DELTA_Q cm->delta_lf_res = 1; cm->delta_lf_present_flag = 0; -#if CONFIG_LOOPFILTER_LEVEL cm->delta_lf_multi = 0; -#endif // CONFIG_LOOPFILTER_LEVEL #endif if (delta_q_allowed == 1 && cm->base_qindex > 0) { cm->delta_q_present_flag = aom_rb_read_bit(rb); @@ -3153,13 +3106,11 @@ if (cm->delta_lf_present_flag) { xd->prev_delta_lf_from_base = 0; cm->delta_lf_res = 1 << aom_rb_read_literal(rb, 2); -#if CONFIG_LOOPFILTER_LEVEL cm->delta_lf_multi = aom_rb_read_bit(rb); const int frame_lf_count = av1_num_planes(cm) > 1 ? FRAME_LF_COUNT : FRAME_LF_COUNT - 2; for (int lf_id = 0; lf_id < frame_lf_count; ++lf_id) xd->prev_delta_lf[lf_id] = 0; -#endif // CONFIG_LOOPFILTER_LEVEL } #endif // CONFIG_EXT_DELTA_Q } @@ -3436,12 +3387,6 @@ } #endif -#if !CONFIG_LOOPFILTER_LEVEL - if (cm->lf.filter_level && !cm->skip_loop_filter) { - av1_loop_filter_frame_init(cm, cm->lf.filter_level, cm->lf.filter_level); - } -#endif - // If encoded in frame parallel mode, frame context is ready after decoding // the frame header. if (cm->frame_parallel_decode &&
diff --git a/av1/decoder/decodemv.c b/av1/decoder/decodemv.c index 7c561b0..dbdb168 100644 --- a/av1/decoder/decodemv.c +++ b/av1/decoder/decodemv.c
@@ -105,10 +105,7 @@ } #if CONFIG_EXT_DELTA_Q static int read_delta_lflevel(AV1_COMMON *cm, MACROBLOCKD *xd, aom_reader *r, -#if CONFIG_LOOPFILTER_LEVEL - int lf_id, -#endif - MB_MODE_INFO *const mbmi, int mi_col, + int lf_id, MB_MODE_INFO *const mbmi, int mi_col, int mi_row) { int sign, abs, reduced_delta_lflevel = 0; BLOCK_SIZE bsize = mbmi->sb_type; @@ -119,7 +116,6 @@ if ((bsize != cm->seq_params.sb_size || mbmi->skip == 0) && read_delta_lf_flag) { -#if CONFIG_LOOPFILTER_LEVEL if (cm->delta_lf_multi) { assert(lf_id >= 0 && lf_id < (av1_num_planes(cm) > 1 ? FRAME_LF_COUNT @@ -130,10 +126,6 @@ abs = aom_read_symbol(r, ec_ctx->delta_lf_cdf, DELTA_LF_PROBS + 1, ACCT_STR); } -#else - abs = - aom_read_symbol(r, ec_ctx->delta_lf_cdf, DELTA_LF_PROBS + 1, ACCT_STR); -#endif // CONFIG_LOOPFILTER_LEVEL const int smallval = (abs < DELTA_LF_SMALL); if (!smallval) { const int rem_bits = aom_read_literal(r, 3, ACCT_STR) + 1; @@ -985,7 +977,6 @@ xd->prev_qindex = xd->current_qindex; #if CONFIG_EXT_DELTA_Q if (cm->delta_lf_present_flag) { -#if CONFIG_LOOPFILTER_LEVEL if (cm->delta_lf_multi) { const int frame_lf_count = av1_num_planes(cm) > 1 ? FRAME_LF_COUNT : FRAME_LF_COUNT - 2; @@ -1007,15 +998,6 @@ clamp(tmp_lvl, -MAX_LOOP_FILTER, MAX_LOOP_FILTER); xd->prev_delta_lf_from_base = xd->current_delta_lf_from_base; } -#else - const int current_delta_lf_from_base = - xd->prev_delta_lf_from_base + - read_delta_lflevel(cm, xd, r, mbmi, mi_col, mi_row) * - cm->delta_lf_res; - mbmi->current_delta_lf_from_base = xd->current_delta_lf_from_base = - clamp(current_delta_lf_from_base, -MAX_LOOP_FILTER, MAX_LOOP_FILTER); - xd->prev_delta_lf_from_base = xd->current_delta_lf_from_base; -#endif // CONFIG_LOOPFILTER_LEVEL } #endif } @@ -2073,7 +2055,6 @@ xd->prev_qindex = xd->current_qindex; #if CONFIG_EXT_DELTA_Q if (cm->delta_lf_present_flag) { -#if CONFIG_LOOPFILTER_LEVEL if (cm->delta_lf_multi) { const int frame_lf_count = av1_num_planes(cm) > 1 ? FRAME_LF_COUNT : FRAME_LF_COUNT - 2; @@ -2095,15 +2076,6 @@ clamp(tmp_lvl, -MAX_LOOP_FILTER, MAX_LOOP_FILTER); xd->prev_delta_lf_from_base = xd->current_delta_lf_from_base; } -#else - const int current_delta_lf_from_base = - xd->prev_delta_lf_from_base + - read_delta_lflevel(cm, xd, r, mbmi, mi_col, mi_row) * - cm->delta_lf_res; - mbmi->current_delta_lf_from_base = xd->current_delta_lf_from_base = - clamp(current_delta_lf_from_base, -MAX_LOOP_FILTER, MAX_LOOP_FILTER); - xd->prev_delta_lf_from_base = xd->current_delta_lf_from_base; -#endif // CONFIG_LOOPFILTER_LEVEL } #endif // CONFIG_EXT_DELTA_Q }
diff --git a/av1/decoder/dthread.c b/av1/decoder/dthread.c index 231a813..20724ff 100644 --- a/av1/decoder/dthread.c +++ b/av1/decoder/dthread.c
@@ -177,12 +177,8 @@ memcpy(dst_cm->lf_info.lfthr, src_cm->lf_info.lfthr, (MAX_LOOP_FILTER + 1) * sizeof(loop_filter_thresh)); dst_cm->lf.last_sharpness_level = src_cm->lf.sharpness_level; -#if CONFIG_LOOPFILTER_LEVEL dst_cm->lf.filter_level[0] = src_cm->lf.filter_level[0]; dst_cm->lf.filter_level[1] = src_cm->lf.filter_level[1]; -#else - dst_cm->lf.filter_level = src_cm->lf.filter_level; -#endif memcpy(dst_cm->lf.ref_deltas, src_cm->lf.ref_deltas, TOTAL_REFS_PER_FRAME); memcpy(dst_cm->lf.mode_deltas, src_cm->lf.mode_deltas, MAX_MODE_LF_DELTAS); dst_cm->seg = src_cm->seg;
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c index 919c047..293722b 100644 --- a/av1/encoder/bitstream.c +++ b/av1/encoder/bitstream.c
@@ -318,10 +318,7 @@ #if CONFIG_EXT_DELTA_Q static void write_delta_lflevel(const AV1_COMMON *cm, const MACROBLOCKD *xd, -#if CONFIG_LOOPFILTER_LEVEL - int lf_id, -#endif - int delta_lflevel, aom_writer *w) { + int lf_id, int delta_lflevel, aom_writer *w) { int sign = delta_lflevel < 0; int abs = sign ? -delta_lflevel : delta_lflevel; int rem_bits, thr; @@ -329,7 +326,6 @@ FRAME_CONTEXT *ec_ctx = xd->tile_ctx; (void)cm; -#if CONFIG_LOOPFILTER_LEVEL if (cm->delta_lf_multi) { assert(lf_id >= 0 && lf_id < (av1_num_planes(cm) > 1 ? FRAME_LF_COUNT : FRAME_LF_COUNT - 2)); @@ -339,10 +335,6 @@ aom_write_symbol(w, AOMMIN(abs, DELTA_LF_SMALL), ec_ctx->delta_lf_cdf, DELTA_LF_PROBS + 1); } -#else - aom_write_symbol(w, AOMMIN(abs, DELTA_LF_SMALL), ec_ctx->delta_lf_cdf, - DELTA_LF_PROBS + 1); -#endif // CONFIG_LOOPFILTER_LEVEL if (!smallval) { rem_bits = OD_ILOG_NZ(abs - 1) - 1; @@ -1110,7 +1102,6 @@ write_delta_qindex(cm, xd, reduced_delta_qindex, w); xd->prev_qindex = mbmi->current_q_index; #if CONFIG_EXT_DELTA_Q -#if CONFIG_LOOPFILTER_LEVEL if (cm->delta_lf_present_flag) { if (cm->delta_lf_multi) { const int frame_lf_count = @@ -1130,15 +1121,6 @@ xd->prev_delta_lf_from_base = mbmi->current_delta_lf_from_base; } } -#else - if (cm->delta_lf_present_flag) { - int reduced_delta_lflevel = - (mbmi->current_delta_lf_from_base - xd->prev_delta_lf_from_base) / - cm->delta_lf_res; - write_delta_lflevel(cm, xd, reduced_delta_lflevel, w); - xd->prev_delta_lf_from_base = mbmi->current_delta_lf_from_base; - } -#endif // CONFIG_LOOPFILTER_LEVEL #endif // CONFIG_EXT_DELTA_Q } } @@ -1448,7 +1430,6 @@ write_delta_qindex(cm, xd, reduced_delta_qindex, w); xd->prev_qindex = mbmi->current_q_index; #if CONFIG_EXT_DELTA_Q -#if CONFIG_LOOPFILTER_LEVEL if (cm->delta_lf_present_flag) { if (cm->delta_lf_multi) { const int frame_lf_count = @@ -1468,15 +1449,6 @@ xd->prev_delta_lf_from_base = mbmi->current_delta_lf_from_base; } } -#else - if (cm->delta_lf_present_flag) { - int reduced_delta_lflevel = - (mbmi->current_delta_lf_from_base - xd->prev_delta_lf_from_base) / - cm->delta_lf_res; - write_delta_lflevel(cm, xd, reduced_delta_lflevel, w); - xd->prev_delta_lf_from_base = mbmi->current_delta_lf_from_base; - } -#endif // CONFIG_LOOPFILTER_LEVEL #endif // CONFIG_EXT_DELTA_Q } } @@ -2008,12 +1980,10 @@ xd->prev_qindex = cpi->common.base_qindex; #if CONFIG_EXT_DELTA_Q if (cpi->common.delta_lf_present_flag) { -#if CONFIG_LOOPFILTER_LEVEL const int frame_lf_count = av1_num_planes(cm) > 1 ? FRAME_LF_COUNT : FRAME_LF_COUNT - 2; for (int lf_id = 0; lf_id < frame_lf_count; ++lf_id) xd->prev_delta_lf[lf_id] = 0; -#endif // CONFIG_LOOPFILTER_LEVEL xd->prev_delta_lf_from_base = 0; } #endif // CONFIG_EXT_DELTA_Q @@ -2249,8 +2219,7 @@ int i; struct loopfilter *lf = &cm->lf; -// Encode the loop filter level and type -#if CONFIG_LOOPFILTER_LEVEL + // Encode the loop filter level and type aom_wb_write_literal(wb, lf->filter_level[0], 6); aom_wb_write_literal(wb, lf->filter_level[1], 6); if (num_planes > 1) { @@ -2259,9 +2228,6 @@ aom_wb_write_literal(wb, lf->filter_level_v, 6); } } -#else - aom_wb_write_literal(wb, lf->filter_level, 6); -#endif // CONFIG_LOOPFILTER_LEVEL aom_wb_write_literal(wb, lf->sharpness_level, 3); // Write out loop filter deltas applied at the MB level based on mode or @@ -3523,13 +3489,11 @@ if (cm->delta_lf_present_flag) { aom_wb_write_literal(wb, OD_ILOG_NZ(cm->delta_lf_res) - 1, 2); xd->prev_delta_lf_from_base = 0; -#if CONFIG_LOOPFILTER_LEVEL aom_wb_write_bit(wb, cm->delta_lf_multi); const int frame_lf_count = av1_num_planes(cm) > 1 ? FRAME_LF_COUNT : FRAME_LF_COUNT - 2; for (int lf_id = 0; lf_id < frame_lf_count; ++lf_id) xd->prev_delta_lf[lf_id] = 0; -#endif // CONFIG_LOOPFILTER_LEVEL } #endif // CONFIG_EXT_DELTA_Q }
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c index 884dd85..6b5acc1 100644 --- a/av1/encoder/encodeframe.c +++ b/av1/encoder/encodeframe.c
@@ -937,7 +937,6 @@ if (absdq < DELTA_Q_SMALL) td->counts->delta_q[absdq][0]++; xd->prev_qindex = mbmi->current_q_index; #if CONFIG_EXT_DELTA_Q -#if CONFIG_LOOPFILTER_LEVEL if (cm->delta_lf_present_flag) { if (cm->delta_lf_multi) { const int frame_lf_count = @@ -967,19 +966,6 @@ xd->prev_delta_lf_from_base = mbmi->current_delta_lf_from_base; } } -#else - if (cm->delta_lf_present_flag) { - const int dlf = - (mbmi->current_delta_lf_from_base - xd->prev_delta_lf_from_base) / - cm->delta_lf_res; - const int absdlf = abs(dlf); - for (i = 0; i < AOMMIN(absdlf, DELTA_LF_SMALL); ++i) { - td->counts->delta_lf[i][1]++; - } - if (absdlf < DELTA_LF_SMALL) td->counts->delta_lf[absdlf][0]++; - xd->prev_delta_lf_from_base = mbmi->current_delta_lf_from_base; - } -#endif // CONFIG_LOOPFILTER_LEVEL #endif } @@ -1485,13 +1471,11 @@ mbmi = &xd->mi[0]->mbmi; if (bsize == cpi->common.seq_params.sb_size && mbmi->skip == 1 && cpi->common.delta_lf_present_flag) { -#if CONFIG_LOOPFILTER_LEVEL const int frame_lf_count = av1_num_planes(&cpi->common) > 1 ? FRAME_LF_COUNT : FRAME_LF_COUNT - 2; for (int lf_id = 0; lf_id < frame_lf_count; ++lf_id) mbmi->curr_delta_lf[lf_id] = xd->prev_delta_lf[lf_id]; -#endif // CONFIG_LOOPFILTER_LEVEL mbmi->current_delta_lf_from_base = xd->prev_delta_lf_from_base; } #endif @@ -3582,14 +3566,12 @@ if (mi_row == tile_info->mi_row_start) xd->prev_qindex = cm->base_qindex; #if CONFIG_EXT_DELTA_Q if (cm->delta_lf_present_flag) { -#if CONFIG_LOOPFILTER_LEVEL if (mi_row == tile_info->mi_row_start) { const int frame_lf_count = av1_num_planes(cm) > 1 ? FRAME_LF_COUNT : FRAME_LF_COUNT - 2; for (int lf_id = 0; lf_id < frame_lf_count; ++lf_id) xd->prev_delta_lf[lf_id] = 0; } -#endif // CONFIG_LOOPFILTER_LEVEL if (mi_row == tile_info->mi_row_start) xd->prev_delta_lf_from_base = 0; } #endif @@ -3683,7 +3665,6 @@ cm->mi[(mi_row + j) * cm->mi_stride + (mi_col + k)] .mbmi.current_delta_lf_from_base = clamp( current_delta_lf_from_base, -MAX_LOOP_FILTER, MAX_LOOP_FILTER); -#if CONFIG_LOOPFILTER_LEVEL const int frame_lf_count = av1_num_planes(cm) > 1 ? FRAME_LF_COUNT : FRAME_LF_COUNT - 2; for (int lf_id = 0; lf_id < frame_lf_count; ++lf_id) { @@ -3692,7 +3673,6 @@ clamp(current_delta_lf_from_base, -MAX_LOOP_FILTER, MAX_LOOP_FILTER); } -#endif // CONFIG_LOOPFILTER_LEVEL } } } @@ -4466,9 +4446,7 @@ cm->delta_lf_res = DEFAULT_DELTA_LF_RES; cm->delta_q_present_flag = cpi->oxcf.deltaq_mode != NO_DELTA_Q; cm->delta_lf_present_flag = cpi->oxcf.deltaq_mode == DELTA_Q_LF; -#if CONFIG_LOOPFILTER_LEVEL cm->delta_lf_multi = DEFAULT_DELTA_LF_MULTI; -#endif // CONFIG_LOOPFILTER_LEVEL // update delta_q_present_flag and delta_lf_present_flag based on base_qindex cm->delta_q_present_flag &= cm->base_qindex > 0; cm->delta_lf_present_flag &= cm->base_qindex > 0;
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c index 4c620ee..fd3d83d 100644 --- a/av1/encoder/encoder.c +++ b/av1/encoder/encoder.c
@@ -161,7 +161,6 @@ if (seg_map[i] == AM_SEGMENT_ID_ACTIVE) seg_map[i] = active_map[i]; av1_enable_segmentation(seg); av1_enable_segfeature(seg, AM_SEGMENT_ID_INACTIVE, SEG_LVL_SKIP); -#if CONFIG_LOOPFILTER_LEVEL av1_enable_segfeature(seg, AM_SEGMENT_ID_INACTIVE, SEG_LVL_ALT_LF_Y_H); av1_enable_segfeature(seg, AM_SEGMENT_ID_INACTIVE, SEG_LVL_ALT_LF_Y_V); av1_enable_segfeature(seg, AM_SEGMENT_ID_INACTIVE, SEG_LVL_ALT_LF_U); @@ -175,23 +174,12 @@ -MAX_LOOP_FILTER); av1_set_segdata(seg, AM_SEGMENT_ID_INACTIVE, SEG_LVL_ALT_LF_V, -MAX_LOOP_FILTER); -#else - av1_enable_segfeature(seg, AM_SEGMENT_ID_INACTIVE, SEG_LVL_ALT_LF); - // Setting the data to -MAX_LOOP_FILTER will result in the computed loop - // filter level being zero. - av1_set_segdata(seg, AM_SEGMENT_ID_INACTIVE, SEG_LVL_ALT_LF, - -MAX_LOOP_FILTER); -#endif // CONFIG_LOOPFILTER_LEVEL } else { av1_disable_segfeature(seg, AM_SEGMENT_ID_INACTIVE, SEG_LVL_SKIP); -#if CONFIG_LOOPFILTER_LEVEL av1_disable_segfeature(seg, AM_SEGMENT_ID_INACTIVE, SEG_LVL_ALT_LF_Y_H); av1_disable_segfeature(seg, AM_SEGMENT_ID_INACTIVE, SEG_LVL_ALT_LF_Y_V); av1_disable_segfeature(seg, AM_SEGMENT_ID_INACTIVE, SEG_LVL_ALT_LF_U); av1_disable_segfeature(seg, AM_SEGMENT_ID_INACTIVE, SEG_LVL_ALT_LF_V); -#else - av1_disable_segfeature(seg, AM_SEGMENT_ID_INACTIVE, SEG_LVL_ALT_LF); -#endif // CONFIG_LOOPFILTER_LEVEL if (seg->enabled) { seg->update_data = 1; seg->update_map = 1; @@ -660,7 +648,6 @@ qi_delta = av1_compute_qdelta(rc, rc->avg_q, rc->avg_q * 0.875, cm->bit_depth); av1_set_segdata(seg, 1, SEG_LVL_ALT_Q, qi_delta - 2); -#if CONFIG_LOOPFILTER_LEVEL av1_set_segdata(seg, 1, SEG_LVL_ALT_LF_Y_H, -2); av1_set_segdata(seg, 1, SEG_LVL_ALT_LF_Y_V, -2); av1_set_segdata(seg, 1, SEG_LVL_ALT_LF_U, -2); @@ -670,10 +657,6 @@ av1_enable_segfeature(seg, 1, SEG_LVL_ALT_LF_Y_V); av1_enable_segfeature(seg, 1, SEG_LVL_ALT_LF_U); av1_enable_segfeature(seg, 1, SEG_LVL_ALT_LF_V); -#else - av1_set_segdata(seg, 1, SEG_LVL_ALT_LF, -2); - av1_enable_segfeature(seg, 1, SEG_LVL_ALT_LF); -#endif // CONFIG_LOOPFILTER_LEVEL av1_enable_segfeature(seg, 1, SEG_LVL_ALT_Q); } @@ -692,7 +675,6 @@ av1_set_segdata(seg, 1, SEG_LVL_ALT_Q, qi_delta + 2); av1_enable_segfeature(seg, 1, SEG_LVL_ALT_Q); -#if CONFIG_LOOPFILTER_LEVEL av1_set_segdata(seg, 1, SEG_LVL_ALT_LF_Y_H, -2); av1_set_segdata(seg, 1, SEG_LVL_ALT_LF_Y_V, -2); av1_set_segdata(seg, 1, SEG_LVL_ALT_LF_U, -2); @@ -702,10 +684,6 @@ av1_enable_segfeature(seg, 1, SEG_LVL_ALT_LF_Y_V); av1_enable_segfeature(seg, 1, SEG_LVL_ALT_LF_U); av1_enable_segfeature(seg, 1, SEG_LVL_ALT_LF_V); -#else - av1_set_segdata(seg, 1, SEG_LVL_ALT_LF, -2); - av1_enable_segfeature(seg, 1, SEG_LVL_ALT_LF); -#endif // CONFIG_LOOPFILTER_LEVEL // Segment coding disabled for compred testing if (high_q || (cpi->static_mb_pct == 100)) { @@ -5187,12 +5165,8 @@ } if (no_loopfilter) { -#if CONFIG_LOOPFILTER_LEVEL lf->filter_level[0] = 0; lf->filter_level[1] = 0; -#else - lf->filter_level = 0; -#endif } else { struct aom_usec_timer timer; @@ -5206,13 +5180,7 @@ cpi->time_pick_lpf += aom_usec_timer_elapsed(&timer); } -#if CONFIG_LOOPFILTER_LEVEL - if (lf->filter_level[0] || lf->filter_level[1]) -#else - if (lf->filter_level > 0) -#endif - { -#if CONFIG_LOOPFILTER_LEVEL + if (lf->filter_level[0] || lf->filter_level[1]) { av1_loop_filter_frame(cm->frame_to_show, cm, xd, lf->filter_level[0], lf->filter_level[1], 0, 0); if (num_planes > 1) { @@ -5221,10 +5189,6 @@ av1_loop_filter_frame(cm->frame_to_show, cm, xd, lf->filter_level_v, lf->filter_level_v, 2, 0); } - -#else - av1_loop_filter_frame(cm->frame_to_show, cm, xd, lf->filter_level, 0, 0); -#endif // CONFIG_LOOPFILTER_LEVEL } #if CONFIG_LOOP_RESTORATION @@ -6076,12 +6040,8 @@ if (!(cm->allow_intrabc && NO_FILTER_FOR_IBC)) { loopfilter_frame(cpi, cm); } else { -#if CONFIG_LOOPFILTER_LEVEL cm->lf.filter_level[0] = 0; cm->lf.filter_level[1] = 0; -#else - cm->lf.filter_level = 0; -#endif // CONFIG_LOOPFILTER_LEVEL cm->cdef_bits = 0; cm->cdef_strengths[0] = 0; cm->nb_cdef_strengths = 1;
diff --git a/av1/encoder/picklpf.c b/av1/encoder/picklpf.c index f467936..76c8d22 100644 --- a/av1/encoder/picklpf.c +++ b/av1/encoder/picklpf.c
@@ -48,16 +48,10 @@ static int64_t try_filter_frame(const YV12_BUFFER_CONFIG *sd, AV1_COMP *const cpi, int filt_level, - int partial_frame -#if CONFIG_LOOPFILTER_LEVEL - , - int plane, int dir -#endif -) { + int partial_frame, int plane, int dir) { AV1_COMMON *const cm = &cpi->common; int64_t filt_err; -#if CONFIG_LOOPFILTER_LEVEL assert(plane >= 0 && plane <= 2); int filter_level[2] = { filt_level, filt_level }; if (plane == 0 && dir == 0) filter_level[1] = cm->lf.filter_level[1]; @@ -65,36 +59,21 @@ av1_loop_filter_frame(cm->frame_to_show, cm, &cpi->td.mb.e_mbd, filter_level[0], filter_level[1], plane, partial_frame); -#else - av1_loop_filter_frame(cm->frame_to_show, cm, &cpi->td.mb.e_mbd, filt_level, 1, - partial_frame); -#endif // CONFIG_LOOPFILTER_LEVEL int highbd = 0; highbd = cm->use_highbitdepth; -#if CONFIG_LOOPFILTER_LEVEL filt_err = aom_get_sse_plane(sd, cm->frame_to_show, plane, highbd); // Re-instate the unfiltered frame yv12_copy_plane(&cpi->last_frame_uf, cm->frame_to_show, plane); -#else - filt_err = aom_get_sse_plane(sd, cm->frame_to_show, 0, highbd); - - // Re-instate the unfiltered frame - yv12_copy_plane(&cpi->last_frame_uf, cm->frame_to_show, 0); -#endif // CONFIG_LOOPFILTER_LEVEL return filt_err; } static int search_filter_level(const YV12_BUFFER_CONFIG *sd, AV1_COMP *cpi, - int partial_frame, double *best_cost_ret -#if CONFIG_LOOPFILTER_LEVEL - , - int plane, int dir -#endif -) { + int partial_frame, double *best_cost_ret, + int plane, int dir) { const AV1_COMMON *const cm = &cpi->common; const struct loopfilter *const lf = &cm->lf; const int min_filter_level = 0; @@ -104,9 +83,8 @@ int filt_best; MACROBLOCK *x = &cpi->td.mb; -// Start the search at the previous frame filter level unless it is now out of -// range. -#if CONFIG_LOOPFILTER_LEVEL + // Start the search at the previous frame filter level unless it is now out of + // range. int lvl; switch (plane) { case 0: lvl = (dir == 1) ? lf->filter_level[1] : lf->filter_level[0]; break; @@ -115,28 +93,14 @@ default: assert(plane >= 0 && plane <= 2); return 0; } int filt_mid = clamp(lvl, min_filter_level, max_filter_level); -#else - int filt_mid = clamp(lf->filter_level, min_filter_level, max_filter_level); -#endif // CONFIG_LOOPFILTER_LEVEL int filter_step = filt_mid < 16 ? 4 : filt_mid / 4; // Sum squared error at each filter level int64_t ss_err[MAX_LOOP_FILTER + 1]; // Set each entry to -1 memset(ss_err, 0xFF, sizeof(ss_err)); - -#if CONFIG_LOOPFILTER_LEVEL yv12_copy_plane(cm->frame_to_show, &cpi->last_frame_uf, plane); -#else - // Make a copy of the unfiltered / processed recon buffer - aom_yv12_copy_y(cm->frame_to_show, &cpi->last_frame_uf); -#endif // CONFIG_LOOPFILTER_LEVEL - -#if CONFIG_LOOPFILTER_LEVEL best_err = try_filter_frame(sd, cpi, filt_mid, partial_frame, plane, dir); -#else - best_err = try_filter_frame(sd, cpi, filt_mid, partial_frame); -#endif // CONFIG_LOOPFILTER_LEVEL filt_best = filt_mid; ss_err[filt_mid] = best_err; @@ -156,12 +120,8 @@ if (filt_direction <= 0 && filt_low != filt_mid) { // Get Low filter error score if (ss_err[filt_low] < 0) { -#if CONFIG_LOOPFILTER_LEVEL ss_err[filt_low] = try_filter_frame(sd, cpi, filt_low, partial_frame, plane, dir); -#else - ss_err[filt_low] = try_filter_frame(sd, cpi, filt_low, partial_frame); -#endif // CONFIG_LOOPFILTER_LEVEL } // If value is close to the best so far then bias towards a lower loop // filter value. @@ -177,12 +137,8 @@ // Now look at filt_high if (filt_direction >= 0 && filt_high != filt_mid) { if (ss_err[filt_high] < 0) { -#if CONFIG_LOOPFILTER_LEVEL ss_err[filt_high] = try_filter_frame(sd, cpi, filt_high, partial_frame, plane, dir); -#else - ss_err[filt_high] = try_filter_frame(sd, cpi, filt_high, partial_frame); -#endif // CONFIG_LOOPFILTER_LEVEL } // If value is significantly better than previous best, bias added against // raising filter value @@ -219,12 +175,8 @@ lf->sharpness_level = cm->frame_type == KEY_FRAME ? 0 : cpi->oxcf.sharpness; if (method == LPF_PICK_MINIMAL_LPF) { -#if CONFIG_LOOPFILTER_LEVEL lf->filter_level[0] = 0; lf->filter_level[1] = 0; -#else - lf->filter_level = 0; -#endif } else if (method >= LPF_PICK_FROM_Q) { const int min_filter_level = 0; const int max_filter_level = av1_get_max_filter_level(cpi); @@ -257,17 +209,12 @@ } if (cm->bit_depth != AOM_BITS_8 && cm->frame_type == KEY_FRAME) filt_guess -= 4; -#if CONFIG_LOOPFILTER_LEVEL // TODO(chengchen): retrain the model for Y, U, V filter levels lf->filter_level[0] = clamp(filt_guess, min_filter_level, max_filter_level); lf->filter_level[1] = clamp(filt_guess, min_filter_level, max_filter_level); lf->filter_level_u = clamp(filt_guess, min_filter_level, max_filter_level); lf->filter_level_v = clamp(filt_guess, min_filter_level, max_filter_level); -#else - lf->filter_level = clamp(filt_guess, min_filter_level, max_filter_level); -#endif } else { -#if CONFIG_LOOPFILTER_LEVEL lf->filter_level[0] = lf->filter_level[1] = search_filter_level( sd, cpi, method == LPF_PICK_FROM_SUBIMAGE, NULL, 0, 2); lf->filter_level[0] = search_filter_level( @@ -281,9 +228,5 @@ lf->filter_level_v = search_filter_level( sd, cpi, method == LPF_PICK_FROM_SUBIMAGE, NULL, 2, 0); } -#else - lf->filter_level = - search_filter_level(sd, cpi, method == LPF_PICK_FROM_SUBIMAGE, NULL); -#endif // CONFIG_LOOPFILTER_LEVEL } }
diff --git a/build/cmake/aom_config_defaults.cmake b/build/cmake/aom_config_defaults.cmake index d24922e..00720d6 100644 --- a/build/cmake/aom_config_defaults.cmake +++ b/build/cmake/aom_config_defaults.cmake
@@ -120,7 +120,6 @@ set(CONFIG_JNT_COMP 1 CACHE NUMBER "AV1 experiment flag.") set(CONFIG_LOOPFILTERING_ACROSS_TILES 1 CACHE NUMBER "AV1 experiment flag.") set(CONFIG_LOOPFILTERING_ACROSS_TILES_EXT 1 CACHE NUMBER "AV1 experiment flag.") -set(CONFIG_LOOPFILTER_LEVEL 1 CACHE NUMBER "AV1 experiment flag.") set(CONFIG_LOOP_RESTORATION 1 CACHE NUMBER "AV1 experiment flag.") set(CONFIG_LOWPRECISION_BLEND 1 CACHE NUMBER "AV1 experiment flag.") set(CONFIG_MAX_TILE 1 CACHE NUMBER "AV1 experiment flag.")