libavcodec/motion_est_template.c:631: error: Uninitialized Value
  The value read from xmax was never initialized.

libavcodec/motion_est_template.c:631:13: 
629.             CHECK_MV(x + dir           , y + dia_size - dir);
630.             CHECK_MV(x + dia_size - dir, y - dir           );
631.             CHECK_MV(x - dir           , y - dia_size + dir);
                 ^
632.             CHECK_MV(x - dia_size + dir, y + dir           );
633.         }

static int funny_diamond_search(MpegEncContext * s, int *best, int dmin,
                                       int src_index, int ref_index, int const penalty_factor,
                                       int size, int h, int flags)
{
    MotionEstContext * const c= &s->me;
    me_cmp_func cmpf, chroma_cmpf;
    int dia_size;
    LOAD_COMMON
    LOAD_COMMON2
    int map_generation= c->map_generation;
    cmpf= s->dsp.me_cmp[size];
    chroma_cmpf= s->dsp.me_cmp[size+1];
    for(dia_size=1; dia_size<=4; dia_size++){
        int dir;
        const int x= best[0];
        const int y= best[1];
        if(dia_size&(dia_size-1)) continue;
        if(   x + dia_size > xmax
           || x - dia_size < xmin
           || y + dia_size > ymax
           || y - dia_size < ymin)
           continue;
        for(dir= 0; dir<dia_size; dir+=2){
            int d;
            CHECK_MV(x + dir           , y + dia_size - dir);
            CHECK_MV(x + dia_size - dir, y - dir           );
            CHECK_MV(x - dir           , y - dia_size + dir);
            CHECK_MV(x - dia_size + dir, y + dir           );
        }
        if(x!=best[0] || y!=best[1])
            dia_size=0;
#if 0
{
int dx, dy, i;
static int stats[8*8];
dx= FFABS(x-best[0]);
dy= FFABS(y-best[1]);
if(dy>dx){
    dx^=dy; dy^=dx; dx^=dy;
}
stats[dy*8 + dx] ++;
if(256*256*256*64 % (stats[0]+1)==0){
    for(i=0; i<64; i++){
        if((i&7)==0) printf("\n");
        printf("%8d ", stats[i]);
    }
    printf("\n");
}
}
#endif
    }
    return dmin;
}
['static int funny_diamond_search(MpegEncContext * s, int *best, int dmin,\n                                       int src_index, int ref_index, int const penalty_factor,\n                                       int size, int h, int flags)\n{\n    MotionEstContext * const c= &s->me;\n    me_cmp_func cmpf, chroma_cmpf;\n    int dia_size;\n    LOAD_COMMON\n    LOAD_COMMON2\n    int map_generation= c->map_generation;\n    cmpf= s->dsp.me_cmp[size];\n    chroma_cmpf= s->dsp.me_cmp[size+1];\n    for(dia_size=1; dia_size<=4; dia_size++){\n        int dir;\n        const int x= best[0];\n        const int y= best[1];\n        if(dia_size&(dia_size-1)) continue;\n        if(   x + dia_size > xmax\n           || x - dia_size < xmin\n           || y + dia_size > ymax\n           || y - dia_size < ymin)\n           continue;\n        for(dir= 0; dir<dia_size; dir+=2){\n            int d;\n            CHECK_MV(x + dir           , y + dia_size - dir);\n            CHECK_MV(x + dia_size - dir, y - dir           );\n            CHECK_MV(x - dir           , y - dia_size + dir);\n            CHECK_MV(x - dia_size + dir, y + dir           );\n        }\n        if(x!=best[0] || y!=best[1])\n            dia_size=0;\n#if 0\n{\nint dx, dy, i;\nstatic int stats[8*8];\ndx= FFABS(x-best[0]);\ndy= FFABS(y-best[1]);\nif(dy>dx){\n    dx^=dy; dy^=dx; dx^=dy;\n}\nstats[dy*8 + dx] ++;\nif(256*256*256*64 % (stats[0]+1)==0){\n    for(i=0; i<64; i++){\n        if((i&7)==0) printf("\\n");\n        printf("%8d ", stats[i]);\n    }\n    printf("\\n");\n}\n}\n#endif\n    }\n    return dmin;\n}']