diff options
author | alex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-07-11 19:08:23 +0000 |
---|---|---|
committer | alex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-07-11 19:08:23 +0000 |
commit | 281381185222544409a88bd027179bc6be104b59 (patch) | |
tree | 46979d1c05a7b986c64324d7746a9ffbae03124b /libmpcodecs | |
parent | f36c4b065b6b5ed5b79cbf423501a0a1d1a07078 (diff) | |
download | mpv-281381185222544409a88bd027179bc6be104b59.tar.bz2 mpv-281381185222544409a88bd027179bc6be104b59.tar.xz |
better support for rgb/bgr formats
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@6708 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs')
-rw-r--r-- | libmpcodecs/mp_image.h | 16 |
1 files 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; |