Move obsolete segment_id reassignment logic to precede mi copying

When `skip_txfm` is `true` for luma and `false` for chroma (SDP), chroma block copies obsolete luma segment ID causing enc/dec mismatch. The segment ID reassignment logic in `av2_encode_sb()` is moved to `av2_update_state()` so that modified segment ID applies to all `mi`s within a luma `mbmi`.

Fixes issues #1246
diff --git a/av2/encoder/encodeframe_utils.c b/av2/encoder/encodeframe_utils.c
index 0b007eb..5d351df 100644
--- a/av2/encoder/encodeframe_utils.c
+++ b/av2/encoder/encodeframe_utils.c
@@ -297,6 +297,17 @@
         !is_mhccp_allowed(cm, xd)) {
       mi_addr->uv_mode = UV_DC_PRED;
     }
+
+    if (!seg->segid_preskip && seg->update_map &&
+        xd->tree_type != CHROMA_PART) {
+      if (txfm_info->skip_txfm && !cm->features.has_lossless_segment) {
+        int cdf_num;
+        const int pred = av2_get_spatial_seg_pred(cm, xd, &cdf_num, 1);
+        assert(is_inter_block(mi_addr, xd->tree_type) ||
+               !cpi->enc_seg.has_lossless_segment);
+        mi_addr->segment_id = pred;
+      }
+    }
   }
   for (i = (xd->tree_type == CHROMA_PART); i < num_planes; ++i) {
     p[i].coeff = ctx->coeff[i];
diff --git a/av2/encoder/encodemb.c b/av2/encoder/encodemb.c
index 19961d4..c2cf414 100644
--- a/av2/encoder/encodemb.c
+++ b/av2/encoder/encodemb.c
@@ -1247,24 +1247,6 @@
     av2_init_txk_skip_array(cm, xd->mi_row, xd->mi_col, sb_type, 1,
                             xd->tree_type, &mbmi->chroma_ref_info, plane_start,
                             plane_end);
-
-    if (cpi->oxcf.q_cfg.aq_mode != NO_AQ) {
-      int current_base_qindex = cpi->common.delta_q_info.delta_q_present_flag
-                                    ? xd->current_base_qindex
-                                    : cpi->common.quant_params.base_qindex;
-      if (mbmi->skip_txfm[xd->tree_type == CHROMA_PART] &&
-          !cm->features.has_lossless_segment && cm->seg.update_map) {
-        assert(is_inter_block(mbmi, xd->tree_type));
-        int cdf_num;
-        int pred = av2_get_spatial_seg_pred(cm, xd, &cdf_num, 1);
-        mbmi->segment_id = pred;
-        int seg_qindex =
-            av2_get_qindex(&cm->seg, mbmi->segment_id, current_base_qindex,
-                           cm->seq_params.bit_depth);
-        get_qindex_with_offsets(cm, seg_qindex, mbmi->final_qindex_dc,
-                                mbmi->final_qindex_ac);
-      }
-    }
   }
 
   if (x->txfm_search_info.skip_txfm) return;