diff --git a/codec-cfg.c b/codec-cfg.c index 98b3088516..c8d22671b6 100644 --- a/codec-cfg.c +++ b/codec-cfg.c @@ -215,6 +215,7 @@ static const struct { {"BGR32", IMGFMT_BGR32}, {"RGB1", IMGFMT_RGB1}, {"BGR1", IMGFMT_BGR1}, + {"GBR24P", IMGFMT_GBR24P}, {"MPES", IMGFMT_MPEGPES}, diff --git a/fmt-conversion.c b/fmt-conversion.c index 6ab6a4b82f..2648811b89 100644 --- a/fmt-conversion.c +++ b/fmt-conversion.c @@ -55,6 +55,7 @@ static const struct { {IMGFMT_RGB8, PIX_FMT_BGR8}, {IMGFMT_RGB4, PIX_FMT_BGR4}, {IMGFMT_BGR8, PIX_FMT_PAL8}, + {IMGFMT_GBR24P, PIX_FMT_GBRP}, {IMGFMT_YUY2, PIX_FMT_YUYV422}, {IMGFMT_UYVY, PIX_FMT_UYVY422}, {IMGFMT_NV12, PIX_FMT_NV12}, diff --git a/libmpcodecs/img_format.c b/libmpcodecs/img_format.c index c4884f3eca..0938cce19f 100644 --- a/libmpcodecs/img_format.c +++ b/libmpcodecs/img_format.c @@ -50,6 +50,7 @@ const char *vo_format_name(int format) case IMGFMT_BGRA: return "BGRA"; case IMGFMT_ARGB: return "ARGB"; case IMGFMT_RGBA: return "RGBA"; + case IMGFMT_GBR24P: return "Planar GBR 24-bit"; case IMGFMT_YVU9: return "Planar YVU9"; case IMGFMT_IF09: return "Planar IF09"; case IMGFMT_YV12: return "Planar YV12"; diff --git a/libmpcodecs/img_format.h b/libmpcodecs/img_format.h index 3056e29268..825bda35b3 100644 --- a/libmpcodecs/img_format.h +++ b/libmpcodecs/img_format.h @@ -49,6 +49,8 @@ #define IMGFMT_BGR24 (IMGFMT_BGR|24) #define IMGFMT_BGR32 (IMGFMT_BGR|32) +#define IMGFMT_GBR24P (('G'<<24)|('B'<<16)|('R'<<8)|24) + #if HAVE_BIGENDIAN #define IMGFMT_ABGR IMGFMT_RGB32 #define IMGFMT_BGRA (IMGFMT_RGB32|64) diff --git a/libmpcodecs/mp_image.c b/libmpcodecs/mp_image.c index 4683f41174..9c4e6d6bd7 100644 --- a/libmpcodecs/mp_image.c +++ b/libmpcodecs/mp_image.c @@ -121,8 +121,13 @@ void mp_image_setfmt(mp_image_t* mpi,unsigned int out_fmt){ mpi->flags|=MP_IMGFLAG_SWAPPED; return; } - mpi->flags|=MP_IMGFLAG_YUV; mpi->num_planes=3; + if (out_fmt == IMGFMT_GBR24P) { + mpi->bpp=24; + mpi->flags|=MP_IMGFLAG_PLANAR; + return; + } + mpi->flags|=MP_IMGFLAG_YUV; if (mp_get_chroma_shift(out_fmt, NULL, NULL, NULL)) { mpi->flags|=MP_IMGFLAG_PLANAR; mpi->bpp = mp_get_chroma_shift(out_fmt, &mpi->chroma_x_shift, &mpi->chroma_y_shift, NULL); diff --git a/libmpcodecs/vf_scale.c b/libmpcodecs/vf_scale.c index b40654cee4..dd349655ac 100644 --- a/libmpcodecs/vf_scale.c +++ b/libmpcodecs/vf_scale.c @@ -107,6 +107,7 @@ static const unsigned int outfmt_list[]={ IMGFMT_RGB32, IMGFMT_BGR24, IMGFMT_RGB24, + IMGFMT_GBR24P, IMGFMT_RGB48LE, IMGFMT_RGB48BE, IMGFMT_BGR16, diff --git a/m_option.c b/m_option.c index 9e99ab8755..ba98d9c21a 100644 --- a/m_option.c +++ b/m_option.c @@ -1191,6 +1191,7 @@ static struct { {"argb", IMGFMT_ARGB}, {"bgra", IMGFMT_BGRA}, {"abgr", IMGFMT_ABGR}, + {"gbr24p", IMGFMT_GBR24P}, {"mjpeg", IMGFMT_MJPEG}, {"mjpg", IMGFMT_MJPEG}, { NULL, 0 }