MCPcopy Create free account
hub / github.com/ValveSoftware/openvr / getValueRequiredBits

Function getValueRequiredBits

samples/shared/lodepng.cpp:3497–3503  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

3495
3496/*Returns how many bits needed to represent given value (max 8 bit)*/
3497unsigned getValueRequiredBits(unsigned char value)
3498{
3499 if(value == 0 || value == 255) return 1;
3500 /*The scaling of 2-bit and 4-bit values uses multiples of 85 and 17*/
3501 if(value % 17 == 0) return value % 85 == 0 ? 2 : 4;
3502 return 8;
3503}
3504
3505/*profile must already have been inited with mode.
3506It's ok to set some parameters of profile to done already.*/

Callers 1

get_color_profileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected