>From 0000bf9c48dc82dba81c522f9ce4f783b4e1a3fb Mon Sep 17 00:00:00 2001 From: Keiji Costantini Date: Wed, 11 Jun 2008 01:51:30 +0200 Subject: [PATCH] Split sws_getContext_altivec_alloc_context from sws_getContext --- swscale.c | 36 ++++++++++++++++++++---------------- 1 files changed, 20 insertions(+), 16 deletions(-) diff --git a/swscale.c b/swscale.c index 6e0bd38..04b60ca 100644 --- a/swscale.c +++ b/swscale.c @@ -1953,6 +1953,25 @@ static inline void sws_getContext_altivec_unscyv2packyuv(SwsContext *c, int *src } } +static inline void sws_getContext_altivec_alloc_context(SwsContext *c) { + int i; + c->vYCoeffsBank = av_malloc(sizeof (vector signed short)*c->vLumFilterSize*c->dstH); + c->vCCoeffsBank = av_malloc(sizeof (vector signed short)*c->vChrFilterSize*c->chrDstH); + + for (i=0;ivLumFilterSize*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;ivChrFilterSize)*c->chrDstH);i++) { + int j; + short *p = (short *)&c->vCCoeffsBank[i]; + for (j=0;j<8;j++) + p[j] = c->vChrFilter[i]; + } +} SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat, int flags, SwsFilter *srcFilter, SwsFilter *dstFilter, double *param){ @@ -2260,22 +2279,7 @@ SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH srcFilter->chrV, dstFilter->chrV, c->param); #ifdef HAVE_ALTIVEC - c->vYCoeffsBank = av_malloc(sizeof (vector signed short)*c->vLumFilterSize*c->dstH); - c->vCCoeffsBank = av_malloc(sizeof (vector signed short)*c->vChrFilterSize*c->chrDstH); - - for (i=0;ivLumFilterSize*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;ivChrFilterSize*c->chrDstH;i++) { - int j; - short *p = (short *)&c->vCCoeffsBank[i]; - for (j=0;j<8;j++) - p[j] = c->vChrFilter[i]; - } + sws_getContext_altivec_alloc_context(c); #endif } -- 1.5.3.7