summaryrefslogtreecommitdiffstats
path: root/postproc/swscale.c
diff options
context:
space:
mode:
authordiego <diego@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-02-11 14:16:10 +0000
committerdiego <diego@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-02-11 14:16:10 +0000
commit844c1f8f8a7d95e7726fd3c7e6426ab410a0a1fe (patch)
tree77e94198157a2817344ac5ba0657e16d84f4a762 /postproc/swscale.c
parentb5e3a24fbb052f669e93b1a234b1dcc2946b6f1b (diff)
downloadmpv-844c1f8f8a7d95e7726fd3c7e6426ab410a0a1fe.tar.bz2
mpv-844c1f8f8a7d95e7726fd3c7e6426ab410a0a1fe.tar.xz
Move the v{Y,C}CoeffsBank vectors into the SwsContext, filling them in just
once when the scaler is initialized, instead of building them and freeing them over and over. This gives massive performance improvements. patch by Alan Curry, pacman*at*TheWorld*dot*com git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17589 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'postproc/swscale.c')
-rw-r--r--postproc/swscale.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/postproc/swscale.c b/postproc/swscale.c
index e4537f7bf2..6f9c203a2a 100644
--- a/postproc/swscale.c
+++ b/postproc/swscale.c
@@ -2110,6 +2110,25 @@ SwsContext *sws_getContext(int srcW, int srcH, int origSrcFormat, int dstW, int
c->chrSrcH, c->chrDstH, filterAlign, (1<<12)-4,
(flags&SWS_BICUBLIN) ? (flags|SWS_BILINEAR) : flags,
srcFilter->chrV, dstFilter->chrV, c->param);
+
+#ifdef HAVE_ALTIVEC
+ c->vYCoeffsBank = memalign (16, sizeof (vector signed short)*c->vLumFilterSize*c->dstH);
+ c->vCCoeffsBank = memalign (16, sizeof (vector signed short)*c->vChrFilterSize*c->dstH);
+
+ for (i=0;i<c->vLumFilterSize*c->dstH;i++) {
+ int j;
+ short *p = (short *)&c->vYCoeffsBank[i];
+ for (j=0;j<8;j++)
+ p[j] = c->vLumFilter[i];
+ }
+
+ for (i=0;i<c->vChrFilterSize*c->dstH;i++) {
+ int j;
+ short *p = (short *)&c->vCCoeffsBank[i];
+ for (j=0;j<8;j++)
+ p[j] = c->vChrFilter[i];
+ }
+#endif
}
// Calculate Buffer Sizes so that they won't run out while handling these damn slices
@@ -2644,6 +2663,12 @@ void sws_freeContext(SwsContext *c){
c->hLumFilter = NULL;
if(c->hChrFilter) free(c->hChrFilter);
c->hChrFilter = NULL;
+#ifdef HAVE_ALTIVEC
+ if(c->vYCoeffsBank) free(c->vYCoeffsBank);
+ c->vYCoeffsBank = NULL;
+ if(c->vCCoeffsBank) free(c->vCCoeffsBank);
+ c->vCCoeffsBank = NULL;
+#endif
if(c->vLumFilterPos) free(c->vLumFilterPos);
c->vLumFilterPos = NULL;