summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel Freitas <miguelfreitas@users.sourceforge.net>2003-01-09 19:15:15 +0000
committerMiguel Freitas <miguelfreitas@users.sourceforge.net>2003-01-09 19:15:15 +0000
commitab46a84ba585cf2644642e6cf491beca0ecaac56 (patch)
treefd05c4161fea908d84129ddd3a7bdef1081dfcc0
parent622c22c66441ecd39d9810e2ea6951fe7df6ad7d (diff)
downloadxine-lib-ab46a84ba585cf2644642e6cf491beca0ecaac56.tar.gz
xine-lib-ab46a84ba585cf2644642e6cf491beca0ecaac56.tar.bz2
patch from walken to clip motion vectors. fix playback for some streams.
CVS patchset: 3847 CVS date: 2003/01/09 19:15:15
-rw-r--r--src/libmpeg2/slice.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/libmpeg2/slice.c b/src/libmpeg2/slice.c
index b190acdd6..7739ef067 100644
--- a/src/libmpeg2/slice.c
+++ b/src/libmpeg2/slice.c
@@ -993,8 +993,12 @@ static inline void slice_non_intra_DCT (picture_t * picture, uint8_t * dest,
#define MOTION(table,ref,motion_x,motion_y,size,y) \
pos_x = 2 * picture->offset + motion_x; \
pos_y = 2 * picture->v_offset + motion_y + 2 * y; \
- if ((pos_x > picture->limit_x) || (pos_y > picture->limit_y_ ## size)) \
- return; \
+ if ((pos_x > picture->limit_x) || (pos_y > picture->limit_y_ ## size)) { \
+ if (pos_x > picture->limit_x) \
+ pos_x = (((int)pos_x) < 0) ? 0 : picture->limit_x; \
+ if (pos_y > picture->limit_y_ ## size) \
+ pos_y = (((int)pos_y) < 0) ? 0 : picture->limit_y_ ## size; \
+ } \
xy_half = ((pos_y & 1) << 1) | (pos_x & 1); \
table[xy_half] (picture->dest[0] + y * picture->pitches[0] + \
picture->offset, ref[0] + (pos_x >> 1) + \
@@ -1016,8 +1020,12 @@ static inline void slice_non_intra_DCT (picture_t * picture, uint8_t * dest,
#define MOTION_FIELD(table,ref,motion_x,motion_y,dest_field,op,src_field) \
pos_x = 2 * picture->offset + motion_x; \
pos_y = picture->v_offset + motion_y; \
- if ((pos_x > picture->limit_x) || (pos_y > picture->limit_y)) \
- return; \
+ if ((pos_x > picture->limit_x) || (pos_y > picture->limit_y)) { \
+ if (pos_x > picture->limit_x) \
+ pos_x = (((int)pos_x) < 0) ? 0 : picture->limit_x; \
+ if (pos_y > picture->limit_y) \
+ pos_y = (((int)pos_y) < 0) ? 0 : picture->limit_y; \
+ } \
xy_half = ((pos_y & 1) << 1) | (pos_x & 1); \
table[xy_half] (picture->dest[0] + dest_field * picture->pitches[0] + \
picture->offset, \