[MPlayer-dev-eng] more on -vop halfpack and conversion to yuy2
D Richard Felker III
dalias at aerifal.cx
Thu Aug 22 01:51:28 CEST 2002
A while back I posted a video filter called halfpack, which converted
planar YUV 4:2:0 formats to half-height YUY2, keeping all the chroma
info but averaging every pair of luma lines. At the time I was told by
Arpi it would be better to use the existing stuff in the postproc dir
for this. I've been trying to follow that advice, and now that 4:2:2
planar formats are supported, I've sorta found a way, but the relevant
code seems to be broken.
The idea is to use -vop yuy2,format=422p,scale=[X]:[Y/2] to accomplish
the same thing. I've modified the yuy2 filter (see attached patch) to
support 4:2:2 input by calling yuv422ptoyuy2 instead of yv12toyuy2.
However, the code doesn't seem to be working; every other line lacks
chroma info completely. Has yuv422ptoyuy2 ever been tested?
Anyway, the other conclusion I've come to is that this method is slow.
Using the -vop yuy2,format=422p,scale filter chain takes 2-3 times the
cpu time as my (very naive, slow, unoptimized) -vop halfpack did, and
the quality in the luma plane downscaling is not terribly different
imo. So, I'm wondering if perhaps it would be preferable or at least
acceptable to improve vf_halfpack.c and place it in CVS. Opinions,
Arpi?
To anyone interested in reading vf_halfpack.c and/or the reasons why
it's useful -- search the archives for my original post.
Rich
-------------- next part --------------
Index: libmpcodecs/vf_yuy2.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vf_yuy2.c,v
retrieving revision 1.3
diff -u -r1.3 vf_yuy2.c
--- libmpcodecs/vf_yuy2.c 13 Apr 2002 19:14:31 -0000 1.3
+++ libmpcodecs/vf_yuy2.c 21 Aug 2002 23:55:50 -0000
@@ -35,6 +35,10 @@
MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
mpi->w, mpi->h);
+ if (mpi->imgfmt == IMGFMT_422P)
+ yuv422ptoyuy2(mpi->planes[0],mpi->planes[1],mpi->planes[2], dmpi->planes[0],
+ mpi->w,mpi->h, mpi->stride[0],mpi->stride[1],dmpi->stride[0]);
+ else
yv12toyuy2(mpi->planes[0],mpi->planes[1],mpi->planes[2], dmpi->planes[0],
mpi->w,mpi->h, mpi->stride[0],mpi->stride[1],dmpi->stride[0]);
@@ -51,6 +55,7 @@
case IMGFMT_YV12:
case IMGFMT_I420:
case IMGFMT_IYUV:
+ case IMGFMT_422P:
return vf_next_query_format(vf,IMGFMT_YUY2) & (~VFCAP_CSP_SUPPORTED_BY_HW);
}
return 0;
More information about the MPlayer-dev-eng
mailing list