MCPcopy Create free account
hub / github.com/HiLab-git/SimpleCRF / paethPredictor

Function paethPredictor

dependency/densecrf/examples/lodepng.cpp:3829–3838  ·  view source on GitHub ↗

Paeth predicter, used by PNG filter type 4 The parameters are of type short, but should come from unsigned chars, the shorts are only needed to make the paeth calculation correct. */

Source from the content-addressed store, hash-verified

3827 are only needed to make the paeth calculation correct.
3828 */
3829static unsigned char paethPredictor(short a, short b, short c)
3830{
3831 short pa = abs(b - c);
3832 short pb = abs(a - c);
3833 short pc = abs(a + b - c - c);
3834
3835 if(pc < pa && pc < pb) return (unsigned char)c;
3836 else if(pb < pa) return (unsigned char)b;
3837 else return (unsigned char)a;
3838}
3839
3840/*shared values used by multiple Adam7 related functions*/
3841

Callers 2

unfilterScanlineFunction · 0.85
filterScanlineFunction · 0.85

Calls 1

absFunction · 0.50

Tested by

no test coverage detected