static int decode_hq_slice(AVCodecContext *avctx, void *arg)

{

    int i, quant, level, orientation, quant_idx;

    uint8_t quants[MAX_DWT_LEVELS][4];

    DiracContext *s = avctx->priv_data;

    DiracSlice *slice = arg;

    GetBitContext *gb = &slice->gb;



    skip_bits_long(gb, 8*s->highquality.prefix_bytes);

    quant_idx = get_bits(gb, 8);



    /* Slice quantization (slice_quantizers() in the specs) */

    for (level = 0; level < s->wavelet_depth; level++) {

        for (orientation = !!level; orientation < 4; orientation++) {

            quant = FFMAX(quant_idx - s->lowdelay.quant[level][orientation], 0);

            quants[level][orientation] = quant;

        }

    }



    /* Luma + 2 Chroma planes */

    for (i = 0; i < 3; i++) {

        int64_t length = s->highquality.size_scaler * get_bits(gb, 8);

        int64_t bits_left = 8 * length;

        int64_t bits_end = get_bits_count(gb) + bits_left;



        if (bits_end >= INT_MAX) {

            av_log(s->avctx, AV_LOG_ERROR, "end too far away\n");

            return AVERROR_INVALIDDATA;

        }



        for (level = 0; level < s->wavelet_depth; level++) {

            for (orientation = !!level; orientation < 4; orientation++) {

                decode_subband(s, gb, quants[level][orientation], slice->slice_x, slice->slice_y, bits_end,

                               &s->plane[i].band[level][orientation], NULL);

            }

        }

        skip_bits_long(gb, bits_end - get_bits_count(gb));

    }



    return 0;

}

static int decode_hq_slice(AVCodecContext *avctx, void *arg)

{

    int i, quant, level, orientation, quant_idx;

    uint8_t quants[MAX_DWT_LEVELS][4];

    DiracContext *s = avctx->priv_data;

    DiracSlice *slice = arg;

    GetBitContext *gb = &slice->gb;



    skip_bits_long(gb, 8*s->highquality.prefix_bytes);

    quant_idx = get_bits(gb, 8);



    

    for (level = 0; level < s->wavelet_depth; level++) {

        for (orientation = !!level; orientation < 4; orientation++) {

            quant = FFMAX(quant_idx - s->lowdelay.quant[level][orientation], 0);

            quants[level][orientation] = quant;

        }

    }



    

    for (i = 0; i < 3; i++) {

        int64_t length = s->highquality.size_scaler * get_bits(gb, 8);

        int64_t bits_left = 8 * length;

        int64_t bits_end = get_bits_count(gb) + bits_left;



        if (bits_end >= INT_MAX) {

            av_log(s->avctx, AV_LOG_ERROR, "end too far away\n");

            return AVERROR_INVALIDDATA;

        }



        for (level = 0; level < s->wavelet_depth; level++) {

            for (orientation = !!level; orientation < 4; orientation++) {

                decode_subband(s, gb, quants[level][orientation], slice->slice_x, slice->slice_y, bits_end,

                               &s->plane[i].band[level][orientation], NULL);

            }

        }

        skip_bits_long(gb, bits_end - get_bits_count(gb));

    }



    return 0;

}

static int decode_hq_slice(AVCodecContext *avctx, void *arg)     int i, quant, level, orientation, quant_idx;     uint8_t quants[MAX_DWT_LEVELS][4];     DiracContext *s = avctx->priv_data;     DiracSlice *slice = arg;             quant = FFMAX(quant_idx - s->lowdelay.quant[level][orientation], 0);             quants[level][orientation] = quant;         int64_t length = s->highquality.size_scaler * get_bits(gb, 8);         int64_t bits_left = 8 * length;         int64_t bits_end = get_bits_count(gb) + bits_left;                 decode_subband(s, gb, quants[level][orientation], slice->slice_x, slice->slice_y, bits_end,                                &s->plane[i].band[level][orientation], NULL);
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1)

{

    int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6;

    uint8_t quants[MAX_DWT_LEVELS][4];

    DiracContext *s = VAR_0->priv_data;

    DiracSlice *slice = VAR_1;

    GetBitContext *gb = &slice->gb;



    skip_bits_long(gb, 8*s->highquality.prefix_bytes);

    VAR_6 = get_bits(gb, 8);



    

    for (VAR_4 = 0; VAR_4 < s->wavelet_depth; VAR_4++) {

        for (VAR_5 = !!VAR_4; VAR_5 < 4; VAR_5++) {

            VAR_3 = FFMAX(VAR_6 - s->lowdelay.VAR_3[VAR_4][VAR_5], 0);

            quants[VAR_4][VAR_5] = VAR_3;

        }

    }



    

    for (VAR_2 = 0; VAR_2 < 3; VAR_2++) {

        int64_t length = s->highquality.size_scaler * get_bits(gb, 8);

        int64_t bits_left = 8 * length;

        int64_t bits_end = get_bits_count(gb) + bits_left;



        if (bits_end >= INT_MAX) {

            av_log(s->VAR_0, AV_LOG_ERROR, "end too far away\n");

            return AVERROR_INVALIDDATA;

        }



        for (VAR_4 = 0; VAR_4 < s->wavelet_depth; VAR_4++) {

            for (VAR_5 = !!VAR_4; VAR_5 < 4; VAR_5++) {

                decode_subband(s, gb, quants[VAR_4][VAR_5], slice->slice_x, slice->slice_y, bits_end,

                               &s->plane[VAR_2].band[VAR_4][VAR_5], NULL);

            }

        }

        skip_bits_long(gb, bits_end - get_bits_count(gb));

    }



    return 0;

}

static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1)
{ int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6; uint8_t quants[MAX_DWT_LEVELS][4]; DiracContext *s = VAR_0->priv_data; DiracSlice *slice = VAR_1; GetBitContext *gb = &slice->gb; skip_bits_long(gb, 8*s->highquality.prefix_bytes); VAR_6 = get_bits(gb, 8); for (VAR_4 = 0; VAR_4 < s->wavelet_depth; VAR_4++) { for (VAR_5 = !!VAR_4; VAR_5 < 4; VAR_5++) { VAR_3 = FFMAX(VAR_6 - s->lowdelay.VAR_3[VAR_4][VAR_5], 0); quants[VAR_4][VAR_5] = VAR_3; } } for (VAR_2 = 0; VAR_2 < 3; VAR_2++) { int64_t length = s->highquality.size_scaler * get_bits(gb, 8); int64_t bits_left = 8 * length; int64_t bits_end = get_bits_count(gb) + bits_left; if (bits_end >= INT_MAX) { av_log(s->VAR_0, AV_LOG_ERROR, "end too far away\n"); return AVERROR_INVALIDDATA; } for (VAR_4 = 0; VAR_4 < s->wavelet_depth; VAR_4++) { for (VAR_5 = !!VAR_4; VAR_5 < 4; VAR_5++) { decode_subband(s, gb, quants[VAR_4][VAR_5], slice->slice_x, slice->slice_y, bits_end,
&s->plane[VAR_2].band[VAR_4][VAR_5], NULL); } } skip_bits_long(gb, bits_end - get_bits_count(gb)); } return 0; }