static void unpack_modes(Vp3DecodeContext *s, GetBitContext *gb)

{

    int i, j, k;

    int scheme;

    int current_macroblock;

    int current_fragment;

    int coding_mode;



    debug_vp3("  vp3: unpacking encoding modes\n");



    if (s->keyframe) {

        debug_vp3("    keyframe-- all blocks are coded as INTRA\n");



        for (i = 0; i < s->fragment_count; i++)

            s->all_fragments[i].coding_method = MODE_INTRA;



    } else {



        /* fetch the mode coding scheme for this frame */

        scheme = get_bits(gb, 3);

        debug_modes("    using mode alphabet %d\n", scheme);



        /* is it a custom coding scheme? */

        if (scheme == 0) {

            debug_modes("    custom mode alphabet ahead:\n");

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

                ModeAlphabet[0][i] = get_bits(gb, 3);

        }



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

            debug_modes("      mode[%d][%d] = %d\n", scheme, i, 

                ModeAlphabet[scheme][i]);



        /* iterate through all of the macroblocks that contain 1 or more

         * coded fragments */

        for (i = 0; i < s->u_superblock_start; i++) {



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

                current_macroblock = s->superblock_macroblocks[i * 4 + j];

                if ((current_macroblock == -1) ||

                    (!s->macroblock_coded[current_macroblock]))

                    continue;



                /* mode 7 means get 3 bits for each coding mode */

                if (scheme == 7)

                    coding_mode = get_bits(gb, 3);

                else

                    coding_mode = ModeAlphabet[scheme][get_mode_code(gb)];



                for (k = 0; k < 6; k++) {

                    current_fragment = 

                        s->macroblock_fragments[current_macroblock * 6 + k];

                    if (s->all_fragments[current_fragment].coding_method != 

                        MODE_COPY)

                        s->all_fragments[current_fragment].coding_method =

                            coding_mode;

                }



                debug_modes("    coding method for macroblock starting @ fragment %d = %d\n",

                    s->macroblock_fragments[current_macroblock * 6], coding_mode);

            }

        }

    }

}

static void unpack_modes(Vp3DecodeContext *s, GetBitContext *gb)

{

    int i, j, k;

    int scheme;

    int current_macroblock;

    int current_fragment;

    int coding_mode;



    debug_vp3("  vp3: unpacking encoding modes\n");



    if (s->keyframe) {

        debug_vp3("    keyframe-- all blocks are coded as INTRA\n");



        for (i = 0; i < s->fragment_count; i++)

            s->all_fragments[i].coding_method = MODE_INTRA;



    } else {



        

        scheme = get_bits(gb, 3);

        debug_modes("    using mode alphabet %d\n", scheme);



        

        if (scheme == 0) {

            debug_modes("    custom mode alphabet ahead:\n");

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

                ModeAlphabet[0][i] = get_bits(gb, 3);

        }



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

            debug_modes("      mode[%d][%d] = %d\n", scheme, i, 

                ModeAlphabet[scheme][i]);



        



        for (i = 0; i < s->u_superblock_start; i++) {



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

                current_macroblock = s->superblock_macroblocks[i * 4 + j];

                if ((current_macroblock == -1) ||

                    (!s->macroblock_coded[current_macroblock]))

                    continue;



                

                if (scheme == 7)

                    coding_mode = get_bits(gb, 3);

                else

                    coding_mode = ModeAlphabet[scheme][get_mode_code(gb)];



                for (k = 0; k < 6; k++) {

                    current_fragment = 

                        s->macroblock_fragments[current_macroblock * 6 + k];

                    if (s->all_fragments[current_fragment].coding_method != 

                        MODE_COPY)

                        s->all_fragments[current_fragment].coding_method =

                            coding_mode;

                }



                debug_modes("    coding method for macroblock starting @ fragment %d = %d\n",

                    s->macroblock_fragments[current_macroblock * 6], coding_mode);

            }

        }

    }

}

static void FUNC_0(Vp3DecodeContext *VAR_0, GetBitContext *VAR_1)

