Let the document say what colour space a picture is in - #23
Merged
Conversation
tannevaled
force-pushed
the
calrgb-is-not-direct
branch
from
August 31, 2026 14:04
04e8ff5 to
d512e35
Compare
tannevaled
force-pushed
the
calrgb-is-not-direct
branch
2 times, most recently
from
August 31, 2026 17:09
725f528 to
cde0c29
Compare
pdfimages lists a /CalRGB picture as "rgb" and a /CalGray one as "gray" (utils/ImageOutputDev.cc:159-164), while the pixels it writes went through colorMap->getRGB (:451) — for a GfxCalRGBColorSpace, the gamma, the matrix and the chromatic adaptation. So the direct bucket admitted pictures poppler HAD converted, and measured every pixel of them against a colour conversion we did not make. All four pictures still differing by more than four levels after render v0.21.0's chroma fix were CalRGB. The bucket is now decided by both sides: a picture is converted when the listing says so, and also when its own /ColorSpace resolves to CalRGB, CalGray, ICCBased or Lab, whatever the listing says. Only the first two can move anything — poppler lists ICCBased as "icc" and Lab as "lab", both converted already — and all four are named so the rule is a statement about the document rather than a patch over one judge's table. The space is read from the picture's own dictionary, through the page's forms as render.Images walks them and to the same depth, and through the resource dictionary when a picture names its space rather than writing it out. Where it cannot decide it does not decide quietly. A name is unique within one resource dictionary and not across the several a page reaches, so a page whose two forms each name their own Im1 marks both when either is CalRGB. That over-counts converted by at most those pictures; the other direction credits a colour conversion to a codec, which is what this is about. Bucket.Calibrated and the record's "calibrated" say how many pictures the second half of the rule moved, per filter and per bucket, because a rule that changes a bucket has to be able to say what it changed. On the four documents issue #20 names, it moves 4 of their 5 DCTDecode pictures and leaves the fifth where it was. Closes #20
tannevaled
force-pushed
the
calrgb-is-not-direct
branch
from
August 31, 2026 17:45
cde0c29 to
6b852da
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.
Stacked on #22 (
poppler-timeout), which it bases on; the diff to read is the second commit.The defect
pdfimageslists a/CalRGBpicture asrgband a/CalGrayone asgray—utils/ImageOutputDev.cc:159-164, read out of the poppler checkout under/Users/Shared/biblio:Meanwhile the pixels it writes go through
colorMap->getRGB(:451), which for aGfxCalRGBColorSpaceapplies the gamma, the matrix and the chromatic adaptation. So thedirectbucket — the one whose agreement figure is about a decoder — admitted pictures poppler had converted, and measured every pixel of them against a colour conversion we did not make. All four pictures still differing by more than four levels afterrenderv0.21.0's chroma fix were/CalRGB.The rule now
A picture is
convertedwhen the listing says so, and also when its own/ColorSpaceresolves toCalRGB,CalGray,ICCBasedorLab, whatever the listing says. Only the first two can move anything, since poppler listsICCBasedasiccandLabaslaband both were converted already; all four are named so the rule is a statement about the document rather than a patch over one judge's table.The space is read from the picture's own dictionary — through the page's forms as
render.Imageswalks them and to the same depth, and through the resource dictionary when a picture names its space (/CS0) rather than writing it out.Where it cannot decide, it does not decide quietly. A resource name is unique within one dictionary and not across the several a page reaches, so a page whose two forms each name their own
Im1marks both when either is/CalRGB. That over-countsconvertedby at most those pictures; the other direction is the one that credits a colour conversion to a codec.What it moved
Bucket.Calibratedand the record'scalibratedsay how much of a converted bucket the document accounts for: the pictures whose own/ColorSpaceis CIE-based. It is deliberately not the count of what the rule moved, and the code and both READMEs say so — most calibrated pictures areICCBasedorIndexed, which the listing already called converted, so reading it as the change overstates it by two orders of magnitude. What moved is a difference between two runs, and #24 measures it: five pictures fleet-wide, four of them the four/CalRGBDCTDecodepictures this issue names.Run over the four documents #20 names, as their own population: 4 of their 5
DCTDecodepictures move toconverted,calibrated: 4, and the fifth stays direct. The fleet-wide figure comes with the re-measurement atrenderv0.21.0.The README now says what the bucket means, including both honesties that remain (
index, and an unreadable listing row).Gate
gofmt,go vet,-race, exact 100% statement coverage and the nine cross-compile targets, all underGOTOOLCHAIN=go1.27.0,GOWORK=off,CGO_ENABLED=0.Closes #20