From 38e810acbad702861f9ee2104370b2988b82d850 Mon Sep 17 00:00:00 2001 From: arpi Date: Thu, 30 May 2002 00:26:23 +0000 Subject: grayscaled palette support git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@6233 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/vd_vfw.c | 6 +++++- libmpcodecs/vf_palette.c | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'libmpcodecs') diff --git a/libmpcodecs/vd_vfw.c b/libmpcodecs/vd_vfw.c index 97fe2cee31..87cc374093 100644 --- a/libmpcodecs/vd_vfw.c +++ b/libmpcodecs/vd_vfw.c @@ -94,7 +94,11 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ 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; diff --git a/libmpcodecs/vf_palette.c b/libmpcodecs/vf_palette.c index f858757a3c..3aae0fb8a2 100644 --- a/libmpcodecs/vf_palette.c +++ b/libmpcodecs/vf_palette.c @@ -29,6 +29,8 @@ static unsigned int rgb_list[]={ 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 @@ static void put_image(struct vf_instance_s* vf, mp_image_t *mpi){ 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 query_format(struct vf_instance_s* vf, unsigned int fmt){ } 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; } -- cgit v1.2.3