changeset 6863:713182435a76

planar yuv 444 422 411 support
author michael
date Thu, 01 Aug 2002 12:39:08 +0000
parents fe7095e0adec
children faf4ce66374f
files codec-cfg.c libmpcodecs/img_format.c libmpcodecs/img_format.h libmpcodecs/mp_image.h libmpcodecs/vf_scale.c postproc/swscale.c
diffstat 6 files changed, 61 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/codec-cfg.c	Thu Aug 01 08:53:32 2002 +0000
+++ b/codec-cfg.c	Thu Aug 01 12:39:08 2002 +0000
@@ -120,6 +120,9 @@
 		{"IYUV",  IMGFMT_IYUV},
 		{"YVU9",  IMGFMT_YVU9},
 		{"IF09",  IMGFMT_IF09},
+		{"444P",  IMGFMT_444P},
+		{"422P",  IMGFMT_422P},
+		{"411P",  IMGFMT_411P},
 
 		{"YUY2",  IMGFMT_YUY2},
 		{"UYVY",  IMGFMT_UYVY},
@@ -268,7 +271,7 @@
 	};
         char **drv=audioflag?audiodrv:videodrv;
         int i;
-        
+
         for(i=0;drv[i];i++) if(!strcmp(s,drv[i])) return i;
 
 	return -1;
--- a/libmpcodecs/img_format.c	Thu Aug 01 08:53:32 2002 +0000
+++ b/libmpcodecs/img_format.c	Thu Aug 01 12:39:08 2002 +0000
@@ -26,6 +26,9 @@
 	case IMGFMT_CLPL: return("Planar CLPL");
 	case IMGFMT_Y800: return("Planar Y800");
 	case IMGFMT_Y8: return("Planar Y8");
+	case IMGFMT_444P: return("Planar 444P");
+	case IMGFMT_422P: return("Planar 422P");
+	case IMGFMT_411P: return("Planar 411P");
 	case IMGFMT_NV12: return("Planar NV12");
 	case IMGFMT_IUYV: return("Packed IUYV");
 	case IMGFMT_IY41: return("Packed IY41");
--- a/libmpcodecs/img_format.h	Thu Aug 01 08:53:32 2002 +0000
+++ b/libmpcodecs/img_format.h	Thu Aug 01 12:39:08 2002 +0000
@@ -43,6 +43,11 @@
 #define IMGFMT_Y8   0x20203859
 #define IMGFMT_NV12 0x3231564E
 
+/* unofficial Planar Formats, FIXME if official 4CC exists */
+#define IMGFMT_444P 0x50343434
+#define IMGFMT_422P 0x50323234
+#define IMGFMT_411P 0x50313134
+
 /* Packed YUV Formats */
 
 #define IMGFMT_IUYV 0x56595549
--- a/libmpcodecs/mp_image.h	Thu Aug 01 08:53:32 2002 +0000
+++ b/libmpcodecs/mp_image.h	Thu Aug 01 12:39:08 2002 +0000
@@ -112,6 +112,30 @@
 	mpi->chroma_x_shift=2;
 	mpi->chroma_y_shift=2;
 	return;
+    case IMGFMT_444P:
+	mpi->flags|=MP_IMGFLAG_PLANAR;
+	mpi->bpp=24;
+	mpi->chroma_width=(mpi->width);
+	mpi->chroma_height=(mpi->height);
+	mpi->chroma_x_shift=0;
+	mpi->chroma_y_shift=0;
+	return;
+    case IMGFMT_422P:
+	mpi->flags|=MP_IMGFLAG_PLANAR;
+	mpi->bpp=16;
+	mpi->chroma_width=(mpi->width>>1);
+	mpi->chroma_height=(mpi->height);
+	mpi->chroma_x_shift=1;
+	mpi->chroma_y_shift=0;
+	return;
+    case IMGFMT_411P:
+	mpi->flags|=MP_IMGFLAG_PLANAR;
+	mpi->bpp=12;
+	mpi->chroma_width=(mpi->width>>2);
+	mpi->chroma_height=(mpi->height);
+	mpi->chroma_x_shift=2;
+	mpi->chroma_y_shift=0;
+	return;
     case IMGFMT_Y800:
     case IMGFMT_Y8:
 	/* they're planar ones, but for easier handling use them as packed */
