A converted negative follows its adjustments as they move, and converts and saves faster #29

Merged
eliott merged 3 commits from feat/faster-darkroom into main 2026-11-20 00:02:54 +01:00
Owner

Adjusting a converted negative in the Convert tab now changes the picture while the slider moves, instead of once it stops. The conversion itself runs on every core: a preview takes about a quarter of the time it did, and a full-size positive well under half.

How it works

  • The levels are counted row by row on every core and the counts added up; the pixels of the positive are made row by row the same way. The results are the same to the byte.
  • The page asks for the next preview as soon as the last one is shown, with the values set by then, one request at a time, instead of 150 ms after the slider stops.
  • The TIFF is written to the file as it is made, instead of being built whole in memory first (229 MB for a 40-megapixel frame).
  • Adding a negative is not faster: most of its time goes to filling in the colours of the X-Trans sensor, which the RAW library already does on every core.

Tested

  • cargo test: 293 passed.
  • Fujifilm X-T5 RAF files (7752 x 5184), the 0.4.0 build against this one, on a 16-core machine:
    • a preview in the app, with a frame and adjustments set: 174 ms -> 46 ms (5 requests each);
    • rollscan convert at full size: 3.1 s -> 1.2 s (two files, one run each);
    • the TIFFs and the preview JPEGs are byte-identical between the two builds.
  • A real mouse drag on an adjustment slider in WebKit: 84 previews during a 4.6 s drag, never two at once, no page errors.

Not tested

  • The scanner: nothing here touches the camera or the Arduino.
  • Saving through the app (it runs the same conversion as convert).
  • Peak memory: lower by the TIFF copy, but estimated, not measured.
  • Windows and macOS, a machine with few cores, RAW files from other cameras.

Changes in behaviour

  • The picture follows an adjustment's slider while it moves, not once it stops.
  • Version 0.5.0.
Adjusting a converted negative in the Convert tab now changes the picture while the slider moves, instead of once it stops. The conversion itself runs on every core: a preview takes about a quarter of the time it did, and a full-size positive well under half. ## How it works - The levels are counted row by row on every core and the counts added up; the pixels of the positive are made row by row the same way. The results are the same to the byte. - The page asks for the next preview as soon as the last one is shown, with the values set by then, one request at a time, instead of 150 ms after the slider stops. - The TIFF is written to the file as it is made, instead of being built whole in memory first (229 MB for a 40-megapixel frame). - Adding a negative is not faster: most of its time goes to filling in the colours of the X-Trans sensor, which the RAW library already does on every core. ## Tested - `cargo test`: 293 passed. - Fujifilm X-T5 RAF files (7752 x 5184), the 0.4.0 build against this one, on a 16-core machine: - a preview in the app, with a frame and adjustments set: 174 ms -> 46 ms (5 requests each); - `rollscan convert` at full size: 3.1 s -> 1.2 s (two files, one run each); - the TIFFs and the preview JPEGs are byte-identical between the two builds. - A real mouse drag on an adjustment slider in WebKit: 84 previews during a 4.6 s drag, never two at once, no page errors. ## Not tested - The scanner: nothing here touches the camera or the Arduino. - Saving through the app (it runs the same conversion as `convert`). - Peak memory: lower by the TIFF copy, but estimated, not measured. - Windows and macOS, a machine with few cores, RAW files from other cameras. ## Changes in behaviour - The picture follows an adjustment's slider while it moves, not once it stops. - Version 0.5.0.
- The levels are counted row by row on every core and the counts added up; the pixels
  are made row by row the same way. The results are the same to the byte.
- The TIFF is written to the file as it is made, through a small buffer, instead of
  being built whole in memory first (229 MB for a 40-megapixel frame).
- On a Fujifilm X-T5 RAF: a preview in the app 174 -> 46 ms, a full conversion
  3.1 -> 1.2 s.
- A new preview is asked for as soon as the last one is shown, with the values set by
  then, one at a time, instead of 150 ms after the slider stops.
eliott merged commit ffdb24f4f0 into main 2026-11-20 00:02:54 +01:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
RollNote/rollscan!29
No description provided.