Repository navigation
Conversation
…clap) Decoded images differed visibly from libheif's: blocking artefacts on every photo, and drift up to 31 levels on files with explicit scaling lists. - Add the in-loop filters every HEVC encoder relies on: the deblocking filter (H.265 8.7.2) and sample adaptive offset (8.7.3), applied once a picture is reconstructed. SAO parameters were parsed but never applied, and the SaoOffsetVal they produced stayed zero without a PPS range extension. - Apply explicit scaling lists. Their coefficients were parsed and discarded, so the default matrices were used, the DC coefficient started 8 too low and matrices predicted from a reference were ignored. Each SPS/PPS now keeps its own lists (a PPS list overrides the SPS one) instead of a static table shared by every image, which also made concurrent decoding unsafe. - Infer slice_deblocking_filter_disabled_flag, the beta/tc offsets and slice_loop_filter_across_slices_enabled_flag from the PPS when the slice header omits them (7.4.7.1). - Apply the clean aperture (clap) crop, with libheif's rounding, before rotation and mirroring; width and height report the cropped size. - Fix 180-degree rotation, which mapped rows with the width. Checked against libheif 1.23.6 on the 12 bundled samples and on real iPhone uploads: same dimensions, max difference 1-2 levels per channel (YCbCr to RGB rounding), blockiness equal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…on tool - TestsCore stripped the first character of the class path location (a Windows drive-letter workaround), so no test could find its samples on Linux or macOS. - The 308 MB of raw reference dumps become SHA-256 digests of the decoded output: the same byte-exact regression lock without the blobs. Regenerate them with -Dopenize.updateReferences=true after an intended change. - tools/compare-with-libheif decodes a directory with Openize.HEIC and with libheif (pillow-heif) and reports PSNR, max difference and blockiness per file; it fails above MAX_DIFF (default 2). - README lists the newly supported features. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
LibheifComparisonTest decodes every sample with Openize.HEIC and with libheif's command line decoder (heif-dec, or heif-convert before libheif 1.18), and requires the same dimensions and at most 2 levels of difference per channel. When a file holds several top-level images, libheif writes them all and the primary image has to match one of them. It is skipped when neither decoder is installed, so a plain mvn test needs no native library. -Dopenize.libheif.decoder points at another command and -Dopenize.libheif.corpus adds a directory of files. Passes on all 12 samples with libheif 1.17.6 (Ubuntu 24.04). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Thanks for Openize.HEIC. We compared its output with libheif on real-world photos and found a few gaps. This PR closes them, so decoded images now match libheif up to YCbCr to RGB rounding.
Changes
LoopFilter, run once a picture is reconstructedSaoOffsetValalso stayed zero without a PPS range extensionscaling_list_dataderives ScalingFactor (7.4.5) per SPS/PPS; a PPS list overrides the SPS onestaticfieldclapnot appliedgimp_with_clap.heicdecoded as 1280x1240 instead of 1280x1239irot/imir; width/height report the cropped sizeTestsCorestrips the first character of the class path (a Windows drive-letter workaround), so no test finds its samples on Linux/macOSThe byte-exact reference dumps (308 MB) had to be regenerated anyway, since the output changed. They are now SHA-256 digests of the same data: the same regression lock without the blobs.
-Dopenize.updateReferences=truerewrites them. If you'd rather keep.binfiles, the old comparison can come back with regenerated dumps.Verification
LibheifComparisonTestdecodes every sample with Openize.HEIC and with libheif's command line decoder (heif-dec/heif-convert), and requires the same dimensions and at most 2 levels of difference per channel. It is skipped when libheif isn't installed, somvn testneeds no native library. It passes with libheif 1.17.6, and a one-off comparison against libheif 1.23.6 gave:The same holds for a dozen real iPhone uploads (not included). The remaining 1-2 levels come from YCbCr to RGB rounding.
mvn test: 14/14.The new code follows the spec section by section, with the section numbers in its comments. It's written from the specification, not ported from another decoder.
🤖 Generated with Claude Code