mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2026-10-28 18:07:12 +08:00
Optimize 16-bit single-channel plane rotation (RotatePlane_16 across
0, 90, 180, 270 degrees, accelerating I010Rotate, I210Rotate,
I410Rotate) using compact tile heights that write one full SIMD
vector per output row without cross-lane permutes:
- Replace scalar TransposeWx8_C_16 in TransposePlane_16 (90/270):
- AVX512BW (TransposeWx32_16_AVX512BW / _Any_AVX512BW):
Transpose 8x32 tiles in zmm0..zmm7 via 3-stage vpunpcklwd/hwd,
vpunpckldq/hdq, and vpunpcklqdq/hqdq butterflies writing 64B.
- AVX2 (TransposeWx16_16_AVX2 / TransposeWx16_16_Any_AVX2):
Transpose 8x16 tiles in ymm0..ymm7 writing 32B rows.
- SSE2, NEON, WASM SIMD, LSX (TransposeWx8_16_* / _Any_*):
Transpose 8x8 tiles writing 16B rows; LASX transposes 8x16 tiles.
- SVE2, SME, RVV (TransposeWx8_16_SVE2, TransposeWxH_16_{SME,RVV}):
Hardware-predicated / matrix / strided-load tile transposes.
- Implement RotatePlane180_16 directly via MirrorUVPlane with
negative height (eliminating temp row buffer allocation and extra
row copies), adding MirrorUVRow_Any_SSSE3, MirrorUVRow_AVX512BW,
and MirrorUVRow_RVV.
Speedup vs Before (1275x1650, US Letter 150 DPI, 1000 iterations):
CPU | 90 degree | 180 degree
---------------------|------------------------|-----------------------
Coral RVV Verilator | 7306 -> 1415c (5.16x) | 2274 -> 719c (3.16x)
AMD Genoa | 510 -> 140ms (3.64x) | 146 -> 116ms (1.26x)
AMD Turin | 327 -> 107ms (3.06x) | 92 -> 77ms (1.19x)
AMD Milan | 686 -> 240ms (2.86x) | 203 -> 163ms (1.25x)
Intel Skylake-X | 1107 -> 461ms (2.40x) | 369 -> 358ms (1.03x)
WASM SIMD (d8) | 415 -> 203ms (2.04x) | 370 -> 106ms (3.49x)
Intel Haswell | 1245 -> 695ms (1.79x) | 401 -> 421ms (0.95x)
Intel Emerald Rapids | 771 -> 453ms (1.70x) | 260 -> 259ms (1.00x)
ARM Neoverse-N1 | 874 -> 554ms (1.58x) | 377 -> 259ms (1.46x)
Intel Ice Lake | 726 -> 482ms (1.51x) | 274 -> 305ms (0.90x)
Intel Sapphire Rapid | 1089 -> 724ms (1.50x) | 300 -> 289ms (1.04x)
NVIDIA Grace | 503 -> 387ms (1.30x) | 194 -> 144ms (1.35x)
Intel Granite Rapids | 724 -> 699ms (1.04x) | 284 -> 285ms (1.00x)
AVX-512 vs C | 327 -> 109ms (3.00x) | 517 -> 79ms (6.54x)
Bug: b/42280915
Test: ./out/Release/libyuv_unittest --gtest_filter=*RotatePlane*_16*
Change-Id: I91ba6cac22185b5d294fcb98344fdb8a23cc94ff
|
||
|---|---|---|
| build_overrides | ||
| docs | ||
| include | ||
| infra/config | ||
| riscv_script | ||
| source | ||
| tools_libyuv | ||
| unit_test | ||
| util | ||
| .clang-format | ||
| .gitignore | ||
| .gn | ||
| Android.bp | ||
| Android.mk | ||
| AUTHORS | ||
| BUILD.bazel | ||
| BUILD.gn | ||
| CM_linux_packages.cmake | ||
| CMakeLists.txt | ||
| codereview.settings | ||
| DEPS | ||
| DIR_METADATA | ||
| download_vs_toolchain.py | ||
| GEMINI.md | ||
| libyuv.bzl | ||
| libyuv.gni | ||
| libyuv.gyp | ||
| libyuv.gypi | ||
| LICENSE | ||
| linux.mk | ||
| OWNERS | ||
| PATENTS | ||
| PRESUBMIT.py | ||
| public.mk | ||
| pylintrc | ||
| README.chromium | ||
| README.md | ||
| vpython.toml | ||
| vpython.toml.uv.lock | ||
| winarm.mk | ||
| WORKSPACE.bazel | ||
libyuv is an open source project that includes YUV scaling and conversion functionality.
- Scale YUV to prepare content for compression, with point, bilinear or box filter.
- Convert to YUV from webcam formats for compression.
- Convert to RGB formats for rendering/effects.
- Rotate by 90/180/270 degrees to adjust for mobile devices in portrait mode.
- Optimized for SSSE3/AVX2 on x86/x64.
- Optimized for Neon/SVE2/SME on Arm.
- Optimized for MSA on Mips.
- Optimized for RVV on RISC-V.
Development
See Getting started for instructions on how to get started developing.
You can also browse the docs directory for more documentation.