~ubuntu-branches/ubuntu/feisty/avidemux/feisty

« back to all changes in this revision

Viewing changes to adm_lavcodec/motion_est.c

  • Committer: Bazaar Package Importer
  • Author(s): Christian Marillat
  • Date: 2005-05-25 13:02:29 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20050525130229-jw94cav0yhmg7vjw
Tags: 1:2.0.40-0.0
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
279
279
        c->hpel_put[2][2]= c->hpel_put[2][3]= zero_hpel;
280
280
    }
281
281
 
 
282
    if(s->codec_id == CODEC_ID_H261){
 
283
        c->sub_motion_search= no_sub_motion_search;
 
284
    }
 
285
 
282
286
    c->temp= c->scratchpad;
283
287
}
284
288
      
691
695
        c->ymin = - y - 16;
692
696
        c->xmax = - x + s->mb_width *16;
693
697
        c->ymax = - y + s->mb_height*16;
 
698
    } else if (s->out_format == FMT_H261){
 
699
        // Search range of H261 is different from other codec standards
 
700
        c->xmin = (x > 15) ? - 15 : 0;
 
701
        c->ymin = (y > 15) ? - 15 : 0;
 
702
        c->xmax = (x < s->mb_width * 16 - 16) ? 15 : 0;              
 
703
        c->ymax = (y < s->mb_height * 16 - 16) ? 15 : 0;
694
704
    } else {
695
705
        c->xmin = - x;
696
706
        c->ymin = - y;
1007
1017
    
1008
1018
    if(p_type && USES_LIST(mb_type, 1)){
1009
1019
        av_log(c->avctx, AV_LOG_ERROR, "backward motion vector in P frame\n");
1010
 
        return INT_MAX;
 
1020
        return INT_MAX/4;
1011
1021
    }
1012
1022
    assert(IS_INTRA(mb_type) || USES_LIST(mb_type,0) || USES_LIST(mb_type,1));
1013
1023
    
1025
1035
        
1026
1036
        if(!(s->flags & CODEC_FLAG_INTERLACED_ME)){
1027
1037
            av_log(c->avctx, AV_LOG_ERROR, "Interlaced macroblock selected but interlaced motion estimation disabled\n");
1028
 
            return INT_MAX;
 
1038
            return INT_MAX/4;
1029
1039
        }
1030
1040
 
1031
1041
        if(USES_LIST(mb_type, 0)){
1086
1096
    }else if(IS_8X8(mb_type)){
1087
1097
        if(!(s->flags & CODEC_FLAG_4MV)){
1088
1098
            av_log(c->avctx, AV_LOG_ERROR, "4MV macroblock selected but 4MV encoding disabled\n");
1089
 
            return INT_MAX;
 
1099
            return INT_MAX/4;
1090
1100
        }
1091
1101
        cmpf= s->dsp.sse[1];
1092
1102
        chroma_cmpf= s->dsp.sse[1];
1882
1892
{
1883
1893
    if(s->me_method>=ME_EPZS){
1884
1894
        int score[8];
1885
 
        int i, y;
 
1895
        int i, y, range= s->avctx->me_range;
1886
1896
        uint8_t * fcode_tab= s->fcode_tab;
1887
1897
        int best_fcode=-1;
1888
1898
        int best_score=-10000000;
1894
1904
            int xy= y*s->mb_stride;
1895
1905
            for(x=0; x<s->mb_width; x++){
1896
1906
                if(s->mb_type[xy] & type){
1897
 
                    int fcode= FFMAX(fcode_tab[mv_table[xy][0] + MAX_MV],
1898
 
                                     fcode_tab[mv_table[xy][1] + MAX_MV]);
 
1907
                    int mx= mv_table[xy][0];
 
1908
                    int my= mv_table[xy][1];
 
1909
                    int fcode= FFMAX(fcode_tab[mx + MAX_MV],
 
1910
                                     fcode_tab[my + MAX_MV]);
1899
1911
                    int j;
1900
1912
                    
 
1913
                    if(range){
 
1914
                        if(mx >= range || mx < -range || 
 
1915
                           my >= range || my < -range)
 
1916
                            continue;
 
1917
                    }
 
1918
                    
1901
1919
                    for(j=0; j<fcode && j<8; j++){
1902
1920
                        if(s->pict_type==B_TYPE || s->current_picture.mc_mb_var[xy] < s->current_picture.mb_var[xy])
1903
1921
                            score[j]-= 170;