163 vector<std::string> makemodel =
165 if (makemodel.size() < 2)
166 ThrowRDE(
"wrong number of strings for make/model");
167 const std::string& make = makemodel[0];
168 const std::string& model = makemodel[1];
177 expf(
canonEv(
static_cast<int64_t
>(iso_index)) * logf(2.0)) * 100.0F /
190 std::array<uint16_t, 4> wbMuls{
192 for (
const auto& mul : wbMuls) {
194 ThrowRDE(
"WB coefficient is zero!");
197 std::array<float, 4> wbCoeffs = {};
198 wbCoeffs[0] =
static_cast<float>(1024.0 / wbMuls[0]);
200 static_cast<float>((1024.0 / wbMuls[1]) + (1024.0 / wbMuls[2])) /
202 wbCoeffs[2] =
static_cast<float>(1024.0 / wbMuls[3]);
203 mRaw->metadata.wbCoeffs = wbCoeffs;
207 int offset =
hints.get(
"wb_offset", 120);
209 std::array<uint16_t, 2> key = {{0x410, 0x45f3}};
210 if (!
hints.contains(
"wb_mangle"))
214 std::array<float, 4> wbCoeffs = {};
215 wbCoeffs[0] =
static_cast<float>(wb->
getU16(offset + 1) ^ key[1]);
216 wbCoeffs[1] =
static_cast<float>(wb->
getU16(offset + 0) ^ key[0]);
217 wbCoeffs[2] =
static_cast<float>(wb->
getU16(offset + 2) ^ key[0]);
218 mRaw->metadata.wbCoeffs = wbCoeffs;
226 std::array<float, 4> wbCoeffs = {};
227 wbCoeffs[0] =
static_cast<float>(entry->
getU16(62));
228 wbCoeffs[1] =
static_cast<float>(entry->
getU16(63));
229 wbCoeffs[2] =
static_cast<float>(entry->
getU16(60));
230 wbCoeffs[3] =
static_cast<float>(entry->
getU16(61));
231 mRaw->metadata.wbCoeffs = wbCoeffs;
234 std::array<float, 4> wbCoeffs = {};
235 wbCoeffs[0] =
static_cast<float>(entry->
getU16(51));
236 wbCoeffs[1] = (
static_cast<float>(entry->
getU16(50)) +
237 static_cast<float>(entry->
getU16(53))) /
239 wbCoeffs[2] =
static_cast<float>(entry->
getU16(52));
240 mRaw->metadata.wbCoeffs = wbCoeffs;
252 ThrowRDE(
"Invalid white balance index");
254 1 + ((std::string_view(
"0134567028")[wb_index] -
'0') * 4);
255 std::array<float, 4> wbCoeffs = {};
256 wbCoeffs[0] = wb_data->
getU16(wb_offset + 0);
257 wbCoeffs[1] = wb_data->
getU16(wb_offset + 1);
258 wbCoeffs[2] = wb_data->
getU16(wb_offset + 3);
259 mRaw->metadata.wbCoeffs = wbCoeffs;
262 mRaw->setError(e.what());
uint32_t getU32(uint32_t num=0) const
ByteStream getData() const
uint16_t getU16(uint32_t num=0) const