static int smka_decode_frame(AVCodecContext *avctx, void *data,

                             int *got_frame_ptr, AVPacket *avpkt)

{

    SmackerAudioContext *s = avctx->priv_data;

    const uint8_t *buf = avpkt->data;

    int buf_size = avpkt->size;

    GetBitContext gb;

    HuffContext h[4] = { { 0 } };

    VLC vlc[4]       = { { 0 } };

    int16_t *samples;

    uint8_t *samples8;

    int val;

    int i, res, ret;

    int unp_size;

    int bits, stereo;

    int pred[2] = {0, 0};



    if (buf_size <= 4) {

        av_log(avctx, AV_LOG_ERROR, "packet is too small\n");

        return AVERROR(EINVAL);

    }



    unp_size = AV_RL32(buf);



    if (unp_size > (1U<<24)) {

        av_log(avctx, AV_LOG_ERROR, "packet is too big\n");

        return AVERROR_INVALIDDATA;

    }



    init_get_bits(&gb, buf + 4, (buf_size - 4) * 8);



    if(!get_bits1(&gb)){

        av_log(avctx, AV_LOG_INFO, "Sound: no data\n");

        *got_frame_ptr = 0;

        return 1;

    }

    stereo = get_bits1(&gb);

    bits = get_bits1(&gb);

    if (stereo ^ (avctx->channels != 1)) {

        av_log(avctx, AV_LOG_ERROR, "channels mismatch\n");

        return AVERROR(EINVAL);

    }

    if (bits && avctx->sample_fmt == AV_SAMPLE_FMT_U8) {

        av_log(avctx, AV_LOG_ERROR, "sample format mismatch\n");

        return AVERROR(EINVAL);

    }



    /* get output buffer */

    s->frame.nb_samples = unp_size / (avctx->channels * (bits + 1));

    if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {

        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");

        return ret;

    }

    samples  = (int16_t *)s->frame.data[0];

    samples8 =            s->frame.data[0];



    // Initialize

    for(i = 0; i < (1 << (bits + stereo)); i++) {

        h[i].length = 256;

        h[i].maxlength = 0;

        h[i].current = 0;

        h[i].bits = av_mallocz(256 * 4);

        h[i].lengths = av_mallocz(256 * sizeof(int));

        h[i].values = av_mallocz(256 * sizeof(int));

        skip_bits1(&gb);

        smacker_decode_tree(&gb, &h[i], 0, 0);

        skip_bits1(&gb);

        if(h[i].current > 1) {

            res = init_vlc(&vlc[i], SMKTREE_BITS, h[i].length,

                    h[i].lengths, sizeof(int), sizeof(int),

                    h[i].bits, sizeof(uint32_t), sizeof(uint32_t), INIT_VLC_LE);

            if(res < 0) {

                av_log(avctx, AV_LOG_ERROR, "Cannot build VLC table\n");

                return AVERROR_INVALIDDATA;

            }

        }

    }

    if(bits) { //decode 16-bit data

        for(i = stereo; i >= 0; i--)

            pred[i] = sign_extend(av_bswap16(get_bits(&gb, 16)), 16);

        for(i = 0; i <= stereo; i++)

            *samples++ = pred[i];

        for(; i < unp_size / 2; i++) {

            if(get_bits_left(&gb)<0)

                return AVERROR_INVALIDDATA;

            if(i & stereo) {

                if(vlc[2].table)

                    res = get_vlc2(&gb, vlc[2].table, SMKTREE_BITS, 3);

                else

                    res = 0;

                if (res < 0) {

                    av_log(avctx, AV_LOG_ERROR, "invalid vlc\n");

                    return AVERROR_INVALIDDATA;

                }

                val  = h[2].values[res];

                if(vlc[3].table)

                    res = get_vlc2(&gb, vlc[3].table, SMKTREE_BITS, 3);

                else

                    res = 0;

                if (res < 0) {

                    av_log(avctx, AV_LOG_ERROR, "invalid vlc\n");

                    return AVERROR_INVALIDDATA;

                }

                val |= h[3].values[res] << 8;

                pred[1] += sign_extend(val, 16);

                *samples++ = av_clip_int16(pred[1]);

            } else {

                if(vlc[0].table)

                    res = get_vlc2(&gb, vlc[0].table, SMKTREE_BITS, 3);

                else

                    res = 0;

                if (res < 0) {

                    av_log(avctx, AV_LOG_ERROR, "invalid vlc\n");

                    return AVERROR_INVALIDDATA;

                }

                val  = h[0].values[res];

                if(vlc[1].table)

                    res = get_vlc2(&gb, vlc[1].table, SMKTREE_BITS, 3);

                else

                    res = 0;

                if (res < 0) {

                    av_log(avctx, AV_LOG_ERROR, "invalid vlc\n");

                    return AVERROR_INVALIDDATA;

                }

                val |= h[1].values[res] << 8;

                pred[0] += sign_extend(val, 16);

                *samples++ = av_clip_int16(pred[0]);

            }

        }

    } else { //8-bit data

        for(i = stereo; i >= 0; i--)

            pred[i] = get_bits(&gb, 8);

        for(i = 0; i <= stereo; i++)

            *samples8++ = pred[i];

        for(; i < unp_size; i++) {

            if(get_bits_left(&gb)<0)

                return AVERROR_INVALIDDATA;

            if(i & stereo){

                if(vlc[1].table)

                    res = get_vlc2(&gb, vlc[1].table, SMKTREE_BITS, 3);

                else

                    res = 0;

                if (res < 0) {

                    av_log(avctx, AV_LOG_ERROR, "invalid vlc\n");

                    return AVERROR_INVALIDDATA;

                }

                pred[1] += sign_extend(h[1].values[res], 8);

                *samples8++ = av_clip_uint8(pred[1]);

            } else {

                if(vlc[0].table)

                    res = get_vlc2(&gb, vlc[0].table, SMKTREE_BITS, 3);

                else

                    res = 0;

                if (res < 0) {

                    av_log(avctx, AV_LOG_ERROR, "invalid vlc\n");

                    return AVERROR_INVALIDDATA;

                }

                pred[0] += sign_extend(h[0].values[res], 8);

                *samples8++ = av_clip_uint8(pred[0]);

            }

        }

    }



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

        if(vlc[i].table)

            ff_free_vlc(&vlc[i]);

        av_free(h[i].bits);

        av_free(h[i].lengths);

        av_free(h[i].values);

    }



    *got_frame_ptr   = 1;

    *(AVFrame *)data = s->frame;



    return buf_size;

}

