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. */
| 3735 | are only needed to make the paeth calculation correct. |
| 3736 | */ |
| 3737 | static unsigned char paethPredictor(short a, short b, short c) |
| 3738 | { |
| 3739 | short pa = abs(b - c); |
| 3740 | short pb = abs(a - c); |
| 3741 | short pc = abs(a + b - c - c); |
| 3742 | |
| 3743 | if(pc < pa && pc < pb) return (unsigned char)c; |
| 3744 | else if(pb < pa) return (unsigned char)b; |
| 3745 | else return (unsigned char)a; |
| 3746 | } |
| 3747 | |
| 3748 | /*shared values used by multiple Adam7 related functions*/ |
| 3749 |
no outgoing calls
no test coverage detected