aboutsummaryrefslogtreecommitdiffstats
path: root/libswscale/swscale.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2006-07-24 10:36:06 +0000
committerMichael Niedermayer <michaelni@gmx.at>2006-07-24 10:36:06 +0000
commitbca11e75fbc6b922438670733c6cb418c70433b4 (patch)
tree16e66dc954b1c00e609786c928333c978b5a2fd4 /libswscale/swscale.c
parentfc8833a1ad8b22c34918125fb880aa6071aea860 (diff)
downloadffmpeg-bca11e75fbc6b922438670733c6cb418c70433b4.tar.gz
vertical scaler with accurate rounding, some people on doom9 can see +-1 errors
the +-1 issue is limited to >2tap vertical filters, so bilinear upscale was unaffected the new code is sometime faster sometimes slower but the difference is significant (~20%) so its optional and enabled with arnd=1 Originally committed as revision 19177 to svn://svn.mplayerhq.hu/mplayer/trunk/libswscale
Diffstat (limited to 'libswscale/swscale.c')
-rw-r--r--libswscale/swscale.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index f45a4dfa46..9fcb44ca0f 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -848,7 +848,7 @@ static double getSplineCoeff(double a, double b, double c, double d, double dist
dist-1.0);
}
-static inline void initFilter(int16_t **outFilter, int16_t **filterPos, int *outFilterSize, int xInc,
+static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outFilterSize, int xInc,
int srcW, int dstW, int filterAlign, int one, int flags,
SwsVector *srcFilter, SwsVector *dstFilter, double param[2])
{
@@ -1127,10 +1127,18 @@ static inline void initFilter(int16_t **outFilter, int16_t **filterPos, int *out
filterAlign = 1;
}
+ if (flags & SWS_CPU_CAPS_MMX) {
+ // special case for unscaled vertical filtering
+ if(minFilterSize == 1 && filterAlign == 2)
+ filterAlign= 1;
+ }
+
ASSERT(minFilterSize > 0)
filterSize= (minFilterSize +(filterAlign-1)) & (~(filterAlign-1));
ASSERT(filterSize > 0)
filter= av_malloc(filterSize*dstW*sizeof(double));
+ if(filterSize >= MAX_FILTER_SIZE)
+ return -1;
*outFilterSize= filterSize;
if(flags&SWS_PRINT_INFO)
@@ -1216,6 +1224,7 @@ static inline void initFilter(int16_t **outFilter, int16_t **filterPos, int *out
}
av_free(filter);
+ return 0;
}
#if defined(ARCH_X86) || defined(ARCH_X86_64)
@@ -2115,6 +2124,7 @@ SwsContext *sws_getContext(int srcW, int srcH, int origSrcFormat, int dstW, int
/* precalculate vertical scaler filter coefficients */
{
const int filterAlign=
+ (flags & SWS_CPU_CAPS_MMX) && (flags & SWS_ACCURATE_RND) ? 2 :
(flags & SWS_CPU_CAPS_ALTIVEC) ? 8 :
1;