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. */
| 3881 | are only needed to make the paeth calculation correct. |
| 3882 | */ |
| 3883 | static unsigned char paethPredictor(short a, short b, short c) |
| 3884 | { |
| 3885 | short pa = abs(b - c); |
| 3886 | short pb = abs(a - c); |
| 3887 | short pc = abs(a + b - c - c); |
| 3888 | |
| 3889 | if(pc < pa && pc < pb) return (unsigned char)c; |
| 3890 | else if(pb < pa) return (unsigned char)b; |
| 3891 | else return (unsigned char)a; |
| 3892 | } |
| 3893 | |
| 3894 | /*shared values used by multiple Adam7 related functions*/ |
| 3895 |
no outgoing calls
no test coverage detected