static void dv_decode_ac(GetBitContext *gb, BlockInfo *mb, DCTELEM *block)

{

    int last_index = get_bits_size(gb);

    const uint8_t *scan_table = mb->scan_table;

    const uint8_t *shift_table = mb->shift_table;

    int pos = mb->pos;

    int partial_bit_count = mb->partial_bit_count;

    int level, pos1, run, vlc_len, index;

    

    OPEN_READER(re, gb);

    UPDATE_CACHE(re, gb);

    

    /* if we must parse a partial vlc, we do it here */

    if (partial_bit_count > 0) {

        re_cache = ((unsigned)re_cache >> partial_bit_count) |

	           (mb->partial_bit_buffer << (sizeof(re_cache)*8 - partial_bit_count));

	re_index -= partial_bit_count;

	mb->partial_bit_count = 0;

    }



    /* get the AC coefficients until last_index is reached */

    for(;;) {

#ifdef VLC_DEBUG

        printf("%2d: bits=%04x index=%d\n", pos, SHOW_UBITS(re, gb, 16), re_index);

#endif

        /* our own optimized GET_RL_VLC */

        index = NEG_USR32(re_cache, TEX_VLC_BITS);

	vlc_len = dv_rl_vlc[index].len;

        if (vlc_len < 0) {

            index = NEG_USR32((unsigned)re_cache << TEX_VLC_BITS, -vlc_len) + dv_rl_vlc[index].level;

            vlc_len = TEX_VLC_BITS - vlc_len;

        }

        level = dv_rl_vlc[index].level;

	run = dv_rl_vlc[index].run;

	

	/* gotta check if we're still within gb boundaries */

	if (re_index + vlc_len > last_index) {

	    /* should be < 16 bits otherwise a codeword could have been parsed */

	    mb->partial_bit_count = last_index - re_index;

	    mb->partial_bit_buffer = NEG_USR32(re_cache, mb->partial_bit_count);

	    re_index = last_index;

	    break;

	}

	re_index += vlc_len;



#ifdef VLC_DEBUG

	printf("run=%d level=%d\n", run, level);

#endif

	pos += run; 	

	if (pos >= 64)

	    break;

        

	if (level) {

            pos1 = scan_table[pos];

            block[pos1] = level << shift_table[pos1];

        } 



        UPDATE_CACHE(re, gb);

    }

    CLOSE_READER(re, gb);

    mb->pos = pos;

}

static void dv_decode_ac(GetBitContext *gb, BlockInfo *mb, DCTELEM *block)

{

    int last_index = get_bits_size(gb);

    const uint8_t *scan_table = mb->scan_table;

    const uint8_t *shift_table = mb->shift_table;

    int pos = mb->pos;

    int partial_bit_count = mb->partial_bit_count;

    int level, pos1, run, vlc_len, index;

    

    OPEN_READER(re, gb);

    UPDATE_CACHE(re, gb);

    

    

    if (partial_bit_count > 0) {

        re_cache = ((unsigned)re_cache >> partial_bit_count) |

	           (mb->partial_bit_buffer << (sizeof(re_cache)*8 - partial_bit_count));

	re_index -= partial_bit_count;

	mb->partial_bit_count = 0;

    }



    

    for(;;) {

#ifdef VLC_DEBUG

        printf("%2d: bits=%04x index=%d\n", pos, SHOW_UBITS(re, gb, 16), re_index);

#endif

        

        index = NEG_USR32(re_cache, TEX_VLC_BITS);

	vlc_len = dv_rl_vlc[index].len;

        if (vlc_len < 0) {

            index = NEG_USR32((unsigned)re_cache << TEX_VLC_BITS, -vlc_len) + dv_rl_vlc[index].level;

            vlc_len = TEX_VLC_BITS - vlc_len;

        }

        level = dv_rl_vlc[index].level;

	run = dv_rl_vlc[index].run;

	

	

	if (re_index + vlc_len > last_index) {

	    

	    mb->partial_bit_count = last_index - re_index;

	    mb->partial_bit_buffer = NEG_USR32(re_cache, mb->partial_bit_count);

	    re_index = last_index;

	    break;

	}

	re_index += vlc_len;



#ifdef VLC_DEBUG

	printf("run=%d level=%d\n", run, level);

#endif

	pos += run; 	

	if (pos >= 64)

	    break;

        

	if (level) {

            pos1 = scan_table[pos];

            block[pos1] = level << shift_table[pos1];

        } 



        UPDATE_CACHE(re, gb);

    }

    CLOSE_READER(re, gb);

    mb->pos = pos;

}

static void FUNC_0(GetBitContext *VAR_0, BlockInfo *VAR_1, DCTELEM *VAR_2)

