# HG changeset patch # User michaelni # Date 1016914893 0 # Node ID 32a3dcce2e9bf588b81452a692495f31cb21085d # Parent 91f7c38f5f37e2de62ec83aea27cfa4e070f244b fixing motion estimation with h263p hopefully diff -r 91f7c38f5f37 -r 32a3dcce2e9b h263.c --- a/h263.c Sat Mar 23 17:43:30 2002 +0000 +++ b/h263.c Sat Mar 23 20:21:33 2002 +0000 @@ -51,6 +51,7 @@ static UINT16 mv_penalty[MAX_FCODE][MAX_MV*2+1]; static UINT8 fcode_tab[MAX_MV*2+1]; +static UINT8 umv_fcode_tab[MAX_MV*2+1]; int h263_get_picture_format(int width, int height) { @@ -689,13 +690,16 @@ mv_penalty[f_code][mv+MAX_MV]= len; } } - for(f_code=MAX_FCODE; f_code>0; f_code--){ for(mv=-(16<mv_penalty= mv_penalty; + s->mv_penalty= mv_penalty; //FIXME exact table for msmpeg4 & h263p - // use fcodes >1 only for mpeg4&h263 FIXME - if(!s->h263_msmpeg4) s->fcode_tab= fcode_tab; + // use fcodes >1 only for mpeg4 & h263 & h263p FIXME + if(s->h263_plus) s->fcode_tab= umv_fcode_tab; + else if(s->h263_pred) s->fcode_tab= fcode_tab; } static void h263_encode_block(MpegEncContext * s, DCTELEM * block, int n) diff -r 91f7c38f5f37 -r 32a3dcce2e9b mpegvideo.c --- a/mpegvideo.c Sat Mar 23 17:43:30 2002 +0000 +++ b/mpegvideo.c Sat Mar 23 20:21:33 2002 +0000 @@ -381,6 +381,9 @@ else if (s->out_format == FMT_MPEG1) mpeg1_encode_init(s); + /* dont use mv_penalty table for crap MV as it would be confused */ + if(s->full_search<4) s->mv_penalty= default_mv_penalty; + s->encoding = 1; /* init */ @@ -1126,8 +1129,8 @@ } } - /* find best f_code */ - if(s->pict_type==P_TYPE){ + /* find best f_code for ME which do unlimited searches */ + if(s->pict_type==P_TYPE && s->full_search>3){ int mv_num[8]; int i; int loose=0; @@ -1149,6 +1152,10 @@ if(loose > 10) break; //FIXME this is pretty ineffective } s->f_code= i; +/* for(i=0; i<=MAX_FCODE; i++){ + printf("%d ", mv_num[i]); + } + printf("\n");*/ }else{ s->f_code= 1; }