[FFmpeg-devel] [PATCH 1/5] DCA: use some type-punning in qmf_32_subbands()

Kostya kostya.shishkov
Mon Apr 12 05:33:29 CEST 2010


On Sun, Apr 11, 2010 at 11:05:50PM +0100, Mans Rullgard wrote:
> ---
>  libavcodec/dca.c |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/dca.c b/libavcodec/dca.c
> index dc164e4..596756c 100644
> --- a/libavcodec/dca.c
> +++ b/libavcodec/dca.c
> @@ -30,6 +30,7 @@
>  #include <stddef.h>
>  #include <stdio.h>
>  
> +#include "libavutil/intreadwrite.h"
>  #include "avcodec.h"
>  #include "dsputil.h"
>  #include "fft.h"
> @@ -770,8 +771,8 @@ static void qmf_32_subbands(DCAContext * s, int chans,
>      for (subindex = 0; subindex < 8; subindex++) {
>          /* Load in one sample from each subband and clear inactive subbands */
>          for (i = 0; i < s->subband_activity[chans]; i++){
> -            if((i-1)&2) s->raXin[i] = -samples_in[i][subindex];
> -            else        s->raXin[i] =  samples_in[i][subindex];
> +            uint32_t v = AV_RN32A(&samples_in[i][subindex]) ^ ((i-1)&2)<<30;
> +            AV_WN32A(&s->raXin[i], v);
>          }
>          for (; i < 32; i++)
>              s->raXin[i] = 0.0;

looks ok



More information about the ffmpeg-devel mailing list