Repository navigation
Conversation
…x2/avx512 The 16-bit DWT packs two int16_t taps into one 32-bit lane with (uint32_t)(filter[k] << 16). Three of the taps are negative, and shifting a negative int is undefined. Convert to uint32_t before shifting; the packed constants are unchanged. Signed-off-by: Lusoris <lusoris@pm.me>
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.
adm_dwt2_16_avx2()andadm_dwt2_16_avx512()pack twoint16_tfilter taps into one 32-bit lane with(uint32_t)(filter_lo[k] << 16). Three of the taps that go through this expression are negative (-4240, -7345, -15826), and left-shifting a negativeintis undefined behaviour. This is one of the two concerns PR 1601 mixed together; the vertical-pass sum goes in a separate PR.Fix
Convert the tap to
uint32_tbefore the shift:((uint32_t)filter_lo[k] << 16). Eight lines, four in each file. The packed constants are the same.Before and after
UBSan build (
-Db_sanitize=undefined), 16-bit 576x324 pairsrc01_hrc00/src01_hrc01(yuv420p16le, from the clips that lived inpython/test/resource/yuvbeforebac8b607),--feature adm:cf677baa--cpumask 16)The reports on master are at
adm_avx2.c:2923-2925andadm_avx512.c:3012-3014.Tests
No test added. In a release build with GCC 16.2.1 the disassembly of both functions is identical before and after the change, so no value-based test can tell the two apart; the UBSan run above is the evidence.
Validation
cf677baa: the libvmaf unit suite passes 27 of 27.