Repository navigation
[V4] Apply luma AC sharpening in the SIMD WebP quantizer - #3257
Merged
JimBobSquarePants merged 2 commits intoOct 27, 2026
Merged
Conversation
The AVX2 and SSE4.1 paths of QuantEnc.QuantizeBlock computed abs(in) + sharpen but discarded the sum, so they quantized without the luma AC sharpening bias that the scalar path applies. Lossy output therefore depended on the CPU: x64 machines with SSE4.1 produced a different bitstream from the scalar path used on ARM64 or with hardware intrinsics disabled. Assign the sums back so every path quantizes the same value. Lossy output is now byte-identical with AVX2, with SSE4.1 only and without hardware intrinsics, and the lossy-with-alpha size bounds no longer need a separate value for ARM64.
4 tasks done
4 tasks done
JimBobSquarePants
marked this pull request as ready for review
October 27, 2026 06:58
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.
Prerequisites
Description
Backports #3234 to
release/4.1.x.The AVX2 and SSE4.1 WebP quantizers discarded the sharpening additions. They now include that bias before quantization, matching the scalar path and local libwebp. The existing SIMD paths and buffers remain in use.
The regression checks fixed coefficient levels and reconstructed values from libwebp. It runs with the available intrinsics, without AVX2, and without hardware intrinsics. The existing alpha encoding tests use the same size bounds on every architecture. Those bounds already applied to the scalar path on ARM64.
Tests use the existing stored PNG inputs and fixed coefficient arrays. No images are generated as test inputs. No tolerance, reference image, or data-integrity policy changed.
Release verification: all 472 WebP tests pass on .NET 8 and .NET 10. Main also passes its WebP tests. Native comparison, original-code failure reproduction and assembly checks are recorded in #3234.
Fixes #3246