static int smka_decode_frame(AVCodecContext *avctx, void *data,

                             int *got_frame_ptr, AVPacket *avpkt)

{

    SmackerAudioContext *s = avctx->priv_data;

    const uint8_t *buf = avpkt->data;

    int buf_size = avpkt->size;

    GetBitContext gb;

    HuffContext h[4] = { { 0 } };

    VLC vlc[4]       = { { 0 } };

    int16_t *samples;

    uint8_t *samples8;

    int val;

    int i, res, ret;

    int unp_size;

    int bits, stereo;

    int pred[2] = {0, 0};



    if (buf_size <= 4) {

        av_log(avctx, AV_LOG_ERROR, "packet is too small\n");

        return AVERROR(EINVAL);

    }



    unp_size = AV_RL32(buf);



    if (unp_size > (1U<<24)) {

        av_log(avctx, AV_LOG_ERROR, "packet is too big\n");

        return AVERROR_INVALIDDATA;

    }



    init_get_bits(&gb, buf + 4, (buf_size - 4) * 8);



    if(!get_bits1(&gb)){

        av_log(avctx, AV_LOG_INFO, "Sound: no data\n");

        *got_frame_ptr = 0;

        return 1;

    }

    stereo = get_bits1(&gb);

    bits = get_bits1(&gb);

    if (stereo ^ (avctx->channels != 1)) {

        av_log(avctx, AV_LOG_ERROR, "channels mismatch\n");

        return AVERROR(EINVAL);

    }

    if (bits && avctx->sample_fmt == AV_SAMPLE_FMT_U8) {

        av_log(avctx, AV_LOG_ERROR, "sample format mismatch\n");

        return AVERROR(EINVAL);

    }



    

    s->frame.nb_samples = unp_size / (avctx->channels * (bits + 1));

    if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {

        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");

        return ret;

    }

    samples  = (int16_t *)s->frame.data[0];

    samples8 =            s->frame.data[0];



    

    for(i = 0; i < (1 << (bits + stereo)); i++) {

        h[i].length = 256;

        h[i].maxlength = 0;

        h[i].current = 0;

        h[i].bits = av_mallocz(256 * 4);

        h[i].lengths = av_mallocz(256 * sizeof(int));

        h[i].values = av_mallocz(256 * sizeof(int));

        skip_bits1(&gb);

        smacker_decode_tree(&gb, &h[i], 0, 0);

        skip_bits1(&gb);

        if(h[i].current > 1) {

            res = init_vlc(&vlc[i], SMKTREE_BITS, h[i].length,

                    h[i].lengths, sizeof(int), sizeof(int),

                    h[i].bits, sizeof(uint32_t), sizeof(uint32_t), INIT_VLC_LE);

            if(res < 0) {

                av_log(avctx, AV_LOG_ERROR, "Cannot build VLC table\n");

                return AVERROR_INVALIDDATA;

            }

        }

    }

    if(bits) { 

        for(i = stereo; i >= 0; i--)

            pred[i] = sign_extend(av_bswap16(get_bits(&gb, 16)), 16);

        for(i = 0; i <= stereo; i++)

            *samples++ = pred[i];

        for(; i < unp_size / 2; i++) {

            if(get_bits_left(&gb)<0)

                return AVERROR_INVALIDDATA;

            if(i & stereo) {

                if(vlc[2].table)

                    res = get_vlc2(&gb, vlc[2].table, SMKTREE_BITS, 3);

                else

                    res = 0;

                if (res < 0) {

                    av_log(avctx, AV_LOG_ERROR, "invalid vlc\n");

                    return AVERROR_INVALIDDATA;

                }

                val  = h[2].values[res];

                if(vlc[3].table)

                    res = get_vlc2(&gb, vlc[3].table, SMKTREE_BITS, 3);

                else

                    res = 0;

                if (res < 0) {

                    av_log(avctx, AV_LOG_ERROR, "invalid vlc\n");

                    return AVERROR_INVALIDDATA;

                }

                val |= h[3].values[res] << 8;

                pred[1] += sign_extend(val, 16);

                *samples++ = av_clip_int16(pred[1]);

            } else {

                if(vlc[0].table)

                    res = get_vlc2(&gb, vlc[0].table, SMKTREE_BITS, 3);

                else

                    res = 0;

                if (res < 0) {

                    av_log(avctx, AV_LOG_ERROR, "invalid vlc\n");

                    return AVERROR_INVALIDDATA;

                }

                val  = h[0].values[res];

                if(vlc[1].table)

                    res = get_vlc2(&gb, vlc[1].table, SMKTREE_BITS, 3);

                else

                    res = 0;

                if (res < 0) {

                    av_log(avctx, AV_LOG_ERROR, "invalid vlc\n");

                    return AVERROR_INVALIDDATA;

                }

                val |= h[1].values[res] << 8;

                pred[0] += sign_extend(val, 16);

                *samples++ = av_clip_int16(pred[0]);

            }

        }

    } else { 

        for(i = stereo; i >= 0; i--)

            pred[i] = get_bits(&gb, 8);

        for(i = 0; i <= stereo; i++)

            *samples8++ = pred[i];

        for(; i < unp_size; i++) {

            if(get_bits_left(&gb)<0)

                return AVERROR_INVALIDDATA;

            if(i & stereo){

                if(vlc[1].table)

                    res = get_vlc2(&gb, vlc[1].table, SMKTREE_BITS, 3);

                else

                    res = 0;

                if (res < 0) {

                    av_log(avctx, AV_LOG_ERROR, "invalid vlc\n");

                    return AVERROR_INVALIDDATA;

                }

                pred[1] += sign_extend(h[1].values[res], 8);

                *samples8++ = av_clip_uint8(pred[1]);

            } else {

                if(vlc[0].table)

                    res = get_vlc2(&gb, vlc[0].table, SMKTREE_BITS, 3);

                else

                    res = 0;

                if (res < 0) {

                    av_log(avctx, AV_LOG_ERROR, "invalid vlc\n");

                    return AVERROR_INVALIDDATA;

                }

                pred[0] += sign_extend(h[0].values[res], 8);

                *samples8++ = av_clip_uint8(pred[0]);

            }

        }

    }



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

        if(vlc[i].table)

            ff_free_vlc(&vlc[i]);

        av_free(h[i].bits);

        av_free(h[i].lengths);

        av_free(h[i].values);

    }



    *got_frame_ptr   = 1;

    *(AVFrame *)data = s->frame;



    return buf_size;

}

