aom: rtc: Fix to setting content state for active_map

From 65d65996284b497ea18b03c548aabbbe507c8a85 Mon Sep 17 00:00:00 2001
From: Marco Paniconi <[EMAIL REDACTED]>
Date: Sat, 9 Mar 2024 21:29:46 -0800
Subject: [PATCH] rtc: Fix to setting content state for active_map

When a coding block has the segment skip set
(i.e, inactive segment in active maps) the content
state should be zero sad. This change fixes this setting
to only set zero sad for the coding block and not the
whole superblock. This reduces artifacts observed
in active maps on boundary regions (superblocks with
part of it labelled as inactive).

Change-Id: I682966394391bdf7d25c48522f37c475b9e35a74
---
 av1/encoder/nonrd_pickmode.c   | 3 ++-
 av1/encoder/partition_search.c | 1 -
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/av1/encoder/nonrd_pickmode.c b/av1/encoder/nonrd_pickmode.c
index f939b6d1fa..41e2e212ae 100644
--- a/av1/encoder/nonrd_pickmode.c
+++ b/av1/encoder/nonrd_pickmode.c
@@ -3241,7 +3241,8 @@ void av1_nonrd_pick_inter_mode_sb(AV1_COMP *cpi, TileDataEnc *tile_data,
   inter_pred_params_sr.conv_params =
       get_conv_params(/*do_average=*/0, AOM_PLANE_Y, xd->bd);
 
-  x->block_is_zero_sad = x->content_state_sb.source_sad_nonrd == kZeroSad;
+  x->block_is_zero_sad = x->content_state_sb.source_sad_nonrd == kZeroSad ||
+                         segfeature_active(&cm->seg, segment_id, SEG_LVL_SKIP);
   if (cpi->oxcf.tune_cfg.content == AOM_CONTENT_SCREEN &&
       !x->force_zeromv_skip_for_blk &&
       x->content_state_sb.source_sad_nonrd != kZeroSad &&
diff --git a/av1/encoder/partition_search.c b/av1/encoder/partition_search.c
index 344141f98d..cef3397570 100644
--- a/av1/encoder/partition_search.c
+++ b/av1/encoder/partition_search.c
@@ -2308,7 +2308,6 @@ static void pick_sb_modes_nonrd(AV1_COMP *const cpi, TileDataEnc *tile_data,
 #endif
     if (segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) {
       x->force_zeromv_skip_for_blk = 1;
-      x->content_state_sb.source_sad_nonrd = kZeroSad;
       // TODO(marpan): Consider adding a function for nonrd:
       // av1_nonrd_pick_inter_mode_sb_seg_skip(), instead of setting
       // x->force_zeromv_skip flag and entering av1_nonrd_pick_inter_mode_sb().