[Ffmpeg-devel] Re: Fw: Dear Niedermayer, I need your help about h.264 again

Michael Niedermayer michaelni
Fri Apr 21 11:46:13 CEST 2006


On Fri, Apr 21, 2006 at 04:34:02PM +0800, He Hua wrote:
> Hello, Michael Niedermayer,
> Would you please tell me the meaning of data structure of scan8[16 + 2*4].
> Why it has the data array as:
>  4+1*8, 5+1*8, 4+2*8, 5+2*8,
>  6+1*8, 7+1*8, 6+2*8, 7+2*8,
>  4+3*8, 5+3*8, 4+4*8, 5+4*8,
>  6+3*8, 7+3*8, 6+4*8, 7+4*8,
>  1+1*8, 2+1*8,
>  1+2*8, 2+2*8,
>  1+4*8, 2+4*8,
>  1+5*8, 2+5*8,
> I really don't know how the data is organized in this structure.
> I can be aware that this data is very important and has many connections
> with intra4x4_pred_mode_cache, non_zero_count_cache etc. 
> It's a key, if I don't know, I can't go on.

h.264 works with 16x16 macro blocks (16x16 luma and 2 8x8 chroma samples),
these are further split into 16 luma 4x4 blocks and 8 chroma 4x4 blocks
now iam sure it will not surprisse you that its neccessary to store various
flags, and values per 4x4 block, its also often needed to quickly access these
from the block to the left or above
so storing them in an organized way makes sense ...
we use for that purpose a 8x5 array, scan8[i] is the position in that array
where the ith block is stored, the first 16 are luma and the following 2x4 are
for the chroma planes they are stored so that scan8[i]-1 is the left block and
scan8[i]-8 is the block above

the following might help in understanding how the 2 2x2 chorma and the 4x4 
luma blocks are stored

0 . T T . T T T T
1 L u u L y y y y
2 L u u L y y y y
3 . T T L y y y y
4 L v v L y y y y
5 L v v . . . . .

PS: iam posting this to ffmpeg-dev as thats where it belongs to ...



In the past you could go to a library and read, borrow or copy any book
Today you'd get arrested for mere telling someone where the library is

More information about the ffmpeg-devel mailing list