comparison xan.c @ 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
comparison
equal deleted inserted replaced
9499:7075d0be5ec4 9500:9157421b6239
331 xan_wc3_output_pixel_run(s, imagedata_buffer, x, y, size); 331 xan_wc3_output_pixel_run(s, imagedata_buffer, x, y, size);
332 imagedata_buffer += size; 332 imagedata_buffer += size;
333 } 333 }
334 } else { 334 } else {
335 /* run-based motion compensation from last frame */ 335 /* run-based motion compensation from last frame */
336 motion_x = *vector_segment >> 4; 336 motion_x = sign_extend(*vector_segment >> 4, 4);
337 motion_y = *vector_segment & 0xF; 337 motion_y = sign_extend(*vector_segment & 0xF, 4);
338 vector_segment++; 338 vector_segment++;
339
340 /* sign extension */
341 if (motion_x & 0x8)
342 motion_x |= 0xFFFFFFF0;
343 if (motion_y & 0x8)
344 motion_y |= 0xFFFFFFF0;
345 339
346 /* copy a run of pixels from the previous frame */ 340 /* copy a run of pixels from the previous frame */
347 xan_wc3_copy_pixel_run(s, x, y, size, motion_x, motion_y); 341 xan_wc3_copy_pixel_run(s, x, y, size, motion_x, motion_y);
348 342
349 flag = 0; 343 flag = 0;