static inline void ff_mpeg4_set_one_direct_mv(MpegEncContext *s, int mx, int my, int i){

    static const int tab_size = sizeof(s->direct_scale_mv[0])/sizeof(int16_t);

    static const int tab_bias = (tab_size/2);

    int xy= s->block_index[i];

    uint16_t time_pp= s->pp_time;

    uint16_t time_pb= s->pb_time;

    int p_mx, p_my;



    p_mx= s->next_picture.motion_val[0][xy][0];

    if((unsigned)(p_mx + tab_bias) < tab_size){

        s->mv[0][i][0] = s->direct_scale_mv[0][p_mx + tab_bias] + mx;

        s->mv[1][i][0] = mx ? s->mv[0][i][0] - p_mx

                            : s->direct_scale_mv[1][p_mx + tab_bias];

    }else{

        s->mv[0][i][0] = p_mx*time_pb/time_pp + mx;

        s->mv[1][i][0] = mx ? s->mv[0][i][0] - p_mx

                            : p_mx*(time_pb - time_pp)/time_pp;

    }

    p_my= s->next_picture.motion_val[0][xy][1];

    if((unsigned)(p_my + tab_bias) < tab_size){

        s->mv[0][i][1] = s->direct_scale_mv[0][p_my + tab_bias] + my;

        s->mv[1][i][1] = my ? s->mv[0][i][1] - p_my

                            : s->direct_scale_mv[1][p_my + tab_bias];

    }else{

        s->mv[0][i][1] = p_my*time_pb/time_pp + my;

        s->mv[1][i][1] = my ? s->mv[0][i][1] - p_my

                            : p_my*(time_pb - time_pp)/time_pp;

    }

}

static inline void ff_mpeg4_set_one_direct_mv(MpegEncContext *s, int mx, int my, int i){

    static const int tab_size = sizeof(s->direct_scale_mv[0])/sizeof(int16_t);

    static const int tab_bias = (tab_size/2);

    int xy= s->block_index[i];

    uint16_t time_pp= s->pp_time;

    uint16_t time_pb= s->pb_time;

    int p_mx, p_my;



    p_mx= s->next_picture.motion_val[0][xy][0];

    if((unsigned)(p_mx + tab_bias) < tab_size){

        s->mv[0][i][0] = s->direct_scale_mv[0][p_mx + tab_bias] + mx;

        s->mv[1][i][0] = mx ? s->mv[0][i][0] - p_mx

                            : s->direct_scale_mv[1][p_mx + tab_bias];

    }else{

        s->mv[0][i][0] = p_mx*time_pb/time_pp + mx;

        s->mv[1][i][0] = mx ? s->mv[0][i][0] - p_mx

                            : p_mx*(time_pb - time_pp)/time_pp;

    }

    p_my= s->next_picture.motion_val[0][xy][1];

    if((unsigned)(p_my + tab_bias) < tab_size){

        s->mv[0][i][1] = s->direct_scale_mv[0][p_my + tab_bias] + my;

        s->mv[1][i][1] = my ? s->mv[0][i][1] - p_my

                            : s->direct_scale_mv[1][p_my + tab_bias];

    }else{

        s->mv[0][i][1] = p_my*time_pb/time_pp + my;

        s->mv[1][i][1] = my ? s->mv[0][i][1] - p_my

                            : p_my*(time_pb - time_pp)/time_pp;

    }

}

    static const int tab_size = sizeof(s->direct_scale_mv[0])/sizeof(int16_t);     static const int tab_bias = (tab_size/2);     static const int tab_size = sizeof(s->direct_scale_mv[0])/sizeof(int16_t);     static const int tab_bias = (tab_size/2);
