Add NEON path for avifFillAlpha and same-depth avifReformatAlpha copies - #3312
Open
kjg0724 wants to merge 1 commit into
Open
Add NEON path for avifFillAlpha and same-depth avifReformatAlpha copies#3312kjg0724 wants to merge 1 commit into
kjg0724 wants to merge 1 commit into
Conversation
Both functions are 100% scalar today with no libyuv involvement, and run on every alpha-channel image during decode/reformat. Add an AArch64 NEON implementation gated by __aarch64__ (NEON is the mandatory Advanced SIMD baseline there, so no runtime feature detection is needed). MSVC's _M_ARM64 is not covered by this guard and stays on the existing scalar path for now. avifReformatAlpha's rescale paths (differing src/dst depth) are intentionally left scalar in this change; they involve a float multiply/round/clamp per pixel and are a natural follow-up once this lands. Adds tests/gtest/avifalphatest.cc covering valid interleave layouts, tail/remainder widths, zero dimensions, and layouts the NEON dispatch must reject in favor of the scalar fallback.
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.
avifFillAlphaandavifReformatAlphacurrently use scalar C when alpha processing is not already handled by libyuv. This adds AArch64 NEON implementations for:avifFillAlpha, for both 8-bit and 16-bit storageavifReformatAlphasame-depth copies (srcDepth == dstDepth), for both 8-bit and 16-bit storageGated by
#if defined(__aarch64__): Advanced SIMD is part of the AArch64 baseline, so no runtime feature detection is needed. MSVC's_M_ARM64is not covered by this guard and stays on the existing scalar path.The differing-depth
avifReformatAlpharescale paths remain scalar.Tested:
cmake --build build --target avifalphatest, all cases pass; existing avifalphapremtest/avifbasictest/avifrgbtoyuvtest/avifyuv unaffectedBenchmark (Oracle Cloud A1, Neoverse-N1, 8-bit depth, NEON vs a scalar-forced build of the same source):