From: Renjianguang-mi via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: Renjianguang-mi <code@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH] swresample: SWR_CH_MAX as config, default 64 (PR #20412)
Message-ID: <175689444433.25.1362591717806933519@463a07221176> (raw)
PR #20412 opened by Renjianguang-mi
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20412
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20412.patch
For memory-constrained products, reduce the memory overhead of swresample.
Optimizing swresample SwrContext memory:
double matrix[SWR_CH_MAX][SWR_CH_MAX]
float matrix_flt[SWR_CH_MAX][SWR_CH_MAX]
int32_t matrix32[SWR_CH_MAX][SWR_CH_MAX]
uint8_t matrix_ch[SWR_CH_MAX][SWR_CH_MAX+1]
eg:
SWR_CH_MAX = 64
matrix Total memory: 68KB
SWR_CH_MAX = 8
matrix Total memory: 1.07KB
Signed-off-by: renjianguang <renjianguang@xiaomi.com>
>From 4cb2102d9e7ff12506ec33e40a1eb88477f53c3f Mon Sep 17 00:00:00 2001
From: renjianguang <renjianguang@xiaomi.com>
Date: Wed, 3 Sep 2025 17:28:36 +0800
Subject: [PATCH] swresample: SWR_CH_MAX as config, default 64
For memory-constrained products, reduce the memory overhead of swresample.
Optimizing swresample SwrContext memory:
double matrix[SWR_CH_MAX][SWR_CH_MAX]
float matrix_flt[SWR_CH_MAX][SWR_CH_MAX]
int32_t matrix32[SWR_CH_MAX][SWR_CH_MAX]
uint8_t matrix_ch[SWR_CH_MAX][SWR_CH_MAX+1]
eg:
SWR_CH_MAX = 64
matrix Total memory: 68KB
SWR_CH_MAX = 8
matrix Total memory: 1.07KB
Signed-off-by: renjianguang <renjianguang@xiaomi.com>
---
configure | 5 +++++
libswresample/swresample_internal.h | 2 --
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/configure b/configure
index 7ec4c3975b..b93d5dd5fb 100755
--- a/configure
+++ b/configure
@@ -445,6 +445,7 @@ Advanced options (experts only):
crashes and arbitrary code execution, it may be faster, but
should only be used with trusted input)
--sws-max-filter-size=N the max filter size swscale uses [$sws_max_filter_size_default]
+ --swr-ch-max=N the max channel number swresamle uses [$swr_ch_max_default]
Optimization options (experts only):
--disable-asm disable all assembly optimizations
@@ -2755,6 +2756,7 @@ CMDLINE_SET="
stdcxx
strip
sws_max_filter_size
+ swr_ch_max
sysinclude
sysroot
target_exec
@@ -4242,6 +4244,8 @@ enable valgrind_backtrace
sws_max_filter_size_default=256
set_default sws_max_filter_size
+swr_ch_max_default=64
+set_default swr_ch_max
# internal components are enabled by default
enable $EXTRALIBS_LIST
@@ -8413,6 +8417,7 @@ cat > $TMPH <<EOF
#define BUILDSUF "$build_suffix"
#define SLIBSUF "$SLIBSUF"
#define SWS_MAX_FILTER_SIZE $sws_max_filter_size
+#define SWR_CH_MAX $swr_ch_max
EOF
test -n "$assert_level" &&
diff --git a/libswresample/swresample_internal.h b/libswresample/swresample_internal.h
index 21c9e33fa1..81eae2eb63 100644
--- a/libswresample/swresample_internal.h
+++ b/libswresample/swresample_internal.h
@@ -25,8 +25,6 @@
#include "libavutil/channel_layout.h"
#include "config.h"
-#define SWR_CH_MAX 64
-
#define SQRT3_2 1.22474487139158904909 /* sqrt(3/2) */
#define NS_TAPS 20
--
2.49.1
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
reply other threads:[~2025-09-03 10:14 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=175689444433.25.1362591717806933519@463a07221176 \
--to=ffmpeg-devel@ffmpeg.org \
--cc=code@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git