static void put_subframe(DCAEncContext *c, int subframe)

{

    int i, band, ss, ch;



    /* Subsubframes count */

    put_bits(&c->pb, 2, SUBSUBFRAMES -1);



    /* Partial subsubframe sample count: dummy */

    put_bits(&c->pb, 3, 0);



    /* Prediction mode: no ADPCM, in each channel and subband */

    for (ch = 0; ch < c->fullband_channels; ch++)

        for (band = 0; band < DCAENC_SUBBANDS; band++)

            put_bits(&c->pb, 1, 0);



    /* Prediction VQ address: not transmitted */

    /* Bit allocation index */

    for (ch = 0; ch < c->fullband_channels; ch++)

        for (band = 0; band < DCAENC_SUBBANDS; band++)

            put_bits(&c->pb, 5, c->abits[band][ch]);



    if (SUBSUBFRAMES > 1) {

        /* Transition mode: none for each channel and subband */

        for (ch = 0; ch < c->fullband_channels; ch++)

            for (band = 0; band < DCAENC_SUBBANDS; band++)

                put_bits(&c->pb, 1, 0); /* codebook A4 */

    }



    /* Scale factors */

    for (ch = 0; ch < c->fullband_channels; ch++)

        for (band = 0; band < DCAENC_SUBBANDS; band++)

            put_bits(&c->pb, 7, c->scale_factor[band][ch]);



    /* Joint subband scale factor codebook select: not transmitted */

    /* Scale factors for joint subband coding: not transmitted */

    /* Stereo down-mix coefficients: not transmitted */

    /* Dynamic range coefficient: not transmitted */

    /* Stde information CRC check word: not transmitted */

    /* VQ encoded high frequency subbands: not transmitted */



    /* LFE data: 8 samples and scalefactor */

    if (c->lfe_channel) {

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

            put_bits(&c->pb, 8, quantize_value(c->downsampled_lfe[i], c->lfe_quant) & 0xff);

        put_bits(&c->pb, 8, c->lfe_scale_factor);

    }



    /* Audio data (subsubframes) */

    for (ss = 0; ss < SUBSUBFRAMES ; ss++)

        for (ch = 0; ch < c->fullband_channels; ch++)

            for (band = 0; band < DCAENC_SUBBANDS; band++)

                    put_subframe_samples(c, ss, band, ch);



    /* DSYNC */

    put_bits(&c->pb, 16, 0xffff);

}

static void put_subframe(DCAEncContext *c, int subframe)

{

    int i, band, ss, ch;



    

    put_bits(&c->pb, 2, SUBSUBFRAMES -1);



    

    put_bits(&c->pb, 3, 0);



    

    for (ch = 0; ch < c->fullband_channels; ch++)

        for (band = 0; band < DCAENC_SUBBANDS; band++)

            put_bits(&c->pb, 1, 0);



    

    

    for (ch = 0; ch < c->fullband_channels; ch++)

        for (band = 0; band < DCAENC_SUBBANDS; band++)

            put_bits(&c->pb, 5, c->abits[band][ch]);



    if (SUBSUBFRAMES > 1) {

        

        for (ch = 0; ch < c->fullband_channels; ch++)

            for (band = 0; band < DCAENC_SUBBANDS; band++)

                put_bits(&c->pb, 1, 0); 

    }



    

    for (ch = 0; ch < c->fullband_channels; ch++)

        for (band = 0; band < DCAENC_SUBBANDS; band++)

            put_bits(&c->pb, 7, c->scale_factor[band][ch]);



    

    

    

    

    

    



    

    if (c->lfe_channel) {

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

            put_bits(&c->pb, 8, quantize_value(c->downsampled_lfe[i], c->lfe_quant) & 0xff);

        put_bits(&c->pb, 8, c->lfe_scale_factor);

    }



    

    for (ss = 0; ss < SUBSUBFRAMES ; ss++)

        for (ch = 0; ch < c->fullband_channels; ch++)

            for (band = 0; band < DCAENC_SUBBANDS; band++)

                    put_subframe_samples(c, ss, band, ch);



    

    put_bits(&c->pb, 16, 0xffff);

}

static void FUNC_0(DCAEncContext *VAR_0, int VAR_1)

