From patchwork Wed Apr 24 11:03:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lynne X-Patchwork-Id: 48250 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:2d06:b0:1a9:af23:56c1 with SMTP id tw6csp571359pzb; Wed, 24 Apr 2024 04:04:05 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXnbEJJLg+tCs6YUW8MKue2Y6rgGSZYS4XR7mUG3/qMhW4VLDiqLijXkuCdox7HdfXsQv1i2FDWs2oQLW5UKH7mz0uM2Th4Ceui0w== X-Google-Smtp-Source: AGHT+IGGXEfAEVtjwd4fn5TmUV1QiZLJy3sxL+o6AxCOIj+LVwIXzj6LyB1qJj6rovdB2sB5Xo1+ X-Received: by 2002:a05:6512:1314:b0:515:a8e0:bf3c with SMTP id x20-20020a056512131400b00515a8e0bf3cmr2098066lfu.32.1713956645613; Wed, 24 Apr 2024 04:04:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1713956645; cv=none; d=google.com; s=arc-20160816; b=PWI69K1yUKIOT3KMqbRfxfUd7hyqXsftxIKeBx052+T9LfNLj2hG5+aPGuLJ8K3dJE /6WJyuNK/E4G1Ne+YYfyNRQNPu3vEj73Oq77igte/nINu0+LZyZ0A1WdZsrL9dWP+pA+ KzZs9ve8LpMXKcVWJE5FDGty9f9Fsz5BKAdXOk1FWyJqrjSok5vRAdk5PqOzcR1T/Rar upQMWunA1HNW0P21oDPsGNkJwAqTXxmFdn8Rc7JU4A1pFY+jSaZePCIS6Ao91kNv8oxx sw0VtLAbWYjpIIMrKD7+DDYd7awwTQu0dxx874iS8EzU1xJNwlEMdF8Ahs+zTjzqT+oc o1/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:message-id:to:from:date:dkim-signature:delivered-to; bh=RbhAKHV8rGgu5LL0z41VvYQmYkKgOYz1/U/UB0bbJWA=; fh=Q46kXK7oI5D1Jhi90JBr53c7NIaTxGaU4KPeRZyM/hI=; b=tkp7ZuaALY4xyBJBSD7Jdv32UqhFZH0Lgk5vQ1SfiAc0wp6z/snSA0y2n3/qH5Zr5g wSx66/uhWGiWXr93eO1ysWfoD4NQX986ABqGDGOk6tIy/swbuE60RAIF7bhk/FLhmqF/ 48BLzX5AhGJMQtHjPdWWiXLozZfeMhl/MDZJRhpUwVrElUKVi72rYmu/2W9TJds1YHi/ vtV9s1xMiPqBnYMbgOOM0pgU6FupKAgzXS38nA/EtOrfBEf1uANMYCMRm0EsRvsRbM9I klAaBdqEJvst48+4dSHVnx4k2u+1FM3hHiuQs8hBRYUWrMphFSj83/u7/iGZTBjz02FG ZrGA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@lynne.ee header.s=s1 header.b=auYPga7a; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=lynne.ee Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id i20-20020a056512225400b0051871779d3fsi4639306lfu.154.2024.04.24.04.04.04; Wed, 24 Apr 2024 04:04:05 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@lynne.ee header.s=s1 header.b=auYPga7a; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=lynne.ee Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8C1BA68D37F; Wed, 24 Apr 2024 14:03:17 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from w4.tutanota.de (w4.tutanota.de [81.3.6.165]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 155F968D3B3 for ; Wed, 24 Apr 2024 14:03:10 +0300 (EEST) Received: from tutadb.w10.tutanota.de (unknown [192.168.1.10]) by w4.tutanota.de (Postfix) with ESMTP id 9B6A01060157 for ; Wed, 24 Apr 2024 11:03:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1713956589; 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=27UC0I3Cxc0YOdIthcZZi4Cfk4LboDFkMVQH+ys8Qs4=; b=auYPga7afWTiMYcLJk81I95mwrDzhQhmb1UKOzSSSpY7qKEKl7/3YfjB8jEkg8++ pT2XENLamC6hZQ8M67hJz8aM0CHpk9g/ddmQrVHXTuI2uZqRkpDaRRq4LAPy/cvkd3l Z0dl5Md5zokyH7+cWNq228ThyCBnXqcmk3Nl05EQsUMPVWdT2qFzDrVTJ+CHrvmvVnA Kl3QFp6w9heRJk1S+f8v+8BaRFfhw6XpcCLkpttACpt4deqmmSyXuFwaRKxAWGqCXv0 O7USelwP3Z3MG3N/bEGR39M7WtyFvGXpWLq29oDTX2il2XzBsX2dsS9frDhwLM2bkdD SiQAmXZsog== Date: Wed, 24 Apr 2024 13:03:09 +0200 (CEST) From: Lynne To: Ffmpeg Devel Message-ID: MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] aacdec: avoid generating unused code when either implementation is disabled 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" X-TUID: KDUBs6hbyKIG Minor optimization to remove extra branches. We need to include the header for xHE anyway, which is float-only. From 54f53fb1c0694bf2777a1eefb1f585a804d56978 Mon Sep 17 00:00:00 2001 From: Lynne Date: Wed, 24 Apr 2024 13:01:14 +0200 Subject: [PATCH] aacdec: avoid generating unused code when either implementation is disabled Minor optimization to remove extra branches. We need to include the header for xHE anyway, which is float-only. --- libavcodec/aac/aacdec.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/libavcodec/aac/aacdec.c b/libavcodec/aac/aacdec.c index 4a29c1b092..72f2d7e7ba 100644 --- a/libavcodec/aac/aacdec.c +++ b/libavcodec/aac/aacdec.c @@ -33,6 +33,8 @@ * for which we need this to be defined for them to work as expected. */ #define USE_FIXED 1 +#include "config_components.h" + #include #include @@ -1312,9 +1314,9 @@ static void decode_ltp(AACDecContext *ac, LongTermPrediction *ltp, int sfb; ltp->lag = get_bits(gb, 11); - if (ac->is_fixed) + if (CONFIG_AAC_FIXED_DECODER && ac->is_fixed) ltp->coef_fixed = Q30(ff_ltp_coef[get_bits(gb, 3)]); - else + else if (CONFIG_AAC_DECODER) ltp->coef = ff_ltp_coef[get_bits(gb, 3)]; for (sfb = 0; sfb < FFMIN(max_sfb, MAX_LTP_LONG_SFB); sfb++) @@ -1623,9 +1625,9 @@ static int decode_tns(AACDecContext *ac, TemporalNoiseShaping *tns, tmp2_idx = 2 * coef_compress + coef_res; for (i = 0; i < tns->order[w][filt]; i++) { - if (ac->is_fixed) + if (CONFIG_AAC_FIXED_DECODER && ac->is_fixed) tns->coef_fixed[w][filt][i] = Q31(ff_tns_tmp2_map[tmp2_idx][get_bits(gb, coef_len)]); - else + else if (CONFIG_AAC_DECODER) tns->coef[w][filt][i] = ff_tns_tmp2_map[tmp2_idx][get_bits(gb, coef_len)]; } } @@ -1974,9 +1976,9 @@ static int decode_extension_payload(AACDecContext *ac, GetBitContext *gb, int cn ac->avctx->profile = AV_PROFILE_AAC_HE; } - if (ac->is_fixed) + if (CONFIG_AAC_FIXED_DECODER && ac->is_fixed) res = ff_aac_sbr_decode_extension_fixed(ac, che, gb, crc_flag, cnt, elem_type); - else + else if (CONFIG_AAC_DECODER) res = ff_aac_sbr_decode_extension(ac, che, gb, crc_flag, cnt, elem_type); @@ -2087,11 +2089,11 @@ static void spectral_to_sample(AACDecContext *ac, int samples) ac->dsp.update_ltp(ac, &che->ch[1]); } if (ac->oc[1].m4ac.sbr > 0) { - if (ac->is_fixed) + if (CONFIG_AAC_FIXED_DECODER && ac->is_fixed) ff_aac_sbr_apply_fixed(ac, che, type, (void *)che->ch[0].output, (void *)che->ch[1].output); - else + else if (CONFIG_AAC_DECODER) ff_aac_sbr_apply(ac, che, type, (void *)che->ch[0].output, (void *)che->ch[1].output); @@ -2550,6 +2552,7 @@ static const AVClass decoder_class = { .version = LIBAVUTIL_VERSION_INT, }; +#if CONFIG_AAC_DECODER const FFCodec ff_aac_decoder = { .p.name = "aac", CODEC_LONG_NAME("AAC (Advanced Audio Coding)"), @@ -2569,7 +2572,9 @@ const FFCodec ff_aac_decoder = { .flush = flush, .p.profiles = NULL_IF_CONFIG_SMALL(ff_aac_profiles), }; +#endif +#if CONFIG_AAC_FIXED_DECODER const FFCodec ff_aac_fixed_decoder = { .p.name = "aac_fixed", CODEC_LONG_NAME("AAC (Advanced Audio Coding)"), @@ -2589,3 +2594,4 @@ const FFCodec ff_aac_fixed_decoder = { .p.profiles = NULL_IF_CONFIG_SMALL(ff_aac_profiles), .flush = flush, }; +#endif -- 2.43.0.381.gb435a96ce8