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:
reimar 2009-12-31 23:45:07 +00:00
parent c07dec1a4a
commit 8afc25d710
9 changed files with 23 additions and 4 deletions

View File

@ -161,6 +161,7 @@ static int add_to_format(char *s, char *alias,unsigned int *fourcc, unsigned int
{"444P16", IMGFMT_444P16}, {"444P16", IMGFMT_444P16},
{"422P16", IMGFMT_422P16}, {"422P16", IMGFMT_422P16},
{"420P16", IMGFMT_420P16}, {"420P16", IMGFMT_420P16},
{"420A", IMGFMT_420A},
{"444P", IMGFMT_444P}, {"444P", IMGFMT_444P},
{"422P", IMGFMT_422P}, {"422P", IMGFMT_422P},
{"411P", IMGFMT_411P}, {"411P", IMGFMT_411P},

View File

@ -2060,7 +2060,7 @@ videocodec ffvp6a
fourcc VP6A fourcc VP6A
driver ffmpeg driver ffmpeg
dll "vp6a" dll "vp6a"
out I420,YUY2,YV12 out 420A
videocodec ffvp6f videocodec ffvp6f
info "FFmpeg VP6 Flash" info "FFmpeg VP6 Flash"

View File

@ -59,6 +59,9 @@ static const struct {
{IMGFMT_422P, PIX_FMT_YUV422P}, {IMGFMT_422P, PIX_FMT_YUV422P},
{IMGFMT_444P, PIX_FMT_YUV444P}, {IMGFMT_444P, PIX_FMT_YUV444P},
{IMGFMT_440P, PIX_FMT_YUV440P}, {IMGFMT_440P, PIX_FMT_YUV440P},
{IMGFMT_420A, PIX_FMT_YUVA420P},
{IMGFMT_420P16_LE, PIX_FMT_YUV420P16LE}, {IMGFMT_420P16_LE, PIX_FMT_YUV420P16LE},
{IMGFMT_420P16_BE, PIX_FMT_YUV420P16BE}, {IMGFMT_420P16_BE, PIX_FMT_YUV420P16BE},
{IMGFMT_422P16_LE, PIX_FMT_YUV422P16LE}, {IMGFMT_422P16_LE, PIX_FMT_YUV422P16LE},

View File

@ -43,6 +43,7 @@ const char *vo_format_name(int format)
case IMGFMT_422P16_BE: return "Planar 422P 16-bit big-endian"; 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_LE: return "Planar 444P 16-bit little-endian";
case IMGFMT_444P16_BE: return "Planar 444P 16-bit big-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_444P: return "Planar 444P";
case IMGFMT_422P: return "Planar 422P"; case IMGFMT_422P: return "Planar 422P";
case IMGFMT_411P: return "Planar 411P"; 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_LE:
case IMGFMT_420P16_BE: case IMGFMT_420P16_BE:
bpp_factor = 2; bpp_factor = 2;
case IMGFMT_420A:
case IMGFMT_I420: case IMGFMT_I420:
case IMGFMT_IYUV: case IMGFMT_IYUV:
case IMGFMT_YV12: 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 (x_shift) *x_shift = xs;
if (y_shift) *y_shift = ys; if (y_shift) *y_shift = ys;
bpp = 8 + (16 >> (xs + ys)); bpp = 8 + (16 >> (xs + ys));
if (format == IMGFMT_420A)
bpp += 8;
bpp *= bpp_factor; bpp *= bpp_factor;
return err ? 0 : bpp; return err ? 0 : bpp;
} }

View File

@ -73,6 +73,10 @@
#define IMGFMT_411P 0x50313134 #define IMGFMT_411P 0x50313134
#define IMGFMT_440P 0x50303434 #define IMGFMT_440P 0x50303434
#define IMGFMT_HM12 0x32314D48 #define IMGFMT_HM12 0x32314D48
// 4:2:0 planar with alpha
#define IMGFMT_420A 0x41303234
#define IMGFMT_444P16_LE 0x51343434 #define IMGFMT_444P16_LE 0x51343434
#define IMGFMT_444P16_BE 0x34343451 #define IMGFMT_444P16_BE 0x34343451
#define IMGFMT_422P16_LE 0x51323234 #define IMGFMT_422P16_LE 0x51323234

View File

