Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to handle fractional values in Rice Encoding? #1

Open
Sahil-5111998 opened this issue Mar 10, 2023 · 3 comments
Open

How to handle fractional values in Rice Encoding? #1

Sahil-5111998 opened this issue Mar 10, 2023 · 3 comments

Comments

@Sahil-5111998
Copy link

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?

@vinnik-dmitry07
Copy link
Owner

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.

@Sahil-5111998
Copy link
Author

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?

@vinnik-dmitry07
Copy link
Owner

vinnik-dmitry07 commented Mar 13, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants