Commit e7a47515 authored by Ramiro Polla's avatar Ramiro Polla

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

Originally committed as revision 30096 to svn://svn.mplayerhq.hu/mplayer/trunk/libswscale
parent 6f9771d7
......@@ -279,6 +279,8 @@ typedef struct SwsContext {
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 needs_hcscale; ///< Set if there are chroma planes to be converted.
} SwsContext;
//FIXME check init (where 0)
......
......@@ -2438,9 +2438,6 @@ inline static void RENAME(hcscale)(SwsContext *c, uint16_t *dst, long dstWidth,
int av_unused canMMX2BeUsed = c->canMMX2BeUsed;
void av_unused *mmx2FilterCode= c->chrMmx2FilterCode;
if (isGray(srcFormat) || srcFormat==PIX_FMT_MONOBLACK || srcFormat==PIX_FMT_MONOWHITE)
return;
src1 += c->chrSrcOffset;
src2 += c->chrSrcOffset;
......@@ -2717,7 +2714,7 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s
assert(lastInChrBuf + 1 - chrSrcSliceY >= 0);
//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,
flags, hChrFilter, hChrFilterPos, hChrFilterSize,
c->srcFormat, formatConvBuffer,
......@@ -3067,4 +3064,8 @@ static void RENAME(sws_init_swScale)(SwsContext *c)
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