void ff_lag_rac_init(lag_rac *l, GetBitContext *gb, int length)

{

    int i, j, left;



    /* According to reference decoder "1st byte is garbage",

     * however, it gets skipped by the call to align_get_bits()

     */

    align_get_bits(gb);

    left                = get_bits_left(gb) >> 3;

    l->bytestream_start =

    l->bytestream       = gb->buffer + get_bits_count(gb) / 8;

    l->bytestream_end   = l->bytestream_start + left;



    l->range        = 0x80;

    l->low          = *l->bytestream >> 1;

    l->hash_shift   = FFMAX(l->scale - 8, 0);



    for (i = j = 0; i < 256; i++) {

        unsigned r = i << l->hash_shift;

        while (l->prob[j + 1] <= r)

            j++;

        l->range_hash[i] = j;

    }



    /* Add conversion factor to hash_shift so we don't have to in lag_get_rac. */

    l->hash_shift += 23;

}

void ff_lag_rac_init(lag_rac *l, GetBitContext *gb, int length)

{

    int i, j, left;



    





    align_get_bits(gb);

    left                = get_bits_left(gb) >> 3;

    l->bytestream_start =

    l->bytestream       = gb->buffer + get_bits_count(gb) / 8;

    l->bytestream_end   = l->bytestream_start + left;



    l->range        = 0x80;

    l->low          = *l->bytestream >> 1;

    l->hash_shift   = FFMAX(l->scale - 8, 0);



    for (i = j = 0; i < 256; i++) {

        unsigned r = i << l->hash_shift;

        while (l->prob[j + 1] <= r)

            j++;

        l->range_hash[i] = j;

    }



    

    l->hash_shift += 23;

}

void FUNC_0(lag_rac *VAR_0, GetBitContext *VAR_1, int VAR_2)

{

    int VAR_3, VAR_4, VAR_5;



    





    align_get_bits(VAR_1);

    VAR_5                = get_bits_left(VAR_1) >> 3;

    VAR_0->bytestream_start =

    VAR_0->bytestream       = VAR_1->buffer + get_bits_count(VAR_1) / 8;

    VAR_0->bytestream_end   = VAR_0->bytestream_start + VAR_5;



    VAR_0->range        = 0x80;

    VAR_0->low          = *VAR_0->bytestream >> 1;

    VAR_0->hash_shift   = FFMAX(VAR_0->scale - 8, 0);



    for (VAR_3 = VAR_4 = 0; VAR_3 < 256; VAR_3++) {

        unsigned VAR_6 = VAR_3 << VAR_0->hash_shift;

        while (VAR_0->prob[VAR_4 + 1] <= VAR_6)

            VAR_4++;

        VAR_0->range_hash[VAR_3] = VAR_4;

    }



    

    VAR_0->hash_shift += 23;

}

void FUNC_0(lag_rac *VAR_0, GetBitContext *VAR_1, int VAR_2)
{ int VAR_3, VAR_4, VAR_5; align_get_bits(VAR_1); VAR_5                = get_bits_left(VAR_1) >> 3; VAR_0->bytestream_start =
VAR_0->bytestream       = VAR_1->buffer + get_bits_count(VAR_1) / 8; VAR_0->bytestream_end   = VAR_0->bytestream_start + VAR_5; VAR_0->range        = 0x80; VAR_0->low          = *VAR_0->bytestream >> 1; VAR_0->hash_shift   = FFMAX(VAR_0->scale - 8, 0); for (VAR_3 = VAR_4 = 0; VAR_3 < 256; VAR_3++) { unsigned VAR_6 = VAR_3 << VAR_0->hash_shift; while (VAR_0->prob[VAR_4 + 1] <= VAR_6)
VAR_4++; VAR_0->range_hash[VAR_3] = VAR_4; } VAR_0->hash_shift += 23; }