changeset 9500:9157421b6239 libavcodec

Use sign_extend function instead of reimplementing it.
author reimar
date Fri, 17 Apr 2009 20:05:27 +0000
parents 7075d0be5ec4
children 880d9562d218
files xan.c
diffstat 1 files changed, 2 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/xan.c	Fri Apr 17 20:01:45 2009 +0000
+++ b/xan.c	Fri Apr 17 20:05:27 2009 +0000
@@ -333,16 +333,10 @@
             }
         } 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);