[Ffmpeg-devel] FW: H.264 MB_Type decoding implementation in FFMPEG

Guy Bonneau gbonneau
Wed Oct 11 15:39:08 CEST 2006


 

 

  _____  

From: Guy Bonneau [mailto:gbonneau at matrox.com] 
Sent: Wednesday, October 11, 2006 9:31 AM
To: 'Guy Bonneau'
Subject: H.264 MB_Type Decidubg implementation in FFMPEG

 

I am currently studying H.264 and use the H.264 decoding implementation in
FFMPEG to help me understand the specification. I am also using the JM 10.1
test model. The exercise is an academic one. Thus I didn't use the software
yet. While trying to understand how the MacroBlock type is encoded I am
having an hard time trying to understand the CABAC decoding implementation
in FFMPEG in the function decode_cabac_intra_mb_type(...)

 

Here is the problem I see in the decoding function
decode_cabac_intra_mb_type(...)

 

When an Intra Macroblock I16x16  is detected this code follow:

 

    mb_type = 1; /* I16x16 */

    mb_type += 12 * get_cabac( &h->cabac, &state[1] ); /* cbp_luma != 0 */

    if( get_cabac( &h->cabac, &state[2] ) ) /* cbp_chroma */

        mb_type += 4 + 4 * get_cabac( &h->cabac, &state[2+intra_slice] );

    mb_type += 2 * get_cabac( &h->cabac, &state[3+intra_slice] );

    mb_type += 1 * get_cabac( &h->cabac, &state[3+2*intra_slice] );

 

Now according to the ITU-T Rec H.264(03/2005) the second line decodes binIdx
2 and the ctxIdxOffset is 3 since we are decoding an Intra MacroBlock in an
Intra slice. (Table 9-30). According to table 9-30 we are supposing to use
ctxIdxInc 3 and the following line should use ctxIdxInc 4. Thus I would
expect the code to be :

 

    mb_type += 12 * get_cabac( &h->cabac, &state[3] ); /* cbp_luma != 0 */

    if( get_cabac( &h->cabac, &state[4] ) ) /* cbp_chroma */

    (...)

 

I missed something ?

 

Thanks

GB

 

 

 

 

 





More information about the ffmpeg-devel mailing list