@ -19,24 +19,26 @@ void mp_image_alloc_planes(mp_image_t *mpi) {
if (mpi->imgfmt == IMGFMT_IF09) { if (mpi->imgfmt == IMGFMT_IF09) {
mpi->planes[0]=memalign(64, mpi->bpp*mpi->width*(mpi->height+2)/8+ mpi->planes[0]=memalign(64, mpi->bpp*mpi->width*(mpi->height+2)/8+
mpi->chroma_width*mpi->chroma_height); 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 } else
mpi->planes[0]=memalign(64, mpi->bpp*mpi->width*(mpi->height+2)/8); mpi->planes[0]=memalign(64, mpi->bpp*mpi->width*(mpi->height+2)/8);
if (mpi->flags&MP_IMGFLAG_PLANAR) { if (mpi->flags&MP_IMGFLAG_PLANAR) {
int bpp = IMGFMT_IS_YUVP16(mpi->imgfmt)? 2 : 1; int bpp = IMGFMT_IS_YUVP16(mpi->imgfmt)? 2 : 1;
// YV12/I420/YVU9/IF09. feel free to add other planar formats here... // 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){ if(mpi->num_planes > 2){
mpi->stride[1]=mpi->stride[2]=bpp*mpi->chroma_width; mpi->stride[1]=mpi->stride[2]=bpp*mpi->chroma_width;
if(mpi->flags&MP_IMGFLAG_SWAPPED){ if(mpi->flags&MP_IMGFLAG_SWAPPED){
// I420/IYUV (Y,U,V) // I420/IYUV (Y,U,V)
mpi->planes[1]=mpi->planes[0]+mpi->stride[0]*mpi->height; mpi->planes[1]=mpi->planes[0]+mpi->stride[0]*mpi->height;
mpi->planes[2]=mpi->planes[1]+mpi->stride[1]*mpi->chroma_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 { } else {
// YV12,YVU9,IF09 (Y,V,U) // YV12,YVU9,IF09 (Y,V,U)
mpi->planes[2]=mpi->planes[0]+mpi->stride[0]*mpi->height; mpi->planes[2]=mpi->planes[0]+mpi->stride[0]*mpi->height;
mpi->planes[1]=mpi->planes[2]+mpi->stride[1]*mpi->chroma_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 { } else {
// NV12/NV21 // NV12/NV21

View File

@ -145,6 +145,7 @@ static inline void mp_image_setfmt(mp_image_t* mpi,unsigned int out_fmt){
mpi->flags|=MP_IMGFLAG_SWAPPED; mpi->flags|=MP_IMGFLAG_SWAPPED;
case IMGFMT_YV12: case IMGFMT_YV12:
return; return;
case IMGFMT_420A:
case IMGFMT_IF09: case IMGFMT_IF09:
mpi->num_planes=4; mpi->num_planes=4;
case IMGFMT_YVU9: 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); 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); void copy_mpi(mp_image_t *dmpi, mp_image_t *mpi);
#endif /* MPLAYER_MP_IMAGE_H */ #endif /* MPLAYER_MP_IMAGE_H */

View File

@ -61,6 +61,7 @@ static unsigned int outfmt_list[]={
IMGFMT_I420, IMGFMT_I420,
IMGFMT_420P16_LE, IMGFMT_420P16_LE,
IMGFMT_420P16_BE, IMGFMT_420P16_BE,
IMGFMT_420A,
IMGFMT_IYUV, IMGFMT_IYUV,
IMGFMT_YVU9, IMGFMT_YVU9,
IMGFMT_IF09, IMGFMT_IF09,
@ -480,6 +481,7 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt){
case IMGFMT_422P: case IMGFMT_422P:
case IMGFMT_411P: case IMGFMT_411P:
case IMGFMT_440P: case IMGFMT_440P:
case IMGFMT_420A:
case IMGFMT_444P16_LE: case IMGFMT_444P16_LE:
case IMGFMT_444P16_BE: case IMGFMT_444P16_BE:
case IMGFMT_422P16_LE: case IMGFMT_422P16_LE:

View File

@ -1041,6 +1041,7 @@ static struct {
{"444p16", IMGFMT_444P16}, {"444p16", IMGFMT_444P16},
{"422p16", IMGFMT_422P16}, {"422p16", IMGFMT_422P16},
{"420p16", IMGFMT_420P16}, {"420p16", IMGFMT_420P16},
{"420a", IMGFMT_420A},
{"444p", IMGFMT_444P}, {"444p", IMGFMT_444P},
{"422p", IMGFMT_422P}, {"422p", IMGFMT_422P},
{"411p", IMGFMT_411P}, {"411p", IMGFMT_411P},