From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 7A5B64BDC4 for ; Tue, 2 Sep 2025 01:30:26 +0000 (UTC) Authentication-Results: ffbox; dkim=fail (body hash mismatch (got b'cM7VqCAkFPzQgRuHMem3hAdLFMdvJmGDvDG9TsLBGQU=', expected b'ahPXYQWdmnH1m2fxMqKBr+mVcVL4MUp6ft8zxnE0Tc4=')) header.d=ffmpeg.org header.i=@ffmpeg.org header.a=rsa-sha256 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1756776615; h=mime-version : to : message-id : reply-to : subject : list-id : list-archive : list-archive : list-help : list-owner : list-post : list-subscribe : list-unsubscribe : from : cc : content-type : content-transfer-encoding : from; bh=cM7VqCAkFPzQgRuHMem3hAdLFMdvJmGDvDG9TsLBGQU=; b=FHksDppiVhy8F5Iv2h9yLnLEyWhCdahKnXfiiRdMbreHd0qiIRa5T/edcf0DAxJ9KL/QU z1mIWJWkiCS2Xl1mfTWYAHMZvntM74MJIrpLMEvtk1wZSz559kPZogbSkByhp42sZI8/3Qz 8KJEn91r5hBEQXGcwHRpRbF08vIqJ7oNG5Ti5swThY/VoMyobb+3sZ+T7VAdr0TKFLbaKxy sPvwBvp8kxsk18rZi+N6mB1ddO4lh+SXfvFyX3W8r/XhMBUG/hF31lk9hvCexuICKXHGXeS OizEFPEb9Fp9iY8xGUPEitcuhdWjqzTNj6tjm1/NYd6A+R3iBa6BxduM6D+g== Received: from [172.19.0.4] (unknown [172.19.0.4]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 1D21F68E7B6; Tue, 2 Sep 2025 04:30:15 +0300 (EEST) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=ffmpeg.org; s=arc; t=1756776605; b=dMqbRkvnqExIUZUEWUxQxx+EOO96+61OhwfIk1dNUL1QR3edgxBj9IR82P7ofQRoDAd5k Fe/yBrAi49STBzloXJ4of7CAbr/nSzRaj2LFz96hiYoaS69C78tbzIRzm4i7lR+uiDmD3N4 7IEru2OuJTnMCNSO9RFH6qVNzvepYE58JoVuPZ10+eZ5TcFAQs8YfQAEhot6WqLH7sMmRfA TX0wEWMM1mpqA4gzhVUq7BFVggcUmQ+2DDTnZS8/QiGSNQ4OEWqabP1pr2ADqm8/enJsVQb drSKgseAXm5g5gyvrNqbM86tCEuRvCwBAfeEOpOnY53KlcwPxGGWvX+AcMOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=ffmpeg.org; s=arc; t=1756776605; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=hhln7bw9ILIT/CHQNAH41eyaDXR+BMdKNR6xBIamqb0=; b=UO2dUl5PQohWObrD2kqvIvoazOXv7VvL/yPOoOiOE/+Pz2p2OwsFf/YVJyuXz/V7QkCYk F2gwTQbKqBiNZ+6GXT7FxaVPsZKLnbKNbzeec2VnIjLNzU8fwTXHOM/oohpExB1xlBgDSpg wmBTW6A4oarYxmtaTruqo5I/KPwO+ELD5qiKBEbyXmDikWZnZ8+81KLf+Qm/dbWX/cEahOc VQ9x0t3qIVANTAd9c+nv2qgYS/bcNd6fn8IXplVjUEnTREtCvPUrH4/jJssn0AJRMn99M8N cgewzA9f81g8tg77161vQL9DI/3K5W/VxnNNQqp4hix2f6DfuOwBK1jMJB7A== ARC-Authentication-Results: i=1; ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none; dmarc=none Authentication-Results: ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none (Message is not ARC signed); dmarc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1756776598; h=content-type : mime-version : content-transfer-encoding : from : to : reply-to : subject : from; bh=ahPXYQWdmnH1m2fxMqKBr+mVcVL4MUp6ft8zxnE0Tc4=; b=WUSJTExd4Zgm5LGta79h25aTYft3O8Mw5aoD6gJGSHXlRguyfRwmwVtHmxLvsNOtf8Kx+ p3ZN/iLP0nc43K8Ws6AlzIgstkEo1sTEA5a35bMhzdP+z4nAYmGtPvFGlyPmHFEqzphPYDJ cR31h4sYQqf/uqT/u4S2NB4CyZJNms5ySIAwRK3UNtQXDXUQN3cjj7xjJNhc8F32Q1AMBvP FigpCBhgL01d4JF5EkPMaBmUsjfVpqS4tUTXkKkTyISsSfFa7Idd1mXY3yZI6lvUmvZVagu 2W2J9oc/agc+W3Fa16/n82Rytbx+aHz1pzpXcQ/7kLgUamL3bC08iPtphPOw== Received: from 5d8f51c41678 (code.ffmpeg.org [188.245.149.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 755B568E74B for ; Tue, 2 Sep 2025 04:29:58 +0300 (EEST) MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Message-ID: <175677659859.25.15869937322765000068@463a07221176> Message-ID-Hash: SNTZM2MC2X2766KQPP7TMVEEBSK3X2EL X-Message-ID-Hash: SNTZM2MC2X2766KQPP7TMVEEBSK3X2EL X-MailFrom: code@ffmpeg.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-ffmpeg-devel.ffmpeg.org-0; header-match-ffmpeg-devel.ffmpeg.org-1; header-match-ffmpeg-devel.ffmpeg.org-2; header-match-ffmpeg-devel.ffmpeg.org-3; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list Reply-To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] [PATCH] avcodec/mpegaudiodec: allocate tables dynamically to reduce .bss (PR #20393) List-Id: FFmpeg development discussions and patches Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: yibofang via ffmpeg-devel Cc: yibofang Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Archived-At: List-Archive: List-Post: PR #20393 opened by yibofang URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20393 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20393.patch The tables ff_table_4_3_exp and ff_table_4_3_value were previously large static arrays (~160 KiB) in .bss. Change them into pointers and allocate memory via av_calloc() during mpegaudiodec_common_tableinit(). This reduces permanent bss usage by ~160 KiB, which helps on resource-constrained platforms. >>From 97ff4b44b14546f93b70a80cc77420775e8903a8 Mon Sep 17 00:00:00 2001 From: YiboFang Date: Tue, 26 Aug 2025 17:17:28 +0800 Subject: [PATCH] avcodec/mpegaudiodec: allocate tables dynamically to reduce .bss The tables ff_table_4_3_exp and ff_table_4_3_value were previously large static arrays (~160 KiB) in .bss. Change them into pointers and allocate memory via av_calloc() during mpegaudiodec_common_tableinit(). This reduces permanent bss usage by ~160 KiB, which helps on resource-constrained platforms. Build cmd: ./configure --arch=arm --target-os=linux \ --enable-cross-compile \ --cross-prefix=arm-linux-gnueabihf- \ --extra-cflags='-march=armv7-a -mfpu=neon-vfpv3 -mfloat-abi=hard -fPIC' On ARM cross build (armv7-a, NEON): before: text=15445946, data=750736, bss=23495660 after : text=15446072 (+126 B), data=750736, bss=23331516 (-164144 B) overall image size reduced by ~160 KiB. Signed-off-by: Yibo Fang --- libavcodec/mpegaudiodata.h | 4 ++-- libavcodec/mpegaudiodec_common_tablegen.h | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/libavcodec/mpegaudiodata.h b/libavcodec/mpegaudiodata.h index 720c4bee64..6dfb74cd01 100644 --- a/libavcodec/mpegaudiodata.h +++ b/libavcodec/mpegaudiodata.h @@ -50,8 +50,8 @@ extern const unsigned char * const ff_mpa_alloc_tables[5]; extern const int8_t ff_table_4_3_exp [TABLE_4_3_SIZE]; extern const uint32_t ff_table_4_3_value[TABLE_4_3_SIZE]; #else -extern int8_t ff_table_4_3_exp [TABLE_4_3_SIZE]; -extern uint32_t ff_table_4_3_value[TABLE_4_3_SIZE]; +extern int8_t *ff_table_4_3_exp; +extern uint32_t *ff_table_4_3_value; #endif /* VLCs for decoding layer 3 huffman tables */ diff --git a/libavcodec/mpegaudiodec_common_tablegen.h b/libavcodec/mpegaudiodec_common_tablegen.h index bf402c9d84..e18c02d716 100644 --- a/libavcodec/mpegaudiodec_common_tablegen.h +++ b/libavcodec/mpegaudiodec_common_tablegen.h @@ -33,10 +33,11 @@ #include "libavcodec/mpegaudiodec_common_tables.h" #else #include +#include "libavutil/mem.h" #include "libavutil/attributes.h" -int8_t ff_table_4_3_exp [TABLE_4_3_SIZE]; -uint32_t ff_table_4_3_value[TABLE_4_3_SIZE]; +int8_t *ff_table_4_3_exp; +uint32_t *ff_table_4_3_value; #define FRAC_BITS 23 #define IMDCT_SCALAR 1.759 @@ -51,6 +52,11 @@ static av_cold void mpegaudiodec_common_tableinit(void) }; double pow43_val = 0; +#if !CONFIG_HARDCODED_TABLES + ff_table_4_3_exp = (int8_t *)av_calloc(TABLE_4_3_SIZE, sizeof(int8_t)); + ff_table_4_3_value = (uint32_t *)av_calloc(TABLE_4_3_SIZE, sizeof(uint32_t)); +#endif + for (int i = 1; i < TABLE_4_3_SIZE; i++) { double f, fm; int e, m; -- 2.49.1 _______________________________________________ ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org