[Mplayer-cvslog] CVS: main/libvo vo_svga.c,1.47,1.48
Michael Niedermayer
michael at mplayerhq.hu
Mon Jun 17 14:40:42 CEST 2002
Update of /cvsroot/mplayer/main/libvo
In directory mail:/var/tmp.root/cvs-serv23581/libvo
Modified Files:
vo_svga.c
Log Message:
1bpp support
Index: vo_svga.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_svga.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- vo_svga.c 17 Jun 2002 01:48:31 -0000 1.47
+++ vo_svga.c 17 Jun 2002 12:40:28 -0000 1.48
@@ -423,7 +423,11 @@
WIDTH=vga_getxdim();
HEIGHT=vga_getydim();
BYTESPERPIXEL=(bpp+4)>>3;
- LINEWIDTH=WIDTH*BYTESPERPIXEL;
+ if(bpp==1)
+ LINEWIDTH=(WIDTH+7)/8;
+ else
+ LINEWIDTH=WIDTH*BYTESPERPIXEL;
+
vga_setlinearaddressing();
if(oldmethod) {
buffer=malloc(HEIGHT*LINEWIDTH);
@@ -453,7 +457,11 @@
if (pformat == IMGFMT_YV12) {
yuv2rgb_init(bpp, MODE_RGB);
- yuvbuf = malloc(maxw * maxh * BYTESPERPIXEL);
+ if(bpp==1)
+ yuvbuf = malloc((maxw+7)/8 * maxh);
+ else
+ yuvbuf = malloc(maxw * maxh * BYTESPERPIXEL);
+
if (yuvbuf == NULL) {
printf("vo_svga: yuvbuf -> Not enough memory for buffering!\n");
uninit();
@@ -476,7 +484,10 @@
static uint32_t draw_frame(uint8_t *src[]) {
if (pformat == IMGFMT_YV12) {
- yuv2rgb(yuvbuf, src[0], src[1], src[2], orig_w, orig_h, orig_w * BYTESPERPIXEL, orig_w, orig_w / 2);
+ if(bpp==1)
+ yuv2rgb(yuvbuf, src[0], src[1], src[2], orig_w, orig_h, (orig_w+7)/8, orig_w, orig_w / 2);
+ else
+ yuv2rgb(yuvbuf, src[0], src[1], src[2], orig_w, orig_h, orig_w * BYTESPERPIXEL, orig_w, orig_w / 2);
src[0] = yuvbuf;
}
if (bpp_conv) {
@@ -509,8 +520,11 @@
int w, int h, int x, int y) {
uint8_t *src = yuvbuf;
uint32_t sw, sh;
-
- yuv2rgb(yuvbuf, image[0], image[1], image[2], w, h, orig_w * BYTESPERPIXEL, stride[0], stride[1]);
+ if(bpp==1)
+ yuv2rgb(yuvbuf, image[0], image[1], image[2], w, h, (orig_w+7)/8, stride[0], stride[1]);
+ else
+ yuv2rgb(yuvbuf, image[0], image[1], image[2], w, h, orig_w * BYTESPERPIXEL, stride[0], stride[1]);
+
putbox(x + x_pos, y + y_pos, w, h, src, 1);
return (0);
@@ -699,15 +713,21 @@
static void putbox(int x, int y, int w, int h, uint8_t *buf, int prog) {
int base, add, wid;
+ if(bpp==1)
+ wid=(w+7)/8;
+ else
+ wid=w*BYTESPERPIXEL;
+
if(oldmethod) {
- wid=w*BYTESPERPIXEL;
add=wid*prog;
while( (h--) > 0 ) {
- memcpy(buffer+x*BYTESPERPIXEL+(y++)*LINEWIDTH, buf, wid);
+ if(bpp==1)
+ memcpy(buffer+(x+7)/8+(y++)*LINEWIDTH, buf, wid);
+ else
+ memcpy(buffer+x*BYTESPERPIXEL+(y++)*LINEWIDTH, buf, wid);
buf+=add;
}
} else {
- wid=w*BYTESPERPIXEL;
add=wid*prog;
base=frame*HEIGHT;
while( (h--) > 0 ) {
More information about the MPlayer-cvslog
mailing list