static int on2avc_decode_band_types(On2AVCContext *c, GetBitContext *gb)

{

    int bits_per_sect = c->is_long ? 5 : 3;

    int esc_val = (1 << bits_per_sect) - 1;

    int num_bands = c->num_bands * c->num_windows;

    int band = 0, i, band_type, run_len, run;



    while (band < num_bands) {

        band_type = get_bits(gb, 4);

        run_len   = 1;

        do {

            run = get_bits(gb, bits_per_sect);

            run_len += run;

        } while (run == esc_val);

        if (band + run_len > num_bands) {

            av_log(c->avctx, AV_LOG_ERROR, "Invalid band type run\n");

            return AVERROR_INVALIDDATA;

        }

        for (i = band; i < band + run_len; i++) {

            c->band_type[i]    = band_type;

            c->band_run_end[i] = band + run_len;

        }

        band += run_len;

    }



    return 0;

}

static int on2avc_decode_band_types(On2AVCContext *c, GetBitContext *gb)

{

    int bits_per_sect = c->is_long ? 5 : 3;

    int esc_val = (1 << bits_per_sect) - 1;

    int num_bands = c->num_bands * c->num_windows;

    int band = 0, i, band_type, run_len, run;



    while (band < num_bands) {

        band_type = get_bits(gb, 4);

        run_len   = 1;

        do {

            run = get_bits(gb, bits_per_sect);

            run_len += run;

        } while (run == esc_val);

        if (band + run_len > num_bands) {

            av_log(c->avctx, AV_LOG_ERROR, "Invalid band type run\n");

            return AVERROR_INVALIDDATA;

        }

        for (i = band; i < band + run_len; i++) {

            c->band_type[i]    = band_type;

            c->band_run_end[i] = band + run_len;

        }

        band += run_len;

    }



    return 0;

}

static int FUNC_0(On2AVCContext *VAR_0, GetBitContext *VAR_1)

{

    int VAR_2 = VAR_0->is_long ? 5 : 3;

    int VAR_3 = (1 << VAR_2) - 1;

    int VAR_4 = VAR_0->VAR_4 * VAR_0->num_windows;

    int VAR_5 = 0, VAR_6, VAR_7, VAR_8, VAR_9;



    while (VAR_5 < VAR_4) {

        VAR_7 = get_bits(VAR_1, 4);

        VAR_8   = 1;

        do {

            VAR_9 = get_bits(VAR_1, VAR_2);

            VAR_8 += VAR_9;

        } while (VAR_9 == VAR_3);

        if (VAR_5 + VAR_8 > VAR_4) {

            av_log(VAR_0->avctx, AV_LOG_ERROR, "Invalid VAR_5 type VAR_9\n");

            return AVERROR_INVALIDDATA;

        }

        for (VAR_6 = VAR_5; VAR_6 < VAR_5 + VAR_8; VAR_6++) {

            VAR_0->VAR_7[VAR_6]    = VAR_7;

            VAR_0->band_run_end[VAR_6] = VAR_5 + VAR_8;

        }

        VAR_5 += VAR_8;

    }



    return 0;

}

static int FUNC_0(On2AVCContext *VAR_0, GetBitContext *VAR_1)
{ int VAR_2 = VAR_0->is_long ? 5 : 3; int VAR_3 = (1 << VAR_2) - 1; int VAR_4 = VAR_0->VAR_4 * VAR_0->num_windows; int VAR_5 = 0, VAR_6, VAR_7, VAR_8, VAR_9; while (VAR_5 < VAR_4) { VAR_7 = get_bits(VAR_1, 4); VAR_8   = 1; do { VAR_9 = get_bits(VAR_1, VAR_2); VAR_8 += VAR_9; } while (VAR_9 == VAR_3); if (VAR_5 + VAR_8 > VAR_4) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Invalid VAR_5 type VAR_9\n"); return AVERROR_INVALIDDATA; } for (VAR_6 = VAR_5; VAR_6 < VAR_5 + VAR_8; VAR_6++) { VAR_0->VAR_7[VAR_6]    = VAR_7; VAR_0->band_run_end[VAR_6] = VAR_5 + VAR_8; } VAR_5 += VAR_8; } return 0; }