Commit 3c7136f8 authored by vertighel's avatar vertighel
Browse files

Downscale before colour-mapping in fits_to_png, not after



apply_viridis was running on the full-resolution frame before
array_to_png threw most of it away for the thumbnail — colour-mapping
every pixel of a 17-Mpixel frame just to keep a 128x128 preview cost
~270-290ms for zero visual benefit. Downscaling first (both the
colormap step and, when vmin/vmax are omitted, the auto_range
fallback) gives byte-identical PNG output for the common case where
vmin/vmax are supplied, since a stride-based pixel selection commutes
with a per-pixel transform. Measured on a real 4126x4145 scicam1
frame: 128px thumbnail 270ms -> 0.9ms, 256px 272ms -> 3.3ms, 512px
(the live-preview push size) 411ms -> 13ms.

When vmin/vmax are None (only stream.py's WS preview broadcast),
auto_range() now also runs on the downscaled data instead of the full
frame - a small approximation (~3% of range on the tested frame), not
used by the user-facing range shown by /info.

Co-Authored-By: default avatarClaude Sonnet 5 <noreply@anthropic.com>
parent 53e0364c
Loading
Loading
Loading
Loading