Revision 326dff7d

View differences:

libavcodec/mpeg4videoenc.c
650 650

  
651 651
                    x= s->mb_x*16;
652 652
                    y= s->mb_y*16;
653
                    if(x+16 > s->width)  x= s->width-16;
654
                    if(y+16 > s->height) y= s->height-16;
655 653

  
656 654
                    offset= x + y*s->linesize;
657 655
                    p_pic= s->new_picture.data[0] + offset;
......
667 665
                        b_pic= pic->data[0] + offset;
668 666
                        if(pic->type != FF_BUFFER_TYPE_SHARED)
669 667
                            b_pic+= INPLACE_OFFSET;
670
                        diff= s->dsp.sad[0](NULL, p_pic, b_pic, s->linesize, 16);
668

  
669
                        if(x+16 > s->width || y+16 > s->height){
670
                            int x1,y1;
671
                            int xe= FFMIN(16, s->width - x);
672
                            int ye= FFMIN(16, s->height- y);
673
                            diff=0;
674
                            for(y1=0; y1<ye; y1++){
675
                                for(x1=0; x1<xe; x1++){
676
                                    diff+= FFABS(p_pic[x1+y1*s->linesize] - b_pic[x1+y1*s->linesize]);
677
                                }
678
                            }
679
                            diff= diff*256/(xe*ye);
680
                        }else{
681
                            diff= s->dsp.sad[0](NULL, p_pic, b_pic, s->linesize, 16);
682
                        }
671 683
                        if(diff>s->qscale*70){ //FIXME check that 70 is optimal
672 684
                            s->mb_skipped=0;
673 685
                            break;

Also available in: Unified diff