static inline void write_back_motion(H264Context *h, int mb_type){

    MpegEncContext * const s = &h->s;

    const int b_xy = 4*s->mb_x + 4*s->mb_y*h->b_stride;

    const int b8_xy= 2*s->mb_x + 2*s->mb_y*h->b8_stride;

    int list;



    if(!USES_LIST(mb_type, 0))

        fill_rectangle(&s->current_picture.ref_index[0][b8_xy], 2, 2, h->b8_stride, (uint8_t)LIST_NOT_USED, 1);



    for(list=0; list<2; list++){

        int y;

        if(!USES_LIST(mb_type, list))

            continue;



        for(y=0; y<4; y++){

            *(uint64_t*)s->current_picture.motion_val[list][b_xy + 0 + y*h->b_stride]= *(uint64_t*)h->mv_cache[list][scan8[0]+0 + 8*y];

            *(uint64_t*)s->current_picture.motion_val[list][b_xy + 2 + y*h->b_stride]= *(uint64_t*)h->mv_cache[list][scan8[0]+2 + 8*y];

        }

        if( h->pps.cabac ) {

            if(IS_SKIP(mb_type))

                fill_rectangle(h->mvd_table[list][b_xy], 4, 4, h->b_stride, 0, 4);

            else

            for(y=0; y<4; y++){

                *(uint64_t*)h->mvd_table[list][b_xy + 0 + y*h->b_stride]= *(uint64_t*)h->mvd_cache[list][scan8[0]+0 + 8*y];

                *(uint64_t*)h->mvd_table[list][b_xy + 2 + y*h->b_stride]= *(uint64_t*)h->mvd_cache[list][scan8[0]+2 + 8*y];

            }

        }



        {

            int8_t *ref_index = &s->current_picture.ref_index[list][b8_xy];

            ref_index[0+0*h->b8_stride]= h->ref_cache[list][scan8[0]];

            ref_index[1+0*h->b8_stride]= h->ref_cache[list][scan8[4]];

            ref_index[0+1*h->b8_stride]= h->ref_cache[list][scan8[8]];

            ref_index[1+1*h->b8_stride]= h->ref_cache[list][scan8[12]];

        }

    }



    if(h->slice_type == B_TYPE && h->pps.cabac){

        if(IS_8X8(mb_type)){

            uint8_t *direct_table = &h->direct_table[b8_xy];

            direct_table[1+0*h->b8_stride] = IS_DIRECT(h->sub_mb_type[1]) ? 1 : 0;

            direct_table[0+1*h->b8_stride] = IS_DIRECT(h->sub_mb_type[2]) ? 1 : 0;

            direct_table[1+1*h->b8_stride] = IS_DIRECT(h->sub_mb_type[3]) ? 1 : 0;

        }

    }

}

