[theora-dev] FPGA encode stages flow diagram

Timothy B. Terriberry tterribe at xiph.org
Thu Mar 24 12:21:01 PDT 2011


> is advanced by the number of coe cients that are added to the block as each
> token is decoded. After fully decoding all the tokens with token index
> ti , the
> current token index of every coded block will be ti or greater...."

You need to read Section 7.7 of the spec thoroughly. I don't think you 
understand what a "token" represents yet.

> ok.
> for example, my encoder produce only two blocks:
> 1) in first block (after DCT) i have
> AC0=1;

I assume you mean DC, not AC0.

> AC(1..62)=0;
> AC63=1;
> so, after zig-zag + RLE  have tokens for
> AC0=(0,1);
> AC63=(62,1)

What you _actually_ have is (token,extra bits) pairs like so
DC=(9, no extra bits) (i.e., value token, value==1)
AC1=(8,111110) (i.e., zero run token, run-length==62)
AC63=(9, no extra bits) (i.e., value token, value==1)

> 1) in first block (after DCT) i have

I assume you meant in the second block.

> AC0=1;
> AC1=1;
> AC(2..62)=0;
> AC63=1;
> so, after zig-zag + RLE  have tokens for
> AC0=(0,1);
> AC1=(0,1);
> AC63=(61,1)

Again, the _actual_ tokens you would use are:
DC=(9, no extra bits) (i.e., value token, value==1)
AC1=(9, no extra bits) (i.e., value token, value==1)
AC2=(8,111101) (i.e., zero run token, run-length==61)
AC63=(9, no extra bits) (i.e., value token, value==1)

> what about tokens for index 1-61?

The first block only has tokens for indexes 0, 1, and 63, which generate 
1 coefficient value, 62 coefficient values, and 1 coefficient value, 
respectively (for a total of 64).

The second block has tokens for indexes 0, 1, 2, and 63, which generate 
1, 1, 61, and 1 coefficient, respectively, again for a total of 64.

As an aside, actually having 64 coefficients in a block is unusual. It 
happens, but it is much more common to end with a long zero run. It is 
important not to actually code these as zero runs, but using an "End Of 
Block" (EOB) token (token values 0...6). EOBs are much, much cheaper 
than using an explicit zero run to end the block, in terms of bits.


More information about the theora-dev mailing list