From 281381185222544409a88bd027179bc6be104b59 Mon Sep 17 00:00:00 2001 From: alex Date: Thu, 11 Jul 2002 19:08:23 +0000 Subject: [PATCH] better support for rgb/bgr formats git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@6708 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/mp_image.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/libmpcodecs/mp_image.h b/libmpcodecs/mp_image.h index d81b24c313..4ca552af64 100644 --- a/libmpcodecs/mp_image.h +++ b/libmpcodecs/mp_image.h @@ -71,15 +71,19 @@ static inline void mp_image_setfmt(mp_image_t* mpi,unsigned int out_fmt){ return; } mpi->num_planes=1; - if( (out_fmt&IMGFMT_RGB_MASK) == IMGFMT_RGB ){ - mpi->bpp=((out_fmt&255)+7)&(~7); - if(out_fmt==IMGFMT_RGB1) mpi->bpp=1; + if (IMGFMT_IS_RGB(out_fmt)) { + if (IMGFMT_RGB_DEPTH(out_fmt) < 8) + mpi->bpp = IMGFMT_RGB_DEPTH(out_fmt); + else + mpi->bpp=(IMGFMT_RGB_DEPTH(out_fmt)+7)&(~7); return; } - if( (out_fmt&IMGFMT_BGR_MASK) == IMGFMT_BGR ){ - mpi->bpp=((out_fmt&255)+7)&(~7); + if (IMGFMT_IS_BGR(out_fmt)) { + if (IMGFMT_BGR_DEPTH(out_fmt) < 8) + mpi->bpp = IMGFMT_BGR_DEPTH(out_fmt); + else + mpi->bpp=(IMGFMT_BGR_DEPTH(out_fmt)+7)&(~7); mpi->flags|=MP_IMGFLAG_SWAPPED; - if(out_fmt==IMGFMT_BGR1) mpi->bpp=1; return; } mpi->flags|=MP_IMGFLAG_YUV;