changeset 6707:3f0c724dac75

better support for rgb/bgr formats
author alex
date Thu, 11 Jul 2002 19:08:23 +0000
parents e1428c2c971f
children 8058078f1248
files libmpcodecs/mp_image.h
diffstat 1 files changed, 10 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/mp_image.h	Thu Jul 11 18:49:18 2002 +0000
+++ b/libmpcodecs/mp_image.h	Thu Jul 11 19:08:23 2002 +0000
@@ -71,15 +71,19 @@
 	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;