Revision f66e4f5f libavcodec/g726.c

View differences:

libavcodec/g726.c
213 213
            c->b[i] = 0;
214 214
    } else {
215 215
        /* This is a bit crazy, but it really is +255 not +256 */
216
        fa1 = clip((-c->a[0]*c->pk[0]*pk0)>>5, -256, 255);
216
        fa1 = av_clip((-c->a[0]*c->pk[0]*pk0)>>5, -256, 255);
217 217

  
218 218
        c->a[1] += 128*pk0*c->pk[1] + fa1 - (c->a[1]>>7);
219
        c->a[1] = clip(c->a[1], -12288, 12288);
219
        c->a[1] = av_clip(c->a[1], -12288, 12288);
220 220
        c->a[0] += 64*3*pk0*c->pk[0] - (c->a[0] >> 8);
221
        c->a[0] = clip(c->a[0], -(15360 - c->a[1]), 15360 - c->a[1]);
221
        c->a[0] = av_clip(c->a[0], -(15360 - c->a[1]), 15360 - c->a[1]);
222 222

  
223 223
        for (i=0; i<6; i++)
224 224
            c->b[i] += 128*dq0*sgn(-c->dq[i].sign) - (c->b[i]>>8);
......
248 248
        c->ap += (0x200 - c->ap) >> 4;
249 249

  
250 250
    /* Update Yu and Yl */
251
    c->yu = clip(c->y + (((c->tbls->W[I] << 5) - c->y) >> 5), 544, 5120);
251
    c->yu = av_clip(c->y + (((c->tbls->W[I] << 5) - c->y) >> 5), 544, 5120);
252 252
    c->yl += c->yu + ((-c->yl)>>6);
253 253

  
254 254
    /* Next iteration for Y */
......
264 264
        c->se += mult(i2f(c->a[i] >> 2, &f), &c->sr[i]);
265 265
    c->se >>= 1;
266 266

  
267
    return clip(re_signal << 2, -0xffff, 0xffff);
267
    return av_clip(re_signal << 2, -0xffff, 0xffff);
268 268
}
269 269

  
270 270
static int g726_reset(G726Context* c, int bit_rate)

Also available in: Unified diff