static int decode_b_mbs(VC9Context *v)

{

    MpegEncContext *s = &v->s;

    GetBitContext *gb = &v->s.gb;

    int current_mb = 0, i /* MB / B postion information */;

    int b_mv_type = BMV_TYPE_BACKWARD;

    int mquant, mqdiff; /* MB quant stuff */

    int ttmb; /* MacroBlock transform type */

    

    static const int size_table[6] = { 0, 2, 3, 4, 5, 8 },

        offset_table[6] = { 0, 1, 3, 7, 15, 31 };

    int mb_has_coeffs = 1; /* last_flag */

    int dmv1_x, dmv1_y, dmv2_x, dmv2_y; /* Differential MV components */

    int k_x, k_y; /* Long MV fixed bitlength */

    int hpel_flag; /* Some MB properties */

    int index, index1; /* LUT indices */

    int val, sign; /* MVDATA temp values */

    

    /* Select proper long MV range */

    switch (v->mvrange)

    {

    case 1: k_x = 10; k_y = 9; break;

    case 2: k_x = 12; k_y = 10; break;

    case 3: k_x = 13; k_y = 11; break;

    default: /*case 0 too */ k_x = 9; k_y = 8; break;

    }

    hpel_flag = v->mv_mode & 1; //MV_PMODE is HPEL

    k_x -= hpel_flag;

    k_y -= hpel_flag;



    /* Select ttmb table depending on pq */

    if (v->pq < 5) v->ttmb_vlc = &vc9_ttmb_vlc[0];

    else if (v->pq < 13) v->ttmb_vlc = &vc9_ttmb_vlc[1];

    else v->ttmb_vlc = &vc9_ttmb_vlc[2];



    for (s->mb_y=0; s->mb_y<s->mb_height; s->mb_y++)

    {

        for (s->mb_x=0; s->mb_x<s->mb_width; s->mb_x++)

        {

            if (v->direct_mb_plane.is_raw)

                v->direct_mb_plane.data[current_mb] = get_bits(gb, 1);

            if (v->skip_mb_plane.is_raw)

                v->skip_mb_plane.data[current_mb] = get_bits(gb, 1);

            

            if (!v->direct_mb_plane.data[current_mb])

            {

                if (v->skip_mb_plane.data[current_mb])

                {

                    b_mv_type = decode012(gb);

                    if (v->bfraction > 420 /*1/2*/ &&

                        b_mv_type < 3) b_mv_type = 1-b_mv_type;

                }

                else

                { 

                    GET_MVDATA(dmv1_x, dmv1_y);

                    if (!s->mb_intra /* b_mv1 tells not intra */)

                    {

                        b_mv_type = decode012(gb);

                        if (v->bfraction > 420 /*1/2*/ &&

                            b_mv_type < 3) b_mv_type = 1-b_mv_type;

                    }

                }

            }

            if (!v->skip_mb_plane.data[current_mb])

            {

                if (mb_has_coeffs /* BMV1 == "last" */)

                {

                    GET_MQUANT();

                    if (s->mb_intra /* intra mb */)

                        s->ac_pred = get_bits(gb, 1);

                }

                else

                {

                    /* if bmv1 tells MVs are interpolated */

                    if (b_mv_type == BMV_TYPE_INTERPOLATED)

                    {

                        GET_MVDATA(dmv2_x, dmv2_y);

                    }

                    /* GET_MVDATA has reset some stuff */

                    if (mb_has_coeffs /* b_mv2 == "last" */)

                    {

                        if (s->mb_intra /* intra_mb */)

                            s->ac_pred = get_bits(gb, 1);

                        GET_MQUANT();

                    }

                }

            }

            //End1

            if (v->ttmbf)

                ttmb = get_vlc2(gb, v->ttmb_vlc->table,

                                   VC9_TTMB_VLC_BITS, 12);



            //End2

            for (i=0; i<6; i++)

            {

                /* FIXME: process the block */

            }



            current_mb++;

        }

    }

    return 0;

}

