On Wed, Jun 11, 2008 at 02:36:08AM +0200, Keiji Costantini wrote:
>
> -- 
> Keiji Costantini

> >From 0000bf9c48dc82dba81c522f9ce4f783b4e1a3fb Mon Sep 17 00:00:00 2001
> From: Keiji Costantini <[EMAIL PROTECTED]>
> 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;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->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;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->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

Whichever way this is done and whereever, it should be done at the
same place where lum/chrMmxFilter is initialized.
And of course both altivec & mmx should use the same array for the same data.

But looking again it seems these arrays are practically unused and the
code using it looks like it shouldnt use them in the first place.

So, correct cleanup seems to be to remove vCCoeffsBank and vYCoeffsBank.

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I am the wisest man alive, for I know one thing, and that is that I know
nothing. -- Socrates

Attachment: signature.asc
Description: Digital signature

_______________________________________________
FFmpeg-soc mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-soc

Reply via email to