MCPcopy Create free account
hub / github.com/ProjectPhysX/FluidX3D / getValueRequiredBits

Function getValueRequiredBits

src/lodepng.cpp:3659–3664  ·  view source on GitHub ↗

Returns how many bits needed to represent given value (max 8 bit)*/

Source from the content-addressed store, hash-verified

3657
3658/*Returns how many bits needed to represent given value (max 8 bit)*/
3659static 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. */
3667unsigned lodepng_compute_color_stats(LodePNGColorStats* stats,

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected