static int encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
                        const AVFrame *frame, int *got_packet_ptr)
{
    DCAEncContext *c = avctx->priv_data;
    const int32_t *samples;
    int ret, i;
    if ((ret = ff_alloc_packet2(avctx, avpkt, c->frame_size , 0)) < 0)
        return ret;
    samples = (const int32_t *)frame->data[0];
    subband_transform(c, samples);
    if (c->lfe_channel)
        lfe_downsample(c, samples);
    calc_masking(c, samples);
    find_peaks(c);
    assign_bits(c);
    calc_scales(c);
    quantize_all(c);
    shift_history(c, samples);
    init_put_bits(&c->pb, avpkt->data, avpkt->size);
    put_frame_header(c);
    put_primary_audio_header(c);
    for (i = 0; i < SUBFRAMES; i++)
        put_subframe(c, i);
    flush_put_bits(&c->pb);
    avpkt->pts      = frame->pts;
    avpkt->duration = ff_samples_to_time_base(avctx, frame->nb_samples);
    avpkt->size     = c->frame_size + 1;
    *got_packet_ptr = 1;
    return 0;
}
static int encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
                        const AVFrame *frame, int *got_packet_ptr)
{
    DCAEncContext *c = avctx->priv_data;
    const int32_t *samples;
    int ret, i;
    if ((ret = ff_alloc_packet2(avctx, avpkt, c->frame_size , 0)) < 0)
        return ret;
    samples = (const int32_t *)frame->data[0];
    subband_transform(c, samples);
    if (c->lfe_channel)
        lfe_downsample(c, samples);
    calc_masking(c, samples);
    find_peaks(c);
    assign_bits(c);
    calc_scales(c);
    quantize_all(c);
    shift_history(c, samples);
    init_put_bits(&c->pb, avpkt->data, avpkt->size);
    put_frame_header(c);
    put_primary_audio_header(c);
    for (i = 0; i < SUBFRAMES; i++)
        put_subframe(c, i);
    flush_put_bits(&c->pb);
    avpkt->pts      = frame->pts;
    avpkt->duration = ff_samples_to_time_base(avctx, frame->nb_samples);
    avpkt->size     = c->frame_size + 1;
    *got_packet_ptr = 1;
    return 0;
}
static int FUNC_0(AVCodecContext *VAR_0, AVPacket *VAR_1,
                        const AVFrame *VAR_2, int *VAR_3)
{
    DCAEncContext *c = VAR_0->priv_data;
    const int32_t *VAR_4;
    int VAR_5, VAR_6;
    if ((VAR_5 = ff_alloc_packet2(VAR_0, VAR_1, c->frame_size , 0)) < 0)
        return VAR_5;
    VAR_4 = (const int32_t *)VAR_2->data[0];
    subband_transform(c, VAR_4);
    if (c->lfe_channel)
        lfe_downsample(c, VAR_4);
    calc_masking(c, VAR_4);
    find_peaks(c);
    assign_bits(c);
    calc_scales(c);
    quantize_all(c);
    shift_history(c, VAR_4);
    init_put_bits(&c->pb, VAR_1->data, VAR_1->size);
    put_frame_header(c);
    put_primary_audio_header(c);
    for (VAR_6 = 0; VAR_6 < SUBFRAMES; VAR_6++)
        put_subframe(c, VAR_6);
    flush_put_bits(&c->pb);
    VAR_1->pts      = VAR_2->pts;
    VAR_1->duration = ff_samples_to_time_base(VAR_0, VAR_2->nb_samples);
    VAR_1->size     = c->frame_size + 1;
    *VAR_3 = 1;
    return 0;
}
static int FUNC_0(AVCodecContext *VAR_0, AVPacket *VAR_1,
const AVFrame *VAR_2, int *VAR_3)
{ DCAEncContext *c = VAR_0->priv_data; const int32_t *VAR_4; int VAR_5, VAR_6; if ((VAR_5 = ff_alloc_packet2(VAR_0, VAR_1, c->frame_size , 0)) < 0)
return VAR_5; VAR_4 = (const int32_t *)VAR_2->data[0]; subband_transform(c, VAR_4); if (c->lfe_channel)
lfe_downsample(c, VAR_4); calc_masking(c, VAR_4); find_peaks(c); assign_bits(c); calc_scales(c); quantize_all(c); shift_history(c, VAR_4); init_put_bits(&c->pb, VAR_1->data, VAR_1->size); put_frame_header(c); put_primary_audio_header(c); for (VAR_6 = 0; VAR_6 < SUBFRAMES; VAR_6++) put_subframe(c, VAR_6); flush_put_bits(&c->pb); VAR_1->pts      = VAR_2->pts; VAR_1->duration = ff_samples_to_time_base(VAR_0, VAR_2->nb_samples); VAR_1->size     = c->frame_size + 1; *VAR_3 = 1; return 0; }