static inline void write_back_motion(H264Context *h, int mb_type){

    MpegEncContext * const s = &h->s;

    const int b_xy = 4*s->mb_x + 4*s->mb_y*h->b_stride;

    const int b8_xy= 2*s->mb_x + 2*s->mb_y*h->b8_stride;

    int list;



    if(!USES_LIST(mb_type, 0))

        fill_rectangle(&s->current_picture.ref_index[0][b8_xy], 2, 2, h->b8_stride, (uint8_t)LIST_NOT_USED, 1);



    for(list=0; list<2; list++){

        int y;

        if(!USES_LIST(mb_type, list))

            continue;



        for(y=0; y<4; y++){

            *(uint64_t*)s->current_picture.motion_val[list][b_xy + 0 + y*h->b_stride]= *(uint64_t*)h->mv_cache[list][scan8[0]+0 + 8*y];

            *(uint64_t*)s->current_picture.motion_val[list][b_xy + 2 + y*h->b_stride]= *(uint64_t*)h->mv_cache[list][scan8[0]+2 + 8*y];

        }

        if( h->pps.cabac ) {

            if(IS_SKIP(mb_type))

                fill_rectangle(h->mvd_table[list][b_xy], 4, 4, h->b_stride, 0, 4);

            else

            for(y=0; y<4; y++){

                *(uint64_t*)h->mvd_table[list][b_xy + 0 + y*h->b_stride]= *(uint64_t*)h->mvd_cache[list][scan8[0]+0 + 8*y];

                *(uint64_t*)h->mvd_table[list][b_xy + 2 + y*h->b_stride]= *(uint64_t*)h->mvd_cache[list][scan8[0]+2 + 8*y];

            }

        }



        {

            int8_t *ref_index = &s->current_picture.ref_index[list][b8_xy];

            ref_index[0+0*h->b8_stride]= h->ref_cache[list][scan8[0]];

            ref_index[1+0*h->b8_stride]= h->ref_cache[list][scan8[4]];

            ref_index[0+1*h->b8_stride]= h->ref_cache[list][scan8[8]];

            ref_index[1+1*h->b8_stride]= h->ref_cache[list][scan8[12]];

        }

    }



    if(h->slice_type == B_TYPE && h->pps.cabac){

        if(IS_8X8(mb_type)){

            uint8_t *direct_table = &h->direct_table[b8_xy];

            direct_table[1+0*h->b8_stride] = IS_DIRECT(h->sub_mb_type[1]) ? 1 : 0;

            direct_table[0+1*h->b8_stride] = IS_DIRECT(h->sub_mb_type[2]) ? 1 : 0;

            direct_table[1+1*h->b8_stride] = IS_DIRECT(h->sub_mb_type[3]) ? 1 : 0;

        }

    }

}

static inline void FUNC_0(H264Context *VAR_0, int VAR_1){

    MpegEncContext * const s = &VAR_0->s;

    const int VAR_2 = 4*s->mb_x + 4*s->mb_y*VAR_0->b_stride;

    const int VAR_3= 2*s->mb_x + 2*s->mb_y*VAR_0->b8_stride;

    int VAR_4;



    if(!USES_LIST(VAR_1, 0))

        fill_rectangle(&s->current_picture.ref_index[0][VAR_3], 2, 2, VAR_0->b8_stride, (uint8_t)LIST_NOT_USED, 1);



    for(VAR_4=0; VAR_4<2; VAR_4++){

        int VAR_5;

        if(!USES_LIST(VAR_1, VAR_4))

            continue;



        for(VAR_5=0; VAR_5<4; VAR_5++){

            *(uint64_t*)s->current_picture.motion_val[VAR_4][VAR_2 + 0 + VAR_5*VAR_0->b_stride]= *(uint64_t*)VAR_0->mv_cache[VAR_4][scan8[0]+0 + 8*VAR_5];

            *(uint64_t*)s->current_picture.motion_val[VAR_4][VAR_2 + 2 + VAR_5*VAR_0->b_stride]= *(uint64_t*)VAR_0->mv_cache[VAR_4][scan8[0]+2 + 8*VAR_5];

        }

        if( VAR_0->pps.cabac ) {

            if(IS_SKIP(VAR_1))

                fill_rectangle(VAR_0->mvd_table[VAR_4][VAR_2], 4, 4, VAR_0->b_stride, 0, 4);

            else

            for(VAR_5=0; VAR_5<4; VAR_5++){

                *(uint64_t*)VAR_0->mvd_table[VAR_4][VAR_2 + 0 + VAR_5*VAR_0->b_stride]= *(uint64_t*)VAR_0->mvd_cache[VAR_4][scan8[0]+0 + 8*VAR_5];

                *(uint64_t*)VAR_0->mvd_table[VAR_4][VAR_2 + 2 + VAR_5*VAR_0->b_stride]= *(uint64_t*)VAR_0->mvd_cache[VAR_4][scan8[0]+2 + 8*VAR_5];

            }

        }



        {

            int8_t *ref_index = &s->current_picture.ref_index[VAR_4][VAR_3];

            ref_index[0+0*VAR_0->b8_stride]= VAR_0->ref_cache[VAR_4][scan8[0]];

            ref_index[1+0*VAR_0->b8_stride]= VAR_0->ref_cache[VAR_4][scan8[4]];

            ref_index[0+1*VAR_0->b8_stride]= VAR_0->ref_cache[VAR_4][scan8[8]];

            ref_index[1+1*VAR_0->b8_stride]= VAR_0->ref_cache[VAR_4][scan8[12]];

        }

    }



    if(VAR_0->slice_type == B_TYPE && VAR_0->pps.cabac){

        if(IS_8X8(VAR_1)){

            uint8_t *direct_table = &VAR_0->direct_table[VAR_3];

            direct_table[1+0*VAR_0->b8_stride] = IS_DIRECT(VAR_0->sub_mb_type[1]) ? 1 : 0;

            direct_table[0+1*VAR_0->b8_stride] = IS_DIRECT(VAR_0->sub_mb_type[2]) ? 1 : 0;

            direct_table[1+1*VAR_0->b8_stride] = IS_DIRECT(VAR_0->sub_mb_type[3]) ? 1 : 0;

        }

    }

}

