>From 401dd7f0e373d75648415b69a4f80fd6ee5299b0 Mon Sep 17 00:00:00 2001 From: Keiji Costantini Date: Sun, 22 Jun 2008 17:38:13 +0200 Subject: [PATCH] simpleCopy splitted into simpleCopy and grayuvCopy --- swscale.c | 21 ++++++++++++++------- 1 files changed, 14 insertions(+), 7 deletions(-) diff --git a/swscale.c b/swscale.c index 069d75e..891c7f2 100644 --- a/swscale.c +++ b/swscale.c @@ -1651,8 +1651,7 @@ static int yvu9toyv12Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], int static int simpleCopy(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 grayuvCopy(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,9 +2128,13 @@ 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= simpleCopy; + else /* Planar YUV or gray */ + c->swScale= grayuvCopy; } + /* gray16{le,be} conversions */ if (isGray16(srcFormat) && (isPlanarYUV(dstFormat) || (dstFormat == PIX_FMT_GRAY8))) { -- 1.5.4.5