aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mpegvideo.c
diff options
context:
space:
mode:
authorIvan Kalvachev <ivan@cacad.com>2003-06-23 22:32:15 +0000
committerMichael Niedermayer <michaelni@gmx.at>2003-06-23 22:32:15 +0000
commit1dff7d56ad940ebbb3b741743462b2970b34d404 (patch)
treed78fee8c329a31d2621d29e531525f6df53498a3 /libavcodec/mpegvideo.c
parent2a250222e6df9f13f871c934c96da32b4439e7b7 (diff)
downloadffmpeg-1dff7d56ad940ebbb3b741743462b2970b34d404.tar.gz
DMV support patch by ("Ivan Kalvachev" <ivan at cacad dot com>)
Originally committed as revision 1985 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mpegvideo.c')
-rw-r--r--libavcodec/mpegvideo.c65
1 files changed, 65 insertions, 0 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 9aa258f956..fc8bb60ec6 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -2190,6 +2190,71 @@ static inline void MPV_motion(MpegEncContext *s,
s->mv[dir][0][0], s->mv[dir][0][1], 16);
}
break;
+ case MV_TYPE_DMV:
+ {
+ op_pixels_func (*dmv_pix_op)[4];
+ int offset;
+
+ dmv_pix_op = s->dsp.put_pixels_tab;
+
+ if(s->picture_structure == PICT_FRAME){
+ //put top field from top field
+ mpeg_motion(s, dest_y, dest_cb, dest_cr, 0,
+ ref_picture, 0,
+ 1, dmv_pix_op,
+ s->mv[dir][0][0], s->mv[dir][0][1], 8);
+ //put bottom field from bottom field
+ mpeg_motion(s, dest_y, dest_cb, dest_cr, s->linesize,
+ ref_picture, s->linesize,
+ 1, dmv_pix_op,
+ s->mv[dir][0][0], s->mv[dir][0][1], 8);
+
+ dmv_pix_op = s->dsp.avg_pixels_tab;
+
+ //avg top field from bottom field
+ mpeg_motion(s, dest_y, dest_cb, dest_cr, 0,
+ ref_picture, s->linesize,
+ 1, dmv_pix_op,
+ s->mv[dir][2][0], s->mv[dir][2][1], 8);
+ //avg bottom field from top field
+ mpeg_motion(s, dest_y, dest_cb, dest_cr, s->linesize,
+ ref_picture, 0,
+ 1, dmv_pix_op,
+ s->mv[dir][3][0], s->mv[dir][3][1], 8);
+
+ }else{
+ offset=(s->picture_structure == PICT_BOTTOM_FIELD)?
+ s->linesize : 0;
+
+ //put field from the same parity
+ //same parity is never in the same frame
+ mpeg_motion(s, dest_y, dest_cb, dest_cr, 0,
+ ref_picture,offset,
+ 0,dmv_pix_op,
+ s->mv[dir][0][0],s->mv[dir][0][1],16);
+
+ // after put we make avg of the same block
+ dmv_pix_op=s->dsp.avg_pixels_tab;
+
+ //opposite parity is always in the same frame if this is second field
+ if(!s->first_field){
+ ref_picture = s->current_picture.data;
+ //top field is one linesize from frame beginig
+ offset=(s->picture_structure == PICT_BOTTOM_FIELD)?
+ -s->linesize : s->linesize;
+ }else
+ offset=(s->picture_structure == PICT_BOTTOM_FIELD)?
+ 0 : s->linesize;
+
+ //avg field from the opposite parity
+ mpeg_motion(s, dest_y, dest_cb, dest_cr,0,
+ ref_picture, offset,
+ 0,dmv_pix_op,
+ s->mv[dir][2][0],s->mv[dir][2][1],16);
+ }
+ }
+ break;
+
}
}