diff mbox series

[FFmpeg-devel,11/12] swscale/internal: add typedefs for input reading functions

Message ID 20241005192403.2450339-11-ffmpeg@haasn.xyz
State New
Headers show
Series [FFmpeg-devel,01/12] avfilter/src_movie: configure correct YUV attributes | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 fail Make failed

Commit Message

Niklas Haas Oct. 5, 2024, 7:24 p.m. UTC
From: Niklas Haas <git@haasn.dev>

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
---
 libswscale/swscale_internal.h | 47 +++++++++++++++++++++++------------
 1 file changed, 31 insertions(+), 16 deletions(-)

Comments

Michael Niedermayer Oct. 6, 2024, 10:30 p.m. UTC | #1
On Sat, Oct 05, 2024 at 09:24:02PM +0200, Niklas Haas wrote:
> From: Niklas Haas <git@haasn.dev>
> 
> Sponsored-by: Sovereign Tech Fund
> Signed-off-by: Niklas Haas <git@haasn.dev>
> ---
>  libswscale/swscale_internal.h | 47 +++++++++++++++++++++++------------
>  1 file changed, 31 insertions(+), 16 deletions(-)
> 
> diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h
> index 0e9d37b5b0..e87b073d57 100644
> --- a/libswscale/swscale_internal.h
> +++ b/libswscale/swscale_internal.h
> @@ -292,6 +292,31 @@ typedef void (*yuv2anyX_fn)(struct SwsContext *c, const int16_t *lumFilter,
>                              const int16_t **alpSrc, uint8_t **dest,
>                              int dstW, int y);
>  
> +/**
> + * Unscaled conversion of luma/alpha plane to YV12 for horizontal scaler.
> + */
> +typedef void (*planar1_YV12_fn)(uint8_t *dst, const uint8_t *src, const uint8_t *src2,
> +                                const uint8_t *src3, int width, uint32_t *pal,
> +                                void *opaque);
> +
> +/**
> + * Unscaled conversion of chroma plane to YV12 for horizontal scaler.
> + */
> +typedef void (*planar2_YV12_fn)(uint8_t *dst, uint8_t *dst2, const uint8_t *src,
> +                                const uint8_t *src2, const uint8_t *src3,
> +                                int width, uint32_t *pal, void *opaque);
> +

iam not 100% sure the names are perfect but the patch is ok, we can rename
them later, if someone has a better name (i dont have one ATM)

thx

[...]
diff mbox series

Patch

diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h
index 0e9d37b5b0..e87b073d57 100644
--- a/libswscale/swscale_internal.h
+++ b/libswscale/swscale_internal.h
@@ -292,6 +292,31 @@  typedef void (*yuv2anyX_fn)(struct SwsContext *c, const int16_t *lumFilter,
                             const int16_t **alpSrc, uint8_t **dest,
                             int dstW, int y);
 
+/**
+ * Unscaled conversion of luma/alpha plane to YV12 for horizontal scaler.
+ */
+typedef void (*planar1_YV12_fn)(uint8_t *dst, const uint8_t *src, const uint8_t *src2,
+                                const uint8_t *src3, int width, uint32_t *pal,
+                                void *opaque);
+
+/**
+ * Unscaled conversion of chroma plane to YV12 for horizontal scaler.
+ */
+typedef void (*planar2_YV12_fn)(uint8_t *dst, uint8_t *dst2, const uint8_t *src,
+                                const uint8_t *src2, const uint8_t *src3,
+                                int width, uint32_t *pal, void *opaque);
+
+/**
+ * Unscaled conversion of arbitrary planar data (e.g. RGBA) to YV12, through
+ * conversion using the given color matrix.
+ */
+typedef void (*planarX_YV12_fn)(uint8_t *dst, const uint8_t *src[4], int width,
+                                int32_t *rgb2yuv, void *opaque);
+
+typedef void (*planarX2_YV12_fn)(uint8_t *dst, uint8_t *dst2,
+                                 const uint8_t *src[4], int width,
+                                 int32_t *rgb2yuv, void *opaque);
+
 struct SwsSlice;
 struct SwsFilterDescriptor;
 
@@ -561,28 +586,18 @@  struct SwsContext {
     /// Opaque data pointer passed to all input functions.
     void *input_opaque;
 
-    /// Unscaled conversion of luma plane to YV12 for horizontal scaler.
-    void (*lumToYV12)(uint8_t *dst, const uint8_t *src, const uint8_t *src2, const uint8_t *src3,
-                      int width, uint32_t *pal, void *opq);
-    /// Unscaled conversion of alpha plane to YV12 for horizontal scaler.
-    void (*alpToYV12)(uint8_t *dst, const uint8_t *src, const uint8_t *src2, const uint8_t *src3,
-                      int width, uint32_t *pal, void *opq);
-    /// Unscaled conversion of chroma planes to YV12 for horizontal scaler.
-    void (*chrToYV12)(uint8_t *dstU, uint8_t *dstV,
-                      const uint8_t *src1, const uint8_t *src2, const uint8_t *src3,
-                      int width, uint32_t *pal, void *opq);
+    planar1_YV12_fn lumToYV12;
+    planar1_YV12_fn alpToYV12;
+    planar2_YV12_fn chrToYV12;
 
     /**
      * Functions to read planar input, such as planar RGB, and convert
      * internally to Y/UV/A.
      */
     /** @{ */
-    void (*readLumPlanar)(uint8_t *dst, const uint8_t *src[4], int width, int32_t *rgb2yuv,
-                          void *opq);
-    void (*readChrPlanar)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src[4],
-                          int width, int32_t *rgb2yuv, void *opq);
-    void (*readAlpPlanar)(uint8_t *dst, const uint8_t *src[4], int width, int32_t *rgb2yuv,
-                          void *opq);
+    planarX_YV12_fn  readLumPlanar;
+    planarX_YV12_fn  readAlpPlanar;
+    planarX2_YV12_fn readChrPlanar;
     /** @} */
 
     /**