Returns how many bits needed to represent given value (max 8 bit)*/
| 3657 | |
| 3658 | /*Returns how many bits needed to represent given value (max 8 bit)*/ |
| 3659 | static unsigned getValueRequiredBits(unsigned char value) { |
| 3660 | if(value == 0 || value == 255) return 1; |
| 3661 | /*The scaling of 2-bit and 4-bit values uses multiples of 85 and 17*/ |
| 3662 | if(value % 17 == 0) return value % 85 == 0 ? 2 : 4; |
| 3663 | return 8; |
| 3664 | } |
| 3665 | |
| 3666 | /*stats must already have been inited. */ |
| 3667 | unsigned lodepng_compute_color_stats(LodePNGColorStats* stats, |
no outgoing calls
no test coverage detected