Changeset 56bf2c2a in ffmpeg


Ignore:
Timestamp:
Dec 17, 2011, 7:25:13 PM (13 years ago)
Author:
Michael Niedermayer <michaelni@gmx.at>
Branches:
master
Children:
9cb6a39
Parents:
c0bea184
git-author:
Michael Niedermayer <michaelni@gmx.at> (12/17/11 18:55:47)
git-committer:
Michael Niedermayer <michaelni@gmx.at> (12/17/11 19:25:13)
Message:

motion_est: avoid generating motion vectors that point between widthxheight and mb_widthxmb_height.
No difference in PSNR or bitrate in the printed precission with the matrix lobby scene at 322x242

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libavcodec/motion_est.c

    rc0bea184 r56bf2c2a  
    537537        c->xmin = - x - 16;
    538538        c->ymin = - y - 16;
    539         c->xmax = - x + s->mb_width *16;
    540         c->ymax = - y + s->mb_height*16;
     539        c->xmax = - x + s->width;
     540        c->ymax = - y + s->height;
    541541    } else if (s->out_format == FMT_H261){
    542542        // Search range of H261 is different from other codec standards
     
    577577    int block;
    578578    int P[10][2];
    579     int dmin_sum=0, mx4_sum=0, my4_sum=0;
     579    int dmin_sum=0, mx4_sum=0, my4_sum=0, i;
    580580    int same=1;
    581581    const int stride= c->stride;
    582582    uint8_t *mv_penalty= c->current_mv_penalty;
     583    int saftey_cliping= s->unrestricted_mv && (s->width&15) && (s->height&15);
    583584
    584585    init_mv4_ref(c);
     
    591592        const int mot_stride = s->b8_stride;
    592593        const int mot_xy = s->block_index[block];
     594
     595        if(saftey_cliping){
     596            c->xmax = - 16*s->mb_x + s->width  - 8*(block &1);
     597            c->ymax = - 16*s->mb_y + s->height - 8*(block>>1);
     598        }
    593599
    594600        P_LEFT[0] = s->current_picture.f.motion_val[0][mot_xy - 1][0];
     
    619625        P_MV1[0]= mx;
    620626        P_MV1[1]= my;
     627        if(saftey_cliping)
     628            for(i=0; i<10; i++){
     629                if(P[i][0] > (c->xmax<<shift)) P[i][0]= (c->xmax<<shift);
     630                if(P[i][1] > (c->ymax<<shift)) P[i][1]= (c->ymax<<shift);
     631            }
    621632
    622633        dmin4 = epzs_motion_search4(s, &mx4, &my4, P, block, block, s->p_mv_table, (1<<16)>>shift);
Note: See TracChangeset for help on using the changeset viewer.