diff options
author | Paul B Mahol <onemda@gmail.com> | 2016-03-13 00:17:29 +0100 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2016-03-13 00:17:29 +0100 |
commit | 4a7c705fde1a25cc3dd4ffcb56e3b4acf12dea41 (patch) | |
tree | 09ea8885d3c46e95d24a7a7d8bd4327f58ebddd4 /libavfilter/vf_vectorscope.c | |
parent | a61cd42c8d756c0f9503469988250b326e182ae6 (diff) | |
download | ffmpeg-4a7c705fde1a25cc3dd4ffcb56e3b4acf12dea41.tar.gz |
avfilter/vf_vectorscope: make it possible to override colorspace
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavfilter/vf_vectorscope.c')
-rw-r--r-- | libavfilter/vf_vectorscope.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/libavfilter/vf_vectorscope.c b/libavfilter/vf_vectorscope.c index 2696a12fcf..da087abc46 100644 --- a/libavfilter/vf_vectorscope.c +++ b/libavfilter/vf_vectorscope.c @@ -62,6 +62,7 @@ typedef struct VectorscopeContext { int tmin; int tmax; int flags; + int colorspace; int cs; uint8_t peak[4096][4096]; @@ -111,6 +112,11 @@ static const AVOption vectorscope_options[] = { { "l", "set low threshold", OFFSET(lthreshold), AV_OPT_TYPE_FLOAT, {.dbl=0}, 0, 1, FLAGS}, { "hthreshold", "set high threshold", OFFSET(hthreshold), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 1, FLAGS}, { "h", "set high threshold", OFFSET(hthreshold), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 1, FLAGS}, + { "colorspace", "set colorspace", OFFSET(colorspace), AV_OPT_TYPE_INT, {.i64=0}, 0, 2, FLAGS, "colorspace"}, + { "c", "set colorspace", OFFSET(colorspace), AV_OPT_TYPE_INT, {.i64=0}, 0, 2, FLAGS, "colorspace"}, + { "auto", 0, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, "colorspace" }, + { "601", 0, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, "colorspace" }, + { "709", 0, 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, FLAGS, "colorspace" }, { NULL } }; @@ -1190,14 +1196,18 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) AVFilterLink *outlink = ctx->outputs[0]; AVFrame *out; - switch (av_frame_get_colorspace(in)) { - case AVCOL_SPC_SMPTE170M: - case AVCOL_SPC_BT470BG: - s->cs = (s->depth - 8) * 2 + 0; - break; - case AVCOL_SPC_BT709: - default: - s->cs = (s->depth - 8) * 2 + 1; + if (s->colorspace) { + s->cs = (s->depth - 8) * 2 + s->colorspace - 1; + } else { + switch (av_frame_get_colorspace(in)) { + case AVCOL_SPC_SMPTE170M: + case AVCOL_SPC_BT470BG: + s->cs = (s->depth - 8) * 2 + 0; + break; + case AVCOL_SPC_BT709: + default: + s->cs = (s->depth - 8) * 2 + 1; + } } out = ff_get_video_buffer(outlink, outlink->w, outlink->h); |