Frank Barchard 47ba8e2160 Handle SsimWindowRow remainder in SIMD for AVX512BW, SVE2, SME, RVV
Because each 8x8 SSIM window spans two 4x4 tiles horizontally,
num_windows = (width - 5) >> 2, so aligned widths that are multiples
of 64 (e.g. 64, 128, 640, 1280, 1920) always have remainder 15
(num_windows & 15 == 15).

- Update SsimWindowRow_AVX512BW (compare_gcc.cc and compare_win.cc)
  to handle any remainder (1..15 windows) via k-masking (load_mask
  for the (rem + 1) * 4 tile words and win_mask for the rem window
  scores) and set win_simd_size = 1.
- Add SsimWindowRow_SVE2, SsimWindowRow_SME, and SsimWindowRow_RVV
  with win_simd_size = 1 using predicated/vl-controlled loops so no
  C code (Ssim4x4Row_C or SsimWindowRow_C) is executed on AVX-512BW,
  SVE2, SME, or RVV CPUs for any image dimensions.
- Remove LIBYUV_TARGET_AVX512BW __attribute__((target(...))) from
  compare_gcc.cc and GCC_HAS_AVX512 from cpu_support.h, using %%zmm0
  directly in inline assembly.

SSIM Performance (Before vs After):
uArch / Target               Before      After   Speedup
--------------------------  ---------  ---------  -------
Coral RVV Verilator (64x16) 5302 cyc   2219 cyc    2.39x
Coral RVV WindowRow (15w)   1854 cyc    308 cyc    6.02x
Apple M6 SME (64x36 10kx)   16.41 ms    4.69 ms    3.50x
Apple M6 SME (720p 1000x)  350.76 ms   66.09 ms    5.31x

R=rrwinterton@gmail.com

