>From 3c6492ab0ea7b8512eab5eeb121bbe3bfc083c17 Mon Sep 17 00:00:00 2001 From: Keiji Costantini Date: Sat, 5 Jul 2008 10:37:08 +0900 Subject: [PATCH] simpleCopy splitted into packedCopy and planarCopy --- swscale.c | 22 ++++++++++++++-------- 1 files changed, 14 insertions(+), 8 deletions(-) diff --git a/swscale.c b/swscale.c index 069d75e..ed240b6 100644 --- a/swscale.c +++ b/swscale.c @@ -1648,11 +1648,10 @@ static int yvu9toyv12Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], int } /* unscaled copy like stuff (assumes nearly identical formats) */ -static int simpleCopy(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, +static int packedCopy(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t* dst[], int dstStride[]){ - if (isPacked(c->srcFormat)) - { + if (dstStride[0]==srcStride[0] && srcStride[0] > 0) memcpy(dst[0] + dstStride[0]*srcSliceY, src[0], srcSliceH*dstStride[0]); else @@ -1674,9 +1673,13 @@ static int simpleCopy(SwsContext *c, uint8_t* src[], int srcStride[], int srcSli dstPtr+= dstStride[0]; } } - } - else - { /* Planar YUV or gray */ + + return srcSliceH; +} +static int planarCopy(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, + int srcSliceH, uint8_t* dst[], int dstStride[]) +{ + int plane; for (plane=0; plane<3; plane++) { @@ -1707,7 +1710,7 @@ static int simpleCopy(SwsContext *c, uint8_t* src[], int srcStride[], int srcSli } } } - } + return srcSliceH; } @@ -2125,7 +2128,10 @@ SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH || (isPlanarYUV(srcFormat) && isGray(dstFormat)) || (isPlanarYUV(dstFormat) && isGray(srcFormat))) { - c->swScale= simpleCopy; + if (isPacked(c->srcFormat)) + c->swScale= packedCopy; + else /* Planar YUV or gray */ + c->swScale= planarCopy; } /* gray16{le,be} conversions */ -- 1.5.4.5