vinnik-dmitry07/python-flac-codec

How to handle fractional values in Rice Encoding?

Sahil-5111998 opened this issue · 3 comments

Hi,

I am trying to implement Rice encoding for my project. The data for which I am trying to implement is having fractional values.
Looking into your code you have made positive mapping. Do you have an idea how fractional mapping can be established for rice encoding?

Hi,

If you know your floating numbers range, you can map them to 0..MAX_INT with rounding by simple renormalization: round(MAX_INT * (x - min) / (max - min)). From my understanding, it is the easiest way to quantize numbers, preserving their continuity (if you have audio data), which is important for the codding.

Hi,
Sorry to bug you again, here the INT_MAX refers to maximum uint64 values and the min and max are the minimum and maximum numbers in the floating number array?