static int imc_decode_block(AVCodecContext *avctx, IMCContext *q, int ch)
{
    int stream_format_code;
    int imc_hdr, i, j, ret;
    int flag;
    int bits, summer;
    int counter, bitscount;
    IMCChannel *chctx = q->chctx + ch;
    /* Check the frame header */
    imc_hdr = get_bits(&q->gb, 9);
    if (imc_hdr & 0x18) {
        av_log(avctx, AV_LOG_ERROR, "frame header check failed!\n");
        av_log(avctx, AV_LOG_ERROR, "got %X.\n", imc_hdr);
    stream_format_code = get_bits(&q->gb, 3);
    if (stream_format_code & 1) {
        av_log_ask_for_sample(avctx, "Stream format %X is not supported\n",
                              stream_format_code);
        return AVERROR_PATCHWELCOME;
    if (stream_format_code & 0x04)
        chctx->decoder_reset = 1;
    if (chctx->decoder_reset) {
        for (i = 0; i < BANDS; i++)
            chctx->old_floor[i] = 1.0;
        for (i = 0; i < COEFFS; i++)
            chctx->CWdecoded[i] = 0;
        chctx->decoder_reset = 0;
    flag = get_bits1(&q->gb);
    imc_read_level_coeffs(q, stream_format_code, chctx->levlCoeffBuf);
    if (stream_format_code & 0x4)
        imc_decode_level_coefficients(q, chctx->levlCoeffBuf,
                                      chctx->flcoeffs1, chctx->flcoeffs2);
    else
        imc_decode_level_coefficients2(q, chctx->levlCoeffBuf, chctx->old_floor,
                                       chctx->flcoeffs1, chctx->flcoeffs2);
    memcpy(chctx->old_floor, chctx->flcoeffs1, 32 * sizeof(float));
    counter = 0;
    for (i = 0; i < BANDS; i++) {
        if (chctx->levlCoeffBuf[i] == 16) {
            chctx->bandWidthT[i] = 0;
            counter++;
        } else
            chctx->bandWidthT[i] = band_tab[i + 1] - band_tab[i];
    memset(chctx->bandFlagsBuf, 0, BANDS * sizeof(int));
    for (i = 0; i < BANDS - 1; i++) {
        if (chctx->bandWidthT[i])
            chctx->bandFlagsBuf[i] = get_bits1(&q->gb);
    imc_calculate_coeffs(q, chctx->flcoeffs1, chctx->flcoeffs2, chctx->bandWidthT, chctx->flcoeffs3, chctx->flcoeffs5);
    bitscount = 0;
    /* first 4 bands will be assigned 5 bits per coefficient */
    if (stream_format_code & 0x2) {
        bitscount += 15;
        chctx->bitsBandT[0] = 5;
        chctx->CWlengthT[0] = 5;
        chctx->CWlengthT[1] = 5;
        chctx->CWlengthT[2] = 5;
        for (i = 1; i < 4; i++) {
            bits = (chctx->levlCoeffBuf[i] == 16) ? 0 : 5;
            chctx->bitsBandT[i] = bits;
            for (j = band_tab[i]; j < band_tab[i + 1]; j++) {
                chctx->CWlengthT[j] = bits;
                bitscount      += bits;
    if (avctx->codec_id == AV_CODEC_ID_IAC) {
        bitscount += !!chctx->bandWidthT[BANDS - 1];
        if (!(stream_format_code & 0x2))
            bitscount += 16;
    if ((ret = bit_allocation(q, chctx, stream_format_code,
                              512 - bitscount - get_bits_count(&q->gb),
                              flag)) < 0) {
        av_log(avctx, AV_LOG_ERROR, "Bit allocations failed\n");
        chctx->decoder_reset = 1;
        return ret;
    for (i = 0; i < BANDS; i++) {
        chctx->sumLenArr[i]   = 0;
        chctx->skipFlagRaw[i] = 0;
        for (j = band_tab[i]; j < band_tab[i + 1]; j++)
            chctx->sumLenArr[i] += chctx->CWlengthT[j];
        if (chctx->bandFlagsBuf[i])
            if ((((band_tab[i + 1] - band_tab[i]) * 1.5) > chctx->sumLenArr[i]) && (chctx->sumLenArr[i] > 0))
                chctx->skipFlagRaw[i] = 1;
    imc_get_skip_coeff(q, chctx);
    for (i = 0; i < BANDS; i++) {
        chctx->flcoeffs6[i] = chctx->flcoeffs1[i];
        /* band has flag set and at least one coded coefficient */
        if (chctx->bandFlagsBuf[i] && (band_tab[i + 1] - band_tab[i]) != chctx->skipFlagCount[i]) {
            chctx->flcoeffs6[i] *= q->sqrt_tab[ band_tab[i + 1] - band_tab[i]] /
                                   q->sqrt_tab[(band_tab[i + 1] - band_tab[i] - chctx->skipFlagCount[i])];
    /* calculate bits left, bits needed and adjust bit allocation */
    bits = summer = 0;
    for (i = 0; i < BANDS; i++) {
        if (chctx->bandFlagsBuf[i]) {
            for (j = band_tab[i]; j < band_tab[i + 1]; j++) {
                if (chctx->skipFlags[j]) {
                    summer += chctx->CWlengthT[j];
                    chctx->CWlengthT[j] = 0;
            bits   += chctx->skipFlagBits[i];
            summer -= chctx->skipFlagBits[i];
    imc_adjust_bit_allocation(q, chctx, summer);
    for (i = 0; i < BANDS; i++) {
        chctx->sumLenArr[i] = 0;
        for (j = band_tab[i]; j < band_tab[i + 1]; j++)
            if (!chctx->skipFlags[j])
                chctx->sumLenArr[i] += chctx->CWlengthT[j];
    memset(chctx->codewords, 0, sizeof(chctx->codewords));
    if (imc_get_coeffs(q, chctx) < 0) {
        av_log(avctx, AV_LOG_ERROR, "Read coefficients failed\n");
        chctx->decoder_reset = 1;
    if (inverse_quant_coeff(q, chctx, stream_format_code) < 0) {
        av_log(avctx, AV_LOG_ERROR, "Inverse quantization of coefficients failed\n");
        chctx->decoder_reset = 1;
    memset(chctx->skipFlags, 0, sizeof(chctx->skipFlags));
    imc_imdct256(q, chctx, avctx->channels);
    return 0;
static int imc_decode_block(AVCodecContext *avctx, IMCContext *q, int ch)
{
    int stream_format_code;
    int imc_hdr, i, j, ret;
    int flag;
    int bits, summer;
    int counter, bitscount;
    IMCChannel *chctx = q->chctx + ch;
    
    imc_hdr = get_bits(&q->gb, 9);
    if (imc_hdr & 0x18) {
        av_log(avctx, AV_LOG_ERROR, "frame header check failed!\n");
        av_log(avctx, AV_LOG_ERROR, "got %X.\n", imc_hdr);
    stream_format_code = get_bits(&q->gb, 3);
    if (stream_format_code & 1) {
        av_log_ask_for_sample(avctx, "Stream format %X is not supported\n",
                              stream_format_code);
        return AVERROR_PATCHWELCOME;
    if (stream_format_code & 0x04)
        chctx->decoder_reset = 1;
    if (chctx->decoder_reset) {
        for (i = 0; i < BANDS; i++)
            chctx->old_floor[i] = 1.0;
        for (i = 0; i < COEFFS; i++)
            chctx->CWdecoded[i] = 0;
        chctx->decoder_reset = 0;
    flag = get_bits1(&q->gb);
    imc_read_level_coeffs(q, stream_format_code, chctx->levlCoeffBuf);
    if (stream_format_code & 0x4)
        imc_decode_level_coefficients(q, chctx->levlCoeffBuf,
                                      chctx->flcoeffs1, chctx->flcoeffs2);
    else
        imc_decode_level_coefficients2(q, chctx->levlCoeffBuf, chctx->old_floor,
                                       chctx->flcoeffs1, chctx->flcoeffs2);
    memcpy(chctx->old_floor, chctx->flcoeffs1, 32 * sizeof(float));
    counter = 0;
    for (i = 0; i < BANDS; i++) {
        if (chctx->levlCoeffBuf[i] == 16) {
            chctx->bandWidthT[i] = 0;
            counter++;
        } else
            chctx->bandWidthT[i] = band_tab[i + 1] - band_tab[i];
    memset(chctx->bandFlagsBuf, 0, BANDS * sizeof(int));
    for (i = 0; i < BANDS - 1; i++) {
        if (chctx->bandWidthT[i])
            chctx->bandFlagsBuf[i] = get_bits1(&q->gb);
    imc_calculate_coeffs(q, chctx->flcoeffs1, chctx->flcoeffs2, chctx->bandWidthT, chctx->flcoeffs3, chctx->flcoeffs5);
    bitscount = 0;
    
    if (stream_format_code & 0x2) {
        bitscount += 15;
        chctx->bitsBandT[0] = 5;
        chctx->CWlengthT[0] = 5;
        chctx->CWlengthT[1] = 5;
        chctx->CWlengthT[2] = 5;
        for (i = 1; i < 4; i++) {
            bits = (chctx->levlCoeffBuf[i] == 16) ? 0 : 5;
            chctx->bitsBandT[i] = bits;
            for (j = band_tab[i]; j < band_tab[i + 1]; j++) {
                chctx->CWlengthT[j] = bits;
                bitscount      += bits;
    if (avctx->codec_id == AV_CODEC_ID_IAC) {
        bitscount += !!chctx->bandWidthT[BANDS - 1];
        if (!(stream_format_code & 0x2))
            bitscount += 16;
    if ((ret = bit_allocation(q, chctx, stream_format_code,
                              512 - bitscount - get_bits_count(&q->gb),
                              flag)) < 0) {
        av_log(avctx, AV_LOG_ERROR, "Bit allocations failed\n");
        chctx->decoder_reset = 1;
        return ret;
    for (i = 0; i < BANDS; i++) {
        chctx->sumLenArr[i]   = 0;
        chctx->skipFlagRaw[i] = 0;
        for (j = band_tab[i]; j < band_tab[i + 1]; j++)
            chctx->sumLenArr[i] += chctx->CWlengthT[j];
        if (chctx->bandFlagsBuf[i])
            if ((((band_tab[i + 1] - band_tab[i]) * 1.5) > chctx->sumLenArr[i]) && (chctx->sumLenArr[i] > 0))
                chctx->skipFlagRaw[i] = 1;
    imc_get_skip_coeff(q, chctx);
    for (i = 0; i < BANDS; i++) {
        chctx->flcoeffs6[i] = chctx->flcoeffs1[i];
        
        if (chctx->bandFlagsBuf[i] && (band_tab[i + 1] - band_tab[i]) != chctx->skipFlagCount[i]) {
            chctx->flcoeffs6[i] *= q->sqrt_tab[ band_tab[i + 1] - band_tab[i]] /
                                   q->sqrt_tab[(band_tab[i + 1] - band_tab[i] - chctx->skipFlagCount[i])];
    
    bits = summer = 0;
    for (i = 0; i < BANDS; i++) {
        if (chctx->bandFlagsBuf[i]) {
            for (j = band_tab[i]; j < band_tab[i + 1]; j++) {
                if (chctx->skipFlags[j]) {
                    summer += chctx->CWlengthT[j];
                    chctx->CWlengthT[j] = 0;
            bits   += chctx->skipFlagBits[i];
            summer -= chctx->skipFlagBits[i];
    imc_adjust_bit_allocation(q, chctx, summer);
    for (i = 0; i < BANDS; i++) {
        chctx->sumLenArr[i] = 0;
        for (j = band_tab[i]; j < band_tab[i + 1]; j++)
            if (!chctx->skipFlags[j])
                chctx->sumLenArr[i] += chctx->CWlengthT[j];
    memset(chctx->codewords, 0, sizeof(chctx->codewords));
    if (imc_get_coeffs(q, chctx) < 0) {
        av_log(avctx, AV_LOG_ERROR, "Read coefficients failed\n");
        chctx->decoder_reset = 1;
    if (inverse_quant_coeff(q, chctx, stream_format_code) < 0) {
        av_log(avctx, AV_LOG_ERROR, "Inverse quantization of coefficients failed\n");
        chctx->decoder_reset = 1;
    memset(chctx->skipFlags, 0, sizeof(chctx->skipFlags));
    imc_imdct256(q, chctx, avctx->channels);
    return 0;
static int FUNC_0(AVCodecContext *VAR_0, IMCContext *VAR_1, int VAR_2)
{
    int VAR_3;
    int VAR_4, VAR_5, VAR_6, VAR_7;
    int VAR_8;
    int VAR_9, VAR_10;
    int VAR_11, VAR_12;
    IMCChannel *chctx = VAR_1->chctx + VAR_2;
    
    VAR_4 = get_bits(&VAR_1->gb, 9);
    if (VAR_4 & 0x18) {
        av_log(VAR_0, AV_LOG_ERROR, "frame header check failed!\n");
        av_log(VAR_0, AV_LOG_ERROR, "got %X.\n", VAR_4);
    VAR_3 = get_bits(&VAR_1->gb, 3);
    if (VAR_3 & 1) {
        av_log_ask_for_sample(VAR_0, "Stream format %X is not supported\n",
                              VAR_3);
        return AVERROR_PATCHWELCOME;
    if (VAR_3 & 0x04)
        chctx->decoder_reset = 1;
    if (chctx->decoder_reset) {
        for (VAR_5 = 0; VAR_5 < BANDS; VAR_5++)
            chctx->old_floor[VAR_5] = 1.0;
        for (VAR_5 = 0; VAR_5 < COEFFS; VAR_5++)
            chctx->CWdecoded[VAR_5] = 0;
        chctx->decoder_reset = 0;
    VAR_8 = get_bits1(&VAR_1->gb);
    imc_read_level_coeffs(VAR_1, VAR_3, chctx->levlCoeffBuf);
    if (VAR_3 & 0x4)
        imc_decode_level_coefficients(VAR_1, chctx->levlCoeffBuf,
                                      chctx->flcoeffs1, chctx->flcoeffs2);
    else
        imc_decode_level_coefficients2(VAR_1, chctx->levlCoeffBuf, chctx->old_floor,
                                       chctx->flcoeffs1, chctx->flcoeffs2);
    memcpy(chctx->old_floor, chctx->flcoeffs1, 32 * sizeof(float));
    VAR_11 = 0;
    for (VAR_5 = 0; VAR_5 < BANDS; VAR_5++) {
        if (chctx->levlCoeffBuf[VAR_5] == 16) {
            chctx->bandWidthT[VAR_5] = 0;
            VAR_11++;
        } else
            chctx->bandWidthT[VAR_5] = band_tab[VAR_5 + 1] - band_tab[VAR_5];
    memset(chctx->bandFlagsBuf, 0, BANDS * sizeof(int));
    for (VAR_5 = 0; VAR_5 < BANDS - 1; VAR_5++) {
        if (chctx->bandWidthT[VAR_5])
            chctx->bandFlagsBuf[VAR_5] = get_bits1(&VAR_1->gb);
    imc_calculate_coeffs(VAR_1, chctx->flcoeffs1, chctx->flcoeffs2, chctx->bandWidthT, chctx->flcoeffs3, chctx->flcoeffs5);
    VAR_12 = 0;
    
    if (VAR_3 & 0x2) {
        VAR_12 += 15;
        chctx->bitsBandT[0] = 5;
        chctx->CWlengthT[0] = 5;
        chctx->CWlengthT[1] = 5;
        chctx->CWlengthT[2] = 5;
        for (VAR_5 = 1; VAR_5 < 4; VAR_5++) {
            VAR_9 = (chctx->levlCoeffBuf[VAR_5] == 16) ? 0 : 5;
            chctx->bitsBandT[VAR_5] = VAR_9;
            for (VAR_6 = band_tab[VAR_5]; VAR_6 < band_tab[VAR_5 + 1]; VAR_6++) {
                chctx->CWlengthT[VAR_6] = VAR_9;
                VAR_12      += VAR_9;
    if (VAR_0->codec_id == AV_CODEC_ID_IAC) {
        VAR_12 += !!chctx->bandWidthT[BANDS - 1];
        if (!(VAR_3 & 0x2))
            VAR_12 += 16;
    if ((VAR_7 = bit_allocation(VAR_1, chctx, VAR_3,
                              512 - VAR_12 - get_bits_count(&VAR_1->gb),
                              VAR_8)) < 0) {
        av_log(VAR_0, AV_LOG_ERROR, "Bit allocations failed\n");
        chctx->decoder_reset = 1;
        return VAR_7;
    for (VAR_5 = 0; VAR_5 < BANDS; VAR_5++) {
        chctx->sumLenArr[VAR_5]   = 0;
        chctx->skipFlagRaw[VAR_5] = 0;
        for (VAR_6 = band_tab[VAR_5]; VAR_6 < band_tab[VAR_5 + 1]; VAR_6++)
            chctx->sumLenArr[VAR_5] += chctx->CWlengthT[VAR_6];
        if (chctx->bandFlagsBuf[VAR_5])
            if ((((band_tab[VAR_5 + 1] - band_tab[VAR_5]) * 1.5) > chctx->sumLenArr[VAR_5]) && (chctx->sumLenArr[VAR_5] > 0))
                chctx->skipFlagRaw[VAR_5] = 1;
    imc_get_skip_coeff(VAR_1, chctx);
    for (VAR_5 = 0; VAR_5 < BANDS; VAR_5++) {
        chctx->flcoeffs6[VAR_5] = chctx->flcoeffs1[VAR_5];
        
        if (chctx->bandFlagsBuf[VAR_5] && (band_tab[VAR_5 + 1] - band_tab[VAR_5]) != chctx->skipFlagCount[VAR_5]) {
            chctx->flcoeffs6[VAR_5] *= VAR_1->sqrt_tab[ band_tab[VAR_5 + 1] - band_tab[VAR_5]] /
                                   VAR_1->sqrt_tab[(band_tab[VAR_5 + 1] - band_tab[VAR_5] - chctx->skipFlagCount[VAR_5])];
    
    VAR_9 = VAR_10 = 0;
    for (VAR_5 = 0; VAR_5 < BANDS; VAR_5++) {
        if (chctx->bandFlagsBuf[VAR_5]) {
            for (VAR_6 = band_tab[VAR_5]; VAR_6 < band_tab[VAR_5 + 1]; VAR_6++) {
                if (chctx->skipFlags[VAR_6]) {
                    VAR_10 += chctx->CWlengthT[VAR_6];
                    chctx->CWlengthT[VAR_6] = 0;
            VAR_9   += chctx->skipFlagBits[VAR_5];
            VAR_10 -= chctx->skipFlagBits[VAR_5];
    imc_adjust_bit_allocation(VAR_1, chctx, VAR_10);
    for (VAR_5 = 0; VAR_5 < BANDS; VAR_5++) {
        chctx->sumLenArr[VAR_5] = 0;
        for (VAR_6 = band_tab[VAR_5]; VAR_6 < band_tab[VAR_5 + 1]; VAR_6++)
            if (!chctx->skipFlags[VAR_6])
                chctx->sumLenArr[VAR_5] += chctx->CWlengthT[VAR_6];
    memset(chctx->codewords, 0, sizeof(chctx->codewords));
    if (imc_get_coeffs(VAR_1, chctx) < 0) {
        av_log(VAR_0, AV_LOG_ERROR, "Read coefficients failed\n");
        chctx->decoder_reset = 1;
    if (inverse_quant_coeff(VAR_1, chctx, VAR_3) < 0) {
        av_log(VAR_0, AV_LOG_ERROR, "Inverse quantization of coefficients failed\n");
        chctx->decoder_reset = 1;
    memset(chctx->skipFlags, 0, sizeof(chctx->skipFlags));
    imc_imdct256(VAR_1, chctx, VAR_0->channels);
    return 0;
static int FUNC_0(AVCodecContext *VAR_0, IMCContext *VAR_1, int VAR_2)
{ int VAR_3; int VAR_4, VAR_5, VAR_6, VAR_7; int VAR_8; int VAR_9, VAR_10; int VAR_11, VAR_12; IMCChannel *chctx = VAR_1->chctx + VAR_2; VAR_4 = get_bits(&VAR_1->gb, 9); if (VAR_4 & 0x18) { av_log(VAR_0, AV_LOG_ERROR, "frame header check failed!\n"); av_log(VAR_0, AV_LOG_ERROR, "got %X.\n", VAR_4); VAR_3 = get_bits(&VAR_1->gb, 3); if (VAR_3 & 1) { av_log_ask_for_sample(VAR_0, "Stream format %X is not supported\n",
VAR_3); return AVERROR_PATCHWELCOME; if (VAR_3 & 0x04)
chctx->decoder_reset = 1; if (chctx->decoder_reset) { for (VAR_5 = 0; VAR_5 < BANDS; VAR_5++) chctx->old_floor[VAR_5] = 1.0; for (VAR_5 = 0; VAR_5 < COEFFS; VAR_5++) chctx->CWdecoded[VAR_5] = 0; chctx->decoder_reset = 0; VAR_8 = get_bits1(&VAR_1->gb); imc_read_level_coeffs(VAR_1, VAR_3, chctx->levlCoeffBuf); if (VAR_3 & 0x4)
imc_decode_level_coefficients(VAR_1, chctx->levlCoeffBuf,
chctx->flcoeffs1, chctx->flcoeffs2); else
imc_decode_level_coefficients2(VAR_1, chctx->levlCoeffBuf, chctx->old_floor,
chctx->flcoeffs1, chctx->flcoeffs2); memcpy(chctx->old_floor, chctx->flcoeffs1, 32 * sizeof(float)); VAR_11 = 0; for (VAR_5 = 0; VAR_5 < BANDS; VAR_5++) { if (chctx->levlCoeffBuf[VAR_5] == 16) { chctx->bandWidthT[VAR_5] = 0; VAR_11++; } else chctx->bandWidthT[VAR_5] = band_tab[VAR_5 + 1] - band_tab[VAR_5]; memset(chctx->bandFlagsBuf, 0, BANDS * sizeof(int)); for (VAR_5 = 0; VAR_5 < BANDS - 1; VAR_5++) { if (chctx->bandWidthT[VAR_5])
chctx->bandFlagsBuf[VAR_5] = get_bits1(&VAR_1->gb); imc_calculate_coeffs(VAR_1, chctx->flcoeffs1, chctx->flcoeffs2, chctx->bandWidthT, chctx->flcoeffs3, chctx->flcoeffs5); VAR_12 = 0; if (VAR_3 & 0x2) { VAR_12 += 15; chctx->bitsBandT[0] = 5; chctx->CWlengthT[0] = 5; chctx->CWlengthT[1] = 5; chctx->CWlengthT[2] = 5; for (VAR_5 = 1; VAR_5 < 4; VAR_5++) { VAR_9 = (chctx->levlCoeffBuf[VAR_5] == 16) ? 0 : 5; chctx->bitsBandT[VAR_5] = VAR_9; for (VAR_6 = band_tab[VAR_5]; VAR_6 < band_tab[VAR_5 + 1]; VAR_6++) { chctx->CWlengthT[VAR_6] = VAR_9; VAR_12      += VAR_9; if (VAR_0->codec_id == AV_CODEC_ID_IAC) { VAR_12 += !!chctx->bandWidthT[BANDS - 1]; if (!(VAR_3 & 0x2))
VAR_12 += 16; if ((VAR_7 = bit_allocation(VAR_1, chctx, VAR_3,
512 - VAR_12 - get_bits_count(&VAR_1->gb),
VAR_8)) < 0) { av_log(VAR_0, AV_LOG_ERROR, "Bit allocations failed\n"); chctx->decoder_reset = 1; return VAR_7; for (VAR_5 = 0; VAR_5 < BANDS; VAR_5++) { chctx->sumLenArr[VAR_5]   = 0; chctx->skipFlagRaw[VAR_5] = 0; for (VAR_6 = band_tab[VAR_5]; VAR_6 < band_tab[VAR_5 + 1]; VAR_6++) chctx->sumLenArr[VAR_5] += chctx->CWlengthT[VAR_6]; if (chctx->bandFlagsBuf[VAR_5])
if ((((band_tab[VAR_5 + 1] - band_tab[VAR_5]) * 1.5) > chctx->sumLenArr[VAR_5]) && (chctx->sumLenArr[VAR_5] > 0))
chctx->skipFlagRaw[VAR_5] = 1; imc_get_skip_coeff(VAR_1, chctx); for (VAR_5 = 0; VAR_5 < BANDS; VAR_5++) { chctx->flcoeffs6[VAR_5] = chctx->flcoeffs1[VAR_5]; if (chctx->bandFlagsBuf[VAR_5] && (band_tab[VAR_5 + 1] - band_tab[VAR_5]) != chctx->skipFlagCount[VAR_5]) { chctx->flcoeffs6[VAR_5] *= VAR_1->sqrt_tab[ band_tab[VAR_5 + 1] - band_tab[VAR_5]] /
VAR_1->sqrt_tab[(band_tab[VAR_5 + 1] - band_tab[VAR_5] - chctx->skipFlagCount[VAR_5])]; VAR_9 = VAR_10 = 0; for (VAR_5 = 0; VAR_5 < BANDS; VAR_5++) { if (chctx->bandFlagsBuf[VAR_5]) { for (VAR_6 = band_tab[VAR_5]; VAR_6 < band_tab[VAR_5 + 1]; VAR_6++) { if (chctx->skipFlags[VAR_6]) { VAR_10 += chctx->CWlengthT[VAR_6]; chctx->CWlengthT[VAR_6] = 0; VAR_9   += chctx->skipFlagBits[VAR_5]; VAR_10 -= chctx->skipFlagBits[VAR_5]; imc_adjust_bit_allocation(VAR_1, chctx, VAR_10); for (VAR_5 = 0; VAR_5 < BANDS; VAR_5++) { chctx->sumLenArr[VAR_5] = 0; for (VAR_6 = band_tab[VAR_5]; VAR_6 < band_tab[VAR_5 + 1]; VAR_6++) if (!chctx->skipFlags[VAR_6])
chctx->sumLenArr[VAR_5] += chctx->CWlengthT[VAR_6]; memset(chctx->codewords, 0, sizeof(chctx->codewords)); if (imc_get_coeffs(VAR_1, chctx) < 0) { av_log(VAR_0, AV_LOG_ERROR, "Read coefficients failed\n"); chctx->decoder_reset = 1; if (inverse_quant_coeff(VAR_1, chctx, VAR_3) < 0) { av_log(VAR_0, AV_LOG_ERROR, "Inverse quantization of coefficients failed\n"); chctx->decoder_reset = 1; memset(chctx->skipFlags, 0, sizeof(chctx->skipFlags)); imc_imdct256(VAR_1, chctx, VAR_0->channels); return 0;