Bug: libyuv:352521931
Change-Id: Ic7d55184c60611af4a57d113cc4ee3d211debadf
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/8621918
Commit-Queue: Frank Barchard <fbarchard@google.com>
Reviewed-by: richard winterton <rrwinterton@gmail.com>
2026-10-20 21:39:37 -07:00
..
compare_common.cc [libyuv] Optimize SsimWindowRow with SIMD and use compare_win on x86 2026-10-20 15:00:52 -07:00
compare_gcc.cc Handle SsimWindowRow remainder in SIMD for AVX512BW, SVE2, SME, RVV 2026-10-20 21:39:37 -07:00
compare_hvx.cc [libyuv] Add Qualcomm Hexagon HVX SIMD support 2026-10-19 14:16:18 -07:00
compare_neon64.cc [libyuv] Optimize CalcFrameSsim with 2-row 4x4 tile buffer and SIMD 2026-10-15 23:22:58 -07:00
compare_neon.cc [libyuv] Optimize CalcFrameSsim with 2-row 4x4 tile buffer and SIMD 2026-10-15 23:22:58 -07:00
compare_wasm.cc [libyuv] Optimize CalcFrameSsim with 2-row 4x4 tile buffer and SIMD 2026-10-15 23:22:58 -07:00
compare_win.cc Handle SsimWindowRow remainder in SIMD for AVX512BW, SVE2, SME, RVV 2026-10-20 21:39:37 -07:00
compare.cc Handle SsimWindowRow remainder in SIMD for AVX512BW, SVE2, SME, RVV 2026-10-20 21:39:37 -07:00
convert_argb.cc [libyuv] Fix top 20 bugs and performance issues 2026-10-19 16:46:40 -07:00
convert_from_argb.cc [libyuv] Fix top 20 bugs and performance issues 2026-10-19 16:46:40 -07:00
convert_from.cc [libyuv] Fix top 20 bugs and performance issues 2026-10-19 16:46:40 -07:00
convert_jpeg.cc [libyuv] Keep LIBYUV_API in basic_types.h and remove legacy types and bool macros 2026-08-28 08:32:19 -07:00
convert_to_argb.cc [libyuv] Fix top 20 bugs and performance issues 2026-10-19 16:46:40 -07:00
convert_to_i420.cc [libyuv] Fix top 20 bugs and performance issues 2026-10-19 16:46:40 -07:00
convert.cc [libyuv] Fix top 20 bugs and performance issues 2026-10-19 16:46:40 -07:00
cpu_id.cc [libyuv] Fix top 20 bugs and performance issues 2026-10-19 16:46:40 -07:00
mjpeg_decoder.cc [libyuv] Fix top 20 bugs and performance issues 2026-10-19 16:46:40 -07:00
mjpeg_validate.cc [libyuv] Keep LIBYUV_API in basic_types.h and remove legacy types and bool macros 2026-08-28 08:32:19 -07:00
planar_functions.cc [libyuv] Fix top 20 bugs and performance issues 2026-10-19 16:46:40 -07:00
rotate_any.cc [libyuv] Rewrite LoongArch LSX/LASX kernels in compact inline asm 2026-10-16 17:25:23 -07:00
rotate_argb.cc [libyuv] Fix top 20 bugs and performance issues 2026-10-19 16:46:40 -07:00
rotate_common.cc [libyuv] Optimize RotatePlane_16 SIMD and compact 32-bit transposes 2026-10-12 10:57:34 -07:00
rotate_gcc.cc [libyuv] Optimize RotatePlane_16 SIMD and compact 32-bit transposes 2026-10-12 10:57:34 -07:00
rotate_hvx.cc [libyuv] Add Qualcomm Hexagon HVX SIMD support 2026-10-19 14:16:18 -07:00
rotate_lasx.cc [libyuv] Rewrite LoongArch LSX/LASX kernels in compact inline asm 2026-10-16 17:25:23 -07:00
rotate_lsx.cc [libyuv] Rewrite LoongArch LSX/LASX kernels in compact inline asm 2026-10-16 17:25:23 -07:00
rotate_neon64.cc [libyuv] Optimize RotatePlane_16 SIMD and compact 32-bit transposes 2026-10-12 10:57:34 -07:00
rotate_neon.cc [libyuv] Optimize RotatePlane_16 SIMD and compact 32-bit transposes 2026-10-12 10:57:34 -07:00
rotate_rvv.cc [libyuv] Optimize RotatePlane_16 SIMD and compact 32-bit transposes 2026-10-12 10:57:34 -07:00
rotate_sme.cc [libyuv] Optimize RotatePlane_16 SIMD and compact 32-bit transposes 2026-10-12 10:57:34 -07:00
rotate_sve.cc [libyuv] Fix top 20 bugs and performance issues 2026-10-19 16:46:40 -07:00
rotate_wasm.cc [libyuv] Optimize RotatePlane_16 SIMD and compact 32-bit transposes 2026-10-12 10:57:34 -07:00
rotate_win.cc [libyuv] Optimize RotatePlane_16 SIMD and compact 32-bit transposes 2026-10-12 10:57:34 -07:00
rotate.cc [libyuv] Fix top 20 bugs and performance issues 2026-10-19 16:46:40 -07:00
row_any.cc [libyuv] Fix top 20 bugs and performance issues 2026-10-19 16:46:40 -07:00
row_common.cc [libyuv] Fix top 20 bugs and performance issues 2026-10-19 16:46:40 -07:00
row_gcc.cc [libyuv] Fix top 20 bugs and performance issues 2026-10-19 16:46:40 -07:00
row_hvx.cc [libyuv] Add Qualcomm Hexagon HVX SIMD support 2026-10-19 14:16:18 -07:00
row_lasx.cc [libyuv] Fix top 20 bugs and performance issues 2026-10-19 16:46:40 -07:00
row_lsx.cc [libyuv] Fix top 20 bugs and performance issues 2026-10-19 16:46:40 -07:00
row_neon64.cc [libyuv] Fix top 20 bugs and performance issues 2026-10-19 16:46:40 -07:00
row_neon.cc [libyuv] Fix top 20 bugs and performance issues 2026-10-19 16:46:40 -07:00
row_rvv.cc Handle SsimWindowRow remainder in SIMD for AVX512BW, SVE2, SME, RVV 2026-10-20 21:39:37 -07:00
row_sme.cc Handle SsimWindowRow remainder in SIMD for AVX512BW, SVE2, SME, RVV 2026-10-20 21:39:37 -07:00
row_sve.cc Handle SsimWindowRow remainder in SIMD for AVX512BW, SVE2, SME, RVV 2026-10-20 21:39:37 -07:00
row_wasm.cc [libyuv] AVX512, NEON, WASM and RVV alpha copy and mirror rows 2026-10-07 12:44:53 -07:00
row_win.cc Add 25 native k-masked AVX-512 row kernels 2026-10-12 18:14:41 -07:00
scale_any.cc [libyuv] Fix top 20 bugs and performance issues 2026-10-19 16:46:40 -07:00
scale_argb.cc [libyuv] Fix top 20 bugs and performance issues 2026-10-19 16:46:40 -07:00
scale_common.cc [libyuv] Multi-platform ScaleUVAddCols3 for ScaleUVBox at 3x 2026-10-19 15:56:38 -07:00
scale_gcc.cc [libyuv] Fix top 20 bugs and performance issues 2026-10-19 16:46:40 -07:00
scale_hvx.cc [libyuv] Multi-platform ScaleUVAddCols3 for ScaleUVBox at 3x 2026-10-19 15:56:38 -07:00
scale_lsx.cc [libyuv] Multi-platform ScaleUVAddCols3 for ScaleUVBox at 3x 2026-10-19 15:56:38 -07:00
scale_neon64.cc [libyuv] Fix top 20 bugs and performance issues 2026-10-19 16:46:40 -07:00
scale_neon.cc [libyuv] Multi-platform ScaleUVAddCols3 for ScaleUVBox at 3x 2026-10-19 15:56:38 -07:00
scale_rgb.cc Fix Coverity Control flow issues (DEADCODE) 2026-07-01 10:39:22 -07:00
scale_rvv.cc [libyuv] Multi-platform ScaleUVAddCols3 for ScaleUVBox at 3x 2026-10-19 15:56:38 -07:00
scale_sme.cc [libyuv] Multi-platform ScaleUVAddCols3 for ScaleUVBox at 3x 2026-10-19 15:56:38 -07:00
scale_uv.cc [libyuv] Fix top 20 bugs and performance issues 2026-10-19 16:46:40 -07:00
scale_wasm.cc [libyuv] Multi-platform ScaleUVAddCols3 for ScaleUVBox at 3x 2026-10-19 15:56:38 -07:00
scale_win.cc [libyuv] Multi-platform ScaleUVAddCols3 for ScaleUVBox at 3x 2026-10-19 15:56:38 -07:00
scale.cc [libyuv] Fix top 20 bugs and performance issues 2026-10-19 16:46:40 -07:00
test.sh Optimze ABGRToI420 for AVX2 2020-06-04 18:24:45 +00:00
video_common.cc Lint cleanup after C99 change CL 2018-01-24 19:16:03 +00:00