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

A question about symbol range #3

Open
Cyprus-hy opened this issue Aug 31, 2021 · 3 comments
Open

A question about symbol range #3

Cyprus-hy opened this issue Aug 31, 2021 · 3 comments

Comments

@Cyprus-hy
Copy link

Thanks for your work. But I have a question, that is whether the symbol must in [0, Lp-2]. For example, I have 3 symbols: 100, 200, 300, and I also know their frequency, can I use torchac to compress them? If I must transform [100, 200, 300] to [0, 1, 2] before compressing, then how can I tranform them back to [100, 200, 300] after decompressing? It really makes me confused. Hope for your reply!

@fab-jul
Copy link
Owner

fab-jul commented Sep 6, 2021

So let's say you have have the following distribution

P(100) = p1
P(200) = p2
P(300) = p3

Now, you would transform this to a CDF that is:

[0, p1, p1+p2, p1+p2+p3]

And if you have for example

data = [100, 100, 300, 200]

you would specify the following symbols:

[0, 0, 2, 1]

so the index.

With "Lp-2" we just mean that the biggest symbol here is 2, since we start counting from 0.

@CaiShilv
Copy link

CaiShilv commented Sep 8, 2021

Thanks for your work. I have a question.Can this implementation be used to encode 16bit image data? If you want to encode 16bit image data does it need to be rewritten? It should now only apply to 8bit image data.

@ZhiyeTang
Copy link

Thanks for your work. I have a question.Can this implementation be used to encode 16bit image data? If you want to encode 16bit image data does it need to be rewritten? It should now only apply to 8bit image data.

According to the source code, torchac seems to use int16_t to store non-negative symbols, which means the number of effective bits is 15. I am currently trying to expand torchac to 32-bit symbols but fail to figure out the magic numbers in the C++ code.

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

4 participants