From 6be56f2145f9ef7649462faa594452107cb387e8 Mon Sep 17 00:00:00 2001 From: Lawrence Lee <45837045+Lawrence37@users.noreply.github.com> Date: Sun, 9 Mar 2025 23:10:09 -0700 Subject: [PATCH] Allow LibRaw to get white level while loading data The function for loading the image data from Minolta RD175 raw images sets the white level. Make use of this white level. --- rtengine/rawimage.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/rtengine/rawimage.cc b/rtengine/rawimage.cc index ab55861f4..1663b9811 100644 --- a/rtengine/rawimage.cc +++ b/rtengine/rawimage.cc @@ -796,12 +796,22 @@ int RawImage::loadRaw(bool loadData, unsigned int imageNum, bool closeFile, Prog #ifdef LIBRAW_USE_OPENMP MyMutex::MyLock lock(*librawMutex); #endif + + // For some cameras like Minolta RD175, the real white level is + // read with LibRaw::unpack(). Here, we initialize LibRaw's + // maximum with the value read earlier. Later, we read the value + // back in case it has changed. + libraw->imgdata.color.maximum = maximum; + err = libraw->unpack(); } if (err) { return err; } + // Update white level in case LibRaw::unpack() read a new value. + maximum = libraw->imgdata.color.maximum; + auto &rd = libraw->imgdata.rawdata; raw_image = rd.raw_image; if (rd.float_image) {