[FFmpeg-devel] [PATCH] Add FATE test for rare overflow-prone case

Jason Garrett-Glaser jason
Sun Jan 23 20:30:41 CET 2011


On Sun, Jan 23, 2011 at 10:05 AM, Vitor Sessak <vitor1001 at gmail.com> wrote:
> $subj, see issue 2547.
>
> -Vitor
>
> PS: no need to wait boxes to rsync, this sample was uploaded several days
> ago.

It might be better to synthesize a clip using code similar to that
which I wrote for extremal plane tests in x264:

#define EXTREMAL_PLANE(size) \
    { \
        int max[7]; \
        for( int j = 0; j < 7; j++ ) \
            max[j] = test ? rand()&PIXEL_MAX : PIXEL_MAX; \
        fdec[48-1-FDEC_STRIDE] = (i&1)*max[0]; \
        for( int j = 0; j < size/2; j++ ) \
            fdec[48+j-FDEC_STRIDE] = (!!(i&2))*max[1]; \
        for( int j = size/2; j < size-1; j++ ) \
            fdec[48+j-FDEC_STRIDE] = (!!(i&4))*max[2]; \
        fdec[48+(size-1)-FDEC_STRIDE] = (!!(i&8))*max[3]; \
        for( int j = 0; j < size/2; j++ ) \
            fdec[48+j*FDEC_STRIDE-1] = (!!(i&16))*max[4]; \
        for( int j = size/2; j < size-1; j++ ) \
            fdec[48+j*FDEC_STRIDE-1] = (!!(i&32))*max[5]; \
        fdec[48+(size-1)*FDEC_STRIDE-1] = (!!(i&64))*max[6]; \
    }
    /* Extremal test case for planar prediction. */
    for( int test = 0; test < 100 && ok; test++ )
        for( int i = 0; i < 128 && ok; i++ )
        {
            EXTREMAL_PLANE(  8 );
            INTRA_TEST(  predict_8x8c, I_PRED_CHROMA_P,  8, 1 );
            EXTREMAL_PLANE( 16 );
            INTRA_TEST( predict_16x16,  I_PRED_16x16_P, 16, 1 );
        }

Having spent hours on fixing bugs related to this, I can say for
certain that without a test this harsh, you will never, ever find all
possible instances of bugs in planar prediction.

Jason



More information about the ffmpeg-devel mailing list