MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / rgbaToAI88

Function rgbaToAI88

engine/Poseidon/Graphics/Textures/Image.cpp:87–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85}
86
87static void rgbaToAI88(const uint8_t* src, uint8_t* dst, int w, int h)
88{
89 auto* out = reinterpret_cast<uint16_t*>(dst);
90 for (int i = 0; i < w * h; ++i)
91 {
92 // ITU-R BT.601 luma
93 uint8_t intensity =
94 static_cast<uint8_t>((src[i * 4 + 0] * 77 + src[i * 4 + 1] * 150 + src[i * 4 + 2] * 29) >> 8);
95 uint8_t alpha = src[i * 4 + 3];
96 out[i] = (alpha << 8) | intensity;
97 }
98}
99
100static void rgbaToARGB8888(const uint8_t* src, uint8_t* dst, int w, int h)
101{

Callers 1

ConvertPixelsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected