Signed-off-by: Paul B Mahol <onemda@gmail.com>
Paul B Mahol authored on 2016/03/13 08:17:29... | ... |
@@ -12656,6 +12656,15 @@ Values higher than this value will be ignored. Default is 1. |
12656 | 12656 |
Note this value is multiplied with actual max possible value one pixel component |
12657 | 12657 |
can have. So for 8-bit input and high threshold value of 0.9 actual threshold |
12658 | 12658 |
is 0.9 * 255 = 230. |
12659 |
+ |
|
12660 |
+@item colorspace, c |
|
12661 |
+Set what kind of colorspace to use when drawing graticule. |
|
12662 |
+@table @samp |
|
12663 |
+@item auto |
|
12664 |
+@item 601 |
|
12665 |
+@item 709 |
|
12666 |
+@end table |
|
12667 |
+Default is auto. |
|
12659 | 12668 |
@end table |
12660 | 12669 |
|
12661 | 12670 |
@anchor{vidstabdetect} |
... | ... |
@@ -62,6 +62,7 @@ typedef struct VectorscopeContext { |
62 | 62 |
int tmin; |
63 | 63 |
int tmax; |
64 | 64 |
int flags; |
65 |
+ int colorspace; |
|
65 | 66 |
int cs; |
66 | 67 |
uint8_t peak[4096][4096]; |
67 | 68 |
|
... | ... |
@@ -111,6 +112,11 @@ static const AVOption vectorscope_options[] = { |
111 | 111 |
{ "l", "set low threshold", OFFSET(lthreshold), AV_OPT_TYPE_FLOAT, {.dbl=0}, 0, 1, FLAGS}, |
112 | 112 |
{ "hthreshold", "set high threshold", OFFSET(hthreshold), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 1, FLAGS}, |
113 | 113 |
{ "h", "set high threshold", OFFSET(hthreshold), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 1, FLAGS}, |
114 |
+ { "colorspace", "set colorspace", OFFSET(colorspace), AV_OPT_TYPE_INT, {.i64=0}, 0, 2, FLAGS, "colorspace"}, |
|
115 |
+ { "c", "set colorspace", OFFSET(colorspace), AV_OPT_TYPE_INT, {.i64=0}, 0, 2, FLAGS, "colorspace"}, |
|
116 |
+ { "auto", 0, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, "colorspace" }, |
|
117 |
+ { "601", 0, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, "colorspace" }, |
|
118 |
+ { "709", 0, 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, FLAGS, "colorspace" }, |
|
114 | 119 |
{ NULL } |
115 | 120 |
}; |
116 | 121 |
|
... | ... |
@@ -1190,14 +1196,18 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) |
1190 | 1190 |
AVFilterLink *outlink = ctx->outputs[0]; |
1191 | 1191 |
AVFrame *out; |
1192 | 1192 |
|
1193 |
- switch (av_frame_get_colorspace(in)) { |
|
1194 |
- case AVCOL_SPC_SMPTE170M: |
|
1195 |
- case AVCOL_SPC_BT470BG: |
|
1196 |
- s->cs = (s->depth - 8) * 2 + 0; |
|
1197 |
- break; |
|
1198 |
- case AVCOL_SPC_BT709: |
|
1199 |
- default: |
|
1200 |
- s->cs = (s->depth - 8) * 2 + 1; |
|
1193 |
+ if (s->colorspace) { |
|
1194 |
+ s->cs = (s->depth - 8) * 2 + s->colorspace - 1; |
|
1195 |
+ } else { |
|
1196 |
+ switch (av_frame_get_colorspace(in)) { |
|
1197 |
+ case AVCOL_SPC_SMPTE170M: |
|
1198 |
+ case AVCOL_SPC_BT470BG: |
|
1199 |
+ s->cs = (s->depth - 8) * 2 + 0; |
|
1200 |
+ break; |
|
1201 |
+ case AVCOL_SPC_BT709: |
|
1202 |
+ default: |
|
1203 |
+ s->cs = (s->depth - 8) * 2 + 1; |
|
1204 |
+ } |
|
1201 | 1205 |
} |
1202 | 1206 |
|
1203 | 1207 |
out = ff_get_video_buffer(outlink, outlink->w, outlink->h); |