Merge commit '9abc80f1ed673141326341e26a05c3e1f78576d0'
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 21 Feb 2015 10:24:11 +0000 (11:24 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 21 Feb 2015 10:27:24 +0000 (11:27 +0100)
* commit '9abc80f1ed673141326341e26a05c3e1f78576d0':
  libavcodec: Make use of av_clip functions

Conflicts:
libavcodec/takdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
13 files changed:
1  2 
libavcodec/aaccoder.c
libavcodec/ac3dsp.c
libavcodec/cavs.c
libavcodec/g722dec.c
libavcodec/g722enc.c
libavcodec/g726.c
libavcodec/h264_direct.c
libavcodec/h264_slice.c
libavcodec/motionpixels.c
libavcodec/opus_celt.c
libavcodec/opus_silk.c
libavcodec/takdec.c
libavcodec/vc1dec.c

Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -459,31 -475,21 +459,31 @@@ static int decode_subframe(TAKDecContex
      for (i = 0; i < filter_order; i++)
          s->residues[i] = *decoded++ >> dshift;
  
 -    for (i = 0; i < subframe_size - filter_order; i++) {
 -        int v = 1 << (filter_quant - 1);
 -
 -        v += s->adsp.scalarproduct_int16(&s->residues[i], filter,
 -                                         FFALIGN(filter_order, 16));
 +    y    = FF_ARRAY_ELEMS(s->residues) - filter_order;
 +    x    = subframe_size - filter_order;
 +    while (x > 0) {
 +        int tmp = FFMIN(y, x);
 +
 +        for (i = 0; i < tmp; i++) {
 +            int v = 1 << (filter_quant - 1);
 +
 +            if (filter_order & -16)
 +                v += s->adsp.scalarproduct_int16(&s->residues[i], s->filter,
 +                                                 filter_order & -16);
 +            for (j = filter_order & -16; j < filter_order; j += 4) {
 +                v += s->residues[i + j + 3] * s->filter[j + 3] +
 +                     s->residues[i + j + 2] * s->filter[j + 2] +
 +                     s->residues[i + j + 1] * s->filter[j + 1] +
 +                     s->residues[i + j    ] * s->filter[j    ];
 +            }
-             v = (av_clip(v >> filter_quant, -8192, 8191) << dshift) - *decoded;
++            v = (av_clip_intp2(v >> filter_quant, 13) << dshift) - *decoded;
 +            *decoded++ = v;
 +            s->residues[filter_order + i] = v >> dshift;
 +        }
  
 -        v = (av_clip_intp2(v >> filter_quant, 13) << dshift) - *decoded;
 -        *decoded++ = v;
 -        s->residues[filter_order + i] = v >> dshift;
 +        x -= tmp;
 +        if (x > 0)
 +            memcpy(s->residues, &s->residues[y], 2 * filter_order);
      }
  
      emms_c();
@@@ -623,40 -640,24 +623,40 @@@ static int decorrelate(TAKDecContext *s
              }
          }
  
 -        av_fast_malloc(&s->residues, &s->residues_buf_size,
 -                       FFALIGN(length + 16, 16) * sizeof(*s->residues));
 -        if (!s->residues)
 -            return AVERROR(ENOMEM);
 -        memset(s->residues, 0, s->residues_buf_size);
  
 -        for (i = 0; i < length; i++)
 -            s->residues[i] = p2[i] >> dshift;
 +        for (i = 0; i < filter_order; i++)
 +            s->residues[i] = *p2++ >> dshift;
  
          p1 += order_half;
 +        x = FF_ARRAY_ELEMS(s->residues) - filter_order;
 +        for (; length2 > 0; length2 -= tmp) {
 +            tmp = FFMIN(length2, x);
 +
 +            for (i = 0; i < tmp; i++)
 +                s->residues[filter_order + i] = *p2++ >> dshift;
 +
 +            for (i = 0; i < tmp; i++) {
 +                int v = 1 << 9;
 +
 +                if (filter_order == 16) {
 +                    v += s->adsp.scalarproduct_int16(&s->residues[i], s->filter,
 +                                                     filter_order);
 +                } else {
 +                    v += s->residues[i + 7] * s->filter[7] +
 +                         s->residues[i + 6] * s->filter[6] +
 +                         s->residues[i + 5] * s->filter[5] +
 +                         s->residues[i + 4] * s->filter[4] +
 +                         s->residues[i + 3] * s->filter[3] +
 +                         s->residues[i + 2] * s->filter[2] +
 +                         s->residues[i + 1] * s->filter[1] +
 +                         s->residues[i    ] * s->filter[0];
 +                }
  
-                 v = (av_clip(v >> 10, -8192, 8191) << dshift) - *p1;
 -        for (i = 0; i < length2; i++) {
 -            int v = 1 << 9;
 -
 -            v += s->adsp.scalarproduct_int16(&s->residues[i], filter,
 -                                             FFALIGN(filter_order, 16));
++                v = (av_clip_intp2(v >> 10, 13) << dshift) - *p1;
 +                *p1++ = v;
 +            }
  
 -            p1[i] = (av_clip_intp2(v >> 10, 13) << dshift) - p1[i];
 +            memcpy(s->residues, &s->residues[tmp], 2 * filter_order);
          }
  
          emms_c();
Simple merge