aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRamiro Polla <ramiro.polla@gmail.com>2009-12-21 01:34:45 +0000
committerRamiro Polla <ramiro.polla@gmail.com>2009-12-21 01:34:45 +0000
commite7a47515abbcf2c8a07c280ea3d04129fc3aaaf6 (patch)
tree9945e408dd0a11865f4baed2f11751fabd82433b
parent6f9771d7a67e1ecef0eee1a38fafb080b7641387 (diff)
downloadffmpeg-e7a47515abbcf2c8a07c280ea3d04129fc3aaaf6.tar.gz
Check if chroma horizontal scaler is needed in sws_init_swScale().
Originally committed as revision 30096 to svn://svn.mplayerhq.hu/mplayer/trunk/libswscale
-rw-r--r--libswscale/swscale_internal.h2
-rw-r--r--libswscale/swscale_template.c9
2 files changed, 7 insertions, 4 deletions
diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h
index f60ffb0a11..eb73fa6dae 100644
--- a/libswscale/swscale_internal.h
+++ b/libswscale/swscale_internal.h
@@ -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)
diff --git a/libswscale/swscale_template.c b/libswscale/swscale_template.c
index 9208a07498..3c6c8ebe8d 100644
--- a/libswscale/swscale_template.c
+++ b/libswscale/swscale_template.c
@@ -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;
}