PR #23814 opened by Ramiro Polla (ramiro)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23814
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23814.patch

So that they may be used without uops.c.

This will be useful for aarch64/ops_asmgen.c which is built for the
host system, and not the target system.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Ramiro Polla <[email protected]>


>From c6763e16917b8c39033eca5b09f8a360e2e6f471 Mon Sep 17 00:00:00 2001
From: Ramiro Polla <[email protected]>
Date: Tue, 30 Jun 2026 09:24:53 +0200
Subject: [PATCH] swscale/uops: move some simple functions to header file

So that they may be used without uops.c.

This will be useful for aarch64/ops_asmgen.c which is built for the
host system, and not the target system.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Ramiro Polla <[email protected]>
---
 libswscale/ops.c  | 32 --------------------------------
 libswscale/uops.h | 30 ++++++++++++++++++++++++++++--
 2 files changed, 28 insertions(+), 34 deletions(-)

diff --git a/libswscale/ops.c b/libswscale/ops.c
index b9d959c1e7..0582a32345 100644
--- a/libswscale/ops.c
+++ b/libswscale/ops.c
@@ -68,38 +68,6 @@ const char *ff_sws_pixel_type_name(SwsPixelType type)
     return "ERR";
 }
 
-int ff_sws_pixel_type_size(SwsPixelType type)
-{
-    switch (type) {
-    case SWS_PIXEL_U8:  return sizeof(uint8_t);
-    case SWS_PIXEL_U16: return sizeof(uint16_t);
-    case SWS_PIXEL_U32: return sizeof(uint32_t);
-    case SWS_PIXEL_F32: return sizeof(float);
-    case SWS_PIXEL_NONE: break;
-    case SWS_PIXEL_TYPE_NB: break;
-    }
-
-    av_unreachable("Invalid pixel type!");
-    return 0;
-}
-
-bool ff_sws_pixel_type_is_int(SwsPixelType type)
-{
-    switch (type) {
-    case SWS_PIXEL_U8:
-    case SWS_PIXEL_U16:
-    case SWS_PIXEL_U32:
-        return true;
-    case SWS_PIXEL_F32:
-        return false;
-    case SWS_PIXEL_NONE:
-    case SWS_PIXEL_TYPE_NB: break;
-    }
-
-    av_unreachable("Invalid pixel type!");
-    return false;
-}
-
 const char *ff_sws_op_type_name(SwsOpType op)
 {
     switch (op) {
diff --git a/libswscale/uops.h b/libswscale/uops.h
index 923b7743b5..ba63c5d596 100644
--- a/libswscale/uops.h
+++ b/libswscale/uops.h
@@ -45,8 +45,34 @@ typedef enum SwsPixelType {
 } SwsPixelType;
 
 const char *ff_sws_pixel_type_name(SwsPixelType type);
-int ff_sws_pixel_type_size(SwsPixelType type) av_const;
-bool ff_sws_pixel_type_is_int(SwsPixelType type) av_const;
+
+static inline av_const int ff_sws_pixel_type_size(SwsPixelType type)
+{
+    switch (type) {
+    case SWS_PIXEL_U8:  return sizeof(uint8_t);
+    case SWS_PIXEL_U16: return sizeof(uint16_t);
+    case SWS_PIXEL_U32: return sizeof(uint32_t);
+    case SWS_PIXEL_F32: return sizeof(float);
+    case SWS_PIXEL_NONE: break;
+    case SWS_PIXEL_TYPE_NB: break;
+    }
+    return 0;
+}
+
+static inline av_const bool ff_sws_pixel_type_is_int(SwsPixelType type)
+{
+    switch (type) {
+    case SWS_PIXEL_U8:
+    case SWS_PIXEL_U16:
+    case SWS_PIXEL_U32:
+        return true;
+    case SWS_PIXEL_F32:
+        return false;
+    case SWS_PIXEL_NONE:
+    case SWS_PIXEL_TYPE_NB: break;
+    }
+    return false;
+}
 
 typedef union SwsPixel {
     char data[4];
-- 
2.52.0

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

Reply via email to