From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 4DB754C76F for ; Mon, 15 Sep 2025 17:52:28 +0000 (UTC) Authentication-Results: ffbox; dkim=fail (body hash mismatch (got b'aqDgDmcIrjw7lEZ1OBx8Qmp01vBMJ5zEU5pKIeiRYzY=', expected b'cNkfWFqiHAj+WBvzFgDOt+KqrYfY3QARFXo0ZyjeBx8=')) header.d=ffmpeg.org header.i=@ffmpeg.org header.a=rsa-sha256 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1757958742; h=mime-version : to : date : message-id : reply-to : subject : list-id : list-archive : list-archive : list-help : list-owner : list-post : list-subscribe : list-unsubscribe : from : cc : content-type : content-transfer-encoding : from; bh=aqDgDmcIrjw7lEZ1OBx8Qmp01vBMJ5zEU5pKIeiRYzY=; b=zgDnrRpQ3MOlb+a17EYGjHbXKzFptAk4yqGG8oDYeJxUzwvhdBmGj0GNJV2QxrZNC7AlR yWyYXGVImkaJYCxbMt7b0uUl97fotzU6joZRg8YXUZZO9UrnicMaVtb5M569UQF8BcB6G7d 97tUc01AsES9pZUwDx7RJp3TGZCZwFNykhhZDMp+uSBMCVCXuZJuDLptQ9LXiYLjitZmKSJ FE6NCQAsoS6d9QYTqyYAL/d4A7U97uavTCVdatRQ9ei048UtoZ5Jzf5z9XIbe2/yL1Don0z b0GoSRuNUtPOa3rXiA7t/R+yZB+L+LPJ4fJn6ZkYL39S82/ENX9yrd4DqJYQ== Received: from [172.19.0.4] (unknown [172.19.0.4]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id BCF8E68E922; Mon, 15 Sep 2025 20:52:22 +0300 (EEST) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=ffmpeg.org; s=arc; t=1757958742; b=C+eMhQ+NR+Vh8ZWKp8xyxIsGRNeJLQOSHAIrKqAFCnb9Zm4Ag2bswPGMWLBM+Y5mL1Rxs HzfwPAv9gOT9Sj9pDLRpzQs8d9KK06aoHjAMbxmB3HMj1t3+numxp67P8SpdWszVcIj4Pn7 7oVsz7Sf3Hopwa704rZVcUyJpZnraGUj0VHRahR2TTSIiobIh4UL1HE1ahYO5bEVk1uVy/X 7LKZX87slfkDx8OTjjUuYNJmkihS+QDmUsFzUiKuXiutbmZ/qdMefD2iQWXg857GPM6ZykB K7i4wgA5XtrvAUKzkktmUSqrof2oR2U4Ek7jlg/J8Pa/b3Mm2zTjBAhGnmtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=ffmpeg.org; s=arc; t=1757958742; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=2415QoSTBGYIxx5zYYH2mB+bVWD+Ut76/XWTCLayPNI=; b=mGT5USHbWQp0jIcE54cMO2vy6ybLFG0rwaUqj5rV2Pl6fAo1GPljazMccOjxYlMQ3XmTH JDcNOwwAwlkwgcpe8OQGkK25DqlhdRug9t2eaAY8awW69Z2WnYkI5BWqBLTZNglBQQuIKMC IgAoOsP6L2IAemo50wzweNxrgo4GZqPSyrrVe2j2nFGMY5JYm8h9Oi3PnaEoWLKXOoJix7e AomHHXljGcxUdWwQR1pJp1apybApuTcSHLhMimLRReHLNCmJShDX8qDMD52az04VkzPnqnf NQeYEKh0DD3fVZQvcZ7hYlLOWc/Ayss3CTGPJwJ/xZRNeE+BnfFkOfO7tMpA== ARC-Authentication-Results: i=1; ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none; dmarc=none Authentication-Results: ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none (Message is not ARC signed); dmarc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1757958734; h=content-type : mime-version : content-transfer-encoding : from : to : reply-to : subject : date : from; bh=cNkfWFqiHAj+WBvzFgDOt+KqrYfY3QARFXo0ZyjeBx8=; b=NF0suIUOZ+FKx5hUscz/ksbe+ao2FVk2vdbnU0cn5aBco125yLhKd2U1vnQJOOSuP82dL fjoGC/5lEWEn48O3TCHKaOJsJJLu8uqQINKOubZKlGA+BoXJdsGw/1qCoQKLuYa545tHjHR mKEvwb+gLVwL7BRwOF0NbEnBgGEp/iOI6iY/rakVmQG/atslk7eAPUqGwJvvkW8eJlEIk4F 9bB84HuzCZQ8k1RZ6qqARx3vxiMRhvRnscW6uF6umemeanlJNmoMDetLqUW1StZb2LsxfEX qbfjwlO6gQ6mvL1Zl2FIPjAI6HIL07jWobs4aqGZFbaRyxBEmxh6v0cFI+cQ== Received: from ed19c606a818 (code.ffmpeg.org [188.245.149.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 63AAA68E909 for ; Mon, 15 Sep 2025 20:52:14 +0300 (EEST) MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Date: Mon, 15 Sep 2025 17:52:14 -0000 Message-ID: <175795873457.25.2675586929786155105@463a07221176> Message-ID-Hash: RSIC447YR4TAVHSCH6UPAQXWQ3J5AZ6V X-Message-ID-Hash: RSIC447YR4TAVHSCH6UPAQXWQ3J5AZ6V X-MailFrom: code@ffmpeg.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-ffmpeg-devel.ffmpeg.org-0; header-match-ffmpeg-devel.ffmpeg.org-1; header-match-ffmpeg-devel.ffmpeg.org-2; header-match-ffmpeg-devel.ffmpeg.org-3; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list Reply-To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] [PATCH] Don't link all of libavfilter in checkasm (PR #20529) List-Id: FFmpeg development discussions and patches Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: mkver via ffmpeg-devel Cc: mkver Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Archived-At: List-Archive: List-Post: PR #20529 opened by mkver URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20529 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20529.patch >>From 10ff1b2875904afbf8059e271fa664d90c5c30f3 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Mon, 15 Sep 2025 18:45:24 +0200 Subject: [PATCH 1/3] avfilter/vf_colordetect: Rename header to vf_colordetectdsp.h It is more in line with our naming conventions. Signed-off-by: Andreas Rheinhardt --- libavfilter/aarch64/vf_colordetect_init.c | 2 +- libavfilter/vf_colordetect.c | 2 +- libavfilter/{vf_colordetect.h => vf_colordetectdsp.h} | 6 +++--- libavfilter/x86/vf_colordetect_init.c | 2 +- tests/checkasm/vf_colordetect.c | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) rename libavfilter/{vf_colordetect.h => vf_colordetectdsp.h} (98%) 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 #include @@ -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 #include "checkasm.h" -#include "libavfilter/vf_colordetect.h" +#include "libavfilter/vf_colordetectdsp.h" #include "libavutil/mem_internal.h" #define WIDTH 540 -- 2.49.1 >>From 9dc8797420e8161a53dac0813d64cacbf9f2dc95 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Mon, 15 Sep 2025 19:14:39 +0200 Subject: [PATCH 2/3] avfilter/vf_colordetect: Avoid sequentially consistent atomics Signed-off-by: Andreas Rheinhardt --- libavfilter/vf_colordetect.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) 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"); } } -- 2.49.1 >>From 0349b549a2f22c5fd591a02b0a9f2bd85ff13d4e Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Mon, 15 Sep 2025 19:33:41 +0200 Subject: [PATCH 3/3] 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. Signed-off-by: Andreas Rheinhardt --- libavfilter/vf_colordetect.c | 17 ----------------- libavfilter/vf_colordetectdsp.h | 24 +++++++++++++++++++++--- 2 files changed, 21 insertions(+), 20 deletions(-) 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 #include +#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 */ -- 2.49.1 _______________________________________________ ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org