static int decode_block(MJpegDecodeContext *s, int16_t *block, int component,

                        int dc_index, int ac_index, uint16_t *quant_matrix)

{

    int code, i, j, level, val;



    /* DC coef */

    val = mjpeg_decode_dc(s, dc_index);

    if (val == 0xfffff) {

        av_log(s->avctx, AV_LOG_ERROR, "error dc\n");

        return AVERROR_INVALIDDATA;

    }

    val = val * quant_matrix[0] + s->last_dc[component];

    val = FFMIN(val, 32767);

    s->last_dc[component] = val;

    block[0] = val;

    /* AC coefs */

    i = 0;

    {OPEN_READER(re, &s->gb);

    do {

        UPDATE_CACHE(re, &s->gb);

        GET_VLC(code, re, &s->gb, s->vlcs[1][ac_index].table, 9, 2);



        i += ((unsigned)code) >> 4;

            code &= 0xf;

        if (code) {

            if (code > MIN_CACHE_BITS - 16)

                UPDATE_CACHE(re, &s->gb);



            {

                int cache = GET_CACHE(re, &s->gb);

                int sign  = (~cache) >> 31;

                level     = (NEG_USR32(sign ^ cache,code) ^ sign) - sign;

            }



            LAST_SKIP_BITS(re, &s->gb, code);



            if (i > 63) {

                av_log(s->avctx, AV_LOG_ERROR, "error count: %d\n", i);

                return AVERROR_INVALIDDATA;

            }

            j        = s->scantable.permutated[i];

            block[j] = level * quant_matrix[i];

        }

    } while (i < 63);

    CLOSE_READER(re, &s->gb);}



    return 0;

}

static int decode_block(MJpegDecodeContext *s, int16_t *block, int component,

                        int dc_index, int ac_index, uint16_t *quant_matrix)

{

    int code, i, j, level, val;



    

    val = mjpeg_decode_dc(s, dc_index);

    if (val == 0xfffff) {

        av_log(s->avctx, AV_LOG_ERROR, "error dc\n");

        return AVERROR_INVALIDDATA;

    }

    val = val * quant_matrix[0] + s->last_dc[component];

    val = FFMIN(val, 32767);

    s->last_dc[component] = val;

    block[0] = val;

    

    i = 0;

    {OPEN_READER(re, &s->gb);

    do {

        UPDATE_CACHE(re, &s->gb);

        GET_VLC(code, re, &s->gb, s->vlcs[1][ac_index].table, 9, 2);



        i += ((unsigned)code) >> 4;

            code &= 0xf;

        if (code) {

            if (code > MIN_CACHE_BITS - 16)

                UPDATE_CACHE(re, &s->gb);



            {

                int cache = GET_CACHE(re, &s->gb);

                int sign  = (~cache) >> 31;

                level     = (NEG_USR32(sign ^ cache,code) ^ sign) - sign;

            }



            LAST_SKIP_BITS(re, &s->gb, code);



            if (i > 63) {

                av_log(s->avctx, AV_LOG_ERROR, "error count: %d\n", i);

                return AVERROR_INVALIDDATA;

            }

            j        = s->scantable.permutated[i];

            block[j] = level * quant_matrix[i];

        }

    } while (i < 63);

    CLOSE_READER(re, &s->gb);}



    return 0;

}

    val = FFMIN(val, 32767);
static int FUNC_0(MJpegDecodeContext *VAR_0, int16_t *VAR_1, int VAR_2,

                        int VAR_3, int VAR_4, uint16_t *VAR_5)

{

    int VAR_6, VAR_7, VAR_8, VAR_9, VAR_10;



    

    VAR_10 = mjpeg_decode_dc(VAR_0, VAR_3);

    if (VAR_10 == 0xfffff) {

        av_log(VAR_0->avctx, AV_LOG_ERROR, "error dc\n");

        return AVERROR_INVALIDDATA;

    }

    VAR_10 = VAR_10 * VAR_5[0] + VAR_0->last_dc[VAR_2];

    VAR_10 = FFMIN(VAR_10, 32767);

    VAR_0->last_dc[VAR_2] = VAR_10;

    VAR_1[0] = VAR_10;

    

    VAR_7 = 0;

    {OPEN_READER(re, &VAR_0->gb);

    do {

        UPDATE_CACHE(re, &VAR_0->gb);

        GET_VLC(VAR_6, re, &VAR_0->gb, VAR_0->vlcs[1][VAR_4].table, 9, 2);



        VAR_7 += ((unsigned)VAR_6) >> 4;

            VAR_6 &= 0xf;

        if (VAR_6) {

            if (VAR_6 > MIN_CACHE_BITS - 16)

                UPDATE_CACHE(re, &VAR_0->gb);



            {

                int VAR_11 = GET_CACHE(re, &VAR_0->gb);

                int VAR_12  = (~VAR_11) >> 31;

                VAR_9     = (NEG_USR32(VAR_12 ^ VAR_11,VAR_6) ^ VAR_12) - VAR_12;

            }



            LAST_SKIP_BITS(re, &VAR_0->gb, VAR_6);



            if (VAR_7 > 63) {

                av_log(VAR_0->avctx, AV_LOG_ERROR, "error count: %d\n", VAR_7);

                return AVERROR_INVALIDDATA;

            }

            VAR_8        = VAR_0->scantable.permutated[VAR_7];

            VAR_1[VAR_8] = VAR_9 * VAR_5[VAR_7];

        }

    } while (VAR_7 < 63);

    CLOSE_READER(re, &VAR_0->gb);}



    return 0;

}

static int FUNC_0(MJpegDecodeContext *VAR_0, int16_t *VAR_1, int VAR_2,
int VAR_3, int VAR_4, uint16_t *VAR_5)
{ int VAR_6, VAR_7, VAR_8, VAR_9, VAR_10; VAR_10 = mjpeg_decode_dc(VAR_0, VAR_3); if (VAR_10 == 0xfffff) { av_log(VAR_0->avctx, AV_LOG_ERROR, "error dc\n"); return AVERROR_INVALIDDATA; } VAR_10 = VAR_10 * VAR_5[0] + VAR_0->last_dc[VAR_2]; VAR_10 = FFMIN(VAR_10, 32767); VAR_0->last_dc[VAR_2] = VAR_10; VAR_1[0] = VAR_10; VAR_7 = 0; {OPEN_READER(re, &VAR_0->gb); do { UPDATE_CACHE(re, &VAR_0->gb); GET_VLC(VAR_6, re, &VAR_0->gb, VAR_0->vlcs[1][VAR_4].table, 9, 2); VAR_7 += ((unsigned)VAR_6) >> 4; VAR_6 &= 0xf; if (VAR_6) { if (VAR_6 > MIN_CACHE_BITS - 16)
UPDATE_CACHE(re, &VAR_0->gb); { int VAR_11 = GET_CACHE(re, &VAR_0->gb); int VAR_12  = (~VAR_11) >> 31; VAR_9     = (NEG_USR32(VAR_12 ^ VAR_11,VAR_6) ^ VAR_12) - VAR_12; } LAST_SKIP_BITS(re, &VAR_0->gb, VAR_6); if (VAR_7 > 63) { av_log(VAR_0->avctx, AV_LOG_ERROR, "error count: %d\n", VAR_7); return AVERROR_INVALIDDATA; } VAR_8        = VAR_0->scantable.permutated[VAR_7]; VAR_1[VAR_8] = VAR_9 * VAR_5[VAR_7]; } } while (VAR_7 < 63); CLOSE_READER(re, &VAR_0->gb);} return 0; }