summaryrefslogtreecommitdiff
path: root/libswscale
diff options
context:
space:
mode:
authorPhilip Langdale <philipl@overt.org>2022-09-05 21:47:29 -0700
committerPhilip Langdale <philipl@overt.org>2022-09-10 12:29:12 -0700
commit09a8e5debb284984871bd3eabd139b7207eedcdc (patch)
tree5fa517efc3387f4543ed26f3d11363103cbd7657 /libswscale
parent68181623e984b249402ac6fd0849c032b05ae143 (diff)
downloadffmpeg-09a8e5debb284984871bd3eabd139b7207eedcdc.tar.gz
swscale/output: add support for Y210LE and Y212LE
Diffstat (limited to 'libswscale')
-rw-r--r--libswscale/output.c48
-rw-r--r--libswscale/utils.c4
-rw-r--r--libswscale/version.h2
3 files changed, 51 insertions, 3 deletions
diff --git a/libswscale/output.c b/libswscale/output.c
index 39e2a04609..2f599698e9 100644
--- a/libswscale/output.c
+++ b/libswscale/output.c
@@ -2732,6 +2732,48 @@ yuv2vuyx_X_c(SwsContext *c, const int16_t *lumFilter,
chrUSrc, chrVSrc, chrFilterSize, alpSrc, dest, dstW, y, 0);
}
+#define output_pixel(pos, val, bits) \
+ AV_WL16(pos, av_clip_uintp2(val >> shift, bits) << output_shift);
+
+#define yuv2y2xx_wrapper(bits) \
+ static void \
+ yuv2y2 ## bits ## le_X_c(SwsContext *c, const int16_t *lumFilter, \
+ const int16_t **lumSrc, int lumFilterSize, \
+ const int16_t *chrFilter, \
+ const int16_t **chrUSrc, \
+ const int16_t **chrVSrc, int chrFilterSize, \
+ const int16_t **alpSrc, \
+ uint8_t *dest, int dstW, int y) \
+ { \
+ int i, j; \
+ int shift = 11 + 16 - bits; \
+ int output_shift = 16 - bits; \
+ for (i = 0; i < ((dstW + 1) >> 1); i++) { \
+ int Y1 = 1 << (shift - 1), Y2 = 1 << (shift - 1); \
+ int U = 1 << (shift - 1), V = 1 << (shift - 1); \
+ \
+ for (j = 0; j < lumFilterSize; j++) { \
+ Y1 += lumSrc[j][i * 2] * lumFilter[j]; \
+ Y2 += lumSrc[j][i * 2 + 1] * lumFilter[j]; \
+ } \
+ \
+ for (j = 0; j < chrFilterSize; j++) { \
+ U += chrUSrc[j][i] * chrFilter[j]; \
+ V += chrVSrc[j][i] * chrFilter[j]; \
+ } \
+ \
+ output_pixel(dest + 8 * i + 0, Y1, bits); \
+ output_pixel(dest + 8 * i + 2, U, bits); \
+ output_pixel(dest + 8 * i + 4, Y2, bits); \
+ output_pixel(dest + 8 * i + 6, V, bits); \
+ } \
+ }
+
+yuv2y2xx_wrapper(10)
+yuv2y2xx_wrapper(12)
+
+#undef output_pixel
+
av_cold void ff_sws_init_output_funcs(SwsContext *c,
yuv2planar1_fn *yuv2plane1,
yuv2planarX_fn *yuv2planeX,
@@ -3252,5 +3294,11 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c,
case AV_PIX_FMT_XV36LE:
*yuv2packedX = yuv2xv36le_X_c;
break;
+ case AV_PIX_FMT_Y210LE:
+ *yuv2packedX = yuv2y210le_X_c;
+ break;
+ case AV_PIX_FMT_Y212LE:
+ *yuv2packedX = yuv2y212le_X_c;
+ break;
}
}
diff --git a/libswscale/utils.c b/libswscale/utils.c
index ec67020cc9..14e2700733 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -248,8 +248,8 @@ static const FormatEntry format_entries[] = {
[AV_PIX_FMT_YUVA444P12LE] = { 1, 1 },
[AV_PIX_FMT_NV24] = { 1, 1 },
[AV_PIX_FMT_NV42] = { 1, 1 },
- [AV_PIX_FMT_Y210LE] = { 1, 0 },
- [AV_PIX_FMT_Y212LE] = { 1, 0 },
+ [AV_PIX_FMT_Y210LE] = { 1, 1 },
+ [AV_PIX_FMT_Y212LE] = { 1, 1 },
[AV_PIX_FMT_X2RGB10LE] = { 1, 1 },
[AV_PIX_FMT_X2BGR10LE] = { 1, 1 },
[AV_PIX_FMT_P210BE] = { 1, 1 },
diff --git a/libswscale/version.h b/libswscale/version.h
index e8f1dadb8b..9bb3b171a7 100644
--- a/libswscale/version.h
+++ b/libswscale/version.h
@@ -29,7 +29,7 @@
#include "version_major.h"
#define LIBSWSCALE_VERSION_MINOR 8
-#define LIBSWSCALE_VERSION_MICRO 111
+#define LIBSWSCALE_VERSION_MICRO 112
#define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \
LIBSWSCALE_VERSION_MINOR, \