Repository navigation
feat(simd): AVX2 integer SSIM horizontal moment accumulation - #145
Merged
Merged
Conversation
lusoris
force-pushed
the
feat/integer-ssim-avx2
branch
from
May 29, 2026 12:09
3f426e5 to
d59e2c9
Compare
lusoris
marked this pull request as ready for review
May 31, 2026 13:44
lusoris
marked this pull request as draft
May 31, 2026 13:54
lusoris
marked this pull request as ready for review
May 31, 2026 14:04
Contributor
Author
|
Closing as part of marathon cleanup 2026-05-31 (150 PRs merged today). Content likely superseded by sibling merges. Reopen if specific finding still needs work; bigger PRs preferred going forward per session feedback. |
Adds `integer_ssim_accumulate_row_avx2` (8bpc, 8-wide) and
`integer_ssim_accumulate_row_16_avx2` (16bpc, 4-wide) to vectorise the
dominant hot path in the `ssim` feature extractor. All accumulation is
in int32/int64 integer arithmetic, matching the scalar reference exactly.
Runtime-dispatched via `vmaf_get_cpu_flags()` in `IntegerSsimState.init()`;
scalar hosts (no AVX2, arm64, non-x86) are unaffected. Projected 4-6x
speedup on the horizontal pass for AVX2 hosts.
Includes:
- `core/src/feature/x86/integer_ssim_avx2.{c,h}` - AVX2 kernels
- `core/src/feature/integer_ssim.c` - dispatch wiring via function pointers
- `core/test/test_integer_ssim_simd.c` - 4 bit-exactness tests
- `docs/adr/0784-integer-ssim-avx2.md`, `docs/backends/x86/integer-ssim-avx2.md`
Rebased onto master (ef9bc22) from feat/integer-ssim-avx2
(d59e2c9); no shared history, changes extracted and applied cleanly.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
lusoris
force-pushed
the
feat/integer-ssim-avx2
branch
from
June 3, 2026 15:37
d59e2c9 to
8958c51
Compare
lusoris
marked this pull request as ready for review
June 3, 2026 15:37
6 tasks
lusoris
added a commit
that referenced
this pull request
Jun 6, 2026
…m_simd.c (#700) On i686 no-asm builds (enable_asm=false), ARCH_X86 is not set in config.h — src/meson.build only defines ARCH_X86 inside the `if is_asm_enabled` block. The scalar reference functions scalar_accumulate_row_8() and scalar_accumulate_row_16() use integer_ssim_moments_t unconditionally (they are the scalar reference that any architecture can run), but the only include that brought in the type was guarded by #if ARCH_X86 (via feature/x86/integer_ssim_avx2.h -> ../integer_ssim.h). On no-asm i686, that guard is false, so the type was never defined, giving: test_integer_ssim_simd.c:102: error: unknown type name 'integer_ssim_moments_t' test_integer_ssim_simd.c:129: error: unknown type name 'integer_ssim_moments_t' Fix: add an unconditional #include "integer_ssim.h" before the #if ARCH_X86 block. The shared header was introduced by ADR-1040 / PR #654 to solve the same class of problem in integer_ssim.c for macOS arm64; the test file was not updated at that time. The test's -I../src/feature include path resolves the header without a path prefix. The AVX2 function calls in the test remain inside #if ARCH_X86, so the linker only needs those symbols when asm is enabled, which is correct. Fixes: Build — Ubuntu i686 gcc (CPU, no-asm) (CI run 26953952042) Introduced by: PR #145 (feat: AVX2 integer SSIM horizontal moment accumulation) Partial-fix-of: ADR-1040 (which fixed integer_ssim.c but missed the test) Co-authored-by: Lusoris <lusoris@pm.me> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
integer_ssim_accumulate_row_avx2(8bpc, 8 output pixels/iter) andinteger_ssim_accumulate_row_16_avx2(16bpc, 4 output pixels/iter) — the dominant hot path in thessimfeature extractor, previously entirely scalar (PR docs(simd): SIMD twin coverage inventory + gap prioritisation (ADR-0771) #111 gap chore(meta): post-cutover URL sweep — lusoris/vmaf → VMAFx/vmafx #1).vmaf_get_cpu_flags()inIntegerSsimState.init(); scalar hosts and non-x86 are unaffected.Test plan
meson test -C build --suite=fast— 50/50 pass locally (includingtest_integer_ssim_simd)test_integer_ssim_simd— 4 sub-tests: 8bpc random (4 seeds), 16bpc random (4 seeds), uniform all-white/black, narrow width=1 (all boundary). All pass (bit-exact memcmp).Deliverables checklist (ADR-0108)
meson test -C build --suite=fast -k integer_ssim_simdNo FFmpeg patch, public header, or ABI change.
Generated with Claude Code