static int read_quant_table(RangeCoder *c, int16_t *quant_table, int scale)

{

    int v;

    int i = 0;

    uint8_t state[CONTEXT_SIZE];



    memset(state, 128, sizeof(state));



    for (v = 0; i < 128; v++) {

        unsigned len = get_symbol(c, state, 0) + 1;



        if (len > 128 - i)

            return AVERROR_INVALIDDATA;



        while (len--) {

            quant_table[i] = scale * v;

            i++;

        }

    }



    for (i = 1; i < 128; i++)

        quant_table[256 - i] = -quant_table[i];

    quant_table[128] = -quant_table[127];



    return 2 * v - 1;

}

static int read_quant_table(RangeCoder *c, int16_t *quant_table, int scale)

{

    int v;

    int i = 0;

    uint8_t state[CONTEXT_SIZE];



    memset(state, 128, sizeof(state));



    for (v = 0; i < 128; v++) {

        unsigned len = get_symbol(c, state, 0) + 1;



        if (len > 128 - i)

            return AVERROR_INVALIDDATA;



        while (len--) {

            quant_table[i] = scale * v;

            i++;

        }

    }



    for (i = 1; i < 128; i++)

        quant_table[256 - i] = -quant_table[i];

    quant_table[128] = -quant_table[127];



    return 2 * v - 1;

}

static int FUNC_0(RangeCoder *VAR_0, int16_t *VAR_1, int VAR_2)

{

    int VAR_3;

    int VAR_4 = 0;

    uint8_t state[CONTEXT_SIZE];



    memset(state, 128, sizeof(state));



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

        unsigned VAR_5 = get_symbol(VAR_0, state, 0) + 1;



        if (VAR_5 > 128 - VAR_4)

            return AVERROR_INVALIDDATA;



        while (VAR_5--) {

            VAR_1[VAR_4] = VAR_2 * VAR_3;

            VAR_4++;

        }

    }



    for (VAR_4 = 1; VAR_4 < 128; VAR_4++)

        VAR_1[256 - VAR_4] = -VAR_1[VAR_4];

    VAR_1[128] = -VAR_1[127];



    return 2 * VAR_3 - 1;

}

static int FUNC_0(RangeCoder *VAR_0, int16_t *VAR_1, int VAR_2)
{ int VAR_3; int VAR_4 = 0; uint8_t state[CONTEXT_SIZE]; memset(state, 128, sizeof(state)); for (VAR_3 = 0; VAR_4 < 128; VAR_3++) { unsigned VAR_5 = get_symbol(VAR_0, state, 0) + 1; if (VAR_5 > 128 - VAR_4)
return AVERROR_INVALIDDATA; while (VAR_5--) { VAR_1[VAR_4] = VAR_2 * VAR_3; VAR_4++; } } for (VAR_4 = 1; VAR_4 < 128; VAR_4++) VAR_1[256 - VAR_4] = -VAR_1[VAR_4]; VAR_1[128] = -VAR_1[127]; return 2 * VAR_3 - 1; }