aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mpeg12.c
diff options
context:
space:
mode:
authorWolfgang Hesseler <qv@multimediaware.com>2003-12-09 01:49:56 +0000
committerMichael Niedermayer <michaelni@gmx.at>2003-12-09 01:49:56 +0000
commit8d7ec294c4460e8a8c657f2423983b728d7903d4 (patch)
treee95c23fce6df8351048503aa6e17dc66305c1ca9 /libavcodec/mpeg12.c
parenta0b8f70c2958ccf96b57f3d07af90545800f5b35 (diff)
downloadffmpeg-8d7ec294c4460e8a8c657f2423983b728d7903d4.tar.gz
move motion_val & mb_type to AVFrame patch by (Wolfgang Hesseler <qv at multimediaware dot com>)
cleanups & fixes by me Originally committed as revision 2579 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mpeg12.c')
-rw-r--r--libavcodec/mpeg12.c60
1 files changed, 39 insertions, 21 deletions
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index ed8127682b..2e2a972b57 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -2131,32 +2131,50 @@ static int mpeg_decode_slice(AVCodecContext *avctx,
dprintf("ret=%d\n", ret);
if (ret < 0)
return -1;
-
- if(s->motion_val && s->pict_type != B_TYPE){ //note motion_val is normally NULL unless we want to extract the MVs
+
+ if(s->current_picture.motion_val[0]){ //note motion_val is normally NULL unless we want to extract the MVs
const int wrap = s->block_wrap[0];
const int xy = s->mb_x*2 + 1 + (s->mb_y*2 +1)*wrap;
- int motion_x, motion_y;
-
+ int motion_for_x, motion_for_y, motion_back_x, motion_back_y;
if (s->mb_intra) {
- motion_x = motion_y = 0;
- }else if (s->mv_type == MV_TYPE_16X16) {
- motion_x = s->mv[0][0][0];
- motion_y = s->mv[0][0][1];
- } else /*if (s->mv_type == MV_TYPE_FIELD)*/ {
- motion_x = s->mv[0][0][0] + s->mv[0][1][0];
- motion_y = s->mv[0][0][1] + s->mv[0][1][1];
- motion_x = (motion_x>>1) | (motion_x&1);
+ motion_for_x = motion_for_y = motion_back_x = motion_back_y = 0;
+ }else if (s->mv_type == MV_TYPE_16X16){
+ motion_for_x = s->mv[0][0][0];
+ motion_for_y = s->mv[0][0][1];
+ motion_back_x = s->mv[1][0][0];
+ motion_back_y = s->mv[1][0][1];
+ } else /*if ((s->mv_type == MV_TYPE_FIELD) || (s->mv_type == MV_TYPE_16X8))*/ {
+ motion_for_x = s->mv[0][0][0] + s->mv[0][1][0];
+ motion_for_y = s->mv[0][0][1] + s->mv[0][1][1];
+ motion_for_x = (motion_for_x>>1) | (motion_for_x&1);
+ motion_back_x = s->mv[1][0][0] + s->mv[1][1][0];
+ motion_back_y = s->mv[1][0][1] + s->mv[1][1][1];
+ motion_back_x = (motion_back_x>>1) | (motion_back_x&1);
+ }
+
+ s->current_picture.motion_val[0][xy][0] = motion_for_x;
+ s->current_picture.motion_val[0][xy][1] = motion_for_y;
+ s->current_picture.motion_val[0][xy + 1][0] = motion_for_x;
+ s->current_picture.motion_val[0][xy + 1][1] = motion_for_y;
+ s->current_picture.motion_val[0][xy + wrap][0] = motion_for_x;
+ s->current_picture.motion_val[0][xy + wrap][1] = motion_for_y;
+ s->current_picture.motion_val[0][xy + 1 + wrap][0] = motion_for_x;
+ s->current_picture.motion_val[0][xy + 1 + wrap][1] = motion_for_y;
+
+ if(s->pict_type != B_TYPE){
+ motion_back_x = motion_back_y = 0;
}
- s->motion_val[xy][0] = motion_x;
- s->motion_val[xy][1] = motion_y;
- s->motion_val[xy + 1][0] = motion_x;
- s->motion_val[xy + 1][1] = motion_y;
- s->motion_val[xy + wrap][0] = motion_x;
- s->motion_val[xy + wrap][1] = motion_y;
- s->motion_val[xy + 1 + wrap][0] = motion_x;
- s->motion_val[xy + 1 + wrap][1] = motion_y;
+
+ s->current_picture.motion_val[1][xy][0] = motion_back_x;
+ s->current_picture.motion_val[1][xy][1] = motion_back_y;
+ s->current_picture.motion_val[1][xy + 1][0] = motion_back_x;
+ s->current_picture.motion_val[1][xy + 1][1] = motion_back_y;
+ s->current_picture.motion_val[1][xy + wrap][0] = motion_back_x;
+ s->current_picture.motion_val[1][xy + wrap][1] = motion_back_y;
+ s->current_picture.motion_val[1][xy + 1 + wrap][0] = motion_back_x;
+ s->current_picture.motion_val[1][xy + 1 + wrap][1] = motion_back_y;
}
-
+
s->dest[0] += 16;
s->dest[1] += 8;
s->dest[2] += 8;