static int vlc_decode_block(MimicContext *ctx, int num_coeffs, int qscale)

{

    int16_t *block = ctx->dct_block;

    unsigned int pos;



    ctx->bdsp.clear_block(block);



    block[0] = get_bits(&ctx->gb, 8) << 3;



    for (pos = 1; pos < num_coeffs; pos++) {

        uint32_t vlc, num_bits;

        int value;

        int coeff;



        vlc = get_vlc2(&ctx->gb, ctx->vlc.table, ctx->vlc.bits, 3);

        if (!vlc) /* end-of-block code */

            return 0;

        if (vlc == -1)

            return AVERROR_INVALIDDATA;



        /* pos_add and num_bits are coded in the vlc code */

        pos     += vlc & 15; // pos_add

        num_bits = vlc >> 4; // num_bits



        if (pos >= 64)

            return AVERROR_INVALIDDATA;



        value = get_bits(&ctx->gb, num_bits);



        /* FFmpeg's IDCT behaves somewhat different from the original code, so

         * a factor of 4 was added to the input */



        coeff = vlcdec_lookup[num_bits][value];

        if (pos < 3)

            coeff *= 16;

        else /* TODO Use >> 10 instead of / 1001 */

            coeff = (coeff * qscale) / 1001;



        block[ctx->scantable.permutated[pos]] = coeff;

    }



    return 0;

}

static int vlc_decode_block(MimicContext *ctx, int num_coeffs, int qscale)

{

    int16_t *block = ctx->dct_block;

    unsigned int pos;



    ctx->bdsp.clear_block(block);



    block[0] = get_bits(&ctx->gb, 8) << 3;



    for (pos = 1; pos < num_coeffs; pos++) {

        uint32_t vlc, num_bits;

        int value;

        int coeff;



        vlc = get_vlc2(&ctx->gb, ctx->vlc.table, ctx->vlc.bits, 3);

        if (!vlc) 

            return 0;

        if (vlc == -1)

            return AVERROR_INVALIDDATA;



        

        pos     += vlc & 15; 

        num_bits = vlc >> 4; 



        if (pos >= 64)

            return AVERROR_INVALIDDATA;



        value = get_bits(&ctx->gb, num_bits);



        





        coeff = vlcdec_lookup[num_bits][value];

        if (pos < 3)

            coeff *= 16;

        else 

            coeff = (coeff * qscale) / 1001;



        block[ctx->scantable.permutated[pos]] = coeff;

    }



    return 0;

}

        coeff = vlcdec_lookup[num_bits][value];
static int FUNC_0(MimicContext *VAR_0, int VAR_1, int VAR_2)

{

    int16_t *block = VAR_0->dct_block;

    unsigned int VAR_3;



    VAR_0->bdsp.clear_block(block);



    block[0] = get_bits(&VAR_0->gb, 8) << 3;



    for (VAR_3 = 1; VAR_3 < VAR_1; VAR_3++) {

        uint32_t vlc, num_bits;

        int VAR_4;

        int VAR_5;



        vlc = get_vlc2(&VAR_0->gb, VAR_0->vlc.table, VAR_0->vlc.bits, 3);

        if (!vlc) 

            return 0;

        if (vlc == -1)

            return AVERROR_INVALIDDATA;



        

        VAR_3     += vlc & 15; 

        num_bits = vlc >> 4; 



        if (VAR_3 >= 64)

            return AVERROR_INVALIDDATA;



        VAR_4 = get_bits(&VAR_0->gb, num_bits);



        





        VAR_5 = vlcdec_lookup[num_bits][VAR_4];

        if (VAR_3 < 3)

            VAR_5 *= 16;

        else 

            VAR_5 = (VAR_5 * VAR_2) / 1001;



        block[VAR_0->scantable.permutated[VAR_3]] = VAR_5;

    }



    return 0;

}

static int FUNC_0(MimicContext *VAR_0, int VAR_1, int VAR_2)
{ int16_t *block = VAR_0->dct_block; unsigned int VAR_3; VAR_0->bdsp.clear_block(block); block[0] = get_bits(&VAR_0->gb, 8) << 3; for (VAR_3 = 1; VAR_3 < VAR_1; VAR_3++) { uint32_t vlc, num_bits; int VAR_4; int VAR_5; vlc = get_vlc2(&VAR_0->gb, VAR_0->vlc.table, VAR_0->vlc.bits, 3); if (!vlc)
return 0; if (vlc == -1)
return AVERROR_INVALIDDATA; VAR_3     += vlc & 15; num_bits = vlc >> 4; if (VAR_3 >= 64)
return AVERROR_INVALIDDATA; VAR_4 = get_bits(&VAR_0->gb, num_bits); VAR_5 = vlcdec_lookup[num_bits][VAR_4]; if (VAR_3 < 3)
VAR_5 *= 16; else
VAR_5 = (VAR_5 * VAR_2) / 1001; block[VAR_0->scantable.permutated[VAR_3]] = VAR_5; } return 0; }