From: "Tomas Härdin" <git@haerdin.se>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH 1/2] lavfi/vf_colorspace: Add support for 14- and 16-bit YUV
Date: Fri, 03 Feb 2023 16:53:18 +0100
Message-ID: <eabb4137dfdeae8c83bb320139c9771a5d7e15b8.camel@haerdin.se> (raw)
[-- Attachment #1: Type: text/plain, Size: 1 bytes --]
[-- Attachment #2: 0001-lavfi-vf_colorspace-Add-support-for-14-and-16-bit-YU.patch --]
[-- Type: text/x-patch, Size: 6298 bytes --]
From 33c0ff957b5a37c1d59069ee414282bb45d21298 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= <git@haerdin.se>
Date: Fri, 3 Feb 2023 15:00:05 +0100
Subject: [PATCH 1/2] lavfi/vf_colorspace: Add support for 14- and 16-bit YUV
---
libavfilter/colorspacedsp.c | 36 +++++++++++++++++++++++++++-
libavfilter/colorspacedsp.h | 2 ++
libavfilter/colorspacedsp_template.c | 8 +++++++
libavfilter/vf_colorspace.c | 10 +++++++-
4 files changed, 54 insertions(+), 2 deletions(-)
diff --git a/libavfilter/colorspacedsp.c b/libavfilter/colorspacedsp.c
index 72207ffaf3..75a442fb66 100644
--- a/libavfilter/colorspacedsp.c
+++ b/libavfilter/colorspacedsp.c
@@ -39,6 +39,14 @@
#define BIT_DEPTH 12
#include "colorspacedsp_template.c"
+#undef BIT_DEPTH
+#define BIT_DEPTH 14
+#include "colorspacedsp_template.c"
+
+#undef BIT_DEPTH
+#define BIT_DEPTH 16
+#include "colorspacedsp_template.c"
+
#undef SS_W
#undef SS_H
@@ -57,6 +65,14 @@
#define BIT_DEPTH 12
#include "colorspacedsp_template.c"
+#undef BIT_DEPTH
+#define BIT_DEPTH 14
+#include "colorspacedsp_template.c"
+
+#undef BIT_DEPTH
+#define BIT_DEPTH 16
+#include "colorspacedsp_template.c"
+
#undef SS_W
#undef SS_H
@@ -75,6 +91,14 @@
#define BIT_DEPTH 12
#include "colorspacedsp_template.c"
+#undef BIT_DEPTH
+#define BIT_DEPTH 14
+#include "colorspacedsp_template.c"
+
+#undef BIT_DEPTH
+#define BIT_DEPTH 16
+#include "colorspacedsp_template.c"
+
static void multiply3x3_c(int16_t *buf[3], ptrdiff_t stride,
int w, int h, const int16_t m[3][3][8])
{
@@ -109,6 +133,8 @@ void ff_colorspacedsp_init(ColorSpaceDSPContext *dsp)
init_yuv2rgb_fn( 8);
init_yuv2rgb_fn(10);
init_yuv2rgb_fn(12);
+ init_yuv2rgb_fn(14);
+ init_yuv2rgb_fn(16);
#define init_rgb2yuv_fn(bit) \
dsp->rgb2yuv[BPP_##bit][SS_444] = rgb2yuv_444p##bit##_c; \
@@ -118,6 +144,8 @@ void ff_colorspacedsp_init(ColorSpaceDSPContext *dsp)
init_rgb2yuv_fn( 8);
init_rgb2yuv_fn(10);
init_rgb2yuv_fn(12);
+ init_rgb2yuv_fn(14);
+ init_rgb2yuv_fn(16);
#define init_rgb2yuv_fsb_fn(bit) \
dsp->rgb2yuv_fsb[BPP_##bit][SS_444] = rgb2yuv_fsb_444p##bit##_c; \
@@ -127,6 +155,8 @@ void ff_colorspacedsp_init(ColorSpaceDSPContext *dsp)
init_rgb2yuv_fsb_fn( 8);
init_rgb2yuv_fsb_fn(10);
init_rgb2yuv_fsb_fn(12);
+ init_rgb2yuv_fsb_fn(14);
+ init_rgb2yuv_fsb_fn(16);
#define init_yuv2yuv_fn(idx1, bit1, bit2) \
dsp->yuv2yuv[idx1][BPP_##bit2][SS_444] = yuv2yuv_444p##bit1##to##bit2##_c; \
@@ -135,11 +165,15 @@ void ff_colorspacedsp_init(ColorSpaceDSPContext *dsp)
#define init_yuv2yuv_fns(bit1) \
init_yuv2yuv_fn(BPP_##bit1, bit1, 8); \
init_yuv2yuv_fn(BPP_##bit1, bit1, 10); \
- init_yuv2yuv_fn(BPP_##bit1, bit1, 12)
+ init_yuv2yuv_fn(BPP_##bit1, bit1, 12); \
+ init_yuv2yuv_fn(BPP_##bit1, bit1, 14); \
+ init_yuv2yuv_fn(BPP_##bit1, bit1, 16)
init_yuv2yuv_fns( 8);
init_yuv2yuv_fns(10);
init_yuv2yuv_fns(12);
+ init_yuv2yuv_fns(14);
+ init_yuv2yuv_fns(16);
dsp->multiply3x3 = multiply3x3_c;
diff --git a/libavfilter/colorspacedsp.h b/libavfilter/colorspacedsp.h
index a81e4f0a52..c994bcfe67 100644
--- a/libavfilter/colorspacedsp.h
+++ b/libavfilter/colorspacedsp.h
@@ -46,6 +46,8 @@ enum BitDepthIndex {
BPP_8,
BPP_10,
BPP_12,
+ BPP_14,
+ BPP_16,
NB_BPP,
};
diff --git a/libavfilter/colorspacedsp_template.c b/libavfilter/colorspacedsp_template.c
index 53ac0d7224..08d809979f 100644
--- a/libavfilter/colorspacedsp_template.c
+++ b/libavfilter/colorspacedsp_template.c
@@ -340,3 +340,11 @@ static void fn(rgb2yuv_fsb)(uint8_t *_yuv[3], const ptrdiff_t yuv_stride[3],
#undef IN_BIT_DEPTH
#define IN_BIT_DEPTH 12
#include "colorspacedsp_yuv2yuv_template.c"
+
+#undef IN_BIT_DEPTH
+#define IN_BIT_DEPTH 14
+#include "colorspacedsp_yuv2yuv_template.c"
+
+#undef IN_BIT_DEPTH
+#define IN_BIT_DEPTH 16
+#include "colorspacedsp_yuv2yuv_template.c"
diff --git a/libavfilter/vf_colorspace.c b/libavfilter/vf_colorspace.c
index 21916b7b7a..1e1ab5fb34 100644
--- a/libavfilter/vf_colorspace.c
+++ b/libavfilter/vf_colorspace.c
@@ -402,7 +402,7 @@ static int create_filtergraph(AVFilterContext *ctx,
const AVPixFmtDescriptor *out_desc = av_pix_fmt_desc_get(out->format);
int emms = 0, m, n, o, res, fmt_identical, redo_yuv2rgb = 0, redo_rgb2yuv = 0;
-#define supported_depth(d) ((d) == 8 || (d) == 10 || (d) == 12)
+#define supported_depth(d) ((d) == 8 || (d) == 10 || (d) == 12 || (d) == 14 || (d) == 16)
#define supported_subsampling(lcw, lch) \
(((lcw) == 0 && (lch) == 0) || ((lcw) == 1 && (lch) == 0) || ((lcw) == 1 && (lch) == 1))
#define supported_format(d) \
@@ -842,6 +842,8 @@ static int query_formats(AVFilterContext *ctx)
AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P,
AV_PIX_FMT_YUV420P10, AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV444P10,
AV_PIX_FMT_YUV420P12, AV_PIX_FMT_YUV422P12, AV_PIX_FMT_YUV444P12,
+ AV_PIX_FMT_YUV420P14, AV_PIX_FMT_YUV422P14, AV_PIX_FMT_YUV444P14,
+ AV_PIX_FMT_YUV420P16, AV_PIX_FMT_YUV422P16, AV_PIX_FMT_YUV444P16,
AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ444P,
AV_PIX_FMT_NONE
};
@@ -961,12 +963,18 @@ static const AVOption colorspace_options[] = {
ENUM("yuv420p", AV_PIX_FMT_YUV420P, "fmt"),
ENUM("yuv420p10", AV_PIX_FMT_YUV420P10, "fmt"),
ENUM("yuv420p12", AV_PIX_FMT_YUV420P12, "fmt"),
+ ENUM("yuv420p14", AV_PIX_FMT_YUV420P14, "fmt"),
+ ENUM("yuv420p16", AV_PIX_FMT_YUV420P16, "fmt"),
ENUM("yuv422p", AV_PIX_FMT_YUV422P, "fmt"),
ENUM("yuv422p10", AV_PIX_FMT_YUV422P10, "fmt"),
ENUM("yuv422p12", AV_PIX_FMT_YUV422P12, "fmt"),
+ ENUM("yuv422p14", AV_PIX_FMT_YUV422P14, "fmt"),
+ ENUM("yuv422p16", AV_PIX_FMT_YUV422P16, "fmt"),
ENUM("yuv444p", AV_PIX_FMT_YUV444P, "fmt"),
ENUM("yuv444p10", AV_PIX_FMT_YUV444P10, "fmt"),
ENUM("yuv444p12", AV_PIX_FMT_YUV444P12, "fmt"),
+ ENUM("yuv444p14", AV_PIX_FMT_YUV444P14, "fmt"),
+ ENUM("yuv444p16", AV_PIX_FMT_YUV444P16, "fmt"),
{ "fast", "Ignore primary chromaticity and gamma correction",
OFFSET(fast_mode), AV_OPT_TYPE_BOOL, { .i64 = 0 },
--
2.30.2
[-- Attachment #3: Type: text/plain, Size: 251 bytes --]
_______________________________________________
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".
next reply other threads:[~2023-02-03 15:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-03 15:53 Tomas Härdin [this message]
2023-02-03 15:54 ` [FFmpeg-devel] [PATCH 2/2] lavfi/vf_colorspace: Add SMPTE ST 2084 support Tomas Härdin
2023-02-03 16:29 ` Pierre-Anthony Lemieux
2023-02-06 9:35 ` Tomas Härdin
2023-02-06 9:51 ` Tomas Härdin
2023-02-06 14:53 ` [FFmpeg-devel] [PATCH 2/2 v2] " Tomas Härdin
2023-02-13 10:14 ` [FFmpeg-devel] [PATCH 1/2] lavfi/vf_colorspace: Add support for 14- and 16-bit YUV Tomas Härdin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=eabb4137dfdeae8c83bb320139c9771a5d7e15b8.camel@haerdin.se \
--to=git@haerdin.se \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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