[MPlayer-cvslog] r30157 - in trunk: codec-cfg.c etc/codecs.conf fmt-conversion.c libmpcodecs/img_format.c libmpcodecs/img_format.h libmpcodecs/mp_image.c libmpcodecs/mp_image.h libmpcodecs/vf_scale.c m_option.c
reimar
subversion at mplayerhq.hu
Fri Jan 1 00:45:07 CET 2010
Author: reimar
Date: Fri Jan 1 00:45:07 2010
New Revision: 30157
Log:
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/
Modified:
trunk/codec-cfg.c
trunk/etc/codecs.conf
trunk/fmt-conversion.c
trunk/libmpcodecs/img_format.c
trunk/libmpcodecs/img_format.h
trunk/libmpcodecs/mp_image.c
trunk/libmpcodecs/mp_image.h
trunk/libmpcodecs/vf_scale.c
trunk/m_option.c
Modified: trunk/codec-cfg.c
==============================================================================
--- trunk/codec-cfg.c Fri Jan 1 00:39:21 2010 (r30156)
+++ trunk/codec-cfg.c Fri Jan 1 00:45:07 2010 (r30157)
@@ -161,6 +161,7 @@ static int add_to_format(char *s, char *
{"444P16", IMGFMT_444P16},
{"422P16", IMGFMT_422P16},
{"420P16", IMGFMT_420P16},
+ {"420A", IMGFMT_420A},
{"444P", IMGFMT_444P},
{"422P", IMGFMT_422P},
{"411P", IMGFMT_411P},
Modified: trunk/etc/codecs.conf
==============================================================================
--- trunk/etc/codecs.conf Fri Jan 1 00:39:21 2010 (r30156)
+++ trunk/etc/codecs.conf Fri Jan 1 00:45:07 2010 (r30157)
@@ -2060,7 +2060,7 @@ videocodec ffvp6a
fourcc VP6A
driver ffmpeg
dll "vp6a"
- out I420,YUY2,YV12
+ out 420A
videocodec ffvp6f
info "FFmpeg VP6 Flash"
Modified: trunk/fmt-conversion.c
==============================================================================
--- trunk/fmt-conversion.c Fri Jan 1 00:39:21 2010 (r30156)
+++ trunk/fmt-conversion.c Fri Jan 1 00:45:07 2010 (r30157)
@@ -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},
Modified: trunk/libmpcodecs/img_format.c
==============================================================================
--- trunk/libmpcodecs/img_format.c Fri Jan 1 00:39:21 2010 (r30156)
+++ trunk/libmpcodecs/img_format.c Fri Jan 1 00:45:07 2010 (r30157)
@@ -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
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
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;
}
Modified: trunk/libmpcodecs/img_format.h
==============================================================================
--- trunk/libmpcodecs/img_format.h Fri Jan 1 00:39:21 2010 (r30156)
+++ trunk/libmpcodecs/img_format.h Fri Jan 1 00:45:07 2010 (r30157)
@@ -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
Modified: trunk/libmpcodecs/mp_image.c
==============================================================================
--- trunk/libmpcodecs/mp_image.c Fri Jan 1 00:39:21 2010 (r30156)
+++ trunk/libmpcodecs/mp_image.c Fri Jan 1 00:45:07 2010 (r30157)
@@ -19,24 +19,26 @@ void mp_image_alloc_planes(mp_image_t *m
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
Modified: trunk/libmpcodecs/mp_image.h
==============================================================================
--- trunk/libmpcodecs/mp_image.h Fri Jan 1 00:39:21 2010 (r30156)
+++ trunk/libmpcodecs/mp_image.h Fri Jan 1 00:45:07 2010 (r30157)
@@ -145,6 +145,7 @@ static inline void mp_image_setfmt(mp_im
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_imag
}
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 */
Modified: trunk/libmpcodecs/vf_scale.c
==============================================================================
--- trunk/libmpcodecs/vf_scale.c Fri Jan 1 00:39:21 2010 (r30156)
+++ trunk/libmpcodecs/vf_scale.c Fri Jan 1 00:45:07 2010 (r30157)
@@ -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_instan
case IMGFMT_422P:
case IMGFMT_411P:
case IMGFMT_440P:
+ case IMGFMT_420A:
case IMGFMT_444P16_LE:
case IMGFMT_444P16_BE:
case IMGFMT_422P16_LE:
Modified: trunk/m_option.c
==============================================================================
--- trunk/m_option.c Fri Jan 1 00:39:21 2010 (r30156)
+++ trunk/m_option.c Fri Jan 1 00:45:07 2010 (r30157)
@@ -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},
More information about the MPlayer-cvslog
mailing list