static int decode_b_mbs(VC9Context *v)

{

    MpegEncContext *s = &v->s;

    GetBitContext *gb = &v->s.gb;

    int current_mb = 0, i ;

    int b_mv_type = BMV_TYPE_BACKWARD;

    int mquant, mqdiff; 

    int ttmb; 

    

    static const int size_table[6] = { 0, 2, 3, 4, 5, 8 },

        offset_table[6] = { 0, 1, 3, 7, 15, 31 };

    int mb_has_coeffs = 1; 

    int dmv1_x, dmv1_y, dmv2_x, dmv2_y; 

    int k_x, k_y; 

    int hpel_flag; 

    int index, index1; 

    int val, sign; 

    

    

    switch (v->mvrange)

    {

    case 1: k_x = 10; k_y = 9; break;

    case 2: k_x = 12; k_y = 10; break;

    case 3: k_x = 13; k_y = 11; break;

    default:  k_x = 9; k_y = 8; break;

    }

    hpel_flag = v->mv_mode & 1; 

    k_x -= hpel_flag;

    k_y -= hpel_flag;



    

    if (v->pq < 5) v->ttmb_vlc = &vc9_ttmb_vlc[0];

    else if (v->pq < 13) v->ttmb_vlc = &vc9_ttmb_vlc[1];

    else v->ttmb_vlc = &vc9_ttmb_vlc[2];



    for (s->mb_y=0; s->mb_y<s->mb_height; s->mb_y++)

    {

        for (s->mb_x=0; s->mb_x<s->mb_width; s->mb_x++)

        {

            if (v->direct_mb_plane.is_raw)

                v->direct_mb_plane.data[current_mb] = get_bits(gb, 1);

            if (v->skip_mb_plane.is_raw)

                v->skip_mb_plane.data[current_mb] = get_bits(gb, 1);

            

            if (!v->direct_mb_plane.data[current_mb])

            {

                if (v->skip_mb_plane.data[current_mb])

                {

                    b_mv_type = decode012(gb);

                    if (v->bfraction > 420  &&

                        b_mv_type < 3) b_mv_type = 1-b_mv_type;

                }

                else

                { 

                    GET_MVDATA(dmv1_x, dmv1_y);

                    if (!s->mb_intra )

                    {

                        b_mv_type = decode012(gb);

                        if (v->bfraction > 420  &&

                            b_mv_type < 3) b_mv_type = 1-b_mv_type;

                    }

                }

            }

            if (!v->skip_mb_plane.data[current_mb])

            {

                if (mb_has_coeffs )

                {

                    GET_MQUANT();

                    if (s->mb_intra )

                        s->ac_pred = get_bits(gb, 1);

                }

                else

                {

                    

                    if (b_mv_type == BMV_TYPE_INTERPOLATED)

                    {

                        GET_MVDATA(dmv2_x, dmv2_y);

                    }

                    

                    if (mb_has_coeffs )

                    {

                        if (s->mb_intra )

                            s->ac_pred = get_bits(gb, 1);

                        GET_MQUANT();

                    }

                }

            }

            

            if (v->ttmbf)

                ttmb = get_vlc2(gb, v->ttmb_vlc->table,

                                   VC9_TTMB_VLC_BITS, 12);



            

            for (i=0; i<6; i++)

            {

                

            }



            current_mb++;

        }

    }

    return 0;

}

    GetBitContext *gb = &v->s.gb;     GetBitContext *gb = &v->s.gb;     if (v->pq < 5) v->ttmb_vlc = &vc9_ttmb_vlc[0];     else if (v->pq < 13) v->ttmb_vlc = &vc9_ttmb_vlc[1];     else v->ttmb_vlc = &vc9_ttmb_vlc[2];             current_mb++;     if (v->pq < 5) v->ttmb_vlc = &vc9_ttmb_vlc[0];     else if (v->pq < 13) v->ttmb_vlc = &vc9_ttmb_vlc[1];     else v->ttmb_vlc = &vc9_ttmb_vlc[2];     case 1: k_x = 10; k_y = 9; break;     case 2: k_x = 12; k_y = 10; break;     case 3: k_x = 13; k_y = 11; break;     k_x -= hpel_flag;     k_y -= hpel_flag;                 v->skip_mb_plane.data[current_mb] = get_bits(gb, 1);             current_mb++;     if (v->pq < 5) v->ttmb_vlc = &vc9_ttmb_vlc[0];     else if (v->pq < 13) v->ttmb_vlc = &vc9_ttmb_vlc[1];     else v->ttmb_vlc = &vc9_ttmb_vlc[2];                 v->direct_mb_plane.data[current_mb] = get_bits(gb, 1);                 v->skip_mb_plane.data[current_mb] = get_bits(gb, 1);             if (!v->direct_mb_plane.data[current_mb])                 if (v->skip_mb_plane.data[current_mb])             if (!v->skip_mb_plane.data[current_mb])                 ttmb = get_vlc2(gb, v->ttmb_vlc->table,                                    VC9_TTMB_VLC_BITS, 12);             current_mb++;
