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 EAC504C02A for ; Tue, 2 Sep 2025 01:29:57 +0000 (UTC) Authentication-Results: ffbox; dkim=fail (body hash mismatch (got b'MytQ/rTc5HnlmsKxLZLn7Mwt1wb8QO7CYOESrq+obj4=', expected b'ZBH3oV2Odp1dS3Bjc4FXXGShKJiTi0lUjtr+eH13pJY=')) 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=1756776581; 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=MytQ/rTc5HnlmsKxLZLn7Mwt1wb8QO7CYOESrq+obj4=; b=LMLlFfsErkCwA/F5pEtzaJ6c8omlIJd0BWurhi065D+tJA59MWPkoMhVPv4LNMzHpulnN bT1khgCVqj29kNtL9YBvxlw1Cw7//5Ngc9BKoKKkVrHnl3zM/J3l5219+fHx7ELFRbwGVKp EgCPyimxkcLK6MA8W8PdlT8A9xKhXhP9ctg6afv5Rnh5+oQPj9DcoiOWvbBzVS7zNBw7iL6 S6fXPJeIA3TBf1Hiq78q3MxOGJWozXSALPVSRnwBkCVd9ojhOMr4Zt6xVZnt/Pk6qAE8lrY MLUbRMg1nkxYqEogJ3OGFDJ4aqWZaGwqkQM4hn4R7MSNo4j/thADE5C6MIIA== Received: from [172.19.0.4] (unknown [172.19.0.4]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 6082868E79F; Tue, 2 Sep 2025 04:29:41 +0300 (EEST) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=ffmpeg.org; s=arc; t=1756776572; b=j0cIhmtthaZHfar4aol5cwx+TP/5AgAGlj9dgbesnvngN8ioyIFFzAWeVQDxqafPZDzPV PfFrHHaS4Jr3AJklvgihWD8Ee61uHuvb+RKW4tFgRkgZ5yCBgu4OZFbYJXGh74Xk7eDeeMr CK6RXpjwq/K0iFFqh7MMx6RABTLaVOUIH1LPuk6u2sP0B94PWa478JtPWeFWSFeTYmVXnxJ iEdkVc7UOCGXPQLs5U4G8t2Meo/hRsGi+80dPYpD2QufE56O3FRkgEnhoJ4t541WlnG8tUi 1oi3BZxtkXPiXD1ezT4VNLVKw/QETDaCCPOAXJVclgVlOyRVv09EKjQlYHIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=ffmpeg.org; s=arc; t=1756776572; 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=ZBAPn2rc78NMAug8sDNFjN4T5zGbOADFHaV35SX2bVU=; b=OadsIb2H9J7L1ykkgSc8QuMgBye8mTy6bpb9zp3Q7fuPmke/n307+FP4561ttsxQFwh4q 8y3TYaDHcnrRxPPqp3sCsfygeoZbqDUY/kXT0rHJtEFRTqat5j2201mmDaRBR035r6svl0y Qvt34ycN3QfekjYnBmmZ3z1RZ8osJZrjMV+0Bgl4Bne2AE1KDkwpbBLoWjBxVRZGKYZ5J76 s4+iCiC8/bYXpNomZOa9B05B1dxIBARLlmJ3verOhn2cneqcNrOS4YCHt0kzPC1Mihwy7sq xRfEH5MFF7idzAwl1DErqCwB+jh0ZR47A+/2QK+zdLVs1f4QYib8Bd6cmv6w== 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=1756776563; h=content-type : mime-version : content-transfer-encoding : from : to : reply-to : subject : from; bh=ZBH3oV2Odp1dS3Bjc4FXXGShKJiTi0lUjtr+eH13pJY=; b=B87L+VtUGmxoX3VtK76b83hbVkVXorvMQB7W0NlQMnqkdilovp32jdeyHmdYma8DafDj0 7nBoOCuuyvLvTj64XheO2IQY3Hl3kqzVH+vCnNKBigdnto0d4HaXca1L7w7YyI+E3mi1Bpa n+CXE33HaO2zWNh7irzmJou5njbSu965jo4gqqkJ5195g3AUIFBR25V/Knhw9vrVaRZ1LJ9 3b8Oxa6LSD4wx0BNLWCBtJjoPjZ4YIaZdwnJYA1sL9+Tw+icxVsF5z78T9Xl1StyGH7zXBp dkwZbHx4zme9PNgNZgbulM3rcyrF520r0jnz2MBqdYd5K4ku9Ego4WskrRjg== Received: from 5d8f51c41678 (code.ffmpeg.org [188.245.149.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 0C0DC68E6E8 for ; Tue, 2 Sep 2025 04:29:22 +0300 (EEST) MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Message-ID: <175677656322.25.7054494836745946690@463a07221176> Message-ID-Hash: 6SJQVY6QLSK54IZW7XON57ZLVAGWRFDV X-Message-ID-Hash: 6SJQVY6QLSK54IZW7XON57ZLVAGWRFDV 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/cbrt_table: use dynamic buffer instead of static array (PR #20392) 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 #20392 opened by yibofang URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20392 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20392.patch The cbrt table generator previously used a 128 KiB static buffer in .bss. Replace it with a temporary av_malloc()/av_free() buffer used only at init. This saves ~128 KiB permanent bss, which is valuable on resource-constrained platforms. >>From ae007d38ba0a8979339803e4db41a732de8d9238 Mon Sep 17 00:00:00 2001 From: YiboFang Date: Tue, 26 Aug 2025 16:51:58 +0800 Subject: [PATCH] avcodec/cbrt_table: use dynamic buffer instead of static array The cbrt table generator previously used a 128 KiB static buffer in .bss. Replace it with a temporary av_malloc()/av_free() buffer used only at init. This saves ~128 KiB permanent bss, which is valuable 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=15446058 (+112 B), data=750736, bss=23364588 (-128 KiB) overall image size reduced by ~128 KiB. Signed-off-by: Yibo Fang Signed-off-by: YiboFang --- libavcodec/cbrt_tablegen.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/libavcodec/cbrt_tablegen.h b/libavcodec/cbrt_tablegen.h index 9af18d8ab5..70eccd8a73 100644 --- a/libavcodec/cbrt_tablegen.h +++ b/libavcodec/cbrt_tablegen.h @@ -25,6 +25,8 @@ #include #include +#include "libavutil/log.h" +#include "libavutil/mem.h" #include "libavutil/attributes.h" #include "libavutil/intfloat.h" #include "libavcodec/aac_defines.h" @@ -39,11 +41,18 @@ uint32_t AAC_RENAME(ff_cbrt_tab)[1 << 13]; av_cold void AAC_RENAME(ff_cbrt_tableinit)(void) { - static double cbrt_tab_dbl[1 << 13]; if (!AAC_RENAME(ff_cbrt_tab)[(1<<13) - 1]) { + double *cbrt_tab_dbl; int i, j, k; double cbrt_val; + cbrt_tab_dbl = av_malloc((1 << 13) * sizeof(double)); + if (!cbrt_tab_dbl) { + av_log(NULL, AV_LOG_ERROR, "cbrt_tableinit malloc failed %zu\n", + (1 << 13) * sizeof(double)); + return; + } + for (i = 1; i < 1<<13; i++) cbrt_tab_dbl[i] = 1; @@ -67,6 +76,8 @@ av_cold void AAC_RENAME(ff_cbrt_tableinit)(void) for (i = 0; i < 1<<13; i++) AAC_RENAME(ff_cbrt_tab)[i] = CBRT(cbrt_tab_dbl[i]); + + av_free(cbrt_tab_dbl); } } -- 2.49.1 _______________________________________________ ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org