static int aic_decode_coeffs(GetBitContext *gb, int16_t *dst,

                             int band, int slice_width)

{

    int has_skips, coeff_type, coeff_bits, skip_type, skip_bits;

    const int num_coeffs = aic_num_band_coeffs[band];

    const uint8_t *scan = aic_scan[band];

    int mb, idx, val;



    has_skips  = get_bits1(gb);

    coeff_type = get_bits1(gb);

    coeff_bits = get_bits(gb, 3);



    if (has_skips) {

        skip_type = get_bits1(gb);

        skip_bits = get_bits(gb, 3);



        for (mb = 0; mb < slice_width; mb++) {

            idx = -1;

            do {

                GET_CODE(val, skip_type, skip_bits);

                idx += val + 1;

                if (idx >= num_coeffs)

                    break;

                GET_CODE(val, coeff_type, coeff_bits);

                val++;

                if (val >= 0x10000)

                    return AVERROR_INVALIDDATA;

                dst[scan[idx]] = val;

            } while (idx < num_coeffs - 1);

            dst += num_coeffs;

        }

    } else {

        for (mb = 0; mb < slice_width; mb++) {

            for (idx = 0; idx < num_coeffs; idx++) {

                GET_CODE(val, coeff_type, coeff_bits);

                if (val >= 0x10000)

                    return AVERROR_INVALIDDATA;

                dst[scan[idx]] = val;

            }

            dst += num_coeffs;

        }

    }

    return 0;

}

static int aic_decode_coeffs(GetBitContext *gb, int16_t *dst,

                             int band, int slice_width)

{

    int has_skips, coeff_type, coeff_bits, skip_type, skip_bits;

    const int num_coeffs = aic_num_band_coeffs[band];

    const uint8_t *scan = aic_scan[band];

    int mb, idx, val;



    has_skips  = get_bits1(gb);

    coeff_type = get_bits1(gb);

    coeff_bits = get_bits(gb, 3);



    if (has_skips) {

        skip_type = get_bits1(gb);

        skip_bits = get_bits(gb, 3);



        for (mb = 0; mb < slice_width; mb++) {

            idx = -1;

            do {

                GET_CODE(val, skip_type, skip_bits);

                idx += val + 1;

                if (idx >= num_coeffs)

                    break;

                GET_CODE(val, coeff_type, coeff_bits);

                val++;

                if (val >= 0x10000)

                    return AVERROR_INVALIDDATA;

                dst[scan[idx]] = val;

            } while (idx < num_coeffs - 1);

            dst += num_coeffs;

        }

    } else {

        for (mb = 0; mb < slice_width; mb++) {

            for (idx = 0; idx < num_coeffs; idx++) {

                GET_CODE(val, coeff_type, coeff_bits);

                if (val >= 0x10000)

                    return AVERROR_INVALIDDATA;

                dst[scan[idx]] = val;

            }

            dst += num_coeffs;

        }

    }

    return 0;

}

static int FUNC_0(GetBitContext *VAR_0, int16_t *VAR_1,

                             int VAR_2, int VAR_3)

{

    int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8;

    const int VAR_9 = aic_num_band_coeffs[VAR_2];

    const uint8_t *VAR_10 = aic_scan[VAR_2];

    int VAR_11, VAR_12, VAR_13;



    VAR_4  = get_bits1(VAR_0);

    VAR_5 = get_bits1(VAR_0);

    VAR_6 = get_bits(VAR_0, 3);



    if (VAR_4) {

        VAR_7 = get_bits1(VAR_0);

        VAR_8 = get_bits(VAR_0, 3);



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

            VAR_12 = -1;

            do {

                GET_CODE(VAR_13, VAR_7, VAR_8);

                VAR_12 += VAR_13 + 1;

                if (VAR_12 >= VAR_9)

                    break;

                GET_CODE(VAR_13, VAR_5, VAR_6);

                VAR_13++;

                if (VAR_13 >= 0x10000)

                    return AVERROR_INVALIDDATA;

                VAR_1[VAR_10[VAR_12]] = VAR_13;

            } while (VAR_12 < VAR_9 - 1);

            VAR_1 += VAR_9;

        }

    } else {

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

            for (VAR_12 = 0; VAR_12 < VAR_9; VAR_12++) {

                GET_CODE(VAR_13, VAR_5, VAR_6);

                if (VAR_13 >= 0x10000)

                    return AVERROR_INVALIDDATA;

                VAR_1[VAR_10[VAR_12]] = VAR_13;

            }

            VAR_1 += VAR_9;

        }

    }

    return 0;

}

static int FUNC_0(GetBitContext *VAR_0, int16_t *VAR_1,
int VAR_2, int VAR_3)
{ int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8; const int VAR_9 = aic_num_band_coeffs[VAR_2]; const uint8_t *VAR_10 = aic_scan[VAR_2]; int VAR_11, VAR_12, VAR_13; VAR_4  = get_bits1(VAR_0); VAR_5 = get_bits1(VAR_0); VAR_6 = get_bits(VAR_0, 3); if (VAR_4) { VAR_7 = get_bits1(VAR_0); VAR_8 = get_bits(VAR_0, 3); for (VAR_11 = 0; VAR_11 < VAR_3; VAR_11++) { VAR_12 = -1; do { GET_CODE(VAR_13, VAR_7, VAR_8); VAR_12 += VAR_13 + 1; if (VAR_12 >= VAR_9)
break; GET_CODE(VAR_13, VAR_5, VAR_6); VAR_13++; if (VAR_13 >= 0x10000)
return AVERROR_INVALIDDATA; VAR_1[VAR_10[VAR_12]] = VAR_13; } while (VAR_12 < VAR_9 - 1); VAR_1 += VAR_9; } } else { for (VAR_11 = 0; VAR_11 < VAR_3; VAR_11++) { for (VAR_12 = 0; VAR_12 < VAR_9; VAR_12++) { GET_CODE(VAR_13, VAR_5, VAR_6); if (VAR_13 >= 0x10000)
return AVERROR_INVALIDDATA; VAR_1[VAR_10[VAR_12]] = VAR_13; } VAR_1 += VAR_9; } } return 0; }