comparison motion_est.c @ 2816:c6ab4b91a5c5 libavcodec

fix assertion failure for mpeg2 encoding
author michael
date Mon, 01 Aug 2005 20:01:41 +0000
parents edc4fccb3bec
children fd5d7c732c6b
comparison
equal deleted inserted replaced
2815:636133fccbdc 2816:c6ab4b91a5c5
1889 /* find best f_code for ME which do unlimited searches */ 1889 /* find best f_code for ME which do unlimited searches */
1890 int ff_get_best_fcode(MpegEncContext * s, int16_t (*mv_table)[2], int type) 1890 int ff_get_best_fcode(MpegEncContext * s, int16_t (*mv_table)[2], int type)
1891 { 1891 {
1892 if(s->me_method>=ME_EPZS){ 1892 if(s->me_method>=ME_EPZS){
1893 int score[8]; 1893 int score[8];
1894 int i, y, range= s->avctx->me_range; 1894 int i, y, range= s->avctx->me_range ? s->avctx->me_range : (INT_MAX/2);
1895 uint8_t * fcode_tab= s->fcode_tab; 1895 uint8_t * fcode_tab= s->fcode_tab;
1896 int best_fcode=-1; 1896 int best_fcode=-1;
1897 int best_score=-10000000; 1897 int best_score=-10000000;
1898 1898
1899 if(s->msmpeg4_version) 1899 if(s->msmpeg4_version)
1912 int my= mv_table[xy][1]; 1912 int my= mv_table[xy][1];
1913 int fcode= FFMAX(fcode_tab[mx + MAX_MV], 1913 int fcode= FFMAX(fcode_tab[mx + MAX_MV],
1914 fcode_tab[my + MAX_MV]); 1914 fcode_tab[my + MAX_MV]);
1915 int j; 1915 int j;
1916 1916
1917 if(range){
1918 if(mx >= range || mx < -range || 1917 if(mx >= range || mx < -range ||
1919 my >= range || my < -range) 1918 my >= range || my < -range)
1920 continue; 1919 continue;
1921 }
1922 1920
1923 for(j=0; j<fcode && j<8; j++){ 1921 for(j=0; j<fcode && j<8; j++){
1924 if(s->pict_type==B_TYPE || s->current_picture.mc_mb_var[xy] < s->current_picture.mb_var[xy]) 1922 if(s->pict_type==B_TYPE || s->current_picture.mc_mb_var[xy] < s->current_picture.mb_var[xy])
1925 score[j]-= 170; 1923 score[j]-= 170;
1926 } 1924 }