[Ffmpeg-devel] FW: H.264 MB_Type decoding implementation in FFMPEG
Loren Merritt
lorenm
Wed Oct 11 19:53:51 CEST 2006
On Wed, 11 Oct 2006, Guy Bonneau wrote:
> 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 ?
uint8_t *state= &h->cabac_state[ctx_base]; // state = context #3
state += 2; // state = context #5
mb_type += 12 * get_cabac( &h->cabac, &state[1] ); // decodes context #6
While the standard says it should use ctxIdxOffset=3 and ctxIdxInc=3, for
a total of context #6.
--Loren Merritt
More information about the ffmpeg-devel
mailing list