[x264-devel] crash in latest version

Guillaume POIRIER poirierg at gmail.com
Fri Oct 24 15:52:43 CEST 2008


Hello,

2008/10/24 David Sullivan <dad.sullivan at gmail.com>:
> Hi,
> I tried the two patches posted by Gabriel and now x264 r999 works fine but
> in slow_mod for my Intel Core 2 Extreme X9770 supporting the following
> instructions: MMX SSE SSE2 SSE3 SSSE3 SSE4.1 EM64T .
> So subme crash came from that.
>
> The problem was something I can't explain:
> i had to add brackets to the ifs of the patch hadamar_slowmod4.patch
>
> +        if (!(cpu&X264_CPU_STACK_MOD4))
> +        {
> +            INIT4( hadamard_ac, _ssse3 );
> +        }
>
> and this
>
> +        if (!(cpu&X264_CPU_STACK_MOD4))
> +        {
> +            INIT4( hadamard_ac, _sse2 );
> +        }
>
> Don't ask me why... I know it sound crazy.
> David

It is not crazy, that's because of the way INIT* macros are defined:

#define INIT2_NAME( name1, name2, cpu ) \
    pixf->name1[PIXEL_16x16] = x264_pixel_##name2##_16x16##cpu;\
    pixf->name1[PIXEL_16x8]  = x264_pixel_##name2##_16x8##cpu;
#define INIT4_NAME( name1, name2, cpu ) \
    INIT2_NAME( name1, name2, cpu ) \
    pixf->name1[PIXEL_8x16]  = x264_pixel_##name2##_8x16##cpu;\
    pixf->name1[PIXEL_8x8]   = x264_pixel_##name2##_8x8##cpu;
#define INIT5_NAME( name1, name2, cpu ) \
    INIT4_NAME( name1, name2, cpu ) \
    pixf->name1[PIXEL_8x4]   = x264_pixel_##name2##_8x4##cpu;
#define INIT7_NAME( name1, name2, cpu ) \
    INIT5_NAME( name1, name2, cpu ) \
    pixf->name1[PIXEL_4x8]   = x264_pixel_##name2##_4x8##cpu;\
    pixf->name1[PIXEL_4x4]   = x264_pixel_##name2##_4x4##cpu;
#define INIT2( name, cpu ) INIT2_NAME( name, name, cpu )
#define INIT4( name, cpu ) INIT4_NAME( name, name, cpu )
#define INIT5( name, cpu ) INIT5_NAME( name, name, cpu )
#define INIT7( name, cpu ) INIT7_NAME( name, name, cpu )


This is quite unsafe. There should be at least a block around them, or
better, a do ... while(0) block.

I shall fix this tonite.

Guillaume
-- 
One should not give up hope on imbeciles. With a little training, you
can make them into soldiers.
 -- Pierre Desproges


More information about the x264-devel mailing list