<html aria-label="message body"><head><meta http-equiv="content-type" content="text/html; charset=us-ascii"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div class="Apple-Mail-URLShareUserContentTopClass">Hello, </div><div class="Apple-Mail-URLShareUserContentTopClass"><br></div><div class="Apple-Mail-URLShareWrapperClass" style="position: relative !important;"><blockquote type="cite" style="border-left-style: none; color: inherit; padding: inherit; margin: inherit;"><p style="margin: 0.0px 0.0px 0.0px 0.0px"></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; font-kerning: none; color: #000000; -webkit-text-stroke: 0px #000000">I scanned 66 frames of 35 mm color negatives on a Plustek OpticFilm 8200i SE (USB 07b3:1825) using sane-backends master from Nov 4. The backend's warning asks for reports, so here's one. Every frame came back with blue clipped to zero in places, while red and green never reach zero. On a dense Kodak GC 400 roll, 86-97% of the blue samples in the middle of three frames are exactly 0.</font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #000000; -webkit-text-stroke: #000000; min-height: 14.0px"><font style="font-kerning: none"></font><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; font-kerning: none; color: #000000; -webkit-text-stroke: 0px #000000">The cause looks like a cached register write that overwrites the blue offset right before the scan. A patch with two regression tests is attached (gl128-afe-port-replay.diff). It passes the unit tests but hasn't been tried on the scanner yet, so a second set of eyes would help.</font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #000000; -webkit-text-stroke: #000000; min-height: 14.0px"><font style="font-kerning: none"></font><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; font-kerning: none; color: #000000; -webkit-text-stroke: 0px #000000">CommandSetGl128::asic_boot() writes each BOOT_REGS entry to the scanner and also caches it in dev->reg. One of those entries is 0x5e=0x1f. On GL128, 0x51/0x5d/0x5e (REG_FE_INDEX/REG_FE_HIGH/REG_FE_LOW) are the frontend bridge: 0x51 selects an AFE register, and a write to 0x5e commits 0x5d:0x5e to it.</font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #000000; -webkit-text-stroke: #000000; min-height: 14.0px"><font style="font-kerning: none"></font><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; font-kerning: none; color: #000000; -webkit-text-stroke: 0px #000000">set_fe() programs AFE registers 0-7 in order and leaves index 7 selected. When genesys_start_scan() then writes dev->reg, the cached 0x5e=0x1f goes out again and AFE register 7, the blue offset, changes from 61 to 31. begin_scan() doesn't reprogram the AFE, so the image is acquired with that value. genesys_warmup_lamp() and the calibration error paths in genesys.cpp write the same cached set.</font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #000000; -webkit-text-stroke: #000000; min-height: 14.0px"><font style="font-kerning: none"></font><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; font-kerning: none; color: #000000; -webkit-text-stroke: 0px #000000">(On this AFE, registers 5-7 are the 9-bit offsets and 2-4 the 6-bit gains. The gain/offset labels in tables_frontend.cpp for this model are the other way round; that doesn't affect behavior.)</font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #000000; -webkit-text-stroke: #000000; min-height: 14.0px"><font style="font-kerning: none"></font><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; font-kerning: none; color: #000000; -webkit-text-stroke: 0px #000000">With the patch, asic_boot() still writes every boot value to the scanner in the same order, but no longer caches REG_FE_INDEX, REG_FE_HIGH or REG_FE_LOW in dev->reg. Only 0x5e is in the boot table today; excluding all three keeps it correct if the table changes. Fixing it at the cache covers every path that writes dev->reg, not just scan start.</font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #000000; -webkit-text-stroke: #000000; min-height: 14.0px"><font style="font-kerning: none"></font><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; font-kerning: none; color: #000000; -webkit-text-stroke: 0px #000000">The patch also adds two tests. One checks that dev->reg holds none of the bridge registers after asic_boot(). The other uses a test interface that tracks AFE registers through the bridge, runs asic_boot() and set_fe(), writes dev->reg the way genesys_start_scan() does, and checks that every AFE register is unchanged.</font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #000000; -webkit-text-stroke: #000000; min-height: 14.0px"><font style="font-kerning: none"></font><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; font-kerning: none; color: #000000; -webkit-text-stroke: 0px #000000">Here's genesys_unit_tests on master b2268a78 (macOS, Apple clang, BACKENDS=genesys):</font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #000000; -webkit-text-stroke: #000000; min-height: 14.0px"><font style="font-kerning: none"></font><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; font-kerning: none; color: #000000; -webkit-text-stroke: 0px #000000"><span class="Apple-converted-space">    </span>Master with the new tests: 1060 pass, 2 fail (AFE register 7: 31 != 61)</font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; font-kerning: none; color: #000000; -webkit-text-stroke: 0px #000000"><span class="Apple-converted-space">    </span>Patched: 1062 pass, 0 fail</font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #000000; -webkit-text-stroke: #000000; min-height: 14.0px"><font style="font-kerning: none"></font><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; font-kerning: none; color: #000000; -webkit-text-stroke: 0px #000000">Details are in validation.txt, and the full runs are in unit-tests-master.log.gz and unit-tests-patched.log.gz.</font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #000000; -webkit-text-stroke: #000000; min-height: 14.0px"><font style="font-kerning: none"></font><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; font-kerning: none; color: #000000; -webkit-text-stroke: 0px #000000">All 66 captures used default options, and the build had no local patches. capture-record.txt has the build, the command and the full option listing. The scans were made with master 6b5186ad; gl128.cpp differs from b2268a78 only by the cf0d9839 build fix.</font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #000000; -webkit-text-stroke: #000000; min-height: 14.0px"><font style="font-kerning: none"></font><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; font-kerning: none; color: #000000; -webkit-text-stroke: 0px #000000">In the opaque area around the film, red reads about 510 and green about 460, while blue is 0 for 100% of samples. Blue's black level is sitting below zero and getting clamped. water-tower-channel-comparison.png shows the three channels of a cropped portion of one frame from the GC 400 roll, unprocessed and over the same linear range: 79% of the blue samples in the crop are exactly 0, and red and green have none. water-tower-visual-comparison.png only illustrates the visible color shift in that frame (the right side is a post-processing correction, not a rescan).</font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #000000; -webkit-text-stroke: #000000; min-height: 14.0px"><font style="font-kerning: none"></font><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; font-kerning: none; color: #000000; -webkit-text-stroke: 0px #000000">pool-channel-comparison.png is a cropped portion of a second frame from the same roll, where 99.4% of the blue samples in the crop are exactly 0. Crop coordinates, source checksums and the exact counts for both are in sample-notes.txt and the two *-measurements.json files.</font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #000000; -webkit-text-stroke: #000000; min-height: 14.0px"><font style="font-kerning: none"></font><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; font-kerning: none; color: #000000; -webkit-text-stroke: 0px #000000">I can't say the overwrite is the only cause until the same frame is rescanned with and without the patch. That will take a while: the scanner belongs to a library, and I only get time on it twice a month for a short session, so I can't do much experimenting. If there's a specific test that would tell you the most, let me know and I'll try to fit it into a visit.</font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #000000; -webkit-text-stroke: #000000; min-height: 14.0px"><font style="font-kerning: none"></font><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; font-kerning: none; color: #000000; -webkit-text-stroke: 0px #000000">The same replay was reported against pyopticfilm and fixed there, with an A/B hardware comparison on this model:</font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #000000; -webkit-text-stroke: #000000; min-height: 14.0px"><font style="font-kerning: none"></font><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; font-kerning: none; color: #000000; -webkit-text-stroke: 0px #000000"><span class="Apple-converted-space">    </span>https://github.com/jboneng/pyopticfilm/issues/97</font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; font-kerning: none; color: #000000; -webkit-text-stroke: 0px #000000"><span class="Apple-converted-space">    </span>https://github.com/jboneng/pyopticfilm/pull/118</font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #000000; -webkit-text-stroke: #000000; min-height: 14.0px"><font style="font-kerning: none"></font><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; font-kerning: none; color: #000000; -webkit-text-stroke: 0px #000000">SANE's GL128 support (MR !1030) predates that fix. The open MR !1059 changes this model's calibration but still caches the boot 0x5e write. I couldn't find an existing SANE issue or MR for this.</font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #000000; -webkit-text-stroke: #000000; min-height: 14.0px"><font style="font-kerning: none"></font><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; font-kerning: none; color: #000000; -webkit-text-stroke: 0px #000000">Issue #886 compares SANE's output with the standalone plustek8200i backend on the same scanner and finds the genesys colors greener. A low blue offset would do that, though I haven't checked it against those scans.</font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #000000; -webkit-text-stroke: #000000; min-height: 14.0px"><font style="font-kerning: none"></font><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; font-kerning: none; color: #000000; -webkit-text-stroke: 0px #000000">AI notice: the bug was found by Codex (Sol 6.1) while analyzing my scans and verified independently by Claude Opus 5.5, which also wrote the patch and tests.</font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #000000; -webkit-text-stroke: #000000; min-height: 14.0px"><font style="font-kerning: none"></font><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; font-kerning: none; color: #000000; -webkit-text-stroke: 0px #000000">The unprocessed 16-bit TIFF crops behind both figures are too big for the list, so they're here if anyone wants to check the counts, along with a copy of the color comparison:</font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #000000; -webkit-text-stroke: #000000; min-height: 14.0px"><font style="font-kerning: none"></font><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; font-kerning: none; color: #000000; -webkit-text-stroke: 0px #000000"><span class="Apple-converted-space">    </span>https://aidansiegel.com/sane/gl128-blue/water-tower-crop-rgb16.tif</font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; font-kerning: none; color: #000000; -webkit-text-stroke: 0px #000000"><span class="Apple-converted-space">    </span>https://aidansiegel.com/sane/gl128-blue/pool-crop-rgb16.tif</font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; font-kerning: none; color: #000000; -webkit-text-stroke: 0px #000000"><span class="Apple-converted-space">    </span>https://aidansiegel.com/sane/gl128-blue/water-tower-visual-comparison.png</font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; font-kerning: none; color: #000000; -webkit-text-stroke: 0px #000000"><span class="Apple-converted-space">    </span>https://aidansiegel.com/sane/gl128-blue/SHA256SUMS</font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #000000; -webkit-text-stroke: #000000; min-height: 14.0px"><font style="font-kerning: none"></font><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; font-kerning: none; color: #000000; -webkit-text-stroke: 0px #000000">The TIFFs are the raw linear negative data, so they look almost black in an image viewer (and most browsers won't display TIFF at all): the brightest channel in the pool crop peaks at 6588 of 65535, about 10% of full scale. The channel-comparison PNGs show the same pixels stretched to 0-6000.</font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #000000; -webkit-text-stroke: #000000; min-height: 14.0px"><font style="font-kerning: none"></font><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; font-kerning: none; color: #000000; -webkit-text-stroke: 0px #000000">Thanks,</font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; font-kerning: none; color: #000000; -webkit-text-stroke: 0px #000000">Aidan</font></p><span></span></blockquote></div></body></html>