ffmpeg-cvslog
Threads by month
- ----- 2026 -----
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
September 2025
- 1 participants
- 195 discussions
[ffmpeg] branch master updated. db6cd6c6bf avformat/tls_openssl: Don't call functions inside FFMIN
by ffmpeg-git@ffmpeg.org 22 Sep '25
by ffmpeg-git@ffmpeg.org 22 Sep '25
22 Sep '25
The branch, master has been updated
via db6cd6c6bfe6f306dd8d9de2a0086586cbd27ec1 (commit)
from ced4a6ebc9e7cd92d0ca9b9fb8f9d1013d23cbfa (commit)
- Log -----------------------------------------------------------------
commit db6cd6c6bfe6f306dd8d9de2a0086586cbd27ec1
Author: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
AuthorDate: Mon Sep 22 15:34:30 2025 +0200
Commit: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
CommitDate: Mon Sep 22 21:58:00 2025 +0200
avformat/tls_openssl: Don't call functions inside FFMIN
It may call the function multiple times.
Reviewed-by: Timo Rothenpieler <timo(a)rothenpieler.org>
Reviewed-by: Steven Liu <lingjiujianke(a)gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
diff --git a/libavformat/tls_openssl.c b/libavformat/tls_openssl.c
index edfd657a3f..86b4d21799 100644
--- a/libavformat/tls_openssl.c
+++ b/libavformat/tls_openssl.c
@@ -939,8 +939,10 @@ static int tls_write(URLContext *h, const uint8_t *buf, int size)
uc->flags &= ~AVIO_FLAG_NONBLOCK;
uc->flags |= h->flags & AVIO_FLAG_NONBLOCK;
- if (s->is_dtls)
- size = FFMIN(size, DTLS_get_data_mtu(c->ssl));
+ if (s->is_dtls) {
+ const size_t mtu_size = DTLS_get_data_mtu(c->ssl);
+ size = FFMIN(size, mtu_size);
+ }
ret = SSL_write(c->ssl, buf, size);
if (ret > 0)
-----------------------------------------------------------------------
Summary of changes:
libavformat/tls_openssl.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
hooks/post-receive
--
1
0
[ffmpeg] branch master updated. ced4a6ebc9 libavutil/arm: Rename the HWCAP defines
by ffmpeg-git@ffmpeg.org 22 Sep '25
by ffmpeg-git@ffmpeg.org 22 Sep '25
22 Sep '25
The branch, master has been updated
via ced4a6ebc9e7cd92d0ca9b9fb8f9d1013d23cbfa (commit)
from cdae5c3639f4adcd289e643a203d43d4e01d87f5 (commit)
- Log -----------------------------------------------------------------
commit ced4a6ebc9e7cd92d0ca9b9fb8f9d1013d23cbfa
Author: Brad Smith <brad(a)comstyle.com>
AuthorDate: Mon Sep 22 07:28:21 2025 -0400
Commit: Brad Smith <brad(a)comstyle.com>
CommitDate: Mon Sep 22 07:28:21 2025 -0400
libavutil/arm: Rename the HWCAP defines
Rename the HWCAP defines to use the same naming scheme as AArch64 and PPC.
Signed-off-by: Brad Smith <brad(a)comstyle.com>
diff --git a/libavutil/arm/cpu.c b/libavutil/arm/cpu.c
index 8ec28143d7..2e2977efc9 100644
--- a/libavutil/arm/cpu.c
+++ b/libavutil/arm/cpu.c
@@ -47,12 +47,12 @@
#endif
/* Relevant HWCAP values from kernel headers */
-#define HWCAP_VFP (1 << 6)
-#define HWCAP_EDSP (1 << 7)
-#define HWCAP_THUMBEE (1 << 11)
-#define HWCAP_NEON (1 << 12)
-#define HWCAP_VFPv3 (1 << 13)
-#define HWCAP_TLS (1 << 15)
+#define HWCAP_ARM_VFP (1 << 6)
+#define HWCAP_ARM_EDSP (1 << 7)
+#define HWCAP_ARM_THUMBEE (1 << 11)
+#define HWCAP_ARM_NEON (1 << 12)
+#define HWCAP_ARM_VFPv3 (1 << 13)
+#define HWCAP_ARM_TLS (1 << 15)
static int get_auxval(uint32_t *hwcap)
{
@@ -101,19 +101,19 @@ static int get_cpuinfo(uint32_t *hwcap)
while (fgets(buf, sizeof(buf), f)) {
if (av_strstart(buf, "Features", NULL)) {
if (strstr(buf, " edsp "))
- *hwcap |= HWCAP_EDSP;
+ *hwcap |= HWCAP_ARM_EDSP;
if (strstr(buf, " tls "))
- *hwcap |= HWCAP_TLS;
+ *hwcap |= HWCAP_ARM_TLS;
if (strstr(buf, " thumbee "))
- *hwcap |= HWCAP_THUMBEE;
+ *hwcap |= HWCAP_ARM_THUMBEE;
if (strstr(buf, " vfp "))
- *hwcap |= HWCAP_VFP;
+ *hwcap |= HWCAP_ARM_VFP;
if (strstr(buf, " vfpv3 "))
- *hwcap |= HWCAP_VFPv3;
+ *hwcap |= HWCAP_ARM_VFPv3;
if (strstr(buf, " neon ") || strstr(buf, " asimd "))
- *hwcap |= HWCAP_NEON;
+ *hwcap |= HWCAP_ARM_NEON;
if (strstr(buf, " fp ")) // Listed on 64 bit ARMv8 kernels
- *hwcap |= HWCAP_VFP | HWCAP_VFPv3;
+ *hwcap |= HWCAP_ARM_VFP | HWCAP_ARM_VFPv3;
break;
}
}
@@ -135,7 +135,7 @@ int ff_get_cpu_flags_arm(void)
return flags;
#define check_cap(cap, flag) do { \
- if (hwcap & HWCAP_ ## cap) \
+ if (hwcap & HWCAP_ARM_ ## cap) \
flags |= AV_CPU_FLAG_ ## flag; \
} while (0)
-----------------------------------------------------------------------
Summary of changes:
libavutil/arm/cpu.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
hooks/post-receive
--
1
0
[ffmpeg] branch master updated. cdae5c3639 libavutil/arm: Make use of elf_aux_info() on FreeBSD/OpenBSD
by ffmpeg-git@ffmpeg.org 22 Sep '25
by ffmpeg-git@ffmpeg.org 22 Sep '25
22 Sep '25
The branch, master has been updated
via cdae5c3639f4adcd289e643a203d43d4e01d87f5 (commit)
from c9168717bf4c7d6f72d5cb02064ce832f4af9c89 (commit)
- Log -----------------------------------------------------------------
commit cdae5c3639f4adcd289e643a203d43d4e01d87f5
Author: Brad Smith <brad(a)comstyle.com>
AuthorDate: Sat Sep 20 23:06:08 2025 -0400
Commit: Brad Smith <brad(a)comstyle.com>
CommitDate: Mon Sep 22 07:16:24 2025 -0400
libavutil/arm: Make use of elf_aux_info() on FreeBSD/OpenBSD
- FreBSD/OpenBSD have elf_aux_info() on arm
- Wrap AT_HWCAP as the value is different for BSD vs Linux (16 vs 25)
Signed-off-by: Brad Smith <brad(a)comstyle.com>
diff --git a/libavutil/arm/cpu.c b/libavutil/arm/cpu.c
index b84882005a..8ec28143d7 100644
--- a/libavutil/arm/cpu.c
+++ b/libavutil/arm/cpu.c
@@ -31,18 +31,20 @@
CORE_FLAG(VFPV3) | \
CORE_FLAG(NEON))
-#if defined __linux__ || defined __ANDROID__
+#if defined __linux__ || defined __ANDROID__ || HAVE_ELF_AUX_INFO
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "libavutil/avstring.h"
-#if HAVE_GETAUXVAL
+#if HAVE_GETAUXVAL || HAVE_ELF_AUX_INFO
#include <sys/auxv.h>
#endif
+#ifndef AT_HWCAP
#define AT_HWCAP 16
+#endif
/* Relevant HWCAP values from kernel headers */
#define HWCAP_VFP (1 << 6)
@@ -54,7 +56,7 @@
static int get_auxval(uint32_t *hwcap)
{
-#if HAVE_GETAUXVAL
+#if HAVE_GETAUXVAL || HAVE_ELF_AUX_INFO
unsigned long ret = ff_getauxval(AT_HWCAP);
if (ret == 0)
return -1;
@@ -65,6 +67,7 @@ static int get_auxval(uint32_t *hwcap)
#endif
}
+#if defined __linux__ || defined __ANDROID__
static int get_hwcap(uint32_t *hwcap)
{
struct { uint32_t a_type; uint32_t a_val; } auxv;
@@ -117,6 +120,7 @@ static int get_cpuinfo(uint32_t *hwcap)
fclose(f);
return 0;
}
+#endif
int ff_get_cpu_flags_arm(void)
{
@@ -124,8 +128,10 @@ int ff_get_cpu_flags_arm(void)
uint32_t hwcap;
if (get_auxval(&hwcap) < 0)
+#if defined __linux__ || defined __ANDROID__
if (get_hwcap(&hwcap) < 0)
if (get_cpuinfo(&hwcap) < 0)
+#endif
return flags;
#define check_cap(cap, flag) do { \
-----------------------------------------------------------------------
Summary of changes:
libavutil/arm/cpu.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
hooks/post-receive
--
1
0
[ffmpeg] branch master updated. c9168717bf avcodec/h274: Make H274FilmGrainDatabase a shared object
by ffmpeg-git@ffmpeg.org 22 Sep '25
by ffmpeg-git@ffmpeg.org 22 Sep '25
22 Sep '25
The branch, master has been updated
via c9168717bf4c7d6f72d5cb02064ce832f4af9c89 (commit)
from b5e0d9f648712198e83566ea8a49498127f370d2 (commit)
- Log -----------------------------------------------------------------
commit c9168717bf4c7d6f72d5cb02064ce832f4af9c89
Author: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
AuthorDate: Thu Sep 18 17:57:16 2025 +0200
Commit: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
CommitDate: Mon Sep 22 04:54:22 2025 +0200
avcodec/h274: Make H274FilmGrainDatabase a shared object
Right now, the private contexts of every decoder supporting
H.274 film grain synthesis (namely H.264, HEVC and VVC)
contain a H274FilmGrainDatabase; said structure is very large
700442B before this commit) and takes up the overwhelming
majority of said contexts: Removing it reduces sizeof(H264Context)
by 92.88%, sizeof(HEVCContext) by 97.78% and sizeof(VVCContext)
by 99.86%. This is especially important for H.264 and HEVC
when using frame-threading.
The content of said film grain database does not depend on
any input parameter; it is shareable between all its users and
could be hardcoded in the binary (but isn't, because it is so huge).
This commit adds a database with static storage duration to h274.c
and uses it instead of the elements in the private contexts above.
It is still lazily initialized as-needed; a mutex is used
for the necessary synchronization. An alternative would be to use
an AV_ONCE to initialize the whole database either in the decoders'
init function (which would be wasteful given that most videos
don't use film grain synthesis) or in ff_h274_apply_film_grain().
Reviewed-by: Niklas Haas <ffmpeg(a)haasn.dev>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
diff --git a/libavcodec/h264_picture.c b/libavcodec/h264_picture.c
index f5d2b31cd6..aa3d2629c8 100644
--- a/libavcodec/h264_picture.c
+++ b/libavcodec/h264_picture.c
@@ -30,10 +30,10 @@
#include "error_resilience.h"
#include "avcodec.h"
#include "h264dec.h"
+#include "h274.h"
#include "hwaccel_internal.h"
#include "mpegutils.h"
#include "libavutil/refstruct.h"
-#include "thread.h"
#include "threadframe.h"
void ff_h264_unref_picture(H264Picture *pic)
@@ -213,7 +213,7 @@ int ff_h264_field_end(H264Context *h, H264SliceContext *sl, int in_setup)
err = AVERROR_INVALIDDATA;
if (sd) // a decoding error may have happened before the side data could be allocated
- err = ff_h274_apply_film_grain(cur->f_grain, cur->f, &h->h274db,
+ err = ff_h274_apply_film_grain(cur->f_grain, cur->f,
(AVFilmGrainParams *) sd->data);
if (err < 0) {
av_log(h->avctx, AV_LOG_WARNING, "Failed synthesizing film "
diff --git a/libavcodec/h264dec.h b/libavcodec/h264dec.h
index 1df99015cc..74fd09dfaa 100644
--- a/libavcodec/h264dec.h
+++ b/libavcodec/h264dec.h
@@ -28,7 +28,6 @@
#ifndef AVCODEC_H264DEC_H
#define AVCODEC_H264DEC_H
-#include "libavutil/buffer.h"
#include "libavutil/mem_internal.h"
#include "cabac.h"
@@ -41,7 +40,6 @@
#include "h264dsp.h"
#include "h264pred.h"
#include "h264qpel.h"
-#include "h274.h"
#include "mpegutils.h"
#include "threadframe.h"
#include "videodsp.h"
@@ -344,7 +342,6 @@ typedef struct H264Context {
H264DSPContext h264dsp;
H264ChromaContext h264chroma;
H264QpelContext h264qpel;
- H274FilmGrainDatabase h274db;
H264Picture DPB[H264_MAX_PICTURE_COUNT];
H264Picture *cur_pic_ptr;
diff --git a/libavcodec/h274.c b/libavcodec/h274.c
index 332d0c2c52..93ad2d1014 100644
--- a/libavcodec/h274.c
+++ b/libavcodec/h274.c
@@ -25,6 +25,8 @@
* @author Niklas Haas <ffmpeg(a)haasn.xyz>
*/
+#include <stdatomic.h>
+
#include "libavutil/avassert.h"
#include "libavutil/bswap.h"
#include "libavcodec/bswapdsp.h"
@@ -32,9 +34,18 @@
#include "libavutil/imgutils.h"
#include "libavutil/md5.h"
#include "libavutil/mem.h"
+#include "libavutil/thread.h"
#include "h274.h"
+typedef struct H274FilmGrainDatabase {
+ // Database of film grain patterns, lazily computed as-needed
+ int8_t db[13 /* h */][13 /* v */][64][64];
+ atomic_uint residency[6];
+} H274FilmGrainDatabase;
+
+static H274FilmGrainDatabase film_grain_db;
+
static const int8_t Gaussian_LUT[2048+4];
static const uint32_t Seed_LUT[256];
static const int8_t R64T[64][64];
@@ -47,8 +58,7 @@ static void prng_shift(uint32_t *state)
*state = (x << 1) | (feedback & 1u);
}
-static void init_slice_c(int8_t out[64][64], uint8_t h, uint8_t v,
- int16_t tmp[64][64])
+static void init_slice_c(int8_t out[64][64], uint8_t h, uint8_t v)
{
static const uint8_t deblock_factors[13] = {
64, 71, 77, 84, 90, 96, 103, 109, 116, 122, 128, 128, 128
@@ -57,6 +67,9 @@ static void init_slice_c(int8_t out[64][64], uint8_t h, uint8_t v,
const uint8_t deblock_coeff = deblock_factors[v];
const uint8_t freq_h = ((h + 3) << 2) - 1;
const uint8_t freq_v = ((v + 3) << 2) - 1;
+ // Temporary buffer for slice generation
+ // FIXME: Static or not?
+ static int16_t tmp[64][64];
uint32_t seed = Seed_LUT[h + v * 13];
// Initialize with random gaussian values, using the output array as a
@@ -106,13 +119,24 @@ static void init_slice_c(int8_t out[64][64], uint8_t h, uint8_t v,
}
}
-static void init_slice(H274FilmGrainDatabase *database, uint8_t h, uint8_t v)
+static void init_slice(uint8_t h, uint8_t v)
{
- if (database->residency[h] & (1 << v))
+ static AVMutex mutex = AV_MUTEX_INITIALIZER;
+ unsigned bitpos = h * 13 + v;
+ unsigned res = atomic_load_explicit(&film_grain_db.residency[bitpos / 32],
+ memory_order_acquire);
+
+ if (res & (1U << (bitpos & 31)))
return;
- database->residency[h] |= (1 << v);
- init_slice_c(database->db[h][v], h, v, database->slice_tmp);
+ ff_mutex_lock(&mutex);
+ res = atomic_load_explicit(&film_grain_db.residency[bitpos / 32], memory_order_relaxed);
+ if (!(res & (1U << (bitpos & 31)))) {
+ init_slice_c(film_grain_db.db[h][v], h, v);
+ atomic_store_explicit(&film_grain_db.residency[bitpos / 32],
+ res | (1U << (bitpos & 31)), memory_order_release);
+ }
+ ff_mutex_unlock(&mutex);
}
// Computes the average of an 8x8 block
@@ -160,7 +184,6 @@ static void deblock_8x8_c(int8_t *out, const int out_stride)
// deblocking step (note that this implies writing to the previous block).
static av_always_inline void generate(int8_t *out, int out_stride,
const uint8_t *in, int in_stride,
- H274FilmGrainDatabase *database,
const AVFilmGrainH274Params *h274,
int c, int invert, int deblock,
int y_offset, int x_offset)
@@ -198,14 +221,14 @@ static av_always_inline void generate(int8_t *out, int out_stride,
h = av_clip(h274->comp_model_value[c][s][1], 2, 14) - 2;
v = av_clip(h274->comp_model_value[c][s][2], 2, 14) - 2;
- init_slice(database, h, v);
+ init_slice(h, v);
scale = h274->comp_model_value[c][s][0];
if (invert)
scale = -scale;
synth_grain_8x8_c(out, out_stride, scale, shift,
- &database->db[h][v][y_offset][x_offset]);
+ &film_grain_db.db[h][v][y_offset][x_offset]);
if (deblock)
deblock_8x8_c(out, out_stride);
@@ -220,7 +243,6 @@ static void add_8x8_clip_c(uint8_t *out, const uint8_t *a, const int8_t *b,
}
int ff_h274_apply_film_grain(AVFrame *out_frame, const AVFrame *in_frame,
- H274FilmGrainDatabase *database,
const AVFilmGrainParams *params)
{
AVFilmGrainH274Params h274 = params->codec.h274;
@@ -275,7 +297,7 @@ int ff_h274_apply_film_grain(AVFrame *out_frame, const AVFrame *in_frame,
for (int xx = 0; xx < 16 && x+xx < width; xx += 8) {
generate(grain + (y+yy) * grain_stride + (x+xx), grain_stride,
in + (y+yy) * in_stride + (x+xx), in_stride,
- database, &h274, c, invert, (x+xx) > 0,
+ &h274, c, invert, (x+xx) > 0,
y_offset + yy, x_offset + xx);
}
}
diff --git a/libavcodec/h274.h b/libavcodec/h274.h
index 055dd591d2..7bbc3e8aa7 100644
--- a/libavcodec/h274.h
+++ b/libavcodec/h274.h
@@ -30,16 +30,6 @@
#include "libavutil/film_grain_params.h"
-// Must be initialized to {0} prior to first usage
-typedef struct H274FilmGrainDatabase {
- // Database of film grain patterns, lazily computed as-needed
- int8_t db[13 /* h */][13 /* v */][64][64];
- uint16_t residency[13 /* h */]; // bit field of v
-
- // Temporary buffer for slice generation
- int16_t slice_tmp[64][64];
-} H274FilmGrainDatabase;
-
/**
* Check whether ff_h274_apply_film_grain() supports the given parameter combination.
*
@@ -61,7 +51,6 @@ static inline int ff_h274_film_grain_params_supported(int model_id, enum AVPixel
// ff_h274_film_grain_params_supported() coincide with actual values
// from the frames and params.
int ff_h274_apply_film_grain(AVFrame *out, const AVFrame *in,
- H274FilmGrainDatabase *db,
const AVFilmGrainParams *params);
typedef struct H274HashContext H274HashContext;
diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c
index ba12d84474..b27d1d79e8 100644
--- a/libavcodec/hevc/hevcdec.c
+++ b/libavcodec/hevc/hevcdec.c
@@ -45,6 +45,7 @@
#include "codec_internal.h"
#include "decode.h"
#include "golomb.h"
+#include "h274.h"
#include "hevc.h"
#include "parse.h"
#include "hevcdec.h"
@@ -3496,8 +3497,7 @@ static int hevc_frame_end(HEVCContext *s, HEVCLayerContext *l)
av_assert0(0);
return AVERROR_BUG;
case AV_FILM_GRAIN_PARAMS_H274:
- ret = ff_h274_apply_film_grain(out->frame_grain, out->f,
- &s->h274db, fgp);
+ ret = ff_h274_apply_film_grain(out->frame_grain, out->f, fgp);
break;
case AV_FILM_GRAIN_PARAMS_AV1:
ret = ff_aom_apply_film_grain(out->frame_grain, out->f, fgp);
diff --git a/libavcodec/hevc/hevcdec.h b/libavcodec/hevc/hevcdec.h
index 911d5c3ae3..8394740c4b 100644
--- a/libavcodec/hevc/hevcdec.h
+++ b/libavcodec/hevc/hevcdec.h
@@ -32,9 +32,7 @@
#include "libavcodec/bswapdsp.h"
#include "libavcodec/cabac.h"
#include "libavcodec/dovi_rpu.h"
-#include "libavcodec/get_bits.h"
#include "libavcodec/h2645_parse.h"
-#include "libavcodec/h274.h"
#include "libavcodec/progressframe.h"
#include "libavcodec/videodsp.h"
@@ -537,7 +535,6 @@ typedef struct HEVCContext {
HEVCDSPContext hevcdsp;
VideoDSPContext vdsp;
BswapDSPContext bdsp;
- H274FilmGrainDatabase h274db;
/** used on BE to byteswap the lines for checksumming */
uint8_t *checksum_buf;
diff --git a/libavcodec/vvc/dec.c b/libavcodec/vvc/dec.c
index 6f52306080..b31fceef40 100644
--- a/libavcodec/vvc/dec.c
+++ b/libavcodec/vvc/dec.c
@@ -1091,8 +1091,7 @@ static int frame_end(VVCContext *s, VVCFrameContext *fc)
av_assert0(0);
return AVERROR_BUG;
case AV_FILM_GRAIN_PARAMS_H274:
- ret = ff_h274_apply_film_grain(fc->ref->frame_grain, fc->ref->frame,
- &s->h274db, fgp);
+ ret = ff_h274_apply_film_grain(fc->ref->frame_grain, fc->ref->frame, fgp);
if (ret < 0)
return ret;
break;
diff --git a/libavcodec/vvc/dec.h b/libavcodec/vvc/dec.h
index 5f8065b38b..bfb8a2e20d 100644
--- a/libavcodec/vvc/dec.h
+++ b/libavcodec/vvc/dec.h
@@ -222,7 +222,6 @@ typedef struct VVCContext {
CodedBitstreamFragment current_frame;
VVCParamSets ps;
- H274FilmGrainDatabase h274db;
int temporal_id; ///< temporal_id_plus1 - 1
int poc_tid0;
-----------------------------------------------------------------------
Summary of changes:
libavcodec/h264_picture.c | 4 ++--
libavcodec/h264dec.h | 3 ---
libavcodec/h274.c | 44 +++++++++++++++++++++++++++++++++-----------
libavcodec/h274.h | 11 -----------
libavcodec/hevc/hevcdec.c | 4 ++--
libavcodec/hevc/hevcdec.h | 3 ---
libavcodec/vvc/dec.c | 3 +--
libavcodec/vvc/dec.h | 1 -
8 files changed, 38 insertions(+), 35 deletions(-)
hooks/post-receive
--
1
0
[ffmpeg] branch master updated. b5e0d9f648 fftools/opt_common: add separator line to show_filters output
by ffmpeg-git@ffmpeg.org 22 Sep '25
by ffmpeg-git@ffmpeg.org 22 Sep '25
22 Sep '25
The branch, master has been updated
via b5e0d9f648712198e83566ea8a49498127f370d2 (commit)
from f1a155d9754f2f38da121b8935ea1a5483021a5a (commit)
- Log -----------------------------------------------------------------
commit b5e0d9f648712198e83566ea8a49498127f370d2
Author: zhanghongyuan <zhanghongyuan(a)uniontech.com>
AuthorDate: Tue Sep 2 15:03:39 2025 +0800
Commit: Zhao Zhili <quink(a)noreply.code.ffmpeg.org>
CommitDate: Mon Sep 22 02:47:40 2025 +0000
fftools/opt_common: add separator line to show_filters output
Add a separator line to show_filters() function output to maintain
consistent formatting with other show functions like show_codecs,
show_formats_devices, etc. This provides uniform formatting across
all command-line output functions for better readability and
parsing by external tools.
diff --git a/fftools/opt_common.c b/fftools/opt_common.c
index 5dcb14e261..e217456be7 100644
--- a/fftools/opt_common.c
+++ b/fftools/opt_common.c
@@ -809,7 +809,8 @@ int show_filters(void *optctx, const char *opt, const char *arg)
" A = Audio input/output\n"
" V = Video input/output\n"
" N = Dynamic number and/or type of input/output\n"
- " | = Source or sink filter\n");
+ " | = Source or sink filter\n"
+ " ------\n");
while ((filter = av_filter_iterate(&opaque))) {
descr_cur = descr;
for (i = 0; i < 2; i++) {
-----------------------------------------------------------------------
Summary of changes:
fftools/opt_common.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
hooks/post-receive
--
1
0
[ffmpeg] branch master updated. f1a155d975 avcodec/aarch64/vvc: Optimize dmvr_hv_10
by ffmpeg-git@ffmpeg.org 21 Sep '25
by ffmpeg-git@ffmpeg.org 21 Sep '25
21 Sep '25
The branch, master has been updated
via f1a155d9754f2f38da121b8935ea1a5483021a5a (commit)
from 0bd5a7d3719456f049f4d29abb313968ccacb28c (commit)
- Log -----------------------------------------------------------------
commit f1a155d9754f2f38da121b8935ea1a5483021a5a
Author: Krzysztof Pyrkosz <ffmpeg(a)szaka.eu>
AuthorDate: Fri Sep 5 19:52:11 2025 +0200
Commit: Martin Storsjö <martin(a)martin.st>
CommitDate: Sun Sep 21 19:39:27 2025 +0000
avcodec/aarch64/vvc: Optimize dmvr_hv_10
Before and after on A53:
dmvr_hv_10_12x20_neon: 1838.2 ( 3.02x)
dmvr_hv_10_20x12_neon: 1330.2 ( 1.83x)
dmvr_hv_10_20x20_neon: 2148.2 ( 1.85x)
dmvr_hv_12_12x20_neon: 1839.2 ( 3.02x)
dmvr_hv_12_20x12_neon: 1330.6 ( 1.83x)
dmvr_hv_12_20x20_neon: 2147.2 ( 1.85x)
dmvr_hv_10_12x20_neon: 1755.0 ( 3.17x)
dmvr_hv_10_20x12_neon: 1165.8 ( 2.09x)
dmvr_hv_10_20x20_neon: 1876.1 ( 2.12x)
dmvr_hv_12_12x20_neon: 1754.4 ( 3.17x)
dmvr_hv_12_20x12_neon: 1167.8 ( 2.09x)
dmvr_hv_12_20x20_neon: 1878.8 ( 2.12x)
diff --git a/libavcodec/aarch64/vvc/inter.S b/libavcodec/aarch64/vvc/inter.S
index 01d2ff155c..79ff720cdd 100644
--- a/libavcodec/aarch64/vvc/inter.S
+++ b/libavcodec/aarch64/vvc/inter.S
@@ -599,18 +599,13 @@ function ff_vvc_dmvr_hv_8_neon, export=1
endfunc
function ff_vvc_dmvr_hv_12_neon, export=1
- movi v29.4s, #(12 - 6)
- movi v30.4s, #(1 << (12 - 7)) // offset1
+ mvni v29.4s, #(12 - 6 - 1)
b 0f
endfunc
function ff_vvc_dmvr_hv_10_neon, export=1
- movi v29.4s, #(10 - 6)
- movi v30.4s, #(1 << (10 - 7)) // offset1
+ mvni v29.4s, #(10 - 6 - 1)
0:
- movi v31.4s, #8 // offset2
- neg v29.4s, v29.4s
-
sub sp, sp, #(VVC_MAX_PB_SIZE * 4)
movrel x9, X(ff_vvc_inter_luma_dmvr_filters)
@@ -626,7 +621,6 @@ function ff_vvc_dmvr_hv_10_neon, export=1
add x12, x9, my, lsl #1
ldrb w10, [x12]
ldrb w11, [x12, #1]
- sxtw x6, w6
dup v2.8h, w10 // filter_y[0]
dup v3.8h, w11 // filter_y[1]
@@ -635,7 +629,7 @@ function ff_vvc_dmvr_hv_10_neon, export=1
mov w10, #0 // start filter_y or not
add height, height, #1
sub dst, dst, #(VVC_MAX_PB_SIZE * 2)
- sub src_stride, src_stride, x6, lsl #1
+ sub src_stride, src_stride, w6, sxtw #1
cset w15, gt // width > 16
1:
mov x12, tmp0
@@ -656,14 +650,10 @@ function ff_vvc_dmvr_hv_10_neon, export=1
umlal v18.4s, v17.4h, v1.4h
umlal2 v19.4s, v17.8h, v1.8h
- add v4.4s, v4.4s, v30.4s
- add v5.4s, v5.4s, v30.4s
- add v18.4s, v18.4s, v30.4s
- add v19.4s, v19.4s, v30.4s
- ushl v4.4s, v4.4s, v29.4s
- ushl v5.4s, v5.4s, v29.4s
- ushl v18.4s, v18.4s, v29.4s
- ushl v19.4s, v19.4s, v29.4s
+ urshl v4.4s, v4.4s, v29.4s
+ urshl v5.4s, v5.4s, v29.4s
+ urshl v18.4s, v18.4s, v29.4s
+ urshl v19.4s, v19.4s, v29.4s
uqxtn v6.4h, v4.4s
uqxtn2 v6.8h, v5.4s
uqxtn v7.4h, v18.4s
@@ -681,18 +671,10 @@ function ff_vvc_dmvr_hv_10_neon, export=1
umlal2 v18.4s, v6.8h, v3.8h
umlal v19.4s, v7.4h, v3.4h
umlal2 v20.4s, v7.8h, v3.8h
- add v17.4s, v17.4s, v31.4s
- add v18.4s, v18.4s, v31.4s
- add v19.4s, v19.4s, v31.4s
- add v20.4s, v20.4s, v31.4s
- ushr v17.4s, v17.4s, #4
- ushr v18.4s, v18.4s, #4
- ushr v19.4s, v19.4s, #4
- ushr v20.4s, v20.4s, #4
- uqxtn v6.4h, v17.4s
- uqxtn2 v6.8h, v18.4s
- uqxtn v7.4h, v19.4s
- uqxtn2 v7.8h, v20.4s
+ uqrshrn v6.4h, v17.4s, #4
+ uqrshrn2 v6.8h, v18.4s, #4
+ uqrshrn v7.4h, v19.4s, #4
+ uqrshrn2 v7.8h, v20.4s, #4
stp q6, q7, [x14], #32
b 3f
2:
@@ -704,10 +686,8 @@ function ff_vvc_dmvr_hv_10_neon, export=1
umlal v4.4s, v7.4h, v1.4h
umlal2 v5.4s, v7.8h, v1.8h
- add v4.4s, v4.4s, v30.4s
- add v5.4s, v5.4s, v30.4s
- ushl v4.4s, v4.4s, v29.4s
- ushl v5.4s, v5.4s, v29.4s
+ urshl v4.4s, v4.4s, v29.4s
+ urshl v5.4s, v5.4s, v29.4s
uqxtn v6.4h, v4.4s
uqxtn2 v6.8h, v5.4s
str q6, [x13], #16
@@ -719,10 +699,8 @@ function ff_vvc_dmvr_hv_10_neon, export=1
umull2 v18.4s, v16.8h, v2.8h
umlal v17.4s, v6.4h, v3.4h
umlal2 v18.4s, v6.8h, v3.8h
- add v17.4s, v17.4s, v31.4s
- add v18.4s, v18.4s, v31.4s
- ushr v17.4s, v17.4s, #4
- ushr v18.4s, v18.4s, #4
+ urshr v17.4s, v17.4s, #4
+ urshr v18.4s, v18.4s, #4
uqxtn v16.4h, v17.4s
uqxtn2 v16.8h, v18.4s
str q16, [x14], #16
@@ -731,8 +709,7 @@ function ff_vvc_dmvr_hv_10_neon, export=1
ldr d6, [src], #8
umull v4.4s, v7.4h, v1.4h
umlal v4.4s, v6.4h, v0.4h
- add v4.4s, v4.4s, v30.4s
- ushl v4.4s, v4.4s, v29.4s
+ urshl v4.4s, v4.4s, v29.4s
uqxtn v6.4h, v4.4s
str d6, [x13], #8
@@ -741,8 +718,7 @@ function ff_vvc_dmvr_hv_10_neon, export=1
ldr d16, [x12], #8
umull v17.4s, v16.4h, v2.4h
umlal v17.4s, v6.4h, v3.4h
- add v17.4s, v17.4s, v31.4s
- ushr v17.4s, v17.4s, #4
+ urshr v17.4s, v17.4s, #4
uqxtn v16.4h, v17.4s
str d16, [x14], #8
4:
-----------------------------------------------------------------------
Summary of changes:
libavcodec/aarch64/vvc/inter.S | 58 +++++++++++++-----------------------------
1 file changed, 17 insertions(+), 41 deletions(-)
hooks/post-receive
--
1
0
[ffmpeg] branch master updated. 0bd5a7d371 avfilter/vf_colordetect: only report detected properties on EOF
by ffmpeg-git@ffmpeg.org 21 Sep '25
by ffmpeg-git@ffmpeg.org 21 Sep '25
21 Sep '25
The branch, master has been updated
via 0bd5a7d3719456f049f4d29abb313968ccacb28c (commit)
from 843920d5d6bdcecbfd4eeac66cd175348bf99496 (commit)
- Log -----------------------------------------------------------------
commit 0bd5a7d3719456f049f4d29abb313968ccacb28c
Author: Niklas Haas <git(a)haasn.dev>
AuthorDate: Sun Sep 21 13:28:58 2025 +0200
Commit: Niklas Haas <git(a)haasn.dev>
CommitDate: Sun Sep 21 13:28:58 2025 +0200
avfilter/vf_colordetect: only report detected properties on EOF
Instead of reporting them also when the filtergraph is suddenly destroyed
mid-stream, e.g. during the `ffmpeg` tool's early init.
diff --git a/libavfilter/vf_colordetect.c b/libavfilter/vf_colordetect.c
index 14b75b72ce..cfe7753ca3 100644
--- a/libavfilter/vf_colordetect.c
+++ b/libavfilter/vf_colordetect.c
@@ -207,7 +207,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
return ff_filter_frame(inlink->dst->outputs[0], in);
}
-static av_cold void uninit(AVFilterContext *ctx)
+static av_cold void report_detected_props(AVFilterContext *ctx)
{
ColorDetectContext *s = ctx->priv;
if (!s->mode)
@@ -233,12 +233,43 @@ static av_cold void uninit(AVFilterContext *ctx)
}
}
+static int activate(AVFilterContext *ctx)
+{
+ AVFilterLink *inlink = ctx->inputs[0];
+ AVFilterLink *outlink = ctx->outputs[0];
+ AVFrame *frame;
+ int64_t pts;
+ int ret;
+
+ ret = ff_outlink_get_status(outlink);
+ if (ret) {
+ ff_inlink_set_status(inlink, ret);
+ report_detected_props(ctx);
+ return 0;
+ }
+
+ ret = ff_inlink_consume_frame(inlink, &frame);
+ if (ret < 0) {
+ return ret;
+ } else if (ret) {
+ return filter_frame(inlink, frame);
+ }
+
+ if (ff_inlink_acknowledge_status(inlink, &ret, &pts)) {
+ ff_outlink_set_status(outlink, ret, pts);
+ report_detected_props(ctx);
+ return 0;
+ }
+
+ FF_FILTER_FORWARD_WANTED(outlink, inlink);
+ return FFERROR_NOT_READY;
+}
+
static const AVFilterPad colordetect_inputs[] = {
{
.name = "default",
.type = AVMEDIA_TYPE_VIDEO,
.config_props = config_input,
- .filter_frame = filter_frame,
},
};
@@ -251,5 +282,5 @@ const FFFilter ff_vf_colordetect = {
FILTER_INPUTS(colordetect_inputs),
FILTER_OUTPUTS(ff_video_default_filterpad),
FILTER_QUERY_FUNC2(query_format),
- .uninit = uninit,
+ .activate = activate,
};
-----------------------------------------------------------------------
Summary of changes:
libavfilter/vf_colordetect.c | 37 ++++++++++++++++++++++++++++++++++---
1 file changed, 34 insertions(+), 3 deletions(-)
hooks/post-receive
--
1
0
[ffmpeg] branch master updated. 843920d5d6 avfilter/x86/vf_idetdsp: add AVX2 and AVX512 implementations
by ffmpeg-git@ffmpeg.org 21 Sep '25
by ffmpeg-git@ffmpeg.org 21 Sep '25
21 Sep '25
The branch, master has been updated
via 843920d5d6bdcecbfd4eeac66cd175348bf99496 (commit)
via 4c067d0778c932ab85f35cc4c07ace9d612e1905 (commit)
via 00e05bcd681a21637b1eed4cd13ff3797d9df97a (commit)
via 326abf359f72c0daf74c332bc05c65d7b3a5da0b (commit)
via 60dbcc5321feace40d80550fde1465788b416df2 (commit)
via 56bb187ca915642358b8527029139628771837cb (commit)
via 2b67137daa488b2de4c86fd025ab9db576a1fb9a (commit)
via 5830743363490d39d9f9b4acd4c4aceb73c14d0c (commit)
via 367febc491bceaf9aa95ba5fb9c2ca9b38f9208d (commit)
from e02e6d54b04aaed3a500e55fd53da6dd411074d8 (commit)
- Log -----------------------------------------------------------------
commit 843920d5d6bdcecbfd4eeac66cd175348bf99496
Author: Niklas Haas <git(a)haasn.dev>
AuthorDate: Mon Sep 15 17:47:39 2025 +0200
Commit: Niklas Haas <ffmpeg(a)haasn.dev>
CommitDate: Sun Sep 21 11:02:41 2025 +0000
avfilter/x86/vf_idetdsp: add AVX2 and AVX512 implementations
The only thing that changes slightly is the horizontal sum at the end.
diff --git a/libavfilter/x86/vf_idetdsp.asm b/libavfilter/x86/vf_idetdsp.asm
index 63d9f4533d..12d65000ab 100644
--- a/libavfilter/x86/vf_idetdsp.asm
+++ b/libavfilter/x86/vf_idetdsp.asm
@@ -39,7 +39,7 @@ SECTION .text
paddd %1, %2
%endmacro
-%macro IDET_FILTER_LINE_16BIT 1 ; %1=increment (4 or 8 words)
+%macro IDET_FILTER_LINE_16BIT 0
cglobal idet_filter_line_16bit, 4, 5, 8, a, b, c, width, index
xor indexq, indexq
%define m_zero m1
@@ -54,7 +54,7 @@ cglobal idet_filter_line_16bit, 4, 5, 8, a, b, c, width, index
psubusw m5, m2, m3 ; ba
movu m4, [cq + indexq * 2] ; C
- add indexq, %1
+ add indexq, mmsize >> 1
psubusw m3, m2 ; ab
CMP indexd, widthd
@@ -67,13 +67,23 @@ cglobal idet_filter_line_16bit, 4, 5, 8, a, b, c, width, index
paddd m_sum, m5
jl .loop_16bit
+%if mmsize > 32
+ vextracti64x4 ym1, m0, 1
+ paddq ym0, ym1
+%endif
HADDD m_sum, m2
movd eax, m_sum
RET
%endmacro
INIT_XMM sse2
-IDET_FILTER_LINE_16BIT 8
+IDET_FILTER_LINE_16BIT
+
+INIT_XMM avx2
+IDET_FILTER_LINE_16BIT
+
+INIT_XMM avx512icl
+IDET_FILTER_LINE_16BIT
;******************************************************************************
; SSE2 8-bit implementation that does 16-bytes at a time:
@@ -106,11 +116,25 @@ cglobal idet_filter_line, 4, 6, 7, a, b, c, width, index, total
jl .sse2_loop
paddq m0, m1
- movhlps m1, m0
- paddq m0, m1
- movd eax, m0
+%if mmsize > 32
+ vextracti64x4 ym1, m0, 1
+ paddq ym0, ym1
+%endif
+%if mmsize > 16
+ vextracti128 xm1, ym0, 1
+ paddq xm0, xm1
+%endif
+ movhlps xm1, xm0
+ paddq xm0, xm1
+ movd eax, xm0
RET
%endmacro
INIT_XMM sse2
IDET_FILTER_LINE
+
+INIT_YMM avx2
+IDET_FILTER_LINE
+
+INIT_ZMM avx512icl
+IDET_FILTER_LINE
diff --git a/libavfilter/x86/vf_idetdsp_init.c b/libavfilter/x86/vf_idetdsp_init.c
index e49b01a68c..1f4c2e2bc3 100644
--- a/libavfilter/x86/vf_idetdsp_init.c
+++ b/libavfilter/x86/vf_idetdsp_init.c
@@ -62,6 +62,12 @@ static int idet_filter_line_16bit_##KIND(const uint8_t *a, const uint8_t *b, \
FUNC_MAIN_DECL(sse2, 16)
FUNC_MAIN_DECL_16bit(sse2, 8)
+FUNC_MAIN_DECL(avx2, 32)
+FUNC_MAIN_DECL_16bit(avx2, 16)
+
+FUNC_MAIN_DECL(avx512icl, 64)
+FUNC_MAIN_DECL_16bit(avx512icl, 32)
+
#endif
av_cold void ff_idet_dsp_init_x86(IDETDSPContext *dsp, int depth)
{
@@ -71,5 +77,11 @@ av_cold void ff_idet_dsp_init_x86(IDETDSPContext *dsp, int depth)
if (EXTERNAL_SSE2(cpu_flags)) {
dsp->filter_line = depth > 8 ? idet_filter_line_16bit_sse2 : idet_filter_line_sse2;
}
+ if (EXTERNAL_AVX2(cpu_flags)) {
+ dsp->filter_line = depth > 8 ? idet_filter_line_16bit_avx2 : idet_filter_line_avx2;
+ }
+ if (EXTERNAL_AVX512ICL(cpu_flags)) {
+ dsp->filter_line = depth > 8 ? idet_filter_line_16bit_avx512icl : idet_filter_line_avx512icl;
+ }
#endif // HAVE_X86ASM
}
commit 4c067d0778c932ab85f35cc4c07ace9d612e1905
Author: Niklas Haas <git(a)haasn.dev>
AuthorDate: Mon Sep 15 17:20:17 2025 +0200
Commit: Niklas Haas <ffmpeg(a)haasn.dev>
CommitDate: Sun Sep 21 11:02:41 2025 +0000
avfilter/x86/vf_idetdsp: generalize 8-bit macro
This is mostly compatible with AVX as well, so turn it into a macro.
diff --git a/libavfilter/x86/vf_idetdsp.asm b/libavfilter/x86/vf_idetdsp.asm
index 7bc8e7d2c4..63d9f4533d 100644
--- a/libavfilter/x86/vf_idetdsp.asm
+++ b/libavfilter/x86/vf_idetdsp.asm
@@ -78,7 +78,7 @@ IDET_FILTER_LINE_16BIT 8
;******************************************************************************
; SSE2 8-bit implementation that does 16-bytes at a time:
-INIT_XMM sse2
+%macro IDET_FILTER_LINE 0
cglobal idet_filter_line, 4, 6, 7, a, b, c, width, index, total
xor indexq, indexq
pxor m0, m0
@@ -92,7 +92,7 @@ cglobal idet_filter_line, 4, 6, 7, a, b, c, width, index, total
psubusb m5, m2, m3 ; ba
movu m3, [cq + indexq*1] ; C
- add indexq, 0x10
+ add indexq, mmsize
psubusb m4, m2 ; ab
CMP indexd, widthd
@@ -110,3 +110,7 @@ cglobal idet_filter_line, 4, 6, 7, a, b, c, width, index, total
paddq m0, m1
movd eax, m0
RET
+%endmacro
+
+INIT_XMM sse2
+IDET_FILTER_LINE
commit 00e05bcd681a21637b1eed4cd13ff3797d9df97a
Author: Niklas Haas <git(a)haasn.dev>
AuthorDate: Mon Sep 15 18:10:43 2025 +0200
Commit: Niklas Haas <ffmpeg(a)haasn.dev>
CommitDate: Sun Sep 21 11:02:41 2025 +0000
tests/checkasm: add vf_idet checkasm
diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile
index 9f1dd57fa6..0a54adc96a 100644
--- a/tests/checkasm/Makefile
+++ b/tests/checkasm/Makefile
@@ -62,6 +62,7 @@ AVFILTEROBJS-$(CONFIG_COLORSPACE_FILTER) += vf_colorspace.o
AVFILTEROBJS-$(CONFIG_EQ_FILTER) += vf_eq.o
AVFILTEROBJS-$(CONFIG_GBLUR_FILTER) += vf_gblur.o
AVFILTEROBJS-$(CONFIG_HFLIP_FILTER) += vf_hflip.o
+AVFILTEROBJS-$(CONFIG_IDET_FILTER) += vf_idet.o
AVFILTEROBJS-$(CONFIG_THRESHOLD_FILTER) += vf_threshold.o
AVFILTEROBJS-$(CONFIG_NLMEANS_FILTER) += vf_nlmeans.o
AVFILTEROBJS-$(CONFIG_SOBEL_FILTER) += vf_convolution.o
diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
index 5312d02909..ad4d9b53b6 100644
--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -290,6 +290,9 @@ static const struct {
#if CONFIG_HFLIP_FILTER
{ "vf_hflip", checkasm_check_vf_hflip },
#endif
+ #if CONFIG_IDET_FILTER
+ { "vf_idet", checkasm_check_idet },
+ #endif
#if CONFIG_NLMEANS_FILTER
{ "vf_nlmeans", checkasm_check_nlmeans },
#endif
diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h
index bb6b413aba..1684c427d6 100644
--- a/tests/checkasm/checkasm.h
+++ b/tests/checkasm/checkasm.h
@@ -112,6 +112,7 @@ void checkasm_check_hevc_pel(void);
void checkasm_check_hevc_sao(void);
void checkasm_check_huffyuvdsp(void);
void checkasm_check_idctdsp(void);
+void checkasm_check_idet(void);
void checkasm_check_jpeg2000dsp(void);
void checkasm_check_llauddsp(void);
void checkasm_check_lls(void);
diff --git a/tests/checkasm/vf_idet.c b/tests/checkasm/vf_idet.c
new file mode 100644
index 0000000000..4bc0f5c846
--- /dev/null
+++ b/tests/checkasm/vf_idet.c
@@ -0,0 +1,65 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "checkasm.h"
+
+#include "libavfilter/vf_idetdsp.h"
+#include "libavutil/mem_internal.h"
+
+#define WIDTH 512
+
+static void check_idet(int depth)
+{
+ IDETDSPContext dsp;
+
+ LOCAL_ALIGNED_32(uint8_t, in0, [WIDTH]);
+ LOCAL_ALIGNED_32(uint8_t, in1, [WIDTH]);
+ LOCAL_ALIGNED_32(uint8_t, in2, [WIDTH]);
+
+ declare_func(int, const uint8_t *a, const uint8_t *b,
+ const uint8_t *c, int w);
+
+ ff_idet_dsp_init(&dsp, depth > 8);
+
+ for (int x = 0; x < WIDTH; x++) {
+ in0[x] = rnd() & 0xFF;
+ in1[x] = rnd() & 0xFF;
+ in2[x] = rnd() & 0xFF;
+ }
+
+ if (check_func(dsp.filter_line, "idet%d", depth)) {
+ /* Ensure odd tail is handled correctly */
+ int res_ref = call_ref(in0, in1, in2, WIDTH - 8);
+ int res_new = call_new(in0, in1, in2, WIDTH - 8);
+ if (res_ref != res_new) {
+ fprintf(stderr, "idet%d: result mismatch: %u != %u\n",
+ depth, res_ref, res_new);
+ fail();
+ }
+ bench_new(in0, in1, in2, WIDTH);
+ }
+}
+
+void checkasm_check_idet(void)
+{
+ check_idet(8);
+ report("idet8");
+
+ check_idet(16);
+ report("idet16");
+}
commit 326abf359f72c0daf74c332bc05c65d7b3a5da0b
Author: Niklas Haas <git(a)haasn.dev>
AuthorDate: Tue Sep 16 14:23:31 2025 +0200
Commit: Niklas Haas <ffmpeg(a)haasn.dev>
CommitDate: Sun Sep 21 11:02:41 2025 +0000
avfilter/vf_idetdsp: use consistent uint8_t pointer type
Even for 16-bit DSP functions. Instead, cast the pointer inside the
function.
diff --git a/libavfilter/vf_idetdsp.c b/libavfilter/vf_idetdsp.c
index b6a095bcd8..68a2a267d4 100644
--- a/libavfilter/vf_idetdsp.c
+++ b/libavfilter/vf_idetdsp.c
@@ -36,13 +36,17 @@ int ff_idet_filter_line_c(const uint8_t *a, const uint8_t *b, const uint8_t *c,
return ret;
}
-int ff_idet_filter_line_c_16bit(const uint16_t *a, const uint16_t *b, const uint16_t *c, int w)
+int ff_idet_filter_line_c_16bit(const uint8_t *a, const uint8_t *b, const uint8_t *c, int w)
{
int x;
int ret=0;
+ const uint16_t *a16 = (const uint16_t *) a;
+ const uint16_t *b16 = (const uint16_t *) b;
+ const uint16_t *c16 = (const uint16_t *) c;
+
for(x=0; x<w; x++){
- int v = (*a++ + *c++) - 2 * *b++;
+ int v = (*a16++ + *c16++) - 2 * *b16++;
ret += FFABS(v);
}
@@ -51,7 +55,7 @@ int ff_idet_filter_line_c_16bit(const uint16_t *a, const uint16_t *b, const uint
void av_cold ff_idet_dsp_init(IDETDSPContext *dsp, int depth)
{
- dsp->filter_line = depth > 8 ? (ff_idet_filter_func)ff_idet_filter_line_c_16bit : ff_idet_filter_line_c;
+ dsp->filter_line = depth > 8 ? ff_idet_filter_line_c_16bit : ff_idet_filter_line_c;
#if ARCH_X86
ff_idet_dsp_init_x86(dsp, depth);
#endif
diff --git a/libavfilter/vf_idetdsp.h b/libavfilter/vf_idetdsp.h
index d31caa7aa8..174d77c171 100644
--- a/libavfilter/vf_idetdsp.h
+++ b/libavfilter/vf_idetdsp.h
@@ -33,6 +33,6 @@ void ff_idet_dsp_init_x86(IDETDSPContext *idet, int depth);
/* main fall-back for left-over */
int ff_idet_filter_line_c(const uint8_t *a, const uint8_t *b, const uint8_t *c, int w);
-int ff_idet_filter_line_c_16bit(const uint16_t *a, const uint16_t *b, const uint16_t *c, int w);
+int ff_idet_filter_line_c_16bit(const uint8_t *a, const uint8_t *b, const uint8_t *c, int w);
#endif /* AVFILTER_IDETDSP_H */
diff --git a/libavfilter/x86/vf_idetdsp_init.c b/libavfilter/x86/vf_idetdsp_init.c
index 710d97a6b4..e49b01a68c 100644
--- a/libavfilter/x86/vf_idetdsp_init.c
+++ b/libavfilter/x86/vf_idetdsp_init.c
@@ -42,17 +42,20 @@ static int idet_filter_line_##KIND(const uint8_t *a, const uint8_t *b, \
#define FUNC_MAIN_DECL_16bit(KIND, SPAN) \
-int ff_idet_filter_line_16bit_##KIND(const uint16_t *a, const uint16_t *b, \
- const uint16_t *c, int w); \
-static int idet_filter_line_16bit_##KIND(const uint16_t *a, const uint16_t *b, \
- const uint16_t *c, int w) { \
+int ff_idet_filter_line_16bit_##KIND(const uint8_t *a, const uint8_t *b, \
+ const uint8_t *c, int w); \
+static int idet_filter_line_16bit_##KIND(const uint8_t *a, const uint8_t *b, \
+ const uint8_t *c, int w) { \
int sum = 0; \
const int left_over = w & (SPAN - 1); \
- w -= left_over; \
- if (w > 0) \
- sum += ff_idet_filter_line_16bit_##KIND(a, b, c, w); \
- if (left_over > 0) \
- sum += ff_idet_filter_line_c_16bit(a + w, b + w, c + w, left_over); \
+ const int w_main = w - left_over; \
+ const int offset = w_main << 1; \
+ if (w_main > 0) \
+ sum += ff_idet_filter_line_16bit_##KIND(a, b, c, w_main); \
+ if (left_over > 0) { \
+ sum += ff_idet_filter_line_c_16bit(a + offset, b + offset, c + offset, \
+ left_over); \
+ } \
return sum; \
}
@@ -66,7 +69,7 @@ av_cold void ff_idet_dsp_init_x86(IDETDSPContext *dsp, int depth)
const int cpu_flags = av_get_cpu_flags();
if (EXTERNAL_SSE2(cpu_flags)) {
- dsp->filter_line = depth > 8 ? (ff_idet_filter_func)idet_filter_line_16bit_sse2 : idet_filter_line_sse2;
+ dsp->filter_line = depth > 8 ? idet_filter_line_16bit_sse2 : idet_filter_line_sse2;
}
#endif // HAVE_X86ASM
}
commit 60dbcc5321feace40d80550fde1465788b416df2
Author: Niklas Haas <git(a)haasn.dev>
AuthorDate: Tue Sep 16 14:17:14 2025 +0200
Commit: Niklas Haas <ffmpeg(a)haasn.dev>
CommitDate: Sun Sep 21 11:02:41 2025 +0000
avfilter/vf_idetdsp: pass actual bit depth
More informative and IMO cleaner; some implementations may want to
differentiate by exact bit depth or support 32 bit down the line.
diff --git a/libavfilter/vf_idet.c b/libavfilter/vf_idet.c
index 0667001252..c217021ae9 100644
--- a/libavfilter/vf_idet.c
+++ b/libavfilter/vf_idet.c
@@ -299,7 +299,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *picref)
if (!idet->csp) {
idet->csp = av_pix_fmt_desc_get(link->format);
- ff_idet_dsp_init(&idet->dsp, idet->csp->comp[0].depth > 8);
+ ff_idet_dsp_init(&idet->dsp, idet->csp->comp[0].depth);
}
if (idet->analyze_interlaced_flag) {
@@ -429,7 +429,7 @@ static av_cold int init(AVFilterContext *ctx)
else
idet->decay_coefficient = PRECISION;
- ff_idet_dsp_init(&idet->dsp, 0);
+ ff_idet_dsp_init(&idet->dsp, 8);
return 0;
}
diff --git a/libavfilter/vf_idetdsp.c b/libavfilter/vf_idetdsp.c
index 60771677cc..b6a095bcd8 100644
--- a/libavfilter/vf_idetdsp.c
+++ b/libavfilter/vf_idetdsp.c
@@ -49,10 +49,10 @@ int ff_idet_filter_line_c_16bit(const uint16_t *a, const uint16_t *b, const uint
return ret;
}
-void av_cold ff_idet_dsp_init(IDETDSPContext *dsp, int for_16b)
+void av_cold ff_idet_dsp_init(IDETDSPContext *dsp, int depth)
{
- dsp->filter_line = for_16b ? (ff_idet_filter_func)ff_idet_filter_line_c_16bit : ff_idet_filter_line_c;
+ dsp->filter_line = depth > 8 ? (ff_idet_filter_func)ff_idet_filter_line_c_16bit : ff_idet_filter_line_c;
#if ARCH_X86
- ff_idet_dsp_init_x86(dsp, for_16b);
+ ff_idet_dsp_init_x86(dsp, depth);
#endif
}
diff --git a/libavfilter/vf_idetdsp.h b/libavfilter/vf_idetdsp.h
index 9953d25ef2..d31caa7aa8 100644
--- a/libavfilter/vf_idetdsp.h
+++ b/libavfilter/vf_idetdsp.h
@@ -27,9 +27,9 @@ typedef struct IDETDSPContext {
ff_idet_filter_func filter_line;
} IDETDSPContext;
-void ff_idet_dsp_init(IDETDSPContext *idet, int for_16b);
+void ff_idet_dsp_init(IDETDSPContext *idet, int depth);
-void ff_idet_dsp_init_x86(IDETDSPContext *idet, int for_16b);
+void ff_idet_dsp_init_x86(IDETDSPContext *idet, int depth);
/* main fall-back for left-over */
int ff_idet_filter_line_c(const uint8_t *a, const uint8_t *b, const uint8_t *c, int w);
diff --git a/libavfilter/x86/vf_idetdsp_init.c b/libavfilter/x86/vf_idetdsp_init.c
index b51985004d..710d97a6b4 100644
--- a/libavfilter/x86/vf_idetdsp_init.c
+++ b/libavfilter/x86/vf_idetdsp_init.c
@@ -60,13 +60,13 @@ FUNC_MAIN_DECL(sse2, 16)
FUNC_MAIN_DECL_16bit(sse2, 8)
#endif
-av_cold void ff_idet_dsp_init_x86(IDETDSPContext *dsp, int for_16b)
+av_cold void ff_idet_dsp_init_x86(IDETDSPContext *dsp, int depth)
{
#if HAVE_X86ASM
const int cpu_flags = av_get_cpu_flags();
if (EXTERNAL_SSE2(cpu_flags)) {
- dsp->filter_line = for_16b ? (ff_idet_filter_func)idet_filter_line_16bit_sse2 : idet_filter_line_sse2;
+ dsp->filter_line = depth > 8 ? (ff_idet_filter_func)idet_filter_line_16bit_sse2 : idet_filter_line_sse2;
}
#endif // HAVE_X86ASM
}
commit 56bb187ca915642358b8527029139628771837cb
Author: Niklas Haas <git(a)haasn.dev>
AuthorDate: Mon Sep 15 18:02:56 2025 +0200
Commit: Niklas Haas <ffmpeg(a)haasn.dev>
CommitDate: Sun Sep 21 11:02:41 2025 +0000
avfilter/vf_idet: correctly update dsp function on format change
Currently, this never updates on change from high bit depth to low bit depth.
diff --git a/libavfilter/vf_idet.c b/libavfilter/vf_idet.c
index 7ec8b088be..0667001252 100644
--- a/libavfilter/vf_idet.c
+++ b/libavfilter/vf_idet.c
@@ -297,10 +297,10 @@ static int filter_frame(AVFilterLink *link, AVFrame *picref)
if (!idet->prev)
return 0;
- if (!idet->csp)
+ if (!idet->csp) {
idet->csp = av_pix_fmt_desc_get(link->format);
- if (idet->csp->comp[0].depth > 8)
- ff_idet_dsp_init(&idet->dsp, 1);
+ ff_idet_dsp_init(&idet->dsp, idet->csp->comp[0].depth > 8);
+ }
if (idet->analyze_interlaced_flag) {
if (idet->cur->flags & AV_FRAME_FLAG_INTERLACED) {
commit 2b67137daa488b2de4c86fd025ab9db576a1fb9a
Author: Niklas Haas <git(a)haasn.dev>
AuthorDate: Mon Sep 15 18:02:16 2025 +0200
Commit: Niklas Haas <ffmpeg(a)haasn.dev>
CommitDate: Sun Sep 21 11:02:41 2025 +0000
avfilter/vf_idet: correctly reset pixdesc on format change
diff --git a/libavfilter/vf_idet.c b/libavfilter/vf_idet.c
index 74baa20227..7ec8b088be 100644
--- a/libavfilter/vf_idet.c
+++ b/libavfilter/vf_idet.c
@@ -283,6 +283,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *picref)
av_frame_free(&idet->cur );
av_frame_free(&idet->next);
+ idet->csp = NULL;
}
idet->prev = idet->cur;
commit 5830743363490d39d9f9b4acd4c4aceb73c14d0c
Author: Niklas Haas <git(a)haasn.dev>
AuthorDate: Tue Sep 16 14:11:21 2025 +0200
Commit: Niklas Haas <ffmpeg(a)haasn.dev>
CommitDate: Sun Sep 21 11:02:41 2025 +0000
avfilter/vf_idet: separate DSP parts
To avoid pulling in the entire libavfilter when using the DSP functions
from checkasm.
The rest of the struct is not needed outside vf_idet.c and was moved there.
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 70b100aff1..1f5de29ba2 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -358,7 +358,7 @@ OBJS-$(CONFIG_HYSTERESIS_FILTER) += vf_hysteresis.o framesync.o
OBJS-$(CONFIG_ICCDETECT_FILTER) += vf_iccdetect.o fflcms2.o
OBJS-$(CONFIG_ICCGEN_FILTER) += vf_iccgen.o fflcms2.o
OBJS-$(CONFIG_IDENTITY_FILTER) += vf_identity.o framesync.o
-OBJS-$(CONFIG_IDET_FILTER) += vf_idet.o
+OBJS-$(CONFIG_IDET_FILTER) += vf_idet.o vf_idetdsp.o
OBJS-$(CONFIG_IL_FILTER) += vf_il.o
OBJS-$(CONFIG_INFLATE_FILTER) += vf_neighbor.o
OBJS-$(CONFIG_INTERLACE_FILTER) += vf_tinterlace.o
diff --git a/libavfilter/vf_idet.c b/libavfilter/vf_idet.c
index 141911e636..74baa20227 100644
--- a/libavfilter/vf_idet.c
+++ b/libavfilter/vf_idet.c
@@ -22,8 +22,57 @@
#include "libavutil/common.h"
#include "libavutil/opt.h"
+#include "libavutil/pixdesc.h"
+
#include "filters.h"
-#include "vf_idet.h"
+#include "vf_idetdsp.h"
+
+typedef enum {
+ TFF,
+ BFF,
+ PROGRESSIVE,
+ UNDETERMINED,
+} Type;
+
+typedef enum {
+ REPEAT_NONE,
+ REPEAT_TOP,
+ REPEAT_BOTTOM,
+} RepeatedField;
+
+typedef struct IDETContext {
+ const AVClass *class;
+ IDETDSPContext dsp;
+
+ float interlace_threshold;
+ float progressive_threshold;
+ float repeat_threshold;
+ float half_life;
+ uint64_t decay_coefficient;
+
+ Type last_type;
+
+ uint64_t repeats[3];
+ uint64_t prestat[4];
+ uint64_t poststat[4];
+ uint64_t total_repeats[3];
+ uint64_t total_prestat[4];
+ uint64_t total_poststat[4];
+
+ #define HIST_SIZE 4
+ uint8_t history[HIST_SIZE];
+
+ AVFrame *cur;
+ AVFrame *next;
+ AVFrame *prev;
+
+ int interlaced_flag_accuracy;
+ int analyze_interlaced_flag;
+ int analyze_interlaced_flag_done;
+
+ const AVPixFmtDescriptor *csp;
+ int eof;
+} IDETContext;
#define OFFSET(x) offsetof(IDETContext, x)
#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
@@ -83,32 +132,6 @@ static const char *rep2str(RepeatedField repeated_field)
return NULL;
}
-int ff_idet_filter_line_c(const uint8_t *a, const uint8_t *b, const uint8_t *c, int w)
-{
- int x;
- int ret=0;
-
- for(x=0; x<w; x++){
- int v = (*a++ + *c++) - 2 * *b++;
- ret += FFABS(v);
- }
-
- return ret;
-}
-
-int ff_idet_filter_line_c_16bit(const uint16_t *a, const uint16_t *b, const uint16_t *c, int w)
-{
- int x;
- int ret=0;
-
- for(x=0; x<w; x++){
- int v = (*a++ + *c++) - 2 * *b++;
- ret += FFABS(v);
- }
-
- return ret;
-}
-
static void filter(AVFilterContext *ctx)
{
IDETContext *idet = ctx->priv;
@@ -120,6 +143,7 @@ static void filter(AVFilterContext *ctx)
RepeatedField repeat;
int match = 0;
AVDictionary **metadata = &idet->cur->metadata;
+ ff_idet_filter_func filter_line = idet->dsp.filter_line;
for (i = 0; i < idet->csp->nb_components; i++) {
int w = idet->cur->width;
@@ -135,10 +159,10 @@ static void filter(AVFilterContext *ctx)
uint8_t *prev = &idet->prev->data[i][y*refs];
uint8_t *cur = &idet->cur ->data[i][y*refs];
uint8_t *next = &idet->next->data[i][y*refs];
- alpha[ y &1] += idet->filter_line(cur-refs, prev, cur+refs, w);
- alpha[(y^1)&1] += idet->filter_line(cur-refs, next, cur+refs, w);
- delta += idet->filter_line(cur-refs, cur, cur+refs, w);
- gamma[(y^1)&1] += idet->filter_line(cur , prev, cur , w);
+ alpha[ y &1] += filter_line(cur-refs, prev, cur+refs, w);
+ alpha[(y^1)&1] += filter_line(cur-refs, next, cur+refs, w);
+ delta += filter_line(cur-refs, cur, cur+refs, w);
+ gamma[(y^1)&1] += filter_line(cur , prev, cur , w);
}
}
@@ -275,7 +299,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *picref)
if (!idet->csp)
idet->csp = av_pix_fmt_desc_get(link->format);
if (idet->csp->comp[0].depth > 8)
- ff_idet_dsp_init(idet, 1);
+ ff_idet_dsp_init(&idet->dsp, 1);
if (idet->analyze_interlaced_flag) {
if (idet->cur->flags & AV_FRAME_FLAG_INTERLACED) {
@@ -391,14 +415,6 @@ static const enum AVPixelFormat pix_fmts[] = {
AV_PIX_FMT_NONE
};
-void ff_idet_dsp_init(IDETContext *idet, int for_16b)
-{
- idet->filter_line = for_16b ? (ff_idet_filter_func)ff_idet_filter_line_c_16bit : ff_idet_filter_line_c;
-#if ARCH_X86
- ff_idet_init_x86(idet, for_16b);
-#endif
-}
-
static av_cold int init(AVFilterContext *ctx)
{
IDETContext *idet = ctx->priv;
@@ -412,7 +428,7 @@ static av_cold int init(AVFilterContext *ctx)
else
idet->decay_coefficient = PRECISION;
- ff_idet_dsp_init(idet, 0);
+ ff_idet_dsp_init(&idet->dsp, 0);
return 0;
}
diff --git a/libavfilter/vf_idetdsp.c b/libavfilter/vf_idetdsp.c
new file mode 100644
index 0000000000..60771677cc
--- /dev/null
+++ b/libavfilter/vf_idetdsp.c
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2012 Michael Niedermayer <michaelni(a)gmx.at>
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <libavutil/attributes.h>
+#include <libavutil/common.h>
+
+#include "vf_idetdsp.h"
+
+int ff_idet_filter_line_c(const uint8_t *a, const uint8_t *b, const uint8_t *c, int w)
+{
+ int x;
+ int ret=0;
+
+ for(x=0; x<w; x++){
+ int v = (*a++ + *c++) - 2 * *b++;
+ ret += FFABS(v);
+ }
+
+ return ret;
+}
+
+int ff_idet_filter_line_c_16bit(const uint16_t *a, const uint16_t *b, const uint16_t *c, int w)
+{
+ int x;
+ int ret=0;
+
+ for(x=0; x<w; x++){
+ int v = (*a++ + *c++) - 2 * *b++;
+ ret += FFABS(v);
+ }
+
+ return ret;
+}
+
+void av_cold ff_idet_dsp_init(IDETDSPContext *dsp, int for_16b)
+{
+ dsp->filter_line = for_16b ? (ff_idet_filter_func)ff_idet_filter_line_c_16bit : ff_idet_filter_line_c;
+#if ARCH_X86
+ ff_idet_dsp_init_x86(dsp, for_16b);
+#endif
+}
diff --git a/libavfilter/vf_idet.h b/libavfilter/vf_idetdsp.h
similarity index 51%
rename from libavfilter/vf_idet.h
rename to libavfilter/vf_idetdsp.h
index 9351c70cf9..9953d25ef2 100644
--- a/libavfilter/vf_idet.h
+++ b/libavfilter/vf_idetdsp.h
@@ -16,67 +16,23 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef AVFILTER_IDET_H
-#define AVFILTER_IDET_H
+#ifndef AVFILTER_IDETDSP_H
+#define AVFILTER_IDETDSP_H
-#include "libavutil/pixdesc.h"
-#include "avfilter.h"
-
-#define HIST_SIZE 4
+#include <stdint.h>
typedef int (*ff_idet_filter_func)(const uint8_t *a, const uint8_t *b, const uint8_t *c, int w);
-typedef enum {
- TFF,
- BFF,
- PROGRESSIVE,
- UNDETERMINED,
-} Type;
-
-typedef enum {
- REPEAT_NONE,
- REPEAT_TOP,
- REPEAT_BOTTOM,
-} RepeatedField;
-
-typedef struct IDETContext {
- const AVClass *class;
- float interlace_threshold;
- float progressive_threshold;
- float repeat_threshold;
- float half_life;
- uint64_t decay_coefficient;
-
- Type last_type;
-
- uint64_t repeats[3];
- uint64_t prestat[4];
- uint64_t poststat[4];
- uint64_t total_repeats[3];
- uint64_t total_prestat[4];
- uint64_t total_poststat[4];
-
- uint8_t history[HIST_SIZE];
-
- AVFrame *cur;
- AVFrame *next;
- AVFrame *prev;
+typedef struct IDETDSPContext {
ff_idet_filter_func filter_line;
+} IDETDSPContext;
- int interlaced_flag_accuracy;
- int analyze_interlaced_flag;
- int analyze_interlaced_flag_done;
-
- const AVPixFmtDescriptor *csp;
- int eof;
-} IDETContext;
-
-void ff_idet_dsp_init(IDETContext *idet, int for_16b);
+void ff_idet_dsp_init(IDETDSPContext *idet, int for_16b);
-void ff_idet_init_x86(IDETContext *idet, int for_16b);
+void ff_idet_dsp_init_x86(IDETDSPContext *idet, int for_16b);
/* main fall-back for left-over */
int ff_idet_filter_line_c(const uint8_t *a, const uint8_t *b, const uint8_t *c, int w);
int ff_idet_filter_line_c_16bit(const uint16_t *a, const uint16_t *b, const uint16_t *c, int w);
-#endif
+#endif /* AVFILTER_IDETDSP_H */
diff --git a/libavfilter/x86/Makefile b/libavfilter/x86/Makefile
index 0e531a9b41..b485c10fbe 100644
--- a/libavfilter/x86/Makefile
+++ b/libavfilter/x86/Makefile
@@ -18,7 +18,7 @@ OBJS-$(CONFIG_FRAMERATE_FILTER) += x86/vf_framerate_init.o
OBJS-$(CONFIG_HALDCLUT_FILTER) += x86/vf_lut3d_init.o
OBJS-$(CONFIG_HFLIP_FILTER) += x86/vf_hflip_init.o
OBJS-$(CONFIG_HQDN3D_FILTER) += x86/vf_hqdn3d_init.o
-OBJS-$(CONFIG_IDET_FILTER) += x86/vf_idet_init.o
+OBJS-$(CONFIG_IDET_FILTER) += x86/vf_idetdsp_init.o
OBJS-$(CONFIG_INTERLACE_FILTER) += x86/vf_tinterlace_init.o
OBJS-$(CONFIG_LIMITER_FILTER) += x86/vf_limiter_init.o
OBJS-$(CONFIG_LUT3D_FILTER) += x86/vf_lut3d_init.o
@@ -66,7 +66,7 @@ X86ASM-OBJS-$(CONFIG_GRADFUN_FILTER) += x86/vf_gradfun.o
X86ASM-OBJS-$(CONFIG_HALDCLUT_FILTER) += x86/vf_lut3d.o
X86ASM-OBJS-$(CONFIG_HFLIP_FILTER) += x86/vf_hflip.o
X86ASM-OBJS-$(CONFIG_HQDN3D_FILTER) += x86/vf_hqdn3d.o
-X86ASM-OBJS-$(CONFIG_IDET_FILTER) += x86/vf_idet.o
+X86ASM-OBJS-$(CONFIG_IDET_FILTER) += x86/vf_idetdsp.o
X86ASM-OBJS-$(CONFIG_INTERLACE_FILTER) += x86/vf_interlace.o
X86ASM-OBJS-$(CONFIG_LIMITER_FILTER) += x86/vf_limiter.o
X86ASM-OBJS-$(CONFIG_LUT3D_FILTER) += x86/vf_lut3d.o
diff --git a/libavfilter/x86/vf_idet.asm b/libavfilter/x86/vf_idetdsp.asm
similarity index 100%
rename from libavfilter/x86/vf_idet.asm
rename to libavfilter/x86/vf_idetdsp.asm
diff --git a/libavfilter/x86/vf_idet_init.c b/libavfilter/x86/vf_idetdsp_init.c
similarity index 93%
rename from libavfilter/x86/vf_idet_init.c
rename to libavfilter/x86/vf_idetdsp_init.c
index acb4e2a778..b51985004d 100644
--- a/libavfilter/x86/vf_idet_init.c
+++ b/libavfilter/x86/vf_idetdsp_init.c
@@ -20,7 +20,7 @@
#include "libavutil/cpu.h"
#include "libavutil/x86/asm.h"
#include "libavutil/x86/cpu.h"
-#include "libavfilter/vf_idet.h"
+#include "libavfilter/vf_idetdsp.h"
#if HAVE_X86ASM
@@ -60,13 +60,13 @@ FUNC_MAIN_DECL(sse2, 16)
FUNC_MAIN_DECL_16bit(sse2, 8)
#endif
-av_cold void ff_idet_init_x86(IDETContext *idet, int for_16b)
+av_cold void ff_idet_dsp_init_x86(IDETDSPContext *dsp, int for_16b)
{
#if HAVE_X86ASM
const int cpu_flags = av_get_cpu_flags();
if (EXTERNAL_SSE2(cpu_flags)) {
- idet->filter_line = for_16b ? (ff_idet_filter_func)idet_filter_line_16bit_sse2 : idet_filter_line_sse2;
+ dsp->filter_line = for_16b ? (ff_idet_filter_func)idet_filter_line_16bit_sse2 : idet_filter_line_sse2;
}
#endif // HAVE_X86ASM
}
commit 367febc491bceaf9aa95ba5fb9c2ca9b38f9208d
Author: Niklas Haas <git(a)haasn.dev>
AuthorDate: Mon Sep 15 17:56:51 2025 +0200
Commit: Niklas Haas <ffmpeg(a)haasn.dev>
CommitDate: Sun Sep 21 11:02:41 2025 +0000
avfilter/vf_idet: expose DSP init function internally
For checkasm.
diff --git a/libavfilter/vf_idet.c b/libavfilter/vf_idet.c
index 445ecc203a..141911e636 100644
--- a/libavfilter/vf_idet.c
+++ b/libavfilter/vf_idet.c
@@ -274,12 +274,8 @@ static int filter_frame(AVFilterLink *link, AVFrame *picref)
if (!idet->csp)
idet->csp = av_pix_fmt_desc_get(link->format);
- if (idet->csp->comp[0].depth > 8){
- idet->filter_line = (ff_idet_filter_func)ff_idet_filter_line_c_16bit;
-#if ARCH_X86
- ff_idet_init_x86(idet, 1);
-#endif
- }
+ if (idet->csp->comp[0].depth > 8)
+ ff_idet_dsp_init(idet, 1);
if (idet->analyze_interlaced_flag) {
if (idet->cur->flags & AV_FRAME_FLAG_INTERLACED) {
@@ -395,6 +391,14 @@ static const enum AVPixelFormat pix_fmts[] = {
AV_PIX_FMT_NONE
};
+void ff_idet_dsp_init(IDETContext *idet, int for_16b)
+{
+ idet->filter_line = for_16b ? (ff_idet_filter_func)ff_idet_filter_line_c_16bit : ff_idet_filter_line_c;
+#if ARCH_X86
+ ff_idet_init_x86(idet, for_16b);
+#endif
+}
+
static av_cold int init(AVFilterContext *ctx)
{
IDETContext *idet = ctx->priv;
@@ -408,11 +412,7 @@ static av_cold int init(AVFilterContext *ctx)
else
idet->decay_coefficient = PRECISION;
- idet->filter_line = ff_idet_filter_line_c;
-
-#if ARCH_X86
- ff_idet_init_x86(idet, 0);
-#endif
+ ff_idet_dsp_init(idet, 0);
return 0;
}
diff --git a/libavfilter/vf_idet.h b/libavfilter/vf_idet.h
index afd8947055..9351c70cf9 100644
--- a/libavfilter/vf_idet.h
+++ b/libavfilter/vf_idet.h
@@ -71,6 +71,8 @@ typedef struct IDETContext {
int eof;
} IDETContext;
+void ff_idet_dsp_init(IDETContext *idet, int for_16b);
+
void ff_idet_init_x86(IDETContext *idet, int for_16b);
/* main fall-back for left-over */
-----------------------------------------------------------------------
Summary of changes:
libavfilter/Makefile | 2 +-
libavfilter/vf_idet.c | 101 ++++++++++++---------
libavfilter/vf_idet.h | 80 ----------------
libavfilter/vf_idetdsp.c | 62 +++++++++++++
.../float_dsp_arm.h => libavfilter/vf_idetdsp.h | 25 +++--
libavfilter/x86/Makefile | 4 +-
libavfilter/x86/{vf_idet.asm => vf_idetdsp.asm} | 44 +++++++--
.../x86/{vf_idet_init.c => vf_idetdsp_init.c} | 39 +++++---
tests/checkasm/Makefile | 1 +
tests/checkasm/checkasm.c | 3 +
tests/checkasm/checkasm.h | 1 +
tests/checkasm/vf_idet.c | 65 +++++++++++++
12 files changed, 274 insertions(+), 153 deletions(-)
delete mode 100644 libavfilter/vf_idet.h
create mode 100644 libavfilter/vf_idetdsp.c
copy libavutil/arm/float_dsp_arm.h => libavfilter/vf_idetdsp.h (57%)
rename libavfilter/x86/{vf_idet.asm => vf_idetdsp.asm} (83%)
rename libavfilter/x86/{vf_idet_init.c => vf_idetdsp_init.c} (63%)
create mode 100644 tests/checkasm/vf_idet.c
hooks/post-receive
--
1
0
[ffmpeg] branch master updated. e02e6d54b0 tests/fate/demux: add hxvs test case
by ffmpeg-git@ffmpeg.org 21 Sep '25
by ffmpeg-git@ffmpeg.org 21 Sep '25
21 Sep '25
The branch, master has been updated
via e02e6d54b04aaed3a500e55fd53da6dd411074d8 (commit)
via dcddb2bf08f5fa6af655938a3a0d3cd2200fd8c9 (commit)
from db0b86a4adf3ffe592ea70e756d615e89138eee0 (commit)
- Log -----------------------------------------------------------------
commit e02e6d54b04aaed3a500e55fd53da6dd411074d8
Author: Zhao Zhili <quinkblack(a)foxmail.com>
AuthorDate: Sun Sep 14 18:14:10 2025 +0800
Commit: Zhao Zhili <quinkblack(a)foxmail.com>
CommitDate: Sun Sep 21 17:42:19 2025 +0800
tests/fate/demux: add hxvs test case
diff --git a/tests/fate/demux.mak b/tests/fate/demux.mak
index a2cb45aa7e..ad1046a453 100644
--- a/tests/fate/demux.mak
+++ b/tests/fate/demux.mak
@@ -54,6 +54,9 @@ fate-flv-demux: CMD = ffprobe_demux $(TARGET_SAMPLES)/flv/Enigma_Principles_of_L
FATE_SAMPLES_DEMUX-$(call FRAMECRC, GIF,, GIF_PARSER) += fate-gif-demux
fate-gif-demux: CMD = framecrc -i $(TARGET_SAMPLES)/gif/Newtons_cradle_animation_book_2.gif -c:v copy
+FATE_SAMPLES_DEMUX-$(call FRAMECRC, HXVS, HEVC, EXTRACT_EXTRADATA_BSF) += fate-hxvs-demux
+fate-hxvs-demux: CMD = framecrc -i $(TARGET_SAMPLES)/hxvs/A231130_171422_171436.bin -c copy -t 3
+
FATE_SAMPLES_DEMUX-$(call FRAMECRC, IFF) += fate-iff-demux
fate-iff-demux: CMD = framecrc -i $(TARGET_SAMPLES)/iff-anim/Hammer2.sndanim -c:v copy -c:a copy
diff --git a/tests/ref/fate/hxvs-demux b/tests/ref/fate/hxvs-demux
new file mode 100644
index 0000000000..c72628ace7
--- /dev/null
+++ b/tests/ref/fate/hxvs-demux
@@ -0,0 +1,197 @@
+#extradata 0: 88, 0x61e61071
+#tb 0: 1/1000
+#media_type 0: video
+#codec_id 0: hevc
+#dimensions 0: 2560x1920
+#sar 0: 0/1
+#tb 1: 1/1000
+#media_type 1: audio
+#codec_id 1: pcm_alaw
+#sample_rate 1: 8000
+#channel_layout_name 1: mono
+1, 0, 0, 20, 160, 0x8a615ea0
+1, 20, 20, 20, 160, 0xd37063a0
+1, 40, 40, 20, 160, 0xb53b7520
+1, 60, 60, 20, 160, 0x7c3b75a0
+1, 80, 80, 20, 160, 0x1a7f6d20
+1, 100, 100, 20, 160, 0xf48e7120
+1, 120, 120, 20, 160, 0x41e16520
+1, 140, 140, 20, 160, 0x7dac70a0
+1, 160, 160, 20, 160, 0x2f8e6ba0
+1, 180, 180, 20, 160, 0xe4d26420
+1, 200, 200, 20, 160, 0xd7526220
+1, 220, 220, 20, 160, 0x3ce16520
+0, 225, 225, 80, 23267, 0x356a00c4
+1, 240, 240, 20, 160, 0xabf06a20
+1, 260, 260, 20, 160, 0xdd8e6f20
+1, 280, 280, 20, 160, 0x76ac70a0
+1, 300, 300, 20, 160, 0x559d70a0
+0, 305, 305, 80, 96910, 0x221584d7, F=0x0
+0, 305, 385, 80, 45582, 0x459e018f
+1, 320, 320, 20, 160, 0xcff06920
+1, 340, 340, 20, 160, 0x2b7f6920
+1, 360, 360, 20, 160, 0x8e3b72a0
+1, 380, 380, 20, 160, 0x96ac6ca0
+0, 385, 465, 80, 29130, 0xfa158ab8, F=0x0
+1, 400, 400, 20, 160, 0xfa0e7120
+1, 420, 420, 20, 160, 0x64bb73a0
+1, 440, 440, 20, 160, 0x93ff6aa0
+1, 460, 460, 20, 160, 0x22597b20
+0, 465, 545, 80, 24585, 0x1e849e4b, F=0x0
+1, 480, 480, 20, 160, 0xd71d71a0
+1, 500, 500, 20, 160, 0x3f3b7220
+1, 520, 520, 20, 160, 0x938e7120
+1, 540, 540, 20, 160, 0x19ac74a0
+0, 545, 625, 80, 12727, 0x6df49132, F=0x0
+1, 560, 560, 20, 160, 0xf78e70a0
+1, 580, 580, 20, 160, 0xb8ac74a0
+1, 600, 600, 20, 160, 0x86d97c20
+1, 620, 620, 20, 160, 0x654a7a20
+0, 625, 705, 80, 16230, 0x46a44bf5
+1, 640, 640, 20, 160, 0xb69d7320
+1, 660, 660, 20, 160, 0x722c7220
+1, 680, 680, 20, 160, 0x976161a0
+1, 700, 700, 20, 160, 0xc3ff65a0
+0, 705, 785, 80, 270, 0x22e4706a, F=0x0
+1, 720, 720, 20, 160, 0x099d70a0
+1, 740, 740, 20, 160, 0x41bb7320
+1, 760, 760, 20, 160, 0x71bb78a0
+1, 780, 780, 20, 160, 0xcf1d7020
+0, 785, 865, 80, 1688, 0x16a723d0, F=0x0
+1, 800, 800, 20, 160, 0x978e6ea0
+1, 820, 820, 20, 160, 0x0e7069a0
+1, 840, 840, 20, 160, 0xba265a8a
+1, 860, 860, 20, 160, 0xc3a65e16
+0, 865, 945, 80, 4818, 0x03555171, F=0x0
+1, 880, 880, 20, 160, 0xb84a5c6d
+1, 900, 900, 20, 160, 0x80ba5f86
+1, 920, 920, 20, 160, 0x4a16611c
+1, 940, 940, 20, 160, 0x2dc364a0
+0, 945, 1025, 80, 4640, 0x8a1e0a78, F=0x0
+1, 960, 960, 20, 160, 0xe52d6091
+1, 980, 980, 20, 160, 0x801d6da0
+1, 1000, 1000, 20, 160, 0x239d73a0
+1, 1020, 1020, 20, 160, 0xa28e7020
+0, 1025, 1105, 80, 5487, 0xb388a312, F=0x0
+1, 1040, 1040, 20, 160, 0xbc5268a0
+1, 1060, 1060, 20, 160, 0xc72c7220
+1, 1080, 1080, 20, 160, 0xe14a79a0
+1, 1100, 1100, 20, 160, 0x853b71a0
+0, 1105, 1185, 80, 9139, 0xffedec30, F=0x0
+1, 1120, 1120, 20, 160, 0x919d6fa0
+1, 1140, 1140, 20, 160, 0x59706720
+1, 1160, 1160, 20, 160, 0x017f6920
+1, 1180, 1180, 20, 160, 0xb01d72a0
+0, 1185, 1265, 80, 756, 0x556d70d5, F=0x0
+1, 1200, 1200, 20, 160, 0xcd0e7320
+1, 1220, 1220, 20, 160, 0x3dff6da0
+1, 1240, 1240, 20, 160, 0x6cd06115
+1, 1260, 1260, 20, 160, 0xcc345f9e
+0, 1265, 1345, 80, 3243, 0x20224c97, F=0x0
+1, 1280, 1280, 20, 160, 0x06436220
+1, 1300, 1300, 20, 160, 0x410e63a0
+1, 1320, 1320, 20, 160, 0x161d6ea0
+1, 1340, 1340, 20, 160, 0xb5bb78a0
+0, 1345, 1425, 80, 8431, 0x4b7c45e1, F=0x0
+1, 1360, 1360, 20, 160, 0x899d74a0
+1, 1380, 1380, 20, 160, 0x48bb75a0
+1, 1400, 1400, 20, 160, 0x0c3b6fa0
+1, 1420, 1420, 20, 160, 0x4eca7920
+0, 1425, 1505, 80, 3313, 0x7555594d, F=0x0
+1, 1440, 1440, 20, 160, 0x188e6b20
+1, 1460, 1460, 20, 160, 0x108e7020
+1, 1480, 1480, 20, 160, 0x417f7120
+1, 1500, 1500, 20, 160, 0x9dca79a0
+0, 1505, 1585, 80, 11529, 0x2ad94990, F=0x0
+1, 1520, 1520, 20, 160, 0x449d6f20
+1, 1540, 1540, 20, 160, 0x0c8e6ca0
+1, 1560, 1560, 20, 160, 0x174a79a0
+1, 1580, 1580, 20, 160, 0xfed97fa0
+0, 1585, 1665, 80, 402, 0x4804b096, F=0x0
+1, 1600, 1600, 20, 160, 0x291d6f20
+1, 1620, 1620, 20, 160, 0x481d6e20
+1, 1640, 1640, 20, 160, 0x67bb7720
+1, 1660, 1660, 20, 160, 0x77d97920
+0, 1665, 1745, 80, 1105, 0x146732d3, F=0x0
+1, 1680, 1680, 20, 160, 0xd00e6e20
+1, 1700, 1700, 20, 160, 0x928e6920
+1, 1720, 1720, 20, 160, 0x4b3b71a0
+1, 1740, 1740, 20, 160, 0xbe9d7320
+0, 1745, 1825, 80, 1644, 0x335e273b, F=0x0
+1, 1760, 1760, 20, 160, 0x908e7020
+1, 1780, 1780, 20, 160, 0xf52c75a0
+1, 1800, 1800, 20, 160, 0x5d687f20
+1, 1820, 1820, 20, 160, 0x37597b20
+0, 1825, 1905, 80, 10631, 0x1932ae14, F=0x0
+1, 1840, 1840, 20, 160, 0x202c7620
+1, 1860, 1860, 20, 160, 0x594a77a0
+1, 1880, 1880, 20, 160, 0x58ca7ba0
+1, 1900, 1900, 20, 160, 0x54bb7820
+0, 1905, 1985, 80, 5253, 0x97ac4e85, F=0x0
+1, 1920, 1920, 20, 160, 0x1a3b76a0
+1, 1940, 1940, 20, 160, 0x0d3b76a0
+1, 1960, 1960, 20, 160, 0x94bb7720
+1, 1980, 1980, 20, 160, 0x48597e20
+0, 1985, 2065, 80, 3917, 0x95109a5b, F=0x0
+1, 2000, 2000, 20, 160, 0x5e4a7820
+1, 2020, 2020, 20, 160, 0xf3687ea0
+1, 2040, 2040, 20, 160, 0x96bb7920
+1, 2060, 2060, 20, 160, 0x35d97b20
+0, 2065, 2145, 80, 5097, 0x3905f533, F=0x0
+1, 2080, 2080, 20, 160, 0x423b7620
+1, 2100, 2100, 20, 160, 0x9d3b7720
+1, 2120, 2120, 20, 160, 0x373b77a0
+1, 2140, 2140, 20, 160, 0xdbca7ba0
+0, 2145, 2225, 80, 13858, 0xe92a0e09, F=0x0
+1, 2160, 2160, 20, 160, 0xf07f6f20
+1, 2180, 2180, 20, 160, 0x233b6da0
+1, 2200, 2200, 20, 160, 0xa97f7520
+1, 2220, 2220, 20, 160, 0x24966020
+0, 2225, 2305, 80, 1266, 0xb6ac78dd, F=0x0
+1, 2240, 2240, 20, 160, 0x35ac7320
+1, 2260, 2260, 20, 160, 0x3eac7420
+1, 2280, 2280, 20, 160, 0x681d74a0
+1, 2300, 2300, 20, 160, 0xc8ac73a0
+0, 2305, 2385, 80, 1452, 0xbec3c1c7, F=0x0
+1, 2320, 2320, 20, 160, 0x741d6fa0
+1, 2340, 2340, 20, 160, 0x80ff66a0
+1, 2360, 2360, 20, 160, 0x92ff6c20
+1, 2380, 2380, 20, 160, 0x7bbb78a0
+0, 2385, 2465, 80, 746, 0x00d06534, F=0x0
+1, 2400, 2400, 20, 160, 0x7e0e6d20
+1, 2420, 2420, 20, 160, 0x8cbb72a0
+1, 2440, 2440, 20, 160, 0x446f669d
+1, 2460, 2460, 20, 160, 0xe0b45ca0
+0, 2465, 2545, 80, 882, 0x36d3ad81, F=0x0
+1, 2480, 2480, 20, 160, 0x957f6ea0
+1, 2500, 2500, 20, 160, 0x122c6fa0
+1, 2520, 2520, 20, 160, 0x1bbb7720
+1, 2540, 2540, 20, 160, 0x31e164a0
+0, 2545, 2625, 80, 969, 0x4549d4c1, F=0x0
+1, 2560, 2560, 20, 160, 0x0d3b74a0
+1, 2580, 2580, 20, 160, 0x0dac75a0
+1, 2600, 2600, 20, 160, 0xc73b78a0
+1, 2620, 2620, 20, 160, 0xceca78a0
+0, 2625, 2705, 80, 736, 0x9f84568c, F=0x0
+1, 2640, 2640, 20, 160, 0xe1ff6ba0
+1, 2660, 2660, 20, 160, 0xc1597ba0
+1, 2680, 2680, 20, 160, 0x62d97c20
+1, 2700, 2700, 20, 160, 0x554a7320
+0, 2705, 2785, 80, 886, 0xf157a913, F=0x0
+1, 2720, 2720, 20, 160, 0x31616920
+1, 2740, 2740, 20, 160, 0x3c526820
+1, 2760, 2760, 20, 160, 0x935268a0
+1, 2780, 2780, 20, 160, 0xa04a7ba0
+0, 2785, 2865, 80, 944, 0x3cf2c38d, F=0x0
+1, 2800, 2800, 20, 160, 0xf91d7220
+1, 2820, 2820, 20, 160, 0xe29d7020
+1, 2840, 2840, 20, 160, 0xb31d75a0
+1, 2860, 2860, 20, 160, 0x253b7920
+0, 2865, 2945, 80, 1313, 0x147a786a, F=0x0
+1, 2880, 2880, 20, 160, 0x678e6ea0
+1, 2900, 2900, 20, 160, 0xb53b78a0
+1, 2920, 2920, 20, 160, 0x4f597c20
+1, 2940, 2940, 20, 160, 0xd3ac7720
+0, 2945, 3025, 80, 1901, 0xdbf8a5f4, F=0x0
+1, 2960, 2960, 20, 160, 0xd9f06020
+1, 2980, 2980, 20, 160, 0x649d6ca0
commit dcddb2bf08f5fa6af655938a3a0d3cd2200fd8c9
Author: Zhao Zhili <quinkblack(a)foxmail.com>
AuthorDate: Sun Sep 14 01:47:12 2025 +0800
Commit: Zhao Zhili <quinkblack(a)foxmail.com>
CommitDate: Sun Sep 21 17:42:19 2025 +0800
avformat: add hxvs demuxer
diff --git a/Changelog b/Changelog
index 88e1ce6659..997ff3b0b6 100644
--- a/Changelog
+++ b/Changelog
@@ -5,6 +5,7 @@ version <next>:
- ffprobe -codec option
- EXIF Metadata Parsing
- gfxcapture: Windows.Graphics.Capture based window/monitor capture
+- hxvs demuxer for HXVS/HXVT IP camera format
version 8.0:
diff --git a/configure b/configure
index 8def62a5d9..98de8e5dff 100755
--- a/configure
+++ b/configure
@@ -3753,6 +3753,7 @@ gxf_muxer_select="pcm_rechunk_bsf"
hds_muxer_select="flv_muxer"
hls_demuxer_select="aac_demuxer ac3_demuxer adts_header ac3_parser eac3_demuxer mov_demuxer mpegts_demuxer"
hls_muxer_select="mov_muxer mpegts_muxer"
+hxvs_demuxer_select="h264_parser hevc_parser"
iamf_demuxer_select="iamfdec"
iamf_muxer_select="iamfenc"
image2_alias_pix_demuxer_select="image2_demuxer"
diff --git a/libavformat/Makefile b/libavformat/Makefile
index ab5551a735..0171f1c480 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -268,6 +268,7 @@ OBJS-$(CONFIG_EVC_MUXER) += rawenc.o
OBJS-$(CONFIG_HLS_DEMUXER) += hls.o hls_sample_encryption.o
OBJS-$(CONFIG_HLS_MUXER) += hlsenc.o hlsplaylist.o
OBJS-$(CONFIG_HNM_DEMUXER) += hnm.o
+OBJS-$(CONFIG_HXVS_DEMUXER) += hxvs.o
OBJS-$(CONFIG_IAMF_DEMUXER) += iamfdec.o
OBJS-$(CONFIG_IAMF_MUXER) += iamfenc.o
OBJS-$(CONFIG_ICO_DEMUXER) += icodec.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index e39eab8e85..3a025da3db 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -216,6 +216,7 @@ extern const FFOutputFormat ff_hevc_muxer;
extern const FFInputFormat ff_hls_demuxer;
extern const FFOutputFormat ff_hls_muxer;
extern const FFInputFormat ff_hnm_demuxer;
+extern const FFInputFormat ff_hxvs_demuxer;
extern const FFInputFormat ff_iamf_demuxer;
extern const FFOutputFormat ff_iamf_muxer;
extern const FFInputFormat ff_ico_demuxer;
diff --git a/libavformat/hxvs.c b/libavformat/hxvs.c
new file mode 100644
index 0000000000..ed827c8d97
--- /dev/null
+++ b/libavformat/hxvs.c
@@ -0,0 +1,340 @@
+/*
+ * HXVS/HXVT IP camera format
+ *
+ * Copyright (c) 2025 Zhao Zhili <quinkblack(a)foxmail.com>
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/intreadwrite.h"
+
+#include "avio_internal.h"
+#include "demux.h"
+#include "internal.h"
+
+/*
+ * Ref
+ * https://code.videolan.org/videolan/vlc/-/blob/master/modules/demux/hx.c
+ * https://github.com/francescovannini/ipcam26Xconvert/tree/main
+ */
+
+/* H.264
+ *
+ * uint32_t tag;
+ * uint32_t width;
+ * uint32_t height;
+ * uint8_t padding[4];
+ */
+#define HXVS MKTAG('H', 'X', 'V', 'S')
+
+/* H.265
+ *
+ * Same as HXVS.
+ */
+#define HXVT MKTAG('H', 'X', 'V', 'T')
+
+/* video frame
+ *
+ * uint32_t tag;
+ * uint32_t bytes
+ * uint32_t timestamp;
+ * uint32_t flags;
+ * ------------------
+ * uint8_t data[bytes]
+ *
+ * Note: each HXVF contains a single NALU or slice, not a frame.
+ */
+#define HXVF MKTAG('H', 'X', 'V', 'F')
+
+/* audio frame
+ *
+ * uint32_t tag;
+ * uint32_t bytes
+ * uint32_t timestamp;
+ * uint32_t flags;
+ * ------------------
+ * uint8_t data[bytes]
+ *
+ * Note: The first four bytes of data is fake start code and NALU type,
+ * which should be skipped.
+ */
+#define HXAF MKTAG('H', 'X', 'A', 'F')
+
+/* RAP frame index
+ *
+ * uint32_t tag;
+ * uint32_t bytes
+ * uint32_t duration;
+ * uint32_t flags;
+ */
+#define HXFI MKTAG('H', 'X', 'F', 'I')
+
+#define HXFI_TABLE_SIZE 200000
+#define HXFI_TABLE_COUNT (200000 / 8)
+
+typedef struct HxvsContext {
+ int video_index;
+ int audio_index;
+} HxvsContext;
+
+static int hxvs_probe(const AVProbeData *p)
+{
+ uint32_t flag = 0;
+ uint32_t bytes;
+
+ for (size_t i = 0; i < p->buf_size; ) {
+ uint32_t tag = AV_RL32(&p->buf[i]);
+
+ // first four bytes must begin with HXVS/HXVT
+ if (i == 0) {
+ if (tag != HXVS && tag != HXVT)
+ return 0;
+ flag |= 1;
+ i += 16;
+ continue;
+ }
+
+ // Got RAP index at the end
+ if (tag == HXFI) {
+ if (flag == 7)
+ return AVPROBE_SCORE_MAX;
+ break;
+ }
+
+ i += 4;
+ if (tag == HXVF || tag == HXAF) {
+ bytes = AV_RL32(&p->buf[i]);
+ i += 12 + bytes;
+ flag |= (tag == HXVF) ? 2 : 4;
+ continue;
+ }
+
+ return 0;
+ }
+
+ // Get audio and video
+ if (flag == 7)
+ return AVPROBE_SCORE_EXTENSION + 10;
+ // Get video only
+ if (flag == 3)
+ return AVPROBE_SCORE_EXTENSION + 2;
+
+ return 0;
+}
+
+static int hxvs_create_video_stream(AVFormatContext *s, enum AVCodecID codec_id)
+{
+ HxvsContext *ctx = s->priv_data;
+ AVIOContext *pb = s->pb;
+ AVStream *vt = avformat_new_stream(s, NULL);
+ if (!vt)
+ return AVERROR(ENOMEM);
+
+ vt->id = 0;
+ vt->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
+ vt->codecpar->codec_id = codec_id;
+ vt->codecpar->width = avio_rl32(pb);
+ vt->codecpar->height = avio_rl32(pb);
+ avpriv_set_pts_info(vt, 32, 1, 1000);
+ ffstream(vt)->need_parsing = AVSTREAM_PARSE_FULL;
+ ctx->video_index = vt->index;
+
+ // skip padding
+ avio_skip(pb, 4);
+
+ return 0;
+}
+
+static int hxvs_create_audio_stream(AVFormatContext *s)
+{
+ HxvsContext *ctx = s->priv_data;
+ AVStream *at = avformat_new_stream(s, NULL);
+ if (!at)
+ return AVERROR(ENOMEM);
+
+ at->id = 1;
+ at->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
+ at->codecpar->codec_id = AV_CODEC_ID_PCM_ALAW;
+ at->codecpar->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO;
+ at->codecpar->sample_rate = 8000;
+ avpriv_set_pts_info(at, 32, 1, 1000);
+ ctx->audio_index = at->index;
+
+ return 0;
+}
+
+static int hxvs_build_index(AVFormatContext *s)
+{
+ HxvsContext *ctx = s->priv_data;
+ AVIOContext *pb = s->pb;
+
+ int64_t size = avio_size(pb);
+ if (size < 0)
+ return size;
+ // Don't return error when HXFI is missing
+ int64_t pos = avio_seek(pb, size -(HXFI_TABLE_SIZE + 16), SEEK_SET);
+ if (pos < 0)
+ return 0;
+
+ uint32_t tag = avio_rl32(pb);
+ if (tag != HXFI)
+ return 0;
+ avio_skip(pb, 4);
+ AVStream *st = s->streams[ctx->video_index];
+ st->duration = avio_rl32(pb);
+ avio_skip(pb, 4);
+
+ FFStream *const sti = ffstream(st);
+ uint32_t prev_time;
+ for (int i = 0; i < HXFI_TABLE_COUNT; i++) {
+ uint32_t offset = avio_rl32(pb);
+ // pts = first_frame_pts + time
+ uint32_t time = avio_rl32(pb);
+ av_log(s, AV_LOG_TRACE, "%s/%d: offset %u, time %u\n",
+ av_fourcc2str(HXAF), i, offset, time);
+ if (!offset)
+ break;
+
+ if (!i) {
+ // Get first frame timestamp
+ int64_t save_pos = avio_tell(pb);
+ pos = avio_seek(pb, offset, SEEK_SET);
+ if (pos < 0)
+ return pos;
+ tag = avio_rl32(pb);
+ if (tag != HXVF) {
+ av_log(s, AV_LOG_ERROR, "invalid tag %s at pos %u\n",
+ av_fourcc2str(tag), offset);
+ return AVERROR_INVALIDDATA;
+ }
+ avio_skip(pb, 4);
+ // save first frame timestamp to stream start_time
+ st->start_time = avio_rl32(pb);
+ pos = avio_seek(pb, save_pos, SEEK_SET);
+ if (pos < 0)
+ return pos;
+ } else if (time == prev_time) {
+ // hxvs put SPS, PPS and slice into separate entries with same timestamp.
+ // Only record the first entry.
+ continue;
+ }
+ prev_time = time;
+ int ret = ff_add_index_entry(&sti->index_entries,
+ &sti->nb_index_entries,
+ &sti->index_entries_allocated_size,
+ offset, st->start_time + time,
+ 0, 0, AVINDEX_KEYFRAME);
+ if (ret < 0)
+ return ret;
+ }
+
+ return 0;
+}
+
+static int hxvs_read_header(AVFormatContext *s)
+{
+ AVIOContext *pb = s->pb;
+ uint32_t tag = avio_rl32(pb);
+ enum AVCodecID codec_id;
+
+ if (tag == HXVS) {
+ codec_id = AV_CODEC_ID_H264;
+ } else if (tag == HXVT) {
+ codec_id = AV_CODEC_ID_HEVC;
+ } else {
+ av_log(s, AV_LOG_ERROR, "Unknown tag %s\n", av_fourcc2str(tag));
+ return AVERROR_INVALIDDATA;
+ }
+
+ int ret = hxvs_create_video_stream(s, codec_id);
+ if (ret < 0)
+ return ret;
+
+ ret = hxvs_create_audio_stream(s);
+ if (ret < 0)
+ return ret;
+
+ if (pb->seekable & AVIO_SEEKABLE_NORMAL) {
+ int64_t pos = avio_tell(pb);
+ if (pos < 0)
+ return pos;
+
+ ret = hxvs_build_index(s);
+ if (ret < 0)
+ return ret;
+
+ pos = avio_seek(pb, pos, SEEK_SET);
+ if (pos < 0)
+ return ret;
+ }
+
+ return 0;
+}
+
+static int hxvs_read_packet(AVFormatContext *s, AVPacket *pkt)
+{
+ HxvsContext *ctx = s->priv_data;
+ AVIOContext *pb = s->pb;
+ int64_t pos = avio_tell(pb);
+ uint32_t tag = avio_rl32(pb);
+ uint32_t bytes;
+ int ret;
+
+ if (avio_feof(pb) || (tag == HXFI))
+ return AVERROR_EOF;
+
+ if (tag != HXVF && tag != HXAF)
+ return AVERROR_INVALIDDATA;
+
+ bytes = avio_rl32(pb);
+ if (bytes < 4)
+ return AVERROR_INVALIDDATA;
+
+ uint32_t timestamp = avio_rl32(pb);
+ int key_flag = 0;
+ int index;
+ if (tag == HXVF) {
+ if (avio_rl32(pb) == 1)
+ key_flag = AV_PKT_FLAG_KEY;
+ index = ctx->video_index;
+ } else {
+ avio_skip(pb, 8);
+ index = ctx->audio_index;
+ bytes -= 4;
+ }
+
+ ret = av_get_packet(pb, pkt, bytes);
+ if (ret < 0)
+ return ret;
+ pkt->pts = timestamp;
+ pkt->pos = pos;
+ pkt->stream_index = index;
+ pkt->flags |= key_flag;
+
+ return 0;
+}
+
+const FFInputFormat ff_hxvs_demuxer = {
+ .p.name = "hxvs",
+ .p.long_name = NULL_IF_CONFIG_SMALL("HXVF/HXVS IP camera format"),
+ .p.extensions = "264,265",
+ .p.flags = AVFMT_GENERIC_INDEX,
+ .read_probe = hxvs_probe,
+ .read_header = hxvs_read_header,
+ .read_packet = hxvs_read_packet,
+ .priv_data_size = sizeof(HxvsContext),
+};
diff --git a/libavformat/version.h b/libavformat/version.h
index 384cbd49cc..4bde82abb4 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -31,8 +31,8 @@
#include "version_major.h"
-#define LIBAVFORMAT_VERSION_MINOR 5
-#define LIBAVFORMAT_VERSION_MICRO 101
+#define LIBAVFORMAT_VERSION_MINOR 6
+#define LIBAVFORMAT_VERSION_MICRO 100
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \
-----------------------------------------------------------------------
Summary of changes:
Changelog | 1 +
configure | 1 +
libavformat/Makefile | 1 +
libavformat/allformats.c | 1 +
libavformat/hxvs.c | 340 ++++++++++++++++++++++++++++++++++++++++++++++
libavformat/version.h | 4 +-
tests/fate/demux.mak | 3 +
tests/ref/fate/hxvs-demux | 197 +++++++++++++++++++++++++++
8 files changed, 546 insertions(+), 2 deletions(-)
create mode 100644 libavformat/hxvs.c
create mode 100644 tests/ref/fate/hxvs-demux
hooks/post-receive
--
1
0
[ffmpeg] branch master updated. db0b86a4ad avformat/udp: fix warning about unused varible
by ffmpeg-git@ffmpeg.org 21 Sep '25
by ffmpeg-git@ffmpeg.org 21 Sep '25
21 Sep '25
The branch, master has been updated
via db0b86a4adf3ffe592ea70e756d615e89138eee0 (commit)
from 55e71768cf7d9cb395187be0cf38e97b9c454ea1 (commit)
- Log -----------------------------------------------------------------
commit db0b86a4adf3ffe592ea70e756d615e89138eee0
Author: Brad Smith <brad(a)comstyle.com>
AuthorDate: Sat Sep 20 01:51:45 2025 -0400
Commit: Brad Smith <brad(a)comstyle.com>
CommitDate: Sat Sep 20 22:59:50 2025 -0400
avformat/udp: fix warning about unused varible
libavformat/udp.c:283:9: warning: unused variable 'i' [-Wunused-variable]
Signed-off-by: Brad Smith <brad(a)comstyle.com>
diff --git a/libavformat/udp.c b/libavformat/udp.c
index e1dec49010..839c301369 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -282,14 +282,12 @@ static int udp_set_multicast_sources(URLContext *h,
struct sockaddr_storage *sources,
int nb_sources, int include)
{
- int i;
if (addr->sa_family != AF_INET) {
#if HAVE_STRUCT_GROUP_SOURCE_REQ && defined(MCAST_BLOCK_SOURCE)
/* For IPv4 prefer the old approach, as that alone works reliably on
* Windows and it also supports supplying the interface based on its
* address. */
- int i;
- for (i = 0; i < nb_sources; i++) {
+ for (int i = 0; i < nb_sources; i++) {
struct group_source_req mreqs;
int level = addr->sa_family == AF_INET ? IPPROTO_IP : IPPROTO_IPV6;
@@ -316,7 +314,7 @@ static int udp_set_multicast_sources(URLContext *h,
#endif
}
#if HAVE_STRUCT_IP_MREQ_SOURCE && defined(IP_BLOCK_SOURCE)
- for (i = 0; i < nb_sources; i++) {
+ for (int i = 0; i < nb_sources; i++) {
struct ip_mreq_source mreqs;
if (sources[i].ss_family != AF_INET) {
av_log(h, AV_LOG_ERROR, "Source/block address %d is of incorrect protocol family\n", i + 1);
-----------------------------------------------------------------------
Summary of changes:
libavformat/udp.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
hooks/post-receive
--
1
0