Skip to content

Regenerate progressive_libjpeg.jpg from a committed generator (#6) - #25

Merged
Ttimmahlax merged 3 commits into
mainfrom
fix/6-fixture-provenance
Oct 28, 2026
Merged

Ttimmahlax merged 3 commits into
mainfrom
fix/6-fixture-provenance

Conversation

@Ttimmahlax

@Ttimmahlax Ttimmahlax commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Closes #6.

The pixel source of tests/fixtures/progressive_libjpeg.jpg was never recorded, so its redistribution terms couldn't be stated. This PR replaces it with an image whose provenance is on record:

  • tools/generate_progressive_libjpeg.py builds a synthetic 32x32 RGB gradient, computed in the script with no external image, and encodes it as a progressive JPEG with Pillow/libjpeg (quality 75). The output is deterministic: two runs are byte-identical.
  • The new fixture (607 bytes) has the exact marker layout of the old one, so tests/progressive.rs still covers the regression it exists for. The first scan, SOS c1/c2/c3 Ss=0 Se=0, names AC table 0 before any DHT defines it, followed by the same 10-scan progressive script with DHTs before each scan.
  • Like the rest of the crate, it is covered by MIT OR Apache-2.0.

Finding along the way. The golden test pins a hash of the decoded fixture. With the new image, std,platform_independent decodes differently from std-without-simd, by ±2 on 51 of 3,072 bytes. I localised it: grayscale decodes are bit-identical, so the IDCT matches. The difference is the YCbCr->RGB step. On x86, a std build dispatches to the SSSE3/AVX2 colour converter even without simd, and that kernel rounds differently from the scalar ycbcr_to_rgb (inherited from upstream jpeg-decoder). The old image just happened not to show it.

  • The golden test now pins the platform_independent decoded row separately, which also fixes the previously failing --all-features run.
  • CHANGES.md corrects the 0.4.0 note: a chip's decoded bytes match the host's platform_independent / no_std build, not std without simd.

Tests: all pass locally on every arm CI runs plus --all-features:

Arm Passed
--release 89
--release --no-default-features --features std,platform_independent 85
--release --no-default-features --features std 87
--release --no-default-features (no_std) 83
--all-features 88

cargo fmt --check and cargo clippy --release --all-targets -D warnings are clean.

🤖 Generated with Claude Code

tim-almond-house and others added 3 commits October 28, 2026 12:57
The fixture's pixel source was never recorded. It is replaced by a synthetic
32x32 gradient that tools/generate_progressive_libjpeg.py produces through
Pillow/libjpeg, deterministically, with the old file's exact marker layout
(the DC-only first scan names AC table 0 before any DHT defines it), so
tests/progressive.rs still covers the regression it was added for.

The new image exposed that on x86 a std build uses the arch YCbCr->RGB
kernel even without simd, which rounds by up to 2 differently from the
scalar converter (the IDCT and grayscale output are bit-identical). The
golden test now pins the platform_independent decode separately, which also
makes --all-features pass. CHANGES.md corrects the 0.4.0 note about which
host build is a chip's oracle.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ecode oracle

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Ttimmahlax
Ttimmahlax merged commit 65528bb into main Oct 28, 2026
10 checks passed
@Ttimmahlax
Ttimmahlax deleted the fix/6-fixture-provenance branch October 28, 2026 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clarify provenance and redistribution terms for progressive_libjpeg.jpg

2 participants