static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1,

                             int *VAR_2, AVPacket *VAR_3)

{

    SmackerAudioContext *s = VAR_0->priv_data;

    const uint8_t *VAR_4 = VAR_3->VAR_1;

    int VAR_5 = VAR_3->size;

    GetBitContext gb;

    HuffContext h[4] = { { 0 } };

    VLC vlc[4]       = { { 0 } };

    int16_t *samples;

    uint8_t *samples8;

    int VAR_6;

    int VAR_7, VAR_8, VAR_9;

    int VAR_10;

    int VAR_11, VAR_12;

    int VAR_13[2] = {0, 0};



    if (VAR_5 <= 4) {

        av_log(VAR_0, AV_LOG_ERROR, "packet is too small\n");

        return AVERROR(EINVAL);

    }



    VAR_10 = AV_RL32(VAR_4);



    if (VAR_10 > (1U<<24)) {

        av_log(VAR_0, AV_LOG_ERROR, "packet is too big\n");

        return AVERROR_INVALIDDATA;

    }



    init_get_bits(&gb, VAR_4 + 4, (VAR_5 - 4) * 8);



    if(!get_bits1(&gb)){

        av_log(VAR_0, AV_LOG_INFO, "Sound: no VAR_1\n");

        *VAR_2 = 0;

        return 1;

    }

    VAR_12 = get_bits1(&gb);

    VAR_11 = get_bits1(&gb);

    if (VAR_12 ^ (VAR_0->channels != 1)) {

        av_log(VAR_0, AV_LOG_ERROR, "channels mismatch\n");

        return AVERROR(EINVAL);

    }

    if (VAR_11 && VAR_0->sample_fmt == AV_SAMPLE_FMT_U8) {

        av_log(VAR_0, AV_LOG_ERROR, "sample format mismatch\n");

        return AVERROR(EINVAL);

    }



    

    s->frame.nb_samples = VAR_10 / (VAR_0->channels * (VAR_11 + 1));

    if ((VAR_9 = VAR_0->get_buffer(VAR_0, &s->frame)) < 0) {

        av_log(VAR_0, AV_LOG_ERROR, "get_buffer() failed\n");

        return VAR_9;

    }

    samples  = (int16_t *)s->frame.VAR_1[0];

    samples8 =            s->frame.VAR_1[0];



    

    for(VAR_7 = 0; VAR_7 < (1 << (VAR_11 + VAR_12)); VAR_7++) {

        h[VAR_7].length = 256;

        h[VAR_7].maxlength = 0;

        h[VAR_7].current = 0;

        h[VAR_7].VAR_11 = av_mallocz(256 * 4);

        h[VAR_7].lengths = av_mallocz(256 * sizeof(int));

        h[VAR_7].values = av_mallocz(256 * sizeof(int));

        skip_bits1(&gb);

        smacker_decode_tree(&gb, &h[VAR_7], 0, 0);

        skip_bits1(&gb);

        if(h[VAR_7].current > 1) {

            VAR_8 = init_vlc(&vlc[VAR_7], SMKTREE_BITS, h[VAR_7].length,

                    h[VAR_7].lengths, sizeof(int), sizeof(int),

                    h[VAR_7].VAR_11, sizeof(uint32_t), sizeof(uint32_t), INIT_VLC_LE);

            if(VAR_8 < 0) {

                av_log(VAR_0, AV_LOG_ERROR, "Cannot build VLC table\n");

                return AVERROR_INVALIDDATA;

            }

        }

    }

    if(VAR_11) { 

        for(VAR_7 = VAR_12; VAR_7 >= 0; VAR_7--)

            VAR_13[VAR_7] = sign_extend(av_bswap16(get_bits(&gb, 16)), 16);

        for(VAR_7 = 0; VAR_7 <= VAR_12; VAR_7++)

            *samples++ = VAR_13[VAR_7];

        for(; VAR_7 < VAR_10 / 2; VAR_7++) {

            if(get_bits_left(&gb)<0)

                return AVERROR_INVALIDDATA;

            if(VAR_7 & VAR_12) {

                if(vlc[2].table)

                    VAR_8 = get_vlc2(&gb, vlc[2].table, SMKTREE_BITS, 3);

                else

                    VAR_8 = 0;

                if (VAR_8 < 0) {

                    av_log(VAR_0, AV_LOG_ERROR, "invalid vlc\n");

                    return AVERROR_INVALIDDATA;

                }

                VAR_6  = h[2].values[VAR_8];

                if(vlc[3].table)

                    VAR_8 = get_vlc2(&gb, vlc[3].table, SMKTREE_BITS, 3);

                else

                    VAR_8 = 0;

                if (VAR_8 < 0) {

                    av_log(VAR_0, AV_LOG_ERROR, "invalid vlc\n");

                    return AVERROR_INVALIDDATA;

                }

                VAR_6 |= h[3].values[VAR_8] << 8;

                VAR_13[1] += sign_extend(VAR_6, 16);

                *samples++ = av_clip_int16(VAR_13[1]);

            } else {

                if(vlc[0].table)

                    VAR_8 = get_vlc2(&gb, vlc[0].table, SMKTREE_BITS, 3);

                else

                    VAR_8 = 0;

                if (VAR_8 < 0) {

                    av_log(VAR_0, AV_LOG_ERROR, "invalid vlc\n");

                    return AVERROR_INVALIDDATA;

                }

                VAR_6  = h[0].values[VAR_8];

                if(vlc[1].table)

                    VAR_8 = get_vlc2(&gb, vlc[1].table, SMKTREE_BITS, 3);

                else

                    VAR_8 = 0;

                if (VAR_8 < 0) {

                    av_log(VAR_0, AV_LOG_ERROR, "invalid vlc\n");

                    return AVERROR_INVALIDDATA;

                }

                VAR_6 |= h[1].values[VAR_8] << 8;

                VAR_13[0] += sign_extend(VAR_6, 16);

                *samples++ = av_clip_int16(VAR_13[0]);

            }

        }

    } else { 

        for(VAR_7 = VAR_12; VAR_7 >= 0; VAR_7--)

            VAR_13[VAR_7] = get_bits(&gb, 8);

        for(VAR_7 = 0; VAR_7 <= VAR_12; VAR_7++)

            *samples8++ = VAR_13[VAR_7];

        for(; VAR_7 < VAR_10; VAR_7++) {

            if(get_bits_left(&gb)<0)

                return AVERROR_INVALIDDATA;

            if(VAR_7 & VAR_12){

                if(vlc[1].table)

                    VAR_8 = get_vlc2(&gb, vlc[1].table, SMKTREE_BITS, 3);

                else

                    VAR_8 = 0;

                if (VAR_8 < 0) {

                    av_log(VAR_0, AV_LOG_ERROR, "invalid vlc\n");

                    return AVERROR_INVALIDDATA;

                }

                VAR_13[1] += sign_extend(h[1].values[VAR_8], 8);

                *samples8++ = av_clip_uint8(VAR_13[1]);

            } else {

                if(vlc[0].table)

                    VAR_8 = get_vlc2(&gb, vlc[0].table, SMKTREE_BITS, 3);

                else

                    VAR_8 = 0;

                if (VAR_8 < 0) {

                    av_log(VAR_0, AV_LOG_ERROR, "invalid vlc\n");

                    return AVERROR_INVALIDDATA;

                }

                VAR_13[0] += sign_extend(h[0].values[VAR_8], 8);

                *samples8++ = av_clip_uint8(VAR_13[0]);

            }

        }

    }



    for(VAR_7 = 0; VAR_7 < 4; VAR_7++) {

        if(vlc[VAR_7].table)

            ff_free_vlc(&vlc[VAR_7]);

        av_free(h[VAR_7].VAR_11);

        av_free(h[VAR_7].lengths);

        av_free(h[VAR_7].values);

    }



    *VAR_2   = 1;

    *(AVFrame *)VAR_1 = s->frame;



    return VAR_5;

}

