9 : Rshift1(
narrow<int>(((2 + pixelOps.getRloss()) - pixelOps.getRshift()) & 31))
10 , Gshift1(
narrow<int>(((2 + pixelOps.getGloss()) - pixelOps.getGshift()) & 31))
11 , Bshift1(
narrow<int>(((2 + pixelOps.getBloss()) - pixelOps.getBshift()) & 31))
13 , Rshift2(
narrow<int>((2 * (2 + pixelOps.getRloss()) - pixelOps.getRshift() - 10) & 31))
14 , Gshift2(
narrow<int>((2 * (2 + pixelOps.getGloss()) - pixelOps.getGshift() - 10) & 31))
15 , Bshift2(
narrow<int>((2 * (2 + pixelOps.getBloss()) - pixelOps.getBshift() - 10) & 31))
17 , Rshift3((Rshift1 + 0) & 31)
18 , Gshift3((Gshift1 + 10) & 31)
19 , Bshift3((Bshift1 + 20) & 31)
21 , Rmask1(
narrow_cast<uint16_t>(pixelOps.getRmask()))
22 , Gmask1(
narrow_cast<uint16_t>(pixelOps.getGmask()))
23 , Bmask1(
narrow_cast<uint16_t>(pixelOps.getBmask()))
26 ((1 << (2 + pixelOps.getRloss())) - 1) <<
27 (10 + pixelOps.getRshift() - 2 * (2 + pixelOps.getRloss()))))
29 ((1 << (2 + pixelOps.getGloss())) - 1) <<
30 (10 + pixelOps.getGshift() - 2 * (2 + pixelOps.getGloss()))))
32 ((1 << (2 + pixelOps.getBloss())) - 1) <<
33 (10 + pixelOps.getBshift() - 2 * (2 + pixelOps.getBloss()))))
39 if (factor == f)
return;
43 uint32_t r = std::rotl(uint16_t(p & Rmask1), Rshift1) |
44 std::rotl(uint16_t(p & Rmask2), Rshift2);
45 uint32_t
g = std::rotl(uint16_t(p & Gmask1), Gshift1) |
46 std::rotl(uint16_t(p & Gmask2), Gshift2);
47 uint32_t b = std::rotl(uint16_t(p & Bmask1), Bshift1) |
48 std::rotl(uint16_t(p & Bmask2), Bshift2);
49 t = (((r * factor) >> 8) << 0) |
50 (((
g * factor) >> 8) << 10) |
51 (((b * factor) >> 8) << 20);
Helper class to perform 'pixel x scalar' calculations.
constexpr auto enumerate(Iterable &&iterable)
Heavily inspired by Nathan Reed's blog post: Python-Like enumerate() In C++17 http://reedbeta....
This file implemented 3 utility functions:
constexpr To narrow_cast(From &&from) noexcept
constexpr To narrow(From from) noexcept