From patchwork Tue Sep 8 21:18:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 22197 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 6AF3944BE02 for ; Wed, 9 Sep 2020 00:20:46 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9DE4068B7CA; Wed, 9 Sep 2020 00:19:46 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2606768B77D for ; Wed, 9 Sep 2020 00:19:43 +0300 (EEST) Received: by mail-wr1-f65.google.com with SMTP id z4so695754wrr.4 for ; Tue, 08 Sep 2020 14:19:43 -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=PpsM4jelC2FxQJAFKqgwaOSVG0sbe6xjR3vICjIVIN4=; b=RBCJ5Vdo4CMeaZ63bfHRMaybt4OF7SpjmnxBk+qMczCZ7YswR72sIVm2YbjrnFb/Xo 6u+rgVzOOGZaamonsffE2E+1dohENqBQ06HIRFPPuLSWG9ewUitbheNVST8mF6MV23Ln qW5opQRPqF2UHkLVoqFNokucyNps6O7mBwxbAiGA8lFpjFO9IGEuyhvaBP6yGmS4TFXK zgwNciY5eYsgmGvNzDvADwtSbqMWw7pUdLlXpgUd0SkcAY5udXEizl0JQPB4dy4yF253 LdXpj0LEKXQGbGpzhG44xb6tflElzp+4CHAHvVIUnevpIig/MljdBY+8/Jdbb0Xm2N92 7VDA== 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=PpsM4jelC2FxQJAFKqgwaOSVG0sbe6xjR3vICjIVIN4=; b=ik6VC+fE8s1jhcwhEFV6sNCI1oJugkufutwK3OSTZJ3fXcBUNChpStkAJ3XkEwLKnI k3OZh3lEVGpLAwGyN8IBuqjymWJMV/DACXuIg8B19i93fOyWAU0CzxnH53M7UPbBMB19 o+3u4kRsbQkvDS3nnqfAvgmFKo6QPXzBZYiDg7I9tmHlLkUV1LBt+TgLiL1MVs5PLLTL KeHgZhaJLmjGeAp4w2Z1/CBd65Nqmlm0OLOOXMvE/a3EW4Tt5NfJswrOwVZUwt70fbEa Pqjt02ebLxUy20XLKBdIhkbbpBYr3JagS0yA3gorokTfnxRbnVyqhi4qIw3zxFNBFE8c G3GQ== X-Gm-Message-State: AOAM530j4KG6qv1fDDrxnsVZyB6+ARaCyRoAciO1zIiSgZOkQJtVpbsN gYykkGVKzyAkYRRaYW2gIIeKp9HDxGI= X-Google-Smtp-Source: ABdhPJy1ELk8EXxBG/GtORym0ZZ/E06RnjlEx5dbVgcc8uGqvAlduN9IdiaQ2p2ETRtBS0ppkxtdcg== X-Received: by 2002:adf:dccc:: with SMTP id x12mr409313wrm.241.1599599982390; Tue, 08 Sep 2020 14:19:42 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1fb0f.dynamic.kabel-deutschland.de. [188.193.251.15]) by smtp.gmail.com with ESMTPSA id a15sm1074304wrn.3.2020.09.08.14.19.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2020 14:19:41 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 8 Sep 2020 23:18:53 +0200 Message-Id: <20200908211856.16290-22-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200908211856.16290-1-andreas.rheinhardt@gmail.com> References: <20200908211856.16290-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 22/25] avfilter/af_headphone: Avoid indirection for function pointer 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" Signed-off-by: Andreas Rheinhardt --- libavfilter/af_headphone.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/libavfilter/af_headphone.c b/libavfilter/af_headphone.c index 2d2b57d819..8b0a431c45 100644 --- a/libavfilter/af_headphone.c +++ b/libavfilter/af_headphone.c @@ -75,7 +75,7 @@ typedef struct HeadphoneContext { FFTContext *fft[2], *ifft[2]; FFTComplex *data_hrtf[2]; - AVFloatDSPContext *fdsp; + float (*scalarproduct_float)(const float *v1, const float *v2, int len); struct hrir_inputs { int ir_len; int eof; @@ -190,7 +190,7 @@ static int headphone_convolute(AVFilterContext *ctx, void *arg, int jobnr, int n memcpy(temp_src + len, bptr, (air_len - len) * sizeof(*temp_src)); } - dst[0] += s->fdsp->scalarproduct_float(temp_ir, temp_src, FFALIGN(ir_len, 32)); + dst[0] += s->scalarproduct_float(temp_ir, temp_src, FFALIGN(ir_len, 32)); temp_ir += air_len; } @@ -668,9 +668,13 @@ static av_cold int init(AVFilterContext *ctx) } } - s->fdsp = avpriv_float_dsp_alloc(0); - if (!s->fdsp) - return AVERROR(ENOMEM); + if (s->type == TIME_DOMAIN) { + AVFloatDSPContext *fdsp = avpriv_float_dsp_alloc(0); + if (!fdsp) + return AVERROR(ENOMEM); + s->scalarproduct_float = fdsp->scalarproduct_float; + av_free(fdsp); + } return 0; } @@ -715,7 +719,6 @@ static av_cold void uninit(AVFilterContext *ctx) av_freep(&s->temp_afft[1]); av_freep(&s->data_hrtf[0]); av_freep(&s->data_hrtf[1]); - av_freep(&s->fdsp); for (unsigned i = 1; i < ctx->nb_inputs; i++) av_freep(&ctx->input_pads[i].name);