Paeth predictor, 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. */
| 3972 | are only needed to make the paeth calculation correct. |
| 3973 | */ |
| 3974 | static unsigned char paethPredictor(short a, short b, short c) { |
| 3975 | short pa = LODEPNG_ABS(b - c); |
| 3976 | short pb = LODEPNG_ABS(a - c); |
| 3977 | short pc = LODEPNG_ABS(a + b - c - c); |
| 3978 | /* return input value associated with smallest of pa, pb, pc (with certain priority if equal) */ |
| 3979 | if(pb < pa) { a = b; pa = pb; } |
| 3980 | return (pc < pa) ? c : a; |
| 3981 | } |
| 3982 | |
| 3983 | /*shared values used by multiple Adam7 related functions*/ |
| 3984 |
no outgoing calls
no test coverage detected