MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / stbi__paeth

Function stbi__paeth

Source/Utils/stb_image.h:4656–4667  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4654};
4655
4656static int stbi__paeth(int a, int b, int c)
4657{
4658 // This formulation looks very different from the reference in the PNG spec, but is
4659 // actually equivalent and has favorable data dependencies and admits straightforward
4660 // generation of branch-free code, which helps performance significantly.
4661 int thresh = c*3 - (a + b);
4662 int lo = a < b ? a : b;
4663 int hi = a < b ? b : a;
4664 int t0 = (hi <= thresh) ? lo : c;
4665 int t1 = (thresh <= lo) ? hi : t0;
4666 return t1;
4667}
4668
4669static const stbi_uc stbi__depth_scale_table[9] = { 0, 0xff, 0x55, 0, 0x11, 0,0,0, 0x01 };
4670

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected