Repository navigation
Upsample subsampled JPEG chroma with libjpeg's 3:1 filter - #28
Merged
Merged
Conversation
JpegDecoder.Sample replaces nearest-neighbour sampling with the triangular filter libjpeg calls fancy: an even output position is three parts of its sample and one of the neighbour before it, an odd one three parts and one of the neighbour after it, with the same rounding. A 4:2:0 fixture now matches Pillow within two levels rather than the six the nearest filter needed, and the test tolerance tightens to two.
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.
Summary
JpegDecoder.Samplenow upsamples a subsampled component with the 3:1 triangular filter libjpeg calls fancy, instead of nearest-neighbour:+1/+2before>> 2), with clamped edges;Effect
jpeg-420.jpgnow matches Pillow within two levels instead of the six nearest-neighbour needed, and the test's tolerance tightens from 6 to 2. All other fixtures are unchanged.Evidence
dotnet build -c Release→ 0 warnings, 0 errors;dotnet test→ 1250 passed, 0 failed onnet10.0andnet11.0.Next
SOF2: spectral selection, successive approximation and the EOB run, against a progressive Pillow fixture.