On 2014-02-14 16:03:11 +0000, Christophe Gisquet wrote:
> The codeblock affected accounted for around 4% of the runtime on x86_64
> (measured using oprofile on a Penryn).
> Timings for Arrandale (gcc 4.6.1 tdm64-1 for windows):
> win32: 341 -> 331
> win64: 321 -> 120
> 
> The compiled loops are completely unrolled, so only unrolling the
> initialization causes an improvement.
> ---
>  libavcodec/dcadec.c | 20 +++++++++++++-------
>  1 file changed, 13 insertions(+), 7 deletions(-)
> 
> diff --git a/libavcodec/dcadec.c b/libavcodec/dcadec.c
> index c251db8..2d88cb4 100644
> --- a/libavcodec/dcadec.c
> +++ b/libavcodec/dcadec.c
> @@ -1193,15 +1193,21 @@ static int dca_subsubframe(DCAContext *s, int 
> base_channel, int block_index)
>              if (s->prediction_mode[k][l]) {
>                  int n;
>                  for (m = 0; m < 8; m++) {
> -                    for (n = 1; n <= 4; n++)
> +                    float sum;
> +                    if (m >= 1)
> +                        sum = adpcm_vb[s->prediction_vq[k][l]][1 - 1] *
> +                              subband_samples[k][l][m - 1];
> +                    else if (s->predictor_history)
> +                        sum = adpcm_vb[s->prediction_vq[k][l]][1 - 1] *
> +                              s->subband_samples_hist[k][l][m - 1 + 4];

can s->predictor_history be 0? if yes sum is uninitialized for m == 0 and used 
later

> +                    for (n = 2; n <= 4; n++)
>                          if (m >= n)
> -                            subband_samples[k][l][m] +=
> -                                (adpcm_vb[s->prediction_vq[k][l]][n - 1] *
> -                                 subband_samples[k][l][m - n] / 8192);
> +                            sum += adpcm_vb[s->prediction_vq[k][l]][n - 1] *
> +                                   subband_samples[k][l][m - n];
>                          else if (s->predictor_history)
> -                            subband_samples[k][l][m] +=
> -                                (adpcm_vb[s->prediction_vq[k][l]][n - 1] *
> -                                 s->subband_samples_hist[k][l][m - n + 4] / 
> 8192);
> +                            sum += adpcm_vb[s->prediction_vq[k][l]][n - 1] *
> +                                   s->subband_samples_hist[k][l][m - n + 4];
> +                    subband_samples[k][l][m] += sum * 1.0f/ 8192;

please add a space between 1.0f and /

Janne
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to