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 BB202447A0 for ; Fri, 23 Sep 2022 23:16:07 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8E2D468BB86; Sat, 24 Sep 2022 02:16:05 +0300 (EEST) Received: from w4.tutanota.de (w4.tutanota.de [81.3.6.165]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D8D4D68BB5C for ; Sat, 24 Sep 2022 02:15:58 +0300 (EEST) Received: from w3.tutanota.de (unknown [192.168.1.164]) by w4.tutanota.de (Postfix) with ESMTP id 91443106016E for ; Fri, 23 Sep 2022 23:15:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1663974958; 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:In-Reply-To:MIME-Version:MIME-Version:Message-ID:Message-ID:Reply-To:References:References:Sender; bh=Hw8jz/Iw2RL6HshncpZWHa/tWbt4zYVIgiarIKImuSM=; b=CX4mhC0E6zYweQ6FQOvUHGyBc2vz8XkzSDD2CVuiPs0GNewakggAj2qBPPdKuydh 9RR7X3IYgjwiL4pn7qK96a+WOed9LwIDzm7C9LFAMsZxaFvUNfKUTrXQyCjpy6j0Pkh rZLJemGO6vUjEeoDlxAuhPcQwVaLjBx/ZJk/AZ9XpEjI/TXcidiZxh/NIYsa24XnQw0 p+SlHPrx0WGxiFApnvNvEH/oywDrY8hpUx/cjD91O7NKpL72+bUKsSu2994fK04kCwA TTYJGKsC4WWhnX2/pwNcp5iiKikmC4KDuxn+nnjYHy64WWdjpwy+LLV8b66Ljxl9zZp 1p0AXEEe4Q== Date: Sat, 24 Sep 2022 01:15:58 +0200 (CEST) From: Lynne To: FFmpeg development discussions and patches Message-ID: In-Reply-To: References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_47877_961561663.1663974958585" Subject: [FFmpeg-devel] [PATCH 2/6] atrac9dec: switch to lavu/tx 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_47877_961561663.1663974958585 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Patch attached. ------=_Part_47877_961561663.1663974958585 Content-Type: text/x-diff; charset=us-ascii; name=0002-atrac9dec-switch-to-lavu-tx.patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=0002-atrac9dec-switch-to-lavu-tx.patch >From 5a310246569e19efd50b37016a80fe6171df0329 Mon Sep 17 00:00:00 2001 From: Lynne Date: Sat, 24 Sep 2022 00:51:18 +0200 Subject: [PATCH 2/6] atrac9dec: switch to lavu/tx --- libavcodec/atrac9dec.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/libavcodec/atrac9dec.c b/libavcodec/atrac9dec.c index d3a5d05799..60962b1676 100644 --- a/libavcodec/atrac9dec.c +++ b/libavcodec/atrac9dec.c @@ -25,8 +25,8 @@ #include "codec_internal.h" #include "decode.h" #include "get_bits.h" -#include "fft.h" #include "atrac9tab.h" +#include "libavutil/tx.h" #include "libavutil/lfg.h" #include "libavutil/float_dsp.h" #include "libavutil/mem_internal.h" @@ -86,7 +86,8 @@ typedef struct ATRAC9BlockData { typedef struct ATRAC9Context { AVCodecContext *avctx; AVFloatDSPContext *fdsp; - FFTContext imdct; + AVTXContext *tx; + av_tx_fn tx_fn; ATRAC9BlockData block[5]; AVLFG lfg; @@ -101,7 +102,7 @@ typedef struct ATRAC9Context { uint8_t alloc_curve[48][48]; DECLARE_ALIGNED(32, float, imdct_win)[256]; - DECLARE_ALIGNED(32, float, temp)[256]; + DECLARE_ALIGNED(32, float, temp)[2048]; } ATRAC9Context; static VLC sf_vlc[2][8]; /* Signed/unsigned, length */ @@ -778,7 +779,7 @@ imdct: const ptrdiff_t offset = wsize*frame_idx*sizeof(float); float *dst = (float *)(frame->extended_data[dst_idx] + offset); - s->imdct.imdct_half(&s->imdct, s->temp, c->coeffs); + s->tx_fn(s->tx, s->temp, c->coeffs, sizeof(float)); s->fdsp->vector_fmul_window(dst, c->prev_win, s->temp, s->imdct_win, wsize >> 1); memcpy(c->prev_win, s->temp + (wsize >> 1), sizeof(float)*wsize >> 1); @@ -834,7 +835,7 @@ static av_cold int atrac9_decode_close(AVCodecContext *avctx) { ATRAC9Context *s = avctx->priv_data; - ff_mdct_end(&s->imdct); + av_tx_uninit(&s->tx); av_freep(&s->fdsp); return 0; @@ -896,10 +897,11 @@ static av_cold void atrac9_init_static(void) static av_cold int atrac9_decode_init(AVCodecContext *avctx) { + float scale; static AVOnce static_table_init = AV_ONCE_INIT; GetBitContext gb; ATRAC9Context *s = avctx->priv_data; - int version, block_config_idx, superframe_idx, alloc_c_len; + int err, version, block_config_idx, superframe_idx, alloc_c_len; s->avctx = avctx; @@ -959,8 +961,11 @@ static av_cold int atrac9_decode_init(AVCodecContext *avctx) s->frame_count = 1 << superframe_idx; s->frame_log2 = at9_tab_sri_frame_log2[s->samplerate_idx]; - if (ff_mdct_init(&s->imdct, s->frame_log2 + 1, 1, 1.0f / 32768.0f)) - return AVERROR(ENOMEM); + scale = 1.0f / 32768.0; + err = av_tx_init(&s->tx, &s->tx_fn, AV_TX_FLOAT_MDCT, 1, + 1 << s->frame_log2, &scale, 0); + if (err < 0) + return err; s->fdsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT); if (!s->fdsp) -- 2.37.2.609.g9ff673ca1a ------=_Part_47877_961561663.1663974958585 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_47877_961561663.1663974958585--