summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--codec-cfg.c5
-rw-r--r--libmpcodecs/img_format.c3
-rw-r--r--libmpcodecs/img_format.h5
-rw-r--r--libmpcodecs/mp_image.h24
-rw-r--r--libmpcodecs/vf_scale.c6
-rw-r--r--postproc/swscale.c22
6 files changed, 61 insertions, 4 deletions
diff --git a/codec-cfg.c b/codec-cfg.c
index b48cf4de81..0eafa56819 100644
--- a/codec-cfg.c
+++ b/codec-cfg.c
@@ -120,6 +120,9 @@ static int add_to_format(char *s, unsigned int *fourcc, unsigned int *fourccmap)
{"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 @@ static short get_driver(char *s,int audioflag)
};
char **drv=audioflag?audiodrv:videodrv;
int i;
-
+
for(i=0;drv[i];i++) if(!strcmp(s,drv[i])) return i;
return -1;
diff --git a/libmpcodecs/img_format.c b/libmpcodecs/img_format.c
index 912e5d0be6..5dc0b719e9 100644
--- a/libmpcodecs/img_format.c
+++ b/libmpcodecs/img_format.c
@@ -26,6 +26,9 @@ char *vo_format_name(int format)
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");
diff --git a/libmpcodecs/img_format.h b/libmpcodecs/img_format.h
index 467ebe1873..7df922e622 100644
--- a/libmpcodecs/img_format.h
+++ b/libmpcodecs/img_format.h
@@ -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
diff --git a/libmpcodecs/mp_image.h b/libmpcodecs/mp_image.h
index 04155dbf48..df7ae7e1e9 100644
--- a/libmpcodecs/mp_image.h
+++ b/libmpcodecs/mp_image.h
@@ -112,6 +112,30 @@ static inline void mp_image_setfmt(mp_image_t* mpi,unsigned int out_fmt){
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 */
diff --git a/libmpcodecs/vf_scale.c b/libmpcodecs/vf_scale.c
index 6b05d9b27d..0b201a770e 100644
--- a/libmpcodecs/vf_scale.c
+++ b/libmpcodecs/vf_scale.c
@@ -48,6 +48,9 @@ static unsigned int outfmt_list[]={
IMGFMT_Y8,
IMGFMT_YVU9,
IMGFMT_IF09,
+ IMGFMT_444P,
+ IMGFMT_422P,
+ IMGFMT_411P,
0
};
@@ -202,6 +205,9 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt){
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;
diff --git a/postproc/swscale.c b/postproc/swscale.c
index 8f0273aa0d..c5622e4e94 100644
--- a/postproc/swscale.c
+++ b/postproc/swscale.c
@@ -103,7 +103,8 @@ untested special converters
#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 @@ untested special converters
#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 @@ static void yvu9toyv12Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], in
* 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 @@ static void getSubSampleFactors(int *h, int *v, int format){
*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;