Log in

View Full Version : H264 Decoder: CABAC implimentaion


vizzimani
5th March 2008, 08:33
I am able to understand standard completely. but i am not cleared about fundamentals of binary arithmetic coding which used in H264 video codec.
some of my doublts...

1. How they designed Range LPS Table.
2. The updation of context models in CABAC engine. and updation tables.
is any one clear my blanks.

thanks in advance.

akupenguin
5th March 2008, 08:57
See ffmpeg's rangecoder for something approximately equivalent, but with simple formulas instead of tables.

range_lps is an approximation of a multiply (fixed point, taking all 7 bits from state and 2 most significant bits from range). This is supposedly an optimization, but actually on modern CPUs it's slower than a plain multiply.

Context adaption is a finite state machine. There's a probability assigned to each state (In ffmpeg's rangecoder, the probability is just state number / 256. In cabac it's something similar but not exactly state number / 128.) The data being coded in one context is a stream of bits, with a certain unknown distribution of 1s and 0s. The state transitions as set such that any stationary distribution of bits will tend to converge to the state whose nominal probability matches the distribution.
For example, consider state #55 whose probability is 1/3. If it sees a 1, it transitions to state #57, and if it sees a 0 it transitions to state #54. From #57 it takes 2 0s to transition back to #55. Thus, you'd have to have a distribution of 1/3 1s and 2/3 0s in order to stay near state #55.

vizzimani
15th March 2008, 08:39
thanks for nice explanation. is Any document is available to understand like this manner. Why i am asking is, In standard like this explanation is not there.