Returns how many bits needed to represent given value (max 8 bit)*/
| 3495 | |
| 3496 | /*Returns how many bits needed to represent given value (max 8 bit)*/ |
| 3497 | unsigned 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. |
| 3506 | It's ok to set some parameters of profile to done already.*/ |