X-Git-Url: https://git.piment-noir.org/?p=deb_ffmpeg.git;a=blobdiff_plain;f=ffmpeg%2Flibavcodec%2Fatrac3plusdec.c;h=78121e84673cebc6b373615cf4a45a7e828f8ea5;hp=3a6b3cfa2e9cdcc7b884729493b44e91b51478dc;hb=f6fa7814ccfe3e76514b36cf04f5cd3cb657c8cf;hpb=2ba45a602cbfa7b771effba9b11bb4245c21bc00 diff --git a/ffmpeg/libavcodec/atrac3plusdec.c b/ffmpeg/libavcodec/atrac3plusdec.c index 3a6b3cf..78121e8 100644 --- a/ffmpeg/libavcodec/atrac3plusdec.c +++ b/ffmpeg/libavcodec/atrac3plusdec.c @@ -47,7 +47,7 @@ typedef struct ATRAC3PContext { GetBitContext gb; - AVFloatDSPContext fdsp; + AVFloatDSPContext *fdsp; DECLARE_ALIGNED(32, float, samples)[2][ATRAC3P_FRAME_SAMPLES]; ///< quantized MDCT spectrum DECLARE_ALIGNED(32, float, mdct_buf)[2][ATRAC3P_FRAME_SAMPLES]; ///< output of the IMDCT @@ -67,7 +67,10 @@ typedef struct ATRAC3PContext { static av_cold int atrac3p_decode_close(AVCodecContext *avctx) { - av_free(((ATRAC3PContext *)(avctx->priv_data))->ch_units); + ATRAC3PContext *ctx = avctx->priv_data; + + av_freep(&ctx->ch_units); + av_freep(&ctx->fdsp); return 0; } @@ -150,8 +153,6 @@ static av_cold int atrac3p_decode_init(AVCodecContext *avctx) ff_atrac3p_init_vlcs(); - avpriv_float_dsp_init(&ctx->fdsp, avctx->flags & CODEC_FLAG_BITEXACT); - /* initialize IPQF */ ff_mdct_init(&ctx->ipqf_dct_ctx, 5, 1, 32.0 / 32768.0); @@ -167,8 +168,9 @@ static av_cold int atrac3p_decode_init(AVCodecContext *avctx) ctx->my_channel_layout = avctx->channel_layout; ctx->ch_units = av_mallocz_array(ctx->num_channel_blocks, sizeof(*ctx->ch_units)); + ctx->fdsp = avpriv_float_dsp_alloc(avctx->flags & CODEC_FLAG_BITEXACT); - if (!ctx->ch_units) { + if (!ctx->ch_units || !ctx->fdsp) { atrac3p_decode_close(avctx); return AVERROR(ENOMEM); } @@ -265,7 +267,7 @@ static void reconstruct_frame(ATRAC3PContext *ctx, Atrac3pChanUnitCtx *ch_unit, for (ch = 0; ch < num_channels; ch++) { for (sb = 0; sb < ch_unit->num_subbands; sb++) { /* inverse transform and windowing */ - ff_atrac3p_imdct(&ctx->fdsp, &ctx->mdct_ctx, + ff_atrac3p_imdct(ctx->fdsp, &ctx->mdct_ctx, &ctx->samples[ch][sb * ATRAC3P_SUBBAND_SAMPLES], &ctx->mdct_buf[ch][sb * ATRAC3P_SUBBAND_SAMPLES], (ch_unit->channels[ch].wnd_shape_prev[sb] << 1) + @@ -299,7 +301,7 @@ static void reconstruct_frame(ATRAC3PContext *ctx, Atrac3pChanUnitCtx *ch_unit, for (sb = 0; sb < ch_unit->num_subbands; sb++) if (ch_unit->channels[ch].tones_info[sb].num_wavs || ch_unit->channels[ch].tones_info_prev[sb].num_wavs) { - ff_atrac3p_generate_tones(ch_unit, &ctx->fdsp, ch, sb, + ff_atrac3p_generate_tones(ch_unit, ctx->fdsp, ch, sb, &ctx->time_buf[ch][sb * 128]); } }