summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfgang Hesseler <qv@multimediaware.com>2003-12-14 17:47:23 +0000
committerMichael Niedermayer <michaelni@gmx.at>2003-12-14 17:47:23 +0000
commitfad05f523c03dd0df5d7172cff641c668247034a (patch)
treec2a0d91a5eaa7e7a05fbff2b3f541446e742aba4
parenta4337a5130aa3d5f1844aba1ceaa6fed66497958 (diff)
cygwin fix and dont average interlaced MVs patch by (Wolfgang Hesseler <qv at multimediaware dot com>)
Originally committed as revision 2609 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/mpeg12.c62
-rw-r--r--libavformat/file.c2
2 files changed, 34 insertions, 30 deletions
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index 3037c9d8b3..69a41dda1f 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -2164,44 +2164,48 @@ static int mpeg_decode_slice(AVCodecContext *avctx,
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_for_x, motion_for_y, motion_back_x, motion_back_y;
+ int motion_for_top_x, motion_for_top_y, motion_back_top_x, motion_back_top_y;
+ int motion_for_bottom_x, motion_for_bottom_y, motion_back_bottom_x, motion_back_bottom_y;
if (s->mb_intra) {
- motion_for_x = motion_for_y = motion_back_x = motion_back_y = 0;
+ motion_for_top_x = motion_for_top_y = motion_back_top_x = motion_back_top_y =
+ motion_for_bottom_x = motion_for_bottom_y = motion_back_bottom_x = motion_back_bottom_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];
+ motion_for_top_x = motion_for_bottom_x = s->mv[0][0][0];
+ motion_for_top_y = motion_for_bottom_y = s->mv[0][0][1];
+ motion_back_top_x = motion_back_bottom_x = s->mv[1][0][0];
+ motion_back_top_y = motion_back_bottom_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);
+ motion_for_top_x = s->mv[0][0][0];
+ motion_for_top_y = s->mv[0][0][1];
+ motion_for_bottom_x = s->mv[0][1][0];
+ motion_for_bottom_y = s->mv[0][1][1];
+ motion_back_top_x = s->mv[1][0][0];
+ motion_back_top_y = s->mv[1][0][1];
+ motion_back_bottom_x = s->mv[1][1][0];
+ motion_back_bottom_y = s->mv[1][1][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;
+ s->current_picture.motion_val[0][xy][0] = motion_for_top_x;
+ s->current_picture.motion_val[0][xy][1] = motion_for_top_y;
+ s->current_picture.motion_val[0][xy + 1][0] = motion_for_top_x;
+ s->current_picture.motion_val[0][xy + 1][1] = motion_for_top_y;
+ s->current_picture.motion_val[0][xy + wrap][0] = motion_for_bottom_x;
+ s->current_picture.motion_val[0][xy + wrap][1] = motion_for_bottom_y;
+ s->current_picture.motion_val[0][xy + 1 + wrap][0] = motion_for_bottom_x;
+ s->current_picture.motion_val[0][xy + 1 + wrap][1] = motion_for_bottom_y;
if(s->pict_type != B_TYPE){
- motion_back_x = motion_back_y = 0;
+ motion_back_top_x = motion_back_top_y = motion_back_bottom_x = motion_back_bottom_y = 0;
}
- 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->current_picture.motion_val[1][xy][0] = motion_back_top_x;
+ s->current_picture.motion_val[1][xy][1] = motion_back_top_y;
+ s->current_picture.motion_val[1][xy + 1][0] = motion_back_top_x;
+ s->current_picture.motion_val[1][xy + 1][1] = motion_back_top_y;
+ s->current_picture.motion_val[1][xy + wrap][0] = motion_back_bottom_x;
+ s->current_picture.motion_val[1][xy + wrap][1] = motion_back_bottom_y;
+ s->current_picture.motion_val[1][xy + 1 + wrap][0] = motion_back_bottom_x;
+ s->current_picture.motion_val[1][xy + 1 + wrap][1] = motion_back_bottom_y;
}
s->dest[0] += 16;
diff --git a/libavformat/file.c b/libavformat/file.c
index a84823a378..ee1f72a00c 100644
--- a/libavformat/file.c
+++ b/libavformat/file.c
@@ -42,7 +42,7 @@ static int file_open(URLContext *h, const char *filename, int flags)
} else {
access = O_RDONLY;
}
-#if defined(CONFIG_WIN32) || defined(CONFIG_OS2)
+#if defined(CONFIG_WIN32) || defined(CONFIG_OS2) || defined(__CYGWIN__)
access |= O_BINARY;
#endif
fd = open(filename, access, 0666);