Revision e8d21fba

View differences:

libavcodec/ac3enc.c
120 120
    int mant1_cnt, mant2_cnt, mant4_cnt;    ///< mantissa counts for bap=1,2,4
121 121
    uint16_t *qmant1_ptr, *qmant2_ptr, *qmant4_ptr; ///< mantissa pointers for bap=1,2,4
122 122

  
123
    int16_t planar_samples[AC3_MAX_CHANNELS][AC3_BLOCK_SIZE+AC3_FRAME_SIZE];
123
    int16_t **planar_samples;
124 124
    int16_t windowed_samples[AC3_WINDOW_SIZE];
125 125
    uint8_t *bap_buffer;
126 126
    uint8_t *bap1_buffer;
......
1464 1464
 */
1465 1465
static av_cold int ac3_encode_close(AVCodecContext *avctx)
1466 1466
{
1467
    int blk;
1467
    int blk, ch;
1468 1468
    AC3EncodeContext *s = avctx->priv_data;
1469 1469

  
1470
    for (ch = 0; ch < s->channels; ch++)
1471
        av_freep(&s->planar_samples[ch]);
1472
    av_freep(&s->planar_samples);
1470 1473
    av_freep(&s->bap_buffer);
1471 1474
    av_freep(&s->bap1_buffer);
1472 1475
    for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) {
......
1606 1609

  
1607 1610
static av_cold int allocate_buffers(AVCodecContext *avctx)
1608 1611
{
1609
    int blk;
1612
    int blk, ch;
1610 1613
    AC3EncodeContext *s = avctx->priv_data;
1611 1614

  
1615
    FF_ALLOC_OR_GOTO(avctx, s->planar_samples, s->channels * sizeof(*s->planar_samples),
1616
                     alloc_fail);
1617
    for (ch = 0; ch < s->channels; ch++) {
1618
        FF_ALLOCZ_OR_GOTO(avctx, s->planar_samples[ch],
1619
                          (AC3_FRAME_SIZE+AC3_BLOCK_SIZE) * sizeof(**s->planar_samples),
1620
                          alloc_fail);
1621
    }
1612 1622
    FF_ALLOC_OR_GOTO(avctx, s->bap_buffer,  AC3_MAX_BLOCKS * s->channels *
1613 1623
                     AC3_MAX_COEFS * sizeof(*s->bap_buffer),  alloc_fail);
1614 1624
    FF_ALLOC_OR_GOTO(avctx, s->bap1_buffer, AC3_MAX_BLOCKS * s->channels *

Also available in: Unified diff