@ -192,10 +192,8 @@ static void mp_set_rgb_from_yuv(MotionPixelsContext *mp, int x, int y, const Yuv
static av_always_inline int mp_get_vlc ( MotionPixelsContext * mp , GetBitContext * gb )
static av_always_inline int mp_get_vlc ( MotionPixelsContext * mp , GetBitContext * gb )
{
{
int i ;
return mp - > vlc . table ? get_vlc2 ( gb , mp - > vlc . table , mp - > max_codes_bits , 1 )
: mp - > codes [ 0 ] . delta ;
i = ( mp - > codes_count = = 1 ) ? 0 : get_vlc2 ( gb , mp - > vlc . table , mp - > max_codes_bits , 1 ) ;
return mp - > codes [ i ] . delta ;
}
}
static void mp_decode_line ( MotionPixelsContext * mp , GetBitContext * gb , int y )
static void mp_decode_line ( MotionPixelsContext * mp , GetBitContext * gb , int y )
@ -322,9 +320,14 @@ static int mp_decode_frame(AVCodecContext *avctx,
if ( sz = = 0 )
if ( sz = = 0 )
goto end ;
goto end ;
if ( mp - > codes_count > 1 )
if ( mp - > codes_count > 1 ) {
if ( init_vlc ( & mp - > vlc , mp - > max_codes_bits , mp - > codes_count , & mp - > codes [ 0 ] . size , sizeof ( HuffCode ) , 1 , & mp - > codes [ 0 ] . code , sizeof ( HuffCode ) , 4 , 0 ) )
ret = ff_init_vlc_sparse ( & mp - > vlc , mp - > max_codes_bits , mp - > codes_count ,
goto end ;
& mp - > codes [ 0 ] . size , sizeof ( HuffCode ) , 1 ,
& mp - > codes [ 0 ] . code , sizeof ( HuffCode ) , 4 ,
& mp - > codes [ 0 ] . delta , sizeof ( HuffCode ) , 1 , 0 ) ;
if ( ret < 0 )
goto end ;
}
mp_decode_frame_helper ( mp , & gb ) ;
mp_decode_frame_helper ( mp , & gb ) ;
ff_free_vlc ( & mp - > vlc ) ;
ff_free_vlc ( & mp - > vlc ) ;