mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-03 06:31:42 +01:00
* CR2: read ColorData's as-shot white balance as words CANON_COLOR_DATA is an UNDEFINED entry: uints() hands its bytes back one by one, but the WB_RGGBLevelsAsShot offsets count 16-bit words. Reading word i at entry offset i*2 (file byte order, bounds-checked) finds the quadruple at 0x47 in the corpus PowerShot SX50 HS: [1613, 951, 951, 1605] -> [1.70, 1.0, 1.69], matching the white balance its own DNG conversion neutralises (AsShotNeutral -> [1.58, 0.955, 1.666] through the color matrix). With this the file's balance is used instead of the grey-world estimate; the regression test pins the words and the missing estimate warning. (The remaining brightness gap between the CR2 and the DNG of the same camera is the CR2 path's exposure normalisation, to be looked at next; the estimate was never what brightened the file.) * cr2: drop the unused glob import in the corpus test * CR2 WB: synthetic word-offset oracle, entry bounds, corpus test behind the feature testgen writes ColorData as Canon does, UNDEFINED bytes that are 16-bit words with the PowerShot's WB_RGGBLevelsAsShot at word offset 0x47, and the new color_data_wb_as_words test checks the decoded balance in every CI run (the corpus oracle stays behind the corpus feature and now panics when its file is missing instead of silently skipping). word() reads stay inside the entry's own byte count, and the shared inspect example moves back to the corpus PR.