Repository navigation
svac3: AVX2 and NEON kernels for the transform, motion compensation and deblocking - #8
Conversation
…nd deblocking The sample-processing kernels move behind a table, svac3_dsp: a C reference, an AVX2 set chosen at run time on x86-64 CPUs that have it, and a NEON set on AArch64. -DSVAC3D_SIMD=OFF builds the C set only. - matmul: the inverse DCT2's two passes as 16-bit matrix products with 32-bit sums (madd on AVX2, vmlal on NEON) - add_block: prediction plus residual, for blocks inside the picture - mc_h / mc_v / mc_hv: 8-tap luma and 4-tap chroma interpolation where every reference sample lies inside the plane (16-bit horizontal sums, 32-bit vertical); edge blocks keep the clamping C path - deblock: 8 lines across one edge in 8 lanes, the Bs decision as lane masks and the filters selected per lane, vertical edges through an 8x8 byte transpose; filter type 1 stays in C The deblocking driver now works per 4x4 unit pair: the edge test, the inter Bs-0 rule, the QPs and alpha/beta are found once per 4 luma (2 chroma) lines rather than per line, which also speeds up the C path. test_dsp compares every SIMD kernel with C on random inputs (all three interpolation shapes, both tap sets, widths that fall back to C, every Bs branch, both edge orientations); the corpus stays bit-exact.
PR Summary by QodoAdd AVX2 and NEON kernels to SVAC3 decoding
AI Description
Diagram
High-Level Assessment
Files changed (12)
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTip of the day💡 Did you know, you can add REVIEW.md to your repo root and Qodo follows it on every PR |
First SIMD pass: the hot sample-processing kernels gain AVX2 (x86-64) and NEON (AArch64) versions behind a dispatch table. Bit-exact by construction and by test: every SIMD kernel gives the C reference's output bits.
Structure
svac3_dsp.h: a kernel table,svac3_dsp()picks the set:svac3_dsp_c, the reference; the previous code moved here unchanged in arithmetic;x86/svac3_dsp_avx2.c, built with-mavx2and used when__builtin_cpu_supports("avx2");arm/svac3_dsp_neon.c, always used on AArch64.-DSVAC3D_SIMD=OFFbuilds the C set only. MSVC builds never get the AVX2 set, which needs GCC/Clang.Kernels
matmulmaddon row pairs, NEONvmlal. Its callers keep the zero-row/column boundsadd_blockmc_h,mc_v,mc_hvdeblockWidths that are not a multiple of 8 go to C.
Deblocking driver: the edge test, the inter Bs-0 rule, the QP average and α/β are now computed once per 4×4 unit pair (4 luma or 2 chroma lines) instead of per line. That alone speeds up the C path. Edges 8 samples apart touch disjoint samples, so batching them changes nothing.
Checks
test_dsp(new, in ctest) runs every SIMD kernel against C on random inputs. It covers:matmul: every transform size, random depths, both operand ranges;Speed: one core, best of 5,
masteragainst this branch:The x86 host was loaded during the runs (load average around 30), so its numbers are the noisier ones.
Left for a next pass: