Mercurial > libavcodec.hg
comparison motion_est.c @ 2302:857e16e85aea libavcodec
fix constrained parameters flag
author | michael |
---|---|
date | Mon, 18 Oct 2004 23:07:18 +0000 |
parents | 70b27300a496 |
children | 5e5cf598a48b |
comparison
equal
deleted
inserted
replaced
2301:79b14ad60f81 | 2302:857e16e85aea |
---|---|
1880 /* find best f_code for ME which do unlimited searches */ | 1880 /* find best f_code for ME which do unlimited searches */ |
1881 int ff_get_best_fcode(MpegEncContext * s, int16_t (*mv_table)[2], int type) | 1881 int ff_get_best_fcode(MpegEncContext * s, int16_t (*mv_table)[2], int type) |
1882 { | 1882 { |
1883 if(s->me_method>=ME_EPZS){ | 1883 if(s->me_method>=ME_EPZS){ |
1884 int score[8]; | 1884 int score[8]; |
1885 int i, y; | 1885 int i, y, range= s->avctx->me_range; |
1886 uint8_t * fcode_tab= s->fcode_tab; | 1886 uint8_t * fcode_tab= s->fcode_tab; |
1887 int best_fcode=-1; | 1887 int best_fcode=-1; |
1888 int best_score=-10000000; | 1888 int best_score=-10000000; |
1889 | 1889 |
1890 for(i=0; i<8; i++) score[i]= s->mb_num*(8-i); | 1890 for(i=0; i<8; i++) score[i]= s->mb_num*(8-i); |
1892 for(y=0; y<s->mb_height; y++){ | 1892 for(y=0; y<s->mb_height; y++){ |
1893 int x; | 1893 int x; |
1894 int xy= y*s->mb_stride; | 1894 int xy= y*s->mb_stride; |
1895 for(x=0; x<s->mb_width; x++){ | 1895 for(x=0; x<s->mb_width; x++){ |
1896 if(s->mb_type[xy] & type){ | 1896 if(s->mb_type[xy] & type){ |
1897 int fcode= FFMAX(fcode_tab[mv_table[xy][0] + MAX_MV], | 1897 int mx= mv_table[xy][0]; |
1898 fcode_tab[mv_table[xy][1] + MAX_MV]); | 1898 int my= mv_table[xy][1]; |
1899 int fcode= FFMAX(fcode_tab[mx + MAX_MV], | |
1900 fcode_tab[my + MAX_MV]); | |
1899 int j; | 1901 int j; |
1902 | |
1903 if(range){ | |
1904 if(mx >= range || mx < -range || | |
1905 my >= range || my < -range) | |
1906 continue; | |
1907 } | |
1900 | 1908 |
1901 for(j=0; j<fcode && j<8; j++){ | 1909 for(j=0; j<fcode && j<8; j++){ |
1902 if(s->pict_type==B_TYPE || s->current_picture.mc_mb_var[xy] < s->current_picture.mb_var[xy]) | 1910 if(s->pict_type==B_TYPE || s->current_picture.mc_mb_var[xy] < s->current_picture.mb_var[xy]) |
1903 score[j]-= 170; | 1911 score[j]-= 170; |
1904 } | 1912 } |