static inline void FUNC_0(MpegEncContext *VAR_0, int VAR_1, int VAR_2, int VAR_3){

    static const int VAR_4 = sizeof(VAR_0->direct_scale_mv[0])/sizeof(int16_t);

    static const int VAR_5 = (VAR_4/2);

    int VAR_6= VAR_0->block_index[VAR_3];

    uint16_t time_pp= VAR_0->pp_time;

    uint16_t time_pb= VAR_0->pb_time;

    int VAR_7, VAR_8;



    VAR_7= VAR_0->next_picture.motion_val[0][VAR_6][0];

    if((unsigned)(VAR_7 + VAR_5) < VAR_4){

        VAR_0->mv[0][VAR_3][0] = VAR_0->direct_scale_mv[0][VAR_7 + VAR_5] + VAR_1;

        VAR_0->mv[1][VAR_3][0] = VAR_1 ? VAR_0->mv[0][VAR_3][0] - VAR_7

                            : VAR_0->direct_scale_mv[1][VAR_7 + VAR_5];

    }else{

        VAR_0->mv[0][VAR_3][0] = VAR_7*time_pb/time_pp + VAR_1;

        VAR_0->mv[1][VAR_3][0] = VAR_1 ? VAR_0->mv[0][VAR_3][0] - VAR_7

                            : VAR_7*(time_pb - time_pp)/time_pp;

    }

    VAR_8= VAR_0->next_picture.motion_val[0][VAR_6][1];

    if((unsigned)(VAR_8 + VAR_5) < VAR_4){

        VAR_0->mv[0][VAR_3][1] = VAR_0->direct_scale_mv[0][VAR_8 + VAR_5] + VAR_2;

        VAR_0->mv[1][VAR_3][1] = VAR_2 ? VAR_0->mv[0][VAR_3][1] - VAR_8

                            : VAR_0->direct_scale_mv[1][VAR_8 + VAR_5];

    }else{

        VAR_0->mv[0][VAR_3][1] = VAR_8*time_pb/time_pp + VAR_2;

        VAR_0->mv[1][VAR_3][1] = VAR_2 ? VAR_0->mv[0][VAR_3][1] - VAR_8

                            : VAR_8*(time_pb - time_pp)/time_pp;

    }

}

static inline void FUNC_0(MpegEncContext *VAR_0, int VAR_1, int VAR_2, int VAR_3){ static const int VAR_4 = sizeof(VAR_0->direct_scale_mv[0])/sizeof(int16_t); static const int VAR_5 = (VAR_4/2); int VAR_6= VAR_0->block_index[VAR_3]; uint16_t time_pp= VAR_0->pp_time; uint16_t time_pb= VAR_0->pb_time; int VAR_7, VAR_8; VAR_7= VAR_0->next_picture.motion_val[0][VAR_6][0]; if((unsigned)(VAR_7 + VAR_5) < VAR_4){ VAR_0->mv[0][VAR_3][0] = VAR_0->direct_scale_mv[0][VAR_7 + VAR_5] + VAR_1; VAR_0->mv[1][VAR_3][0] = VAR_1 ? VAR_0->mv[0][VAR_3][0] - VAR_7
: VAR_0->direct_scale_mv[1][VAR_7 + VAR_5]; }else{ VAR_0->mv[0][VAR_3][0] = VAR_7*time_pb/time_pp + VAR_1; VAR_0->mv[1][VAR_3][0] = VAR_1 ? VAR_0->mv[0][VAR_3][0] - VAR_7
: VAR_7*(time_pb - time_pp)/time_pp; } VAR_8= VAR_0->next_picture.motion_val[0][VAR_6][1]; if((unsigned)(VAR_8 + VAR_5) < VAR_4){ VAR_0->mv[0][VAR_3][1] = VAR_0->direct_scale_mv[0][VAR_8 + VAR_5] + VAR_2; VAR_0->mv[1][VAR_3][1] = VAR_2 ? VAR_0->mv[0][VAR_3][1] - VAR_8
: VAR_0->direct_scale_mv[1][VAR_8 + VAR_5]; }else{ VAR_0->mv[0][VAR_3][1] = VAR_8*time_pb/time_pp + VAR_2; VAR_0->mv[1][VAR_3][1] = VAR_2 ? VAR_0->mv[0][VAR_3][1] - VAR_8
: VAR_8*(time_pb - time_pp)/time_pp; } }