static int FUNC_0(VC9Context *VAR_0)

{

    MpegEncContext *s = &VAR_0->s;

    GetBitContext *gb = &VAR_0->s.gb;

    int VAR_1 = 0, VAR_2 ;

    int VAR_3 = BMV_TYPE_BACKWARD;

    int VAR_4, VAR_5; 

    int VAR_6; 

    

    static const int VAR_7[6] = { 0, 2, 3, 4, 5, 8 },

        VAR_8[6] = { 0, 1, 3, 7, 15, 31 };

    int VAR_9 = 1; 

    int VAR_10, VAR_11, VAR_12, VAR_13; 

    int VAR_14, VAR_15; 

    int VAR_16; 

    int VAR_17, VAR_18; 

    int VAR_19, VAR_20; 

    

    

    switch (VAR_0->mvrange)

    {

    case 1: VAR_14 = 10; VAR_15 = 9; break;

    case 2: VAR_14 = 12; VAR_15 = 10; break;

    case 3: VAR_14 = 13; VAR_15 = 11; break;

    default:  VAR_14 = 9; VAR_15 = 8; break;

    }

    VAR_16 = VAR_0->mv_mode & 1; 

    VAR_14 -= VAR_16;

    VAR_15 -= VAR_16;



    

    if (VAR_0->pq < 5) VAR_0->ttmb_vlc = &vc9_ttmb_vlc[0];

    else if (VAR_0->pq < 13) VAR_0->ttmb_vlc = &vc9_ttmb_vlc[1];

    else VAR_0->ttmb_vlc = &vc9_ttmb_vlc[2];



    for (s->mb_y=0; s->mb_y<s->mb_height; s->mb_y++)

    {

        for (s->mb_x=0; s->mb_x<s->mb_width; s->mb_x++)

        {

            if (VAR_0->direct_mb_plane.is_raw)

                VAR_0->direct_mb_plane.data[VAR_1] = get_bits(gb, 1);

            if (VAR_0->skip_mb_plane.is_raw)

                VAR_0->skip_mb_plane.data[VAR_1] = get_bits(gb, 1);

            

            if (!VAR_0->direct_mb_plane.data[VAR_1])

            {

                if (VAR_0->skip_mb_plane.data[VAR_1])

                {

                    VAR_3 = decode012(gb);

                    if (VAR_0->bfraction > 420  &&

                        VAR_3 < 3) VAR_3 = 1-VAR_3;

                }

                else

                { 

                    GET_MVDATA(VAR_10, VAR_11);

                    if (!s->mb_intra )

                    {

                        VAR_3 = decode012(gb);

                        if (VAR_0->bfraction > 420  &&

                            VAR_3 < 3) VAR_3 = 1-VAR_3;

                    }

                }

            }

            if (!VAR_0->skip_mb_plane.data[VAR_1])

            {

                if (VAR_9 )

                {

                    GET_MQUANT();

                    if (s->mb_intra )

                        s->ac_pred = get_bits(gb, 1);

                }

                else

                {

                    

                    if (VAR_3 == BMV_TYPE_INTERPOLATED)

                    {

                        GET_MVDATA(VAR_12, VAR_13);

                    }

                    

                    if (VAR_9 )

                    {

                        if (s->mb_intra )

                            s->ac_pred = get_bits(gb, 1);

                        GET_MQUANT();

                    }

                }

            }

            

            if (VAR_0->ttmbf)

                VAR_6 = get_vlc2(gb, VAR_0->ttmb_vlc->table,

                                   VC9_TTMB_VLC_BITS, 12);



            

            for (VAR_2=0; VAR_2<6; VAR_2++)

            {

                

            }



            VAR_1++;

        }

    }

    return 0;

}

