fix(raw): enable camera white balance multipliers and fallback extraction to fix RAW color cast on Olympus and other bodies

This commit is contained in:
2026-10-05 15:43:20 +07:00
parent 140b4f88b2
commit 480fd148a3
3 changed files with 9 additions and 4 deletions
+8 -3
View File
@@ -72,7 +72,7 @@ const SETTINGS = {
outputBps: 16,
outputColor: 0,
noAutoScale: true,
useCameraWb: false,
useCameraWb: true,
noAutoBright: true,
gamm: [1, 1] as [number, number],
userQual: 3,
@@ -367,8 +367,13 @@ export async function developRaw(bytes: Uint8Array): Promise<Uint8Array> {
const effect = Skia.RuntimeEffect.Make(RAW_DEVELOP_SKSL);
if (!effect) throw new Error('develop shader failed to compile');
const green = cd.cam_mul[1] || 1;
const mul = cd.cam_mul.map((v) => v / green);
const rawMul = (cd?.cam_mul && cd.cam_mul.some((v: number) => v > 0 && v !== 1))
? cd.cam_mul
: (cd?.pre_mul && cd.pre_mul.some((v: number) => v > 0))
? cd.pre_mul
: [1, 1, 1, 1];
const green = rawMul[1] || rawMul[3] || 1;
const mul = rawMul.map((v: number) => v / green);
const row = (i: number) => cd.rgb_cam[i].slice(0, 3);
const [r0, r1, r2] = [row(0), row(1), row(2)];