MCPcopy Create free account
hub / github.com/darktable-org/rawspeed / initVC5LogTable

Method initVC5LogTable

src/librawspeed/decompressors/VC5Decompressor.cpp:360–382  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

358}
359
360void VC5Decompressor::initVC5LogTable() {
361 mVC5LogTable = decltype(mVC5LogTable)(
362 [outputBits = outputBits](unsigned i, unsigned tableSize) {
363 // The vanilla "inverse log" curve for decoding.
364 auto normalizedCurve = [](auto normalizedI) {
365 return (std::pow(113.0, normalizedI) - 1) / 112.0;
366 };
367
368 auto normalizeI = [tableSize](auto x) { return x / (tableSize - 1.0); };
369 auto denormalizeY = [maxVal = std::numeric_limits<uint16_t>::max()](
370 auto y) { return maxVal * y; };
371 // Adjust for output whitelevel bitdepth.
372 auto rescaleY = [outputBits](auto y) {
373 auto scale = 16 - outputBits;
374 return y >> scale;
375 };
376
377 const auto naiveY = denormalizeY(normalizedCurve(normalizeI(i)));
378 const auto intY = static_cast<unsigned int>(naiveY);
379 const auto rescaledY = rescaleY(intY);
380 return rescaledY;
381 });
382}
383
384void VC5Decompressor::parseVC5() {
385 mBs.setByteOrder(Endianness::big);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected