Revision f66e4f5f libavcodec/jpeg_ls.c

View differences:

libavcodec/jpeg_ls.c
366 366
            }
367 367

  
368 368
            if(sign){
369
                pred = clip(pred - state->C[context], 0, state->maxval);
369
                pred = av_clip(pred - state->C[context], 0, state->maxval);
370 370
                err = -ls_get_code_regular(&s->gb, state, context);
371 371
            } else {
372
                pred = clip(pred + state->C[context], 0, state->maxval);
372
                pred = av_clip(pred + state->C[context], 0, state->maxval);
373 373
                err = ls_get_code_regular(&s->gb, state, context);
374 374
            }
375 375

  
......
381 381
                pred += state->range * state->twonear;
382 382
            else if(pred > state->maxval + state->near)
383 383
                pred -= state->range * state->twonear;
384
            pred = clip(pred, 0, state->maxval);
384
            pred = av_clip(pred, 0, state->maxval);
385 385
        }
386 386

  
387 387
        pred &= state->maxval;
......
623 623
                    err = -(state->near - err) / state->twonear;
624 624

  
625 625
                if(RItype || (Rb >= Ra))
626
                    Ra = clip(pred + err * state->twonear, 0, state->maxval);
626
                    Ra = av_clip(pred + err * state->twonear, 0, state->maxval);
627 627
                else
628
                    Ra = clip(pred - err * state->twonear, 0, state->maxval);
628
                    Ra = av_clip(pred - err * state->twonear, 0, state->maxval);
629 629
                W(cur, x, Ra);
630 630
            }
631 631
            if(err < 0)
......
646 646
            if(context < 0){
647 647
                context = -context;
648 648
                sign = 1;
649
                pred = clip(pred - state->C[context], 0, state->maxval);
649
                pred = av_clip(pred - state->C[context], 0, state->maxval);
650 650
                err = pred - R(cur, x);
651 651
            }else{
652 652
                sign = 0;
653
                pred = clip(pred + state->C[context], 0, state->maxval);
653
                pred = av_clip(pred + state->C[context], 0, state->maxval);
654 654
                err = R(cur, x) - pred;
655 655
            }
656 656

  
......
660 660
                else
661 661
                    err = -(state->near - err) / state->twonear;
662 662
                if(!sign)
663
                    Ra = clip(pred + err * state->twonear, 0, state->maxval);
663
                    Ra = av_clip(pred + err * state->twonear, 0, state->maxval);
664 664
                else
665
                    Ra = clip(pred - err * state->twonear, 0, state->maxval);
665
                    Ra = av_clip(pred - err * state->twonear, 0, state->maxval);
666 666
                W(cur, x, Ra);
667 667
            }
668 668

  

Also available in: Unified diff