{

    int VAR_2, VAR_3, VAR_4, VAR_5;



    

    put_bits(&VAR_0->pb, 2, SUBSUBFRAMES -1);



    

    put_bits(&VAR_0->pb, 3, 0);



    

    for (VAR_5 = 0; VAR_5 < VAR_0->fullband_channels; VAR_5++)

        for (VAR_3 = 0; VAR_3 < DCAENC_SUBBANDS; VAR_3++)

            put_bits(&VAR_0->pb, 1, 0);



    

    

    for (VAR_5 = 0; VAR_5 < VAR_0->fullband_channels; VAR_5++)

        for (VAR_3 = 0; VAR_3 < DCAENC_SUBBANDS; VAR_3++)

            put_bits(&VAR_0->pb, 5, VAR_0->abits[VAR_3][VAR_5]);



    if (SUBSUBFRAMES > 1) {

        

        for (VAR_5 = 0; VAR_5 < VAR_0->fullband_channels; VAR_5++)

            for (VAR_3 = 0; VAR_3 < DCAENC_SUBBANDS; VAR_3++)

                put_bits(&VAR_0->pb, 1, 0); 

    }



    

    for (VAR_5 = 0; VAR_5 < VAR_0->fullband_channels; VAR_5++)

        for (VAR_3 = 0; VAR_3 < DCAENC_SUBBANDS; VAR_3++)

            put_bits(&VAR_0->pb, 7, VAR_0->scale_factor[VAR_3][VAR_5]);



    

    

    

    

    

    



    

    if (VAR_0->lfe_channel) {

        for (VAR_2 = 0; VAR_2 < DCA_LFE_SAMPLES; VAR_2++)

            put_bits(&VAR_0->pb, 8, quantize_value(VAR_0->downsampled_lfe[VAR_2], VAR_0->lfe_quant) & 0xff);

        put_bits(&VAR_0->pb, 8, VAR_0->lfe_scale_factor);

    }



    

    for (VAR_4 = 0; VAR_4 < SUBSUBFRAMES ; VAR_4++)

        for (VAR_5 = 0; VAR_5 < VAR_0->fullband_channels; VAR_5++)

            for (VAR_3 = 0; VAR_3 < DCAENC_SUBBANDS; VAR_3++)

                    put_subframe_samples(VAR_0, VAR_4, VAR_3, VAR_5);



    

    put_bits(&VAR_0->pb, 16, 0xffff);

}

static void FUNC_0(DCAEncContext *VAR_0, int VAR_1)
{ int VAR_2, VAR_3, VAR_4, VAR_5; put_bits(&VAR_0->pb, 2, SUBSUBFRAMES -1); put_bits(&VAR_0->pb, 3, 0); for (VAR_5 = 0; VAR_5 < VAR_0->fullband_channels; VAR_5++) for (VAR_3 = 0; VAR_3 < DCAENC_SUBBANDS; VAR_3++) put_bits(&VAR_0->pb, 1, 0); for (VAR_5 = 0; VAR_5 < VAR_0->fullband_channels; VAR_5++) for (VAR_3 = 0; VAR_3 < DCAENC_SUBBANDS; VAR_3++) put_bits(&VAR_0->pb, 5, VAR_0->abits[VAR_3][VAR_5]); if (SUBSUBFRAMES > 1) { for (VAR_5 = 0; VAR_5 < VAR_0->fullband_channels; VAR_5++) for (VAR_3 = 0; VAR_3 < DCAENC_SUBBANDS; VAR_3++) put_bits(&VAR_0->pb, 1, 0); } for (VAR_5 = 0; VAR_5 < VAR_0->fullband_channels; VAR_5++) for (VAR_3 = 0; VAR_3 < DCAENC_SUBBANDS; VAR_3++) put_bits(&VAR_0->pb, 7, VAR_0->scale_factor[VAR_3][VAR_5]); if (VAR_0->lfe_channel) { for (VAR_2 = 0; VAR_2 < DCA_LFE_SAMPLES; VAR_2++) put_bits(&VAR_0->pb, 8, quantize_value(VAR_0->downsampled_lfe[VAR_2], VAR_0->lfe_quant) & 0xff); put_bits(&VAR_0->pb, 8, VAR_0->lfe_scale_factor); } for (VAR_4 = 0; VAR_4 < SUBSUBFRAMES ; VAR_4++) for (VAR_5 = 0; VAR_5 < VAR_0->fullband_channels; VAR_5++) for (VAR_3 = 0; VAR_3 < DCAENC_SUBBANDS; VAR_3++) put_subframe_samples(VAR_0, VAR_4, VAR_3, VAR_5); put_bits(&VAR_0->pb, 16, 0xffff); }