MCPcopy Create free account
hub / github.com/HiLab-git/SimpleCRF / getValueRequiredBits

Function getValueRequiredBits

dependency/densecrf/examples/lodepng.cpp:3557–3563  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

3555
3556/*Returns how many bits needed to represent given value (max 8 bit)*/
3557static unsigned getValueRequiredBits(unsigned char value)
3558{
3559 if(value == 0 || value == 255) return 1;
3560 /*The scaling of 2-bit and 4-bit values uses multiples of 85 and 17*/
3561 if(value % 17 == 0) return value % 85 == 0 ? 2 : 4;
3562 return 8;
3563}
3564
3565/*profile must already have been inited with mode.
3566 It's ok to set some parameters of profile to done already.*/

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected