From caeaabe7d019c423c73f0330f719673872e65cbc Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Thu, 9 Oct 2003 22:25:53 +0000 Subject: uyvy output support in swscaler Originally committed as revision 11069 to svn://svn.mplayerhq.hu/mplayer/trunk/postproc --- postproc/rgb2rgb_template.c | 58 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) (limited to 'postproc/rgb2rgb_template.c') diff --git a/postproc/rgb2rgb_template.c b/postproc/rgb2rgb_template.c index 85c8f440e3..acb53ea4aa 100644 --- a/postproc/rgb2rgb_template.c +++ b/postproc/rgb2rgb_template.c @@ -1568,6 +1568,64 @@ static inline void RENAME(yv12toyuy2)(const uint8_t *ysrc, const uint8_t *usrc, RENAME(yuvPlanartoyuy2)(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 2); } +static inline void RENAME(yuvPlanartouyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, + unsigned int width, unsigned int height, + int lumStride, int chromStride, int dstStride, int vertLumPerChroma) +{ + unsigned y; + const unsigned chromWidth= width>>1; + for(y=0; y= 64 + int i; + uint64_t *ldst = (uint64_t *) dst; + const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc; + for(i = 0; i < chromWidth; i += 2){ + uint64_t k, l; + k = uc[0] + (yc[0] << 8) + + (vc[0] << 16) + (yc[1] << 24); + l = uc[1] + (yc[2] << 8) + + (vc[1] << 16) + (yc[3] << 24); + *ldst++ = k + (l << 32); + yc += 4; + uc += 2; + vc += 2; + } + +#else + int i, *idst = (int32_t *) dst; + const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc; + for(i = 0; i < chromWidth; i++){ + *idst++ = uc[0] + (yc[0] << 8) + + (vc[0] << 16) + (yc[1] << 24); + yc += 2; + uc++; + vc++; + } +#endif + if((y&(vertLumPerChroma-1))==(vertLumPerChroma-1) ) + { + usrc += chromStride; + vsrc += chromStride; + } + ysrc += lumStride; + dst += dstStride; + } +} + +/** + * + * height should be a multiple of 2 and width should be a multiple of 16 (if this is a + * problem for anyone then tell me, and ill fix it) + */ +static inline void RENAME(yv12touyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, + unsigned int width, unsigned int height, + int lumStride, int chromStride, int dstStride) +{ + //FIXME interpolate chroma + RENAME(yuvPlanartouyvy)(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 2); +} + /** * * width should be a multiple of 16 -- cgit v1.2.3