summaryrefslogtreecommitdiff
path: root/vp9/encoder/vp9_encoder.c
diff options
context:
space:
mode:
authorJerome Jiang <jianj@google.com>2021-09-28 16:59:21 -0700
committerJerome Jiang <jianj@google.com>2022-01-27 13:12:29 -0800
commit8a0af65f34bdf43fc63b4ce4ac9393aceab0abbf (patch)
tree979b3be617ece8ed83081b4fd86f1ac86836ca26 /vp9/encoder/vp9_encoder.c
parentc56ab7d0c6f3fb215d571db3dacc0cc908c1b53c (diff)
downloadlibvpx-8a0af65f34bdf43fc63b4ce4ac9393aceab0abbf.tar
libvpx-8a0af65f34bdf43fc63b4ce4ac9393aceab0abbf.tar.gz
libvpx-8a0af65f34bdf43fc63b4ce4ac9393aceab0abbf.tar.bz2
libvpx-8a0af65f34bdf43fc63b4ce4ac9393aceab0abbf.zip
Use background segmentation mask with ROI
RTC sample encoder vpx_temporal_svc_encoder can take mask files as input when ROI_MAP is set to 1. Uses ROI and segmentation of vp9 to skip background encoding when source_sad is low and the correspond block in previous frame is also skipped. Change-Id: I8590e6f9a88cecfa1d7f375d4cc480f0f2af87b6
Diffstat (limited to 'vp9/encoder/vp9_encoder.c')
-rw-r--r--vp9/encoder/vp9_encoder.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c
index 7e80835f6..ac0efced7 100644
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -618,7 +618,7 @@ static void apply_roi_map(VP9_COMP *cpi) {
}
if (skip[i] != 0) {
vp9_enable_segfeature(seg, i, SEG_LVL_SKIP);
- vp9_set_segdata(seg, i, SEG_LVL_SKIP, skip[i]);
+ vp9_set_segdata(seg, i, SEG_LVL_SKIP, 0);
}
if (ref_frame[i] >= 0) {
int valid_ref = 1;
@@ -4137,11 +4137,22 @@ static int encode_without_recode_loop(VP9_COMP *cpi, size_t *size,
vp9_alt_ref_aq_setup_map(cpi->alt_ref_aq, cpi);
} else {
#endif
- if (cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ) {
+ // If ROI is enabled and skip feature is used for segmentation, apply cyclic
+ // refresh but not apply ROI for skip for the first 20 frames (defined by
+ // FRAMES_NO_SKIPPING_AFTER_KEY) after key frame to improve quality.
+ if (cpi->roi.enabled && !frame_is_intra_only(cm)) {
+ if (cpi->roi.skip[BACKGROUND_SEG_SKIP_ID]) {
+ if (cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ)
+ vp9_cyclic_refresh_setup(cpi);
+ if (cpi->rc.frames_since_key > FRAMES_NO_SKIPPING_AFTER_KEY)
+ apply_roi_map(cpi);
+ } else {
+ apply_roi_map(cpi);
+ }
+ } else if (cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ) {
vp9_cyclic_refresh_setup(cpi);
- } else if (cpi->roi.enabled && !frame_is_intra_only(cm)) {
- apply_roi_map(cpi);
}
+
#if !CONFIG_REALTIME_ONLY
}
#endif