[FFmpeg-cvslog] mpegvideo: simplify dxy calculation in hpel_motion()
Mans Rullgard
git at videolan.org
Fri Nov 23 13:49:43 CET 2012
ffmpeg | branch: master | Mans Rullgard <mans at mansr.com> | Sat Aug 4 02:57:53 2012 +0100| [5e39bb073a1d6fc6ac30b19893beefdd3c7d633f] | committer: Mans Rullgard
mpegvideo: simplify dxy calculation in hpel_motion()
Signed-off-by: Mans Rullgard <mans at mansr.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5e39bb073a1d6fc6ac30b19893beefdd3c7d633f
---
libavcodec/mpegvideo_motion.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/libavcodec/mpegvideo_motion.c b/libavcodec/mpegvideo_motion.c
index 9168793..4ea31ad 100644
--- a/libavcodec/mpegvideo_motion.c
+++ b/libavcodec/mpegvideo_motion.c
@@ -177,20 +177,19 @@ static inline int hpel_motion(MpegEncContext *s,
op_pixels_func *pix_op,
int motion_x, int motion_y)
{
- int dxy;
+ int dxy = 0;
int emu=0;
- dxy = ((motion_y & 1) << 1) | (motion_x & 1);
src_x += motion_x >> 1;
src_y += motion_y >> 1;
/* WARNING: do no forget half pels */
src_x = av_clip(src_x, -16, s->width); //FIXME unneeded for emu?
- if (src_x == s->width)
- dxy &= ~1;
+ if (src_x != s->width)
+ dxy |= motion_x & 1;
src_y = av_clip(src_y, -16, s->height);
- if (src_y == s->height)
- dxy &= ~2;
+ if (src_y != s->height)
+ dxy |= (motion_y & 1) << 1;
src += src_y * s->linesize + src_x;
if(s->unrestricted_mv && (s->flags&CODEC_FLAG_EMU_EDGE)){
More information about the ffmpeg-cvslog
mailing list