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

Originally committed as revision 30096 to svn://svn.mplayerhq.hu/mplayer/trunk/libswscale
This commit is contained in:
Ramiro Polla 2009-12-21 01:34:45 +00:00
parent 6f9771d7a6
commit e7a47515ab
2 changed files with 7 additions and 4 deletions

View File

@ -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)

View File

@ -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;
}