1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00

clip MVs for direct mode

Originally committed as revision 1068 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Michael Niedermayer 2002-10-24 00:51:17 +00:00
parent 470ba6f28a
commit c42612f1b4

View File

@ -1336,7 +1336,13 @@ static inline int check_bidir_mv(MpegEncContext * s,
dxy = ((motion_fy & 1) << 1) | (motion_fx & 1);
src_x = mb_x * 16 + (motion_fx >> 1);
src_y = mb_y * 16 + (motion_fy >> 1);
src_x = clip(src_x, -16, s->width);
if (src_x == s->width)
dxy&= 2;
src_y = clip(src_y, -16, s->height);
if (src_y == s->height)
dxy&= 1;
ptr = s->last_picture[0] + (src_y * s->linesize) + src_x;
put_pixels_tab[0][dxy](dest_y , ptr , s->linesize, 16);
@ -1345,6 +1351,12 @@ static inline int check_bidir_mv(MpegEncContext * s,
dxy = ((motion_by & 1) << 1) | (motion_bx & 1);
src_x = mb_x * 16 + (motion_bx >> 1);
src_y = mb_y * 16 + (motion_by >> 1);
src_x = clip(src_x, -16, s->width);
if (src_x == s->width)
dxy&= 2;
src_y = clip(src_y, -16, s->height);
if (src_y == s->height)
dxy&= 1;
ptr = s->next_picture[0] + (src_y * s->linesize) + src_x;
avg_pixels_tab[0][dxy](dest_y , ptr , s->linesize, 16);