static inline void FUNC_0(H264Context *VAR_0, int VAR_1){ MpegEncContext * const s = &VAR_0->s; const int VAR_2 = 4*s->mb_x + 4*s->mb_y*VAR_0->b_stride; const int VAR_3= 2*s->mb_x + 2*s->mb_y*VAR_0->b8_stride; int VAR_4; if(!USES_LIST(VAR_1, 0))
fill_rectangle(&s->current_picture.ref_index[0][VAR_3], 2, 2, VAR_0->b8_stride, (uint8_t)LIST_NOT_USED, 1); for(VAR_4=0; VAR_4<2; VAR_4++){ int VAR_5; if(!USES_LIST(VAR_1, VAR_4))
continue; for(VAR_5=0; VAR_5<4; VAR_5++){ *(uint64_t*)s->current_picture.motion_val[VAR_4][VAR_2 + 0 + VAR_5*VAR_0->b_stride]= *(uint64_t*)VAR_0->mv_cache[VAR_4][scan8[0]+0 + 8*VAR_5]; *(uint64_t*)s->current_picture.motion_val[VAR_4][VAR_2 + 2 + VAR_5*VAR_0->b_stride]= *(uint64_t*)VAR_0->mv_cache[VAR_4][scan8[0]+2 + 8*VAR_5]; } if( VAR_0->pps.cabac ) { if(IS_SKIP(VAR_1))
fill_rectangle(VAR_0->mvd_table[VAR_4][VAR_2], 4, 4, VAR_0->b_stride, 0, 4); else
for(VAR_5=0; VAR_5<4; VAR_5++){ *(uint64_t*)VAR_0->mvd_table[VAR_4][VAR_2 + 0 + VAR_5*VAR_0->b_stride]= *(uint64_t*)VAR_0->mvd_cache[VAR_4][scan8[0]+0 + 8*VAR_5]; *(uint64_t*)VAR_0->mvd_table[VAR_4][VAR_2 + 2 + VAR_5*VAR_0->b_stride]= *(uint64_t*)VAR_0->mvd_cache[VAR_4][scan8[0]+2 + 8*VAR_5]; } } { int8_t *ref_index = &s->current_picture.ref_index[VAR_4][VAR_3]; ref_index[0+0*VAR_0->b8_stride]= VAR_0->ref_cache[VAR_4][scan8[0]]; ref_index[1+0*VAR_0->b8_stride]= VAR_0->ref_cache[VAR_4][scan8[4]]; ref_index[0+1*VAR_0->b8_stride]= VAR_0->ref_cache[VAR_4][scan8[8]]; ref_index[1+1*VAR_0->b8_stride]= VAR_0->ref_cache[VAR_4][scan8[12]]; } } if(VAR_0->slice_type == B_TYPE && VAR_0->pps.cabac){ if(IS_8X8(VAR_1)){ uint8_t *direct_table = &VAR_0->direct_table[VAR_3]; direct_table[1+0*VAR_0->b8_stride] = IS_DIRECT(VAR_0->sub_mb_type[1]) ? 1 : 0; direct_table[0+1*VAR_0->b8_stride] = IS_DIRECT(VAR_0->sub_mb_type[2]) ? 1 : 0; direct_table[1+1*VAR_0->b8_stride] = IS_DIRECT(VAR_0->sub_mb_type[3]) ? 1 : 0; } } }