fix number of planes
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index 7e598ab..b953adb 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -7044,10 +7044,12 @@
 #endif  // CONFIG_EXTENDED_WARP_PREDICTION
 
     mbmi->motion_mode = SIMPLE_TRANSLATION;
+    const int num_planes_to_build =
+        (xd->tree_type == SHARED_PART) ? av1_num_planes(cm) : 1;
 
 #if !CONFIG_MORPH_PRED
     av1_enc_build_inter_predictor(cm, xd, mi_row, mi_col, NULL, bsize, 0,
-                                  av1_num_planes(cm) - 1);
+                                  num_planes_to_build - 1);
 #endif  // CONFIG_MORPH_PRED
 
     const IntraBCMvCosts *const dv_costs = &x->dv_costs;
@@ -7124,7 +7126,7 @@
       if (morph_idx == 0) {
         // Build intra bc predictor for yuv planes as baseline.
         av1_enc_build_inter_predictor(cm, xd, mi_row, mi_col, NULL, bsize, 0,
-                                      av1_num_planes(cm) - 1);
+                                      num_planes_to_build - 1);
       } else {
         // Build the y predictor using a linear model.
         const bool valid = av1_build_morph_pred(cm, xd, bsize, mi_row, mi_col);