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 <[email protected]> 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 -- [email protected] To unsubscribe send an email to [email protected]
