Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: michaelni via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: michaelni <code@ffmpeg.org>
Subject: [FFmpeg-devel] [PR] fftools/ffmpeg_filter: Simplify median3() (PR #21346)
Date: Wed, 31 Dec 2025 20:54:27 -0000
Message-ID: <176721446746.25.12375998959031063085@4457048688e7> (raw)

PR #21346 opened by michaelni
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21346
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21346.patch

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>


>From 334bc7276c0a3bca4b0959e4c096ac1f6ce1acbe Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <michael@niedermayer.cc>
Date: Wed, 31 Dec 2025 21:34:26 +0100
Subject: [PATCH] fftools/ffmpeg_filter: Simplify median3()

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 fftools/ffmpeg_filter.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 4387c992da..1ed9681ad2 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -2488,18 +2488,7 @@ early_exit:
 
 static int64_t median3(int64_t a, int64_t b, int64_t c)
 {
-    int64_t max2, min2, m;
-
-    if (a >= b) {
-        max2 = a;
-        min2 = b;
-    } else {
-        max2 = b;
-        min2 = a;
-    }
-    m = (c >= max2) ? max2 : c;
-
-    return (m >= min2) ? m : min2;
+    return a + (uint64_t)b + c - FFMIN3(a,b,c) - FFMAX3(a,b,c);
 }
 
 
-- 
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-12-31 20:54 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=176721446746.25.12375998959031063085@4457048688e7 \
    --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