--- a/libmpcodecs/vf_scale.c	Thu Aug 01 08:53:32 2002 +0000
+++ b/libmpcodecs/vf_scale.c	Thu Aug 01 12:39:08 2002 +0000
@@ -48,6 +48,9 @@
     IMGFMT_Y8,
     IMGFMT_YVU9,
     IMGFMT_IF09,
+    IMGFMT_444P,
+    IMGFMT_422P,
+    IMGFMT_411P,
     0
 };
 
@@ -202,6 +205,9 @@
     case IMGFMT_Y8: 
     case IMGFMT_YVU9: 
     case IMGFMT_IF09: 
+    case IMGFMT_444P: 
+    case IMGFMT_422P: 
+    case IMGFMT_411P: 
     {
 	unsigned int best=find_best_out(vf);
 	int flags;
--- a/postproc/swscale.c	Thu Aug 01 08:53:32 2002 +0000
+++ b/postproc/swscale.c	Thu Aug 01 12:39:08 2002 +0000
@@ -103,7 +103,8 @@
 #endif
 
 //FIXME replace this with something faster
-#define isPlanarYUV(x) ((x)==IMGFMT_YV12 || (x)==IMGFMT_I420 || (x)==IMGFMT_YVU9)
+#define isPlanarYUV(x) ((x)==IMGFMT_YV12 || (x)==IMGFMT_I420 || (x)==IMGFMT_YVU9 \
+			|| (x)==IMGFMT_444P || (x)==IMGFMT_422P || (x)==IMGFMT_411P)
 #define isYUV(x)       ((x)==IMGFMT_YUY2 || isPlanarYUV(x))
 #define isGray(x)      ((x)==IMGFMT_Y800)
 #define isRGB(x)       (((x)&IMGFMT_RGB_MASK)==IMGFMT_RGB)
@@ -111,8 +112,10 @@
 #define isSupportedIn(x)  ((x)==IMGFMT_YV12 || (x)==IMGFMT_I420 || (x)==IMGFMT_YUY2 \
 			|| (x)==IMGFMT_BGR32|| (x)==IMGFMT_BGR24|| (x)==IMGFMT_BGR16|| (x)==IMGFMT_BGR15\
 			|| (x)==IMGFMT_RGB32|| (x)==IMGFMT_RGB24\
-			|| (x)==IMGFMT_Y800 || (x)==IMGFMT_YVU9)
+			|| (x)==IMGFMT_Y800 || (x)==IMGFMT_YVU9\
+			|| (x)==IMGFMT_444P || (x)==IMGFMT_422P || (x)==IMGFMT_411P)
 #define isSupportedOut(x) ((x)==IMGFMT_YV12 || (x)==IMGFMT_I420 \
+			|| (x)==IMGFMT_444P || (x)==IMGFMT_422P || (x)==IMGFMT_411P\
 			|| isRGB(x) || isBGR(x)\
 			|| (x)==IMGFMT_Y800 || (x)==IMGFMT_YVU9)
 #define isPacked(x)    ((x)==IMGFMT_YUY2 || isRGB(x) || isBGR(x))
@@ -1757,7 +1760,8 @@
  * bring pointers in YUV order instead of YVU
  */
 static inline void orderYUV(int format, uint8_t * sortedP[], int sortedStride[], uint8_t * p[], int stride[]){
-	if(format == IMGFMT_YV12 || format == IMGFMT_YVU9){
+	if(format == IMGFMT_YV12 || format == IMGFMT_YVU9 
+           || format == IMGFMT_444P || format == IMGFMT_422P || format == IMGFMT_411P){
 		sortedP[0]= p[0];
 		sortedP[1]= p[1];
 		sortedP[2]= p[2];
@@ -1885,6 +1889,18 @@
 		*h=2;
 		*v=2;
 		break;
+	case IMGFMT_444P:
+		*h=0;
+		*v=0;
+		break;
+	case IMGFMT_422P:
+		*h=1;
+		*v=0;
+		break;
+	case IMGFMT_411P:
+		*h=2;
+		*v=0;
+		break;
 	default:
 		*h=0;
 		*v=0;