changeset 6232:f8e0eac1256c

grayscaled palette support
author arpi
date Thu, 30 May 2002 00:26:23 +0000
parents 3acbdbc8f212
children e2f1b1b8f8b4
files libmpcodecs/vd_vfw.c libmpcodecs/vf_palette.c
diffstat 2 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vd_vfw.c	Thu May 30 00:08:47 2002 +0000
+++ b/libmpcodecs/vd_vfw.c	Thu May 30 00:26:23 2002 +0000
@@ -94,7 +94,11 @@
     
     if(mpi->imgfmt==IMGFMT_RGB8 || mpi->imgfmt==IMGFMT_BGR8){
 	// export palette:
-	mpi->planes[1]=((unsigned char*)&sh->o_bih)+40;
+// FIXME: sh->o_bih is cutted down to 40 bytes!!!
+//	if(sh->o_bih->biSize>40)
+//	    mpi->planes[1]=((unsigned char*)&sh->o_bih)+40;
+//	else
+	    mpi->planes[1]=NULL;
     }
     
     return mpi;
--- a/libmpcodecs/vf_palette.c	Thu May 30 00:08:47 2002 +0000
+++ b/libmpcodecs/vf_palette.c	Thu May 30 00:26:23 2002 +0000
@@ -29,6 +29,8 @@
     0
 };
 
+static unsigned int gray_pal[256];
+
 static unsigned int find_best(struct vf_instance_s* vf, unsigned int fmt){
     unsigned int best=0;
     int ret;
@@ -73,6 +75,8 @@
 	MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
 	mpi->w, mpi->h);
 
+    if(!mpi->planes[1]) mpi->planes[1]=gray_pal;
+
     if(mpi->w==mpi->stride[0] && dmpi->w*(dmpi->bpp>>3)==dmpi->stride[0]){
 	// no stride conversion needed
 	switch(dmpi->imgfmt&255){
@@ -119,10 +123,12 @@
 }
 
 static int open(vf_instance_t *vf, char* args){
+    unsigned int i;
     vf->config=config;
     vf->put_image=put_image;
     vf->query_format=query_format;
     vf->priv=malloc(sizeof(struct vf_priv_s));
+    for(i=0;i<256;i++) gray_pal[i]=0x01010101*i;
     return 1;
 }