Revision 668154df

View differences:

libavcodec/motion_est.c
176 176
    }else{\
177 177
        int fx = s->me.direct_basis_mv[0][0] + hx;\
178 178
        int fy = s->me.direct_basis_mv[0][1] + hy;\
179
        int bx = hx ? fx - s->me.co_located_mv[0][0] : s->me.co_located_mv[0][0]*(time_pb - time_pp)/time_pp;\
180
        int by = hy ? fy - s->me.co_located_mv[0][1] : s->me.co_located_mv[0][1]*(time_pb - time_pp)/time_pp;\
179
        int bx = hx ? fx - s->me.co_located_mv[0][0] : (s->me.co_located_mv[0][0]*(time_pb - time_pp)/time_pp);\
180
        int by = hy ? fy - s->me.co_located_mv[0][1] : (s->me.co_located_mv[0][1]*(time_pb - time_pp)/time_pp);\
181 181
        int fxy= (fx&1) + 2*(fy&1);\
182 182
        int bxy= (bx&1) + 2*(by&1);\
183
        \
184
        assert((fx>>1) + 16*s->mb_x >= -16);\
185
        assert((fy>>1) + 16*s->mb_y >= -16);\
186
        assert((fx>>1) + 16*s->mb_x <= s->width);\
187
        assert((fy>>1) + 16*s->mb_y <= s->height);\
188
        assert((bx>>1) + 16*s->mb_x >= -16);\
189
        assert((by>>1) + 16*s->mb_y >= -16);\
190
        assert((bx>>1) + 16*s->mb_x <= s->width);\
191
        assert((by>>1) + 16*s->mb_y <= s->height);\
183 192
\
184 193
        hpel_put[0][fxy](s->me.scratchpad, (ref_y ) + (fx>>1) + (fy>>1)*(stride), stride, 16);\
185 194
        hpel_avg[0][bxy](s->me.scratchpad, (ref2_y) + (bx>>1) + (by>>1)*(stride), stride, 16);\
......
1406 1415

  
1407 1416
        max= FFMAX(s->me.direct_basis_mv[i][0], s->me.direct_basis_mv[i][0] - s->me.co_located_mv[i][0])>>shift;
1408 1417
        min= FFMIN(s->me.direct_basis_mv[i][0], s->me.direct_basis_mv[i][0] - s->me.co_located_mv[i][0])>>shift;
1409
        max+= (2*mb_x + (i& 1))*8 - 1; // +-1 is for the simpler rounding
1410
        min+= (2*mb_x + (i& 1))*8 + 1;
1418
        max+= (2*mb_x + (i& 1))*8 + 1; // +-1 is for the simpler rounding
1419
        min+= (2*mb_x + (i& 1))*8 - 1;
1411 1420
        xmax= FFMIN(xmax, s->width - max);
1412 1421
        xmin= FFMAX(xmin, - 16     - min);
1413 1422

  
1414 1423
        max= FFMAX(s->me.direct_basis_mv[i][1], s->me.direct_basis_mv[i][1] - s->me.co_located_mv[i][1])>>shift;
1415 1424
        min= FFMIN(s->me.direct_basis_mv[i][1], s->me.direct_basis_mv[i][1] - s->me.co_located_mv[i][1])>>shift;
1416
        max+= (2*mb_y + (i>>1))*8 - 1; // +-1 is for the simpler rounding
1417
        min+= (2*mb_y + (i>>1))*8 + 1;
1425
        max+= (2*mb_y + (i>>1))*8 + 1; // +-1 is for the simpler rounding
1426
        min+= (2*mb_y + (i>>1))*8 - 1;
1418 1427
        ymax= FFMIN(ymax, s->height - max);
1419 1428
        ymin= FFMAX(ymin, - 16      - min);
1420 1429
        

Also available in: Unified diff