s->mb_type[i] &= ~MB_TYPE_INTER4V; s->mb_type[i] |= MB_TYPE_INTRA; s->current_picture.mb_type[i]= MB_TYPE_INTRA;
s->mb_type[i] &= ~CANDIDATE_MB_TYPE_INTER4V; s->mb_type[i] |= CANDIDATE_MB_TYPE_INTRA; s->current_picture.mb_type[i]= CANDIDATE_MB_TYPE_INTRA;
void ff_fix_long_p_mvs(MpegEncContext * s){    const int f_code= s->f_code;    int y, range;    assert(s->pict_type==P_TYPE);    range = (((s->out_format == FMT_MPEG1) ? 8 : 16) << f_code);        if(s->msmpeg4_version) range= 16;        if(s->avctx->me_range && range > s->avctx->me_range) range= s->avctx->me_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]&MB_TYPE_INTER){                if(   s->p_mv_table[xy][0] >=range || s->p_mv_table[xy][0] <-range                   || s->p_mv_table[xy][1] >=range || s->p_mv_table[xy][1] <-range){                    s->mb_type[xy] &= ~MB_TYPE_INTER;                    s->mb_type[xy] |= MB_TYPE_INTRA;                    s->current_picture.mb_type[xy]= MB_TYPE_INTRA;                    s->p_mv_table[xy][0] = 0;                    s->p_mv_table[xy][1] = 0;                }            }            xy++;        }    }//printf("%d no:%d %d//\n", clip, noclip, f_code);    if(s->flags&CODEC_FLAG_4MV){        const int wrap= 2+ s->mb_width*2;        /* clip / convert to intra 8x8 type MVs */        for(y=0; y<s->mb_height; y++){            int xy= (y*2 + 1)*wrap + 1;            int i= y*s->mb_stride;            int x;            for(x=0; x<s->mb_width; x++){                if(s->mb_type[i]&MB_TYPE_INTER4V){                    int block;                    for(block=0; block<4; block++){                        int off= (block& 1) + (block>>1)*wrap;                        int mx= s->current_picture.motion_val[0][ xy + off ][0];                        int my= s->current_picture.motion_val[0][ xy + off ][1];                        if(   mx >=range || mx <-range                           || my >=range || my <-range){                            s->mb_type[i] &= ~MB_TYPE_INTER4V;                            s->mb_type[i] |= MB_TYPE_INTRA;                            s->current_picture.mb_type[i]= MB_TYPE_INTRA;                        }                    }                }                xy+=2;                i++;            }        }    }}