The branch, master has been updated
via f47b270b415d988437ae9eec56a761a8caf73d03 (commit)
via fe0a31329931e0771814b5dbc093f0604986adae (commit)
via a35c91dc14e5b4d3e724a5d9656f46b6b5298fef (commit)
from b8256b82f5341d9ae5774f77779507db09f97b96 (commit)
- Log -----------------------------------------------------------------
commit f47b270b415d988437ae9eec56a761a8caf73d03
Author: Andreas Rheinhardt <[email protected]>
AuthorDate: Mon Sep 15 19:33:41 2025 +0200
Commit: Andreas Rheinhardt <[email protected]>
CommitDate: Tue Sep 16 18:23:52 2025 +0200
avfilter/vf_colordetect: Move ff_color_detect_dsp_init() out of .c file
Otherwise checkasm pulls in vf_colordetect.o and then all of
libavfilter.
Reviewed-by: Martin Storsjö <[email protected]>
Reviewed-by: Niklas Haas <[email protected]>
Signed-off-by: Andreas Rheinhardt <[email protected]>
diff --git a/libavfilter/vf_colordetect.c b/libavfilter/vf_colordetect.c
index ee4288c839..14b75b72ce 100644
--- a/libavfilter/vf_colordetect.c
+++ b/libavfilter/vf_colordetect.c
@@ -233,23 +233,6 @@ static av_cold void uninit(AVFilterContext *ctx)
}
}
-av_cold void ff_color_detect_dsp_init(FFColorDetectDSPContext *dsp, int depth,
- enum AVColorRange color_range)
-{
- dsp->detect_range = depth > 8 ? ff_detect_range16_c : ff_detect_range_c;
- if (color_range == AVCOL_RANGE_JPEG) {
- dsp->detect_alpha = depth > 8 ? ff_detect_alpha16_full_c :
ff_detect_alpha_full_c;
- } else {
- dsp->detect_alpha = depth > 8 ? ff_detect_alpha16_limited_c :
ff_detect_alpha_limited_c;
- }
-
-#if ARCH_AARCH64
- ff_color_detect_dsp_init_aarch64(dsp, depth, color_range);
-#elif ARCH_X86
- ff_color_detect_dsp_init_x86(dsp, depth, color_range);
-#endif
-}
-
static const AVFilterPad colordetect_inputs[] = {
{
.name = "default",
diff --git a/libavfilter/vf_colordetectdsp.h b/libavfilter/vf_colordetectdsp.h
index 2ce3d061a3..7a57e7aa73 100644
--- a/libavfilter/vf_colordetectdsp.h
+++ b/libavfilter/vf_colordetectdsp.h
@@ -22,6 +22,9 @@
#include <stddef.h>
#include <stdint.h>
+#include "config.h"
+
+#include "libavutil/attributes.h"
#include "libavutil/avassert.h"
#include "libavutil/pixfmt.h"
@@ -46,9 +49,6 @@ typedef struct FFColorDetectDSPContext {
int alpha_max, int mpeg_range, int offset);
} FFColorDetectDSPContext;
-void ff_color_detect_dsp_init(FFColorDetectDSPContext *dsp, int depth,
- enum AVColorRange color_range);
-
void ff_color_detect_dsp_init_aarch64(FFColorDetectDSPContext *dsp, int depth,
enum AVColorRange color_range);
void ff_color_detect_dsp_init_x86(FFColorDetectDSPContext *dsp, int depth,
@@ -195,4 +195,22 @@ ff_detect_alpha16_limited_c(const uint8_t *color,
ptrdiff_t color_stride,
return transparent ? FF_ALPHA_TRANSPARENT : 0;
}
+static av_cold inline void
+ff_color_detect_dsp_init(FFColorDetectDSPContext *dsp, int depth,
+ enum AVColorRange color_range)
+{
+ dsp->detect_range = depth > 8 ? ff_detect_range16_c : ff_detect_range_c;
+ if (color_range == AVCOL_RANGE_JPEG) {
+ dsp->detect_alpha = depth > 8 ? ff_detect_alpha16_full_c :
ff_detect_alpha_full_c;
+ } else {
+ dsp->detect_alpha = depth > 8 ? ff_detect_alpha16_limited_c :
ff_detect_alpha_limited_c;
+ }
+
+#if ARCH_AARCH64
+ ff_color_detect_dsp_init_aarch64(dsp, depth, color_range);
+#elif ARCH_X86
+ ff_color_detect_dsp_init_x86(dsp, depth, color_range);
+#endif
+}
+
#endif /* AVFILTER_COLORDETECTDSP_H */
commit fe0a31329931e0771814b5dbc093f0604986adae
Author: Andreas Rheinhardt <[email protected]>
AuthorDate: Mon Sep 15 19:14:39 2025 +0200
Commit: Andreas Rheinhardt <[email protected]>
CommitDate: Tue Sep 16 18:23:45 2025 +0200
avfilter/vf_colordetect: Avoid sequentially consistent atomics
Reviewed-by: Martin Storsjö <[email protected]>
Reviewed-by: Niklas Haas <[email protected]>
Signed-off-by: Andreas Rheinhardt <[email protected]>
diff --git a/libavfilter/vf_colordetect.c b/libavfilter/vf_colordetect.c
index 7abe6659a3..ee4288c839 100644
--- a/libavfilter/vf_colordetect.c
+++ b/libavfilter/vf_colordetect.c
@@ -138,7 +138,8 @@ static int detect_range(AVFilterContext *ctx, void *arg,
if (s->dsp.detect_range(in->data[0] + y_start * stride, stride,
in->width, h_slice, s->mpeg_min, s->mpeg_max))
- atomic_store(&s->detected_range, AVCOL_RANGE_JPEG);
+ atomic_store_explicit(&s->detected_range, AVCOL_RANGE_JPEG,
+ memory_order_relaxed);
return 0;
}
@@ -194,11 +195,13 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
ColorDetectContext *s = ctx->priv;
const int nb_threads = FFMIN(inlink->h, s->nb_threads);
- if (s->mode & COLOR_DETECT_COLOR_RANGE && s->detected_range ==
AVCOL_RANGE_UNSPECIFIED)
+ enum AVColorRange detected_range =
atomic_load_explicit(&s->detected_range, memory_order_relaxed);
+ if (s->mode & COLOR_DETECT_COLOR_RANGE && detected_range ==
AVCOL_RANGE_UNSPECIFIED)
ff_filter_execute(ctx, detect_range, in, NULL, nb_threads);
- if (s->mode & COLOR_DETECT_ALPHA_MODE && s->detected_alpha !=
FF_ALPHA_NONE &&
- s->detected_alpha != FF_ALPHA_STRAIGHT)
+ enum FFAlphaDetect detected_alpha =
atomic_load_explicit(&s->detected_alpha, memory_order_relaxed);
+ if (s->mode & COLOR_DETECT_ALPHA_MODE && detected_alpha != FF_ALPHA_NONE &&
+ detected_alpha != FF_ALPHA_STRAIGHT)
ff_filter_execute(ctx, detect_alpha, in, NULL, nb_threads);
return ff_filter_frame(inlink->dst->outputs[0], in);
@@ -212,17 +215,21 @@ static av_cold void uninit(AVFilterContext *ctx)
av_log(ctx, AV_LOG_INFO, "Detected color properties:\n");
if (s->mode & COLOR_DETECT_COLOR_RANGE) {
+ enum AVColorRange detected_range =
atomic_load_explicit(&s->detected_range,
+
memory_order_relaxed);
av_log(ctx, AV_LOG_INFO, " Color range: %s\n",
- s->detected_range == AVCOL_RANGE_JPEG ? "JPEG / full range"
- : "undetermined");
+ detected_range == AVCOL_RANGE_JPEG ? "JPEG / full range"
+ : "undetermined");
}
if (s->mode & COLOR_DETECT_ALPHA_MODE) {
+ enum FFAlphaDetect detected_alpha =
atomic_load_explicit(&s->detected_alpha,
+
memory_order_relaxed);
av_log(ctx, AV_LOG_INFO, " Alpha mode: %s\n",
- s->detected_alpha == FF_ALPHA_NONE ? "none" :
- s->detected_alpha == FF_ALPHA_STRAIGHT ? "straight" :
- s->detected_alpha == FF_ALPHA_TRANSPARENT ? "undetermined"
- : "opaque");
+ detected_alpha == FF_ALPHA_NONE ? "none" :
+ detected_alpha == FF_ALPHA_STRAIGHT ? "straight" :
+ detected_alpha == FF_ALPHA_TRANSPARENT ? "undetermined"
+ : "opaque");
}
}
commit a35c91dc14e5b4d3e724a5d9656f46b6b5298fef
Author: Andreas Rheinhardt <[email protected]>
AuthorDate: Mon Sep 15 18:45:24 2025 +0200
Commit: Andreas Rheinhardt <[email protected]>
CommitDate: Tue Sep 16 18:22:24 2025 +0200
avfilter/vf_colordetect: Rename header to vf_colordetectdsp.h
It is more in line with our naming conventions.
Reviewed-by: Martin Storsjö <[email protected]>
Reviewed-by: Niklas Haas <[email protected]>
Signed-off-by: Andreas Rheinhardt <[email protected]>
diff --git a/libavfilter/aarch64/vf_colordetect_init.c
b/libavfilter/aarch64/vf_colordetect_init.c
index 4db6b90542..2fd23513e3 100644
--- a/libavfilter/aarch64/vf_colordetect_init.c
+++ b/libavfilter/aarch64/vf_colordetect_init.c
@@ -19,7 +19,7 @@
*/
#include "libavutil/aarch64/cpu.h"
-#include "libavfilter/vf_colordetect.h"
+#include "libavfilter/vf_colordetectdsp.h"
int ff_detect_alpha_full_neon(const uint8_t *color, ptrdiff_t color_stride,
const uint8_t *alpha, ptrdiff_t alpha_stride,
diff --git a/libavfilter/vf_colordetect.c b/libavfilter/vf_colordetect.c
index ef7fb25130..7abe6659a3 100644
--- a/libavfilter/vf_colordetect.c
+++ b/libavfilter/vf_colordetect.c
@@ -37,7 +37,7 @@
#include "formats.h"
#include "video.h"
-#include "vf_colordetect.h"
+#include "vf_colordetectdsp.h"
enum ColorDetectMode {
COLOR_DETECT_COLOR_RANGE = 1 << 0,
diff --git a/libavfilter/vf_colordetect.h b/libavfilter/vf_colordetectdsp.h
similarity index 98%
rename from libavfilter/vf_colordetect.h
rename to libavfilter/vf_colordetectdsp.h
index aa974bb1fd..2ce3d061a3 100644
--- a/libavfilter/vf_colordetect.h
+++ b/libavfilter/vf_colordetectdsp.h
@@ -16,8 +16,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef AVFILTER_COLORDETECT_H
-#define AVFILTER_COLORDETECT_H
+#ifndef AVFILTER_COLORDETECTDSP_H
+#define AVFILTER_COLORDETECTDSP_H
#include <stddef.h>
#include <stdint.h>
@@ -195,4 +195,4 @@ ff_detect_alpha16_limited_c(const uint8_t *color, ptrdiff_t
color_stride,
return transparent ? FF_ALPHA_TRANSPARENT : 0;
}
-#endif /* AVFILTER_COLORDETECT_H */
+#endif /* AVFILTER_COLORDETECTDSP_H */
diff --git a/libavfilter/x86/vf_colordetect_init.c
b/libavfilter/x86/vf_colordetect_init.c
index 72fa021bf2..7257b5c4f5 100644
--- a/libavfilter/x86/vf_colordetect_init.c
+++ b/libavfilter/x86/vf_colordetect_init.c
@@ -20,7 +20,7 @@
#include "libavutil/attributes.h"
#include "libavutil/x86/cpu.h"
-#include "libavfilter/vf_colordetect.h"
+#include "libavfilter/vf_colordetectdsp.h"
#define DETECT_RANGE_FUNC(FUNC_NAME, ASM_FUNC_NAME, C_FUNC_NAME, SHIFT,
MMSIZE) \
int ASM_FUNC_NAME(const uint8_t *src, ptrdiff_t stride,
\
diff --git a/tests/checkasm/vf_colordetect.c b/tests/checkasm/vf_colordetect.c
index 18472e9b66..471f77fcc7 100644
--- a/tests/checkasm/vf_colordetect.c
+++ b/tests/checkasm/vf_colordetect.c
@@ -19,7 +19,7 @@
#include <string.h>
#include "checkasm.h"
-#include "libavfilter/vf_colordetect.h"
+#include "libavfilter/vf_colordetectdsp.h"
#include "libavutil/mem_internal.h"
#define WIDTH 540
-----------------------------------------------------------------------
Summary of changes:
libavfilter/aarch64/vf_colordetect_init.c | 2 +-
libavfilter/vf_colordetect.c | 46 +++++++++-------------
.../{vf_colordetect.h => vf_colordetectdsp.h} | 30 +++++++++++---
libavfilter/x86/vf_colordetect_init.c | 2 +-
tests/checkasm/vf_colordetect.c | 2 +-
5 files changed, 45 insertions(+), 37 deletions(-)
rename libavfilter/{vf_colordetect.h => vf_colordetectdsp.h} (89%)
hooks/post-receive
--
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]