Returns how many bits needed to represent given value (max 8 bit)*/
| 3541 | |
| 3542 | /*Returns how many bits needed to represent given value (max 8 bit)*/ |
| 3543 | unsigned getValueRequiredBits(unsigned short value) |
| 3544 | { |
| 3545 | if(value == 0 || value == 255) return 1; |
| 3546 | /*The scaling of 2-bit and 4-bit values uses multiples of 85 and 17*/ |
| 3547 | if(value % 17 == 0) return value % 85 == 0 ? 2 : 4; |
| 3548 | return 8; |
| 3549 | } |
| 3550 | |
| 3551 | /*profile must already have been inited with mode. |
| 3552 | It's ok to set some parameters of profile to done already.*/ |