Commit 9b50b7e522 for aom

commit 9b50b7e522264b96e5cf280661faf0c0b1e5cd2c
Author: Frank Galligan <fgalligan@google.com>
Date:   Wed Dec 2 23:10:30 2026 -0800

    x86: Pass >3 SIMD vector params by const ptr

    32-bit Windows MSVC (__cdecl) caps by-value __m128i/__m256i parameters
    at 3 (XMM0-XMM2 / YMM0-YMM2) and fails with error C2719 ("formal
    parameter with requested alignment of 16/32 won't be aligned") even on
    static inline / AOM_FORCE_INLINE helpers.

    Update the remaining 7 x86 __m128i/__m256i C intrinsic helpers across 5
    files to pass vector parameters via const pointers with AOM_FORCE_INLINE
    (fdct8x16_odd_dual_avx2 takes a 4-element const __m256i *d array
    matching fdct8x8_dual_avx2; the other 6 pass all vector inputs as
    const pointers):
    - av1/encoder/x86/av1_fwd_txfm2d_avx2.c: btf_16_w16_out0_avx2,
      fdct8x16_odd_dual_avx2
    - av1/encoder/x86/encodetxb_sse2.c: finish_nz_ctx_sse2
    - av1/encoder/x86/pickrst_avx2.c: calc_proj_err_r0_r1_avx2,
      calc_proj_err_r0_or_r1_avx2
    - aom_dsp/x86/intrapred_ssse3.c: write_smooth_directional_sum16
    - av1/common/x86/cfl_ssse3.c: predict_unclipped_vec

    x86_64 Clang -O3 Release codegen across all 5 object files is identical
    in .text size, and GCC -O3 Release .text is identical or smaller (-64 B
    in pickrst_avx2.c.o).

    TAG=agy
    CONV=f0d05378-f513-4531-bc9f-96c6d94a09d6
    Change-Id: I34c7fcb4e6a15eb5a1d75d58f2603efb92230c53

diff --git a/aom_dsp/x86/intrapred_ssse3.c b/aom_dsp/x86/intrapred_ssse3.c
index 302da29f0d..d9301a9b81 100644
--- a/aom_dsp/x86/intrapred_ssse3.c
+++ b/aom_dsp/x86/intrapred_ssse3.c
@@ -1097,17 +1097,17 @@ void aom_smooth_predictor_64x64_ssse3(uint8_t *dst, ptrdiff_t stride,
 // Vertical, weights1 and weights2 are the same, and scaled_corner1 and
 // scaled_corner2 are the same.
 static AOM_FORCE_INLINE void write_smooth_directional_sum16(
-    uint8_t *LIBAOM_RESTRICT dst, const __m128i pixels1, const __m128i pixels2,
-    const __m128i weights1, const __m128i weights2,
-    const __m128i scaled_corner1, const __m128i scaled_corner2,
-    const __m128i round) {
-  const __m128i weighted_px1 = _mm_mullo_epi16(pixels1, weights1);
-  const __m128i weighted_px2 = _mm_mullo_epi16(pixels2, weights2);
-  const __m128i pred_sum1 = _mm_add_epi16(scaled_corner1, weighted_px1);
-  const __m128i pred_sum2 = _mm_add_epi16(scaled_corner2, weighted_px2);
+    uint8_t *LIBAOM_RESTRICT dst, const __m128i *pixels1,
+    const __m128i *pixels2, const __m128i *weights1, const __m128i *weights2,
+    const __m128i *scaled_corner1, const __m128i *scaled_corner2,
+    const __m128i *round) {
+  const __m128i weighted_px1 = _mm_mullo_epi16(*pixels1, *weights1);
+  const __m128i weighted_px2 = _mm_mullo_epi16(*pixels2, *weights2);
+  const __m128i pred_sum1 = _mm_add_epi16(*scaled_corner1, weighted_px1);
+  const __m128i pred_sum2 = _mm_add_epi16(*scaled_corner2, weighted_px2);
   // Equivalent to RightShiftWithRounding(pred[x][y], 8).
-  const __m128i pred1 = _mm_srli_epi16(_mm_add_epi16(pred_sum1, round), 8);
-  const __m128i pred2 = _mm_srli_epi16(_mm_add_epi16(pred_sum2, round), 8);
+  const __m128i pred1 = _mm_srli_epi16(_mm_add_epi16(pred_sum1, *round), 8);
+  const __m128i pred2 = _mm_srli_epi16(_mm_add_epi16(pred_sum2, *round), 8);
   StoreUnaligned16(dst, _mm_packus_epi16(pred1, pred2));
 }

@@ -1417,30 +1417,30 @@ void aom_smooth_v_predictor_16x4_ssse3(
   __m128i y_select = _mm_set1_epi32(0x01000100);
   __m128i weights_y = _mm_shuffle_epi8(weights, y_select);
   __m128i scaled_bottom_left_y = _mm_shuffle_epi8(scaled_bottom_left, y_select);
-  write_smooth_directional_sum16(dst, top_lo, top_hi, weights_y, weights_y,
-                                 scaled_bottom_left_y, scaled_bottom_left_y,
-                                 round);
+  write_smooth_directional_sum16(dst, &top_lo, &top_hi, &weights_y, &weights_y,
+                                 &scaled_bottom_left_y, &scaled_bottom_left_y,
+                                 &round);
   dst += stride;
   y_select = _mm_set1_epi32(0x03020302);
   weights_y = _mm_shuffle_epi8(weights, y_select);
   scaled_bottom_left_y = _mm_shuffle_epi8(scaled_bottom_left, y_select);
-  write_smooth_directional_sum16(dst, top_lo, top_hi, weights_y, weights_y,
-                                 scaled_bottom_left_y, scaled_bottom_left_y,
-                                 round);
+  write_smooth_directional_sum16(dst, &top_lo, &top_hi, &weights_y, &weights_y,
+                                 &scaled_bottom_left_y, &scaled_bottom_left_y,
+                                 &round);
   dst += stride;
   y_select = _mm_set1_epi32(0x05040504);
   weights_y = _mm_shuffle_epi8(weights, y_select);
   scaled_bottom_left_y = _mm_shuffle_epi8(scaled_bottom_left, y_select);
-  write_smooth_directional_sum16(dst, top_lo, top_hi, weights_y, weights_y,
-                                 scaled_bottom_left_y, scaled_bottom_left_y,
-                                 round);
+  write_smooth_directional_sum16(dst, &top_lo, &top_hi, &weights_y, &weights_y,
+                                 &scaled_bottom_left_y, &scaled_bottom_left_y,
+                                 &round);
   dst += stride;
   y_select = _mm_set1_epi32(0x07060706);
   weights_y = _mm_shuffle_epi8(weights, y_select);
   scaled_bottom_left_y = _mm_shuffle_epi8(scaled_bottom_left, y_select);
-  write_smooth_directional_sum16(dst, top_lo, top_hi, weights_y, weights_y,
-                                 scaled_bottom_left_y, scaled_bottom_left_y,
-                                 round);
+  write_smooth_directional_sum16(dst, &top_lo, &top_hi, &weights_y, &weights_y,
+                                 &scaled_bottom_left_y, &scaled_bottom_left_y,
+                                 &round);
 }
 #endif  // !CONFIG_REALTIME_ONLY || CONFIG_AV1_DECODER

@@ -1463,9 +1463,9 @@ void aom_smooth_v_predictor_16x8_ssse3(
     const __m128i weights_y = _mm_shuffle_epi8(weights, y_select);
     const __m128i scaled_bottom_left_y =
         _mm_shuffle_epi8(scaled_bottom_left, y_select);
-    write_smooth_directional_sum16(dst, top_lo, top_hi, weights_y, weights_y,
-                                   scaled_bottom_left_y, scaled_bottom_left_y,
-                                   round);
+    write_smooth_directional_sum16(dst, &top_lo, &top_hi, &weights_y,
+                                   &weights_y, &scaled_bottom_left_y,
+                                   &scaled_bottom_left_y, &round);
     dst += stride;
   }
 }
@@ -1496,9 +1496,9 @@ void aom_smooth_v_predictor_16x16_ssse3(
     const __m128i weights_y = _mm_shuffle_epi8(weights_lo, y_select);
     const __m128i scaled_bottom_left_y =
         _mm_shuffle_epi8(scaled_bottom_left_lo, y_select);
-    write_smooth_directional_sum16(dst, top_lo, top_hi, weights_y, weights_y,
-                                   scaled_bottom_left_y, scaled_bottom_left_y,
-                                   round);
+    write_smooth_directional_sum16(dst, &top_lo, &top_hi, &weights_y,
+                                   &weights_y, &scaled_bottom_left_y,
+                                   &scaled_bottom_left_y, &round);
     dst += stride;
   }
   for (int y_mask = 0x01000100; y_mask < 0x0F0E0F0F; y_mask += 0x02020202) {
@@ -1506,9 +1506,9 @@ void aom_smooth_v_predictor_16x16_ssse3(
     const __m128i weights_y = _mm_shuffle_epi8(weights_hi, y_select);
     const __m128i scaled_bottom_left_y =
         _mm_shuffle_epi8(scaled_bottom_left_hi, y_select);
-    write_smooth_directional_sum16(dst, top_lo, top_hi, weights_y, weights_y,
-                                   scaled_bottom_left_y, scaled_bottom_left_y,
-                                   round);
+    write_smooth_directional_sum16(dst, &top_lo, &top_hi, &weights_y,
+                                   &weights_y, &scaled_bottom_left_y,
+                                   &scaled_bottom_left_y, &round);
     dst += stride;
   }
 }
@@ -1548,9 +1548,9 @@ void aom_smooth_v_predictor_16x32_ssse3(
     const __m128i weights_y = _mm_shuffle_epi8(weights1, y_select);
     const __m128i scaled_bottom_left_y =
         _mm_shuffle_epi8(scaled_bottom_left1, y_select);
-    write_smooth_directional_sum16(dst, top_lo, top_hi, weights_y, weights_y,
-                                   scaled_bottom_left_y, scaled_bottom_left_y,
-                                   round);
+    write_smooth_directional_sum16(dst, &top_lo, &top_hi, &weights_y,
+                                   &weights_y, &scaled_bottom_left_y,
+                                   &scaled_bottom_left_y, &round);
     dst += stride;
   }
   for (int y_mask = 0x01000100; y_mask < 0x0F0E0F0F; y_mask += 0x02020202) {
@@ -1558,9 +1558,9 @@ void aom_smooth_v_predictor_16x32_ssse3(
     const __m128i weights_y = _mm_shuffle_epi8(weights2, y_select);
     const __m128i scaled_bottom_left_y =
         _mm_shuffle_epi8(scaled_bottom_left2, y_select);
-    write_smooth_directional_sum16(dst, top_lo, top_hi, weights_y, weights_y,
-                                   scaled_bottom_left_y, scaled_bottom_left_y,
-                                   round);
+    write_smooth_directional_sum16(dst, &top_lo, &top_hi, &weights_y,
+                                   &weights_y, &scaled_bottom_left_y,
+                                   &scaled_bottom_left_y, &round);
     dst += stride;
   }
   for (int y_mask = 0x01000100; y_mask < 0x0F0E0F0F; y_mask += 0x02020202) {
@@ -1568,9 +1568,9 @@ void aom_smooth_v_predictor_16x32_ssse3(
     const __m128i weights_y = _mm_shuffle_epi8(weights3, y_select);
     const __m128i scaled_bottom_left_y =
         _mm_shuffle_epi8(scaled_bottom_left3, y_select);
-    write_smooth_directional_sum16(dst, top_lo, top_hi, weights_y, weights_y,
-                                   scaled_bottom_left_y, scaled_bottom_left_y,
-                                   round);
+    write_smooth_directional_sum16(dst, &top_lo, &top_hi, &weights_y,
+                                   &weights_y, &scaled_bottom_left_y,
+                                   &scaled_bottom_left_y, &round);
     dst += stride;
   }
   for (int y_mask = 0x01000100; y_mask < 0x0F0E0F0F; y_mask += 0x02020202) {
@@ -1578,9 +1578,9 @@ void aom_smooth_v_predictor_16x32_ssse3(
     const __m128i weights_y = _mm_shuffle_epi8(weights4, y_select);
     const __m128i scaled_bottom_left_y =
         _mm_shuffle_epi8(scaled_bottom_left4, y_select);
-    write_smooth_directional_sum16(dst, top_lo, top_hi, weights_y, weights_y,
-                                   scaled_bottom_left_y, scaled_bottom_left_y,
-                                   round);
+    write_smooth_directional_sum16(dst, &top_lo, &top_hi, &weights_y,
+                                   &weights_y, &scaled_bottom_left_y,
+                                   &scaled_bottom_left_y, &round);
     dst += stride;
   }
 }
@@ -1614,9 +1614,9 @@ void aom_smooth_v_predictor_16x64_ssse3(
       const __m128i weights_y = _mm_shuffle_epi8(weights_lo, y_select);
       const __m128i scaled_bottom_left_y =
           _mm_shuffle_epi8(scaled_bottom_left_lo, y_select);
-      write_smooth_directional_sum16(dst, top_lo, top_hi, weights_y, weights_y,
-                                     scaled_bottom_left_y, scaled_bottom_left_y,
-                                     round);
+      write_smooth_directional_sum16(dst, &top_lo, &top_hi, &weights_y,
+                                     &weights_y, &scaled_bottom_left_y,
+                                     &scaled_bottom_left_y, &round);
       dst += stride;
     }
     for (int y_mask = 0x01000100; y_mask < 0x0F0E0F0F; y_mask += 0x02020202) {
@@ -1624,9 +1624,9 @@ void aom_smooth_v_predictor_16x64_ssse3(
       const __m128i weights_y = _mm_shuffle_epi8(weights_hi, y_select);
       const __m128i scaled_bottom_left_y =
           _mm_shuffle_epi8(scaled_bottom_left_hi, y_select);
-      write_smooth_directional_sum16(dst, top_lo, top_hi, weights_y, weights_y,
-                                     scaled_bottom_left_y, scaled_bottom_left_y,
-                                     round);
+      write_smooth_directional_sum16(dst, &top_lo, &top_hi, &weights_y,
+                                     &weights_y, &scaled_bottom_left_y,
+                                     &scaled_bottom_left_y, &round);
       dst += stride;
     }
   }
@@ -1655,12 +1655,12 @@ void aom_smooth_v_predictor_32x8_ssse3(
     const __m128i weights_y = _mm_shuffle_epi8(weights, y_select);
     const __m128i scaled_bottom_left_y =
         _mm_shuffle_epi8(scaled_bottom_left, y_select);
-    write_smooth_directional_sum16(dst, top1, top2, weights_y, weights_y,
-                                   scaled_bottom_left_y, scaled_bottom_left_y,
-                                   round);
-    write_smooth_directional_sum16(dst + 16, top3, top4, weights_y, weights_y,
-                                   scaled_bottom_left_y, scaled_bottom_left_y,
-                                   round);
+    write_smooth_directional_sum16(dst, &top1, &top2, &weights_y, &weights_y,
+                                   &scaled_bottom_left_y, &scaled_bottom_left_y,
+                                   &round);
+    write_smooth_directional_sum16(dst + 16, &top3, &top4, &weights_y,
+                                   &weights_y, &scaled_bottom_left_y,
+                                   &scaled_bottom_left_y, &round);
     dst += stride;
   }
 }
@@ -1694,12 +1694,12 @@ void aom_smooth_v_predictor_32x16_ssse3(
     const __m128i weights_y = _mm_shuffle_epi8(weights1, y_select);
     const __m128i scaled_bottom_left_y =
         _mm_shuffle_epi8(scaled_bottom_left1, y_select);
-    write_smooth_directional_sum16(dst, top1, top2, weights_y, weights_y,
-                                   scaled_bottom_left_y, scaled_bottom_left_y,
-                                   round);
-    write_smooth_directional_sum16(dst + 16, top3, top4, weights_y, weights_y,
-                                   scaled_bottom_left_y, scaled_bottom_left_y,
-                                   round);
+    write_smooth_directional_sum16(dst, &top1, &top2, &weights_y, &weights_y,
+                                   &scaled_bottom_left_y, &scaled_bottom_left_y,
+                                   &round);
+    write_smooth_directional_sum16(dst + 16, &top3, &top4, &weights_y,
+                                   &weights_y, &scaled_bottom_left_y,
+                                   &scaled_bottom_left_y, &round);
     dst += stride;
   }
   for (int y_mask = 0x01000100; y_mask < 0x0F0E0F0F; y_mask += 0x02020202) {
@@ -1707,12 +1707,12 @@ void aom_smooth_v_predictor_32x16_ssse3(
     const __m128i weights_y = _mm_shuffle_epi8(weights2, y_select);
     const __m128i scaled_bottom_left_y =
         _mm_shuffle_epi8(scaled_bottom_left2, y_select);
-    write_smooth_directional_sum16(dst, top1, top2, weights_y, weights_y,
-                                   scaled_bottom_left_y, scaled_bottom_left_y,
-                                   round);
-    write_smooth_directional_sum16(dst + 16, top3, top4, weights_y, weights_y,
-                                   scaled_bottom_left_y, scaled_bottom_left_y,
-                                   round);
+    write_smooth_directional_sum16(dst, &top1, &top2, &weights_y, &weights_y,
+                                   &scaled_bottom_left_y, &scaled_bottom_left_y,
+                                   &round);
+    write_smooth_directional_sum16(dst + 16, &top3, &top4, &weights_y,
+                                   &weights_y, &scaled_bottom_left_y,
+                                   &scaled_bottom_left_y, &round);
     dst += stride;
   }
 }
@@ -1754,12 +1754,12 @@ void aom_smooth_v_predictor_32x32_ssse3(
     const __m128i weights_y = _mm_shuffle_epi8(weights1, y_select);
     const __m128i scaled_bottom_left_y =
         _mm_shuffle_epi8(scaled_bottom_left1, y_select);
-    write_smooth_directional_sum16(dst, top1, top2, weights_y, weights_y,
-                                   scaled_bottom_left_y, scaled_bottom_left_y,
-                                   round);
-    write_smooth_directional_sum16(dst + 16, top3, top4, weights_y, weights_y,
-                                   scaled_bottom_left_y, scaled_bottom_left_y,
-                                   round);
+    write_smooth_directional_sum16(dst, &top1, &top2, &weights_y, &weights_y,
+                                   &scaled_bottom_left_y, &scaled_bottom_left_y,
+                                   &round);
+    write_smooth_directional_sum16(dst + 16, &top3, &top4, &weights_y,
+                                   &weights_y, &scaled_bottom_left_y,
+                                   &scaled_bottom_left_y, &round);
     dst += stride;
   }
   for (int y_mask = 0x01000100; y_mask < 0x0F0E0F0F; y_mask += 0x02020202) {
@@ -1767,12 +1767,12 @@ void aom_smooth_v_predictor_32x32_ssse3(
     const __m128i weights_y = _mm_shuffle_epi8(weights2, y_select);
     const __m128i scaled_bottom_left_y =
         _mm_shuffle_epi8(scaled_bottom_left2, y_select);
-    write_smooth_directional_sum16(dst, top1, top2, weights_y, weights_y,
-                                   scaled_bottom_left_y, scaled_bottom_left_y,
-                                   round);
-    write_smooth_directional_sum16(dst + 16, top3, top4, weights_y, weights_y,
-                                   scaled_bottom_left_y, scaled_bottom_left_y,
-                                   round);
+    write_smooth_directional_sum16(dst, &top1, &top2, &weights_y, &weights_y,
+                                   &scaled_bottom_left_y, &scaled_bottom_left_y,
+                                   &round);
+    write_smooth_directional_sum16(dst + 16, &top3, &top4, &weights_y,
+                                   &weights_y, &scaled_bottom_left_y,
+                                   &scaled_bottom_left_y, &round);
     dst += stride;
   }
   for (int y_mask = 0x01000100; y_mask < 0x0F0E0F0F; y_mask += 0x02020202) {
@@ -1780,12 +1780,12 @@ void aom_smooth_v_predictor_32x32_ssse3(
     const __m128i weights_y = _mm_shuffle_epi8(weights3, y_select);
     const __m128i scaled_bottom_left_y =
         _mm_shuffle_epi8(scaled_bottom_left3, y_select);
-    write_smooth_directional_sum16(dst, top1, top2, weights_y, weights_y,
-                                   scaled_bottom_left_y, scaled_bottom_left_y,
-                                   round);
-    write_smooth_directional_sum16(dst + 16, top3, top4, weights_y, weights_y,
-                                   scaled_bottom_left_y, scaled_bottom_left_y,
-                                   round);
+    write_smooth_directional_sum16(dst, &top1, &top2, &weights_y, &weights_y,
+                                   &scaled_bottom_left_y, &scaled_bottom_left_y,
+                                   &round);
+    write_smooth_directional_sum16(dst + 16, &top3, &top4, &weights_y,
+                                   &weights_y, &scaled_bottom_left_y,
+                                   &scaled_bottom_left_y, &round);
     dst += stride;
   }
   for (int y_mask = 0x01000100; y_mask < 0x0F0E0F0F; y_mask += 0x02020202) {
@@ -1793,12 +1793,12 @@ void aom_smooth_v_predictor_32x32_ssse3(
     const __m128i weights_y = _mm_shuffle_epi8(weights4, y_select);
     const __m128i scaled_bottom_left_y =
         _mm_shuffle_epi8(scaled_bottom_left4, y_select);
-    write_smooth_directional_sum16(dst, top1, top2, weights_y, weights_y,
-                                   scaled_bottom_left_y, scaled_bottom_left_y,
-                                   round);
-    write_smooth_directional_sum16(dst + 16, top3, top4, weights_y, weights_y,
-                                   scaled_bottom_left_y, scaled_bottom_left_y,
-                                   round);
+    write_smooth_directional_sum16(dst, &top1, &top2, &weights_y, &weights_y,
+                                   &scaled_bottom_left_y, &scaled_bottom_left_y,
+                                   &round);
+    write_smooth_directional_sum16(dst + 16, &top3, &top4, &weights_y,
+                                   &weights_y, &scaled_bottom_left_y,
+                                   &scaled_bottom_left_y, &round);
     dst += stride;
   }
 }
@@ -1834,12 +1834,12 @@ void aom_smooth_v_predictor_32x64_ssse3(
       const __m128i weights_y = _mm_shuffle_epi8(weights_lo, y_select);
       const __m128i scaled_bottom_left_y =
           _mm_shuffle_epi8(scaled_bottom_left_lo, y_select);
-      write_smooth_directional_sum16(dst, top1, top2, weights_y, weights_y,
-                                     scaled_bottom_left_y, scaled_bottom_left_y,
-                                     round);
-      write_smooth_directional_sum16(dst + 16, top3, top4, weights_y, weights_y,
-                                     scaled_bottom_left_y, scaled_bottom_left_y,
-                                     round);
+      write_smooth_directional_sum16(dst, &top1, &top2, &weights_y, &weights_y,
+                                     &scaled_bottom_left_y,
+                                     &scaled_bottom_left_y, &round);
+      write_smooth_directional_sum16(dst + 16, &top3, &top4, &weights_y,
+                                     &weights_y, &scaled_bottom_left_y,
+                                     &scaled_bottom_left_y, &round);
       dst += stride;
     }
     for (int y_mask = 0x01000100; y_mask < 0x0F0E0F0F; y_mask += 0x02020202) {
@@ -1847,12 +1847,12 @@ void aom_smooth_v_predictor_32x64_ssse3(
       const __m128i weights_y = _mm_shuffle_epi8(weights_hi, y_select);
       const __m128i scaled_bottom_left_y =
           _mm_shuffle_epi8(scaled_bottom_left_hi, y_select);
-      write_smooth_directional_sum16(dst, top1, top2, weights_y, weights_y,
-                                     scaled_bottom_left_y, scaled_bottom_left_y,
-                                     round);
-      write_smooth_directional_sum16(dst + 16, top3, top4, weights_y, weights_y,
-                                     scaled_bottom_left_y, scaled_bottom_left_y,
-                                     round);
+      write_smooth_directional_sum16(dst, &top1, &top2, &weights_y, &weights_y,
+                                     &scaled_bottom_left_y,
+                                     &scaled_bottom_left_y, &round);
+      write_smooth_directional_sum16(dst + 16, &top3, &top4, &weights_y,
+                                     &weights_y, &scaled_bottom_left_y,
+                                     &scaled_bottom_left_y, &round);
       dst += stride;
     }
   }
@@ -1894,18 +1894,18 @@ void aom_smooth_v_predictor_64x16_ssse3(
     const __m128i weights_y = _mm_shuffle_epi8(weights1, y_select);
     const __m128i scaled_bottom_left_y =
         _mm_shuffle_epi8(scaled_bottom_left1, y_select);
-    write_smooth_directional_sum16(dst, top1, top2, weights_y, weights_y,
-                                   scaled_bottom_left_y, scaled_bottom_left_y,
-                                   round);
-    write_smooth_directional_sum16(dst + 16, top3, top4, weights_y, weights_y,
-                                   scaled_bottom_left_y, scaled_bottom_left_y,
-                                   round);
-    write_smooth_directional_sum16(dst + 32, top5, top6, weights_y, weights_y,
-                                   scaled_bottom_left_y, scaled_bottom_left_y,
-                                   round);
-    write_smooth_directional_sum16(dst + 48, top7, top8, weights_y, weights_y,
-                                   scaled_bottom_left_y, scaled_bottom_left_y,
-                                   round);
+    write_smooth_directional_sum16(dst, &top1, &top2, &weights_y, &weights_y,
+                                   &scaled_bottom_left_y, &scaled_bottom_left_y,
+                                   &round);
+    write_smooth_directional_sum16(dst + 16, &top3, &top4, &weights_y,
+                                   &weights_y, &scaled_bottom_left_y,
+                                   &scaled_bottom_left_y, &round);
+    write_smooth_directional_sum16(dst + 32, &top5, &top6, &weights_y,
+                                   &weights_y, &scaled_bottom_left_y,
+                                   &scaled_bottom_left_y, &round);
+    write_smooth_directional_sum16(dst + 48, &top7, &top8, &weights_y,
+                                   &weights_y, &scaled_bottom_left_y,
+                                   &scaled_bottom_left_y, &round);
     dst += stride;
   }
   for (int y_mask = 0x01000100; y_mask < 0x0F0E0F0F; y_mask += 0x02020202) {
@@ -1913,18 +1913,18 @@ void aom_smooth_v_predictor_64x16_ssse3(
     const __m128i weights_y = _mm_shuffle_epi8(weights2, y_select);
     const __m128i scaled_bottom_left_y =
         _mm_shuffle_epi8(scaled_bottom_left2, y_select);
-    write_smooth_directional_sum16(dst, top1, top2, weights_y, weights_y,
-                                   scaled_bottom_left_y, scaled_bottom_left_y,
-                                   round);
-    write_smooth_directional_sum16(dst + 16, top3, top4, weights_y, weights_y,
-                                   scaled_bottom_left_y, scaled_bottom_left_y,
-                                   round);
-    write_smooth_directional_sum16(dst + 32, top5, top6, weights_y, weights_y,
-                                   scaled_bottom_left_y, scaled_bottom_left_y,
-                                   round);
-    write_smooth_directional_sum16(dst + 48, top7, top8, weights_y, weights_y,
-                                   scaled_bottom_left_y, scaled_bottom_left_y,
-                                   round);
+    write_smooth_directional_sum16(dst, &top1, &top2, &weights_y, &weights_y,
+                                   &scaled_bottom_left_y, &scaled_bottom_left_y,
+                                   &round);
+    write_smooth_directional_sum16(dst + 16, &top3, &top4, &weights_y,
+                                   &weights_y, &scaled_bottom_left_y,
+                                   &scaled_bottom_left_y, &round);
+    write_smooth_directional_sum16(dst + 32, &top5, &top6, &weights_y,
+                                   &weights_y, &scaled_bottom_left_y,
+                                   &scaled_bottom_left_y, &round);
+    write_smooth_directional_sum16(dst + 48, &top7, &top8, &weights_y,
+                                   &weights_y, &scaled_bottom_left_y,
+                                   &scaled_bottom_left_y, &round);
     dst += stride;
   }
 }
@@ -1974,18 +1974,18 @@ void aom_smooth_v_predictor_64x32_ssse3(
     const __m128i weights_y = _mm_shuffle_epi8(weights1, y_select);
     const __m128i scaled_bottom_left_y =
         _mm_shuffle_epi8(scaled_bottom_left1, y_select);
-    write_smooth_directional_sum16(dst, top1, top2, weights_y, weights_y,
-                                   scaled_bottom_left_y, scaled_bottom_left_y,
-                                   round);
-    write_smooth_directional_sum16(dst + 16, top3, top4, weights_y, weights_y,
-                                   scaled_bottom_left_y, scaled_bottom_left_y,
-                                   round);
-    write_smooth_directional_sum16(dst + 32, top5, top6, weights_y, weights_y,
-                                   scaled_bottom_left_y, scaled_bottom_left_y,
-                                   round);
-    write_smooth_directional_sum16(dst + 48, top7, top8, weights_y, weights_y,
-                                   scaled_bottom_left_y, scaled_bottom_left_y,
-                                   round);
+    write_smooth_directional_sum16(dst, &top1, &top2, &weights_y, &weights_y,
+                                   &scaled_bottom_left_y, &scaled_bottom_left_y,
+                                   &round);
+    write_smooth_directional_sum16(dst + 16, &top3, &top4, &weights_y,
+                                   &weights_y, &scaled_bottom_left_y,
+                                   &scaled_bottom_left_y, &round);
+    write_smooth_directional_sum16(dst + 32, &top5, &top6, &weights_y,
+                                   &weights_y, &scaled_bottom_left_y,
+                                   &scaled_bottom_left_y, &round);
+    write_smooth_directional_sum16(dst + 48, &top7, &top8, &weights_y,
+                                   &weights_y, &scaled_bottom_left_y,
+                                   &scaled_bottom_left_y, &round);
     dst += stride;
   }
   for (int y_mask = 0x01000100; y_mask < 0x0F0E0F0F; y_mask += 0x02020202) {
@@ -1993,18 +1993,18 @@ void aom_smooth_v_predictor_64x32_ssse3(
     const __m128i weights_y = _mm_shuffle_epi8(weights2, y_select);
     const __m128i scaled_bottom_left_y =
         _mm_shuffle_epi8(scaled_bottom_left2, y_select);
-    write_smooth_directional_sum16(dst, top1, top2, weights_y, weights_y,
-                                   scaled_bottom_left_y, scaled_bottom_left_y,
-                                   round);
-    write_smooth_directional_sum16(dst + 16, top3, top4, weights_y, weights_y,
-                                   scaled_bottom_left_y, scaled_bottom_left_y,
-                                   round);
-    write_smooth_directional_sum16(dst + 32, top5, top6, weights_y, weights_y,
-                                   scaled_bottom_left_y, scaled_bottom_left_y,
-                                   round);
-    write_smooth_directional_sum16(dst + 48, top7, top8, weights_y, weights_y,
-                                   scaled_bottom_left_y, scaled_bottom_left_y,
-                                   round);
+    write_smooth_directional_sum16(dst, &top1, &top2, &weights_y, &weights_y,
+                                   &scaled_bottom_left_y, &scaled_bottom_left_y,
+                                   &round);
+    write_smooth_directional_sum16(dst + 16, &top3, &top4, &weights_y,
+                                   &weights_y, &scaled_bottom_left_y,
+                                   &scaled_bottom_left_y, &round);
+    write_smooth_directional_sum16(dst + 32, &top5, &top6, &weights_y,
+                                   &weights_y, &scaled_bottom_left_y,
+                                   &scaled_bottom_left_y, &round);
+    write_smooth_directional_sum16(dst + 48, &top7, &top8, &weights_y,
+                                   &weights_y, &scaled_bottom_left_y,
+                                   &scaled_bottom_left_y, &round);
     dst += stride;
   }
   for (int y_mask = 0x01000100; y_mask < 0x0F0E0F0F; y_mask += 0x02020202) {
@@ -2012,18 +2012,18 @@ void aom_smooth_v_predictor_64x32_ssse3(
     const __m128i weights_y = _mm_shuffle_epi8(weights3, y_select);
     const __m128i scaled_bottom_left_y =
         _mm_shuffle_epi8(scaled_bottom_left3, y_select);
-    write_smooth_directional_sum16(dst, top1, top2, weights_y, weights_y,
-                                   scaled_bottom_left_y, scaled_bottom_left_y,
-                                   round);
-    write_smooth_directional_sum16(dst + 16, top3, top4, weights_y, weights_y,
-                                   scaled_bottom_left_y, scaled_bottom_left_y,
-                                   round);
-    write_smooth_directional_sum16(dst + 32, top5, top6, weights_y, weights_y,
-                                   scaled_bottom_left_y, scaled_bottom_left_y,
-                                   round);
-    write_smooth_directional_sum16(dst + 48, top7, top8, weights_y, weights_y,
-                                   scaled_bottom_left_y, scaled_bottom_left_y,
-                                   round);
+    write_smooth_directional_sum16(dst, &top1, &top2, &weights_y, &weights_y,
+                                   &scaled_bottom_left_y, &scaled_bottom_left_y,
+                                   &round);
+    write_smooth_directional_sum16(dst + 16, &top3, &top4, &weights_y,
+                                   &weights_y, &scaled_bottom_left_y,
+                                   &scaled_bottom_left_y, &round);
+    write_smooth_directional_sum16(dst + 32, &top5, &top6, &weights_y,
+                                   &weights_y, &scaled_bottom_left_y,
+                                   &scaled_bottom_left_y, &round);
+    write_smooth_directional_sum16(dst + 48, &top7, &top8, &weights_y,
+                                   &weights_y, &scaled_bottom_left_y,
+                                   &scaled_bottom_left_y, &round);
     dst += stride;
   }
   for (int y_mask = 0x01000100; y_mask < 0x0F0E0F0F; y_mask += 0x02020202) {
@@ -2031,18 +2031,18 @@ void aom_smooth_v_predictor_64x32_ssse3(
     const __m128i weights_y = _mm_shuffle_epi8(weights4, y_select);
     const __m128i scaled_bottom_left_y =
         _mm_shuffle_epi8(scaled_bottom_left4, y_select);
-    write_smooth_directional_sum16(dst, top1, top2, weights_y, weights_y,
-                                   scaled_bottom_left_y, scaled_bottom_left_y,
-                                   round);
-    write_smooth_directional_sum16(dst + 16, top3, top4, weights_y, weights_y,
-                                   scaled_bottom_left_y, scaled_bottom_left_y,
-                                   round);
-    write_smooth_directional_sum16(dst + 32, top5, top6, weights_y, weights_y,
-                                   scaled_bottom_left_y, scaled_bottom_left_y,
-                                   round);
-    write_smooth_directional_sum16(dst + 48, top7, top8, weights_y, weights_y,
-                                   scaled_bottom_left_y, scaled_bottom_left_y,
-                                   round);
+    write_smooth_directional_sum16(dst, &top1, &top2, &weights_y, &weights_y,
+                                   &scaled_bottom_left_y, &scaled_bottom_left_y,
+                                   &round);
+    write_smooth_directional_sum16(dst + 16, &top3, &top4, &weights_y,
+                                   &weights_y, &scaled_bottom_left_y,
+                                   &scaled_bottom_left_y, &round);
+    write_smooth_directional_sum16(dst + 32, &top5, &top6, &weights_y,
+                                   &weights_y, &scaled_bottom_left_y,
+                                   &scaled_bottom_left_y, &round);
+    write_smooth_directional_sum16(dst + 48, &top7, &top8, &weights_y,
+                                   &weights_y, &scaled_bottom_left_y,
+                                   &scaled_bottom_left_y, &round);
     dst += stride;
   }
 }
@@ -2083,18 +2083,18 @@ void aom_smooth_v_predictor_64x64_ssse3(
       const __m128i weights_y = _mm_shuffle_epi8(weights_lo, y_select);
       const __m128i scaled_bottom_left_y =
           _mm_shuffle_epi8(scaled_bottom_left_lo, y_select);
-      write_smooth_directional_sum16(dst, top1, top2, weights_y, weights_y,
-                                     scaled_bottom_left_y, scaled_bottom_left_y,
-                                     round);
-      write_smooth_directional_sum16(dst + 16, top3, top4, weights_y, weights_y,
-                                     scaled_bottom_left_y, scaled_bottom_left_y,
-                                     round);
-      write_smooth_directional_sum16(dst + 32, top5, top6, weights_y, weights_y,
-                                     scaled_bottom_left_y, scaled_bottom_left_y,
-                                     round);
-      write_smooth_directional_sum16(dst + 48, top7, top8, weights_y, weights_y,
-                                     scaled_bottom_left_y, scaled_bottom_left_y,
-                                     round);
+      write_smooth_directional_sum16(dst, &top1, &top2, &weights_y, &weights_y,
+                                     &scaled_bottom_left_y,
+                                     &scaled_bottom_left_y, &round);
+      write_smooth_directional_sum16(dst + 16, &top3, &top4, &weights_y,
+                                     &weights_y, &scaled_bottom_left_y,
+                                     &scaled_bottom_left_y, &round);
+      write_smooth_directional_sum16(dst + 32, &top5, &top6, &weights_y,
+                                     &weights_y, &scaled_bottom_left_y,
+                                     &scaled_bottom_left_y, &round);
+      write_smooth_directional_sum16(dst + 48, &top7, &top8, &weights_y,
+                                     &weights_y, &scaled_bottom_left_y,
+                                     &scaled_bottom_left_y, &round);
       dst += stride;
     }
     for (int y_mask = 0x01000100; y_mask < 0x0F0E0F0F; y_mask += 0x02020202) {
@@ -2102,18 +2102,18 @@ void aom_smooth_v_predictor_64x64_ssse3(
       const __m128i weights_y = _mm_shuffle_epi8(weights_hi, y_select);
       const __m128i scaled_bottom_left_y =
           _mm_shuffle_epi8(scaled_bottom_left_hi, y_select);
-      write_smooth_directional_sum16(dst, top1, top2, weights_y, weights_y,
-                                     scaled_bottom_left_y, scaled_bottom_left_y,
-                                     round);
-      write_smooth_directional_sum16(dst + 16, top3, top4, weights_y, weights_y,
-                                     scaled_bottom_left_y, scaled_bottom_left_y,
-                                     round);
-      write_smooth_directional_sum16(dst + 32, top5, top6, weights_y, weights_y,
-                                     scaled_bottom_left_y, scaled_bottom_left_y,
-                                     round);
-      write_smooth_directional_sum16(dst + 48, top7, top8, weights_y, weights_y,
-                                     scaled_bottom_left_y, scaled_bottom_left_y,
-                                     round);
+      write_smooth_directional_sum16(dst, &top1, &top2, &weights_y, &weights_y,
+                                     &scaled_bottom_left_y,
+                                     &scaled_bottom_left_y, &round);
+      write_smooth_directional_sum16(dst + 16, &top3, &top4, &weights_y,
+                                     &weights_y, &scaled_bottom_left_y,
+                                     &scaled_bottom_left_y, &round);
+      write_smooth_directional_sum16(dst + 32, &top5, &top6, &weights_y,
+                                     &weights_y, &scaled_bottom_left_y,
+                                     &scaled_bottom_left_y, &round);
+      write_smooth_directional_sum16(dst + 48, &top7, &top8, &weights_y,
+                                     &weights_y, &scaled_bottom_left_y,
+                                     &scaled_bottom_left_y, &round);
       dst += stride;
     }
   }
@@ -2437,23 +2437,27 @@ void aom_smooth_h_predictor_16x4_ssse3(
   const __m128i round = _mm_set1_epi16(1 << (SMOOTH_WEIGHT_LOG2_SCALE - 1));
   __m128i y_mask = _mm_set1_epi32(0x01000100);
   __m128i left_y = _mm_shuffle_epi8(left, y_mask);
-  write_smooth_directional_sum16(dst, left_y, left_y, weights1, weights2,
-                                 scaled_top_right1, scaled_top_right2, round);
+  write_smooth_directional_sum16(dst, &left_y, &left_y, &weights1, &weights2,
+                                 &scaled_top_right1, &scaled_top_right2,
+                                 &round);
   dst += stride;
   y_mask = _mm_set1_epi32(0x03020302);
   left_y = _mm_shuffle_epi8(left, y_mask);
-  write_smooth_directional_sum16(dst, left_y, left_y, weights1, weights2,
-                                 scaled_top_right1, scaled_top_right2, round);
+  write_smooth_directional_sum16(dst, &left_y, &left_y, &weights1, &weights2,
+                                 &scaled_top_right1, &scaled_top_right2,
+                                 &round);
   dst += stride;
   y_mask = _mm_set1_epi32(0x05040504);
   left_y = _mm_shuffle_epi8(left, y_mask);
-  write_smooth_directional_sum16(dst, left_y, left_y, weights1, weights2,
-                                 scaled_top_right1, scaled_top_right2, round);
+  write_smooth_directional_sum16(dst, &left_y, &left_y, &weights1, &weights2,
+                                 &scaled_top_right1, &scaled_top_right2,
+                                 &round);
   dst += stride;
   y_mask = _mm_set1_epi32(0x07060706);
   left_y = _mm_shuffle_epi8(left, y_mask);
-  write_smooth_directional_sum16(dst, left_y, left_y, weights1, weights2,
-                                 scaled_top_right1, scaled_top_right2, round);
+  write_smooth_directional_sum16(dst, &left_y, &left_y, &weights1, &weights2,
+                                 &scaled_top_right1, &scaled_top_right2,
+                                 &round);
 }
 #endif  // !CONFIG_REALTIME_ONLY || CONFIG_AV1_DECODER

@@ -2477,8 +2481,9 @@ void aom_smooth_h_predictor_16x8_ssse3(
   for (int y_mask = 0x01000100; y_mask < 0x0F0E0F0F; y_mask += 0x02020202) {
     const __m128i y_select = _mm_set1_epi32(y_mask);
     const __m128i left_y = _mm_shuffle_epi8(left, y_select);
-    write_smooth_directional_sum16(dst, left_y, left_y, weights1, weights2,
-                                   scaled_top_right1, scaled_top_right2, round);
+    write_smooth_directional_sum16(dst, &left_y, &left_y, &weights1, &weights2,
+                                   &scaled_top_right1, &scaled_top_right2,
+                                   &round);
     dst += stride;
   }
 }
@@ -2503,16 +2508,18 @@ void aom_smooth_h_predictor_16x16_ssse3(
   for (int y_mask = 0x01000100; y_mask < 0x0F0E0F0F; y_mask += 0x02020202) {
     const __m128i y_select = _mm_set1_epi32(y_mask);
     const __m128i left_y = _mm_shuffle_epi8(left, y_select);
-    write_smooth_directional_sum16(dst, left_y, left_y, weights1, weights2,
-                                   scaled_top_right1, scaled_top_right2, round);
+    write_smooth_directional_sum16(dst, &left_y, &left_y, &weights1, &weights2,
+                                   &scaled_top_right1, &scaled_top_right2,
+                                   &round);
     dst += stride;
   }
   left = cvtepu8_epi16(LoadLo8(left_column + 8));
   for (int y_mask = 0x01000100; y_mask < 0x0F0E0F0F; y_mask += 0x02020202) {
     const __m128i y_select = _mm_set1_epi32(y_mask);
     const __m128i left_y = _mm_shuffle_epi8(left, y_select);
-    write_smooth_directional_sum16(dst, left_y, left_y, weights1, weights2,
-                                   scaled_top_right1, scaled_top_right2, round);
+    write_smooth_directional_sum16(dst, &left_y, &left_y, &weights1, &weights2,
+                                   &scaled_top_right1, &scaled_top_right2,
+                                   &round);
     dst += stride;
   }
 }
@@ -2537,32 +2544,36 @@ void aom_smooth_h_predictor_16x32_ssse3(
   for (int y_mask = 0x01000100; y_mask < 0x0F0E0F0F; y_mask += 0x02020202) {
     const __m128i y_select = _mm_set1_epi32(y_mask);
     const __m128i left_y = _mm_shuffle_epi8(left, y_select);
-    write_smooth_directional_sum16(dst, left_y, left_y, weights1, weights2,
-                                   scaled_top_right1, scaled_top_right2, round);
+    write_smooth_directional_sum16(dst, &left_y, &left_y, &weights1, &weights2,
+                                   &scaled_top_right1, &scaled_top_right2,
+                                   &round);
     dst += stride;
   }
   left = cvtepu8_epi16(LoadLo8(left_column + 8));
   for (int y_mask = 0x01000100; y_mask < 0x0F0E0F0F; y_mask += 0x02020202) {
     const __m128i y_select = _mm_set1_epi32(y_mask);
     const __m128i left_y = _mm_shuffle_epi8(left, y_select);
-    write_smooth_directional_sum16(dst, left_y, left_y, weights1, weights2,
-                                   scaled_top_right1, scaled_top_right2, round);
+    write_smooth_directional_sum16(dst, &left_y, &left_y, &weights1, &weights2,
+                                   &scaled_top_right1, &scaled_top_right2,
+                                   &round);
     dst += stride;
   }
   left = cvtepu8_epi16(LoadLo8(left_column + 16));
   for (int y_mask = 0x01000100; y_mask < 0x0F0E0F0F; y_mask += 0x02020202) {
     const __m128i y_select = _mm_set1_epi32(y_mask);
     const __m128i left_y = _mm_shuffle_epi8(left, y_select);
-    write_smooth_directional_sum16(dst, left_y, left_y, weights1, weights2,
-                                   scaled_top_right1, scaled_top_right2, round);
+    write_smooth_directional_sum16(dst, &left_y, &left_y, &weights1, &weights2,
+                                   &scaled_top_right1, &scaled_top_right2,
+                                   &round);
     dst += stride;
   }
   left = cvtepu8_epi16(LoadLo8(left_column + 24));
   for (int y_mask = 0x01000100; y_mask < 0x0F0E0F0F; y_mask += 0x02020202) {
     const __m128i y_select = _mm_set1_epi32(y_mask);
     const __m128i left_y = _mm_shuffle_epi8(left, y_select);
-    write_smooth_directional_sum16(dst, left_y, left_y, weights1, weights2,
-                                   scaled_top_right1, scaled_top_right2, round);
+    write_smooth_directional_sum16(dst, &left_y, &left_y, &weights1, &weights2,
+                                   &scaled_top_right1, &scaled_top_right2,
+                                   &round);
     dst += stride;
   }
 }
@@ -2589,9 +2600,9 @@ void aom_smooth_h_predictor_16x64_ssse3(
     for (int y_mask = 0x01000100; y_mask < 0x0F0E0F0F; y_mask += 0x02020202) {
       const __m128i y_select = _mm_set1_epi32(y_mask);
       const __m128i left_y = _mm_shuffle_epi8(left, y_select);
-      write_smooth_directional_sum16(dst, left_y, left_y, weights1, weights2,
-                                     scaled_top_right1, scaled_top_right2,
-                                     round);
+      write_smooth_directional_sum16(dst, &left_y, &left_y, &weights1,
+                                     &weights2, &scaled_top_right1,
+                                     &scaled_top_right2, &round);
       dst += stride;
     }
   }
@@ -2626,10 +2637,12 @@ void aom_smooth_h_predictor_32x8_ssse3(
   for (int y_mask = 0x01000100; y_mask < 0x0F0E0F0F; y_mask += 0x02020202) {
     __m128i y_select = _mm_set1_epi32(y_mask);
     __m128i left_y = _mm_shuffle_epi8(left, y_select);
-    write_smooth_directional_sum16(dst, left_y, left_y, weights1, weights2,
-                                   scaled_top_right1, scaled_top_right2, round);
-    write_smooth_directional_sum16(dst + 16, left_y, left_y, weights3, weights4,
-                                   scaled_top_right3, scaled_top_right4, round);
+    write_smooth_directional_sum16(dst, &left_y, &left_y, &weights1, &weights2,
+                                   &scaled_top_right1, &scaled_top_right2,
+                                   &round);
+    write_smooth_directional_sum16(dst + 16, &left_y, &left_y, &weights3,
+                                   &weights4, &scaled_top_right3,
+                                   &scaled_top_right4, &round);
     dst += stride;
   }
 }
@@ -2664,10 +2677,12 @@ void aom_smooth_h_predictor_32x16_ssse3(
   for (int y_mask = 0x01000100; y_mask < 0x0F0E0F0F; y_mask += 0x02020202) {
     __m128i y_select = _mm_set1_epi32(y_mask);
     __m128i left_y = _mm_shuffle_epi8(left1, y_select);
-    write_smooth_directional_sum16(dst, left_y, left_y, weights1, weights2,
-                                   scaled_top_right1, scaled_top_right2, round);
-    write_smooth_directional_sum16(dst + 16, left_y, left_y, weights3, weights4,
-                                   scaled_top_right3, scaled_top_right4, round);
+    write_smooth_directional_sum16(dst, &left_y, &left_y, &weights1, &weights2,
+                                   &scaled_top_right1, &scaled_top_right2,
+                                   &round);
+    write_smooth_directional_sum16(dst + 16, &left_y, &left_y, &weights3,
+                                   &weights4, &scaled_top_right3,
+                                   &scaled_top_right4, &round);
     dst += stride;
   }
   const __m128i left2 =
@@ -2675,10 +2690,12 @@ void aom_smooth_h_predictor_32x16_ssse3(
   for (int y_mask = 0x01000100; y_mask < 0x0F0E0F0F; y_mask += 0x02020202) {
     __m128i y_select = _mm_set1_epi32(y_mask);
     __m128i left_y = _mm_shuffle_epi8(left2, y_select);
-    write_smooth_directional_sum16(dst, left_y, left_y, weights1, weights2,
-                                   scaled_top_right1, scaled_top_right2, round);
-    write_smooth_directional_sum16(dst + 16, left_y, left_y, weights3, weights4,
-                                   scaled_top_right3, scaled_top_right4, round);
+    write_smooth_directional_sum16(dst, &left_y, &left_y, &weights1, &weights2,
+                                   &scaled_top_right1, &scaled_top_right2,
+                                   &round);
+    write_smooth_directional_sum16(dst + 16, &left_y, &left_y, &weights3,
+                                   &weights4, &scaled_top_right3,
+                                   &scaled_top_right4, &round);
     dst += stride;
   }
 }
@@ -2712,40 +2729,48 @@ void aom_smooth_h_predictor_32x32_ssse3(
   for (int y_mask = 0x01000100; y_mask < 0x0F0E0F0F; y_mask += 0x02020202) {
     __m128i y_select = _mm_set1_epi32(y_mask);
     __m128i left_y = _mm_shuffle_epi8(left, y_select);
-    write_smooth_directional_sum16(dst, left_y, left_y, weights1, weights2,
-                                   scaled_top_right1, scaled_top_right2, round);
-    write_smooth_directional_sum16(dst + 16, left_y, left_y, weights3, weights4,
-                                   scaled_top_right3, scaled_top_right4, round);
+    write_smooth_directional_sum16(dst, &left_y, &left_y, &weights1, &weights2,
+                                   &scaled_top_right1, &scaled_top_right2,
+                                   &round);
+    write_smooth_directional_sum16(dst + 16, &left_y, &left_y, &weights3,
+                                   &weights4, &scaled_top_right3,
+                                   &scaled_top_right4, &round);
     dst += stride;
   }
   left = cvtepu8_epi16(LoadLo8(left_column + 8));
   for (int y_mask = 0x01000100; y_mask < 0x0F0E0F0F; y_mask += 0x02020202) {
     __m128i y_select = _mm_set1_epi32(y_mask);
     __m128i left_y = _mm_shuffle_epi8(left, y_select);
-    write_smooth_directional_sum16(dst, left_y, left_y, weights1, weights2,
-                                   scaled_top_right1, scaled_top_right2, round);
-    write_smooth_directional_sum16(dst + 16, left_y, left_y, weights3, weights4,
-                                   scaled_top_right3, scaled_top_right4, round);
+    write_smooth_directional_sum16(dst, &left_y, &left_y, &weights1, &weights2,
+                                   &scaled_top_right1, &scaled_top_right2,
+                                   &round);
+    write_smooth_directional_sum16(dst + 16, &left_y, &left_y, &weights3,
+                                   &weights4, &scaled_top_right3,
+                                   &scaled_top_right4, &round);
     dst += stride;
   }
   left = cvtepu8_epi16(LoadLo8(left_column + 16));
   for (int y_mask = 0x01000100; y_mask < 0x0F0E0F0F; y_mask += 0x02020202) {
     __m128i y_select = _mm_set1_epi32(y_mask);
     __m128i left_y = _mm_shuffle_epi8(left, y_select);
-    write_smooth_directional_sum16(dst, left_y, left_y, weights1, weights2,
-                                   scaled_top_right1, scaled_top_right2, round);
-    write_smooth_directional_sum16(dst + 16, left_y, left_y, weights3, weights4,
-                                   scaled_top_right3, scaled_top_right4, round);
+    write_smooth_directional_sum16(dst, &left_y, &left_y, &weights1, &weights2,
+                                   &scaled_top_right1, &scaled_top_right2,
+                                   &round);
+    write_smooth_directional_sum16(dst + 16, &left_y, &left_y, &weights3,
+                                   &weights4, &scaled_top_right3,
+                                   &scaled_top_right4, &round);
     dst += stride;
   }
   left = cvtepu8_epi16(LoadLo8(left_column + 24));
   for (int y_mask = 0x01000100; y_mask < 0x0F0E0F0F; y_mask += 0x02020202) {
     __m128i y_select = _mm_set1_epi32(y_mask);
     __m128i left_y = _mm_shuffle_epi8(left, y_select);
-    write_smooth_directional_sum16(dst, left_y, left_y, weights1, weights2,
-                                   scaled_top_right1, scaled_top_right2, round);
-    write_smooth_directional_sum16(dst + 16, left_y, left_y, weights3, weights4,
-                                   scaled_top_right3, scaled_top_right4, round);
+    write_smooth_directional_sum16(dst, &left_y, &left_y, &weights1, &weights2,
+                                   &scaled_top_right1, &scaled_top_right2,
+                                   &round);
+    write_smooth_directional_sum16(dst + 16, &left_y, &left_y, &weights3,
+                                   &weights4, &scaled_top_right3,
+                                   &scaled_top_right4, &round);
     dst += stride;
   }
 }
@@ -2780,12 +2805,12 @@ void aom_smooth_h_predictor_32x64_ssse3(
     for (int y_mask = 0x01000100; y_mask < 0x0F0E0F0F; y_mask += 0x02020202) {
       const __m128i y_select = _mm_set1_epi32(y_mask);
       const __m128i left_y = _mm_shuffle_epi8(left, y_select);
-      write_smooth_directional_sum16(dst, left_y, left_y, weights1, weights2,
-                                     scaled_top_right1, scaled_top_right2,
-                                     round);
-      write_smooth_directional_sum16(dst + 16, left_y, left_y, weights3,
-                                     weights4, scaled_top_right3,
-                                     scaled_top_right4, round);
+      write_smooth_directional_sum16(dst, &left_y, &left_y, &weights1,
+                                     &weights2, &scaled_top_right1,
+                                     &scaled_top_right2, &round);
+      write_smooth_directional_sum16(dst + 16, &left_y, &left_y, &weights3,
+                                     &weights4, &scaled_top_right3,
+                                     &scaled_top_right4, &round);
       dst += stride;
     }
   }
@@ -2839,28 +2864,36 @@ void aom_smooth_h_predictor_64x16_ssse3(
   for (int y_mask = 0x01000100; y_mask < 0x0F0E0F0F; y_mask += 0x02020202) {
     __m128i y_select = _mm_set1_epi32(y_mask);
     __m128i left_y = _mm_shuffle_epi8(left1, y_select);
-    write_smooth_directional_sum16(dst, left_y, left_y, weights1, weights2,
-                                   scaled_top_right1, scaled_top_right2, round);
-    write_smooth_directional_sum16(dst + 16, left_y, left_y, weights3, weights4,
-                                   scaled_top_right3, scaled_top_right4, round);
-    write_smooth_directional_sum16(dst + 32, left_y, left_y, weights5, weights6,
-                                   scaled_top_right5, scaled_top_right6, round);
-    write_smooth_directional_sum16(dst + 48, left_y, left_y, weights7, weights8,
-                                   scaled_top_right7, scaled_top_right8, round);
+    write_smooth_directional_sum16(dst, &left_y, &left_y, &weights1, &weights2,
+                                   &scaled_top_right1, &scaled_top_right2,
+                                   &round);
+    write_smooth_directional_sum16(dst + 16, &left_y, &left_y, &weights3,
+                                   &weights4, &scaled_top_right3,
+                                   &scaled_top_right4, &round);
+    write_smooth_directional_sum16(dst + 32, &left_y, &left_y, &weights5,
+                                   &weights6, &scaled_top_right5,
+                                   &scaled_top_right6, &round);
+    write_smooth_directional_sum16(dst + 48, &left_y, &left_y, &weights7,
+                                   &weights8, &scaled_top_right7,
+                                   &scaled_top_right8, &round);
     dst += stride;
   }
   const __m128i left2 = cvtepu8_epi16(LoadLo8(left_column + 8));
   for (int y_mask = 0x01000100; y_mask < 0x0F0E0F0F; y_mask += 0x02020202) {
     __m128i y_select = _mm_set1_epi32(y_mask);
     __m128i left_y = _mm_shuffle_epi8(left2, y_select);
-    write_smooth_directional_sum16(dst, left_y, left_y, weights1, weights2,
-                                   scaled_top_right1, scaled_top_right2, round);
-    write_smooth_directional_sum16(dst + 16, left_y, left_y, weights3, weights4,
-                                   scaled_top_right3, scaled_top_right4, round);
-    write_smooth_directional_sum16(dst + 32, left_y, left_y, weights5, weights6,
-                                   scaled_top_right5, scaled_top_right6, round);
-    write_smooth_directional_sum16(dst + 48, left_y, left_y, weights7, weights8,
-                                   scaled_top_right7, scaled_top_right8, round);
+    write_smooth_directional_sum16(dst, &left_y, &left_y, &weights1, &weights2,
+                                   &scaled_top_right1, &scaled_top_right2,
+                                   &round);
+    write_smooth_directional_sum16(dst + 16, &left_y, &left_y, &weights3,
+                                   &weights4, &scaled_top_right3,
+                                   &scaled_top_right4, &round);
+    write_smooth_directional_sum16(dst + 32, &left_y, &left_y, &weights5,
+                                   &weights6, &scaled_top_right5,
+                                   &scaled_top_right6, &round);
+    write_smooth_directional_sum16(dst + 48, &left_y, &left_y, &weights7,
+                                   &weights8, &scaled_top_right7,
+                                   &scaled_top_right8, &round);
     dst += stride;
   }
 }
@@ -2913,56 +2946,72 @@ void aom_smooth_h_predictor_64x32_ssse3(
   for (int y_mask = 0x01000100; y_mask < 0x0F0E0F0F; y_mask += 0x02020202) {
     const __m128i y_select = _mm_set1_epi32(y_mask);
     const __m128i left_y = _mm_shuffle_epi8(left1, y_select);
-    write_smooth_directional_sum16(dst, left_y, left_y, weights1, weights2,
-                                   scaled_top_right1, scaled_top_right2, round);
-    write_smooth_directional_sum16(dst + 16, left_y, left_y, weights3, weights4,
-                                   scaled_top_right3, scaled_top_right4, round);
-    write_smooth_directional_sum16(dst + 32, left_y, left_y, weights5, weights6,
-                                   scaled_top_right5, scaled_top_right6, round);
-    write_smooth_directional_sum16(dst + 48, left_y, left_y, weights7, weights8,
-                                   scaled_top_right7, scaled_top_right8, round);
+    write_smooth_directional_sum16(dst, &left_y, &left_y, &weights1, &weights2,
+                                   &scaled_top_right1, &scaled_top_right2,
+                                   &round);
+    write_smooth_directional_sum16(dst + 16, &left_y, &left_y, &weights3,
+                                   &weights4, &scaled_top_right3,
+                                   &scaled_top_right4, &round);
+    write_smooth_directional_sum16(dst + 32, &left_y, &left_y, &weights5,
+                                   &weights6, &scaled_top_right5,
+                                   &scaled_top_right6, &round);
+    write_smooth_directional_sum16(dst + 48, &left_y, &left_y, &weights7,
+                                   &weights8, &scaled_top_right7,
+                                   &scaled_top_right8, &round);
     dst += stride;
   }
   const __m128i left2 = cvtepu8_epi16(LoadLo8(left_column + 8));
   for (int y_mask = 0x01000100; y_mask < 0x0F0E0F0F; y_mask += 0x02020202) {
     const __m128i y_select = _mm_set1_epi32(y_mask);
     const __m128i left_y = _mm_shuffle_epi8(left2, y_select);
-    write_smooth_directional_sum16(dst, left_y, left_y, weights1, weights2,
-                                   scaled_top_right1, scaled_top_right2, round);
-    write_smooth_directional_sum16(dst + 16, left_y, left_y, weights3, weights4,
-                                   scaled_top_right3, scaled_top_right4, round);
-    write_smooth_directional_sum16(dst + 32, left_y, left_y, weights5, weights6,
-                                   scaled_top_right5, scaled_top_right6, round);
-    write_smooth_directional_sum16(dst + 48, left_y, left_y, weights7, weights8,
-                                   scaled_top_right7, scaled_top_right8, round);
+    write_smooth_directional_sum16(dst, &left_y, &left_y, &weights1, &weights2,
+                                   &scaled_top_right1, &scaled_top_right2,
+                                   &round);
+    write_smooth_directional_sum16(dst + 16, &left_y, &left_y, &weights3,
+                                   &weights4, &scaled_top_right3,
+                                   &scaled_top_right4, &round);
+    write_smooth_directional_sum16(dst + 32, &left_y, &left_y, &weights5,
+                                   &weights6, &scaled_top_right5,
+                                   &scaled_top_right6, &round);
+    write_smooth_directional_sum16(dst + 48, &left_y, &left_y, &weights7,
+                                   &weights8, &scaled_top_right7,
+                                   &scaled_top_right8, &round);
     dst += stride;
   }
   const __m128i left3 = cvtepu8_epi16(LoadLo8(left_column + 16));
   for (int y_mask = 0x01000100; y_mask < 0x0F0E0F0F; y_mask += 0x02020202) {
     const __m128i y_select = _mm_set1_epi32(y_mask);
     const __m128i left_y = _mm_shuffle_epi8(left3, y_select);
-    write_smooth_directional_sum16(dst, left_y, left_y, weights1, weights2,
-                                   scaled_top_right1, scaled_top_right2, round);
-    write_smooth_directional_sum16(dst + 16, left_y, left_y, weights3, weights4,
-                                   scaled_top_right3, scaled_top_right4, round);
-    write_smooth_directional_sum16(dst + 32, left_y, left_y, weights5, weights6,
-                                   scaled_top_right5, scaled_top_right6, round);
-    write_smooth_directional_sum16(dst + 48, left_y, left_y, weights7, weights8,
-                                   scaled_top_right7, scaled_top_right8, round);
+    write_smooth_directional_sum16(dst, &left_y, &left_y, &weights1, &weights2,
+                                   &scaled_top_right1, &scaled_top_right2,
+                                   &round);
+    write_smooth_directional_sum16(dst + 16, &left_y, &left_y, &weights3,
+                                   &weights4, &scaled_top_right3,
+                                   &scaled_top_right4, &round);
+    write_smooth_directional_sum16(dst + 32, &left_y, &left_y, &weights5,
+                                   &weights6, &scaled_top_right5,
+                                   &scaled_top_right6, &round);
+    write_smooth_directional_sum16(dst + 48, &left_y, &left_y, &weights7,
+                                   &weights8, &scaled_top_right7,
+                                   &scaled_top_right8, &round);
     dst += stride;
   }
   const __m128i left4 = cvtepu8_epi16(LoadLo8(left_column + 24));
   for (int y_mask = 0x01000100; y_mask < 0x0F0E0F0F; y_mask += 0x02020202) {
     const __m128i y_select = _mm_set1_epi32(y_mask);
     const __m128i left_y = _mm_shuffle_epi8(left4, y_select);
-    write_smooth_directional_sum16(dst, left_y, left_y, weights1, weights2,
-                                   scaled_top_right1, scaled_top_right2, round);
-    write_smooth_directional_sum16(dst + 16, left_y, left_y, weights3, weights4,
-                                   scaled_top_right3, scaled_top_right4, round);
-    write_smooth_directional_sum16(dst + 32, left_y, left_y, weights5, weights6,
-                                   scaled_top_right5, scaled_top_right6, round);
-    write_smooth_directional_sum16(dst + 48, left_y, left_y, weights7, weights8,
-                                   scaled_top_right7, scaled_top_right8, round);
+    write_smooth_directional_sum16(dst, &left_y, &left_y, &weights1, &weights2,
+                                   &scaled_top_right1, &scaled_top_right2,
+                                   &round);
+    write_smooth_directional_sum16(dst + 16, &left_y, &left_y, &weights3,
+                                   &weights4, &scaled_top_right3,
+                                   &scaled_top_right4, &round);
+    write_smooth_directional_sum16(dst + 32, &left_y, &left_y, &weights5,
+                                   &weights6, &scaled_top_right5,
+                                   &scaled_top_right6, &round);
+    write_smooth_directional_sum16(dst + 48, &left_y, &left_y, &weights7,
+                                   &weights8, &scaled_top_right7,
+                                   &scaled_top_right8, &round);
     dst += stride;
   }
 }
@@ -3015,18 +3064,18 @@ void aom_smooth_h_predictor_64x64_ssse3(
     for (int y_mask = 0x01000100; y_mask < 0x0F0E0F0F; y_mask += 0x02020202) {
       const __m128i y_select = _mm_set1_epi32(y_mask);
       const __m128i left_y = _mm_shuffle_epi8(left, y_select);
-      write_smooth_directional_sum16(dst, left_y, left_y, weights1, weights2,
-                                     scaled_top_right1, scaled_top_right2,
-                                     round);
-      write_smooth_directional_sum16(dst + 16, left_y, left_y, weights3,
-                                     weights4, scaled_top_right3,
-                                     scaled_top_right4, round);
-      write_smooth_directional_sum16(dst + 32, left_y, left_y, weights5,
-                                     weights6, scaled_top_right5,
-                                     scaled_top_right6, round);
-      write_smooth_directional_sum16(dst + 48, left_y, left_y, weights7,
-                                     weights8, scaled_top_right7,
-                                     scaled_top_right8, round);
+      write_smooth_directional_sum16(dst, &left_y, &left_y, &weights1,
+                                     &weights2, &scaled_top_right1,
+                                     &scaled_top_right2, &round);
+      write_smooth_directional_sum16(dst + 16, &left_y, &left_y, &weights3,
+                                     &weights4, &scaled_top_right3,
+                                     &scaled_top_right4, &round);
+      write_smooth_directional_sum16(dst + 32, &left_y, &left_y, &weights5,
+                                     &weights6, &scaled_top_right5,
+                                     &scaled_top_right6, &round);
+      write_smooth_directional_sum16(dst + 48, &left_y, &left_y, &weights7,
+                                     &weights8, &scaled_top_right7,
+                                     &scaled_top_right8, &round);
       dst += stride;
     }
   }
diff --git a/av1/common/x86/cfl_ssse3.c b/av1/common/x86/cfl_ssse3.c
index 008780a213..1577046932 100644
--- a/av1/common/x86/cfl_ssse3.c
+++ b/av1/common/x86/cfl_ssse3.c
@@ -15,6 +15,7 @@

 #include "config/av1_rtcd.h"

+#include "aom_dsp/aom_dsp_common.h"
 #include "aom_dsp/x86/mem_sse2.h"
 #include "aom_dsp/x86/synonyms.h"
 #include "av1/common/cfl.h"
@@ -305,18 +306,20 @@ static inline void cfl_luma_subsampling_444_hbd_ssse3(const uint16_t *input,

 CFL_GET_SUBSAMPLE_FUNCTION(ssse3)

-static inline __m128i predict_unclipped_vec(__m128i ac_q3, __m128i alpha_q12,
-                                            __m128i alpha_sign, __m128i dc_q0) {
-  __m128i ac_sign = _mm_sign_epi16(alpha_sign, ac_q3);
-  __m128i scaled_luma_q0 = _mm_mulhrs_epi16(_mm_abs_epi16(ac_q3), alpha_q12);
+static AOM_FORCE_INLINE __m128i predict_unclipped_vec(const __m128i *ac_q3,
+                                                      const __m128i *alpha_q12,
+                                                      const __m128i *alpha_sign,
+                                                      const __m128i *dc_q0) {
+  __m128i ac_sign = _mm_sign_epi16(*alpha_sign, *ac_q3);
+  __m128i scaled_luma_q0 = _mm_mulhrs_epi16(_mm_abs_epi16(*ac_q3), *alpha_q12);
   scaled_luma_q0 = _mm_sign_epi16(scaled_luma_q0, ac_sign);
-  return _mm_add_epi16(scaled_luma_q0, dc_q0);
+  return _mm_add_epi16(scaled_luma_q0, *dc_q0);
 }

 static inline __m128i predict_unclipped(const __m128i *input, __m128i alpha_q12,
                                         __m128i alpha_sign, __m128i dc_q0) {
-  return predict_unclipped_vec(_mm_loadu_si128(input), alpha_q12, alpha_sign,
-                               dc_q0);
+  const __m128i ac_q3 = _mm_loadu_si128(input);
+  return predict_unclipped_vec(&ac_q3, &alpha_q12, &alpha_sign, &dc_q0);
 }

 static inline void cfl_predict_lbd_ssse3(const int16_t *pred_buf_q3,
@@ -332,7 +335,8 @@ static inline void cfl_predict_lbd_ssse3(const int16_t *pred_buf_q3,
   if (width == 4) {
     do {
       const __m128i ac_q3 = xx_loadu_2x64(row + CFL_BUF_LINE_I128, row);
-      __m128i res = predict_unclipped_vec(ac_q3, alpha_q12, alpha_sign, dc_q0);
+      __m128i res =
+          predict_unclipped_vec(&ac_q3, &alpha_q12, &alpha_sign, &dc_q0);
       res = _mm_packus_epi16(res, res);
       xx_storel_32(dst, res);
       xx_storel_32(dst + dst_stride, _mm_srli_si128(res, 4));
diff --git a/av1/encoder/x86/av1_fwd_txfm2d_avx2.c b/av1/encoder/x86/av1_fwd_txfm2d_avx2.c
index 50e222d851..282c407255 100644
--- a/av1/encoder/x86/av1_fwd_txfm2d_avx2.c
+++ b/av1/encoder/x86/av1_fwd_txfm2d_avx2.c
@@ -2294,17 +2294,17 @@ static inline __m256i pair_set_w16x2_epi16(int16_t a, int16_t b, int16_t c,
   return _mm256_setr_epi32(lo, lo, lo, lo, hi, hi, hi, hi);
 }

-static AOM_FORCE_INLINE __m256i btf_16_w16_out0_avx2(const __m256i w,
-                                                     const __m256i in0,
-                                                     const __m256i in1,
-                                                     const __m256i r,
+static AOM_FORCE_INLINE __m256i btf_16_w16_out0_avx2(const __m256i *w,
+                                                     const __m256i *in0,
+                                                     const __m256i *in1,
+                                                     const __m256i *r,
                                                      const int32_t cos_bit) {
-  const __m256i t0 = _mm256_unpacklo_epi16(in0, in1);
-  const __m256i t1 = _mm256_unpackhi_epi16(in0, in1);
-  const __m256i u0 = _mm256_madd_epi16(t0, w);
-  const __m256i u1 = _mm256_madd_epi16(t1, w);
-  const __m256i c0 = _mm256_srai_epi32(_mm256_add_epi32(u0, r), cos_bit);
-  const __m256i c1 = _mm256_srai_epi32(_mm256_add_epi32(u1, r), cos_bit);
+  const __m256i t0 = _mm256_unpacklo_epi16(*in0, *in1);
+  const __m256i t1 = _mm256_unpackhi_epi16(*in0, *in1);
+  const __m256i u0 = _mm256_madd_epi16(t0, *w);
+  const __m256i u1 = _mm256_madd_epi16(t1, *w);
+  const __m256i c0 = _mm256_srai_epi32(_mm256_add_epi32(u0, *r), cos_bit);
+  const __m256i c1 = _mm256_srai_epi32(_mm256_add_epi32(u1, *r), cos_bit);
   return _mm256_packs_epi32(c0, c1);
 }

@@ -2351,9 +2351,9 @@ static AOM_FORCE_INLINE void fdct8x8_dual_avx2(const __m256i *p, __m256i *q) {
   // stage 2: e01 = [x2_0 | x2_1], e32 = [x2_3 | x2_2], x56 = [x2_5 | x2_6].
   const __m256i e01 = _mm256_adds_epi16(s01, s32);
   const __m256i e32 = _mm256_subs_epi16(s01, s32);
-  const __m256i x56 =
-      btf_16_w16_out0_avx2(w_s2, _mm256_permute2x128_si256(d45, d45, 0x11),
-                           _mm256_permute2x128_si256(d76, d76, 0x11), r, 13);
+  const __m256i in0_s2 = _mm256_permute2x128_si256(d45, d45, 0x11);
+  const __m256i in1_s2 = _mm256_permute2x128_si256(d76, d76, 0x11);
+  const __m256i x56 = btf_16_w16_out0_avx2(&w_s2, &in0_s2, &in1_s2, &r, 13);

   // stage 3
   __m256i in0 = _mm256_blend_epi32(e01, e32, 0xF0);         // [x2_0 | x2_2]
@@ -3473,15 +3473,18 @@ static inline void fidentity8x8_new_avx2(const __m256i *input, __m256i *output,
   output[7] = _mm256_adds_epi16(input[7], input[7]);
 }

-// Odd half of 16-point DCT on dual-lane inputs d0..d3:
-//   d0 = [x1_8 | x1_9], d1 = [x1_11 | x1_10],
-//   d2 = [x1_12 | x1_13], d3 = [x1_15 | x1_14].
+// Odd half of 16-point DCT on dual-lane inputs d[0..3]:
+//   d[0] = [x1_8 | x1_9], d[1] = [x1_11 | x1_10],
+//   d[2] = [x1_12 | x1_13], d[3] = [x1_15 | x1_14].
 // Outputs:
 //   q_odd[0] = [o1 | o9], q_odd[1] = [o15 | o7],
 //   q_odd[2] = [o5 | o13], q_odd[3] = [o11 | o3].
-static AOM_FORCE_INLINE void fdct8x16_odd_dual_avx2(__m256i d0, __m256i d1,
-                                                    __m256i d2, __m256i d3,
+static AOM_FORCE_INLINE void fdct8x16_odd_dual_avx2(const __m256i *d,
                                                     __m256i *q_odd) {
+  const __m256i d0 = d[0];
+  __m256i d1 = d[1];
+  __m256i d2 = d[2];
+  const __m256i d3 = d[3];
   const int32_t *cospi = cospi_arr(13);
   const __m256i r = _mm256_set1_epi32(1 << 12);
   const __m256i w0_s2 = pair_set_w16_epi16(-cospi[32], cospi[32]);
@@ -3548,14 +3551,16 @@ static inline void fdct8x16_new_avx2(const __m256i *input, __m256i *output,
   s[2] = _mm256_adds_epi16(x_4_5, x_11_10);
   s[3] = _mm256_adds_epi16(x_7_6, x_8_9);

-  const __m256i d0 = _mm256_subs_epi16(x_7_6, x_8_9);
-  const __m256i d1 = _mm256_subs_epi16(x_4_5, x_11_10);
-  const __m256i d2 = _mm256_subs_epi16(x_3_2, x_12_13);
-  const __m256i d3 = _mm256_subs_epi16(x_0_1, x_15_14);
+  const __m256i d[4] = {
+    _mm256_subs_epi16(x_7_6, x_8_9),
+    _mm256_subs_epi16(x_4_5, x_11_10),
+    _mm256_subs_epi16(x_3_2, x_12_13),
+    _mm256_subs_epi16(x_0_1, x_15_14),
+  };

   __m256i q_even[4], q_odd[4];
   fdct8x8_dual_avx2(s, q_even);
-  fdct8x16_odd_dual_avx2(d0, d1, d2, d3, q_odd);
+  fdct8x16_odd_dual_avx2(d, q_odd);

   output[0] = _mm256_permute2x128_si256(q_even[0], q_even[1], 0x20);
   output[1] = q_odd[0];
@@ -3831,14 +3836,16 @@ static void lowbd_fwd_txfm2d_8x16_avx2(const int16_t *input, int32_t *output,
   s[2] = _mm256_adds_epi16(x_4_5, x_11_10);
   s[3] = _mm256_adds_epi16(x_7_6, x_8_9);

-  const __m256i d0 = _mm256_subs_epi16(x_7_6, x_8_9);
-  const __m256i d1 = _mm256_subs_epi16(x_4_5, x_11_10);
-  const __m256i d2 = _mm256_subs_epi16(x_3_2, x_12_13);
-  const __m256i d3 = _mm256_subs_epi16(x_0_1, x_15_14);
+  const __m256i d[4] = {
+    _mm256_subs_epi16(x_7_6, x_8_9),
+    _mm256_subs_epi16(x_4_5, x_11_10),
+    _mm256_subs_epi16(x_3_2, x_12_13),
+    _mm256_subs_epi16(x_0_1, x_15_14),
+  };

   __m256i q_even[4], q_odd[4];
   fdct8x8_dual_avx2(s, q_even);
-  fdct8x16_odd_dual_avx2(d0, d1, d2, d3, q_odd);
+  fdct8x16_odd_dual_avx2(d, q_odd);

   const __m256i round2 = _mm256_set1_epi16(2);
   buf0[0] = _mm256_srai_epi16(
@@ -3928,14 +3935,16 @@ static void lowbd_fwd_txfm2d_16x8_avx2(const int16_t *input, int32_t *output,
   s[2] = _mm256_adds_epi16(x_4_5, x_11_10);
   s[3] = _mm256_adds_epi16(x_7_6, x_8_9);

-  const __m256i d0 = _mm256_subs_epi16(x_7_6, x_8_9);
-  const __m256i d1 = _mm256_subs_epi16(x_4_5, x_11_10);
-  const __m256i d2 = _mm256_subs_epi16(x_3_2, x_12_13);
-  const __m256i d3 = _mm256_subs_epi16(x_0_1, x_15_14);
+  const __m256i d[4] = {
+    _mm256_subs_epi16(x_7_6, x_8_9),
+    _mm256_subs_epi16(x_4_5, x_11_10),
+    _mm256_subs_epi16(x_3_2, x_12_13),
+    _mm256_subs_epi16(x_0_1, x_15_14),
+  };

   __m256i q_even[4], q_odd[4];
   fdct8x8_dual_avx2(s, q_even);
-  fdct8x16_odd_dual_avx2(d0, d1, d2, d3, q_odd);
+  fdct8x16_odd_dual_avx2(d, q_odd);

   store_rect_row_pair_16bit_to_32bit_avx2(q_even[0], output, 0, 4);
   store_rect_row_pair_16bit_to_32bit_avx2(q_even[1], output, 8, 12);
diff --git a/av1/encoder/x86/encodetxb_sse2.c b/av1/encoder/x86/encodetxb_sse2.c
index 0cfc19ce6a..88de3daeae 100644
--- a/av1/encoder/x86/encodetxb_sse2.c
+++ b/av1/encoder/x86/encodetxb_sse2.c
@@ -20,13 +20,12 @@

 // Compute min((sum + 1) >> 1, 4) + pos_to_offset using avg(sum, 0) = (sum +
 // 1) >> 1 for 5 neighbor levels clamped to [0, 3] (sum <= 15).
-static inline __m128i finish_nz_ctx_sse2(const __m128i sum,
-                                         const __m128i const_4,
-                                         const __m128i zero,
-                                         const __m128i pos_to_offset) {
-  __m128i count = _mm_avg_epu8(sum, zero);
-  count = _mm_min_epu8(count, const_4);
-  return _mm_add_epi8(count, pos_to_offset);
+static AOM_FORCE_INLINE __m128i
+finish_nz_ctx_sse2(const __m128i *sum, const __m128i *const_4,
+                   const __m128i *zero, const __m128i *pos_to_offset) {
+  __m128i count = _mm_avg_epu8(*sum, *zero);
+  count = _mm_min_epu8(count, *const_4);
+  return _mm_add_epi8(count, *pos_to_offset);
 }

 // 4-high rectangular 2D blocks (TX_8X4, TX_16X4): pack 4 columns per XMM and
@@ -74,7 +73,7 @@ static inline void get_4_nz_map_contexts_2d(const uint8_t *const levels,
     __m128i sum = _mm_add_epi8(_mm_srli_epi32(cur_p, 8), nxt1_p);
     sum = _mm_add_epi8(sum, nxt2_c);
     _mm_store_si128((__m128i *)cc,
-                    finish_nz_ctx_sse2(sum, const_4, zero, pos_to_offset));
+                    finish_nz_ctx_sse2(&sum, &const_4, &zero, &pos_to_offset));

     pos_to_offset = pos_large;
     cur = nxt_c;
@@ -138,8 +137,8 @@ static inline void get_4_nz_map_contexts_hv(const uint8_t *const levels,
       sum = _mm_add_epi8(sum, sh2);
       sum = _mm_add_epi8(sum, sh3);
       sum = _mm_add_epi8(sum, nxt);
-      _mm_store_si128((__m128i *)cc,
-                      finish_nz_ctx_sse2(sum, const_4, zero, pos_to_offset));
+      _mm_store_si128((__m128i *)cc, finish_nz_ctx_sse2(&sum, &const_4, &zero,
+                                                        &pos_to_offset));
       pos_to_offset = pos_large;
       cur = nxt;
       lv += 4 * stride;
@@ -170,8 +169,8 @@ static inline void get_4_nz_map_contexts_hv(const uint8_t *const levels,
       const __m128i p = _mm_add_epi8(cur, _mm_srli_epi32(cur, 8));
       const __m128i q = _mm_add_epi8(p, _mm_srli_epi32(p, 16));
       const __m128i sum = _mm_add_epi8(_mm_srli_epi32(q, 8), sh1);
-      _mm_store_si128((__m128i *)cc,
-                      finish_nz_ctx_sse2(sum, const_4, zero, pos_to_offset));
+      _mm_store_si128((__m128i *)cc, finish_nz_ctx_sse2(&sum, &const_4, &zero,
+                                                        &pos_to_offset));
       cur = nxt;
       lv += 4 * stride;
       cc += 16;
@@ -234,7 +233,7 @@ static inline void get_8_coeff_contexts_2d(const uint8_t *const levels,
     __m128i sum = _mm_add_epi8(_mm_srli_epi64(p01, 8), p12);
     sum = _mm_add_epi8(sum, c23);
     _mm_store_si128((__m128i *)cc,
-                    finish_nz_ctx_sse2(sum, const_4, zero, pos0));
+                    finish_nz_ctx_sse2(&sum, &const_4, &zero, &pos0));

     pos0 = pos1;
     pos1 = pos2;
@@ -289,8 +288,8 @@ static inline void get_8_coeff_contexts_hv(const uint8_t *const levels,
           _mm_shuffle_ps(_mm_castsi128_ps(s01), _mm_castsi128_ps(s23), 0x4e));
       __m128i sum = _mm_add_epi8(_mm_srli_epi64(c01, 8), mid);
       sum = _mm_add_epi8(sum, s23);
-      _mm_store_si128((__m128i *)cc,
-                      finish_nz_ctx_sse2(sum, const_4, zero, pos_to_offset));
+      _mm_store_si128((__m128i *)cc, finish_nz_ctx_sse2(&sum, &const_4, &zero,
+                                                        &pos_to_offset));
       pos_to_offset = pos_large;
       c01 = c23;
       c23 = c45;
@@ -320,8 +319,8 @@ static inline void get_8_coeff_contexts_hv(const uint8_t *const levels,
       const __m128i p = _mm_add_epi8(c01, _mm_srli_epi64(c01, 8));
       const __m128i q = _mm_add_epi8(p, _mm_srli_epi64(p, 16));
       const __m128i sum = _mm_add_epi8(_mm_srli_epi64(q, 8), c12);
-      _mm_store_si128((__m128i *)cc,
-                      finish_nz_ctx_sse2(sum, const_4, zero, pos_to_offset));
+      _mm_store_si128((__m128i *)cc, finish_nz_ctx_sse2(&sum, &const_4, &zero,
+                                                        &pos_to_offset));
       c01 = c23;
       lv += 2 * stride;
       cc += 16;
@@ -445,7 +444,7 @@ static inline void run_2d_band16_sse2(const uint8_t *const lv_band,
     __m128i sum = _mm_add_epi8(p0_s1, p1);
     sum = _mm_add_epi8(sum, cl2);
     _mm_store_si128((__m128i *)cc,
-                    finish_nz_ctx_sse2(sum, const_4, zero, pos0));
+                    finish_nz_ctx_sse2(&sum, &const_4, &zero, &pos0));

     __m128i p2, p2_s1;
     if (zero_tail) {
@@ -552,7 +551,7 @@ static inline void get_32h_coeff_contexts_ver(const uint8_t *const levels,
       const __m128i sum = _mm_add_epi8(
           _mm_add_epi8(_mm_add_epi8(m1, m2), _mm_add_epi8(m3, m4)), nxt);
       _mm_store_si128((__m128i *)cc,
-                      finish_nz_ctx_sse2(sum, const_4, zero, pos_lo));
+                      finish_nz_ctx_sse2(&sum, &const_4, &zero, &pos_lo));
       lv += stride;
       cc += 32;
     } while (--col != 0);
@@ -574,7 +573,7 @@ static inline void get_32h_coeff_contexts_ver(const uint8_t *const levels,
       const __m128i sum_lo = _mm_add_epi8(
           _mm_add_epi8(_mm_add_epi8(m1, m2), _mm_add_epi8(m3, m4)), nxt_lo);
       _mm_store_si128((__m128i *)cc,
-                      finish_nz_ctx_sse2(sum_lo, const_4, zero, pos_lo));
+                      finish_nz_ctx_sse2(&sum_lo, &const_4, &zero, &pos_lo));

       // Band 1 is followed by TX_PAD_HOR zeros, so shift prefix sums suffice.
       const __m128i nxt_hi = _mm_min_epu8(
@@ -583,7 +582,7 @@ static inline void get_32h_coeff_contexts_ver(const uint8_t *const levels,
       const __m128i q = _mm_add_epi8(p, _mm_srli_si128(p, 2));
       const __m128i sum_hi = _mm_add_epi8(_mm_srli_si128(q, 1), nxt_hi);
       _mm_store_si128((__m128i *)(cc + 16),
-                      finish_nz_ctx_sse2(sum_hi, const_4, zero, pos_hi));
+                      finish_nz_ctx_sse2(&sum_hi, &const_4, &zero, &pos_hi));
       cur_hi = nxt_hi;
       lv += stride;
       cc += 32;
@@ -628,7 +627,7 @@ static inline void get_16n_coeff_contexts_ver(const uint8_t *const levels,
     const __m128i q = _mm_add_epi8(p, _mm_srli_si128(p, 2));
     const __m128i sum = _mm_add_epi8(_mm_srli_si128(q, 1), nxt);
     _mm_store_si128((__m128i *)cc,
-                    finish_nz_ctx_sse2(sum, const_4, zero, pos_lo));
+                    finish_nz_ctx_sse2(&sum, &const_4, &zero, &pos_lo));
     cur = nxt;
     lv += stride;
     cc += 16;
@@ -668,7 +667,7 @@ static inline void get_16n_hor_band_sse2(const uint8_t *const lv_b,
     __m128i sum = _mm_add_epi8(l0, p12);
     sum = _mm_add_epi8(sum, p34);
     _mm_store_si128((__m128i *)cc,
-                    finish_nz_ctx_sse2(sum, const_4, zero, pos0));
+                    finish_nz_ctx_sse2(&sum, &const_4, &zero, &pos0));
     pos0 = pos1;
     pos1 = pos2;
     c3 = c4;
@@ -722,7 +721,7 @@ static inline void get_4x4_2d_sse2(const uint8_t *const levels,
   sum = _mm_add_epi8(sum, _mm_srli_si128(cur, 8));

   _mm_store_si128((__m128i *)coeff_contexts,
-                  finish_nz_ctx_sse2(sum, const_4, zero, pos_to_offset));
+                  finish_nz_ctx_sse2(&sum, &const_4, &zero, &pos_to_offset));
   coeff_contexts[0] = 0;
 }

@@ -750,7 +749,7 @@ static inline void get_8x8_2d_sse2(const uint8_t *const levels,
   __m128i sum = _mm_add_epi8(_mm_srli_epi64(p01, 8), p12);
   sum = _mm_add_epi8(sum, c23);
   _mm_store_si128((__m128i *)coeff_contexts,
-                  finish_nz_ctx_sse2(sum, const_4, zero, pos_to_offset_0));
+                  finish_nz_ctx_sse2(&sum, &const_4, &zero, &pos_to_offset_0));

   // default_scan_8x8 enters columns 2, 4, 6 at scan indices 5, 14, 27.
   if (last_idx > 5) {
@@ -764,8 +763,9 @@ static inline void get_8x8_2d_sse2(const uint8_t *const levels,

     sum = _mm_add_epi8(_mm_srli_epi64(p23, 8), p34);
     sum = _mm_add_epi8(sum, c45);
-    _mm_store_si128((__m128i *)(coeff_contexts + 16),
-                    finish_nz_ctx_sse2(sum, const_4, zero, pos_to_offset_1));
+    _mm_store_si128(
+        (__m128i *)(coeff_contexts + 16),
+        finish_nz_ctx_sse2(&sum, &const_4, &zero, &pos_to_offset_1));

     if (last_idx > 14) {
       const __m128i pos_to_offset_2 = _mm_set1_epi8(21);
@@ -777,14 +777,15 @@ static inline void get_8x8_2d_sse2(const uint8_t *const levels,

       sum = _mm_add_epi8(_mm_srli_epi64(p45, 8), p56);
       sum = _mm_add_epi8(sum, c67);
-      _mm_store_si128((__m128i *)(coeff_contexts + 32),
-                      finish_nz_ctx_sse2(sum, const_4, zero, pos_to_offset_2));
+      _mm_store_si128(
+          (__m128i *)(coeff_contexts + 32),
+          finish_nz_ctx_sse2(&sum, &const_4, &zero, &pos_to_offset_2));

       if (last_idx > 27) {
         sum = _mm_add_epi8(_mm_srli_epi64(p67, 8), _mm_srli_si128(p67, 8));
         _mm_store_si128(
             (__m128i *)(coeff_contexts + 48),
-            finish_nz_ctx_sse2(sum, const_4, zero, pos_to_offset_2));
+            finish_nz_ctx_sse2(&sum, &const_4, &zero, &pos_to_offset_2));
       }
     }
   }
@@ -835,7 +836,8 @@ static inline void get_16x16_2d_sse2(const uint8_t *const levels,
     const __m128i p2 = _mm_add_epi8(c2, _mm_srli_si128(c2, 1));
     __m128i sum = _mm_add_epi8(_mm_srli_si128(p0, 1), p1);
     sum = _mm_add_epi8(sum, c2);
-    _mm_store_si128((__m128i *)cc, finish_nz_ctx_sse2(sum, const_4, zero, pos));
+    _mm_store_si128((__m128i *)cc,
+                    finish_nz_ctx_sse2(&sum, &const_4, &zero, &pos));
     pos = _mm_or_si128(_mm_srli_si128(pos, 1), top_21);
     p0 = p1;
     p1 = p2;
diff --git a/av1/encoder/x86/pickrst_avx2.c b/av1/encoder/x86/pickrst_avx2.c
index 0c5b44a677..ccb661fe76 100644
--- a/av1/encoder/x86/pickrst_avx2.c
+++ b/av1/encoder/x86/pickrst_avx2.c
@@ -10,6 +10,7 @@
  */

 #include <immintrin.h>  // AVX2
+#include "aom_dsp/aom_dsp_common.h"
 #include "aom_dsp/x86/mem_sse2.h"
 #include "aom_dsp/x86/synonyms.h"
 #include "aom_dsp/x86/synonyms_avx2.h"
@@ -1560,34 +1561,34 @@ static inline __m256i load_shuffled_u8_dual8_to_epi16(const uint8_t *ptrA,
   return _mm256_cvtepu8_epi16(shuffled);
 }

-static inline __m256i calc_proj_err_r0_r1_avx2(
-    const __m256i d0, const __m256i s0, const __m256i flt0_16b,
-    const __m256i flt1_16b, const __m256i xq_coeff, const __m256i rounding,
+static AOM_FORCE_INLINE __m256i calc_proj_err_r0_r1_avx2(
+    const __m256i *d0, const __m256i *s0, const __m256i *flt0_16b,
+    const __m256i *flt1_16b, const __m256i *xq_coeff, const __m256i *rounding,
     int shift) {
-  const __m256i u0 = _mm256_slli_epi16(d0, SGRPROJ_RST_BITS);
+  const __m256i u0 = _mm256_slli_epi16(*d0, SGRPROJ_RST_BITS);
   const __m256i v0 = _mm256_madd_epi16(
-      xq_coeff, _mm256_unpacklo_epi16(_mm256_sub_epi16(flt0_16b, u0),
-                                      _mm256_sub_epi16(flt1_16b, u0)));
+      *xq_coeff, _mm256_unpacklo_epi16(_mm256_sub_epi16(*flt0_16b, u0),
+                                       _mm256_sub_epi16(*flt1_16b, u0)));
   const __m256i v1 = _mm256_madd_epi16(
-      xq_coeff, _mm256_unpackhi_epi16(_mm256_sub_epi16(flt0_16b, u0),
-                                      _mm256_sub_epi16(flt1_16b, u0)));
+      *xq_coeff, _mm256_unpackhi_epi16(_mm256_sub_epi16(*flt0_16b, u0),
+                                       _mm256_sub_epi16(*flt1_16b, u0)));
   const __m256i vr = _mm256_packs_epi32(
-      _mm256_srai_epi32(_mm256_add_epi32(v0, rounding), shift),
-      _mm256_srai_epi32(_mm256_add_epi32(v1, rounding), shift));
-  return _mm256_add_epi16(vr, _mm256_sub_epi16(d0, s0));
+      _mm256_srai_epi32(_mm256_add_epi32(v0, *rounding), shift),
+      _mm256_srai_epi32(_mm256_add_epi32(v1, *rounding), shift));
+  return _mm256_add_epi16(vr, _mm256_sub_epi16(*d0, *s0));
 }

-static inline __m256i calc_proj_err_r0_or_r1_avx2(
-    const __m256i d0, const __m256i s0, const __m256i flt_16b,
-    const __m256i xq_coeff, const __m256i rounding, int shift) {
+static AOM_FORCE_INLINE __m256i calc_proj_err_r0_or_r1_avx2(
+    const __m256i *d0, const __m256i *s0, const __m256i *flt_16b,
+    const __m256i *xq_coeff, const __m256i *rounding, int shift) {
   const __m256i v0 =
-      _mm256_madd_epi16(xq_coeff, _mm256_unpacklo_epi16(flt_16b, d0));
+      _mm256_madd_epi16(*xq_coeff, _mm256_unpacklo_epi16(*flt_16b, *d0));
   const __m256i v1 =
-      _mm256_madd_epi16(xq_coeff, _mm256_unpackhi_epi16(flt_16b, d0));
+      _mm256_madd_epi16(*xq_coeff, _mm256_unpackhi_epi16(*flt_16b, *d0));
   const __m256i vr_16b = _mm256_packs_epi32(
-      _mm256_srai_epi32(_mm256_add_epi32(v0, rounding), shift),
-      _mm256_srai_epi32(_mm256_add_epi32(v1, rounding), shift));
-  return _mm256_add_epi16(vr_16b, _mm256_sub_epi16(d0, s0));
+      _mm256_srai_epi32(_mm256_add_epi32(v0, *rounding), shift),
+      _mm256_srai_epi32(_mm256_add_epi32(v1, *rounding), shift));
+  return _mm256_add_epi16(vr_16b, _mm256_sub_epi16(*d0, *s0));
 }

 int64_t av1_lowbd_pixel_proj_error_avx2(
@@ -1620,8 +1621,8 @@ int64_t av1_lowbd_pixel_proj_error_avx2(
         const __m256i flt1_16b =
             _mm256_packs_epi32(yy_loadu_256(flt1), yy_loadu_256(flt1_rowB));

-        const __m256i e0 = calc_proj_err_r0_r1_avx2(d0, s0, flt0_16b, flt1_16b,
-                                                    xq_coeff, rounding, shift);
+        const __m256i e0 = calc_proj_err_r0_r1_avx2(
+            &d0, &s0, &flt0_16b, &flt1_16b, &xq_coeff, &rounding, shift);
         const __m256i err0 = _mm256_madd_epi16(e0, e0);
         sum32 = _mm256_add_epi32(sum32, err0);

@@ -1671,8 +1672,8 @@ int64_t av1_lowbd_pixel_proj_error_avx2(
               _mm256_packs_epi32(yy_loadu_256(flt0), yy_loadu_256(flt0 + 8));
           const __m256i flt1_16b =
               _mm256_packs_epi32(yy_loadu_256(flt1), yy_loadu_256(flt1 + 8));
-          const __m256i e = calc_proj_err_r0_r1_avx2(d0, s0, flt0_16b, flt1_16b,
-                                                     xq_coeff, rounding, shift);
+          const __m256i e = calc_proj_err_r0_r1_avx2(
+              &d0, &s0, &flt0_16b, &flt1_16b, &xq_coeff, &rounding, shift);
           sum32_A = _mm256_add_epi32(sum32_A, _mm256_madd_epi16(e, e));
         }
         // Row B
@@ -1683,8 +1684,8 @@ int64_t av1_lowbd_pixel_proj_error_avx2(
               yy_loadu_256(flt0_rowB), yy_loadu_256(flt0_rowB + 8));
           const __m256i flt1_16b = _mm256_packs_epi32(
               yy_loadu_256(flt1_rowB), yy_loadu_256(flt1_rowB + 8));
-          const __m256i e = calc_proj_err_r0_r1_avx2(d0, s0, flt0_16b, flt1_16b,
-                                                     xq_coeff, rounding, shift);
+          const __m256i e = calc_proj_err_r0_r1_avx2(
+              &d0, &s0, &flt0_16b, &flt1_16b, &xq_coeff, &rounding, shift);
           sum32_B = _mm256_add_epi32(sum32_B, _mm256_madd_epi16(e, e));
         }
         // Row C
@@ -1695,8 +1696,8 @@ int64_t av1_lowbd_pixel_proj_error_avx2(
               yy_loadu_256(flt0_rowC), yy_loadu_256(flt0_rowC + 8));
           const __m256i flt1_16b = _mm256_packs_epi32(
               yy_loadu_256(flt1_rowC), yy_loadu_256(flt1_rowC + 8));
-          const __m256i e = calc_proj_err_r0_r1_avx2(d0, s0, flt0_16b, flt1_16b,
-                                                     xq_coeff, rounding, shift);
+          const __m256i e = calc_proj_err_r0_r1_avx2(
+              &d0, &s0, &flt0_16b, &flt1_16b, &xq_coeff, &rounding, shift);
           sum32_C = _mm256_add_epi32(sum32_C, _mm256_madd_epi16(e, e));
         }
         // Row D
@@ -1707,8 +1708,8 @@ int64_t av1_lowbd_pixel_proj_error_avx2(
               yy_loadu_256(flt0_rowD), yy_loadu_256(flt0_rowD + 8));
           const __m256i flt1_16b = _mm256_packs_epi32(
               yy_loadu_256(flt1_rowD), yy_loadu_256(flt1_rowD + 8));
-          const __m256i e = calc_proj_err_r0_r1_avx2(d0, s0, flt0_16b, flt1_16b,
-                                                     xq_coeff, rounding, shift);
+          const __m256i e = calc_proj_err_r0_r1_avx2(
+              &d0, &s0, &flt0_16b, &flt1_16b, &xq_coeff, &rounding, shift);
           sum32_D = _mm256_add_epi32(sum32_D, _mm256_madd_epi16(e, e));
         }

@@ -1724,8 +1725,8 @@ int64_t av1_lowbd_pixel_proj_error_avx2(
             _mm256_packs_epi32(yy_loadu_256(flt0), yy_loadu_256(flt0 + 8));
         const __m256i flt1_16b =
             _mm256_packs_epi32(yy_loadu_256(flt1), yy_loadu_256(flt1 + 8));
-        const __m256i e = calc_proj_err_r0_r1_avx2(d0, s0, flt0_16b, flt1_16b,
-                                                   xq_coeff, rounding, shift);
+        const __m256i e = calc_proj_err_r0_r1_avx2(
+            &d0, &s0, &flt0_16b, &flt1_16b, &xq_coeff, &rounding, shift);
         sum32_A = _mm256_add_epi32(sum32_A, _mm256_madd_epi16(e, e));

         dat += dat_stride;
@@ -1758,7 +1759,7 @@ int64_t av1_lowbd_pixel_proj_error_avx2(
             const __m256i flt1_A = _mm256_packs_epi32(
                 yy_loadu_256(flt1 + j), yy_loadu_256(flt1 + j + 8));
             const __m256i e_A = calc_proj_err_r0_r1_avx2(
-                d_A, s_A, flt0_A, flt1_A, xq_coeff, rounding, shift);
+                &d_A, &s_A, &flt0_A, &flt1_A, &xq_coeff, &rounding, shift);
             sum32_A = _mm256_add_epi32(sum32_A, _mm256_madd_epi16(e_A, e_A));

             const __m256i d_B = load_shuffled_u8_to_epi16(dat + j + 16);
@@ -1768,7 +1769,7 @@ int64_t av1_lowbd_pixel_proj_error_avx2(
             const __m256i flt1_B = _mm256_packs_epi32(
                 yy_loadu_256(flt1 + j + 16), yy_loadu_256(flt1 + j + 24));
             const __m256i e_B = calc_proj_err_r0_r1_avx2(
-                d_B, s_B, flt0_B, flt1_B, xq_coeff, rounding, shift);
+                &d_B, &s_B, &flt0_B, &flt1_B, &xq_coeff, &rounding, shift);
             sum32_B = _mm256_add_epi32(sum32_B, _mm256_madd_epi16(e_B, e_B));
           }
           dat += dat_stride;
@@ -1795,7 +1796,7 @@ int64_t av1_lowbd_pixel_proj_error_avx2(
           const __m256i flt1_16b = _mm256_packs_epi32(
               yy_loadu_256(flt1 + j), yy_loadu_256(flt1 + j + 8));
           const __m256i e0 = calc_proj_err_r0_r1_avx2(
-              d0, s0, flt0_16b, flt1_16b, xq_coeff, rounding, shift);
+              &d0, &s0, &flt0_16b, &flt1_16b, &xq_coeff, &rounding, shift);
           sum32 = _mm256_add_epi32(sum32, _mm256_madd_epi16(e0, e0));
         }
         for (k = j; k < width; ++k) {
@@ -1837,7 +1838,7 @@ int64_t av1_lowbd_pixel_proj_error_avx2(
             _mm256_packs_epi32(yy_loadu_256(flt), yy_loadu_256(flt_rowB));

         const __m256i e0 = calc_proj_err_r0_or_r1_avx2(
-            d0, s0, flt_16b, xq_coeff, rounding, shift);
+            &d0, &s0, &flt_16b, &xq_coeff, &rounding, shift);
         const __m256i err0 = _mm256_madd_epi16(e0, e0);
         sum32 = _mm256_add_epi32(sum32, err0);

@@ -1882,7 +1883,7 @@ int64_t av1_lowbd_pixel_proj_error_avx2(
           const __m256i flt_16b =
               _mm256_packs_epi32(yy_loadu_256(flt), yy_loadu_256(flt + 8));
           const __m256i e = calc_proj_err_r0_or_r1_avx2(
-              d0, s0, flt_16b, xq_coeff, rounding, shift);
+              &d0, &s0, &flt_16b, &xq_coeff, &rounding, shift);
           sum32_A = _mm256_add_epi32(sum32_A, _mm256_madd_epi16(e, e));
         }
         // Row B
@@ -1892,7 +1893,7 @@ int64_t av1_lowbd_pixel_proj_error_avx2(
           const __m256i flt_16b = _mm256_packs_epi32(
               yy_loadu_256(flt_rowB), yy_loadu_256(flt_rowB + 8));
           const __m256i e = calc_proj_err_r0_or_r1_avx2(
-              d0, s0, flt_16b, xq_coeff, rounding, shift);
+              &d0, &s0, &flt_16b, &xq_coeff, &rounding, shift);
           sum32_B = _mm256_add_epi32(sum32_B, _mm256_madd_epi16(e, e));
         }
         // Row C
@@ -1902,7 +1903,7 @@ int64_t av1_lowbd_pixel_proj_error_avx2(
           const __m256i flt_16b = _mm256_packs_epi32(
               yy_loadu_256(flt_rowC), yy_loadu_256(flt_rowC + 8));
           const __m256i e = calc_proj_err_r0_or_r1_avx2(
-              d0, s0, flt_16b, xq_coeff, rounding, shift);
+              &d0, &s0, &flt_16b, &xq_coeff, &rounding, shift);
           sum32_C = _mm256_add_epi32(sum32_C, _mm256_madd_epi16(e, e));
         }
         // Row D
@@ -1912,7 +1913,7 @@ int64_t av1_lowbd_pixel_proj_error_avx2(
           const __m256i flt_16b = _mm256_packs_epi32(
               yy_loadu_256(flt_rowD), yy_loadu_256(flt_rowD + 8));
           const __m256i e = calc_proj_err_r0_or_r1_avx2(
-              d0, s0, flt_16b, xq_coeff, rounding, shift);
+              &d0, &s0, &flt_16b, &xq_coeff, &rounding, shift);
           sum32_D = _mm256_add_epi32(sum32_D, _mm256_madd_epi16(e, e));
         }

@@ -1925,8 +1926,8 @@ int64_t av1_lowbd_pixel_proj_error_avx2(
         const __m256i s0 = load_shuffled_u8_to_epi16(src);
         const __m256i flt_16b =
             _mm256_packs_epi32(yy_loadu_256(flt), yy_loadu_256(flt + 8));
-        const __m256i e = calc_proj_err_r0_or_r1_avx2(d0, s0, flt_16b, xq_coeff,
-                                                      rounding, shift);
+        const __m256i e = calc_proj_err_r0_or_r1_avx2(
+            &d0, &s0, &flt_16b, &xq_coeff, &rounding, shift);
         sum32_A = _mm256_add_epi32(sum32_A, _mm256_madd_epi16(e, e));

         dat += dat_stride;
@@ -1956,7 +1957,7 @@ int64_t av1_lowbd_pixel_proj_error_avx2(
             const __m256i flt_A = _mm256_packs_epi32(yy_loadu_256(flt + j),
                                                      yy_loadu_256(flt + j + 8));
             const __m256i e_A = calc_proj_err_r0_or_r1_avx2(
-                d_A, s_A, flt_A, xq_coeff, rounding, shift);
+                &d_A, &s_A, &flt_A, &xq_coeff, &rounding, shift);
             sum32_A = _mm256_add_epi32(sum32_A, _mm256_madd_epi16(e_A, e_A));

             const __m256i d_B = load_shuffled_u8_to_epi16(dat + j + 16);
@@ -1964,7 +1965,7 @@ int64_t av1_lowbd_pixel_proj_error_avx2(
             const __m256i flt_B = _mm256_packs_epi32(
                 yy_loadu_256(flt + j + 16), yy_loadu_256(flt + j + 24));
             const __m256i e_B = calc_proj_err_r0_or_r1_avx2(
-                d_B, s_B, flt_B, xq_coeff, rounding, shift);
+                &d_B, &s_B, &flt_B, &xq_coeff, &rounding, shift);
             sum32_B = _mm256_add_epi32(sum32_B, _mm256_madd_epi16(e_B, e_B));
           }
           dat += dat_stride;
@@ -1988,7 +1989,7 @@ int64_t av1_lowbd_pixel_proj_error_avx2(
           const __m256i flt_16b = _mm256_packs_epi32(yy_loadu_256(flt + j),
                                                      yy_loadu_256(flt + j + 8));
           const __m256i e0 = calc_proj_err_r0_or_r1_avx2(
-              d0, s0, flt_16b, xq_coeff, rounding, shift);
+              &d0, &s0, &flt_16b, &xq_coeff, &rounding, shift);
           sum32 = _mm256_add_epi32(sum32, _mm256_madd_epi16(e0, e0));
         }
         for (k = j; k < width; ++k) {