aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>2009-04-17 20:05:27 +0000
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>2009-04-17 20:05:27 +0000
commitd7670f2827b3bebcf0c0969e8a4bcf0745db0236 (patch)
treebe98f28e3479e50a627654ec6eb60b3618020edc
parente62f62219353d333df45aa7f8327631d6cd9d31d (diff)
downloadffmpeg-d7670f2827b3bebcf0c0969e8a4bcf0745db0236.tar.gz
Use sign_extend function instead of reimplementing it.
Originally committed as revision 18599 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/xan.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/libavcodec/xan.c b/libavcodec/xan.c
index bb6dab49ce..748f4d1eab 100644
--- a/libavcodec/xan.c
+++ b/libavcodec/xan.c
@@ -333,16 +333,10 @@ static void xan_wc3_decode_frame(XanContext *s) {
}
} else {
/* run-based motion compensation from last frame */
- motion_x = *vector_segment >> 4;
- motion_y = *vector_segment & 0xF;
+ motion_x = sign_extend(*vector_segment >> 4, 4);
+ motion_y = sign_extend(*vector_segment & 0xF, 4);
vector_segment++;
- /* sign extension */
- if (motion_x & 0x8)
- motion_x |= 0xFFFFFFF0;
- if (motion_y & 0x8)
- motion_y |= 0xFFFFFFF0;
-
/* copy a run of pixels from the previous frame */
xan_wc3_copy_pixel_run(s, x, y, size, motion_x, motion_y);