[Mplayer-cvslog] CVS: main/libmpcodecs img_format.c,1.5,1.6 img_format.h,1.10,1.11 vf_format.c,1.8,1.9 vf_scale.c,1.28,1.29 mp_image.h,1.21,1.22

Michael Niedermayer CVS michael at mplayerhq.hu
Thu Jan 30 10:15:42 CET 2003


Update of /cvsroot/mplayer/main/libmpcodecs
In directory mail:/var/tmp.root/cvs-serv19941/libmpcodecs

Modified Files:
	img_format.c img_format.h vf_format.c vf_scale.c mp_image.h 
Log Message:
fixing rgb4 & bgr4 (2 pixels per byte)
adding bg4b & rg4b (1 pixel per byte)


Index: img_format.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/img_format.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- img_format.c	1 Aug 2002 12:39:07 -0000	1.5
+++ img_format.c	30 Jan 2003 09:14:58 -0000	1.6
@@ -6,6 +6,7 @@
     {
 	case IMGFMT_RGB1: return("RGB 1-bit");
 	case IMGFMT_RGB4: return("RGB 4-bit");
+	case IMGFMT_RG4B: return("RGB 4-bit per byte");
 	case IMGFMT_RGB8: return("RGB 8-bit");
 	case IMGFMT_RGB15: return("RGB 15-bit");
 	case IMGFMT_RGB16: return("RGB 16-bit");
@@ -13,6 +14,7 @@
 	case IMGFMT_RGB32: return("RGB 32-bit");
 	case IMGFMT_BGR1: return("BGR 1-bit");
 	case IMGFMT_BGR4: return("BGR 4-bit");
+	case IMGFMT_BG4B: return("BGR 4-bit per byte");
 	case IMGFMT_BGR8: return("BGR 8-bit");
 	case IMGFMT_BGR15: return("BGR 15-bit");
 	case IMGFMT_BGR16: return("BGR 16-bit");

Index: img_format.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/img_format.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- img_format.h	26 Jan 2003 22:24:48 -0000	1.10
+++ img_format.h	30 Jan 2003 09:14:58 -0000	1.11
@@ -8,6 +8,7 @@
 #define IMGFMT_RGB (('R'<<24)|('G'<<16)|('B'<<8))
 #define IMGFMT_RGB1  (IMGFMT_RGB|1)
 #define IMGFMT_RGB4  (IMGFMT_RGB|4)
+#define IMGFMT_RG4B  (IMGFMT_RGB|4|128) // RGB4 with 1 pixel per byte
 #define IMGFMT_RGB8  (IMGFMT_RGB|8)
 #define IMGFMT_RGB15 (IMGFMT_RGB|15)
 #define IMGFMT_RGB16 (IMGFMT_RGB|16)
@@ -18,6 +19,7 @@
 #define IMGFMT_BGR (('B'<<24)|('G'<<16)|('R'<<8))
 #define IMGFMT_BGR1 (IMGFMT_BGR|1)
 #define IMGFMT_BGR4 (IMGFMT_BGR|4)
+#define IMGFMT_BG4B (IMGFMT_BGR|4|128) // BGR4 with 1 pixel per byte
 #define IMGFMT_BGR8 (IMGFMT_BGR|8)
 #define IMGFMT_BGR15 (IMGFMT_BGR|15)
 #define IMGFMT_BGR16 (IMGFMT_BGR|16)
@@ -27,8 +29,8 @@
 #define IMGFMT_IS_RGB(fmt) (((fmt)&IMGFMT_RGB_MASK)==IMGFMT_RGB)
 #define IMGFMT_IS_BGR(fmt) (((fmt)&IMGFMT_BGR_MASK)==IMGFMT_BGR)
 
-#define IMGFMT_RGB_DEPTH(fmt) ((fmt)&~IMGFMT_RGB_MASK)
-#define IMGFMT_BGR_DEPTH(fmt) ((fmt)&~IMGFMT_BGR_MASK)
+#define IMGFMT_RGB_DEPTH(fmt) ((fmt)&0x3F)
+#define IMGFMT_BGR_DEPTH(fmt) ((fmt)&0x3F)
 
 
 /* Planar YUV Formats */

Index: vf_format.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vf_format.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- vf_format.c	2 Aug 2002 19:36:31 -0000	1.8
+++ vf_format.c	30 Jan 2003 09:14:58 -0000	1.9
@@ -44,6 +44,7 @@
 	if(!strcasecmp(args,"bgr15")) vf->priv->fmt=IMGFMT_BGR15; else
 	if(!strcasecmp(args,"bgr8")) vf->priv->fmt=IMGFMT_BGR8; else
 	if(!strcasecmp(args,"bgr4")) vf->priv->fmt=IMGFMT_BGR4; else
+	if(!strcasecmp(args,"bg4b")) vf->priv->fmt=IMGFMT_BG4B; else
 	if(!strcasecmp(args,"bgr1")) vf->priv->fmt=IMGFMT_BGR1; else
 	if(!strcasecmp(args,"rgb24")) vf->priv->fmt=IMGFMT_RGB24; else
 	if(!strcasecmp(args,"rgb32")) vf->priv->fmt=IMGFMT_RGB32; else
@@ -51,6 +52,7 @@
 	if(!strcasecmp(args,"rgb15")) vf->priv->fmt=IMGFMT_RGB15; else
 	if(!strcasecmp(args,"rgb8")) vf->priv->fmt=IMGFMT_RGB8; else
 	if(!strcasecmp(args,"rgb4")) vf->priv->fmt=IMGFMT_RGB4; else
+	if(!strcasecmp(args,"rg4b")) vf->priv->fmt=IMGFMT_RG4B; else
 	if(!strcasecmp(args,"rgb1")) vf->priv->fmt=IMGFMT_RGB1; else
 	{ printf("Unknown format name: '%s'\n",args);return 0;}
     } else

