Commit e328b41a authored by ramiro's avatar ramiro

Check if chroma horizontal scaler is needed in sws_init_swScale().

git-svn-id: file:///var/local/repositories/mplayer/trunk/libswscale@30096 b3059339-0415-0410-9bf9-f77b7e298cf2
parent 39f103f8
...@@ -279,6 +279,8 @@ typedef struct SwsContext { ...@@ -279,6 +279,8 @@ typedef struct SwsContext {
int chrSrcOffset; ///< Offset given to chroma src pointers passed to horizontal input functions. int chrSrcOffset; ///< Offset given to chroma src pointers passed to horizontal input functions.
int alpSrcOffset; ///< Offset given to alpha src pointers passed to horizontal input functions. int alpSrcOffset; ///< Offset given to alpha src pointers passed to horizontal input functions.
int needs_hcscale; ///< Set if there are chroma planes to be converted.
} SwsContext; } SwsContext;
//FIXME check init (where 0) //FIXME check init (where 0)
......
...@@ -2438,9 +2438,6 @@ inline static void RENAME(hcscale)(SwsContext *c, uint16_t *dst, long dstWidth, ...@@ -2438,9 +2438,6 @@ inline static void RENAME(hcscale)(SwsContext *c, uint16_t *dst, long dstWidth,
int av_unused canMMX2BeUsed = c->canMMX2BeUsed; int av_unused canMMX2BeUsed = c->canMMX2BeUsed;
void av_unused *mmx2FilterCode= c->chrMmx2FilterCode; void av_unused *mmx2FilterCode= c->chrMmx2FilterCode;
if (isGray(srcFormat) || srcFormat==PIX_FMT_MONOBLACK || srcFormat==PIX_FMT_MONOWHITE)
return;
src1 += c->chrSrcOffset; src1 += c->chrSrcOffset;
src2 += c->chrSrcOffset; src2 += c->chrSrcOffset;
...@@ -2717,7 +2714,7 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s ...@@ -2717,7 +2714,7 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s
assert(lastInChrBuf + 1 - chrSrcSliceY >= 0); assert(lastInChrBuf + 1 - chrSrcSliceY >= 0);
//FIXME replace parameters through context struct (some at least) //FIXME replace parameters through context struct (some at least)
if (!(isGray(srcFormat) || isGray(dstFormat))) if (c->needs_hcscale)
RENAME(hcscale)(c, chrPixBuf[ chrBufIndex ], chrDstW, src1, src2, chrSrcW, chrXInc, RENAME(hcscale)(c, chrPixBuf[ chrBufIndex ], chrDstW, src1, src2, chrSrcW, chrXInc,
flags, hChrFilter, hChrFilterPos, hChrFilterSize, flags, hChrFilter, hChrFilterPos, hChrFilterSize,
c->srcFormat, formatConvBuffer, c->srcFormat, formatConvBuffer,
...@@ -3067,4 +3064,8 @@ static void RENAME(sws_init_swScale)(SwsContext *c) ...@@ -3067,4 +3064,8 @@ static void RENAME(sws_init_swScale)(SwsContext *c)
c->chrConvertRange = RENAME(chrRangeToJpeg); c->chrConvertRange = RENAME(chrRangeToJpeg);
} }
} }
if (!(isGray(srcFormat) || isGray(c->dstFormat) ||
srcFormat == PIX_FMT_MONOBLACK || srcFormat == PIX_FMT_MONOWHITE))
c->needs_hcscale = 1;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment