Align SimdLib.h API docs with actual behavior for gradient, feature-difference, and alpha pipelines#356
Merged
Conversation
Agent-Logs-Url: https://github.com/ermig1979/Simd/sessions/89e61a96-07f7-48a4-afb1-38ad5d9b75dd Co-authored-by: ermig1979 <11633100+ermig1979@users.noreply.github.com>
Agent-Logs-Url: https://github.com/ermig1979/Simd/sessions/30a2b1e6-c9f6-451c-98ab-20236c6c5383 Co-authored-by: ermig1979 <11633100+ermig1979@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
ermig1979
May 26, 2026 07:49
View session
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the public C API documentation in SimdLib.h to accurately reflect the library’s implemented behavior for CRC, absolute-difference/gradient, feature-difference accumulation, and multiple alpha blending / alpha conversion pipelines.
Changes:
- Clarifies CRC-32 / CRC-32C parameters (polynomial form, init/final XOR semantics) and tightens wording.
- Aligns gradient and feature-difference documentation with implementation details (including saturation/clamping and exact formulas).
- Documents alpha blending math using the library’s
DivideBy255rounding form and clarifies BGRA→YUV420p alpha blending semantics and premultiply/unpremultiply channel layout behavior.
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.
The issue was outdated/inexact descriptions in
SimdLib.hfor several image-processing APIs, especially around feature-difference math and alpha compositing semantics. This update rewrites those docs to match implementation-level behavior and parameter meaning.Abs gradient + feature difference semantics
SimdAbsGradientSaturatedSumwording to explicitly describe saturated|dx| + |dy|behavior and border handling.SimdAddFeatureDifferenceformula to the implementation’s actual excess term and saturating accumulation:excess = max(max(value - hi, lo - value), 0)difference = min(difference + ((weight * excess * excess) >> 16), 255)Alpha blending family clarified
SimdAlphaBlending,SimdAlphaBlending2x,SimdAlphaBlendingUniform, andSimdAlphaFillingaround true per-channel equations.DivideBy255rounding form used by implementation instead of plain/255shorthand.BGRA → YUV420p alpha path documented precisely
SimdAlphaBlendingBgraToYuv420pdocs to reflect real behavior:Premultiply / unpremultiply channel-layout behavior
SimdAlphaPremultiplyandSimdAlphaUnpremultiplydescriptions to reflect:argb-controlled alpha index (3for BGRA/RGBA,0for ARGB).