[FFmpeg-devel] [PATCH 2/5] DCA: use a local variable for loop boundary

Kostya kostya.shishkov
Mon Apr 12 05:34:02 CEST 2010


On Sun, Apr 11, 2010 at 11:05:51PM +0100, Mans Rullgard wrote:
> This prevents gcc reloading the value from memory on each iteration
> of the loop.
> ---
>  libavcodec/dca.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/libavcodec/dca.c b/libavcodec/dca.c
> index 596756c..7a6841d 100644
> --- a/libavcodec/dca.c
> +++ b/libavcodec/dca.c
> @@ -757,6 +757,7 @@ static void qmf_32_subbands(DCAContext * s, int chans,
>      const float *prCoeff;
>      int i;
>  
> +    int sb_act = s->subband_activity[chans];
>      int subindex;
>  
>      scale *= sqrt(1/8.0);
> @@ -770,7 +771,7 @@ static void qmf_32_subbands(DCAContext * s, int chans,
>      /* Reconstructed channel sample index */
>      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++){
> +        for (i = 0; i < sb_act; i++){
>              uint32_t v = AV_RN32A(&samples_in[i][subindex]) ^ ((i-1)&2)<<30;
>              AV_WN32A(&s->raXin[i], v);
>          }

looks ok



More information about the ffmpeg-devel mailing list