diff options
author | Clément Bœsch <u@pkh.me> | 2015-08-16 01:22:59 +0200 |
---|---|---|
committer | Clément Bœsch <u@pkh.me> | 2015-08-29 14:57:52 +0200 |
commit | b48d8fa3ac38849eab53cf586467481b256b3a99 (patch) | |
tree | 69b0d1f1f515d1228eae8741622d9828e8f2a304 /libavfilter | |
parent | 8323d9b8afbc0755120cbded0e0259b2ba23977c (diff) | |
download | ffmpeg-b48d8fa3ac38849eab53cf586467481b256b3a99.tar.gz |
avfilter: add allrgb
Signed-off-by: Nicolas George <george@nsup.org>
Signed-off-by: Clément Bœsch <u@pkh.me>
Diffstat (limited to 'libavfilter')
-rw-r--r-- | libavfilter/Makefile | 1 | ||||
-rw-r--r-- | libavfilter/allfilters.c | 1 | ||||
-rw-r--r-- | libavfilter/version.h | 2 | ||||
-rw-r--r-- | libavfilter/vsrc_testsrc.c | 81 |
4 files changed, 84 insertions, 1 deletions
diff --git a/libavfilter/Makefile b/libavfilter/Makefile index ac7412d41b..a2af794e20 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -241,6 +241,7 @@ OBJS-$(CONFIG_YADIF_FILTER) += vf_yadif.o OBJS-$(CONFIG_ZMQ_FILTER) += f_zmq.o OBJS-$(CONFIG_ZOOMPAN_FILTER) += vf_zoompan.o +OBJS-$(CONFIG_ALLRGB_FILTER) += vsrc_testsrc.o OBJS-$(CONFIG_ALLYUV_FILTER) += vsrc_testsrc.o OBJS-$(CONFIG_CELLAUTO_FILTER) += vsrc_cellauto.o OBJS-$(CONFIG_COLOR_FILTER) += vsrc_testsrc.o diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index 9068e833ff..b7b38078d7 100644 --- a/libavfilter/allfilters.c +++ b/libavfilter/allfilters.c @@ -256,6 +256,7 @@ void avfilter_register_all(void) REGISTER_FILTER(ZMQ, zmq, vf); REGISTER_FILTER(ZOOMPAN, zoompan, vf); + REGISTER_FILTER(ALLRGB, allrgb, vsrc); REGISTER_FILTER(ALLYUV, allyuv, vsrc); REGISTER_FILTER(CELLAUTO, cellauto, vsrc); REGISTER_FILTER(COLOR, color, vsrc); diff --git a/libavfilter/version.h b/libavfilter/version.h index 15eb5407be..93fc827b56 100644 --- a/libavfilter/version.h +++ b/libavfilter/version.h @@ -30,7 +30,7 @@ #include "libavutil/version.h" #define LIBAVFILTER_VERSION_MAJOR 5 -#define LIBAVFILTER_VERSION_MINOR 39 +#define LIBAVFILTER_VERSION_MINOR 40 #define LIBAVFILTER_VERSION_MICRO 100 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c index 3493b0f459..f63c861186 100644 --- a/libavfilter/vsrc_testsrc.c +++ b/libavfilter/vsrc_testsrc.c @@ -1170,3 +1170,84 @@ AVFilter ff_vsrc_allyuv = { }; #endif /* CONFIG_ALLYUV_FILTER */ + +#if CONFIG_ALLRGB_FILTER + +static const AVOption allrgb_options[] = { + COMMON_OPTIONS_NOSIZE + { NULL } +}; + +AVFILTER_DEFINE_CLASS(allrgb); + +static void allrgb_fill_picture(AVFilterContext *ctx, AVFrame *frame) +{ + unsigned x, y; + const int linesize = frame->linesize[0]; + uint8_t *line = frame->data[0]; + + for (y = 0; y < 4096; y++) { + uint8_t *dst = line; + + for (x = 0; x < 4096; x++) { + *dst++ = x; + *dst++ = y; + *dst++ = (x >> 8) | ((y >> 8) << 4); + } + line += linesize; + } +} + +static av_cold int allrgb_init(AVFilterContext *ctx) +{ + TestSourceContext *test = ctx->priv; + + test->w = test->h = 4096; + test->draw_once = 1; + test->fill_picture_fn = allrgb_fill_picture; + return init(ctx); +} + +static int allrgb_config_props(AVFilterLink *outlink) +{ + TestSourceContext *test = outlink->src->priv; + + ff_fill_rgba_map(test->rgba_map, outlink->format); + return config_props(outlink); +} + +static int allrgb_query_formats(AVFilterContext *ctx) +{ + static const enum AVPixelFormat pix_fmts[] = { + AV_PIX_FMT_RGB24, AV_PIX_FMT_NONE + }; + + AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); +} + +static const AVFilterPad avfilter_vsrc_allrgb_outputs[] = { + { + .name = "default", + .type = AVMEDIA_TYPE_VIDEO, + .request_frame = request_frame, + .config_props = allrgb_config_props, + }, + { NULL } +}; + +AVFilter ff_vsrc_allrgb = { + .name = "allrgb", + .description = NULL_IF_CONFIG_SMALL("Generate all RGB colors."), + .priv_size = sizeof(TestSourceContext), + .priv_class = &allrgb_class, + .init = allrgb_init, + .uninit = uninit, + .query_formats = allrgb_query_formats, + .inputs = NULL, + .outputs = avfilter_vsrc_allrgb_outputs, +}; + +#endif /* CONFIG_ALLRGB_FILTER */ |