* [FFmpeg-devel] [PATCH 1/2] swscale: remove unconditional #define DITHER1XBPP
@ 2024-07-04 9:40 Ramiro Polla
2024-07-04 9:40 ` [FFmpeg-devel] [PATCH 2/2] swscale/x86/yuv2rgb: Detemplatize Ramiro Polla
0 siblings, 1 reply; 3+ messages in thread
From: Ramiro Polla @ 2024-07-04 9:40 UTC (permalink / raw)
To: ffmpeg-devel
This seems to have had an use in the past, but it is now defined
unconditionally.
---
libswscale/swscale_internal.h | 2 --
libswscale/utils.c | 4 ----
libswscale/x86/swscale.c | 2 --
libswscale/x86/swscale_template.c | 20 --------------------
libswscale/x86/yuv2rgb.c | 2 --
libswscale/x86/yuv2rgb_template.c | 4 ----
6 files changed, 34 deletions(-)
diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h
index 0818f50c7f..e5610161d0 100644
--- a/libswscale/swscale_internal.h
+++ b/libswscale/swscale_internal.h
@@ -46,8 +46,6 @@
#define MAX_FILTER_SIZE SWS_MAX_FILTER_SIZE
-#define DITHER1XBPP
-
#if HAVE_BIGENDIAN
#define ALT32_CORR (-1)
#else
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 12dba712c1..bc8d7627e2 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -1952,14 +1952,10 @@ static av_cold int sws_init_single_context(SwsContext *c, SwsFilter *srcFilter,
av_log(c, AV_LOG_INFO, "%s scaler, from %s to %s%s ",
scaler,
av_get_pix_fmt_name(srcFormat),
-#ifdef DITHER1XBPP
dstFormat == AV_PIX_FMT_BGR555 || dstFormat == AV_PIX_FMT_BGR565 ||
dstFormat == AV_PIX_FMT_RGB444BE || dstFormat == AV_PIX_FMT_RGB444LE ||
dstFormat == AV_PIX_FMT_BGR444BE || dstFormat == AV_PIX_FMT_BGR444LE ?
"dithered " : "",
-#else
- "",
-#endif
av_get_pix_fmt_name(dstFormat));
if (INLINE_MMXEXT(cpu_flags))
diff --git a/libswscale/x86/swscale.c b/libswscale/x86/swscale.c
index ad7f67f90e..43319fd6b2 100644
--- a/libswscale/x86/swscale.c
+++ b/libswscale/x86/swscale.c
@@ -40,8 +40,6 @@ const DECLARE_ALIGNED(8, uint64_t, ff_dither8)[2] = {
#if HAVE_INLINE_ASM
-#define DITHER1XBPP
-
DECLARE_ASM_CONST(8, uint64_t, bF8)= 0xF8F8F8F8F8F8F8F8LL;
DECLARE_ASM_CONST(8, uint64_t, bFC)= 0xFCFCFCFCFCFCFCFCLL;
diff --git a/libswscale/x86/swscale_template.c b/libswscale/x86/swscale_template.c
index 6190fcb4fe..6bff2a44aa 100644
--- a/libswscale/x86/swscale_template.c
+++ b/libswscale/x86/swscale_template.c
@@ -384,11 +384,9 @@ static void RENAME(yuv2rgb565_X_ar)(SwsContext *c, const int16_t *lumFilter,
YSCALEYUV2RGBX
"pxor %%mm7, %%mm7 \n\t"
/* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
-#ifdef DITHER1XBPP
"paddusb "BLUE_DITHER"(%0), %%mm2\n\t"
"paddusb "GREEN_DITHER"(%0), %%mm4\n\t"
"paddusb "RED_DITHER"(%0), %%mm5\n\t"
-#endif
WRITERGB16(%4, "%5", %%FF_REGa)
YSCALEYUV2PACKEDX_END
}
@@ -408,11 +406,9 @@ static void RENAME(yuv2rgb565_X)(SwsContext *c, const int16_t *lumFilter,
YSCALEYUV2RGBX
"pxor %%mm7, %%mm7 \n\t"
/* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
-#ifdef DITHER1XBPP
"paddusb "BLUE_DITHER"(%0), %%mm2 \n\t"
"paddusb "GREEN_DITHER"(%0), %%mm4 \n\t"
"paddusb "RED_DITHER"(%0), %%mm5 \n\t"
-#endif
WRITERGB16(%4, "%5", %%FF_REGa)
YSCALEYUV2PACKEDX_END
}
@@ -461,11 +457,9 @@ static void RENAME(yuv2rgb555_X_ar)(SwsContext *c, const int16_t *lumFilter,
YSCALEYUV2RGBX
"pxor %%mm7, %%mm7 \n\t"
/* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
-#ifdef DITHER1XBPP
"paddusb "BLUE_DITHER"(%0), %%mm2\n\t"
"paddusb "GREEN_DITHER"(%0), %%mm4\n\t"
"paddusb "RED_DITHER"(%0), %%mm5\n\t"
-#endif
WRITERGB15(%4, "%5", %%FF_REGa)
YSCALEYUV2PACKEDX_END
}
@@ -485,11 +479,9 @@ static void RENAME(yuv2rgb555_X)(SwsContext *c, const int16_t *lumFilter,
YSCALEYUV2RGBX
"pxor %%mm7, %%mm7 \n\t"
/* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
-#ifdef DITHER1XBPP
"paddusb "BLUE_DITHER"(%0), %%mm2 \n\t"
"paddusb "GREEN_DITHER"(%0), %%mm4 \n\t"
"paddusb "RED_DITHER"(%0), %%mm5 \n\t"
-#endif
WRITERGB15(%4, "%5", %%FF_REGa)
YSCALEYUV2PACKEDX_END
}
@@ -891,11 +883,9 @@ static void RENAME(yuv2rgb555_2)(SwsContext *c, const int16_t *buf[2],
YSCALEYUV2RGB(%%FF_REGBP, %5)
"pxor %%mm7, %%mm7 \n\t"
/* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
-#ifdef DITHER1XBPP
"paddusb "BLUE_DITHER"(%5), %%mm2 \n\t"
"paddusb "GREEN_DITHER"(%5), %%mm4 \n\t"
"paddusb "RED_DITHER"(%5), %%mm5 \n\t"
-#endif
WRITERGB15(%%FF_REGb, DSTW_OFFSET"(%5)", %%FF_REGBP)
"pop %%"FF_REG_BP" \n\t"
"mov "ESP_OFFSET"(%5), %%"FF_REG_b" \n\t"
@@ -920,11 +910,9 @@ static void RENAME(yuv2rgb565_2)(SwsContext *c, const int16_t *buf[2],
YSCALEYUV2RGB(%%FF_REGBP, %5)
"pxor %%mm7, %%mm7 \n\t"
/* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
-#ifdef DITHER1XBPP
"paddusb "BLUE_DITHER"(%5), %%mm2 \n\t"
"paddusb "GREEN_DITHER"(%5), %%mm4 \n\t"
"paddusb "RED_DITHER"(%5), %%mm5 \n\t"
-#endif
WRITERGB16(%%FF_REGb, DSTW_OFFSET"(%5)", %%FF_REGBP)
"pop %%"FF_REG_BP" \n\t"
"mov "ESP_OFFSET"(%5), %%"FF_REG_b" \n\t"
@@ -1240,11 +1228,9 @@ static void RENAME(yuv2rgb555_1)(SwsContext *c, const int16_t *buf0,
YSCALEYUV2RGB1(%%FF_REGBP, %5)
"pxor %%mm7, %%mm7 \n\t"
/* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
-#ifdef DITHER1XBPP
"paddusb "BLUE_DITHER"(%5), %%mm2 \n\t"
"paddusb "GREEN_DITHER"(%5), %%mm4 \n\t"
"paddusb "RED_DITHER"(%5), %%mm5 \n\t"
-#endif
WRITERGB15(%%FF_REGb, DSTW_OFFSET"(%5)", %%FF_REGBP)
"pop %%"FF_REG_BP" \n\t"
"mov "ESP_OFFSET"(%5), %%"FF_REG_b" \n\t"
@@ -1261,11 +1247,9 @@ static void RENAME(yuv2rgb555_1)(SwsContext *c, const int16_t *buf0,
YSCALEYUV2RGB1b(%%FF_REGBP, %5)
"pxor %%mm7, %%mm7 \n\t"
/* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
-#ifdef DITHER1XBPP
"paddusb "BLUE_DITHER"(%5), %%mm2 \n\t"
"paddusb "GREEN_DITHER"(%5), %%mm4 \n\t"
"paddusb "RED_DITHER"(%5), %%mm5 \n\t"
-#endif
WRITERGB15(%%FF_REGb, DSTW_OFFSET"(%5)", %%FF_REGBP)
"pop %%"FF_REG_BP" \n\t"
"mov "ESP_OFFSET"(%5), %%"FF_REG_b" \n\t"
@@ -1293,11 +1277,9 @@ static void RENAME(yuv2rgb565_1)(SwsContext *c, const int16_t *buf0,
YSCALEYUV2RGB1(%%FF_REGBP, %5)
"pxor %%mm7, %%mm7 \n\t"
/* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
-#ifdef DITHER1XBPP
"paddusb "BLUE_DITHER"(%5), %%mm2 \n\t"
"paddusb "GREEN_DITHER"(%5), %%mm4 \n\t"
"paddusb "RED_DITHER"(%5), %%mm5 \n\t"
-#endif
WRITERGB16(%%FF_REGb, DSTW_OFFSET"(%5)", %%FF_REGBP)
"pop %%"FF_REG_BP" \n\t"
"mov "ESP_OFFSET"(%5), %%"FF_REG_b" \n\t"
@@ -1314,11 +1296,9 @@ static void RENAME(yuv2rgb565_1)(SwsContext *c, const int16_t *buf0,
YSCALEYUV2RGB1b(%%FF_REGBP, %5)
"pxor %%mm7, %%mm7 \n\t"
/* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
-#ifdef DITHER1XBPP
"paddusb "BLUE_DITHER"(%5), %%mm2 \n\t"
"paddusb "GREEN_DITHER"(%5), %%mm4 \n\t"
"paddusb "RED_DITHER"(%5), %%mm5 \n\t"
-#endif
WRITERGB16(%%FF_REGb, DSTW_OFFSET"(%5)", %%FF_REGBP)
"pop %%"FF_REG_BP" \n\t"
"mov "ESP_OFFSET"(%5), %%"FF_REG_b" \n\t"
diff --git a/libswscale/x86/yuv2rgb.c b/libswscale/x86/yuv2rgb.c
index 41dfa80f33..ddc7cca2c8 100644
--- a/libswscale/x86/yuv2rgb.c
+++ b/libswscale/x86/yuv2rgb.c
@@ -39,8 +39,6 @@
#if HAVE_X86ASM
-#define DITHER1XBPP // only for MMX
-
//SSSE3 versions
#undef RENAME
#define RENAME(a) a ## _ssse3
diff --git a/libswscale/x86/yuv2rgb_template.c b/libswscale/x86/yuv2rgb_template.c
index a4741e6873..abaf80eec2 100644
--- a/libswscale/x86/yuv2rgb_template.c
+++ b/libswscale/x86/yuv2rgb_template.c
@@ -75,11 +75,9 @@ static inline int RENAME(yuv420_rgb15)(SwsContext *c, const uint8_t *src[],
YUV2RGB_LOOP(2)
-#ifdef DITHER1XBPP
c->blueDither = ff_dither8[y & 1];
c->greenDither = ff_dither8[y & 1];
c->redDither = ff_dither8[(y + 1) & 1];
-#endif
RENAME(ff_yuv_420_rgb15)(index, image, pu - index, pv - index, &(c->redDither), py - 2 * index);
}
@@ -95,11 +93,9 @@ static inline int RENAME(yuv420_rgb16)(SwsContext *c, const uint8_t *src[],
YUV2RGB_LOOP(2)
-#ifdef DITHER1XBPP
c->blueDither = ff_dither8[y & 1];
c->greenDither = ff_dither4[y & 1];
c->redDither = ff_dither8[(y + 1) & 1];
-#endif
RENAME(ff_yuv_420_rgb16)(index, image, pu - index, pv - index, &(c->redDither), py - 2 * index);
}
--
2.30.2
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 3+ messages in thread
* [FFmpeg-devel] [PATCH 2/2] swscale/x86/yuv2rgb: Detemplatize
2024-07-04 9:40 [FFmpeg-devel] [PATCH 1/2] swscale: remove unconditional #define DITHER1XBPP Ramiro Polla
@ 2024-07-04 9:40 ` Ramiro Polla
2024-07-08 12:01 ` Ramiro Polla
0 siblings, 1 reply; 3+ messages in thread
From: Ramiro Polla @ 2024-07-04 9:40 UTC (permalink / raw)
To: ffmpeg-devel
Every function in yuv2rgb_template.c is only compiled exactly
once, so detemplatize it.
---
libswscale/x86/yuv2rgb.c | 167 +++++++++++++++++++++++++-
libswscale/x86/yuv2rgb_template.c | 188 ------------------------------
2 files changed, 162 insertions(+), 193 deletions(-)
delete mode 100644 libswscale/x86/yuv2rgb_template.c
diff --git a/libswscale/x86/yuv2rgb.c b/libswscale/x86/yuv2rgb.c
index ddc7cca2c8..68e903c6ad 100644
--- a/libswscale/x86/yuv2rgb.c
+++ b/libswscale/x86/yuv2rgb.c
@@ -1,7 +1,8 @@
/*
* software YUV to RGB converter
*
- * Copyright (C) 2009 Konstantin Shishkov
+ * Copyright (C) 2001-2007 Michael Niedermayer
+ * Copyright (C) 2009-2010 Konstantin Shishkov
*
* MMX/MMXEXT template stuff (needed for fast movntq support),
* 1,4,8bpp support and context / deglobalize stuff
@@ -39,10 +40,166 @@
#if HAVE_X86ASM
-//SSSE3 versions
-#undef RENAME
-#define RENAME(a) a ## _ssse3
-#include "yuv2rgb_template.c"
+#define YUV2RGB_LOOP(depth) \
+ h_size = (c->dstW + 7) & ~7; \
+ if (h_size * depth > FFABS(dstStride[0])) \
+ h_size -= 8; \
+ \
+ vshift = c->srcFormat != AV_PIX_FMT_YUV422P; \
+ \
+ for (y = 0; y < srcSliceH; y++) { \
+ uint8_t *image = dst[0] + (y + srcSliceY) * dstStride[0]; \
+ const uint8_t *py = src[0] + y * srcStride[0]; \
+ const uint8_t *pu = src[1] + (y >> vshift) * srcStride[1]; \
+ const uint8_t *pv = src[2] + (y >> vshift) * srcStride[2]; \
+ x86_reg index = -h_size / 2; \
+
+extern void ff_yuv_420_rgb24_ssse3(x86_reg index, uint8_t *image, const uint8_t *pu_index,
+ const uint8_t *pv_index, const uint64_t *pointer_c_dither,
+ const uint8_t *py_2index);
+extern void ff_yuv_420_bgr24_ssse3(x86_reg index, uint8_t *image, const uint8_t *pu_index,
+ const uint8_t *pv_index, const uint64_t *pointer_c_dither,
+ const uint8_t *py_2index);
+
+extern void ff_yuv_420_rgb15_ssse3(x86_reg index, uint8_t *image, const uint8_t *pu_index,
+ const uint8_t *pv_index, const uint64_t *pointer_c_dither,
+ const uint8_t *py_2index);
+extern void ff_yuv_420_rgb16_ssse3(x86_reg index, uint8_t *image, const uint8_t *pu_index,
+ const uint8_t *pv_index, const uint64_t *pointer_c_dither,
+ const uint8_t *py_2index);
+extern void ff_yuv_420_rgb32_ssse3(x86_reg index, uint8_t *image, const uint8_t *pu_index,
+ const uint8_t *pv_index, const uint64_t *pointer_c_dither,
+ const uint8_t *py_2index);
+extern void ff_yuv_420_bgr32_ssse3(x86_reg index, uint8_t *image, const uint8_t *pu_index,
+ const uint8_t *pv_index, const uint64_t *pointer_c_dither,
+ const uint8_t *py_2index);
+extern void ff_yuva_420_rgb32_ssse3(x86_reg index, uint8_t *image, const uint8_t *pu_index,
+ const uint8_t *pv_index, const uint64_t *pointer_c_dither,
+ const uint8_t *py_2index, const uint8_t *pa_2index);
+extern void ff_yuva_420_bgr32_ssse3(x86_reg index, uint8_t *image, const uint8_t *pu_index,
+ const uint8_t *pv_index, const uint64_t *pointer_c_dither,
+ const uint8_t *py_2index, const uint8_t *pa_2index);
+
+static inline int yuv420_rgb15_ssse3(SwsContext *c, const uint8_t *src[],
+ int srcStride[],
+ int srcSliceY, int srcSliceH,
+ uint8_t *dst[], int dstStride[])
+{
+ int y, h_size, vshift;
+
+ YUV2RGB_LOOP(2)
+
+ c->blueDither = ff_dither8[y & 1];
+ c->greenDither = ff_dither8[y & 1];
+ c->redDither = ff_dither8[(y + 1) & 1];
+
+ ff_yuv_420_rgb15_ssse3(index, image, pu - index, pv - index, &(c->redDither), py - 2 * index);
+ }
+ return srcSliceH;
+}
+
+static inline int yuv420_rgb16_ssse3(SwsContext *c, const uint8_t *src[],
+ int srcStride[],
+ int srcSliceY, int srcSliceH,
+ uint8_t *dst[], int dstStride[])
+{
+ int y, h_size, vshift;
+
+ YUV2RGB_LOOP(2)
+
+ c->blueDither = ff_dither8[y & 1];
+ c->greenDither = ff_dither4[y & 1];
+ c->redDither = ff_dither8[(y + 1) & 1];
+
+ ff_yuv_420_rgb16_ssse3(index, image, pu - index, pv - index, &(c->redDither), py - 2 * index);
+ }
+ return srcSliceH;
+}
+
+static inline int yuv420_rgb32_ssse3(SwsContext *c, const uint8_t *src[],
+ int srcStride[],
+ int srcSliceY, int srcSliceH,
+ uint8_t *dst[], int dstStride[])
+{
+ int y, h_size, vshift;
+
+ YUV2RGB_LOOP(4)
+
+ ff_yuv_420_rgb32_ssse3(index, image, pu - index, pv - index, &(c->redDither), py - 2 * index);
+ }
+ return srcSliceH;
+}
+
+static inline int yuv420_bgr32_ssse3(SwsContext *c, const uint8_t *src[],
+ int srcStride[],
+ int srcSliceY, int srcSliceH,
+ uint8_t *dst[], int dstStride[])
+{
+ int y, h_size, vshift;
+
+ YUV2RGB_LOOP(4)
+
+ ff_yuv_420_bgr32_ssse3(index, image, pu - index, pv - index, &(c->redDither), py - 2 * index);
+ }
+ return srcSliceH;
+}
+
+static inline int yuva420_rgb32_ssse3(SwsContext *c, const uint8_t *src[],
+ int srcStride[],
+ int srcSliceY, int srcSliceH,
+ uint8_t *dst[], int dstStride[])
+{
+ int y, h_size, vshift;
+ YUV2RGB_LOOP(4)
+
+ const uint8_t *pa = src[3] + y * srcStride[3];
+ ff_yuva_420_rgb32_ssse3(index, image, pu - index, pv - index, &(c->redDither), py - 2 * index, pa - 2 * index);
+ }
+ return srcSliceH;
+}
+
+static inline int yuva420_bgr32_ssse3(SwsContext *c, const uint8_t *src[],
+ int srcStride[],
+ int srcSliceY, int srcSliceH,
+ uint8_t *dst[], int dstStride[])
+{
+ int y, h_size, vshift;
+
+ YUV2RGB_LOOP(4)
+
+ const uint8_t *pa = src[3] + y * srcStride[3];
+ ff_yuva_420_bgr32_ssse3(index, image, pu - index, pv - index, &(c->redDither), py - 2 * index, pa - 2 * index);
+ }
+ return srcSliceH;
+}
+
+static inline int yuv420_rgb24_ssse3(SwsContext *c, const uint8_t *src[],
+ int srcStride[],
+ int srcSliceY, int srcSliceH,
+ uint8_t *dst[], int dstStride[])
+{
+ int y, h_size, vshift;
+
+ YUV2RGB_LOOP(3)
+
+ ff_yuv_420_rgb24_ssse3(index, image, pu - index, pv - index, &(c->redDither), py - 2 * index);
+ }
+ return srcSliceH;
+}
+
+static inline int yuv420_bgr24_ssse3(SwsContext *c, const uint8_t *src[],
+ int srcStride[],
+ int srcSliceY, int srcSliceH,
+ uint8_t *dst[], int dstStride[])
+{
+ int y, h_size, vshift;
+
+ YUV2RGB_LOOP(3)
+
+ ff_yuv_420_bgr24_ssse3(index, image, pu - index, pv - index, &(c->redDither), py - 2 * index);
+ }
+ return srcSliceH;
+}
#endif /* HAVE_X86ASM */
diff --git a/libswscale/x86/yuv2rgb_template.c b/libswscale/x86/yuv2rgb_template.c
deleted file mode 100644
index abaf80eec2..0000000000
--- a/libswscale/x86/yuv2rgb_template.c
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * software YUV to RGB converter
- *
- * Copyright (C) 2001-2007 Michael Niedermayer
- * (c) 2010 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdint.h>
-
-#include "libavutil/x86/asm.h"
-#include "libswscale/swscale_internal.h"
-
-#define YUV2RGB_LOOP(depth) \
- h_size = (c->dstW + 7) & ~7; \
- if (h_size * depth > FFABS(dstStride[0])) \
- h_size -= 8; \
- \
- vshift = c->srcFormat != AV_PIX_FMT_YUV422P; \
- \
- for (y = 0; y < srcSliceH; y++) { \
- uint8_t *image = dst[0] + (y + srcSliceY) * dstStride[0]; \
- const uint8_t *py = src[0] + y * srcStride[0]; \
- const uint8_t *pu = src[1] + (y >> vshift) * srcStride[1]; \
- const uint8_t *pv = src[2] + (y >> vshift) * srcStride[2]; \
- x86_reg index = -h_size / 2; \
-
-extern void RENAME(ff_yuv_420_rgb24)(x86_reg index, uint8_t *image, const uint8_t *pu_index,
- const uint8_t *pv_index, const uint64_t *pointer_c_dither,
- const uint8_t *py_2index);
-extern void RENAME(ff_yuv_420_bgr24)(x86_reg index, uint8_t *image, const uint8_t *pu_index,
- const uint8_t *pv_index, const uint64_t *pointer_c_dither,
- const uint8_t *py_2index);
-
-extern void RENAME(ff_yuv_420_rgb15)(x86_reg index, uint8_t *image, const uint8_t *pu_index,
- const uint8_t *pv_index, const uint64_t *pointer_c_dither,
- const uint8_t *py_2index);
-extern void RENAME(ff_yuv_420_rgb16)(x86_reg index, uint8_t *image, const uint8_t *pu_index,
- const uint8_t *pv_index, const uint64_t *pointer_c_dither,
- const uint8_t *py_2index);
-extern void RENAME(ff_yuv_420_rgb32)(x86_reg index, uint8_t *image, const uint8_t *pu_index,
- const uint8_t *pv_index, const uint64_t *pointer_c_dither,
- const uint8_t *py_2index);
-extern void RENAME(ff_yuv_420_bgr32)(x86_reg index, uint8_t *image, const uint8_t *pu_index,
- const uint8_t *pv_index, const uint64_t *pointer_c_dither,
- const uint8_t *py_2index);
-extern void RENAME(ff_yuva_420_rgb32)(x86_reg index, uint8_t *image, const uint8_t *pu_index,
- const uint8_t *pv_index, const uint64_t *pointer_c_dither,
- const uint8_t *py_2index, const uint8_t *pa_2index);
-extern void RENAME(ff_yuva_420_bgr32)(x86_reg index, uint8_t *image, const uint8_t *pu_index,
- const uint8_t *pv_index, const uint64_t *pointer_c_dither,
- const uint8_t *py_2index, const uint8_t *pa_2index);
-
-static inline int RENAME(yuv420_rgb15)(SwsContext *c, const uint8_t *src[],
- int srcStride[],
- int srcSliceY, int srcSliceH,
- uint8_t *dst[], int dstStride[])
-{
- int y, h_size, vshift;
-
- YUV2RGB_LOOP(2)
-
- c->blueDither = ff_dither8[y & 1];
- c->greenDither = ff_dither8[y & 1];
- c->redDither = ff_dither8[(y + 1) & 1];
-
- RENAME(ff_yuv_420_rgb15)(index, image, pu - index, pv - index, &(c->redDither), py - 2 * index);
- }
- return srcSliceH;
-}
-
-static inline int RENAME(yuv420_rgb16)(SwsContext *c, const uint8_t *src[],
- int srcStride[],
- int srcSliceY, int srcSliceH,
- uint8_t *dst[], int dstStride[])
-{
- int y, h_size, vshift;
-
- YUV2RGB_LOOP(2)
-
- c->blueDither = ff_dither8[y & 1];
- c->greenDither = ff_dither4[y & 1];
- c->redDither = ff_dither8[(y + 1) & 1];
-
- RENAME(ff_yuv_420_rgb16)(index, image, pu - index, pv - index, &(c->redDither), py - 2 * index);
- }
- return srcSliceH;
-}
-
-static inline int RENAME(yuv420_rgb32)(SwsContext *c, const uint8_t *src[],
- int srcStride[],
- int srcSliceY, int srcSliceH,
- uint8_t *dst[], int dstStride[])
-{
- int y, h_size, vshift;
-
- YUV2RGB_LOOP(4)
-
- RENAME(ff_yuv_420_rgb32)(index, image, pu - index, pv - index, &(c->redDither), py - 2 * index);
- }
- return srcSliceH;
-}
-
-static inline int RENAME(yuv420_bgr32)(SwsContext *c, const uint8_t *src[],
- int srcStride[],
- int srcSliceY, int srcSliceH,
- uint8_t *dst[], int dstStride[])
-{
- int y, h_size, vshift;
-
- YUV2RGB_LOOP(4)
-
- RENAME(ff_yuv_420_bgr32)(index, image, pu - index, pv - index, &(c->redDither), py - 2 * index);
- }
- return srcSliceH;
-}
-
-static inline int RENAME(yuva420_rgb32)(SwsContext *c, const uint8_t *src[],
- int srcStride[],
- int srcSliceY, int srcSliceH,
- uint8_t *dst[], int dstStride[])
-{
- int y, h_size, vshift;
- YUV2RGB_LOOP(4)
-
- const uint8_t *pa = src[3] + y * srcStride[3];
- RENAME(ff_yuva_420_rgb32)(index, image, pu - index, pv - index, &(c->redDither), py - 2 * index, pa - 2 * index);
- }
- return srcSliceH;
-}
-
-static inline int RENAME(yuva420_bgr32)(SwsContext *c, const uint8_t *src[],
- int srcStride[],
- int srcSliceY, int srcSliceH,
- uint8_t *dst[], int dstStride[])
-{
- int y, h_size, vshift;
-
- YUV2RGB_LOOP(4)
-
- const uint8_t *pa = src[3] + y * srcStride[3];
- RENAME(ff_yuva_420_bgr32)(index, image, pu - index, pv - index, &(c->redDither), py - 2 * index, pa - 2 * index);
- }
- return srcSliceH;
-}
-
-static inline int RENAME(yuv420_rgb24)(SwsContext *c, const uint8_t *src[],
- int srcStride[],
- int srcSliceY, int srcSliceH,
- uint8_t *dst[], int dstStride[])
-{
- int y, h_size, vshift;
-
- YUV2RGB_LOOP(3)
-
- RENAME(ff_yuv_420_rgb24)(index, image, pu - index, pv - index, &(c->redDither), py - 2 * index);
- }
- return srcSliceH;
-}
-
-static inline int RENAME(yuv420_bgr24)(SwsContext *c, const uint8_t *src[],
- int srcStride[],
- int srcSliceY, int srcSliceH,
- uint8_t *dst[], int dstStride[])
-{
- int y, h_size, vshift;
-
- YUV2RGB_LOOP(3)
-
- RENAME(ff_yuv_420_bgr24)(index, image, pu - index, pv - index, &(c->redDither), py - 2 * index);
- }
- return srcSliceH;
-}
--
2.30.2
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [FFmpeg-devel] [PATCH 2/2] swscale/x86/yuv2rgb: Detemplatize
2024-07-04 9:40 ` [FFmpeg-devel] [PATCH 2/2] swscale/x86/yuv2rgb: Detemplatize Ramiro Polla
@ 2024-07-08 12:01 ` Ramiro Polla
0 siblings, 0 replies; 3+ messages in thread
From: Ramiro Polla @ 2024-07-08 12:01 UTC (permalink / raw)
To: ffmpeg-devel
On Thu, Jul 4, 2024 at 11:40 AM Ramiro Polla <ramiro.polla@gmail.com> wrote:
> Every function in yuv2rgb_template.c is only compiled exactly
> once, so detemplatize it.
I'll apply in a few days if there are no comments.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-07-08 12:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-04 9:40 [FFmpeg-devel] [PATCH 1/2] swscale: remove unconditional #define DITHER1XBPP Ramiro Polla
2024-07-04 9:40 ` [FFmpeg-devel] [PATCH 2/2] swscale/x86/yuv2rgb: Detemplatize Ramiro Polla
2024-07-08 12:01 ` Ramiro Polla
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git