mirror of
https://github.com/mpv-player/mpv
synced 2025-01-18 13:14:36 +00:00
planar yuv 444 422 411 support
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@6864 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
8f7938b386
commit
bfe5d4d4b4
@ -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},
|
||||
|
@ -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");
|
||||
|
@ -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
|
||||
|
@ -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 */
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user