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

libavcodec/motion_est_template.c:485:9: 
483.         CHECK_QUARTER_MV(1, 0, mx-1, my  )
484. #endif
485.         assert(bx >= xmin*4 && bx <= xmax*4 && by >= ymin*4 && by <= ymax*4);
             ^
486. 
487.         *mx_ptr = bx;

static int qpel_motion_search(MpegEncContext * s,
                                  int *mx_ptr, int *my_ptr, int dmin,
                                  int src_index, int ref_index,
                                  int size, int h)
{
    MotionEstContext * const c= &s->me;
    const int mx = *mx_ptr;
    const int my = *my_ptr;
    const int penalty_factor= c->sub_penalty_factor;
    const int map_generation= c->map_generation;
    const int subpel_quality= c->avctx->me_subpel_quality;
    uint32_t *map= c->map;
    me_cmp_func cmpf, chroma_cmpf;
    me_cmp_func cmp_sub, chroma_cmp_sub;
    LOAD_COMMON
    int flags= c->sub_flags;
    cmpf= s->dsp.me_cmp[size];
    chroma_cmpf= s->dsp.me_cmp[size+1];
    cmp_sub= s->dsp.me_sub_cmp[size];
    chroma_cmp_sub= s->dsp.me_sub_cmp[size+1];
    if(c->skip){
        *mx_ptr = 0;
        *my_ptr = 0;
        return dmin;
    }
    if(c->avctx->me_cmp != c->avctx->me_sub_cmp){
        dmin= cmp(s, mx, my, 0, 0, size, h, ref_index, src_index, cmp_sub, chroma_cmp_sub, flags);
        if(mx || my || size>0)
            dmin += (mv_penalty[4*mx - pred_x] + mv_penalty[4*my - pred_y])*penalty_factor;
    }
    if (mx > xmin && mx < xmax &&
        my > ymin && my < ymax) {
        int bx=4*mx, by=4*my;
        int d= dmin;
        int i, nx, ny;
        const int index= (my<<ME_MAP_SHIFT) + mx;
        const int t= score_map[(index-(1<<ME_MAP_SHIFT)  )&(ME_MAP_SIZE-1)];
        const int l= score_map[(index- 1                 )&(ME_MAP_SIZE-1)];
        const int r= score_map[(index+ 1                 )&(ME_MAP_SIZE-1)];
        const int b= score_map[(index+(1<<ME_MAP_SHIFT)  )&(ME_MAP_SIZE-1)];
        const int c= score_map[(index                    )&(ME_MAP_SIZE-1)];
        int best[8];
        int best_pos[8][2];
        memset(best, 64, sizeof(int)*8);
#if 1
        if(s->me.dia_size>=2){
            const int tl= score_map[(index-(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)];
            const int bl= score_map[(index+(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)];
            const int tr= score_map[(index-(1<<ME_MAP_SHIFT)+1)&(ME_MAP_SIZE-1)];
            const int br= score_map[(index+(1<<ME_MAP_SHIFT)+1)&(ME_MAP_SIZE-1)];
            for(ny= -3; ny <= 3; ny++){
                for(nx= -3; nx <= 3; nx++){
                    const int64_t t2= nx*nx*(tr + tl - 2*t) + 4*nx*(tr-tl) + 32*t;
                    const int64_t c2= nx*nx*( r +  l - 2*c) + 4*nx*( r- l) + 32*c;
                    const int64_t b2= nx*nx*(br + bl - 2*b) + 4*nx*(br-bl) + 32*b;
                    int score= (ny*ny*(b2 + t2 - 2*c2) + 4*ny*(b2 - t2) + 32*c2 + 512)>>10;
                    int i;
                    if((nx&3)==0 && (ny&3)==0) continue;
                    score += (mv_penalty[4*mx + nx - pred_x] + mv_penalty[4*my + ny - pred_y])*penalty_factor;
                    for(i=0; i<8; i++){
                        if(score < best[i]){
                            memmove(&best[i+1], &best[i], sizeof(int)*(7-i));
                            memmove(&best_pos[i+1][0], &best_pos[i][0], sizeof(int)*2*(7-i));
                            best[i]= score;
                            best_pos[i][0]= nx + 4*mx;
                            best_pos[i][1]= ny + 4*my;
                            break;
                        }
                    }
                }
            }
        }else{
            int tl;
            const int cx = 4*(r - l);
            const int cx2= r + l - 2*c;
            const int cy = 4*(b - t);
            const int cy2= b + t - 2*c;
            int cxy;
            if(map[(index-(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)] == (my<<ME_MAP_MV_BITS) + mx + map_generation && 0){
                tl= score_map[(index-(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)];
            }else{
                tl= cmp(s, mx-1, my-1, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags);
            }
            cxy= 2*tl + (cx + cy)/4 - (cx2 + cy2) - 2*c;
            assert(16*cx2 + 4*cx + 32*c == 32*r);
            assert(16*cx2 - 4*cx + 32*c == 32*l);
            assert(16*cy2 + 4*cy + 32*c == 32*b);
            assert(16*cy2 - 4*cy + 32*c == 32*t);
            assert(16*cxy + 16*cy2 + 16*cx2 - 4*cy - 4*cx + 32*c == 32*tl);
            for(ny= -3; ny <= 3; ny++){
                for(nx= -3; nx <= 3; nx++){
                    int score= ny*nx*cxy + nx*nx*cx2 + ny*ny*cy2 + nx*cx + ny*cy + 32*c;
                    int i;
                    if((nx&3)==0 && (ny&3)==0) continue;
                    score += 32*(mv_penalty[4*mx + nx - pred_x] + mv_penalty[4*my + ny - pred_y])*penalty_factor;
                    for(i=0; i<8; i++){
                        if(score < best[i]){
                            memmove(&best[i+1], &best[i], sizeof(int)*(7-i));
                            memmove(&best_pos[i+1][0], &best_pos[i][0], sizeof(int)*2*(7-i));
                            best[i]= score;
                            best_pos[i][0]= nx + 4*mx;
                            best_pos[i][1]= ny + 4*my;
                            break;
                        }
                    }
                }
            }
        }
        for(i=0; i<subpel_quality; i++){
            nx= best_pos[i][0];
            ny= best_pos[i][1];
            CHECK_QUARTER_MV(nx&3, ny&3, nx>>2, ny>>2)
        }
#if 0
            const int tl= score_map[(index-(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)];
            const int bl= score_map[(index+(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)];
            const int tr= score_map[(index-(1<<ME_MAP_SHIFT)+1)&(ME_MAP_SIZE-1)];
            const int br= score_map[(index+(1<<ME_MAP_SHIFT)+1)&(ME_MAP_SIZE-1)];
            if(tl<br){
            static int stats[7][7], count;
            count++;
            stats[4*mx - bx + 3][4*my - by + 3]++;
            if(256*256*256*64 % count ==0){
                for(i=0; i<49; i++){
                    if((i%7)==0) printf("\n");
                    printf("%6d ", stats[0][i]);
                }
                printf("\n");
            }
            }
#endif
#else
        CHECK_QUARTER_MV(2, 2, mx-1, my-1)
        CHECK_QUARTER_MV(0, 2, mx  , my-1)
        CHECK_QUARTER_MV(2, 2, mx  , my-1)
        CHECK_QUARTER_MV(2, 0, mx  , my  )
        CHECK_QUARTER_MV(2, 2, mx  , my  )
        CHECK_QUARTER_MV(0, 2, mx  , my  )
        CHECK_QUARTER_MV(2, 2, mx-1, my  )
        CHECK_QUARTER_MV(2, 0, mx-1, my  )
        nx= bx;
        ny= by;
        for(i=0; i<8; i++){
            int ox[8]= {0, 1, 1, 1, 0,-1,-1,-1};
            int oy[8]= {1, 1, 0,-1,-1,-1, 0, 1};
            CHECK_QUARTER_MV((nx + ox[i])&3, (ny + oy[i])&3, (nx + ox[i])>>2, (ny + oy[i])>>2)
        }
#endif
#if 0
        CHECK_QUARTER_MV(1, 3, mx-1, my-1)
        CHECK_QUARTER_MV(1, 2, mx-1, my-1)
        CHECK_QUARTER_MV(1, 1, mx-1, my-1)
        CHECK_QUARTER_MV(2, 1, mx-1, my-1)
        CHECK_QUARTER_MV(3, 1, mx-1, my-1)
        CHECK_QUARTER_MV(0, 1, mx  , my-1)
        CHECK_QUARTER_MV(1, 1, mx  , my-1)
        CHECK_QUARTER_MV(2, 1, mx  , my-1)
        CHECK_QUARTER_MV(3, 1, mx  , my-1)
        CHECK_QUARTER_MV(3, 2, mx  , my-1)
        CHECK_QUARTER_MV(3, 3, mx  , my-1)
        CHECK_QUARTER_MV(3, 0, mx  , my  )
        CHECK_QUARTER_MV(3, 1, mx  , my  )
        CHECK_QUARTER_MV(3, 2, mx  , my  )
        CHECK_QUARTER_MV(3, 3, mx  , my  )
        CHECK_QUARTER_MV(2, 3, mx  , my  )
        CHECK_QUARTER_MV(1, 3, mx  , my  )
        CHECK_QUARTER_MV(0, 3, mx  , my  )
        CHECK_QUARTER_MV(3, 3, mx-1, my  )
        CHECK_QUARTER_MV(2, 3, mx-1, my  )
        CHECK_QUARTER_MV(1, 3, mx-1, my  )
        CHECK_QUARTER_MV(1, 2, mx-1, my  )
        CHECK_QUARTER_MV(1, 1, mx-1, my  )
        CHECK_QUARTER_MV(1, 0, mx-1, my  )
#endif
        assert(bx >= xmin*4 && bx <= xmax*4 && by >= ymin*4 && by <= ymax*4);
        *mx_ptr = bx;
        *my_ptr = by;
    }else{
        *mx_ptr =4*mx;
        *my_ptr =4*my;
    }
    return dmin;
}
['static int qpel_motion_search(MpegEncContext * s,\n                                  int *mx_ptr, int *my_ptr, int dmin,\n                                  int src_index, int ref_index,\n                                  int size, int h)\n{\n    MotionEstContext * const c= &s->me;\n    const int mx = *mx_ptr;\n    const int my = *my_ptr;\n    const int penalty_factor= c->sub_penalty_factor;\n    const int map_generation= c->map_generation;\n    const int subpel_quality= c->avctx->me_subpel_quality;\n    uint32_t *map= c->map;\n    me_cmp_func cmpf, chroma_cmpf;\n    me_cmp_func cmp_sub, chroma_cmp_sub;\n    LOAD_COMMON\n    int flags= c->sub_flags;\n    cmpf= s->dsp.me_cmp[size];\n    chroma_cmpf= s->dsp.me_cmp[size+1];\n    cmp_sub= s->dsp.me_sub_cmp[size];\n    chroma_cmp_sub= s->dsp.me_sub_cmp[size+1];\n    if(c->skip){\n        *mx_ptr = 0;\n        *my_ptr = 0;\n        return dmin;\n    }\n    if(c->avctx->me_cmp != c->avctx->me_sub_cmp){\n        dmin= cmp(s, mx, my, 0, 0, size, h, ref_index, src_index, cmp_sub, chroma_cmp_sub, flags);\n        if(mx || my || size>0)\n            dmin += (mv_penalty[4*mx - pred_x] + mv_penalty[4*my - pred_y])*penalty_factor;\n    }\n    if (mx > xmin && mx < xmax &&\n        my > ymin && my < ymax) {\n        int bx=4*mx, by=4*my;\n        int d= dmin;\n        int i, nx, ny;\n        const int index= (my<<ME_MAP_SHIFT) + mx;\n        const int t= score_map[(index-(1<<ME_MAP_SHIFT)  )&(ME_MAP_SIZE-1)];\n        const int l= score_map[(index- 1                 )&(ME_MAP_SIZE-1)];\n        const int r= score_map[(index+ 1                 )&(ME_MAP_SIZE-1)];\n        const int b= score_map[(index+(1<<ME_MAP_SHIFT)  )&(ME_MAP_SIZE-1)];\n        const int c= score_map[(index                    )&(ME_MAP_SIZE-1)];\n        int best[8];\n        int best_pos[8][2];\n        memset(best, 64, sizeof(int)*8);\n#if 1\n        if(s->me.dia_size>=2){\n            const int tl= score_map[(index-(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)];\n            const int bl= score_map[(index+(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)];\n            const int tr= score_map[(index-(1<<ME_MAP_SHIFT)+1)&(ME_MAP_SIZE-1)];\n            const int br= score_map[(index+(1<<ME_MAP_SHIFT)+1)&(ME_MAP_SIZE-1)];\n            for(ny= -3; ny <= 3; ny++){\n                for(nx= -3; nx <= 3; nx++){\n                    const int64_t t2= nx*nx*(tr + tl - 2*t) + 4*nx*(tr-tl) + 32*t;\n                    const int64_t c2= nx*nx*( r +  l - 2*c) + 4*nx*( r- l) + 32*c;\n                    const int64_t b2= nx*nx*(br + bl - 2*b) + 4*nx*(br-bl) + 32*b;\n                    int score= (ny*ny*(b2 + t2 - 2*c2) + 4*ny*(b2 - t2) + 32*c2 + 512)>>10;\n                    int i;\n                    if((nx&3)==0 && (ny&3)==0) continue;\n                    score += (mv_penalty[4*mx + nx - pred_x] + mv_penalty[4*my + ny - pred_y])*penalty_factor;\n                    for(i=0; i<8; i++){\n                        if(score < best[i]){\n                            memmove(&best[i+1], &best[i], sizeof(int)*(7-i));\n                            memmove(&best_pos[i+1][0], &best_pos[i][0], sizeof(int)*2*(7-i));\n                            best[i]= score;\n                            best_pos[i][0]= nx + 4*mx;\n                            best_pos[i][1]= ny + 4*my;\n                            break;\n                        }\n                    }\n                }\n            }\n        }else{\n            int tl;\n            const int cx = 4*(r - l);\n            const int cx2= r + l - 2*c;\n            const int cy = 4*(b - t);\n            const int cy2= b + t - 2*c;\n            int cxy;\n            if(map[(index-(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)] == (my<<ME_MAP_MV_BITS) + mx + map_generation && 0){\n                tl= score_map[(index-(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)];\n            }else{\n                tl= cmp(s, mx-1, my-1, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags);\n            }\n            cxy= 2*tl + (cx + cy)/4 - (cx2 + cy2) - 2*c;\n            assert(16*cx2 + 4*cx + 32*c == 32*r);\n            assert(16*cx2 - 4*cx + 32*c == 32*l);\n            assert(16*cy2 + 4*cy + 32*c == 32*b);\n            assert(16*cy2 - 4*cy + 32*c == 32*t);\n            assert(16*cxy + 16*cy2 + 16*cx2 - 4*cy - 4*cx + 32*c == 32*tl);\n            for(ny= -3; ny <= 3; ny++){\n                for(nx= -3; nx <= 3; nx++){\n                    int score= ny*nx*cxy + nx*nx*cx2 + ny*ny*cy2 + nx*cx + ny*cy + 32*c;\n                    int i;\n                    if((nx&3)==0 && (ny&3)==0) continue;\n                    score += 32*(mv_penalty[4*mx + nx - pred_x] + mv_penalty[4*my + ny - pred_y])*penalty_factor;\n                    for(i=0; i<8; i++){\n                        if(score < best[i]){\n                            memmove(&best[i+1], &best[i], sizeof(int)*(7-i));\n                            memmove(&best_pos[i+1][0], &best_pos[i][0], sizeof(int)*2*(7-i));\n                            best[i]= score;\n                            best_pos[i][0]= nx + 4*mx;\n                            best_pos[i][1]= ny + 4*my;\n                            break;\n                        }\n                    }\n                }\n            }\n        }\n        for(i=0; i<subpel_quality; i++){\n            nx= best_pos[i][0];\n            ny= best_pos[i][1];\n            CHECK_QUARTER_MV(nx&3, ny&3, nx>>2, ny>>2)\n        }\n#if 0\n            const int tl= score_map[(index-(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)];\n            const int bl= score_map[(index+(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)];\n            const int tr= score_map[(index-(1<<ME_MAP_SHIFT)+1)&(ME_MAP_SIZE-1)];\n            const int br= score_map[(index+(1<<ME_MAP_SHIFT)+1)&(ME_MAP_SIZE-1)];\n            if(tl<br){\n            static int stats[7][7], count;\n            count++;\n            stats[4*mx - bx + 3][4*my - by + 3]++;\n            if(256*256*256*64 % count ==0){\n                for(i=0; i<49; i++){\n                    if((i%7)==0) printf("\\n");\n                    printf("%6d ", stats[0][i]);\n                }\n                printf("\\n");\n            }\n            }\n#endif\n#else\n        CHECK_QUARTER_MV(2, 2, mx-1, my-1)\n        CHECK_QUARTER_MV(0, 2, mx  , my-1)\n        CHECK_QUARTER_MV(2, 2, mx  , my-1)\n        CHECK_QUARTER_MV(2, 0, mx  , my  )\n        CHECK_QUARTER_MV(2, 2, mx  , my  )\n        CHECK_QUARTER_MV(0, 2, mx  , my  )\n        CHECK_QUARTER_MV(2, 2, mx-1, my  )\n        CHECK_QUARTER_MV(2, 0, mx-1, my  )\n        nx= bx;\n        ny= by;\n        for(i=0; i<8; i++){\n            int ox[8]= {0, 1, 1, 1, 0,-1,-1,-1};\n            int oy[8]= {1, 1, 0,-1,-1,-1, 0, 1};\n            CHECK_QUARTER_MV((nx + ox[i])&3, (ny + oy[i])&3, (nx + ox[i])>>2, (ny + oy[i])>>2)\n        }\n#endif\n#if 0\n        CHECK_QUARTER_MV(1, 3, mx-1, my-1)\n        CHECK_QUARTER_MV(1, 2, mx-1, my-1)\n        CHECK_QUARTER_MV(1, 1, mx-1, my-1)\n        CHECK_QUARTER_MV(2, 1, mx-1, my-1)\n        CHECK_QUARTER_MV(3, 1, mx-1, my-1)\n        CHECK_QUARTER_MV(0, 1, mx  , my-1)\n        CHECK_QUARTER_MV(1, 1, mx  , my-1)\n        CHECK_QUARTER_MV(2, 1, mx  , my-1)\n        CHECK_QUARTER_MV(3, 1, mx  , my-1)\n        CHECK_QUARTER_MV(3, 2, mx  , my-1)\n        CHECK_QUARTER_MV(3, 3, mx  , my-1)\n        CHECK_QUARTER_MV(3, 0, mx  , my  )\n        CHECK_QUARTER_MV(3, 1, mx  , my  )\n        CHECK_QUARTER_MV(3, 2, mx  , my  )\n        CHECK_QUARTER_MV(3, 3, mx  , my  )\n        CHECK_QUARTER_MV(2, 3, mx  , my  )\n        CHECK_QUARTER_MV(1, 3, mx  , my  )\n        CHECK_QUARTER_MV(0, 3, mx  , my  )\n        CHECK_QUARTER_MV(3, 3, mx-1, my  )\n        CHECK_QUARTER_MV(2, 3, mx-1, my  )\n        CHECK_QUARTER_MV(1, 3, mx-1, my  )\n        CHECK_QUARTER_MV(1, 2, mx-1, my  )\n        CHECK_QUARTER_MV(1, 1, mx-1, my  )\n        CHECK_QUARTER_MV(1, 0, mx-1, my  )\n#endif\n        assert(bx >= xmin*4 && bx <= xmax*4 && by >= ymin*4 && by <= ymax*4);\n        *mx_ptr = bx;\n        *my_ptr = by;\n    }else{\n        *mx_ptr =4*mx;\n        *my_ptr =4*my;\n    }\n    return dmin;\n}']