mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2026-06-16 04:32:47 +02:00
avfilter/vsrc_testsrc: add pal75bars and pal100bars video filter sources
Generates color bar test patterns based on EBU PAL recommendations. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
This commit is contained in:
@@ -390,6 +390,8 @@ OBJS-$(CONFIG_MANDELBROT_FILTER) += vsrc_mandelbrot.o
|
||||
OBJS-$(CONFIG_MPTESTSRC_FILTER) += vsrc_mptestsrc.o
|
||||
OBJS-$(CONFIG_NULLSRC_FILTER) += vsrc_testsrc.o
|
||||
OBJS-$(CONFIG_OPENCLSRC_FILTER) += vf_program_opencl.o opencl.o
|
||||
OBJS-$(CONFIG_PAL75BARS_FILTER) += vsrc_testsrc.o
|
||||
OBJS-$(CONFIG_PAL100BARS_FILTER) += vsrc_testsrc.o
|
||||
OBJS-$(CONFIG_RGBTESTSRC_FILTER) += vsrc_testsrc.o
|
||||
OBJS-$(CONFIG_SMPTEBARS_FILTER) += vsrc_testsrc.o
|
||||
OBJS-$(CONFIG_SMPTEHDBARS_FILTER) += vsrc_testsrc.o
|
||||
|
||||
@@ -380,6 +380,8 @@ extern AVFilter ff_vsrc_mandelbrot;
|
||||
extern AVFilter ff_vsrc_mptestsrc;
|
||||
extern AVFilter ff_vsrc_nullsrc;
|
||||
extern AVFilter ff_vsrc_openclsrc;
|
||||
extern AVFilter ff_vsrc_pal75bars;
|
||||
extern AVFilter ff_vsrc_pal100bars;
|
||||
extern AVFilter ff_vsrc_rgbtestsrc;
|
||||
extern AVFilter ff_vsrc_smptebars;
|
||||
extern AVFilter ff_vsrc_smptehdbars;
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include "libavutil/version.h"
|
||||
|
||||
#define LIBAVFILTER_VERSION_MAJOR 7
|
||||
#define LIBAVFILTER_VERSION_MINOR 23
|
||||
#define LIBAVFILTER_VERSION_MINOR 24
|
||||
#define LIBAVFILTER_VERSION_MICRO 100
|
||||
|
||||
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
|
||||
|
||||
+105
-1
@@ -1252,7 +1252,7 @@ AVFilter ff_vsrc_yuvtestsrc = {
|
||||
|
||||
#endif /* CONFIG_YUVTESTSRC_FILTER */
|
||||
|
||||
#if CONFIG_SMPTEBARS_FILTER || CONFIG_SMPTEHDBARS_FILTER
|
||||
#if CONFIG_PAL75_FILTER || CONFIG_PAL100_FILTER || CONFIG_SMPTEBARS_FILTER || CONFIG_SMPTEHDBARS_FILTER
|
||||
|
||||
static const uint8_t rainbow[7][4] = {
|
||||
{ 180, 128, 128, 255 }, /* 75% white */
|
||||
@@ -1264,6 +1264,16 @@ static const uint8_t rainbow[7][4] = {
|
||||
{ 35, 212, 114, 255 }, /* 75% blue */
|
||||
};
|
||||
|
||||
static const uint8_t rainbow100[7][4] = {
|
||||
{ 235, 128, 128, 255 }, /* 100% white */
|
||||
{ 210, 16, 146, 255 }, /* 100% yellow */
|
||||
{ 170, 166, 16, 255 }, /* 100% cyan */
|
||||
{ 145, 54, 34, 255 }, /* 100% green */
|
||||
{ 106, 202, 222, 255 }, /* 100% magenta */
|
||||
{ 81, 90, 240, 255 }, /* 100% red */
|
||||
{ 41, 240, 110, 255 }, /* 100% blue */
|
||||
};
|
||||
|
||||
static const uint8_t rainbowhd[7][4] = {
|
||||
{ 180, 128, 128, 255 }, /* 75% white */
|
||||
{ 168, 44, 136, 255 }, /* 75% yellow */
|
||||
@@ -1371,6 +1381,100 @@ static const AVFilterPad smptebars_outputs[] = {
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
#if CONFIG_PAL75BARS_FILTER
|
||||
|
||||
#define pal75bars_options options
|
||||
AVFILTER_DEFINE_CLASS(pal75bars);
|
||||
|
||||
static void pal75bars_fill_picture(AVFilterContext *ctx, AVFrame *picref)
|
||||
{
|
||||
TestSourceContext *test = ctx->priv;
|
||||
int r_w, i, x = 0;
|
||||
const AVPixFmtDescriptor *pixdesc = av_pix_fmt_desc_get(picref->format);
|
||||
|
||||
picref->color_range = AVCOL_RANGE_MPEG;
|
||||
picref->colorspace = AVCOL_SPC_BT470BG;
|
||||
|
||||
r_w = FFALIGN((test->w + 7) / 8, 1 << pixdesc->log2_chroma_w);
|
||||
|
||||
draw_bar(test, white, x, 0, r_w, test->h, picref);
|
||||
x += r_w;
|
||||
for (i = 1; i < 7; i++) {
|
||||
draw_bar(test, rainbow[i], x, 0, r_w, test->h, picref);
|
||||
x += r_w;
|
||||
}
|
||||
draw_bar(test, black0, x, 0, r_w, test->h, picref);
|
||||
}
|
||||
|
||||
static av_cold int pal75bars_init(AVFilterContext *ctx)
|
||||
{
|
||||
TestSourceContext *test = ctx->priv;
|
||||
|
||||
test->fill_picture_fn = pal75bars_fill_picture;
|
||||
test->draw_once = 1;
|
||||
return init(ctx);
|
||||
}
|
||||
|
||||
AVFilter ff_vsrc_pal75bars = {
|
||||
.name = "pal75bars",
|
||||
.description = NULL_IF_CONFIG_SMALL("Generate PAL 75% color bars."),
|
||||
.priv_size = sizeof(TestSourceContext),
|
||||
.priv_class = &pal75bars_class,
|
||||
.init = pal75bars_init,
|
||||
.uninit = uninit,
|
||||
.query_formats = smptebars_query_formats,
|
||||
.inputs = NULL,
|
||||
.outputs = smptebars_outputs,
|
||||
};
|
||||
|
||||
#endif /* CONFIG_PAL75BARS_FILTER */
|
||||
|
||||
#if CONFIG_PAL100BARS_FILTER
|
||||
|
||||
#define pal100bars_options options
|
||||
AVFILTER_DEFINE_CLASS(pal100bars);
|
||||
|
||||
static void pal100bars_fill_picture(AVFilterContext *ctx, AVFrame *picref)
|
||||
{
|
||||
TestSourceContext *test = ctx->priv;
|
||||
int r_w, i, x = 0;
|
||||
const AVPixFmtDescriptor *pixdesc = av_pix_fmt_desc_get(picref->format);
|
||||
|
||||
picref->color_range = AVCOL_RANGE_MPEG;
|
||||
picref->colorspace = AVCOL_SPC_BT470BG;
|
||||
|
||||
r_w = FFALIGN((test->w + 7) / 8, 1 << pixdesc->log2_chroma_w);
|
||||
|
||||
for (i = 0; i < 7; i++) {
|
||||
draw_bar(test, rainbow100[i], x, 0, r_w, test->h, picref);
|
||||
x += r_w;
|
||||
}
|
||||
draw_bar(test, black0, x, 0, r_w, test->h, picref);
|
||||
}
|
||||
|
||||
static av_cold int pal100bars_init(AVFilterContext *ctx)
|
||||
{
|
||||
TestSourceContext *test = ctx->priv;
|
||||
|
||||
test->fill_picture_fn = pal100bars_fill_picture;
|
||||
test->draw_once = 1;
|
||||
return init(ctx);
|
||||
}
|
||||
|
||||
AVFilter ff_vsrc_pal100bars = {
|
||||
.name = "pal100bars",
|
||||
.description = NULL_IF_CONFIG_SMALL("Generate PAL 100% color bars."),
|
||||
.priv_size = sizeof(TestSourceContext),
|
||||
.priv_class = &pal100bars_class,
|
||||
.init = pal100bars_init,
|
||||
.uninit = uninit,
|
||||
.query_formats = smptebars_query_formats,
|
||||
.inputs = NULL,
|
||||
.outputs = smptebars_outputs,
|
||||
};
|
||||
|
||||
#endif /* CONFIG_PAL100BARS_FILTER */
|
||||
|
||||
#if CONFIG_SMPTEBARS_FILTER
|
||||
|
||||
#define smptebars_options options
|
||||
|
||||
Reference in New Issue
Block a user