mirror of https://github.com/mpv-player/mpv
Add support for YUV format with alpha and fix the codecs.conf entry for vp6a
to use it. Fixes playback of samples in http://samples.mplayerhq.hu/FLV/flash_with_alpha/ git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30157 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
c07dec1a4a
commit
8afc25d710
|
@ -161,6 +161,7 @@ static int add_to_format(char *s, char *alias,unsigned int *fourcc, unsigned int
|
|||
{"444P16", IMGFMT_444P16},
|
||||
{"422P16", IMGFMT_422P16},
|
||||
{"420P16", IMGFMT_420P16},
|
||||
{"420A", IMGFMT_420A},
|
||||
{"444P", IMGFMT_444P},
|
||||
{"422P", IMGFMT_422P},
|
||||
{"411P", IMGFMT_411P},
|
||||
|
|
|
@ -2060,7 +2060,7 @@ videocodec ffvp6a
|
|||
fourcc VP6A
|
||||
driver ffmpeg
|
||||
dll "vp6a"
|
||||
out I420,YUY2,YV12
|
||||
out 420A
|
||||
|
||||
videocodec ffvp6f
|
||||
info "FFmpeg VP6 Flash"
|
||||
|
|
|
@ -59,6 +59,9 @@ static const struct {
|
|||
{IMGFMT_422P, PIX_FMT_YUV422P},
|
||||
{IMGFMT_444P, PIX_FMT_YUV444P},
|
||||
{IMGFMT_440P, PIX_FMT_YUV440P},
|
||||
|
||||
{IMGFMT_420A, PIX_FMT_YUVA420P},
|
||||
|
||||
{IMGFMT_420P16_LE, PIX_FMT_YUV420P16LE},
|
||||
{IMGFMT_420P16_BE, PIX_FMT_YUV420P16BE},
|
||||
{IMGFMT_422P16_LE, PIX_FMT_YUV422P16LE},
|
||||
|
|
|
@ -43,6 +43,7 @@ const char *vo_format_name(int format)
|
|||
case IMGFMT_422P16_BE: return "Planar 422P 16-bit big-endian";
|
||||
case IMGFMT_444P16_LE: return "Planar 444P 16-bit little-endian";
|
||||
case IMGFMT_444P16_BE: return "Planar 444P 16-bit big-endian";
|
||||
case IMGFMT_420A: return "Planar 420P with alpha";
|
||||
case IMGFMT_444P: return "Planar 444P";
|
||||
case IMGFMT_422P: return "Planar 422P";
|
||||
case IMGFMT_411P: return "Planar 411P";
|
||||
|
@ -96,6 +97,7 @@ int mp_get_chroma_shift(int format, int *x_shift, int *y_shift)
|
|||
case IMGFMT_420P16_LE:
|
||||
case IMGFMT_420P16_BE:
|
||||
bpp_factor = 2;
|
||||
case IMGFMT_420A:
|
||||
case IMGFMT_I420:
|
||||
case IMGFMT_IYUV:
|
||||
case IMGFMT_YV12:
|
||||
|
@ -136,6 +138,8 @@ int mp_get_chroma_shift(int format, int *x_shift, int *y_shift)
|
|||
if (x_shift) *x_shift = xs;
|
||||
if (y_shift) *y_shift = ys;
|
||||
bpp = 8 + (16 >> (xs + ys));
|
||||
if (format == IMGFMT_420A)
|
||||
bpp += 8;
|
||||
bpp *= bpp_factor;
|
||||
return err ? 0 : bpp;
|
||||
}
|
||||
|
|
|
@ -73,6 +73,10 @@
|
|||
#define IMGFMT_411P 0x50313134
|
||||
#define IMGFMT_440P 0x50303434
|
||||
#define IMGFMT_HM12 0x32314D48
|
||||
|
||||
// 4:2:0 planar with alpha
|
||||
#define IMGFMT_420A 0x41303234
|
||||
|
||||
#define IMGFMT_444P16_LE 0x51343434
|
||||
#define IMGFMT_444P16_BE 0x34343451
|
||||
#define IMGFMT_422P16_LE 0x51323234
|
||||
|
|
|
@ -19,24 +19,26 @@ void mp_image_alloc_planes(mp_image_t *mpi) {
|
|||
if (mpi->imgfmt == IMGFMT_IF09) {
|
||||
mpi->planes[0]=memalign(64, mpi->bpp*mpi->width*(mpi->height+2)/8+
|
||||
mpi->chroma_width*mpi->chroma_height);
|
||||
/* export delta table */
|
||||
mpi->planes[3]=mpi->planes[0]+(mpi->width*mpi->height)+2*(mpi->chroma_width*mpi->chroma_height);
|
||||
} else
|
||||
mpi->planes[0]=memalign(64, mpi->bpp*mpi->width*(mpi->height+2)/8);
|
||||
if (mpi->flags&MP_IMGFLAG_PLANAR) {
|
||||
int bpp = IMGFMT_IS_YUVP16(mpi->imgfmt)? 2 : 1;
|
||||
// YV12/I420/YVU9/IF09. feel free to add other planar formats here...
|
||||
mpi->stride[0]=bpp*mpi->width;
|
||||
mpi->stride[0]=mpi->stride[3]=bpp*mpi->width;
|
||||
if(mpi->num_planes > 2){
|
||||
mpi->stride[1]=mpi->stride[2]=bpp*mpi->chroma_width;
|
||||
if(mpi->flags&MP_IMGFLAG_SWAPPED){
|
||||
// I420/IYUV (Y,U,V)
|
||||
mpi->planes[1]=mpi->planes[0]+mpi->stride[0]*mpi->height;
|
||||
mpi->planes[2]=mpi->planes[1]+mpi->stride[1]*mpi->chroma_height;
|
||||
if (mpi->num_planes > 3)
|
||||
mpi->planes[3]=mpi->planes[2]+mpi->stride[2]*mpi->chroma_height;
|
||||
} else {
|
||||
// YV12,YVU9,IF09 (Y,V,U)
|
||||
mpi->planes[2]=mpi->planes[0]+mpi->stride[0]*mpi->height;
|
||||
mpi->planes[1]=mpi->planes[2]+mpi->stride[1]*mpi->chroma_height;
|
||||
if (mpi->num_planes > 3)
|
||||
mpi->planes[3]=mpi->planes[1]+mpi->stride[1]*mpi->chroma_height;
|
||||
}
|
||||
} else {
|
||||
// NV12/NV21
|
||||
|
|
|
@ -145,6 +145,7 @@ static inline void mp_image_setfmt(mp_image_t* mpi,unsigned int out_fmt){
|
|||
mpi->flags|=MP_IMGFLAG_SWAPPED;
|
||||
case IMGFMT_YV12:
|
||||
return;
|
||||
case IMGFMT_420A:
|
||||
case IMGFMT_IF09:
|
||||
mpi->num_planes=4;
|
||||
case IMGFMT_YVU9:
|
||||
|
@ -210,6 +211,7 @@ static inline void free_mp_image(mp_image_t* mpi){
|
|||
}
|
||||
|
||||
mp_image_t* alloc_mpi(int w, int h, unsigned long int fmt);
|
||||
void mp_image_alloc_planes(mp_image_t *mpi);
|
||||
void copy_mpi(mp_image_t *dmpi, mp_image_t *mpi);
|
||||
|
||||
#endif /* MPLAYER_MP_IMAGE_H */
|
||||
|
|
|
@ -61,6 +61,7 @@ static unsigned int outfmt_list[]={
|
|||
IMGFMT_I420,
|
||||
IMGFMT_420P16_LE,
|
||||
IMGFMT_420P16_BE,
|
||||
IMGFMT_420A,
|
||||
IMGFMT_IYUV,
|
||||
IMGFMT_YVU9,
|
||||
IMGFMT_IF09,
|
||||
|
@ -480,6 +481,7 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt){
|
|||
case IMGFMT_422P:
|
||||
case IMGFMT_411P:
|
||||
case IMGFMT_440P:
|
||||
case IMGFMT_420A:
|
||||
case IMGFMT_444P16_LE:
|
||||
case IMGFMT_444P16_BE:
|
||||
case IMGFMT_422P16_LE:
|
||||
|
|
|
@ -1041,6 +1041,7 @@ static struct {
|
|||
{"444p16", IMGFMT_444P16},
|
||||
{"422p16", IMGFMT_422P16},
|
||||
{"420p16", IMGFMT_420P16},
|
||||
{"420a", IMGFMT_420A},
|
||||
{"444p", IMGFMT_444P},
|
||||
{"422p", IMGFMT_422P},
|
||||
{"411p", IMGFMT_411P},
|
||||
|
|
Loading…
Reference in New Issue