From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 00A2B47081 for ; Wed, 26 Jul 2023 07:29:24 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0B40368C919; Wed, 26 Jul 2023 10:29:23 +0300 (EEST) Received: from w4.tutanota.de (w4.tutanota.de [81.3.6.165]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 78DBD68C8B0 for ; Wed, 26 Jul 2023 10:29:16 +0300 (EEST) Received: from tutadb.w10.tutanota.de (unknown [192.168.1.10]) by w4.tutanota.de (Postfix) with ESMTP id B4C99106015C for ; Wed, 26 Jul 2023 07:29:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1690356556; s=s1; d=lynne.ee; h=From:From:To:To:Subject:Subject:Content-Description:Content-ID:Content-Type:Content-Type:Content-Transfer-Encoding:Cc:Date:Date:In-Reply-To:MIME-Version:MIME-Version:Message-ID:Message-ID:Reply-To:References:Sender; bh=8QOr/Hb60gi2ja7uBpPTY4WUkISYchwMpOi4wME/XkU=; b=HLRx5wgsC0EVfp5mY9gQcURw4xLmM+EmOYqwpTq26+aKlCAjObVHThpzvlcG+eqx JV8+QpgsTxQRNVbFKglAde9HoUFWKFBmhrVYynsU8XNxkj0u04PH7KERP2hPI/gBNvn xl0FfrBqWToBt3ilzpLrVb4l6FUM+yKdi0bGp1k3IBlFdqxyfd4gHFvHBRbj8hg9+QV XTa5k1uow2LX2dpxrodnCHdQMDYA48yR2jtNSv4GU4xP2Uv8GhUSzN3Eh7LWSUU/qYT qJR/i4wbgrTSdabCodJO2I74oc1aTUiFylot3lPO+wkEy7iRyBaIdOMJTwa8CiMluMI cGv8TXs9EA== Date: Wed, 26 Jul 2023 09:29:16 +0200 (CEST) From: Lynne To: Ffmpeg Devel Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_580644_966377190.1690356556198" Subject: [FFmpeg-devel] [PATCH 1/3] avfft: wrap lavu/tx instead of ff_fft X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: ------=_Part_580644_966377190.1690356556198 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Patch attached. ------=_Part_580644_966377190.1690356556198 Content-Type: text/x-diff; charset=us-ascii; name=0001-avfft-wrap-lavu-tx-instead-of-ff_fft.patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=0001-avfft-wrap-lavu-tx-instead-of-ff_fft.patch >From 3a595d6f177617ce89cc2709eca61b7cf486ce22 Mon Sep 17 00:00:00 2001 From: Lynne Date: Thu, 10 Nov 2022 11:23:38 +0100 Subject: [PATCH 1/3] avfft: wrap lavu/tx instead of ff_fft --- libavcodec/avfft.c | 40 +++++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/libavcodec/avfft.c b/libavcodec/avfft.c index 2200f37708..e4b19af272 100644 --- a/libavcodec/avfft.c +++ b/libavcodec/avfft.c @@ -18,38 +18,60 @@ #include "libavutil/attributes.h" #include "libavutil/mem.h" +#include "libavutil/tx.h" #include "avfft.h" #include "fft.h" #include "rdft.h" #include "dct.h" +typedef struct AVTXWrapper { + AVTXContext *ctx; + av_tx_fn fn; + + AVTXContext *ctx2; + av_tx_fn fn2; + + ptrdiff_t stride; +} AVTXWrapper; + /* FFT */ FFTContext *av_fft_init(int nbits, int inverse) { - FFTContext *s = av_mallocz(sizeof(*s)); - - if (s && ff_fft_init(s, nbits, inverse)) - av_freep(&s); + int ret; + float scale = 1.0f; + AVTXWrapper *s = av_malloc(sizeof(*s)); + if (!s) + return NULL; + + ret = av_tx_init(&s->ctx, &s->fn, AV_TX_FLOAT_FFT, inverse, 1 << nbits, + &scale, AV_TX_INPLACE); + if (ret < 0) { + av_free(s); + return NULL; + } - return s; + return (FFTContext *)s; } void av_fft_permute(FFTContext *s, FFTComplex *z) { - s->fft_permute(s, z); + /* Empty */ } void av_fft_calc(FFTContext *s, FFTComplex *z) { - s->fft_calc(s, z); + AVTXWrapper *w = (AVTXWrapper *)s; + w->fn(w->ctx, z, (void *)z, sizeof(AVComplexFloat)); } av_cold void av_fft_end(FFTContext *s) { if (s) { - ff_fft_end(s); - av_free(s); + AVTXWrapper *w = (AVTXWrapper *)s; + av_tx_uninit(&w->ctx); + av_tx_uninit(&w->ctx2); + av_free(w); } } -- 2.40.1 ------=_Part_580644_966377190.1690356556198 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ------=_Part_580644_966377190.1690356556198--