* [FFmpeg-devel] [PATCH] fftools/ffmpeg_filter: fix build failure on riscv (PR #21308)
@ 2025-12-29 8:18 Zhao Zhili via ffmpeg-devel
0 siblings, 0 replies; only message in thread
From: Zhao Zhili via ffmpeg-devel @ 2025-12-29 8:18 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Zhao Zhili
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-12-29 8:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-29 8:18 [FFmpeg-devel] [PATCH] fftools/ffmpeg_filter: fix build failure on riscv (PR #21308) Zhao Zhili via ffmpeg-devel
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