From patchwork Mon Sep 14 05:27:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 22365 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 5D332448249 for ; Mon, 14 Sep 2020 08:35:12 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4593B68BC31; Mon, 14 Sep 2020 08:35:12 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1CD6E68BC3A for ; Mon, 14 Sep 2020 08:35:10 +0300 (EEST) Received: by mail-wr1-f66.google.com with SMTP id s12so17180455wrw.11 for ; Sun, 13 Sep 2020 22:35:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UyNmZ4sX3qb4APnTgX9TkYV6m7mwNGZGI1D/CxlkluI=; b=u1yw1Yfhjl/fkKmWBd+IanWxBgd5YDfN7Q0tHfXP95iDSxY494R44ZMBYBEPHY8wE/ SY3XgD7G+WCmYklEl19Ak8ywHms6AJf1qThhNMxZJOE9xDSk208oKuYDkK7Py4JDS3Ct oZXoz4ZylNfX/9isaYtNou16ShvNWA6NUMfLSaghvY3KdsDY/PHMk1NTUMZRxiNGqVFX GhH94Xhqid5kWuNQVhbXoC7dHFN9accr8TSCzZlBtN8uHq8grwIZ0cw2Ph4t685bj8xQ q21s3+u4lu/kMA6ZHMKmSVhFpI1Fy3o+x2EL/LRjndb6QfWFr3aHjbcgmQgN6iyx2vNi URgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UyNmZ4sX3qb4APnTgX9TkYV6m7mwNGZGI1D/CxlkluI=; b=dquPH1rsqzSeazJhzY4o1jgqxeRWyVbXMUiU5EBzw3JngTI99vw0qld4PsnI9LLPzv P97MatJ82rniwXY4GbJwEaya6bRbKI8LCmKFSyb855ild8aruQIaVDtNKiAlTYq7sh40 H/XS0BcBvK/JQvBHEQ4ZC+bSabkp1PQVcfmthMNMNRMKDsFinLD8YYwG43LFMbU/T8Qm AHITz/pgx7s8Rc/djE3+8ow56nkKsAXxJGYjDNnqQG6SchSptx8IvHNx9wg5e3ieV87I p9VqTwTfAXlPQxUpMDhL/ut8bQTdeB5mOvoxehLZtXmec5GPzUSes8M/xLo1emjvYSCl W1bQ== X-Gm-Message-State: AOAM5315vaMo6xhU23MHJLYdxpdS3IJ3fMkNL5fRJfsmAmm510N7J332 KF6CItrcMXeBx4MpPefZ9YejzwL9eZc= X-Google-Smtp-Source: ABdhPJy05Ca5bTiuoGlMrBck59FzryFul7CbyoUTbsD62LjMVz3FLURUbE0RDlmhzFBUatVOvtVotw== X-Received: by 2002:a05:6402:12d1:: with SMTP id k17mr15083754edx.323.1600061301700; Sun, 13 Sep 2020 22:28:21 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1fb0f.dynamic.kabel-deutschland.de. [188.193.251.15]) by smtp.gmail.com with ESMTPSA id f4sm8251421edm.76.2020.09.13.22.28.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Sep 2020 22:28:21 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 14 Sep 2020 07:27:30 +0200 Message-Id: <20200914052747.124118-7-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200913025753.274772-1-andreas.rheinhardt@gmail.com> References: <20200913025753.274772-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 23/40] avcodec/atrac3: Avoid indirection when calling float dsp function X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Do this by only keeping the only function pointer from the AVFloatDSPContext that is needed lateron. Signed-off-by: Andreas Rheinhardt --- libavcodec/atrac3.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/libavcodec/atrac3.c b/libavcodec/atrac3.c index ef2f8428dc..dc68e507aa 100644 --- a/libavcodec/atrac3.c +++ b/libavcodec/atrac3.c @@ -111,7 +111,8 @@ typedef struct ATRAC3Context { AtracGCContext gainc_ctx; FFTContext mdct_ctx; - AVFloatDSPContext *fdsp; + void (*vector_fmul)(float *dst, const float *src0, const float *src1, + int len); } ATRAC3Context; static DECLARE_ALIGNED(32, float, mdct_window)[MDCT_SIZE]; @@ -144,7 +145,7 @@ static void imlt(ATRAC3Context *q, float *input, float *output, int odd_band) q->mdct_ctx.imdct_calc(&q->mdct_ctx, output, input); /* Perform windowing on the output. */ - q->fdsp->vector_fmul(output, output, mdct_window, MDCT_SIZE); + q->vector_fmul(output, output, mdct_window, MDCT_SIZE); } /* @@ -194,7 +195,6 @@ static av_cold int atrac3_decode_close(AVCodecContext *avctx) av_freep(&q->units); av_freep(&q->decoded_bytes_buffer); - av_freep(&q->fdsp); ff_mdct_end(&q->mdct_ctx); @@ -874,6 +874,7 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx) int version, delay, samples_per_frame, frame_factor; const uint8_t *edata_ptr = avctx->extradata; ATRAC3Context *q = avctx->priv_data; + AVFloatDSPContext *fdsp; if (avctx->channels < MIN_CHANNELS || avctx->channels > MAX_CHANNELS) { av_log(avctx, AV_LOG_ERROR, "Channel configuration error!\n"); @@ -997,12 +998,15 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx) } ff_atrac_init_gain_compensation(&q->gainc_ctx, 4, 3); - q->fdsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT); + fdsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT); + if (!fdsp) + return AVERROR(ENOMEM); + q->vector_fmul = fdsp->vector_fmul; + av_free(fdsp); q->units = av_mallocz_array(avctx->channels, sizeof(*q->units)); - if (!q->units || !q->fdsp) { + if (!q->units) return AVERROR(ENOMEM); - } return 0; }