Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH v2 01/13] avfilter/f_ebur128: use transformed direct form II
@ 2025-06-16 11:19 Niklas Haas
  2025-06-16 11:19 ` [FFmpeg-devel] [PATCH v2 02/13] avfilter/f_ebur128: simplify sample cache array Niklas Haas
                   ` (11 more replies)
  0 siblings, 12 replies; 21+ messages in thread
From: Niklas Haas @ 2025-06-16 11:19 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Niklas Haas

From: Niklas Haas <git@haasn.dev>

Instead of direct form I. See af_biquads.c for math. Also eliminate
an unnecessary indirection.
---
 libavfilter/f_ebur128.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/libavfilter/f_ebur128.c b/libavfilter/f_ebur128.c
index 768f062bac..173a4f75ca 100644
--- a/libavfilter/f_ebur128.c
+++ b/libavfilter/f_ebur128.c
@@ -686,17 +686,15 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
             /* Y[i] = X[i]*b0 + X[i-1]*b1 + X[i-2]*b2 - Y[i-1]*a1 - Y[i-2]*a2 */
 #define FILTER(Y, X, NUM, DEN) do {                                             \
             double *dst = ebur128->Y + ch*3;                                    \
-            double *src = ebur128->X + ch*3;                                    \
-            dst[2] = dst[1];                                                    \
-            dst[1] = dst[0];                                                    \
-            dst[0] = src[0]*NUM[0] + src[1]*NUM[1] + src[2]*NUM[2]              \
-                                   - dst[1]*DEN[1] - dst[2]*DEN[2];             \
+            double src = ebur128->X[ch*3]  ;                                    \
+            double dst0 = NUM[0] * src + dst[1];                                \
+            dst[1] = NUM[1] * src + dst[2] - DEN[1] * dst0;                     \
+            dst[2] = NUM[2] * src - DEN[2] * dst0;                              \
+            dst[0] = dst0;                                                      \
 } while (0)
 
             // TODO: merge both filters in one?
             FILTER(y, x, ebur128->pre_b, ebur128->pre_a);  // apply pre-filter
-            ebur128->x[ch * 3 + 2] = ebur128->x[ch * 3 + 1];
-            ebur128->x[ch * 3 + 1] = ebur128->x[ch * 3    ];
             FILTER(z, y, ebur128->rlb_b, ebur128->rlb_a);  // apply RLB-filter
 
             bin = ebur128->z[ch * 3] * ebur128->z[ch * 3];