static int FUNC_0(VC9Context *VAR_0)
{ MpegEncContext *s = &VAR_0->s; GetBitContext *gb = &VAR_0->s.gb; int VAR_1 = 0, VAR_2 ; int VAR_3 = BMV_TYPE_BACKWARD; int VAR_4, VAR_5; int VAR_6; static const int VAR_7[6] = { 0, 2, 3, 4, 5, 8 }, VAR_8[6] = { 0, 1, 3, 7, 15, 31 }; int VAR_9 = 1; int VAR_10, VAR_11, VAR_12, VAR_13; int VAR_14, VAR_15; int VAR_16; int VAR_17, VAR_18; int VAR_19, VAR_20; switch (VAR_0->mvrange)
{ case 1: VAR_14 = 10; VAR_15 = 9; break; case 2: VAR_14 = 12; VAR_15 = 10; break; case 3: VAR_14 = 13; VAR_15 = 11; break; default:  VAR_14 = 9; VAR_15 = 8; break; } VAR_16 = VAR_0->mv_mode & 1; VAR_14 -= VAR_16; VAR_15 -= VAR_16; if (VAR_0->pq < 5) VAR_0->ttmb_vlc = &vc9_ttmb_vlc[0]; else if (VAR_0->pq < 13) VAR_0->ttmb_vlc = &vc9_ttmb_vlc[1]; else VAR_0->ttmb_vlc = &vc9_ttmb_vlc[2]; for (s->mb_y=0; s->mb_y<s->mb_height; s->mb_y++) { for (s->mb_x=0; s->mb_x<s->mb_width; s->mb_x++) { if (VAR_0->direct_mb_plane.is_raw)
VAR_0->direct_mb_plane.data[VAR_1] = get_bits(gb, 1); if (VAR_0->skip_mb_plane.is_raw)
VAR_0->skip_mb_plane.data[VAR_1] = get_bits(gb, 1); if (!VAR_0->direct_mb_plane.data[VAR_1])
{ if (VAR_0->skip_mb_plane.data[VAR_1])
{ VAR_3 = decode012(gb); if (VAR_0->bfraction > 420  &&
VAR_3 < 3) VAR_3 = 1-VAR_3; } else
{ GET_MVDATA(VAR_10, VAR_11); if (!s->mb_intra )
{ VAR_3 = decode012(gb); if (VAR_0->bfraction > 420  &&
VAR_3 < 3) VAR_3 = 1-VAR_3; } } } if (!VAR_0->skip_mb_plane.data[VAR_1])
{ if (VAR_9 )
{ GET_MQUANT(); if (s->mb_intra )
s->ac_pred = get_bits(gb, 1); } else
{ if (VAR_3 == BMV_TYPE_INTERPOLATED)
{ GET_MVDATA(VAR_12, VAR_13); } if (VAR_9 )
{ if (s->mb_intra )
s->ac_pred = get_bits(gb, 1); GET_MQUANT(); } } } if (VAR_0->ttmbf)
VAR_6 = get_vlc2(gb, VAR_0->ttmb_vlc->table,
VC9_TTMB_VLC_BITS, 12); for (VAR_2=0; VAR_2<6; VAR_2++) { } VAR_1++; } } return 0; }