PR #21281 opened by Zhaozhenghang
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21281
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21281.patch

TX_TYPE_ANY was defined as INT32_MAX and assigned to enum AVTXType,
which triggers overflow and type-limits warnings on some platforms.
Use a proper enum value instead.

Signed-off-by: zhaozhenghang <[email protected]>


>From 8799ce68804d07fec8ec0a3a9a0053582fcf48fd Mon Sep 17 00:00:00 2001
From: zhaozhenghang <[email protected]>
Date: Tue, 23 Dec 2025 16:08:03 +0800
Subject: [PATCH] avutil/tx: fix AVTXType warnings on some platforms

TX_TYPE_ANY was defined as INT32_MAX and assigned to enum AVTXType,
which triggers overflow and type-limits warnings on some platforms.
Use a proper enum value instead.

Signed-off-by: zhaozhenghang <[email protected]>
---
 libavutil/tx.c      | 8 ++++----
 libavutil/tx.h      | 3 +++
 libavutil/tx_priv.h | 1 -
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/libavutil/tx.c b/libavutil/tx.c
index 05c132ada1..15f0579cc1 100644
--- a/libavutil/tx.c
+++ b/libavutil/tx.c
@@ -320,7 +320,7 @@ static void ff_tx_null(AVTXContext *s, void *_out, void 
*_in, ptrdiff_t stride)
 static const FFTXCodelet ff_tx_null_def = {
     .name       = NULL_IF_CONFIG_SMALL("null"),
     .function   = ff_tx_null,
-    .type       = TX_TYPE_ANY,
+    .type       = AV_TX_TYPE_ANY,
     .flags      = AV_TX_UNALIGNED | FF_TX_ALIGNED |
                   FF_TX_OUT_OF_PLACE | AV_TX_INPLACE,
     .factors[0] = TX_FACTOR_ANY,
@@ -433,7 +433,7 @@ int ff_tx_decompose_length(int dst[TX_MAX_DECOMPOSITIONS], 
enum AVTXType type,
                 goto sort;
 
             /* Check if the type matches */
-            if (cd->type != TX_TYPE_ANY && type != cd->type)
+            if (cd->type != AV_TX_TYPE_ANY && type != cd->type)
                 continue;
 
             /* Check direction for non-orthogonal codelets */
@@ -575,7 +575,7 @@ static void print_flags(AVBPrint *bp, uint64_t f)
 static void print_type(AVBPrint *bp, enum AVTXType type)
 {
     av_bprintf(bp, "%s",
-               type == TX_TYPE_ANY       ? "any"         :
+               type == AV_TX_TYPE_ANY    ? "any"         :
                type == AV_TX_FLOAT_FFT   ? "fft_float"   :
                type == AV_TX_FLOAT_MDCT  ? "mdct_float"  :
                type == AV_TX_FLOAT_RDFT  ? "rdft_float"  :
@@ -755,7 +755,7 @@ av_cold int ff_tx_init_subtx(AVTXContext *s, enum AVTXType 
type,
 
         while ((cd = *list++)) {
             /* Check if the type matches */
-            if (cd->type != TX_TYPE_ANY && type != cd->type)
+            if (cd->type != AV_TX_TYPE_ANY && type != cd->type)
                 continue;
 
             /* Check direction for non-orthogonal codelets */
diff --git a/libavutil/tx.h b/libavutil/tx.h
index c950095735..285efaab2d 100644
--- a/libavutil/tx.h
+++ b/libavutil/tx.h
@@ -129,6 +129,9 @@ enum AVTXType {
     AV_TX_DOUBLE_DST_I = 16,
     AV_TX_INT32_DST_I  = 17,
 
+    /* Special type to allow all types */
+    AV_TX_TYPE_ANY,
+
     /* Not part of the API, do not use */
     AV_TX_NB,
 };
diff --git a/libavutil/tx_priv.h b/libavutil/tx_priv.h
index d3fcdbf563..c90dee8ac2 100644
--- a/libavutil/tx_priv.h
+++ b/libavutil/tx_priv.h
@@ -200,7 +200,6 @@ typedef struct FFTXCodelet {
     const char    *name;          /* Codelet name, for debugging */
     av_tx_fn       function;      /* Codelet function, != NULL */
     enum AVTXType  type;          /* Type of codelet transform */
-#define TX_TYPE_ANY INT32_MAX     /* Special type to allow all types */
 
     uint64_t flags;               /* A combination of AVTXFlags and codelet
                                    * flags that describe its properties. */
-- 
2.49.1

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to