Logo Search packages:      
Sourcecode: blender version File versions  Download package

void ff_fix_long_mvs ( MpegEncContext s,
uint8_t *  field_select_table,
int  field_select,
int16_t(*)  mv_table[2],
int  f_code,
int  type,
int  truncate 
)

Parameters:
truncate 1 for truncation, 0 for using intra

Definition at line 2074 of file motion_est.c.

References MotionEstContext::avctx, MpegEncContext::mb_height, MpegEncContext::mb_stride, MpegEncContext::mb_type, MpegEncContext::mb_width, MpegEncContext::me, AVCodecContext::me_range, MpegEncContext::msmpeg4_version, and MpegEncContext::out_format.

{
    MotionEstContext * const c= &s->me;
    int y, h_range, v_range;

    // RAL: 8 in MPEG-1, 16 in MPEG-4
    int range = (((s->out_format == FMT_MPEG1 || s->msmpeg4_version) ? 8 : 16) << f_code);

    if(c->avctx->me_range && range > c->avctx->me_range) range= c->avctx->me_range;

    h_range= range;
    v_range= field_select_table ? range>>1 : range;

    /* clip / convert to intra 16x16 type MVs */
    for(y=0; y<s->mb_height; y++){
        int x;
        int xy= y*s->mb_stride;
        for(x=0; x<s->mb_width; x++){
            if (s->mb_type[xy] & type){    // RAL: "type" test added...
                if(field_select_table==NULL || field_select_table[xy] == field_select){
                    if(   mv_table[xy][0] >=h_range || mv_table[xy][0] <-h_range
                       || mv_table[xy][1] >=v_range || mv_table[xy][1] <-v_range){

                        if(truncate){
                            if     (mv_table[xy][0] > h_range-1) mv_table[xy][0]=  h_range-1;
                            else if(mv_table[xy][0] < -h_range ) mv_table[xy][0]= -h_range;
                            if     (mv_table[xy][1] > v_range-1) mv_table[xy][1]=  v_range-1;
                            else if(mv_table[xy][1] < -v_range ) mv_table[xy][1]= -v_range;
                        }else{
                            s->mb_type[xy] &= ~type;
                            s->mb_type[xy] |= CANDIDATE_MB_TYPE_INTRA;
                            mv_table[xy][0]=
                            mv_table[xy][1]= 0;
                        }
                    }
                }
            }
            xy++;
        }
    }
}


Generated by  Doxygen 1.6.0   Back to index