| 358 | } |
| 359 | |
| 360 | void 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 | |
| 384 | void VC5Decompressor::parseVC5() { |
| 385 | mBs.setByteOrder(Endianness::big); |
nothing calls this directly
no outgoing calls
no test coverage detected