Fix asymmetric chroma plane stride handling in encoder preprocessing#3961
Open
sprangerik wants to merge 1 commit into
Open
Fix asymmetric chroma plane stride handling in encoder preprocessing#3961sprangerik wants to merge 1 commit into
sprangerik wants to merge 1 commit into
Conversation
3463bfa to
5a54974
Compare
BenzhengZhang
approved these changes
Jul 9, 2026
5a54974 to
03ef5d0
Compare
When preprocessing incoming I420 source frames, WelsMoveMemoryWrapper previously read only the U chroma plane stride (iStride[1]) and used it as a shared stride for copying both the U and V chroma planes. If an incoming frame has distinct, asymmetric strides for the U and V chroma planes (for example, when the U plane stride is larger than the V plane stride), copying the V plane using the U plane's stride advances the source pointer incorrectly. This change ensures correct memory advancement for each chroma plane by: - Modifying WelsMoveMemory_c to accept separate destination and source strides for the U and V chroma planes (iDstStrideU, iDstStrideV, iSrcStrideU, iSrcStrideV). - Updating WelsMoveMemoryWrapper to read and pass iStride[1] and iStride[2] separately from the input SSourcePicture. - Updating internal callers (DownsamplePadding and Padding) to pass their respective U and V line sizes cleanly. - Adding a unit test (CustomChromaPlaneStrides) to verify that distinct, asymmetric chroma plane strides are handled correctly.
03ef5d0 to
57f4363
Compare
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.
When preprocessing incoming I420 source frames, WelsMoveMemoryWrapper
previously read only the U chroma plane stride (iStride[1]) and used it as a
shared stride for copying both the U and V chroma planes. If an incoming
frame has distinct, asymmetric strides for the U and V chroma planes (for
example, when the U plane stride is larger than the V plane stride), copying
the V plane using the U plane's stride advances the source pointer incorrectly.
This change ensures correct memory advancement for each chroma plane by:
strides for the U and V chroma planes (iDstStrideU, iDstStrideV,
iSrcStrideU, iSrcStrideV).
separately from the input SSourcePicture.
respective U and V line sizes cleanly.
asymmetric chroma plane strides are handled correctly.