Enable SGR filter at speed 5,6
This patch enables the SGR filter for speed 5 and 6 and
introduces a new level 2 for the 'enable_sgr_ep_pruning'sf
where only 4 SGR projection parameters are searched.
Performance results averaged over all resolutions are as
follows:
Instruction
Count Reduction(%) BD-Rate Loss(%)
cpu Encoder Decoder avg.psnr ssim vmaf vmaf_neg
5 -1.89 -4.88 -1.2041 -1.9123 -0.3232 -0.4700
6 -2.58 -4.81 -1.2586 -2.0265 -0.4120 -0.5395
STATS_CHANGED for speed = 5,6.
Change-Id:If4814eafac8ce1415e68788307be836b6846a02e
diff --git a/av1/encoder/pickrst.c b/av1/encoder/pickrst.c
index 3913d58..cd79ed9 100644
--- a/av1/encoder/pickrst.c
+++ b/av1/encoder/pickrst.c
@@ -848,25 +848,27 @@
flt0, flt1, flt_stride, exqd, &err, error_info);
get_best_error(&besterr, err, exqd, bestxqd, &bestep, ep);
}
- // evaluate left and right ep of winner in seed ep
- int bestep_ref = bestep;
- for (ep = bestep_ref - 1; ep < bestep_ref + 2; ep += 2) {
- if (ep < SGRPROJ_EP_GRP1_START_IDX || ep > SGRPROJ_EP_GRP1_END_IDX)
- continue;
- int64_t err;
- compute_sgrproj_err(dat8, width, height, dat_stride, src8, src_stride,
- use_highbitdepth, bit_depth, pu_width, pu_height, ep,
- flt0, flt1, flt_stride, exqd, &err, error_info);
- get_best_error(&besterr, err, exqd, bestxqd, &bestep, ep);
- }
- // evaluate last two group
- for (idx = 0; idx < SGRPROJ_EP_GRP2_3_SEARCH_COUNT; idx++) {
- ep = sgproj_ep_grp2_3[idx][bestep];
- int64_t err;
- compute_sgrproj_err(dat8, width, height, dat_stride, src8, src_stride,
- use_highbitdepth, bit_depth, pu_width, pu_height, ep,
- flt0, flt1, flt_stride, exqd, &err, error_info);
- get_best_error(&besterr, err, exqd, bestxqd, &bestep, ep);
+ if (enable_sgr_ep_pruning < 2) {
+ // evaluate left and right ep of winner in seed ep
+ int bestep_ref = bestep;
+ for (ep = bestep_ref - 1; ep < bestep_ref + 2; ep += 2) {
+ if (ep < SGRPROJ_EP_GRP1_START_IDX || ep > SGRPROJ_EP_GRP1_END_IDX)
+ continue;
+ int64_t err;
+ compute_sgrproj_err(dat8, width, height, dat_stride, src8, src_stride,
+ use_highbitdepth, bit_depth, pu_width, pu_height,
+ ep, flt0, flt1, flt_stride, exqd, &err, error_info);
+ get_best_error(&besterr, err, exqd, bestxqd, &bestep, ep);
+ }
+ // evaluate last two group
+ for (idx = 0; idx < SGRPROJ_EP_GRP2_3_SEARCH_COUNT; idx++) {
+ ep = sgproj_ep_grp2_3[idx][bestep];
+ int64_t err;
+ compute_sgrproj_err(dat8, width, height, dat_stride, src8, src_stride,
+ use_highbitdepth, bit_depth, pu_width, pu_height,
+ ep, flt0, flt1, flt_stride, exqd, &err, error_info);
+ get_best_error(&besterr, err, exqd, bestxqd, &bestep, ep);
+ }
}
}
diff --git a/av1/encoder/speed_features.c b/av1/encoder/speed_features.c
index 0ba18c8..e2b04ca 100644
--- a/av1/encoder/speed_features.c
+++ b/av1/encoder/speed_features.c
@@ -1426,7 +1426,7 @@
: MULTI_WINNER_MODE_OFF;
// Disable Self-guided Loop restoration filter.
- sf->lpf_sf.disable_sgr_filter = true;
+ sf->lpf_sf.enable_sgr_ep_pruning = 2;
sf->lpf_sf.disable_wiener_coeff_refine_search = true;
sf->tpl_sf.prune_starting_mv = 3;
diff --git a/av1/encoder/speed_features.h b/av1/encoder/speed_features.h
index 54e64ae..ad7f7e4 100644
--- a/av1/encoder/speed_features.h
+++ b/av1/encoder/speed_features.h
@@ -1598,7 +1598,14 @@
// search_switchable()
int switchable_lr_with_bias_level;
- // prune sgr ep using binary search like mechanism
+ // Enable fast search in self guided restoration
+ // 0 : Search over all 16 SGR projection parameters listed
+ // in av1_sgr_params[SGRPROJ_PARAMS].
+ // 1 : Approximate search using binary search like mechanism,
+ // a total of 8 SGR projection parameters are searched.
+ // 2 : Search only 'ep' values in
+ // sgproj_ep_grp1_seed[SGRPROJ_EP_GRP1_SEARCH_COUNT],
+ // a total of 4 SGR projection parameters are searched.
int enable_sgr_ep_pruning;
// Disable loop restoration for Chroma plane