[FFmpeg-devel] [PATCH 1/3] avfilter/vf_overlay: Add support for yuv444p10 pixel format
Tobias Rapp
t.rapp at noa-archive.com
Fri Jul 7 15:44:38 EEST 2023
---
doc/filters.texi | 3 +++
libavfilter/vf_overlay.c | 36 +++++++++++++++++++++++++++++++++++-
libavfilter/vf_overlay.h | 1 +
3 files changed, 39 insertions(+), 1 deletion(-)
diff --git a/doc/filters.texi b/doc/filters.texi
index f17488c..3b82edf 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -18605,6 +18605,9 @@ force YUV422p10 output
@item yuv444
force YUV444 output
+ at item yuv444p10
+force YUV444p10 output
+
@item rgb
force packed RGB output
diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c
index 36c04ac..fa39abb 100644
--- a/libavfilter/vf_overlay.c
+++ b/libavfilter/vf_overlay.c
@@ -156,7 +156,7 @@ static int process_command(AVFilterContext *ctx, const char *cmd, const char *ar
static const enum AVPixelFormat alpha_pix_fmts[] = {
AV_PIX_FMT_YUVA420P, AV_PIX_FMT_YUVA422P, AV_PIX_FMT_YUVA444P,
- AV_PIX_FMT_YUVA420P10, AV_PIX_FMT_YUVA422P10,
+ AV_PIX_FMT_YUVA420P10, AV_PIX_FMT_YUVA422P10, AV_PIX_FMT_YUVA444P10,
AV_PIX_FMT_ARGB, AV_PIX_FMT_ABGR, AV_PIX_FMT_RGBA,
AV_PIX_FMT_BGRA, AV_PIX_FMT_GBRAP, AV_PIX_FMT_NONE
};
@@ -204,6 +204,13 @@ static int query_formats(AVFilterContext *ctx)
AV_PIX_FMT_YUVA444P, AV_PIX_FMT_NONE
};
+ static const enum AVPixelFormat main_pix_fmts_yuv444p10[] = {
+ AV_PIX_FMT_YUV444P10, AV_PIX_FMT_YUVA444P10, AV_PIX_FMT_NONE
+ };
+ static const enum AVPixelFormat overlay_pix_fmts_yuv444p10[] = {
+ AV_PIX_FMT_YUVA444P10, AV_PIX_FMT_NONE
+ };
+
static const enum AVPixelFormat main_pix_fmts_gbrp[] = {
AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRAP, AV_PIX_FMT_NONE
};
@@ -248,6 +255,10 @@ static int query_formats(AVFilterContext *ctx)
main_formats = main_pix_fmts_yuv444;
overlay_formats = overlay_pix_fmts_yuv444;
break;
+ case OVERLAY_FORMAT_YUV444P10:
+ main_formats = main_pix_fmts_yuv444p10;
+ overlay_formats = overlay_pix_fmts_yuv444p10;
+ break;
case OVERLAY_FORMAT_RGB:
main_formats = main_pix_fmts_rgb;
overlay_formats = overlay_pix_fmts_rgb;
@@ -759,6 +770,22 @@ static int blend_slice_yuva444(AVFilterContext *ctx, void *arg, int jobnr, int n
return 0;
}
+static int blend_slice_yuv444p10(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
+{
+ OverlayContext *s = ctx->priv;
+ ThreadData *td = arg;
+ blend_slice_yuv_16_10bits(ctx, td->dst, td->src, 0, 0, 0, s->x, s->y, 1, jobnr, nb_jobs);
+ return 0;
+}
+
+static int blend_slice_yuva444p10(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
+{
+ OverlayContext *s = ctx->priv;
+ ThreadData *td = arg;
+ blend_slice_yuv_16_10bits(ctx, td->dst, td->src, 0, 0, 1, s->x, s->y, 1, jobnr, nb_jobs);
+ return 0;
+}
+
static int blend_slice_gbrp(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
{
OverlayContext *s = ctx->priv;
@@ -902,6 +929,9 @@ static int config_input_main(AVFilterLink *inlink)
case OVERLAY_FORMAT_YUV444:
s->blend_slice = s->main_has_alpha ? blend_slice_yuva444 : blend_slice_yuv444;
break;
+ case OVERLAY_FORMAT_YUV444P10:
+ s->blend_slice = s->main_has_alpha ? blend_slice_yuva444p10 : blend_slice_yuv444p10;
+ break;
case OVERLAY_FORMAT_RGB:
s->blend_slice = s->main_has_alpha ? blend_slice_rgba : blend_slice_rgb;
break;
@@ -925,6 +955,9 @@ static int config_input_main(AVFilterLink *inlink)
case AV_PIX_FMT_YUVA444P:
s->blend_slice = blend_slice_yuva444;
break;
+ case AV_PIX_FMT_YUVA444P10:
+ s->blend_slice = blend_slice_yuva444p10;
+ break;
case AV_PIX_FMT_ARGB:
case AV_PIX_FMT_RGBA:
case AV_PIX_FMT_BGRA:
@@ -1084,6 +1117,7 @@ static const AVOption overlay_options[] = {
{ "yuv422", "", 0, AV_OPT_TYPE_CONST, {.i64=OVERLAY_FORMAT_YUV422}, .flags = FLAGS, .unit = "format" },
{ "yuv422p10", "", 0, AV_OPT_TYPE_CONST, {.i64=OVERLAY_FORMAT_YUV422P10}, .flags = FLAGS, .unit = "format" },
{ "yuv444", "", 0, AV_OPT_TYPE_CONST, {.i64=OVERLAY_FORMAT_YUV444}, .flags = FLAGS, .unit = "format" },
+ { "yuv444p10", "", 0, AV_OPT_TYPE_CONST, {.i64=OVERLAY_FORMAT_YUV444P10}, .flags = FLAGS, .unit = "format" },
{ "rgb", "", 0, AV_OPT_TYPE_CONST, {.i64=OVERLAY_FORMAT_RGB}, .flags = FLAGS, .unit = "format" },
{ "gbrp", "", 0, AV_OPT_TYPE_CONST, {.i64=OVERLAY_FORMAT_GBRP}, .flags = FLAGS, .unit = "format" },
{ "auto", "", 0, AV_OPT_TYPE_CONST, {.i64=OVERLAY_FORMAT_AUTO}, .flags = FLAGS, .unit = "format" },
diff --git a/libavfilter/vf_overlay.h b/libavfilter/vf_overlay.h
index 7e65095..5974964 100644
--- a/libavfilter/vf_overlay.h
+++ b/libavfilter/vf_overlay.h
@@ -47,6 +47,7 @@ enum OverlayFormat {
OVERLAY_FORMAT_YUV422,
OVERLAY_FORMAT_YUV422P10,
OVERLAY_FORMAT_YUV444,
+ OVERLAY_FORMAT_YUV444P10,
OVERLAY_FORMAT_RGB,
OVERLAY_FORMAT_GBRP,
OVERLAY_FORMAT_AUTO,
--
2.7.4
More information about the ffmpeg-devel
mailing list