Lynne: > @@ -165,7 +164,11 @@ typedef struct AC3EncodeContext { > AVCodecContext *avctx; ///< parent AVCodecContext > PutBitContext pb; ///< bitstream writer context > AudioDSPContext adsp; > +#if AC3ENC_FLOAT > AVFloatDSPContext *fdsp; > +#else > + AVFixedDSPContext *fdsp; > +#endif > MECmpContext mecc; > AC3DSPContext ac3dsp; ///< AC-3 optimized functions > FFTContext mdct; ///< FFT context for MDCT > calculation [...] > @@ -118,9 +89,10 @@ static CoefType calc_cpl_coord(CoefSumType energy_ch, > CoefSumType energy_cpl) > static av_cold void ac3_fixed_mdct_end(AC3EncodeContext *s) > { > ff_mdct_end(&s->mdct); > + av_freep(&s->fdsp); > + av_freep(&s->mdct_window); > }
ff_ac3_encode_close already unconditionally frees fdsp, so freeing it above is either unnecessary or ac3_float_mdct_end should also free its fdsp (and ff_ac3_encode_close shouldn't). Freeing mdct_window can also be moved to ff_ac3_encode_close (which already frees several buffers whose pointed-to-type depends upon the encoding mode). Notice that ac3enc.c uses the fixed-point mode, but the layout of AC3EncodeContext does not depend upon this (apart from pointed-to-types, of course). Actually, ff_mdct_end does the same for both fixed- and floating-point mode, so one could even incorporate ac3_fixed/float_mdct_end into ff_ac3_encode_close. - Andreas _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".