aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/motion_est.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2004-10-18 23:07:18 +0000
committerMichael Niedermayer <michaelni@gmx.at>2004-10-18 23:07:18 +0000
commit7494cac0fd849a1950799e82bc04e8e6dd15cedc (patch)
tree486df8f5760b6296d559eb09f4fcf731f22c2893 /libavcodec/motion_est.c
parentd08f4bcbbd6b50387729ef9666de13bbac909945 (diff)
downloadffmpeg-7494cac0fd849a1950799e82bc04e8e6dd15cedc.tar.gz
fix constrained parameters flag
Originally committed as revision 3609 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/motion_est.c')
-rw-r--r--libavcodec/motion_est.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c
index a43cd13619..64550edffc 100644
--- a/libavcodec/motion_est.c
+++ b/libavcodec/motion_est.c
@@ -1882,7 +1882,7 @@ int ff_get_best_fcode(MpegEncContext * s, int16_t (*mv_table)[2], int type)
{
if(s->me_method>=ME_EPZS){
int score[8];
- int i, y;
+ int i, y, range= s->avctx->me_range;
uint8_t * fcode_tab= s->fcode_tab;
int best_fcode=-1;
int best_score=-10000000;
@@ -1894,10 +1894,18 @@ int ff_get_best_fcode(MpegEncContext * s, int16_t (*mv_table)[2], int type)
int xy= y*s->mb_stride;
for(x=0; x<s->mb_width; x++){
if(s->mb_type[xy] & type){
- int fcode= FFMAX(fcode_tab[mv_table[xy][0] + MAX_MV],
- fcode_tab[mv_table[xy][1] + MAX_MV]);
+ int mx= mv_table[xy][0];
+ int my= mv_table[xy][1];
+ int fcode= FFMAX(fcode_tab[mx + MAX_MV],
+ fcode_tab[my + MAX_MV]);
int j;
+ if(range){
+ if(mx >= range || mx < -range ||
+ my >= range || my < -range)
+ continue;
+ }
+
for(j=0; j<fcode && j<8; j++){
if(s->pict_type==B_TYPE || s->current_picture.mc_mb_var[xy] < s->current_picture.mb_var[xy])
score[j]-= 170;