Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Zhao Zhili via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: Zhao Zhili <code@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH] fftools/ffmpeg_filter: fix build failure on riscv (PR #21308)
Date: Mon, 29 Dec 2025 08:18:55 -0000
Message-ID: <176699633646.25.11834066859251253649@4457048688e7> (raw)

PR #21308 opened by Zhao Zhili (quink)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21308
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21308.patch

libavcodec/mathops.h is a private header file, which can use private
symbols inside libavcodec, e.g., ff_rv_zbb_supported. With shared
build, we got

fftools/ffmpeg_filter.c:2687: undefined reference to `ff_rv_zbb_supported'

This patch also fixes integer overflow issue by rewriting median3
to work with int64_t.


>From c91303ef78b8daebe874dfa652ff56a003537b16 Mon Sep 17 00:00:00 2001
From: Zhao Zhili <zhilizhao@tencent.com>
Date: Mon, 29 Dec 2025 07:25:49 +0000
Subject: [PATCH] fftools/ffmpeg_filter: fix build failure on riscv

libavcodec/mathops.h is a private header file, which can use private
symbols inside libavcodec, e.g., ff_rv_zbb_supported. With shared
build, we got

fftools/ffmpeg_filter.c:2687: undefined reference to `ff_rv_zbb_supported'

This patch also fixes integer overflow issue by rewriting median3
to work with int64_t.
---
 fftools/ffmpeg_filter.c | 26 ++++++++++++++++++++------
 1 file changed, 20 insertions(+), 6 deletions(-)

diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index d5ae59ec03..9a4360b5c5 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -40,9 +40,6 @@
 #include "libavutil/time.h"
 #include "libavutil/timestamp.h"
 
-// FIXME private header, used for mid_pred()
-#include "libavcodec/mathops.h"
-
 typedef struct FilterGraphPriv {
     FilterGraph      fg;
 
@@ -2489,6 +2486,23 @@ early_exit:
     return float_pts;
 }
 
+static inline 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;
+}
+
+
 /* Convert frame timestamps to the encoder timebase and decide how many times
  * should this (and possibly previous) frame be repeated in order to conform to
  * desired target framerate (if any).
@@ -2501,9 +2515,9 @@ static void video_sync_process(OutputFilterPriv *ofp, AVFrame *frame,
     double delta0, delta, sync_ipts, duration;
 
     if (!frame) {
-        *nb_frames_prev = *nb_frames = mid_pred(fps->frames_prev_hist[0],
-                                                fps->frames_prev_hist[1],
-                                                fps->frames_prev_hist[2]);
+        *nb_frames_prev = *nb_frames = median3(fps->frames_prev_hist[0],
+                                               fps->frames_prev_hist[1],
+                                               fps->frames_prev_hist[2]);
 
         if (!*nb_frames && fps->last_dropped) {
             atomic_fetch_add(&ofilter->nb_frames_drop, 1);
-- 
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-29  8:19 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=176699633646.25.11834066859251253649@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