{

    int VAR_2, VAR_3, VAR_4;

    int VAR_5;

    int VAR_6;

    int VAR_7;

    int VAR_8;



    debug_vp3("  vp3: unpacking encoding modes\n");



    if (VAR_0->keyframe) {

        debug_vp3("    keyframe-- all blocks are coded as INTRA\n");



        for (VAR_2 = 0; VAR_2 < VAR_0->fragment_count; VAR_2++)

            VAR_0->all_fragments[VAR_2].coding_method = MODE_INTRA;



    } else {



        

        VAR_5 = get_bits(VAR_1, 3);

        debug_modes("    using mode alphabet %d\n", VAR_5);



        

        if (VAR_5 == 0) {

            debug_modes("    custom mode alphabet ahead:\n");

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

                ModeAlphabet[0][VAR_2] = get_bits(VAR_1, 3);

        }



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

            debug_modes("      mode[%d][%d] = %d\n", VAR_5, VAR_2, 

                ModeAlphabet[VAR_5][VAR_2]);



        



        for (VAR_2 = 0; VAR_2 < VAR_0->u_superblock_start; VAR_2++) {



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

                VAR_6 = VAR_0->superblock_macroblocks[VAR_2 * 4 + VAR_3];

                if ((VAR_6 == -1) ||

                    (!VAR_0->macroblock_coded[VAR_6]))

                    continue;



                

                if (VAR_5 == 7)

                    VAR_8 = get_bits(VAR_1, 3);

                else

                    VAR_8 = ModeAlphabet[VAR_5][get_mode_code(VAR_1)];



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

                    VAR_7 = 

                        VAR_0->macroblock_fragments[VAR_6 * 6 + VAR_4];

                    if (VAR_0->all_fragments[VAR_7].coding_method != 

                        MODE_COPY)

                        VAR_0->all_fragments[VAR_7].coding_method =

                            VAR_8;

                }



                debug_modes("    coding method for macroblock starting @ fragment %d = %d\n",

                    VAR_0->macroblock_fragments[VAR_6 * 6], VAR_8);

            }

        }

    }

}

static void FUNC_0(Vp3DecodeContext *VAR_0, GetBitContext *VAR_1)
{ int VAR_2, VAR_3, VAR_4; int VAR_5; int VAR_6; int VAR_7; int VAR_8; debug_vp3("  vp3: unpacking encoding modes\n"); if (VAR_0->keyframe) { debug_vp3("    keyframe-- all blocks are coded as INTRA\n"); for (VAR_2 = 0; VAR_2 < VAR_0->fragment_count; VAR_2++) VAR_0->all_fragments[VAR_2].coding_method = MODE_INTRA; } else { VAR_5 = get_bits(VAR_1, 3); debug_modes("    using mode alphabet %d\n", VAR_5); if (VAR_5 == 0) { debug_modes("    custom mode alphabet ahead:\n"); for (VAR_2 = 0; VAR_2 < 8; VAR_2++) ModeAlphabet[0][VAR_2] = get_bits(VAR_1, 3); } for (VAR_2 = 0; VAR_2 < 8; VAR_2++) debug_modes("      mode[%d][%d] = %d\n", VAR_5, VAR_2,
ModeAlphabet[VAR_5][VAR_2]); for (VAR_2 = 0; VAR_2 < VAR_0->u_superblock_start; VAR_2++) { for (VAR_3 = 0; VAR_3 < 4; VAR_3++) { VAR_6 = VAR_0->superblock_macroblocks[VAR_2 * 4 + VAR_3]; if ((VAR_6 == -1) ||
(!VAR_0->macroblock_coded[VAR_6]))
continue; if (VAR_5 == 7)
VAR_8 = get_bits(VAR_1, 3); else
VAR_8 = ModeAlphabet[VAR_5][get_mode_code(VAR_1)]; for (VAR_4 = 0; VAR_4 < 6; VAR_4++) { VAR_7 =
VAR_0->macroblock_fragments[VAR_6 * 6 + VAR_4]; if (VAR_0->all_fragments[VAR_7].coding_method !=
MODE_COPY)
VAR_0->all_fragments[VAR_7].coding_method =
VAR_8; } debug_modes("    coding method for macroblock starting @ fragment %d = %d\n",
VAR_0->macroblock_fragments[VAR_6 * 6], VAR_8); } } } }