Revision f66e4f5f libavcodec/mpegvideo.c

View differences:

libavcodec/mpegvideo.c
188 188

  
189 189
static inline void update_qscale(MpegEncContext *s){
190 190
    s->qscale= (s->lambda*139 + FF_LAMBDA_SCALE*64) >> (FF_LAMBDA_SHIFT + 7);
191
    s->qscale= clip(s->qscale, s->avctx->qmin, s->avctx->qmax);
191
    s->qscale= av_clip(s->qscale, s->avctx->qmin, s->avctx->qmax);
192 192

  
193 193
    s->lambda2= (s->lambda*s->lambda + FF_LAMBDA_SCALE/2) >> FF_LAMBDA_SHIFT;
194 194
}
......
1713 1713
static void draw_line(uint8_t *buf, int sx, int sy, int ex, int ey, int w, int h, int stride, int color){
1714 1714
    int x, y, fr, f;
1715 1715

  
1716
    sx= clip(sx, 0, w-1);
1717
    sy= clip(sy, 0, h-1);
1718
    ex= clip(ex, 0, w-1);
1719
    ey= clip(ey, 0, h-1);
1716
    sx= av_clip(sx, 0, w-1);
1717
    sy= av_clip(sy, 0, h-1);
1718
    ex= av_clip(ex, 0, w-1);
1719
    ey= av_clip(ey, 0, h-1);
1720 1720

  
1721 1721
    buf[sy*stride + sx]+= color;
1722 1722

  
......
1762 1762
static void draw_arrow(uint8_t *buf, int sx, int sy, int ex, int ey, int w, int h, int stride, int color){
1763 1763
    int dx,dy;
1764 1764

  
1765
    sx= clip(sx, -100, w+100);
1766
    sy= clip(sy, -100, h+100);
1767
    ex= clip(ex, -100, w+100);
1768
    ey= clip(ey, -100, h+100);
1765
    sx= av_clip(sx, -100, w+100);
1766
    sy= av_clip(sy, -100, h+100);
1767
    ex= av_clip(ex, -100, w+100);
1768
    ey= av_clip(ey, -100, h+100);
1769 1769

  
1770 1770
    dx= ex - sx;
1771 1771
    dy= ey - sy;
......
2664 2664
    src_y = s->mb_y * 16 + (motion_y >> (s->sprite_warping_accuracy+1));
2665 2665
    motion_x<<=(3-s->sprite_warping_accuracy);
2666 2666
    motion_y<<=(3-s->sprite_warping_accuracy);
2667
    src_x = clip(src_x, -16, s->width);
2667
    src_x = av_clip(src_x, -16, s->width);
2668 2668
    if (src_x == s->width)
2669 2669
        motion_x =0;
2670
    src_y = clip(src_y, -16, s->height);
2670
    src_y = av_clip(src_y, -16, s->height);
2671 2671
    if (src_y == s->height)
2672 2672
        motion_y =0;
2673 2673

  
......
2706 2706
    src_y = s->mb_y * 8 + (motion_y >> (s->sprite_warping_accuracy+1));
2707 2707
    motion_x<<=(3-s->sprite_warping_accuracy);
2708 2708
    motion_y<<=(3-s->sprite_warping_accuracy);
2709
    src_x = clip(src_x, -8, s->width>>1);
2709
    src_x = av_clip(src_x, -8, s->width>>1);
2710 2710
    if (src_x == s->width>>1)
2711 2711
        motion_x =0;
2712
    src_y = clip(src_y, -8, s->height>>1);
2712
    src_y = av_clip(src_y, -8, s->height>>1);
2713 2713
    if (src_y == s->height>>1)
2714 2714
        motion_y =0;
2715 2715

  
......
2879 2879
    src_y += motion_y >> 1;
2880 2880

  
2881 2881
    /* WARNING: do no forget half pels */
2882
    src_x = clip(src_x, -16, width); //FIXME unneeded for emu?
2882
    src_x = av_clip(src_x, -16, width); //FIXME unneeded for emu?
2883 2883
    if (src_x == width)
2884 2884
        dxy &= ~1;
2885
    src_y = clip(src_y, -16, height);
2885
    src_y = av_clip(src_y, -16, height);
2886 2886
    if (src_y == height)
2887 2887
        dxy &= ~2;
2888 2888
    src += src_y * stride + src_x;
......
3358 3358

  
3359 3359
    src_x = s->mb_x * 8 + mx;
3360 3360
    src_y = s->mb_y * 8 + my;
3361
    src_x = clip(src_x, -8, s->width/2);
3361
    src_x = av_clip(src_x, -8, s->width/2);
3362 3362
    if (src_x == s->width/2)
3363 3363
        dxy &= ~1;
3364
    src_y = clip(src_y, -8, s->height/2);
3364
    src_y = av_clip(src_y, -8, s->height/2);
3365 3365
    if (src_y == s->height/2)
3366 3366
        dxy &= ~2;
3367 3367

  
......
3574 3574
                src_y = mb_y * 16 + (motion_y >> 2) + (i >>1) * 8;
3575 3575

  
3576 3576
                /* WARNING: do no forget half pels */
3577
                src_x = clip(src_x, -16, s->width);
3577
                src_x = av_clip(src_x, -16, s->width);
3578 3578
                if (src_x == s->width)
3579 3579
                    dxy &= ~3;
3580
                src_y = clip(src_y, -16, s->height);
3580
                src_y = av_clip(src_y, -16, s->height);
3581 3581
                if (src_y == s->height)
3582 3582
                    dxy &= ~12;
3583 3583

  
......
4343 4343
            s->dquant= s->qscale - last_qp;
4344 4344

  
4345 4345
            if(s->out_format==FMT_H263){
4346
                s->dquant= clip(s->dquant, -2, 2);
4346
                s->dquant= av_clip(s->dquant, -2, 2);
4347 4347

  
4348 4348
                if(s->codec_id==CODEC_ID_MPEG4){
4349 4349
                    if(!s->mb_intra){
......
5742 5742
        for(i=1;i<64;i++){
5743 5743
            int j= s->dsp.idct_permutation[i];
5744 5744

  
5745
            s->intra_matrix[j] = clip_uint8((ff_mpeg1_default_intra_matrix[i] * s->qscale) >> 3);
5745
            s->intra_matrix[j] = av_clip_uint8((ff_mpeg1_default_intra_matrix[i] * s->qscale) >> 3);
5746 5746
        }
5747 5747
        convert_matrix(&s->dsp, s->q_intra_matrix, s->q_intra_matrix16,
5748 5748
                       s->intra_matrix, s->intra_quant_bias, 8, 8, 1);

Also available in: Unified diff