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 C236D47B1B for ; Fri, 1 Mar 2024 11:33:19 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2269D68D22D; Fri, 1 Mar 2024 13:33:16 +0200 (EET) Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02olkn2086.outbound.protection.outlook.com [40.92.49.86]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0DB0268D207 for ; Fri, 1 Mar 2024 13:33:10 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oPglUeowqTath+yX2v2oL+iWFoFP+ell/lT+D8C7+JYHcF/3/r0h2vDjAiTK3RuZXEihSxDdvRXr3datCWmMygotk20gmdhoZ6dwW4sd2O8b9GLMkEGrY9v4tyzhKdJN6aNeWCeB2McR9VMLpk/xY/bKrX8jMqlrrKCuo+3ixikjE5zgoB36c6IyFEhrFSgUtbEz/2d6E42Le7x3e7r8dwMZLsMEwfmC8kIAqN5eiUs6NjmRgbdZvOu36TOdPlDrWZZUGiD6q4rbcl/YPOtf+O94zE3Q1w7T+nnTvCyyhSgors/OXSjBvgHueKlR36kgY1CSamqvpm7i4pQxNAApaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=RylquqYx9UUjshxRgQXAdNIb/IlExAmGuwMUrFnmr7E=; b=YN6ZLPI20q9LtxBvaEyIkeoxLYOm0WYwIZVy1PPNTl5ixH7priAQgRSvwUBeIIPX+RQb/fEfX0xju8uDQxB02MEBH5mmGf/kaAbQbetHnicIAoVVe5CUyz7iN2sJM9e3gZUCOxTLBLCzjuFVhguE0UZXDX8J5xpcx7mBnUxkGp4iPbNqAUEibmo2hC2st4AI8Buw4XSVz/xVwBdrRZDeDXaqxhYt5P5+J2MbjKYOTfCc/Sel0Qg8H9QQKahrFUYPt0HpnheA3DV4tkmuousuvHt5s1UOSGi3FS7Bq2coET/2bZixltckbReZQmtsaiyw+nGHJoHMtnPFxVxrShtZog== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RylquqYx9UUjshxRgQXAdNIb/IlExAmGuwMUrFnmr7E=; b=SK+VvByHIGyR/E/uXn2MGkz0EUSUlkeP5OgdElcIqC8k8mMZMVLDQgleolHmBHKaZaA6O1Kre2VLM5IcpuUPSFlEyKWmnFOxc+ekTABWMonSzuMhucgXQFD0W2bVWhtNpb9mx6OU13BNuZFQN9wqt6dsS5SzvjzzzOCKclRQ7CH3ENopxLj6aDC0r5x4sk2Vk7pSiR+upGvjtpfOtUtHfqO8MS9Ah2PpPIf5T4lCPRS8YqFFPadV87NrShSV3sjD/Y4cZiq9wUrXOAba6OAWMGC4eMvqbmDdhcbJEPAF8wv3ioC8VfdNPCiO5+UrZ9ajGysnIfyAEJQlBPFLFdlWdg== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by AM8P250MB0137.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:320::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.41; Fri, 1 Mar 2024 11:33:08 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::65aa:deb0:a18e:d48d]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::65aa:deb0:a18e:d48d%5]) with mapi id 15.20.7316.023; Fri, 1 Mar 2024 11:33:08 +0000 Message-ID: Date: Fri, 1 Mar 2024 12:35:07 +0100 User-Agent: Mozilla Thunderbird Content-Language: en-US To: ffmpeg-devel@ffmpeg.org References: From: Andreas Rheinhardt In-Reply-To: X-TMN: [O7iywa0jtHKDupTxNCv9dyF/EdW9GEz79a53ya6TcR4=] X-ClientProxiedBy: ZR0P278CA0088.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:22::21) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|AM8P250MB0137:EE_ X-MS-Office365-Filtering-Correlation-Id: 1059a243-ba42-4b7d-8910-08dc39e35e44 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Hl+6vmcKl6NPrsMQTnKXmapyvlHAw/0f73OHKNxGtnA2B8BFM2Gti0EYj1bSUXkZjAVon2QKC4N7JQ6r4QElhuED0/lEqZAsRQCpyf4B282AF6gZXdgxFpTUBcFktnUT9+OA5Gp2c6MNy6+wBt9w9+ilO5qEoNQbmOrM3OyYBgA/xsqjuCc9HhEgPm6e32sMfkWgtFl/LlYUxpK6YzqzGTMv/Mb9/rXajVLyAEkDqbdp6i3XJ3Q8j6YAFhfoBRWMznMM9cX0xnT2CJvhunWTPB725QwuNe9TZifcmZ0Qsj9tYC9PXw76kNd9ntcCoCjGcResli/fGGDDRvDG7X7AsIy+DTULDEGED0Qf4wwwq6dPlYxp9hQQB/ta3fNe6yVQkaHNmiaZRWjhmGYS6MQkjL2ewhhdWWA5Vel7WIdGloR+sumCcCDOgEQvw7TRVe4PdJPkYKDZ9c3/0/y5vzJZfl+PS3fK7qn4OhM6Mz0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YWloU2hsUVdCbGNSbmdISmNUclZIamVC?= =?utf-8?B?RFNmbll4QTFiTjFXcWVnaUdBdE9qZlEyYnJhK2tpYmVkUkRXZnRidVhBPT0=?= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1059a243-ba42-4b7d-8910-08dc39e35e44 X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Mar 2024 11:33:08.3103 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8P250MB0137 Subject: Re: [FFmpeg-devel] [PATCH 1/6] avcodec/aacenc: Move initializing DSP out of aacenc.c 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Andreas Rheinhardt: > Otherwise aacenc.o gets pulled in by the aacencdsp checkasm > test and it in turn pulls the rest of lavc in. > Besides being bad size-wise this also has the downside that > it pulls in avpriv_(cga|vga16)_font from libavutil which are > marked as being imported from another library when building > libavcodec as a DLL and this breaks checkasm because it links > both lavc and lavu statically. > > Signed-off-by: Andreas Rheinhardt > --- > libavcodec/aaccoder.c | 26 +++++------ > libavcodec/aaccoder_trellis.h | 2 +- > libavcodec/aaccoder_twoloop.h | 2 +- > libavcodec/aacenc.c | 21 +++------ > libavcodec/aacenc.h | 9 +--- > libavcodec/aacenc_is.c | 6 +-- > libavcodec/aacenc_ltp.c | 4 +- > libavcodec/aacenc_pred.c | 6 +-- > libavcodec/aacenc_utils.h | 24 ----------- > libavcodec/aacencdsp.h | 72 +++++++++++++++++++++++++++++++ > libavcodec/mips/aaccoder_mips.c | 1 + > libavcodec/riscv/aacencdsp_init.c | 5 +-- > libavcodec/x86/aacencdsp_init.c | 5 +-- > tests/checkasm/aacencdsp.c | 10 ++--- > 14 files changed, 112 insertions(+), 81 deletions(-) > create mode 100644 libavcodec/aacencdsp.h > > diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c > index 6291c16123..4ce54ca886 100644 > --- a/libavcodec/aaccoder.c > +++ b/libavcodec/aaccoder.c > @@ -108,10 +108,10 @@ static av_always_inline float quantize_and_encode_band_cost_template( > return cost * lambda; > } > if (!scaled) { > - s->abs_pow34(s->scoefs, in, size); > + s->aacdsp.abs_pow34(s->scoefs, in, size); > scaled = s->scoefs; > } > - s->quant_bands(s->qcoefs, in, scaled, size, !BT_UNSIGNED, aac_cb_maxval[cb], Q34, ROUNDING); > + s->aacdsp.quant_bands(s->qcoefs, in, scaled, size, !BT_UNSIGNED, aac_cb_maxval[cb], Q34, ROUNDING); > if (BT_UNSIGNED) { > off = 0; > } else { > @@ -311,7 +311,7 @@ static void encode_window_bands_info(AACEncContext *s, SingleChannelElement *sce > float next_minrd = INFINITY; > int next_mincb = 0; > > - s->abs_pow34(s->scoefs, sce->coeffs, 1024); > + s->aacdsp.abs_pow34(s->scoefs, sce->coeffs, 1024); > start = win*128; > for (cb = 0; cb < CB_TOT_ALL; cb++) { > path[0][cb].cost = 0.0f; > @@ -522,7 +522,7 @@ static void search_for_quantizers_anmr(AVCodecContext *avctx, AACEncContext *s, > } > } > idx = 1; > - s->abs_pow34(s->scoefs, sce->coeffs, 1024); > + s->aacdsp.abs_pow34(s->scoefs, sce->coeffs, 1024); > for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) { > start = w*128; > for (g = 0; g < sce->ics.num_swb; g++) { > @@ -668,7 +668,7 @@ static void search_for_quantizers_fast(AVCodecContext *avctx, AACEncContext *s, > > if (!allz) > return; > - s->abs_pow34(s->scoefs, sce->coeffs, 1024); > + s->aacdsp.abs_pow34(s->scoefs, sce->coeffs, 1024); > ff_quantize_band_cost_cache_init(s); > > for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) { > @@ -874,8 +874,8 @@ static void search_for_pns(AACEncContext *s, AVCodecContext *avctx, SingleChanne > s->fdsp->vector_fmul_scalar(PNS, PNS, scale, sce->ics.swb_sizes[g]); > pns_senergy = s->fdsp->scalarproduct_float(PNS, PNS, sce->ics.swb_sizes[g]); > pns_energy += pns_senergy; > - s->abs_pow34(NOR34, &sce->coeffs[start_c], sce->ics.swb_sizes[g]); > - s->abs_pow34(PNS34, PNS, sce->ics.swb_sizes[g]); > + s->aacdsp.abs_pow34(NOR34, &sce->coeffs[start_c], sce->ics.swb_sizes[g]); > + s->aacdsp.abs_pow34(PNS34, PNS, sce->ics.swb_sizes[g]); > dist1 += quantize_band_cost(s, &sce->coeffs[start_c], > NOR34, > sce->ics.swb_sizes[g], > @@ -1012,8 +1012,8 @@ static void search_for_ms(AACEncContext *s, ChannelElement *cpe) > S[i] = M[i] > - sce1->coeffs[start+(w+w2)*128+i]; > } > - s->abs_pow34(M34, M, sce0->ics.swb_sizes[g]); > - s->abs_pow34(S34, S, sce0->ics.swb_sizes[g]); > + s->aacdsp.abs_pow34(M34, M, sce0->ics.swb_sizes[g]); > + s->aacdsp.abs_pow34(S34, S, sce0->ics.swb_sizes[g]); > for (i = 0; i < sce0->ics.swb_sizes[g]; i++ ) { > Mmax = FFMAX(Mmax, M34[i]); > Smax = FFMAX(Smax, S34[i]); > @@ -1056,10 +1056,10 @@ static void search_for_ms(AACEncContext *s, ChannelElement *cpe) > - sce1->coeffs[start+(w+w2)*128+i]; > } > > - s->abs_pow34(L34, sce0->coeffs+start+(w+w2)*128, sce0->ics.swb_sizes[g]); > - s->abs_pow34(R34, sce1->coeffs+start+(w+w2)*128, sce0->ics.swb_sizes[g]); > - s->abs_pow34(M34, M, sce0->ics.swb_sizes[g]); > - s->abs_pow34(S34, S, sce0->ics.swb_sizes[g]); > + s->aacdsp.abs_pow34(L34, sce0->coeffs+start+(w+w2)*128, sce0->ics.swb_sizes[g]); > + s->aacdsp.abs_pow34(R34, sce1->coeffs+start+(w+w2)*128, sce0->ics.swb_sizes[g]); > + s->aacdsp.abs_pow34(M34, M, sce0->ics.swb_sizes[g]); > + s->aacdsp.abs_pow34(S34, S, sce0->ics.swb_sizes[g]); > dist1 += quantize_band_cost(s, &sce0->coeffs[start + (w+w2)*128], > L34, > sce0->ics.swb_sizes[g], > diff --git a/libavcodec/aaccoder_trellis.h b/libavcodec/aaccoder_trellis.h > index 4810ff3208..245aa1c11b 100644 > --- a/libavcodec/aaccoder_trellis.h > +++ b/libavcodec/aaccoder_trellis.h > @@ -70,7 +70,7 @@ static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce, > float next_minbits = INFINITY; > int next_mincb = 0; > > - s->abs_pow34(s->scoefs, sce->coeffs, 1024); > + s->aacdsp.abs_pow34(s->scoefs, sce->coeffs, 1024); > start = win*128; > for (cb = 0; cb < CB_TOT_ALL; cb++) { > path[0][cb].cost = run_bits+4; > diff --git a/libavcodec/aaccoder_twoloop.h b/libavcodec/aaccoder_twoloop.h > index 0504a916ad..92dc2911a3 100644 > --- a/libavcodec/aaccoder_twoloop.h > +++ b/libavcodec/aaccoder_twoloop.h > @@ -291,7 +291,7 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx, > > if (!allz) > return; > - s->abs_pow34(s->scoefs, sce->coeffs, 1024); > + s->aacdsp.abs_pow34(s->scoefs, sce->coeffs, 1024); > ff_quantize_band_cost_cache_init(s); > > for (i = 0; i < sizeof(minsf) / sizeof(minsf[0]); ++i) > diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c > index bce4e039dc..3f99188be4 100644 > --- a/libavcodec/aacenc.c > +++ b/libavcodec/aacenc.c > @@ -1381,7 +1381,11 @@ static av_cold int aac_encode_init(AVCodecContext *avctx) > ff_lpc_init(&s->lpc, 2*avctx->frame_size, TNS_MAX_ORDER, FF_LPC_TYPE_LEVINSON); > s->random_state = 0x1f2e3d4c; > > - ff_aac_dsp_init(s); > + ff_aacenc_dsp_init(&s->aacdsp); > + > +#if HAVE_MIPSDSP > + ff_aac_coder_init_mips(s); > +#endif > > ff_af_queue_init(avctx, &s->afq); > > @@ -1435,18 +1439,3 @@ const FFCodec ff_aac_encoder = { > AV_SAMPLE_FMT_NONE }, > .p.priv_class = &aacenc_class, > }; > - > -void ff_aac_dsp_init(AACEncContext *s){ > - s->abs_pow34 = abs_pow34_v; > - s->quant_bands = quantize_bands; > - > -#if ARCH_RISCV > - ff_aac_dsp_init_riscv(s); > -#elif ARCH_X86 > - ff_aac_dsp_init_x86(s); > -#endif > - > -#if HAVE_MIPSDSP > - ff_aac_coder_init_mips(s); > -#endif > -} > diff --git a/libavcodec/aacenc.h b/libavcodec/aacenc.h > index 752f1c26b2..c18e828905 100644 > --- a/libavcodec/aacenc.h > +++ b/libavcodec/aacenc.h > @@ -33,6 +33,7 @@ > #include "put_bits.h" > > #include "aac.h" > +#include "aacencdsp.h" > #include "audio_frame_queue.h" > #include "psymodel.h" > > @@ -233,19 +234,13 @@ typedef struct AACEncContext { > uint16_t quantize_band_cost_cache_generation; > AACQuantizeBandCostCacheEntry quantize_band_cost_cache[256][128]; ///< memoization area for quantize_band_cost > > - void (*abs_pow34)(float *out, const float *in, const int size); > - void (*quant_bands)(int *out, const float *in, const float *scaled, > - int size, int is_signed, int maxval, const float Q34, > - const float rounding); > + AACEncDSPContext aacdsp; > > struct { > float *samples; > } buffer; > } AACEncContext; > > -void ff_aac_dsp_init(AACEncContext *s); > -void ff_aac_dsp_init_riscv(AACEncContext *s); > -void ff_aac_dsp_init_x86(AACEncContext *s); > void ff_aac_coder_init_mips(AACEncContext *c); > void ff_quantize_band_cost_cache_init(struct AACEncContext *s); > > diff --git a/libavcodec/aacenc_is.c b/libavcodec/aacenc_is.c > index 1810790d88..4943b6450c 100644 > --- a/libavcodec/aacenc_is.c > +++ b/libavcodec/aacenc_is.c > @@ -59,9 +59,9 @@ struct AACISError ff_aac_is_encoding_err(AACEncContext *s, ChannelElement *cpe, > float minthr = FFMIN(band0->threshold, band1->threshold); > for (i = 0; i < sce0->ics.swb_sizes[g]; i++) > IS[i] = (L[start+(w+w2)*128+i] + phase*R[start+(w+w2)*128+i])*sqrt(ener0/ener01); > - s->abs_pow34(L34, &L[start+(w+w2)*128], sce0->ics.swb_sizes[g]); > - s->abs_pow34(R34, &R[start+(w+w2)*128], sce0->ics.swb_sizes[g]); > - s->abs_pow34(I34, IS, sce0->ics.swb_sizes[g]); > + s->aacdsp.abs_pow34(L34, &L[start+(w+w2)*128], sce0->ics.swb_sizes[g]); > + s->aacdsp.abs_pow34(R34, &R[start+(w+w2)*128], sce0->ics.swb_sizes[g]); > + s->aacdsp.abs_pow34(I34, IS, sce0->ics.swb_sizes[g]); > maxval = find_max_val(1, sce0->ics.swb_sizes[g], I34); > is_band_type = find_min_book(maxval, is_sf_idx); > dist1 += quantize_band_cost(s, &L[start + (w+w2)*128], L34, > diff --git a/libavcodec/aacenc_ltp.c b/libavcodec/aacenc_ltp.c > index f3075f0e71..591ff6aedf 100644 > --- a/libavcodec/aacenc_ltp.c > +++ b/libavcodec/aacenc_ltp.c > @@ -190,8 +190,8 @@ void ff_aac_search_for_ltp(AACEncContext *s, SingleChannelElement *sce, > FFPsyBand *band = &s->psy.ch[s->cur_channel].psy_bands[(w+w2)*16+g]; > for (i = 0; i < sce->ics.swb_sizes[g]; i++) > PCD[i] = sce->coeffs[start+(w+w2)*128+i] - sce->lcoeffs[start+(w+w2)*128+i]; > - s->abs_pow34(C34, &sce->coeffs[start+(w+w2)*128], sce->ics.swb_sizes[g]); > - s->abs_pow34(PCD34, PCD, sce->ics.swb_sizes[g]); > + s->aacdsp.abs_pow34(C34, &sce->coeffs[start+(w+w2)*128], sce->ics.swb_sizes[g]); > + s->aacdsp.abs_pow34(PCD34, PCD, sce->ics.swb_sizes[g]); > dist1 += quantize_band_cost(s, &sce->coeffs[start+(w+w2)*128], C34, sce->ics.swb_sizes[g], > sce->sf_idx[(w+w2)*16+g], sce->band_type[(w+w2)*16+g], > s->lambda/band->threshold, INFINITY, &bits_tmp1, NULL); > diff --git a/libavcodec/aacenc_pred.c b/libavcodec/aacenc_pred.c > index f87fcd5a00..a486c44d42 100644 > --- a/libavcodec/aacenc_pred.c > +++ b/libavcodec/aacenc_pred.c > @@ -270,7 +270,7 @@ void ff_aac_search_for_pred(AACEncContext *s, SingleChannelElement *sce) > continue; > > /* Normal coefficients */ > - s->abs_pow34(O34, &sce->coeffs[start_coef], num_coeffs); > + s->aacdsp.abs_pow34(O34, &sce->coeffs[start_coef], num_coeffs); > dist1 = ff_quantize_and_encode_band_cost(s, NULL, &sce->coeffs[start_coef], NULL, > O34, num_coeffs, sce->sf_idx[sfb], > cb_n, s->lambda / band->threshold, INFINITY, &cost1, NULL); > @@ -279,7 +279,7 @@ void ff_aac_search_for_pred(AACEncContext *s, SingleChannelElement *sce) > /* Encoded coefficients - needed for #bits, band type and quant. error */ > for (i = 0; i < num_coeffs; i++) > SENT[i] = sce->coeffs[start_coef + i] - sce->prcoeffs[start_coef + i]; > - s->abs_pow34(S34, SENT, num_coeffs); > + s->aacdsp.abs_pow34(S34, SENT, num_coeffs); > if (cb_n < RESERVED_BT) > cb_p = av_clip(find_min_book(find_max_val(1, num_coeffs, S34), sce->sf_idx[sfb]), cb_min, cb_max); > else > @@ -291,7 +291,7 @@ void ff_aac_search_for_pred(AACEncContext *s, SingleChannelElement *sce) > /* Reconstructed coefficients - needed for distortion measurements */ > for (i = 0; i < num_coeffs; i++) > sce->prcoeffs[start_coef + i] += QERR[i] != 0.0f ? (sce->prcoeffs[start_coef + i] - QERR[i]) : 0.0f; > - s->abs_pow34(P34, &sce->prcoeffs[start_coef], num_coeffs); > + s->aacdsp.abs_pow34(P34, &sce->prcoeffs[start_coef], num_coeffs); > if (cb_n < RESERVED_BT) > cb_p = av_clip(find_min_book(find_max_val(1, num_coeffs, P34), sce->sf_idx[sfb]), cb_min, cb_max); > else > diff --git a/libavcodec/aacenc_utils.h b/libavcodec/aacenc_utils.h > index ef2218e036..cc747c3ea6 100644 > --- a/libavcodec/aacenc_utils.h > +++ b/libavcodec/aacenc_utils.h > @@ -37,15 +37,6 @@ > #define ROUND_TO_ZERO 0.1054f > #define C_QUANT 0.4054f > > -static inline void abs_pow34_v(float *out, const float *in, const int size) > -{ > - int i; > - for (i = 0; i < size; i++) { > - float a = fabsf(in[i]); > - out[i] = sqrtf(a * sqrtf(a)); > - } > -} > - > static inline float pos_pow34(float a) > { > return sqrtf(a * sqrtf(a)); > @@ -62,21 +53,6 @@ static inline int quant(float coef, const float Q, const float rounding) > return sqrtf(a * sqrtf(a)) + rounding; > } > > -static inline void quantize_bands(int *out, const float *in, const float *scaled, > - int size, int is_signed, int maxval, const float Q34, > - const float rounding) > -{ > - int i; > - for (i = 0; i < size; i++) { > - float qc = scaled[i] * Q34; > - int tmp = (int)FFMIN(qc + rounding, (float)maxval); > - if (is_signed && in[i] < 0.0f) { > - tmp = -tmp; > - } > - out[i] = tmp; > - } > -} > - > static inline float find_max_val(int group_len, int swb_size, const float *scaled) > { > float maxval = 0.0f; > diff --git a/libavcodec/aacencdsp.h b/libavcodec/aacencdsp.h > new file mode 100644 > index 0000000000..67836d8cf7 > --- /dev/null > +++ b/libavcodec/aacencdsp.h > @@ -0,0 +1,72 @@ > +/* > + * This file is part of FFmpeg. > + * > + * FFmpeg is free software; you can redistribute it and/or > + * modify it under the terms of the GNU Lesser General Public > + * License as published by the Free Software Foundation; either > + * version 2.1 of the License, or (at your option) any later version. > + * > + * FFmpeg is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + * Lesser General Public License for more details. > + * > + * You should have received a copy of the GNU Lesser General Public > + * License along with FFmpeg; if not, write to the Free Software > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA > + */ > + > +#ifndef AVCODEC_AACENCDSP_H > +#define AVCODEC_AACENCDSP_H > + > +#include > + > +#include "config.h" > + > +#include "libavutil/macros.h" > + > +typedef struct AACEncDSPContext { > + void (*abs_pow34)(float *out, const float *in, const int size); > + void (*quant_bands)(int *out, const float *in, const float *scaled, > + int size, int is_signed, int maxval, const float Q34, > + const float rounding); > +} AACEncDSPContext; > + > +void ff_aacenc_dsp_init_riscv(AACEncDSPContext *s); > +void ff_aacenc_dsp_init_x86(AACEncDSPContext *s); > + > +static inline void abs_pow34_v(float *out, const float *in, const int size) > +{ > + for (int i = 0; i < size; i++) { > + float a = fabsf(in[i]); > + out[i] = sqrtf(a * sqrtf(a)); > + } > +} > + > +static inline void quantize_bands(int *out, const float *in, const float *scaled, > + int size, int is_signed, int maxval, const float Q34, > + const float rounding) > +{ > + for (int i = 0; i < size; i++) { > + float qc = scaled[i] * Q34; > + int tmp = (int)FFMIN(qc + rounding, (float)maxval); > + if (is_signed && in[i] < 0.0f) { > + tmp = -tmp; > + } > + out[i] = tmp; > + } > +} > + > +static inline void ff_aacenc_dsp_init(AACEncDSPContext *s) > +{ > + s->abs_pow34 = abs_pow34_v; > + s->quant_bands = quantize_bands; > + > +#if ARCH_RISCV > + ff_aacenc_dsp_init_riscv(s); > +#elif ARCH_X86 > + ff_aacenc_dsp_init_x86(s); > +#endif > +} > + > +#endif > diff --git a/libavcodec/mips/aaccoder_mips.c b/libavcodec/mips/aaccoder_mips.c > index bf27a2a5da..dd9661fbdd 100644 > --- a/libavcodec/mips/aaccoder_mips.c > +++ b/libavcodec/mips/aaccoder_mips.c > @@ -61,6 +61,7 @@ > #include "libavcodec/put_bits.h" > #include "libavcodec/aac.h" > #include "libavcodec/aacenc.h" > +#include "libavcodec/aacencdsp.h" > #include "libavcodec/aactab.h" > #include "libavcodec/aacenctab.h" > #include "libavcodec/aacenc_utils.h" > diff --git a/libavcodec/riscv/aacencdsp_init.c b/libavcodec/riscv/aacencdsp_init.c > index 83ae16f46b..b27af9d973 100644 > --- a/libavcodec/riscv/aacencdsp_init.c > +++ b/libavcodec/riscv/aacencdsp_init.c > @@ -22,13 +22,12 @@ > #include "config.h" > > #include "libavutil/attributes.h" > -#include "libavutil/float_dsp.h" > #include "libavutil/cpu.h" > -#include "libavcodec/aacenc.h" > +#include "libavcodec/aacencdsp.h" > > void ff_abs_pow34_rvv(float *out, const float *in, const int size); > > -av_cold void ff_aac_dsp_init_riscv(AACEncContext *s) > +av_cold void ff_aacenc_dsp_init_riscv(AACEncDSPContext *s) > { > #if HAVE_RVV > int flags = av_get_cpu_flags(); > diff --git a/libavcodec/x86/aacencdsp_init.c b/libavcodec/x86/aacencdsp_init.c > index 049a2417d9..e0d8dec4f8 100644 > --- a/libavcodec/x86/aacencdsp_init.c > +++ b/libavcodec/x86/aacencdsp_init.c > @@ -22,9 +22,8 @@ > #include "config.h" > > #include "libavutil/attributes.h" > -#include "libavutil/float_dsp.h" > #include "libavutil/x86/cpu.h" > -#include "libavcodec/aacenc.h" > +#include "libavcodec/aacencdsp.h" > > void ff_abs_pow34_sse(float *out, const float *in, const int size); > > @@ -32,7 +31,7 @@ void ff_aac_quantize_bands_sse2(int *out, const float *in, const float *scaled, > int size, int is_signed, int maxval, const float Q34, > const float rounding); > > -av_cold void ff_aac_dsp_init_x86(AACEncContext *s) > +av_cold void ff_aacenc_dsp_init_x86(AACEncDSPContext *s) > { > int cpu_flags = av_get_cpu_flags(); > > diff --git a/tests/checkasm/aacencdsp.c b/tests/checkasm/aacencdsp.c > index 6fc22047c3..1756c4ecd5 100644 > --- a/tests/checkasm/aacencdsp.c > +++ b/tests/checkasm/aacencdsp.c > @@ -20,10 +20,9 @@ > > #include > > -#include "libavutil/mem.h" > #include "libavutil/mem_internal.h" > > -#include "libavcodec/aacenc.h" > +#include "libavcodec/aacencdsp.h" > > #include "checkasm.h" > > @@ -36,7 +35,8 @@ > } \ > } while (0) > > -static void test_abs_pow34(AACEncContext *s) { > +static void test_abs_pow34(AACEncDSPContext *s) > +{ > #define BUF_SIZE 1024 > LOCAL_ALIGNED_32(float, in, [BUF_SIZE]); > > @@ -63,8 +63,8 @@ static void test_abs_pow34(AACEncContext *s) { > > void checkasm_check_aacencdsp(void) > { > - AACEncContext s = { 0 }; > - ff_aac_dsp_init(&s); > + AACEncDSPContext s = { 0 }; > + ff_aacenc_dsp_init(&s); > > test_abs_pow34(&s); > } Will apply this patchset tomorrow unless there are objections. - Andreas _______________________________________________ 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".