diff options
author | arpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2001-11-10 23:28:10 +0000 |
---|---|---|
committer | arpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2001-11-10 23:28:10 +0000 |
commit | 31dc28382695dd2fa4a86a9676113a4eb36010ec (patch) | |
tree | dbf93b96cced1ca97a5203900cb43c472aba0f5e /postproc | |
parent | 751324d0d3b7412297ed297883aede43c8cbdd61 (diff) | |
download | mpv-31dc28382695dd2fa4a86a9676113a4eb36010ec.tar.bz2 mpv-31dc28382695dd2fa4a86a9676113a4eb36010ec.tar.xz |
uyvy->uv12 added
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@2802 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'postproc')
-rw-r--r-- | postproc/rgb2rgb.c | 38 | ||||
-rw-r--r-- | postproc/rgb2rgb_template.c | 38 |
2 files changed, 76 insertions, 0 deletions
diff --git a/postproc/rgb2rgb.c b/postproc/rgb2rgb.c index 67f33de38b..2157de908f 100644 --- a/postproc/rgb2rgb.c +++ b/postproc/rgb2rgb.c @@ -813,3 +813,41 @@ asm( EMMS" \n\t" :::"memory"); #endif } + +/** + * + * 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) + */ +void uyvytoyv12(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, + unsigned int width, unsigned int height, + unsigned int lumStride, unsigned int chromStride, unsigned int srcStride) +{ + int y; + const int chromWidth= width>>1; + for(y=0; y<height; y+=2) + { + int i; + for(i=0; i<chromWidth; i++) + { + udst[i] = src[4*i+0]; + ydst[2*i+0] = src[4*i+1]; + vdst[i] = src[4*i+2]; + ydst[2*i+1] = src[4*i+3]; + } + ydst += lumStride; + src += srcStride; + + for(i=0; i<chromWidth; i++) + { + ydst[2*i+0] = src[4*i+1]; + ydst[2*i+1] = src[4*i+3]; + } + udst += chromStride; + vdst += chromStride; + ydst += lumStride; + src += srcStride; + } +} + + diff --git a/postproc/rgb2rgb_template.c b/postproc/rgb2rgb_template.c index 67f33de38b..2157de908f 100644 --- a/postproc/rgb2rgb_template.c +++ b/postproc/rgb2rgb_template.c @@ -813,3 +813,41 @@ asm( EMMS" \n\t" :::"memory"); #endif } + +/** + * + * 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) + */ +void uyvytoyv12(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, + unsigned int width, unsigned int height, + unsigned int lumStride, unsigned int chromStride, unsigned int srcStride) +{ + int y; + const int chromWidth= width>>1; + for(y=0; y<height; y+=2) + { + int i; + for(i=0; i<chromWidth; i++) + { + udst[i] = src[4*i+0]; + ydst[2*i+0] = src[4*i+1]; + vdst[i] = src[4*i+2]; + ydst[2*i+1] = src[4*i+3]; + } + ydst += lumStride; + src += srcStride; + + for(i=0; i<chromWidth; i++) + { + ydst[2*i+0] = src[4*i+1]; + ydst[2*i+1] = src[4*i+3]; + } + udst += chromStride; + vdst += chromStride; + ydst += lumStride; + src += srcStride; + } +} + + |