{

    int VAR_3 = get_bits_size(VAR_0);

    const uint8_t *VAR_4 = VAR_1->VAR_4;

    const uint8_t *VAR_5 = VAR_1->VAR_5;

    int VAR_6 = VAR_1->VAR_6;

    int VAR_7 = VAR_1->VAR_7;

    int VAR_8, VAR_9, VAR_10, VAR_11, VAR_12;

    

    OPEN_READER(re, VAR_0);

    UPDATE_CACHE(re, VAR_0);

    

    

    if (VAR_7 > 0) {

        re_cache = ((unsigned)re_cache >> VAR_7) |

	           (VAR_1->partial_bit_buffer << (sizeof(re_cache)*8 - VAR_7));

	re_index -= VAR_7;

	VAR_1->VAR_7 = 0;

    }



    

    for(;;) {

#ifdef VLC_DEBUG

        printf("%2d: bits=%04x VAR_12=%d\n", VAR_6, SHOW_UBITS(re, VAR_0, 16), re_index);

#endif

        

        VAR_12 = NEG_USR32(re_cache, TEX_VLC_BITS);

	VAR_11 = dv_rl_vlc[VAR_12].len;

        if (VAR_11 < 0) {

            VAR_12 = NEG_USR32((unsigned)re_cache << TEX_VLC_BITS, -VAR_11) + dv_rl_vlc[VAR_12].VAR_8;

            VAR_11 = TEX_VLC_BITS - VAR_11;

        }

        VAR_8 = dv_rl_vlc[VAR_12].VAR_8;

	VAR_10 = dv_rl_vlc[VAR_12].VAR_10;

	

	

	if (re_index + VAR_11 > VAR_3) {

	    

	    VAR_1->VAR_7 = VAR_3 - re_index;

	    VAR_1->partial_bit_buffer = NEG_USR32(re_cache, VAR_1->VAR_7);

	    re_index = VAR_3;

	    break;

	}

	re_index += VAR_11;



#ifdef VLC_DEBUG

	printf("VAR_10=%d VAR_8=%d\n", VAR_10, VAR_8);

#endif

	VAR_6 += VAR_10; 	

	if (VAR_6 >= 64)

	    break;

        

	if (VAR_8) {

            VAR_9 = VAR_4[VAR_6];

            VAR_2[VAR_9] = VAR_8 << VAR_5[VAR_9];

        } 



        UPDATE_CACHE(re, VAR_0);

    }

    CLOSE_READER(re, VAR_0);

    VAR_1->VAR_6 = VAR_6;

}

static void FUNC_0(GetBitContext *VAR_0, BlockInfo *VAR_1, DCTELEM *VAR_2)
{ int VAR_3 = get_bits_size(VAR_0); const uint8_t *VAR_4 = VAR_1->VAR_4; const uint8_t *VAR_5 = VAR_1->VAR_5; int VAR_6 = VAR_1->VAR_6; int VAR_7 = VAR_1->VAR_7; int VAR_8, VAR_9, VAR_10, VAR_11, VAR_12; OPEN_READER(re, VAR_0); UPDATE_CACHE(re, VAR_0); if (VAR_7 > 0) { re_cache = ((unsigned)re_cache >> VAR_7) |
(VAR_1->partial_bit_buffer << (sizeof(re_cache)*8 - VAR_7)); re_index -= VAR_7; VAR_1->VAR_7 = 0; } for(;;) { #ifdef VLC_DEBUG
printf("%2d: bits=%04x VAR_12=%d\n", VAR_6, SHOW_UBITS(re, VAR_0, 16), re_index); #endif
VAR_12 = NEG_USR32(re_cache, TEX_VLC_BITS); VAR_11 = dv_rl_vlc[VAR_12].len; if (VAR_11 < 0) { VAR_12 = NEG_USR32((unsigned)re_cache << TEX_VLC_BITS, -VAR_11) + dv_rl_vlc[VAR_12].VAR_8; VAR_11 = TEX_VLC_BITS - VAR_11; } VAR_8 = dv_rl_vlc[VAR_12].VAR_8; VAR_10 = dv_rl_vlc[VAR_12].VAR_10; if (re_index + VAR_11 > VAR_3) { VAR_1->VAR_7 = VAR_3 - re_index; VAR_1->partial_bit_buffer = NEG_USR32(re_cache, VAR_1->VAR_7); re_index = VAR_3; break; } re_index += VAR_11; #ifdef VLC_DEBUG
printf("VAR_10=%d VAR_8=%d\n", VAR_10, VAR_8); #endif
VAR_6 += VAR_10; if (VAR_6 >= 64)
break; if (VAR_8) { VAR_9 = VAR_4[VAR_6]; VAR_2[VAR_9] = VAR_8 << VAR_5[VAR_9]; } UPDATE_CACHE(re, VAR_0); } CLOSE_READER(re, VAR_0); VAR_1->VAR_6 = VAR_6; }