Index: vf_scale.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vf_scale.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- vf_scale.c	23 Jan 2003 09:35:05 -0000	1.28
+++ vf_scale.c	30 Jan 2003 09:14:58 -0000	1.29
@@ -41,6 +41,8 @@
     IMGFMT_RGB8,
     IMGFMT_BGR4,
     IMGFMT_RGB4,
+    IMGFMT_BG4B,
+    IMGFMT_RG4B,
     IMGFMT_BGR1,
     IMGFMT_RGB1,
 // YUV:
@@ -178,7 +180,8 @@
 	    vf->priv->palette[4*i+2]=4*((i>>5)&7)*9;
 	}
 	break; }
-    case IMGFMT_BGR4: {
+    case IMGFMT_BGR4: 
+    case IMGFMT_BG4B: {
 	int i;
 	vf->priv->palette=malloc(4*16);
 	for(i=0; i<16; i++){

Index: mp_image.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/mp_image.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- mp_image.h	30 Oct 2002 20:50:10 -0000	1.21
+++ mp_image.h	30 Jan 2003 09:14:58 -0000	1.22
@@ -96,14 +96,14 @@
     }
     mpi->num_planes=1;
     if (IMGFMT_IS_RGB(out_fmt)) {
-	if (IMGFMT_RGB_DEPTH(out_fmt) < 8)
+	if (IMGFMT_RGB_DEPTH(out_fmt) < 8 && !(out_fmt&128))
 	    mpi->bpp = IMGFMT_RGB_DEPTH(out_fmt);
 	else
 	    mpi->bpp=(IMGFMT_RGB_DEPTH(out_fmt)+7)&(~7);
 	return;
     }
     if (IMGFMT_IS_BGR(out_fmt)) {
-	if (IMGFMT_BGR_DEPTH(out_fmt) < 8)
+	if (IMGFMT_BGR_DEPTH(out_fmt) < 8 && !(out_fmt&128))
 	    mpi->bpp = IMGFMT_BGR_DEPTH(out_fmt);
 	else
 	    mpi->bpp=(IMGFMT_BGR_DEPTH(out_fmt)+7)&(~7);



More information about the MPlayer-cvslog mailing list