-
Notifications
You must be signed in to change notification settings - Fork 10
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
Golomb-Rice (from flac-dev) #55
Comments
I must confess I don't know enough about the encoding specifics confirm this myself. Is anyone who is more familiar with the guts of the spec able to chime in on this? |
ping @bumblebritches57 |
I can review the information about the used codings, but only after Bangkok and after Bologna. |
There's a whole family of Rice codes, there's regular Rice (aka Unary), modified regular Rice (Truncated Rice), Exponential-Golomb. (that I'm familiar with anyway, there's probably a bunch more) So, it's called Exponential-Golomb in AVC/H.264 documentation, I thought this was the universal term, but I guess not? Anyway, regular Rice (Unary) coding works by writing X number of bits (0 or 1, I don't remember which is more common, not that it really matters), then writing a stop bit (the opposite, if the regular bits are 0, this is 1, or vice versa). Truncated Rice aka Truncated Unary coding, works by doing the same, Exponential-Rice coding uses regular Rice (aka Unary, and not the truncated variant) to write how many bits there are in the number. So if you want to write the number 7, it'll write 3 binary digits as length codes (because the number 7 takes up 3 bits), then it'll write a "stop bit" (except here it's used to separate the sections of the code), then the regular binary digits of the number, in this case, 111. For a total code of 0001111. (in this case, they (being Rice vs Exp-Golomb) take up the same number of bits, but for a larger number, say 12 bits, it's a fuck ton more efficient than writing 4096 + 1 + 12 bits) As for what "Golomb-Rice coding" is, It sounds incredibly generic so I'm worried I'll stumble upon the wrong variant, but I'll look into it. Is this the variant they're talking about, or is it just ddg getting confused because the name is too vague? |
Thank you very much, @bumblebritches57! I don’t longer need to re-delve into my 1990s teachings! |
Does anyone have a link to the thread? not sure if I'm subbed to the flac mailing list anymore. Either way "Golomb-Rice" is just too generic to be of use, it's just the names of the inventors, David A. Rice, and Solomon W. Golomb. That's like saying "What OS do you use?" "I use the "Jobs-Gates" OS!" Edit: I emailed him from the thread on the mailing list with a link to this thread. |
Federico’s post is at: http://lists.xiph.org/pipermail/flac-dev/2017-June/006286.html |
I'm not familiar with these encodings, but when writing a decoder, I found the specification has the following gaps:
|
I see that quite some time ago, the name of the residual coding methods was changed from rice to exponential Golomb. I looked into what exponential Golomb is, and it is not what FLAC is using. Also the explanation currently in the spec is not what FLAC is using. FLAC uses a coding method in which the residual is first split up into partitions. Each of these partitions get a parameter from 0 to 14 for the first coding method or 0 to 30 for the second method. Each (signed) residual sample is then 'folded' into an unsigned representation: if the residual sample is positive, it is doubled, if the sample is negative, it is doubled and has 1 subtracted from it. This folded residual is then divided by So, if a partition has a parameter of 3, the residuals are coded as follows
Wikipedia calls this simply Rice coding or Rice-Golomb coding, as does libFLAC. It is pretty much the 'simple algorithm' described on the Wikipedia page on Golomb coding. Also, see this bit of code. As can be seen, the total number of bits is 0 + parameter + residual << parameter. In other words, the remainder is stored directly (in parameter bits), while the quotient (residual << parameter) is stored unary. If this name is not appropriate, perhaps one should come up with a better name, but as I understand it, this is not Exponential Golomb coding. |
Thanks. So I think it is safer to go back to the old naming. |
Yes, I will expand that part. Still, if 'rice code' is too general, I haven't been able to come up with a better name yet. |
Hi, when implemented https://github.com/wader/flac.tcl i was confused by the unsigned "folding" for a while. I think it is essentially https://en.wikipedia.org/wiki/Variable-length_quantity#Zigzag_encoding or? |
👍 Sure no problem |
Posted on 2017-06-06 in [flac-dev]:
The text was updated successfully, but these errors were encountered: