summaryrefslogtreecommitdiffstats
path: root/libswscale/swscale_template.c
diff options
context:
space:
mode:
authorramiro <ramiro@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-04-02 18:32:49 +0000
committerramiro <ramiro@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-04-02 18:32:49 +0000
commit9574441a1cf640c96ad41ac389c8fc0e34d77127 (patch)
tree8b33ccb406815834c6c8ef426d3ec32bfa31ab10 /libswscale/swscale_template.c
parent755c96e95306fc0f48a6da4c13486db8f593fcdf (diff)
downloadmpv-9574441a1cf640c96ad41ac389c8fc0e34d77127.tar.bz2
mpv-9574441a1cf640c96ad41ac389c8fc0e34d77127.tar.xz
swscale: Split h[yc]scale_fast() into their own functions.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29128 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libswscale/swscale_template.c')
-rw-r--r--libswscale/swscale_template.c61
1 files changed, 38 insertions, 23 deletions
diff --git a/libswscale/swscale_template.c b/libswscale/swscale_template.c
index 04e9d17a64..28b023ea98 100644
--- a/libswscale/swscale_template.c
+++ b/libswscale/swscale_template.c
@@ -2243,6 +2243,22 @@ static inline void RENAME(hScale)(int16_t *dst, int dstW, uint8_t *src, int srcW
#endif /* HAVE_ALTIVEC */
#endif /* HAVE_MMX */
}
+
+static inline void RENAME(hyscale_fast)(SwsContext *c, int16_t *dst,
+ int dstWidth, uint8_t *src, int srcW,
+ int xInc)
+{
+ int i;
+ unsigned int xpos=0;
+ for (i=0;i<dstWidth;i++)
+ {
+ register unsigned int xx=xpos>>16;
+ register unsigned int xalpha=(xpos&0xFFFF)>>9;
+ dst[i]= (src[xx]<<7) + (src[xx+1] - src[xx])*xalpha;
+ xpos+=xInc;
+ }
+}
+
// *** horizontal scale Y line to temp buffer
static inline void RENAME(hyscale)(SwsContext *c, uint16_t *dst, long dstWidth, uint8_t *src, int srcW, int xInc,
int flags, int canMMX2BeUsed, int16_t *hLumFilter,
@@ -2465,15 +2481,7 @@ FUNNY_Y_CODE
} //if MMX2 can't be used
#endif
#else
- int i;
- unsigned int xpos=0;
- for (i=0;i<dstWidth;i++)
- {
- register unsigned int xx=xpos>>16;
- register unsigned int xalpha=(xpos&0xFFFF)>>9;
- dst[i]= (src[xx]<<7) + (src[xx+1] - src[xx])*xalpha;
- xpos+=xInc;
- }
+ RENAME(hyscale_fast)(c, dst, dstWidth, src, srcW, xInc);
#endif /* ARCH_X86 */
}
@@ -2491,6 +2499,26 @@ FUNNY_Y_CODE
}
}
+static inline void RENAME(hcscale_fast)(SwsContext *c, int16_t *dst,
+ int dstWidth, uint8_t *src1,
+ uint8_t *src2, int srcW, int xInc)
+{
+ int i;
+ unsigned int xpos=0;
+ for (i=0;i<dstWidth;i++)
+ {
+ register unsigned int xx=xpos>>16;
+ register unsigned int xalpha=(xpos&0xFFFF)>>9;
+ dst[i]=(src1[xx]*(xalpha^127)+src1[xx+1]*xalpha);
+ dst[i+VOFW]=(src2[xx]*(xalpha^127)+src2[xx+1]*xalpha);
+ /* slower
+ dst[i]= (src1[xx]<<7) + (src1[xx+1] - src1[xx])*xalpha;
+ dst[i+VOFW]=(src2[xx]<<7) + (src2[xx+1] - src2[xx])*xalpha;
+ */
+ xpos+=xInc;
+ }
+}
+
inline static void RENAME(hcscale)(SwsContext *c, uint16_t *dst, long dstWidth, uint8_t *src1, uint8_t *src2,
int srcW, int xInc, int flags, int canMMX2BeUsed, int16_t *hChrFilter,
int16_t *hChrFilterPos, int hChrFilterSize, void *funnyUVCode,
@@ -2754,20 +2782,7 @@ FUNNY_UV_CODE
} //if MMX2 can't be used
#endif
#else
- int i;
- unsigned int xpos=0;
- for (i=0;i<dstWidth;i++)
- {
- register unsigned int xx=xpos>>16;
- register unsigned int xalpha=(xpos&0xFFFF)>>9;
- dst[i]=(src1[xx]*(xalpha^127)+src1[xx+1]*xalpha);
- dst[i+VOFW]=(src2[xx]*(xalpha^127)+src2[xx+1]*xalpha);
- /* slower
- dst[i]= (src1[xx]<<7) + (src1[xx+1] - src1[xx])*xalpha;
- dst[i+VOFW]=(src2[xx]<<7) + (src2[xx+1] - src2[xx])*xalpha;
- */
- xpos+=xInc;
- }
+ RENAME(hcscale_fast)(c, dst, dstWidth, src1, src2, srcW, xInc);
#endif /* ARCH_X86 */
}
if(c->srcRange != c->dstRange && !(isRGB(c->dstFormat) || isBGR(c->dstFormat))){