aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBaptiste Coudurier <baptiste.coudurier@gmail.com>2008-09-05 00:25:39 +0000
committerBaptiste Coudurier <baptiste.coudurier@gmail.com>2008-09-05 00:25:39 +0000
commita6100f39a11bd0cdc9f023c4e47fe75fec7a09fb (patch)
treecb8a325ac9db9a2010b25c03d63c852b26f6a0b9
parente10049bef5384fc64e5b249118da968a6c8dffe7 (diff)
downloadffmpeg-a6100f39a11bd0cdc9f023c4e47fe75fec7a09fb.tar.gz
enable yuv422p to uyvy converter
Originally committed as revision 27527 to svn://svn.mplayerhq.hu/mplayer/trunk/libswscale
-rw-r--r--libswscale/rgb2rgb.c3
-rw-r--r--libswscale/rgb2rgb.h8
-rw-r--r--libswscale/rgb2rgb_template.c11
-rw-r--r--libswscale/swscale.c26
4 files changed, 48 insertions, 0 deletions
diff --git a/libswscale/rgb2rgb.c b/libswscale/rgb2rgb.c
index e3ac5a6ace..13388ac85a 100644
--- a/libswscale/rgb2rgb.c
+++ b/libswscale/rgb2rgb.c
@@ -65,6 +65,9 @@ void (*yv12touyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc
void (*yuv422ptoyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
long width, long height,
long lumStride, long chromStride, long dstStride);
+void (*yuv422ptouyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
+ long width, long height,
+ long lumStride, long chromStride, long dstStride);
void (*yuy2toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
long width, long height,
long lumStride, long chromStride, long srcStride);
diff --git a/libswscale/rgb2rgb.h b/libswscale/rgb2rgb.h
index 0ec6273d8b..5d371acbc3 100644
--- a/libswscale/rgb2rgb.h
+++ b/libswscale/rgb2rgb.h
@@ -110,6 +110,14 @@ extern void (*yv12touyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_
long lumStride, long chromStride, long dstStride);
/**
+ *
+ * width should be a multiple of 16
+ */
+extern void (*yuv422ptouyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
+ long width, long height,
+ long lumStride, long chromStride, long dstStride);
+
+/**
* Height should be a multiple of 2 and width should be a multiple of 2.
* (If this is a problem for anyone then tell me, and I will fix it.)
* Chrominance data is only taken from every second line, others are ignored.
diff --git a/libswscale/rgb2rgb_template.c b/libswscale/rgb2rgb_template.c
index 2f27f70a5d..c98c080978 100644
--- a/libswscale/rgb2rgb_template.c
+++ b/libswscale/rgb2rgb_template.c
@@ -1758,6 +1758,16 @@ static inline void RENAME(yv12touyvy)(const uint8_t *ysrc, const uint8_t *usrc,
/**
* Width should be a multiple of 16.
*/
+static inline void RENAME(yuv422ptouyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
+ long width, long height,
+ long lumStride, long chromStride, long dstStride)
+{
+ RENAME(yuvPlanartouyvy)(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 1);
+}
+
+/**
+ * Width should be a multiple of 16.
+ */
static inline void RENAME(yuv422ptoyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
long width, long height,
long lumStride, long chromStride, long dstStride)
@@ -2727,6 +2737,7 @@ static inline void RENAME(rgb2rgb_init)(void){
yv12toyuy2 = RENAME(yv12toyuy2);
yv12touyvy = RENAME(yv12touyvy);
yuv422ptoyuy2 = RENAME(yuv422ptoyuy2);
+ yuv422ptouyvy = RENAME(yuv422ptouyvy);
yuy2toyv12 = RENAME(yuy2toyv12);
// uyvytoyv12 = RENAME(uyvytoyv12);
// yvu9toyv12 = RENAME(yvu9toyv12);
diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index e5c9b898a7..8fdd5eb0cc 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -1648,6 +1648,24 @@ static int PlanarToUyvyWrapper(SwsContext *c, uint8_t* src[], int srcStride[], i
return srcSliceH;
}
+static int YUV422PToYuy2Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
+ int srcSliceH, uint8_t* dstParam[], int dstStride[]){
+ uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY;
+
+ yuv422ptoyuy2(src[0],src[1],src[2],dst,c->srcW,srcSliceH,srcStride[0],srcStride[1],dstStride[0]);
+
+ return srcSliceH;
+}
+
+static int YUV422PToUyvyWrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
+ int srcSliceH, uint8_t* dstParam[], int dstStride[]){
+ uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY;
+
+ yuv422ptouyvy(src[0],src[1],src[2],dst,c->srcW,srcSliceH,srcStride[0],srcStride[1],dstStride[0]);
+
+ return srcSliceH;
+}
+
/* {RGB,BGR}{15,16,24,32,32_1} -> {RGB,BGR}{15,16,24,32} */
static int rgb2rgbWrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
int srcSliceH, uint8_t* dst[], int dstStride[]){
@@ -2233,6 +2251,14 @@ SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH
&& (!needsDither || (c->flags&(SWS_FAST_BILINEAR|SWS_POINT))))
c->swScale= rgb2rgbWrapper;
+ if (srcFormat == PIX_FMT_YUV422P)
+ {
+ if (dstFormat == PIX_FMT_YUYV422)
+ c->swScale= YUV422PToYuy2Wrapper;
+ else if (dstFormat == PIX_FMT_UYVY422)
+ c->swScale= YUV422PToUyvyWrapper;
+ }
+
/* LQ converters if -sws 0 or -sws 4*/
if (c->flags&(SWS_FAST_BILINEAR|SWS_POINT)){
/* yv12_to_yuy2 */