Round-2 fixes for the codecs part of owner review 2, phase 4b (mass
conversion), so the dry run never promises a conversion that then fails
or writes wrong pixels.
- The managed TIFF reader refuses samples it does not render (CMYK,
CIELab, palette, LogL, RGB of fewer than three samples, float
min-is-white) before reading pixels, instead of decoding them as the
gray of their first plane. The conversion chain then asks WIC on a PC;
the server leaves them to a PC. Impossible strip/tile counts are
refused as data, not as an OverflowException that escaped the chain.
- A conversion's managed provider reads JPEG, PNG and TIFF headers in
its probe (ReadsHeaders): what its decoders refuse there (compression,
sample format, photometric, MaxSamples, MaxPixels, arithmetic coding)
is not planned as convertible on the server, and is asked of WIC on a
PC. The probe gives the real size, so TooLarge sees it.
- Float TIFFs are linear light (SourceColor.IsLinear): a JPEG or TIFF
carrying their profile gets codes from the profile's own curves, a DNG
gets them through the matrix only (no curve, no clip, highlights
kept). IsSrgb is decided by the numbers for matrix/TRC profiles, so a
linear profile named sRGB is converted, not taken as sRGB. The TIFF
profile is read from the image the decoders read.
- TooLarge is a bound: the target's limits and what the server's
decoders read back, which every converted file must (JPEG 2^28 pixels,
TIFF-16 and DNG 2^29 samples), and the incompressible worst case
against the 2 GB array. A MemoryStream overflow is TooLarge, never a
generic file failure.
- Colorants that convert nothing (a white without positive cone
responses, a non-finite or singular matrix) are dropped when a profile
is parsed: the photo is carried into a JPEG or TIFF and planned out of
a DNG as colour_profile, instead of throwing in BradfordAdaptation at
every retry.
Tests: header probes, refused photometrics, the size bound against the
verifier's header reads, float TIFF colour, a fuzz of damaged profiles,
and a Windows test converting a CMYK TIFF through WIC.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 18cf9133087aada2db06c8310d2c69ff804c0115)
Phase 4b review, codec findings. A Replace makes the converted file the
photo, so a conversion must not lose what the original held, and the dry
run must promise only what the job will do.
- Linear DNG from a conversion is scene-referred: the pixels are stored in
linear ProPhoto primaries (colours outside sRGB stay positive) and
divided by the power of two that brings their peak under the white
level (at most 4 stops), with BaselineExposure giving it back and
ColorMatrix1/ForwardMatrix1 describing that space. Highlights a RAW
develops above 1 and its wide-gamut colours now read back as written.
Exports keep the clipped linear-sRGB DNG.
- A conversion reads with the managed decoders first for every format they
read natively (RAWs developed at float precision, as on the server) and
with WIC only for what they cannot. A RAW only WIC's Raw Image Extension
develops (8 bits) is refused for TIFF-16 and linear DNG and planned out
as "eight_bit"; JPEG still converts it. Providers say so through
IImageDecoderProvider.DevelopsRawAt8Bits.
- The original's colour space is kept: a JPEG (APP2) or TIFF (tag 34675)
carries its ICC profile, with the values unchanged; a linear DNG gets the
values converted through a matrix/TRC profile; a gray profile converts
to sRGB. Exif Adobe RGB (uncalibrated + R03) and HEIF nclx P3 get an
in-house profile. A space nothing here can keep (CMYK, a lookup-table
profile into a DNG, uncalibrated without R03, HDR nclx) is planned out
as "color_profile". New in-house ICC parser/writer and header reader
for JPEG, PNG, TIFF, HEIF/AVIF and WebP.
- The planner asks every file, whatever tier was recorded (unknown before
the light analysis, or by another host), with the conversion's decoders,
headers only and eight at a time; a RAW the server cannot develop is
"convert_on_pc" in the plan instead of failing its sequence. Photos a
target cannot hold (a JPEG side above 65535, more samples than one
buffer) are planned out as "too_large", and an overflow fails its photo
rather than the job.
- A photo that fails reads in the job log as one catalog sentence by cause
(Archive.Convert.Failed.*), the file named once; the exception's English
text goes to the diagnostics log only.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 0ca1e91ea09946d7a55f45695ee58e1a0ff5f779)