mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-14 23:32:20 +00:00
perf(weather): apply the infrared cloud transfer from a lookup table, in place
The Satellite clouds transfer ran a power curve per pixel and wrote the result back from a full-size copy. On the 4096x2048 images the 3D Tiles host draws, that held the page for about 150 ms per image. The scale depends only on the brightest channel, so it is now worked out once per byte value and applied to the canvas pixels in place. Output bytes are unchanged. Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
1 parent
188f0ccd9b
commit
0b5ae6386e
4 files changed
+100
-15
No files matched your search
@@ -6,7 +6,7 @@ import {
|
||||
drawWeatherPixels,
|
||||
closeWeatherPixels,
|
||||
} from './source.js';
|
||||
import { infraredAlpha } from './infraredAlpha.js';
|
||||
import { applyInfraredAlpha } from './infraredAlpha.js';
|
||||
|
||||
export const MAX_MOSAIC_BYTES = 4 * 1024 * 1024;
|
||||
|
||||
@@ -31,7 +31,8 @@ export function processInfraredImage(
|
||||
|
||||
function applyInfraredTransfer(context, canvas, mode) {
|
||||
const pixels = context.getImageData(0, 0, canvas.width, canvas.height);
|
||||
pixels.data.set(infraredAlpha(pixels.data, mode));
|
||||
// In place: a copy of a 4096×2048 image is 33 MB, made and written back.
|
||||
applyInfraredAlpha(pixels.data, mode);
|
||||
context.putImageData(pixels, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user