Revision f852ff32

View differences:

libavcodec/motion_est_template.c
667 667
    LOAD_COMMON
668 668
    LOAD_COMMON2
669 669
    int map_generation= c->map_generation;
670
    int x,y,i,d;
671
    static const int hex[6][2]={{-2, 0}, { 2,0}, {-1,-2}, {1,-2}, {-1,2},{1,2}};
670
    int x,y,d;
671
    const int dec= dia_size & (dia_size-1);
672 672

  
673 673
    cmpf= s->dsp.me_cmp[size];
674 674
    chroma_cmpf= s->dsp.me_cmp[size+1];
675 675

  
676
    for(;dia_size; dia_size--){
676
    for(;dia_size; dia_size= dec ? dia_size-1 : dia_size>>1){
677 677
        do{
678 678
            x= best[0];
679 679
            y= best[1];
680
            for(i=0; i<6; i++){
681
                CHECK_CLIPPED_MV(x+hex[i][0]*dia_size, y+hex[i][1]*dia_size);
680

  
681
            CHECK_CLIPPED_MV(x  -dia_size    , y);
682
            CHECK_CLIPPED_MV(x+  dia_size    , y);
683
            CHECK_CLIPPED_MV(x+( dia_size>>1), y+dia_size);
684
            CHECK_CLIPPED_MV(x+( dia_size>>1), y-dia_size);
685
            if(dia_size>1){
686
                CHECK_CLIPPED_MV(x+(-dia_size>>1), y+dia_size);
687
                CHECK_CLIPPED_MV(x+(-dia_size>>1), y-dia_size);
682 688
            }
683 689
        }while(best[0] != x || best[1] != y);
684 690
    }
685 691

  
686
    do{
687
        x= best[0];
688
        y= best[1];
689
        CHECK_CLIPPED_MV(x+1, y);
690
        CHECK_CLIPPED_MV(x, y+1);
691
        CHECK_CLIPPED_MV(x-1, y);
692
        CHECK_CLIPPED_MV(x, y-1);
693
    }while(best[0] != x || best[1] != y);
694

  
695 692
    return dmin;
696 693
}
697 694

  
......
704 701
    LOAD_COMMON
705 702
    LOAD_COMMON2
706 703
    int map_generation= c->map_generation;
707
    int x,y,i,d, dia_size;
704
    int x,y,i,d;
705
    int dia_size= c->dia_size&0xFF;
706
    const int dec= dia_size & (dia_size-1);
708 707
    static const int hex[8][2]={{-2, 0}, {-1,-1}, { 0,-2}, { 1,-1},
709 708
                                { 2, 0}, { 1, 1}, { 0, 2}, {-1, 1}};
710 709

  
711 710
    cmpf= s->dsp.me_cmp[size];
712 711
    chroma_cmpf= s->dsp.me_cmp[size+1];
713 712

  
714
    for(dia_size= c->dia_size&0xFF; dia_size; dia_size--){
713
    for(; dia_size; dia_size= dec ? dia_size-1 : dia_size>>1){
715 714
        do{
716 715
            x= best[0];
717 716
            y= best[1];

Also available in: Unified diff