-- 
2.49.0

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 21+ messages in thread
* [FFmpeg-devel] [PATCH v2 01/13] avfilter/f_ebur128: use transformed direct form II
@ 2025-06-13 16:37 Niklas Haas
  2025-06-13 16:37 ` [FFmpeg-devel] [PATCH v2 07/13] avfilter/x86/f_ebur128: add x86 AVX implementation Niklas Haas
  0 siblings, 1 reply; 21+ messages in thread
From: Niklas Haas @ 2025-06-13 16:37 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Niklas Haas

From: Niklas Haas <git@haasn.dev>

Instead of direct form I. See af_biquads.c for math. Also eliminate
an unnecessary indirection.
---
 libavfilter/f_ebur128.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/libavfilter/f_ebur128.c b/libavfilter/f_ebur128.c
index 768f062bac..173a4f75ca 100644
--- a/libavfilter/f_ebur128.c
+++ b/libavfilter/f_ebur128.c
@@ -686,17 +686,15 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
             /* Y[i] = X[i]*b0 + X[i-1]*b1 + X[i-2]*b2 - Y[i-1]*a1 - Y[i-2]*a2 */
 #define FILTER(Y, X, NUM, DEN) do {                                             \
             double *dst = ebur128->Y + ch*3;                                    \
-            double *src = ebur128->X + ch*3;                                    \
-            dst[2] = dst[1];                                                    \
-            dst[1] = dst[0];                                                    \
-            dst[0] = src[0]*NUM[0] + src[1]*NUM[1] + src[2]*NUM[2]              \
-                                   - dst[1]*DEN[1] - dst[2]*DEN[2];             \
+            double src = ebur128->X[ch*3]  ;                                    \
+            double dst0 = NUM[0] * src + dst[1];                                \
+            dst[1] = NUM[1] * src + dst[2] - DEN[1] * dst0;                     \
+            dst[2] = NUM[2] * src - DEN[2] * dst0;                              \
+            dst[0] = dst0;                                                      \
 } while (0)
 
             // TODO: merge both filters in one?
             FILTER(y, x, ebur128->pre_b, ebur128->pre_a);  // apply pre-filter
-            ebur128->x[ch * 3 + 2] = ebur128->x[ch * 3 + 1];
-            ebur128->x[ch * 3 + 1] = ebur128->x[ch * 3    ];
             FILTER(z, y, ebur128->rlb_b, ebur128->rlb_a);  // apply RLB-filter
 
             bin = ebur128->z[ch * 3] * ebur128->z[ch * 3];
-- 
2.49.0

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2025-06-16 14:40 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-16 11:19 [FFmpeg-devel] [PATCH v2 01/13] avfilter/f_ebur128: use transformed direct form II Niklas Haas
2025-06-16 11:19 ` [FFmpeg-devel] [PATCH v2 02/13] avfilter/f_ebur128: simplify sample cache array Niklas Haas
2025-06-16 11:19 ` [FFmpeg-devel] [PATCH v2 03/13] avfilter/f_ebur128: use structs for biquad weights Niklas Haas
2025-06-16 11:19 ` [FFmpeg-devel] [PATCH v2 04/13] avfilter/f_ebur128: use a single packed array for the integrator cache Niklas Haas
2025-06-16 11:19 ` [FFmpeg-devel] [PATCH v2 05/13] avfilter/f_ebur128: move weights and cache to EBUR128DSPContext Niklas Haas
2025-06-16 14:40   ` Michael Niedermayer
2025-06-16 11:19 ` [FFmpeg-devel] [PATCH v2 06/13] avfilter/f_ebur128: split off C implementation to separate function Niklas Haas
2025-06-16 11:19 ` [FFmpeg-devel] [PATCH v2 07/13] avfilter/x86/f_ebur128: add x86 AVX implementation Niklas Haas
2025-06-16 14:18   ` Michael Niedermayer
2025-06-16 11:19 ` [FFmpeg-devel] [PATCH v2 08/13] avfilter/f_ebur128: remove pointless macro Niklas Haas
2025-06-16 11:19 ` [FFmpeg-devel] [PATCH v2 09/13] avfilter/f_ebur128: move true peak calculation out of main loop Niklas Haas
2025-06-16 13:06   ` Niklas Haas
2025-06-16 11:19 ` [FFmpeg-devel] [PATCH v2 10/13] avfilter/f_ebur128: lift sample " Niklas Haas
2025-06-16 11:19 ` [FFmpeg-devel] [PATCH v2 11/13] avfilter/f_ebur128: move variable declarations to usage site Niklas Haas
2025-06-16 11:20 ` [FFmpeg-devel] [PATCH v2 12/13] avfilter/f_ebur128: move true peak calculation to DSP function Niklas Haas
2025-06-16 11:20 ` [FFmpeg-devel] [PATCH v2 13/13] avfilter/x86/f_ebur128: implement AVX true peak calculation Niklas Haas
  -- strict thread matches above, loose matches on Subject: below --
2025-06-13 16:37 [FFmpeg-devel] [PATCH v2 01/13] avfilter/f_ebur128: use transformed direct form II Niklas Haas
2025-06-13 16:37 ` [FFmpeg-devel] [PATCH v2 07/13] avfilter/x86/f_ebur128: add x86 AVX implementation Niklas Haas
2025-06-14  1:12   ` Michael Niedermayer
2025-06-16 11:19     ` Niklas Haas
2025-06-14  1:20   ` James Almer
2025-06-16 11:15     ` Niklas Haas

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