[MPlayer-dev-eng] fbdev and odd width
Alan Curry
pacman at theworld.com
Thu Mar 2 23:39:56 CET 2006
If a video has an odd width, vo_fbdev and vo_fbdev2, when centering it on the
screen, use a starting position that is on an odd byte, halfway between
pixels. Try it in 16bpp for most impressive demonstration.
-vf scale=199:-2 -vo fbdev -vm -fbmode 640x480-60 -bpp 16
"The colors, children!" -- Prof. Frink
This patch guarantees that the starting position for the image is a multiple
of fb_pixel_size by switching the order of the /2 and the *fb_pixel_size
Index: libvo/vo_fbdev.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_fbdev.c,v
retrieving revision 1.93
diff -u -r1.93 vo_fbdev.c
--- libvo/vo_fbdev.c 17 Feb 2006 03:49:33 -0000 1.93
+++ libvo/vo_fbdev.c 2 Mar 2006 22:22:44 -0000
@@ -1005,8 +1005,9 @@
return 1;
}
- center = frame_buffer + (out_width - in_width) * fb_pixel_size /
- 2 + ( (out_height - in_height) / 2 ) * fb_line_len +
+ center = frame_buffer +
+ ( (out_width - in_width) / 2 ) * fb_pixel_size +
+ ( (out_height - in_height) / 2 ) * fb_line_len +
x_offset * fb_pixel_size + y_offset * fb_line_len;
mp_msg(MSGT_VO, MSGL_DBG2, "frame_buffer @ %p\n", frame_buffer);
Index: libvo/vo_fbdev2.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_fbdev2.c,v
retrieving revision 1.8
diff -u -r1.8 vo_fbdev2.c
--- libvo/vo_fbdev2.c 17 Feb 2006 03:49:33 -0000 1.8
+++ libvo/vo_fbdev2.c 2 Mar 2006 22:22:44 -0000
@@ -280,8 +280,9 @@
}
}
- center = frame_buffer + (out_width - in_width) * fb_pixel_size /
- 2 + ( (out_height - in_height) / 2 ) * fb_line_len;
+ center = frame_buffer +
+ ( (out_width - in_width) / 2 ) * fb_pixel_size +
+ ( (out_height - in_height) / 2 ) * fb_line_len;
#ifndef USE_CONVERT2FB
if (!(next_frame = (uint8_t *) realloc(next_frame, in_width * in_height * fb_pixel_size))) {
More information about the MPlayer-dev-eng
mailing list