static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1,
int *VAR_2, AVPacket *VAR_3)
{ SmackerAudioContext *s = VAR_0->priv_data; const uint8_t *VAR_4 = VAR_3->VAR_1; int VAR_5 = VAR_3->size; GetBitContext gb; HuffContext h[4] = { { 0 } }; VLC vlc[4]       = { { 0 } }; int16_t *samples; uint8_t *samples8; int VAR_6; int VAR_7, VAR_8, VAR_9; int VAR_10; int VAR_11, VAR_12; int VAR_13[2] = {0, 0}; if (VAR_5 <= 4) { av_log(VAR_0, AV_LOG_ERROR, "packet is too small\n"); return AVERROR(EINVAL); } VAR_10 = AV_RL32(VAR_4); if (VAR_10 > (1U<<24)) { av_log(VAR_0, AV_LOG_ERROR, "packet is too big\n"); return AVERROR_INVALIDDATA; } init_get_bits(&gb, VAR_4 + 4, (VAR_5 - 4) * 8); if(!get_bits1(&gb)){ av_log(VAR_0, AV_LOG_INFO, "Sound: no VAR_1\n"); *VAR_2 = 0; return 1; } VAR_12 = get_bits1(&gb); VAR_11 = get_bits1(&gb); if (VAR_12 ^ (VAR_0->channels != 1)) { av_log(VAR_0, AV_LOG_ERROR, "channels mismatch\n"); return AVERROR(EINVAL); } if (VAR_11 && VAR_0->sample_fmt == AV_SAMPLE_FMT_U8) { av_log(VAR_0, AV_LOG_ERROR, "sample format mismatch\n"); return AVERROR(EINVAL); } s->frame.nb_samples = VAR_10 / (VAR_0->channels * (VAR_11 + 1)); if ((VAR_9 = VAR_0->get_buffer(VAR_0, &s->frame)) < 0) { av_log(VAR_0, AV_LOG_ERROR, "get_buffer() failed\n"); return VAR_9; } samples  = (int16_t *)s->frame.VAR_1[0]; samples8 =            s->frame.VAR_1[0]; for(VAR_7 = 0; VAR_7 < (1 << (VAR_11 + VAR_12)); VAR_7++) { h[VAR_7].length = 256; h[VAR_7].maxlength = 0; h[VAR_7].current = 0; h[VAR_7].VAR_11 = av_mallocz(256 * 4); h[VAR_7].lengths = av_mallocz(256 * sizeof(int)); h[VAR_7].values = av_mallocz(256 * sizeof(int)); skip_bits1(&gb); smacker_decode_tree(&gb, &h[VAR_7], 0, 0); skip_bits1(&gb); if(h[VAR_7].current > 1) { VAR_8 = init_vlc(&vlc[VAR_7], SMKTREE_BITS, h[VAR_7].length,
h[VAR_7].lengths, sizeof(int), sizeof(int),
h[VAR_7].VAR_11, sizeof(uint32_t), sizeof(uint32_t), INIT_VLC_LE); if(VAR_8 < 0) { av_log(VAR_0, AV_LOG_ERROR, "Cannot build VLC table\n"); return AVERROR_INVALIDDATA; } } } if(VAR_11) { for(VAR_7 = VAR_12; VAR_7 >= 0; VAR_7--) VAR_13[VAR_7] = sign_extend(av_bswap16(get_bits(&gb, 16)), 16); for(VAR_7 = 0; VAR_7 <= VAR_12; VAR_7++) *samples++ = VAR_13[VAR_7]; for(; VAR_7 < VAR_10 / 2; VAR_7++) { if(get_bits_left(&gb)<0)
return AVERROR_INVALIDDATA; if(VAR_7 & VAR_12) { if(vlc[2].table)
VAR_8 = get_vlc2(&gb, vlc[2].table, SMKTREE_BITS, 3); else
VAR_8 = 0; if (VAR_8 < 0) { av_log(VAR_0, AV_LOG_ERROR, "invalid vlc\n"); return AVERROR_INVALIDDATA; } VAR_6  = h[2].values[VAR_8]; if(vlc[3].table)
VAR_8 = get_vlc2(&gb, vlc[3].table, SMKTREE_BITS, 3); else
VAR_8 = 0; if (VAR_8 < 0) { av_log(VAR_0, AV_LOG_ERROR, "invalid vlc\n"); return AVERROR_INVALIDDATA; } VAR_6 |= h[3].values[VAR_8] << 8; VAR_13[1] += sign_extend(VAR_6, 16); *samples++ = av_clip_int16(VAR_13[1]); } else { if(vlc[0].table)
VAR_8 = get_vlc2(&gb, vlc[0].table, SMKTREE_BITS, 3); else
VAR_8 = 0; if (VAR_8 < 0) { av_log(VAR_0, AV_LOG_ERROR, "invalid vlc\n"); return AVERROR_INVALIDDATA; } VAR_6  = h[0].values[VAR_8]; if(vlc[1].table)
VAR_8 = get_vlc2(&gb, vlc[1].table, SMKTREE_BITS, 3); else
VAR_8 = 0; if (VAR_8 < 0) { av_log(VAR_0, AV_LOG_ERROR, "invalid vlc\n"); return AVERROR_INVALIDDATA; } VAR_6 |= h[1].values[VAR_8] << 8; VAR_13[0] += sign_extend(VAR_6, 16); *samples++ = av_clip_int16(VAR_13[0]); } } } else { for(VAR_7 = VAR_12; VAR_7 >= 0; VAR_7--) VAR_13[VAR_7] = get_bits(&gb, 8); for(VAR_7 = 0; VAR_7 <= VAR_12; VAR_7++) *samples8++ = VAR_13[VAR_7]; for(; VAR_7 < VAR_10; VAR_7++) { if(get_bits_left(&gb)<0)
return AVERROR_INVALIDDATA; if(VAR_7 & VAR_12){ if(vlc[1].table)
VAR_8 = get_vlc2(&gb, vlc[1].table, SMKTREE_BITS, 3); else
VAR_8 = 0; if (VAR_8 < 0) { av_log(VAR_0, AV_LOG_ERROR, "invalid vlc\n"); return AVERROR_INVALIDDATA; } VAR_13[1] += sign_extend(h[1].values[VAR_8], 8); *samples8++ = av_clip_uint8(VAR_13[1]); } else { if(vlc[0].table)
VAR_8 = get_vlc2(&gb, vlc[0].table, SMKTREE_BITS, 3); else
VAR_8 = 0; if (VAR_8 < 0) { av_log(VAR_0, AV_LOG_ERROR, "invalid vlc\n"); return AVERROR_INVALIDDATA; } VAR_13[0] += sign_extend(h[0].values[VAR_8], 8); *samples8++ = av_clip_uint8(VAR_13[0]); } } } for(VAR_7 = 0; VAR_7 < 4; VAR_7++) { if(vlc[VAR_7].table)
ff_free_vlc(&vlc[VAR_7]); av_free(h[VAR_7].VAR_11); av_free(h[VAR_7].lengths); av_free(h[VAR_7].values); } *VAR_2   = 1; *(AVFrame *)VAR_1 = s->frame; return VAR_5; }