Line |
Branch |
Exec |
Source |
1 |
|
|
/* |
2 |
|
|
* Copyright (c) 2016 Paul B Mahol |
3 |
|
|
* |
4 |
|
|
* This file is part of FFmpeg. |
5 |
|
|
* |
6 |
|
|
* FFmpeg is free software; you can redistribute it and/or |
7 |
|
|
* modify it under the terms of the GNU Lesser General Public |
8 |
|
|
* License as published by the Free Software Foundation; either |
9 |
|
|
* version 2.1 of the License, or (at your option) any later version. |
10 |
|
|
* |
11 |
|
|
* FFmpeg is distributed in the hope that it will be useful, |
12 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 |
|
|
* Lesser General Public License for more details. |
15 |
|
|
* |
16 |
|
|
* You should have received a copy of the GNU Lesser General Public |
17 |
|
|
* License along with FFmpeg; if not, write to the Free Software |
18 |
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
19 |
|
|
*/ |
20 |
|
|
|
21 |
|
|
#include "libavutil/intreadwrite.h" |
22 |
|
|
#include "libavutil/mem.h" |
23 |
|
|
#include "libavutil/opt.h" |
24 |
|
|
#include "libavutil/pixdesc.h" |
25 |
|
|
#include "libavutil/xga_font_data.h" |
26 |
|
|
#include "avfilter.h" |
27 |
|
|
#include "drawutils.h" |
28 |
|
|
#include "filters.h" |
29 |
|
|
#include "formats.h" |
30 |
|
|
#include "video.h" |
31 |
|
|
|
32 |
|
|
typedef struct DatascopeContext { |
33 |
|
|
const AVClass *class; |
34 |
|
|
int ow, oh; |
35 |
|
|
int x, y; |
36 |
|
|
int mode; |
37 |
|
|
int dformat; |
38 |
|
|
int axis; |
39 |
|
|
int components; |
40 |
|
|
float opacity; |
41 |
|
|
|
42 |
|
|
int nb_planes; |
43 |
|
|
int nb_comps; |
44 |
|
|
int chars; |
45 |
|
|
FFDrawContext draw; |
46 |
|
|
FFDrawColor yellow; |
47 |
|
|
FFDrawColor white; |
48 |
|
|
FFDrawColor black; |
49 |
|
|
FFDrawColor gray; |
50 |
|
|
|
51 |
|
|
void (*pick_color)(FFDrawContext *draw, FFDrawColor *color, AVFrame *in, int x, int y, int *value); |
52 |
|
|
void (*reverse_color)(FFDrawContext *draw, FFDrawColor *color, FFDrawColor *reverse); |
53 |
|
|
int (*filter)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs); |
54 |
|
|
} DatascopeContext; |
55 |
|
|
|
56 |
|
|
#define OFFSET(x) offsetof(DatascopeContext, x) |
57 |
|
|
#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM |
58 |
|
|
#define FLAGSR AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_RUNTIME_PARAM |
59 |
|
|
|
60 |
|
|
static const AVOption datascope_options[] = { |
61 |
|
|
{ "size", "set output size", OFFSET(ow), AV_OPT_TYPE_IMAGE_SIZE, {.str="hd720"}, 0, 0, FLAGS }, |
62 |
|
|
{ "s", "set output size", OFFSET(ow), AV_OPT_TYPE_IMAGE_SIZE, {.str="hd720"}, 0, 0, FLAGS }, |
63 |
|
|
{ "x", "set x offset", OFFSET(x), AV_OPT_TYPE_INT, {.i64=0}, 0, INT_MAX, FLAGSR }, |
64 |
|
|
{ "y", "set y offset", OFFSET(y), AV_OPT_TYPE_INT, {.i64=0}, 0, INT_MAX, FLAGSR }, |
65 |
|
|
{ "mode", "set scope mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=0}, 0, 2, FLAGSR, .unit = "mode" }, |
66 |
|
|
{ "mono", NULL, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGSR, .unit = "mode" }, |
67 |
|
|
{ "color", NULL, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGSR, .unit = "mode" }, |
68 |
|
|
{ "color2", NULL, 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, FLAGSR, .unit = "mode" }, |
69 |
|
|
{ "axis", "draw column/row numbers", OFFSET(axis), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGSR }, |
70 |
|
|
{ "opacity", "set background opacity", OFFSET(opacity), AV_OPT_TYPE_FLOAT, {.dbl=0.75}, 0, 1, FLAGSR }, |
71 |
|
|
{ "format", "set display number format", OFFSET(dformat), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGSR, .unit = "format" }, |
72 |
|
|
{ "hex", NULL, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGSR, .unit = "format" }, |
73 |
|
|
{ "dec", NULL, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGSR, .unit = "format" }, |
74 |
|
|
{ "components", "set components to display", OFFSET(components), AV_OPT_TYPE_INT, {.i64=15}, 1, 15, FLAGSR }, |
75 |
|
|
{ NULL } |
76 |
|
|
}; |
77 |
|
|
|
78 |
|
|
AVFILTER_DEFINE_CLASS(datascope); |
79 |
|
|
|
80 |
|
✗ |
static int query_formats(const AVFilterContext *ctx, |
81 |
|
|
AVFilterFormatsConfig **cfg_in, |
82 |
|
|
AVFilterFormatsConfig **cfg_out) |
83 |
|
|
{ |
84 |
|
✗ |
return ff_set_common_formats2(ctx, cfg_in, cfg_out, |
85 |
|
|
ff_draw_supported_pixel_formats(0)); |
86 |
|
|
} |
87 |
|
|
|
88 |
|
✗ |
static void draw_text(FFDrawContext *draw, AVFrame *frame, FFDrawColor *color, |
89 |
|
|
int x0, int y0, const uint8_t *text, int vertical) |
90 |
|
|
{ |
91 |
|
✗ |
int x = x0; |
92 |
|
|
|
93 |
|
✗ |
for (; *text; text++) { |
94 |
|
✗ |
if (*text == '\n') { |
95 |
|
✗ |
x = x0; |
96 |
|
✗ |
y0 += 8; |
97 |
|
✗ |
continue; |
98 |
|
|
} |
99 |
|
✗ |
ff_blend_mask(draw, color, frame->data, frame->linesize, |
100 |
|
|
frame->width, frame->height, |
101 |
|
✗ |
avpriv_cga_font + *text * 8, 1, 8, 8, 0, 0, x, y0); |
102 |
|
✗ |
if (vertical) { |
103 |
|
✗ |
x = x0; |
104 |
|
✗ |
y0 += 8; |
105 |
|
|
} else { |
106 |
|
✗ |
x += 8; |
107 |
|
|
} |
108 |
|
|
} |
109 |
|
✗ |
} |
110 |
|
|
|
111 |
|
✗ |
static void pick_color8(FFDrawContext *draw, FFDrawColor *color, AVFrame *in, int x, int y, int *value) |
112 |
|
|
{ |
113 |
|
|
int p, i; |
114 |
|
|
|
115 |
|
✗ |
color->rgba[3] = 255; |
116 |
|
✗ |
for (p = 0; p < draw->nb_planes; p++) { |
117 |
|
✗ |
if (draw->nb_planes == 1) { |
118 |
|
✗ |
for (i = 0; i < 4; i++) { |
119 |
|
✗ |
value[i] = in->data[0][y * in->linesize[0] + x * draw->pixelstep[0] + i]; |
120 |
|
✗ |
color->comp[0].u8[i] = value[i]; |
121 |
|
|
} |
122 |
|
|
} else { |
123 |
|
✗ |
value[p] = in->data[p][(y >> draw->vsub[p]) * in->linesize[p] + (x >> draw->hsub[p])]; |
124 |
|
✗ |
color->comp[p].u8[0] = value[p]; |
125 |
|
|
} |
126 |
|
|
} |
127 |
|
✗ |
} |
128 |
|
|
|
129 |
|
✗ |
static void pick_color16(FFDrawContext *draw, FFDrawColor *color, AVFrame *in, int x, int y, int *value) |
130 |
|
|
{ |
131 |
|
|
int p, i; |
132 |
|
|
|
133 |
|
✗ |
color->rgba[3] = 255; |
134 |
|
✗ |
for (p = 0; p < draw->nb_planes; p++) { |
135 |
|
✗ |
if (draw->nb_planes == 1) { |
136 |
|
✗ |
for (i = 0; i < 4; i++) { |
137 |
|
✗ |
value[i] = AV_RL16(in->data[0] + y * in->linesize[0] + x * draw->pixelstep[0] + i * 2); |
138 |
|
✗ |
color->comp[0].u16[i] = value[i]; |
139 |
|
|
} |
140 |
|
|
} else { |
141 |
|
✗ |
value[p] = AV_RL16(in->data[p] + (y >> draw->vsub[p]) * in->linesize[p] + (x >> draw->hsub[p]) * 2); |
142 |
|
✗ |
color->comp[p].u16[0] = value[p]; |
143 |
|
|
} |
144 |
|
|
} |
145 |
|
✗ |
} |
146 |
|
|
|
147 |
|
✗ |
static void reverse_color8(FFDrawContext *draw, FFDrawColor *color, FFDrawColor *reverse) |
148 |
|
|
{ |
149 |
|
|
int p; |
150 |
|
|
|
151 |
|
✗ |
reverse->rgba[3] = 255; |
152 |
|
✗ |
for (p = 0; p < draw->nb_planes; p++) { |
153 |
|
✗ |
reverse->comp[p].u8[0] = color->comp[p].u8[0] > 127 ? 0 : 255; |
154 |
|
✗ |
reverse->comp[p].u8[1] = color->comp[p].u8[1] > 127 ? 0 : 255; |
155 |
|
✗ |
reverse->comp[p].u8[2] = color->comp[p].u8[2] > 127 ? 0 : 255; |
156 |
|
|
} |
157 |
|
✗ |
} |
158 |
|
|
|
159 |
|
✗ |
static void reverse_color16(FFDrawContext *draw, FFDrawColor *color, FFDrawColor *reverse) |
160 |
|
|
{ |
161 |
|
|
int p; |
162 |
|
|
|
163 |
|
✗ |
reverse->rgba[3] = 255; |
164 |
|
✗ |
for (p = 0; p < draw->nb_planes; p++) { |
165 |
|
✗ |
const unsigned max = (1 << draw->desc->comp[p].depth) - 1; |
166 |
|
✗ |
const unsigned mid = (max + 1) / 2; |
167 |
|
|
|
168 |
|
✗ |
reverse->comp[p].u16[0] = color->comp[p].u16[0] > mid ? 0 : max; |
169 |
|
✗ |
reverse->comp[p].u16[1] = color->comp[p].u16[1] > mid ? 0 : max; |
170 |
|
✗ |
reverse->comp[p].u16[2] = color->comp[p].u16[2] > mid ? 0 : max; |
171 |
|
|
} |
172 |
|
✗ |
} |
173 |
|
|
|
174 |
|
|
typedef struct ThreadData { |
175 |
|
|
AVFrame *in, *out; |
176 |
|
|
int xoff, yoff, PP; |
177 |
|
|
} ThreadData; |
178 |
|
|
|
179 |
|
✗ |
static int filter_color2(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) |
180 |
|
|
{ |
181 |
|
✗ |
DatascopeContext *s = ctx->priv; |
182 |
|
✗ |
AVFilterLink *outlink = ctx->outputs[0]; |
183 |
|
✗ |
AVFilterLink *inlink = ctx->inputs[0]; |
184 |
|
✗ |
ThreadData *td = arg; |
185 |
|
✗ |
AVFrame *in = td->in; |
186 |
|
✗ |
AVFrame *out = td->out; |
187 |
|
✗ |
const int PP = td->PP; |
188 |
|
✗ |
const int xoff = td->xoff; |
189 |
|
✗ |
const int yoff = td->yoff; |
190 |
|
✗ |
const int P = FFMAX(s->nb_planes, s->nb_comps); |
191 |
|
✗ |
const int C = s->chars; |
192 |
|
✗ |
const int D = ((s->chars - s->dformat) >> 2) + s->dformat * 2; |
193 |
|
✗ |
const int W = (outlink->w - xoff) / (C * 10); |
194 |
|
✗ |
const int H = (outlink->h - yoff) / (PP * 12); |
195 |
|
✗ |
const char *format[4] = {"%02X\n", "%04X\n", "%03d\n", "%05d\n"}; |
196 |
|
✗ |
const int slice_start = (W * jobnr) / nb_jobs; |
197 |
|
✗ |
const int slice_end = (W * (jobnr+1)) / nb_jobs; |
198 |
|
|
int x, y, p; |
199 |
|
|
|
200 |
|
✗ |
for (y = 0; y < H && (y + s->y < inlink->h); y++) { |
201 |
|
✗ |
for (x = slice_start; x < slice_end && (x + s->x < inlink->w); x++) { |
202 |
|
✗ |
FFDrawColor color = { { 0 } }; |
203 |
|
✗ |
FFDrawColor reverse = { { 0 } }; |
204 |
|
✗ |
int value[4] = { 0 }, pp = 0; |
205 |
|
|
|
206 |
|
✗ |
s->pick_color(&s->draw, &color, in, x + s->x, y + s->y, value); |
207 |
|
✗ |
s->reverse_color(&s->draw, &color, &reverse); |
208 |
|
✗ |
ff_fill_rectangle(&s->draw, &color, out->data, out->linesize, |
209 |
|
✗ |
xoff + x * C * 10, yoff + y * PP * 12, C * 10, PP * 12); |
210 |
|
|
|
211 |
|
✗ |
for (p = 0; p < P; p++) { |
212 |
|
|
char text[256]; |
213 |
|
|
|
214 |
|
✗ |
if (!(s->components & (1 << p))) |
215 |
|
✗ |
continue; |
216 |
|
✗ |
snprintf(text, sizeof(text), format[D], value[p]); |
217 |
|
✗ |
draw_text(&s->draw, out, &reverse, xoff + x * C * 10 + 2, yoff + y * PP * 12 + pp * 10 + 2, text, 0); |
218 |
|
✗ |
pp++; |
219 |
|
|
} |
220 |
|
|
} |
221 |
|
|
} |
222 |
|
|
|
223 |
|
✗ |
return 0; |
224 |
|
|
} |
225 |
|
|
|
226 |
|
✗ |
static int filter_color(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) |
227 |
|
|
{ |
228 |
|
✗ |
DatascopeContext *s = ctx->priv; |
229 |
|
✗ |
AVFilterLink *outlink = ctx->outputs[0]; |
230 |
|
✗ |
AVFilterLink *inlink = ctx->inputs[0]; |
231 |
|
✗ |
ThreadData *td = arg; |
232 |
|
✗ |
AVFrame *in = td->in; |
233 |
|
✗ |
AVFrame *out = td->out; |
234 |
|
✗ |
const int PP = td->PP; |
235 |
|
✗ |
const int xoff = td->xoff; |
236 |
|
✗ |
const int yoff = td->yoff; |
237 |
|
✗ |
const int P = FFMAX(s->nb_planes, s->nb_comps); |
238 |
|
✗ |
const int C = s->chars; |
239 |
|
✗ |
const int D = ((s->chars - s->dformat) >> 2) + s->dformat * 2; |
240 |
|
✗ |
const int W = (outlink->w - xoff) / (C * 10); |
241 |
|
✗ |
const int H = (outlink->h - yoff) / (PP * 12); |
242 |
|
✗ |
const char *format[4] = {"%02X\n", "%04X\n", "%03d\n", "%05d\n"}; |
243 |
|
✗ |
const int slice_start = (W * jobnr) / nb_jobs; |
244 |
|
✗ |
const int slice_end = (W * (jobnr+1)) / nb_jobs; |
245 |
|
|
int x, y, p; |
246 |
|
|
|
247 |
|
✗ |
for (y = 0; y < H && (y + s->y < inlink->h); y++) { |
248 |
|
✗ |
for (x = slice_start; x < slice_end && (x + s->x < inlink->w); x++) { |
249 |
|
✗ |
FFDrawColor color = { { 0 } }; |
250 |
|
✗ |
int value[4] = { 0 }, pp = 0; |
251 |
|
|
|
252 |
|
✗ |
s->pick_color(&s->draw, &color, in, x + s->x, y + s->y, value); |
253 |
|
|
|
254 |
|
✗ |
for (p = 0; p < P; p++) { |
255 |
|
|
char text[256]; |
256 |
|
|
|
257 |
|
✗ |
if (!(s->components & (1 << p))) |
258 |
|
✗ |
continue; |
259 |
|
✗ |
snprintf(text, sizeof(text), format[D], value[p]); |
260 |
|
✗ |
draw_text(&s->draw, out, &color, xoff + x * C * 10 + 2, yoff + y * PP * 12 + pp * 10 + 2, text, 0); |
261 |
|
✗ |
pp++; |
262 |
|
|
} |
263 |
|
|
} |
264 |
|
|
} |
265 |
|
|
|
266 |
|
✗ |
return 0; |
267 |
|
|
} |
268 |
|
|
|
269 |
|
✗ |
static int filter_mono(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) |
270 |
|
|
{ |
271 |
|
✗ |
DatascopeContext *s = ctx->priv; |
272 |
|
✗ |
AVFilterLink *outlink = ctx->outputs[0]; |
273 |
|
✗ |
AVFilterLink *inlink = ctx->inputs[0]; |
274 |
|
✗ |
ThreadData *td = arg; |
275 |
|
✗ |
AVFrame *in = td->in; |
276 |
|
✗ |
AVFrame *out = td->out; |
277 |
|
✗ |
const int PP = td->PP; |
278 |
|
✗ |
const int xoff = td->xoff; |
279 |
|
✗ |
const int yoff = td->yoff; |
280 |
|
✗ |
const int P = FFMAX(s->nb_planes, s->nb_comps); |
281 |
|
✗ |
const int C = s->chars; |
282 |
|
✗ |
const int D = ((s->chars - s->dformat) >> 2) + s->dformat * 2; |
283 |
|
✗ |
const int W = (outlink->w - xoff) / (C * 10); |
284 |
|
✗ |
const int H = (outlink->h - yoff) / (PP * 12); |
285 |
|
✗ |
const char *format[4] = {"%02X\n", "%04X\n", "%03d\n", "%05d\n"}; |
286 |
|
✗ |
const int slice_start = (W * jobnr) / nb_jobs; |
287 |
|
✗ |
const int slice_end = (W * (jobnr+1)) / nb_jobs; |
288 |
|
|
int x, y, p; |
289 |
|
|
|
290 |
|
✗ |
for (y = 0; y < H && (y + s->y < inlink->h); y++) { |
291 |
|
✗ |
for (x = slice_start; x < slice_end && (x + s->x < inlink->w); x++) { |
292 |
|
✗ |
FFDrawColor color = { { 0 } }; |
293 |
|
✗ |
int value[4] = { 0 }, pp = 0; |
294 |
|
|
|
295 |
|
✗ |
s->pick_color(&s->draw, &color, in, x + s->x, y + s->y, value); |
296 |
|
✗ |
for (p = 0; p < P; p++) { |
297 |
|
|
char text[256]; |
298 |
|
|
|
299 |
|
✗ |
if (!(s->components & (1 << p))) |
300 |
|
✗ |
continue; |
301 |
|
✗ |
snprintf(text, sizeof(text), format[D], value[p]); |
302 |
|
✗ |
draw_text(&s->draw, out, &s->white, xoff + x * C * 10 + 2, yoff + y * PP * 12 + pp * 10 + 2, text, 0); |
303 |
|
✗ |
pp++; |
304 |
|
|
} |
305 |
|
|
} |
306 |
|
|
} |
307 |
|
|
|
308 |
|
✗ |
return 0; |
309 |
|
|
} |
310 |
|
|
|
311 |
|
✗ |
static int filter_frame(AVFilterLink *inlink, AVFrame *in) |
312 |
|
|
{ |
313 |
|
✗ |
AVFilterContext *ctx = inlink->dst; |
314 |
|
✗ |
DatascopeContext *s = ctx->priv; |
315 |
|
✗ |
AVFilterLink *outlink = ctx->outputs[0]; |
316 |
|
✗ |
const int P = FFMAX(s->nb_planes, s->nb_comps); |
317 |
|
✗ |
ThreadData td = { 0 }; |
318 |
|
✗ |
int ymaxlen = 0; |
319 |
|
✗ |
int xmaxlen = 0; |
320 |
|
✗ |
int PP = 0; |
321 |
|
|
AVFrame *out; |
322 |
|
|
|
323 |
|
✗ |
out = ff_get_video_buffer(outlink, outlink->w, outlink->h); |
324 |
|
✗ |
if (!out) { |
325 |
|
✗ |
av_frame_free(&in); |
326 |
|
✗ |
return AVERROR(ENOMEM); |
327 |
|
|
} |
328 |
|
✗ |
av_frame_copy_props(out, in); |
329 |
|
|
|
330 |
|
✗ |
ff_fill_rectangle(&s->draw, &s->black, out->data, out->linesize, |
331 |
|
|
0, 0, outlink->w, outlink->h); |
332 |
|
|
|
333 |
|
✗ |
for (int p = 0; p < P; p++) { |
334 |
|
✗ |
if (s->components & (1 << p)) |
335 |
|
✗ |
PP++; |
336 |
|
|
} |
337 |
|
✗ |
PP = FFMAX(PP, 1); |
338 |
|
|
|
339 |
|
✗ |
if (s->axis) { |
340 |
|
✗ |
const int C = s->chars; |
341 |
|
✗ |
int Y = outlink->h / (PP * 12); |
342 |
|
✗ |
int X = outlink->w / (C * 10); |
343 |
|
✗ |
char text[256] = { 0 }; |
344 |
|
|
int x, y; |
345 |
|
|
|
346 |
|
✗ |
snprintf(text, sizeof(text), "%d", s->y + Y); |
347 |
|
✗ |
ymaxlen = strlen(text); |
348 |
|
✗ |
ymaxlen *= 10; |
349 |
|
✗ |
snprintf(text, sizeof(text), "%d", s->x + X); |
350 |
|
✗ |
xmaxlen = strlen(text); |
351 |
|
✗ |
xmaxlen *= 10; |
352 |
|
|
|
353 |
|
✗ |
Y = (outlink->h - xmaxlen) / (PP * 12); |
354 |
|
✗ |
X = (outlink->w - ymaxlen) / (C * 10); |
355 |
|
|
|
356 |
|
✗ |
for (y = 0; y < Y; y++) { |
357 |
|
✗ |
snprintf(text, sizeof(text), "%d", s->y + y); |
358 |
|
|
|
359 |
|
✗ |
ff_fill_rectangle(&s->draw, &s->gray, out->data, out->linesize, |
360 |
|
✗ |
0, xmaxlen + y * PP * 12 + (PP + 1) * PP - 2, ymaxlen, 10); |
361 |
|
|
|
362 |
|
✗ |
draw_text(&s->draw, out, &s->yellow, 2, xmaxlen + y * PP * 12 + (PP + 1) * PP, text, 0); |
363 |
|
|
} |
364 |
|
|
|
365 |
|
✗ |
for (x = 0; x < X; x++) { |
366 |
|
✗ |
snprintf(text, sizeof(text), "%d", s->x + x); |
367 |
|
|
|
368 |
|
✗ |
ff_fill_rectangle(&s->draw, &s->gray, out->data, out->linesize, |
369 |
|
✗ |
ymaxlen + x * C * 10 + 2 * C - 2, 0, 10, xmaxlen); |
370 |
|
|
|
371 |
|
✗ |
draw_text(&s->draw, out, &s->yellow, ymaxlen + x * C * 10 + 2 * C, 2, text, 1); |
372 |
|
|
} |
373 |
|
|
} |
374 |
|
|
|
375 |
|
✗ |
td.in = in; td.out = out, td.yoff = xmaxlen, td.xoff = ymaxlen, td.PP = PP; |
376 |
|
✗ |
ff_filter_execute(ctx, s->filter, &td, NULL, |
377 |
|
✗ |
FFMIN(ff_filter_get_nb_threads(ctx), FFMAX(outlink->w / 20, 1))); |
378 |
|
|
|
379 |
|
✗ |
av_frame_free(&in); |
380 |
|
✗ |
return ff_filter_frame(outlink, out); |
381 |
|
|
} |
382 |
|
|
|
383 |
|
✗ |
static int config_input(AVFilterLink *inlink) |
384 |
|
|
{ |
385 |
|
✗ |
DatascopeContext *s = inlink->dst->priv; |
386 |
|
✗ |
uint8_t alpha = s->opacity * 255; |
387 |
|
|
|
388 |
|
✗ |
s->nb_planes = av_pix_fmt_count_planes(inlink->format); |
389 |
|
✗ |
ff_draw_init2(&s->draw, inlink->format, inlink->colorspace, inlink->color_range, 0); |
390 |
|
✗ |
ff_draw_color(&s->draw, &s->white, (uint8_t[]){ 255, 255, 255, 255} ); |
391 |
|
✗ |
ff_draw_color(&s->draw, &s->black, (uint8_t[]){ 0, 0, 0, alpha} ); |
392 |
|
✗ |
ff_draw_color(&s->draw, &s->yellow, (uint8_t[]){ 255, 255, 0, 255} ); |
393 |
|
✗ |
ff_draw_color(&s->draw, &s->gray, (uint8_t[]){ 77, 77, 77, 255} ); |
394 |
|
✗ |
s->chars = (s->draw.desc->comp[0].depth + 7) / 8 * 2 + s->dformat; |
395 |
|
✗ |
s->nb_comps = s->draw.desc->nb_components; |
396 |
|
|
|
397 |
|
✗ |
switch (s->mode) { |
398 |
|
✗ |
case 0: s->filter = filter_mono; break; |
399 |
|
✗ |
case 1: s->filter = filter_color; break; |
400 |
|
✗ |
case 2: s->filter = filter_color2; break; |
401 |
|
|
} |
402 |
|
|
|
403 |
|
✗ |
if (s->draw.desc->comp[0].depth <= 8) { |
404 |
|
✗ |
s->pick_color = pick_color8; |
405 |
|
✗ |
s->reverse_color = reverse_color8; |
406 |
|
|
} else { |
407 |
|
✗ |
s->pick_color = pick_color16; |
408 |
|
✗ |
s->reverse_color = reverse_color16; |
409 |
|
|
} |
410 |
|
|
|
411 |
|
✗ |
return 0; |
412 |
|
|
} |
413 |
|
|
|
414 |
|
✗ |
static int config_output(AVFilterLink *outlink) |
415 |
|
|
{ |
416 |
|
✗ |
DatascopeContext *s = outlink->src->priv; |
417 |
|
|
|
418 |
|
✗ |
outlink->h = s->oh; |
419 |
|
✗ |
outlink->w = s->ow; |
420 |
|
✗ |
outlink->sample_aspect_ratio = (AVRational){1,1}; |
421 |
|
|
|
422 |
|
✗ |
return 0; |
423 |
|
|
} |
424 |
|
|
|
425 |
|
✗ |
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, |
426 |
|
|
char *res, int res_len, int flags) |
427 |
|
|
{ |
428 |
|
|
int ret; |
429 |
|
|
|
430 |
|
✗ |
ret = ff_filter_process_command(ctx, cmd, args, res, res_len, flags); |
431 |
|
✗ |
if (ret < 0) |
432 |
|
✗ |
return ret; |
433 |
|
|
|
434 |
|
✗ |
return config_input(ctx->inputs[0]); |
435 |
|
|
} |
436 |
|
|
|
437 |
|
|
static const AVFilterPad inputs[] = { |
438 |
|
|
{ |
439 |
|
|
.name = "default", |
440 |
|
|
.type = AVMEDIA_TYPE_VIDEO, |
441 |
|
|
.filter_frame = filter_frame, |
442 |
|
|
.config_props = config_input, |
443 |
|
|
}, |
444 |
|
|
}; |
445 |
|
|
|
446 |
|
|
static const AVFilterPad outputs[] = { |
447 |
|
|
{ |
448 |
|
|
.name = "default", |
449 |
|
|
.type = AVMEDIA_TYPE_VIDEO, |
450 |
|
|
.config_props = config_output, |
451 |
|
|
}, |
452 |
|
|
}; |
453 |
|
|
|
454 |
|
|
const AVFilter ff_vf_datascope = { |
455 |
|
|
.name = "datascope", |
456 |
|
|
.description = NULL_IF_CONFIG_SMALL("Video data analysis."), |
457 |
|
|
.priv_size = sizeof(DatascopeContext), |
458 |
|
|
.priv_class = &datascope_class, |
459 |
|
|
FILTER_INPUTS(inputs), |
460 |
|
|
FILTER_OUTPUTS(outputs), |
461 |
|
|
FILTER_QUERY_FUNC2(query_formats), |
462 |
|
|
.flags = AVFILTER_FLAG_SLICE_THREADS, |
463 |
|
|
.process_command = process_command, |
464 |
|
|
}; |
465 |
|
|
|
466 |
|
|
typedef struct PixscopeContext { |
467 |
|
|
const AVClass *class; |
468 |
|
|
|
469 |
|
|
float xpos, ypos; |
470 |
|
|
float wx, wy; |
471 |
|
|
int w, h; |
472 |
|
|
float o; |
473 |
|
|
|
474 |
|
|
int x, y; |
475 |
|
|
int ww, wh; |
476 |
|
|
|
477 |
|
|
int nb_planes; |
478 |
|
|
int nb_comps; |
479 |
|
|
int is_rgb; |
480 |
|
|
uint8_t rgba_map[4]; |
481 |
|
|
FFDrawContext draw; |
482 |
|
|
FFDrawColor dark; |
483 |
|
|
FFDrawColor black; |
484 |
|
|
FFDrawColor white; |
485 |
|
|
FFDrawColor green; |
486 |
|
|
FFDrawColor blue; |
487 |
|
|
FFDrawColor red; |
488 |
|
|
FFDrawColor *colors[4]; |
489 |
|
|
|
490 |
|
|
uint16_t values[4][80][80]; |
491 |
|
|
|
492 |
|
|
void (*pick_color)(FFDrawContext *draw, FFDrawColor *color, AVFrame *in, int x, int y, int *value); |
493 |
|
|
} PixscopeContext; |
494 |
|
|
|
495 |
|
|
#define POFFSET(x) offsetof(PixscopeContext, x) |
496 |
|
|
|
497 |
|
|
static const AVOption pixscope_options[] = { |
498 |
|
|
{ "x", "set scope x offset", POFFSET(xpos), AV_OPT_TYPE_FLOAT, {.dbl=0.5}, 0, 1, FLAGSR }, |
499 |
|
|
{ "y", "set scope y offset", POFFSET(ypos), AV_OPT_TYPE_FLOAT, {.dbl=0.5}, 0, 1, FLAGSR }, |
500 |
|
|
{ "w", "set scope width", POFFSET(w), AV_OPT_TYPE_INT, {.i64=7}, 1, 80, FLAGSR }, |
501 |
|
|
{ "h", "set scope height", POFFSET(h), AV_OPT_TYPE_INT, {.i64=7}, 1, 80, FLAGSR }, |
502 |
|
|
{ "o", "set window opacity", POFFSET(o), AV_OPT_TYPE_FLOAT, {.dbl=0.5}, 0, 1, FLAGSR }, |
503 |
|
|
{ "wx", "set window x offset", POFFSET(wx), AV_OPT_TYPE_FLOAT, {.dbl=-1}, -1, 1, FLAGSR }, |
504 |
|
|
{ "wy", "set window y offset", POFFSET(wy), AV_OPT_TYPE_FLOAT, {.dbl=-1}, -1, 1, FLAGSR }, |
505 |
|
|
{ NULL } |
506 |
|
|
}; |
507 |
|
|
|
508 |
|
|
AVFILTER_DEFINE_CLASS(pixscope); |
509 |
|
|
|
510 |
|
✗ |
static int pixscope_config_input(AVFilterLink *inlink) |
511 |
|
|
{ |
512 |
|
✗ |
PixscopeContext *s = inlink->dst->priv; |
513 |
|
|
|
514 |
|
✗ |
s->nb_planes = av_pix_fmt_count_planes(inlink->format); |
515 |
|
✗ |
ff_draw_init(&s->draw, inlink->format, 0); |
516 |
|
✗ |
ff_draw_color(&s->draw, &s->dark, (uint8_t[]){ 0, 0, 0, s->o * 255} ); |
517 |
|
✗ |
ff_draw_color(&s->draw, &s->black, (uint8_t[]){ 0, 0, 0, 255} ); |
518 |
|
✗ |
ff_draw_color(&s->draw, &s->white, (uint8_t[]){ 255, 255, 255, 255} ); |
519 |
|
✗ |
ff_draw_color(&s->draw, &s->green, (uint8_t[]){ 0, 255, 0, 255} ); |
520 |
|
✗ |
ff_draw_color(&s->draw, &s->blue, (uint8_t[]){ 0, 0, 255, 255} ); |
521 |
|
✗ |
ff_draw_color(&s->draw, &s->red, (uint8_t[]){ 255, 0, 0, 255} ); |
522 |
|
✗ |
s->nb_comps = s->draw.desc->nb_components; |
523 |
|
✗ |
s->is_rgb = s->draw.desc->flags & AV_PIX_FMT_FLAG_RGB; |
524 |
|
|
|
525 |
|
✗ |
if (s->is_rgb) { |
526 |
|
✗ |
s->colors[0] = &s->red; |
527 |
|
✗ |
s->colors[1] = &s->green; |
528 |
|
✗ |
s->colors[2] = &s->blue; |
529 |
|
✗ |
s->colors[3] = &s->white; |
530 |
|
✗ |
ff_fill_rgba_map(s->rgba_map, inlink->format); |
531 |
|
|
} else { |
532 |
|
✗ |
s->colors[0] = &s->white; |
533 |
|
✗ |
s->colors[1] = &s->blue; |
534 |
|
✗ |
s->colors[2] = &s->red; |
535 |
|
✗ |
s->colors[3] = &s->white; |
536 |
|
✗ |
s->rgba_map[0] = 0; |
537 |
|
✗ |
s->rgba_map[1] = 1; |
538 |
|
✗ |
s->rgba_map[2] = 2; |
539 |
|
✗ |
s->rgba_map[3] = 3; |
540 |
|
|
} |
541 |
|
|
|
542 |
|
✗ |
if (s->draw.desc->comp[0].depth <= 8) { |
543 |
|
✗ |
s->pick_color = pick_color8; |
544 |
|
|
} else { |
545 |
|
✗ |
s->pick_color = pick_color16; |
546 |
|
|
} |
547 |
|
|
|
548 |
|
✗ |
if (inlink->w < 640 || inlink->h < 480) { |
549 |
|
✗ |
av_log(inlink->dst, AV_LOG_ERROR, "min supported resolution is 640x480\n"); |
550 |
|
✗ |
return AVERROR(EINVAL); |
551 |
|
|
} |
552 |
|
|
|
553 |
|
✗ |
s->ww = 300; |
554 |
|
✗ |
s->wh = 300 * 1.6; |
555 |
|
✗ |
s->x = s->xpos * (inlink->w - 1); |
556 |
|
✗ |
s->y = s->ypos * (inlink->h - 1); |
557 |
|
✗ |
if (s->x + s->w >= inlink->w || s->y + s->h >= inlink->h) { |
558 |
|
✗ |
av_log(inlink->dst, AV_LOG_WARNING, "scope position is out of range, clipping\n"); |
559 |
|
✗ |
s->x = FFMIN(s->x, inlink->w - s->w); |
560 |
|
✗ |
s->y = FFMIN(s->y, inlink->h - s->h); |
561 |
|
|
} |
562 |
|
|
|
563 |
|
✗ |
return 0; |
564 |
|
|
} |
565 |
|
|
|
566 |
|
|
#define SQR(x) ((x)*(x)) |
567 |
|
|
|
568 |
|
✗ |
static int pixscope_filter_frame(AVFilterLink *inlink, AVFrame *in) |
569 |
|
|
{ |
570 |
|
✗ |
AVFilterContext *ctx = inlink->dst; |
571 |
|
✗ |
PixscopeContext *s = ctx->priv; |
572 |
|
✗ |
AVFilterLink *outlink = ctx->outputs[0]; |
573 |
|
✗ |
AVFrame *out = ff_get_video_buffer(outlink, in->width, in->height); |
574 |
|
✗ |
int max[4] = { 0 }, min[4] = { INT_MAX, INT_MAX, INT_MAX, INT_MAX }; |
575 |
|
✗ |
float average[4] = { 0 }; |
576 |
|
✗ |
double std[4] = { 0 }, rms[4] = { 0 }; |
577 |
|
✗ |
const char rgba[4] = { 'R', 'G', 'B', 'A' }; |
578 |
|
✗ |
const char yuva[4] = { 'Y', 'U', 'V', 'A' }; |
579 |
|
|
int x, y, X, Y, i, w, h; |
580 |
|
|
char text[128]; |
581 |
|
|
|
582 |
|
✗ |
if (!out) { |
583 |
|
✗ |
av_frame_free(&in); |
584 |
|
✗ |
return AVERROR(ENOMEM); |
585 |
|
|
} |
586 |
|
✗ |
av_frame_copy_props(out, in); |
587 |
|
✗ |
av_frame_copy(out, in); |
588 |
|
|
|
589 |
|
✗ |
w = s->ww / s->w; |
590 |
|
✗ |
h = s->ww / s->h; |
591 |
|
|
|
592 |
|
✗ |
if (s->wx >= 0) { |
593 |
|
✗ |
X = (in->width - s->ww) * s->wx; |
594 |
|
|
} else { |
595 |
|
✗ |
X = (in->width - s->ww) * -s->wx; |
596 |
|
|
} |
597 |
|
✗ |
if (s->wy >= 0) { |
598 |
|
✗ |
Y = (in->height - s->wh) * s->wy; |
599 |
|
|
} else { |
600 |
|
✗ |
Y = (in->height - s->wh) * -s->wy; |
601 |
|
|
} |
602 |
|
|
|
603 |
|
✗ |
if (s->wx < 0) { |
604 |
|
✗ |
if (s->x + s->w >= X && (s->x + s->w <= X + s->ww) && |
605 |
|
✗ |
s->y + s->h >= Y && (s->y + s->h <= Y + s->wh)) { |
606 |
|
✗ |
X = (in->width - s->ww) * (1 + s->wx); |
607 |
|
|
} |
608 |
|
|
} |
609 |
|
|
|
610 |
|
✗ |
if (s->wy < 0) { |
611 |
|
✗ |
if (s->x + s->w >= X && (s->x + s->w <= X + s->ww) && |
612 |
|
✗ |
s->y + s->h >= Y && (s->y + s->h <= Y + s->wh)) { |
613 |
|
✗ |
Y = (in->height - s->wh) * (1 + s->wy); |
614 |
|
|
} |
615 |
|
|
} |
616 |
|
|
|
617 |
|
✗ |
ff_blend_rectangle(&s->draw, &s->dark, out->data, out->linesize, |
618 |
|
|
out->width, out->height, |
619 |
|
|
X, |
620 |
|
|
Y, |
621 |
|
|
s->ww, |
622 |
|
|
s->wh); |
623 |
|
|
|
624 |
|
✗ |
for (y = 0; y < s->h; y++) { |
625 |
|
✗ |
for (x = 0; x < s->w; x++) { |
626 |
|
✗ |
FFDrawColor color = { { 0 } }; |
627 |
|
✗ |
int value[4] = { 0 }; |
628 |
|
|
|
629 |
|
✗ |
s->pick_color(&s->draw, &color, in, x + s->x, y + s->y, value); |
630 |
|
✗ |
ff_fill_rectangle(&s->draw, &color, out->data, out->linesize, |
631 |
|
✗ |
x * w + (s->ww - 4 - (s->w * w)) / 2 + X, y * h + 2 + Y, w, h); |
632 |
|
✗ |
for (i = 0; i < 4; i++) { |
633 |
|
✗ |
s->values[i][x][y] = value[i]; |
634 |
|
✗ |
rms[i] += (double)value[i] * (double)value[i]; |
635 |
|
✗ |
average[i] += value[i]; |
636 |
|
✗ |
min[i] = FFMIN(min[i], value[i]); |
637 |
|
✗ |
max[i] = FFMAX(max[i], value[i]); |
638 |
|
|
} |
639 |
|
|
} |
640 |
|
|
} |
641 |
|
|
|
642 |
|
✗ |
ff_blend_rectangle(&s->draw, &s->black, out->data, out->linesize, |
643 |
|
|
out->width, out->height, |
644 |
|
✗ |
s->x - 2, s->y - 2, s->w + 4, 1); |
645 |
|
|
|
646 |
|
✗ |
ff_blend_rectangle(&s->draw, &s->white, out->data, out->linesize, |
647 |
|
|
out->width, out->height, |
648 |
|
✗ |
s->x - 1, s->y - 1, s->w + 2, 1); |
649 |
|
|
|
650 |
|
✗ |
ff_blend_rectangle(&s->draw, &s->white, out->data, out->linesize, |
651 |
|
|
out->width, out->height, |
652 |
|
✗ |
s->x - 1, s->y - 1, 1, s->h + 2); |
653 |
|
|
|
654 |
|
✗ |
ff_blend_rectangle(&s->draw, &s->black, out->data, out->linesize, |
655 |
|
|
out->width, out->height, |
656 |
|
✗ |
s->x - 2, s->y - 2, 1, s->h + 4); |
657 |
|
|
|
658 |
|
✗ |
ff_blend_rectangle(&s->draw, &s->white, out->data, out->linesize, |
659 |
|
|
out->width, out->height, |
660 |
|
✗ |
s->x - 1, s->y + 1 + s->h, s->w + 3, 1); |
661 |
|
|
|
662 |
|
✗ |
ff_blend_rectangle(&s->draw, &s->black, out->data, out->linesize, |
663 |
|
|
out->width, out->height, |
664 |
|
✗ |
s->x - 2, s->y + 2 + s->h, s->w + 4, 1); |
665 |
|
|
|
666 |
|
✗ |
ff_blend_rectangle(&s->draw, &s->white, out->data, out->linesize, |
667 |
|
|
out->width, out->height, |
668 |
|
✗ |
s->x + 1 + s->w, s->y - 1, 1, s->h + 2); |
669 |
|
|
|
670 |
|
✗ |
ff_blend_rectangle(&s->draw, &s->black, out->data, out->linesize, |
671 |
|
|
out->width, out->height, |
672 |
|
✗ |
s->x + 2 + s->w, s->y - 2, 1, s->h + 5); |
673 |
|
|
|
674 |
|
✗ |
for (i = 0; i < 4; i++) { |
675 |
|
✗ |
rms[i] /= s->w * s->h; |
676 |
|
✗ |
rms[i] = sqrt(rms[i]); |
677 |
|
✗ |
average[i] /= s->w * s->h; |
678 |
|
|
} |
679 |
|
|
|
680 |
|
✗ |
for (y = 0; y < s->h; y++) { |
681 |
|
✗ |
for (x = 0; x < s->w; x++) { |
682 |
|
✗ |
for (i = 0; i < 4; i++) |
683 |
|
✗ |
std[i] += SQR(s->values[i][x][y] - average[i]); |
684 |
|
|
} |
685 |
|
|
} |
686 |
|
|
|
687 |
|
✗ |
for (i = 0; i < 4; i++) { |
688 |
|
✗ |
std[i] /= s->w * s->h; |
689 |
|
✗ |
std[i] = sqrt(std[i]); |
690 |
|
|
} |
691 |
|
|
|
692 |
|
✗ |
snprintf(text, sizeof(text), "CH AVG MIN MAX RMS\n"); |
693 |
|
✗ |
draw_text(&s->draw, out, &s->white, X + 28, Y + s->ww + 5, text, 0); |
694 |
|
✗ |
for (i = 0; i < s->nb_comps; i++) { |
695 |
|
✗ |
int c = s->rgba_map[i]; |
696 |
|
|
|
697 |
|
✗ |
snprintf(text, sizeof(text), "%c %07.1f %05d %05d %07.1f\n", s->is_rgb ? rgba[i] : yuva[i], average[c], min[c], max[c], rms[c]); |
698 |
|
✗ |
draw_text(&s->draw, out, s->colors[i], X + 28, Y + s->ww + 15 * (i + 1), text, 0); |
699 |
|
|
} |
700 |
|
✗ |
snprintf(text, sizeof(text), "CH STD\n"); |
701 |
|
✗ |
draw_text(&s->draw, out, &s->white, X + 28, Y + s->ww + 15 * (0 + 5), text, 0); |
702 |
|
✗ |
for (i = 0; i < s->nb_comps; i++) { |
703 |
|
✗ |
int c = s->rgba_map[i]; |
704 |
|
|
|
705 |
|
✗ |
snprintf(text, sizeof(text), "%c %07.2f\n", s->is_rgb ? rgba[i] : yuva[i], std[c]); |
706 |
|
✗ |
draw_text(&s->draw, out, s->colors[i], X + 28, Y + s->ww + 15 * (i + 6), text, 0); |
707 |
|
|
} |
708 |
|
|
|
709 |
|
✗ |
av_frame_free(&in); |
710 |
|
✗ |
return ff_filter_frame(outlink, out); |
711 |
|
|
} |
712 |
|
|
|
713 |
|
✗ |
static int pixscope_process_command(AVFilterContext *ctx, const char *cmd, const char *args, |
714 |
|
|
char *res, int res_len, int flags) |
715 |
|
|
{ |
716 |
|
|
int ret; |
717 |
|
|
|
718 |
|
✗ |
ret = ff_filter_process_command(ctx, cmd, args, res, res_len, flags); |
719 |
|
✗ |
if (ret < 0) |
720 |
|
✗ |
return ret; |
721 |
|
|
|
722 |
|
✗ |
return pixscope_config_input(ctx->inputs[0]); |
723 |
|
|
} |
724 |
|
|
|
725 |
|
|
static const AVFilterPad pixscope_inputs[] = { |
726 |
|
|
{ |
727 |
|
|
.name = "default", |
728 |
|
|
.type = AVMEDIA_TYPE_VIDEO, |
729 |
|
|
.filter_frame = pixscope_filter_frame, |
730 |
|
|
.config_props = pixscope_config_input, |
731 |
|
|
}, |
732 |
|
|
}; |
733 |
|
|
|
734 |
|
|
const AVFilter ff_vf_pixscope = { |
735 |
|
|
.name = "pixscope", |
736 |
|
|
.description = NULL_IF_CONFIG_SMALL("Pixel data analysis."), |
737 |
|
|
.priv_size = sizeof(PixscopeContext), |
738 |
|
|
.priv_class = &pixscope_class, |
739 |
|
|
FILTER_INPUTS(pixscope_inputs), |
740 |
|
|
FILTER_OUTPUTS(ff_video_default_filterpad), |
741 |
|
|
FILTER_QUERY_FUNC2(query_formats), |
742 |
|
|
.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, |
743 |
|
|
.process_command = pixscope_process_command, |
744 |
|
|
}; |
745 |
|
|
|
746 |
|
|
typedef struct PixelValues { |
747 |
|
|
uint16_t p[4]; |
748 |
|
|
} PixelValues; |
749 |
|
|
|
750 |
|
|
typedef struct OscilloscopeContext { |
751 |
|
|
const AVClass *class; |
752 |
|
|
|
753 |
|
|
float xpos, ypos; |
754 |
|
|
float tx, ty; |
755 |
|
|
float size; |
756 |
|
|
float tilt; |
757 |
|
|
float theight, twidth; |
758 |
|
|
float o; |
759 |
|
|
int components; |
760 |
|
|
int grid; |
761 |
|
|
int statistics; |
762 |
|
|
int scope; |
763 |
|
|
|
764 |
|
|
int x1, y1, x2, y2; |
765 |
|
|
int ox, oy; |
766 |
|
|
int height, width; |
767 |
|
|
|
768 |
|
|
int max; |
769 |
|
|
int nb_planes; |
770 |
|
|
int nb_comps; |
771 |
|
|
int is_rgb; |
772 |
|
|
uint8_t rgba_map[4]; |
773 |
|
|
FFDrawContext draw; |
774 |
|
|
FFDrawColor dark; |
775 |
|
|
FFDrawColor black; |
776 |
|
|
FFDrawColor white; |
777 |
|
|
FFDrawColor green; |
778 |
|
|
FFDrawColor blue; |
779 |
|
|
FFDrawColor red; |
780 |
|
|
FFDrawColor cyan; |
781 |
|
|
FFDrawColor magenta; |
782 |
|
|
FFDrawColor gray; |
783 |
|
|
FFDrawColor *colors[4]; |
784 |
|
|
|
785 |
|
|
int nb_values; |
786 |
|
|
PixelValues *values; |
787 |
|
|
|
788 |
|
|
void (*pick_color)(FFDrawContext *draw, FFDrawColor *color, AVFrame *in, int x, int y, int *value); |
789 |
|
|
void (*draw_trace)(struct OscilloscopeContext *s, AVFrame *frame); |
790 |
|
|
} OscilloscopeContext; |
791 |
|
|
|
792 |
|
|
#define OOFFSET(x) offsetof(OscilloscopeContext, x) |
793 |
|
|
|
794 |
|
|
static const AVOption oscilloscope_options[] = { |
795 |
|
|
{ "x", "set scope x position", OOFFSET(xpos), AV_OPT_TYPE_FLOAT, {.dbl=0.5}, 0, 1, FLAGSR }, |
796 |
|
|
{ "y", "set scope y position", OOFFSET(ypos), AV_OPT_TYPE_FLOAT, {.dbl=0.5}, 0, 1, FLAGSR }, |
797 |
|
|
{ "s", "set scope size", OOFFSET(size), AV_OPT_TYPE_FLOAT, {.dbl=0.8}, 0, 1, FLAGSR }, |
798 |
|
|
{ "t", "set scope tilt", OOFFSET(tilt), AV_OPT_TYPE_FLOAT, {.dbl=0.5}, 0, 1, FLAGSR }, |
799 |
|
|
{ "o", "set trace opacity", OOFFSET(o), AV_OPT_TYPE_FLOAT, {.dbl=0.8}, 0, 1, FLAGSR }, |
800 |
|
|
{ "tx", "set trace x position", OOFFSET(tx), AV_OPT_TYPE_FLOAT, {.dbl=0.5}, 0, 1, FLAGSR }, |
801 |
|
|
{ "ty", "set trace y position", OOFFSET(ty), AV_OPT_TYPE_FLOAT, {.dbl=0.9}, 0, 1, FLAGSR }, |
802 |
|
|
{ "tw", "set trace width", OOFFSET(twidth), AV_OPT_TYPE_FLOAT, {.dbl=0.8},.1, 1, FLAGSR }, |
803 |
|
|
{ "th", "set trace height", OOFFSET(theight), AV_OPT_TYPE_FLOAT, {.dbl=0.3},.1, 1, FLAGSR }, |
804 |
|
|
{ "c", "set components to trace", OOFFSET(components), AV_OPT_TYPE_INT, {.i64=7}, 0, 15, FLAGSR }, |
805 |
|
|
{ "g", "draw trace grid", OOFFSET(grid), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1, FLAGSR }, |
806 |
|
|
{ "st", "draw statistics", OOFFSET(statistics), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1, FLAGSR }, |
807 |
|
|
{ "sc", "draw scope", OOFFSET(scope), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1, FLAGSR }, |
808 |
|
|
{ NULL } |
809 |
|
|
}; |
810 |
|
|
|
811 |
|
|
AVFILTER_DEFINE_CLASS(oscilloscope); |
812 |
|
|
|
813 |
|
✗ |
static void oscilloscope_uninit(AVFilterContext *ctx) |
814 |
|
|
{ |
815 |
|
✗ |
OscilloscopeContext *s = ctx->priv; |
816 |
|
|
|
817 |
|
✗ |
av_freep(&s->values); |
818 |
|
✗ |
} |
819 |
|
|
|
820 |
|
✗ |
static void draw_line(FFDrawContext *draw, int x0, int y0, int x1, int y1, |
821 |
|
|
AVFrame *out, FFDrawColor *color) |
822 |
|
|
{ |
823 |
|
✗ |
int dx = FFABS(x1 - x0), sx = x0 < x1 ? 1 : -1; |
824 |
|
✗ |
int dy = FFABS(y1 - y0), sy = y0 < y1 ? 1 : -1; |
825 |
|
✗ |
int err = (dx > dy ? dx : -dy) / 2, e2; |
826 |
|
|
int p, i; |
827 |
|
|
|
828 |
|
|
for (;;) { |
829 |
|
✗ |
if (x0 >= 0 && y0 >= 0 && x0 < out->width && y0 < out->height) { |
830 |
|
✗ |
for (p = 0; p < draw->nb_planes; p++) { |
831 |
|
✗ |
if (draw->desc->comp[p].depth == 8) { |
832 |
|
✗ |
if (draw->nb_planes == 1) { |
833 |
|
✗ |
for (i = 0; i < draw->desc->nb_components; i++) { |
834 |
|
✗ |
out->data[0][y0 * out->linesize[0] + x0 * draw->pixelstep[0] + i] = color->comp[0].u8[i]; |
835 |
|
|
} |
836 |
|
|
} else { |
837 |
|
✗ |
out->data[p][out->linesize[p] * (y0 >> draw->vsub[p]) + (x0 >> draw->hsub[p])] = color->comp[p].u8[0]; |
838 |
|
|
} |
839 |
|
|
} else { |
840 |
|
✗ |
if (draw->nb_planes == 1) { |
841 |
|
✗ |
for (i = 0; i < draw->desc->nb_components; i++) { |
842 |
|
✗ |
AV_WN16(out->data[0] + y0 * out->linesize[0] + (x0 * draw->pixelstep[0] + i), color->comp[0].u16[i]); |
843 |
|
|
} |
844 |
|
|
} else { |
845 |
|
✗ |
AV_WN16(out->data[p] + out->linesize[p] * (y0 >> draw->vsub[p]) + (x0 >> draw->hsub[p]) * 2, color->comp[p].u16[0]); |
846 |
|
|
} |
847 |
|
|
} |
848 |
|
|
} |
849 |
|
|
} |
850 |
|
|
|
851 |
|
✗ |
if (x0 == x1 && y0 == y1) |
852 |
|
✗ |
break; |
853 |
|
|
|
854 |
|
✗ |
e2 = err; |
855 |
|
|
|
856 |
|
✗ |
if (e2 >-dx) { |
857 |
|
✗ |
err -= dy; |
858 |
|
✗ |
x0 += sx; |
859 |
|
|
} |
860 |
|
|
|
861 |
|
✗ |
if (e2 < dy) { |
862 |
|
✗ |
err += dx; |
863 |
|
✗ |
y0 += sy; |
864 |
|
|
} |
865 |
|
|
} |
866 |
|
✗ |
} |
867 |
|
|
|
868 |
|
✗ |
static void draw_trace8(OscilloscopeContext *s, AVFrame *frame) |
869 |
|
|
{ |
870 |
|
|
int i, c; |
871 |
|
|
|
872 |
|
✗ |
for (i = 1; i < s->nb_values; i++) { |
873 |
|
✗ |
for (c = 0; c < s->nb_comps; c++) { |
874 |
|
✗ |
if ((1 << c) & s->components) { |
875 |
|
✗ |
int x = i * s->width / s->nb_values; |
876 |
|
✗ |
int px = (i - 1) * s->width / s->nb_values; |
877 |
|
✗ |
int py = s->height - s->values[i-1].p[s->rgba_map[c]] * s->height / 256; |
878 |
|
✗ |
int y = s->height - s->values[i].p[s->rgba_map[c]] * s->height / 256; |
879 |
|
|
|
880 |
|
✗ |
draw_line(&s->draw, s->ox + x, s->oy + y, s->ox + px, s->oy + py, frame, s->colors[c]); |
881 |
|
|
} |
882 |
|
|
} |
883 |
|
|
} |
884 |
|
✗ |
} |
885 |
|
|
|
886 |
|
|
|
887 |
|
✗ |
static void draw_trace16(OscilloscopeContext *s, AVFrame *frame) |
888 |
|
|
{ |
889 |
|
|
int i, c; |
890 |
|
|
|
891 |
|
✗ |
for (i = 1; i < s->nb_values; i++) { |
892 |
|
✗ |
for (c = 0; c < s->nb_comps; c++) { |
893 |
|
✗ |
if ((1 << c) & s->components) { |
894 |
|
✗ |
int x = i * s->width / s->nb_values; |
895 |
|
✗ |
int px = (i - 1) * s->width / s->nb_values; |
896 |
|
✗ |
int py = s->height - s->values[i-1].p[s->rgba_map[c]] * s->height / s->max; |
897 |
|
✗ |
int y = s->height - s->values[i].p[s->rgba_map[c]] * s->height / s->max; |
898 |
|
|
|
899 |
|
✗ |
draw_line(&s->draw, s->ox + x, s->oy + y, s->ox + px, s->oy + py, frame, s->colors[c]); |
900 |
|
|
} |
901 |
|
|
} |
902 |
|
|
} |
903 |
|
✗ |
} |
904 |
|
|
|
905 |
|
✗ |
static void update_oscilloscope(AVFilterContext *ctx) |
906 |
|
|
{ |
907 |
|
✗ |
OscilloscopeContext *s = ctx->priv; |
908 |
|
✗ |
AVFilterLink *inlink = ctx->inputs[0]; |
909 |
|
|
int cx, cy, size; |
910 |
|
|
double tilt; |
911 |
|
|
|
912 |
|
✗ |
ff_draw_color(&s->draw, &s->dark, (uint8_t[]){ 0, 0, 0, s->o * 255} ); |
913 |
|
✗ |
s->height = s->theight * inlink->h; |
914 |
|
✗ |
s->width = s->twidth * inlink->w; |
915 |
|
✗ |
size = hypot(inlink->w, inlink->h); |
916 |
|
✗ |
size *= s->size; |
917 |
|
✗ |
tilt = (s->tilt - 0.5) * M_PI; |
918 |
|
✗ |
cx = s->xpos * (inlink->w - 1); |
919 |
|
✗ |
cy = s->ypos * (inlink->h - 1); |
920 |
|
✗ |
s->x1 = cx - size / 2.0 * cos(tilt); |
921 |
|
✗ |
s->x2 = cx + size / 2.0 * cos(tilt); |
922 |
|
✗ |
s->y1 = cy - size / 2.0 * sin(tilt); |
923 |
|
✗ |
s->y2 = cy + size / 2.0 * sin(tilt); |
924 |
|
✗ |
s->ox = (inlink->w - s->width) * s->tx; |
925 |
|
✗ |
s->oy = (inlink->h - s->height) * s->ty; |
926 |
|
✗ |
} |
927 |
|
|
|
928 |
|
✗ |
static int oscilloscope_config_input(AVFilterLink *inlink) |
929 |
|
|
{ |
930 |
|
✗ |
OscilloscopeContext *s = inlink->dst->priv; |
931 |
|
|
int size; |
932 |
|
|
|
933 |
|
✗ |
s->nb_planes = av_pix_fmt_count_planes(inlink->format); |
934 |
|
✗ |
ff_draw_init(&s->draw, inlink->format, 0); |
935 |
|
✗ |
ff_draw_color(&s->draw, &s->black, (uint8_t[]){ 0, 0, 0, 255} ); |
936 |
|
✗ |
ff_draw_color(&s->draw, &s->white, (uint8_t[]){ 255, 255, 255, 255} ); |
937 |
|
✗ |
ff_draw_color(&s->draw, &s->green, (uint8_t[]){ 0, 255, 0, 255} ); |
938 |
|
✗ |
ff_draw_color(&s->draw, &s->blue, (uint8_t[]){ 0, 0, 255, 255} ); |
939 |
|
✗ |
ff_draw_color(&s->draw, &s->red, (uint8_t[]){ 255, 0, 0, 255} ); |
940 |
|
✗ |
ff_draw_color(&s->draw, &s->cyan, (uint8_t[]){ 0, 255, 255, 255} ); |
941 |
|
✗ |
ff_draw_color(&s->draw, &s->magenta, (uint8_t[]){ 255, 0, 255, 255} ); |
942 |
|
✗ |
ff_draw_color(&s->draw, &s->gray, (uint8_t[]){ 128, 128, 128, 255} ); |
943 |
|
✗ |
s->nb_comps = s->draw.desc->nb_components; |
944 |
|
✗ |
s->is_rgb = s->draw.desc->flags & AV_PIX_FMT_FLAG_RGB; |
945 |
|
|
|
946 |
|
✗ |
if (s->is_rgb) { |
947 |
|
✗ |
s->colors[0] = &s->red; |
948 |
|
✗ |
s->colors[1] = &s->green; |
949 |
|
✗ |
s->colors[2] = &s->blue; |
950 |
|
✗ |
s->colors[3] = &s->white; |
951 |
|
✗ |
ff_fill_rgba_map(s->rgba_map, inlink->format); |
952 |
|
|
} else { |
953 |
|
✗ |
s->colors[0] = &s->white; |
954 |
|
✗ |
s->colors[1] = &s->cyan; |
955 |
|
✗ |
s->colors[2] = &s->magenta; |
956 |
|
✗ |
s->colors[3] = &s->white; |
957 |
|
✗ |
s->rgba_map[0] = 0; |
958 |
|
✗ |
s->rgba_map[1] = 1; |
959 |
|
✗ |
s->rgba_map[2] = 2; |
960 |
|
✗ |
s->rgba_map[3] = 3; |
961 |
|
|
} |
962 |
|
|
|
963 |
|
✗ |
if (s->draw.desc->comp[0].depth <= 8) { |
964 |
|
✗ |
s->pick_color = pick_color8; |
965 |
|
✗ |
s->draw_trace = draw_trace8; |
966 |
|
|
} else { |
967 |
|
✗ |
s->pick_color = pick_color16; |
968 |
|
✗ |
s->draw_trace = draw_trace16; |
969 |
|
|
} |
970 |
|
|
|
971 |
|
✗ |
s->max = (1 << s->draw.desc->comp[0].depth); |
972 |
|
✗ |
size = hypot(inlink->w, inlink->h); |
973 |
|
|
|
974 |
|
✗ |
s->values = av_calloc(size, sizeof(*s->values)); |
975 |
|
✗ |
if (!s->values) |
976 |
|
✗ |
return AVERROR(ENOMEM); |
977 |
|
|
|
978 |
|
✗ |
update_oscilloscope(inlink->dst); |
979 |
|
|
|
980 |
|
✗ |
return 0; |
981 |
|
|
} |
982 |
|
|
|
983 |
|
✗ |
static void draw_scope(OscilloscopeContext *s, int x0, int y0, int x1, int y1, |
984 |
|
|
AVFrame *out, PixelValues *p, int state) |
985 |
|
|
{ |
986 |
|
✗ |
int dx = FFABS(x1 - x0), sx = x0 < x1 ? 1 : -1; |
987 |
|
✗ |
int dy = FFABS(y1 - y0), sy = y0 < y1 ? 1 : -1; |
988 |
|
✗ |
int err = (dx > dy ? dx : -dy) / 2, e2; |
989 |
|
|
|
990 |
|
|
for (;;) { |
991 |
|
✗ |
if (x0 >= 0 && y0 >= 0 && x0 < out->width && y0 < out->height) { |
992 |
|
✗ |
FFDrawColor color = { { 0 } }; |
993 |
|
✗ |
int value[4] = { 0 }; |
994 |
|
|
|
995 |
|
✗ |
s->pick_color(&s->draw, &color, out, x0, y0, value); |
996 |
|
✗ |
s->values[s->nb_values].p[0] = value[0]; |
997 |
|
✗ |
s->values[s->nb_values].p[1] = value[1]; |
998 |
|
✗ |
s->values[s->nb_values].p[2] = value[2]; |
999 |
|
✗ |
s->values[s->nb_values].p[3] = value[3]; |
1000 |
|
✗ |
s->nb_values++; |
1001 |
|
|
|
1002 |
|
✗ |
if (s->scope) { |
1003 |
|
✗ |
if (s->draw.desc->comp[0].depth == 8) { |
1004 |
|
✗ |
if (s->draw.nb_planes == 1) { |
1005 |
|
|
int i; |
1006 |
|
|
|
1007 |
|
✗ |
for (i = 0; i < s->nb_comps; i++) |
1008 |
|
✗ |
out->data[0][out->linesize[0] * y0 + x0 * s->draw.pixelstep[0] + i] = 255 * ((s->nb_values + state) & 1); |
1009 |
|
|
} else { |
1010 |
|
✗ |
out->data[0][out->linesize[0] * y0 + x0] = 255 * ((s->nb_values + state) & 1); |
1011 |
|
|
} |
1012 |
|
|
} else { |
1013 |
|
✗ |
if (s->draw.nb_planes == 1) { |
1014 |
|
|
int i; |
1015 |
|
|
|
1016 |
|
✗ |
for (i = 0; i < s->nb_comps; i++) |
1017 |
|
✗ |
AV_WN16(out->data[0] + out->linesize[0] * y0 + x0 * s->draw.pixelstep[0] + i, (s->max - 1) * ((s->nb_values + state) & 1)); |
1018 |
|
|
} else { |
1019 |
|
✗ |
AV_WN16(out->data[0] + out->linesize[0] * y0 + 2 * x0, (s->max - 1) * ((s->nb_values + state) & 1)); |
1020 |
|
|
} |
1021 |
|
|
} |
1022 |
|
|
} |
1023 |
|
|
} |
1024 |
|
|
|
1025 |
|
✗ |
if (x0 == x1 && y0 == y1) |
1026 |
|
✗ |
break; |
1027 |
|
|
|
1028 |
|
✗ |
e2 = err; |
1029 |
|
|
|
1030 |
|
✗ |
if (e2 >-dx) { |
1031 |
|
✗ |
err -= dy; |
1032 |
|
✗ |
x0 += sx; |
1033 |
|
|
} |
1034 |
|
|
|
1035 |
|
✗ |
if (e2 < dy) { |
1036 |
|
✗ |
err += dx; |
1037 |
|
✗ |
y0 += sy; |
1038 |
|
|
} |
1039 |
|
|
} |
1040 |
|
✗ |
} |
1041 |
|
|
|
1042 |
|
✗ |
static int oscilloscope_filter_frame(AVFilterLink *inlink, AVFrame *frame) |
1043 |
|
|
{ |
1044 |
|
✗ |
FilterLink *inl = ff_filter_link(inlink); |
1045 |
|
✗ |
AVFilterContext *ctx = inlink->dst; |
1046 |
|
✗ |
OscilloscopeContext *s = ctx->priv; |
1047 |
|
✗ |
AVFilterLink *outlink = ctx->outputs[0]; |
1048 |
|
✗ |
float average[4] = { 0 }; |
1049 |
|
✗ |
int max[4] = { 0 }; |
1050 |
|
✗ |
int min[4] = { INT_MAX, INT_MAX, INT_MAX, INT_MAX }; |
1051 |
|
|
int i, c; |
1052 |
|
|
|
1053 |
|
✗ |
s->nb_values = 0; |
1054 |
|
✗ |
draw_scope(s, s->x1, s->y1, s->x2, s->y2, frame, s->values, inl->frame_count_in & 1); |
1055 |
|
✗ |
ff_blend_rectangle(&s->draw, &s->dark, frame->data, frame->linesize, |
1056 |
|
|
frame->width, frame->height, |
1057 |
|
✗ |
s->ox, s->oy, s->width, s->height + 20 * s->statistics); |
1058 |
|
|
|
1059 |
|
✗ |
if (s->grid && outlink->h >= 10) { |
1060 |
|
✗ |
ff_fill_rectangle(&s->draw, &s->gray, frame->data, frame->linesize, |
1061 |
|
✗ |
s->ox, s->oy, s->width - 1, 1); |
1062 |
|
|
|
1063 |
|
✗ |
for (i = 1; i < 5; i++) { |
1064 |
|
✗ |
ff_fill_rectangle(&s->draw, &s->gray, frame->data, frame->linesize, |
1065 |
|
✗ |
s->ox, s->oy + i * (s->height - 1) / 4, s->width, 1); |
1066 |
|
|
} |
1067 |
|
|
|
1068 |
|
✗ |
for (i = 0; i < 10; i++) { |
1069 |
|
✗ |
ff_fill_rectangle(&s->draw, &s->gray, frame->data, frame->linesize, |
1070 |
|
✗ |
s->ox + i * (s->width - 1) / 10, s->oy, 1, s->height); |
1071 |
|
|
} |
1072 |
|
|
|
1073 |
|
✗ |
ff_fill_rectangle(&s->draw, &s->gray, frame->data, frame->linesize, |
1074 |
|
✗ |
s->ox + s->width - 1, s->oy, 1, s->height); |
1075 |
|
|
} |
1076 |
|
|
|
1077 |
|
✗ |
s->draw_trace(s, frame); |
1078 |
|
|
|
1079 |
|
✗ |
for (i = 0; i < s->nb_values; i++) { |
1080 |
|
✗ |
for (c = 0; c < s->nb_comps; c++) { |
1081 |
|
✗ |
if ((1 << c) & s->components) { |
1082 |
|
✗ |
max[c] = FFMAX(max[c], s->values[i].p[s->rgba_map[c]]); |
1083 |
|
✗ |
min[c] = FFMIN(min[c], s->values[i].p[s->rgba_map[c]]); |
1084 |
|
✗ |
average[c] += s->values[i].p[s->rgba_map[c]]; |
1085 |
|
|
} |
1086 |
|
|
} |
1087 |
|
|
} |
1088 |
|
✗ |
for (c = 0; c < s->nb_comps; c++) { |
1089 |
|
✗ |
average[c] /= s->nb_values; |
1090 |
|
|
} |
1091 |
|
|
|
1092 |
|
✗ |
if (s->statistics && s->height > 10 && s->width > 280 * av_popcount(s->components)) { |
1093 |
|
✗ |
for (c = 0, i = 0; c < s->nb_comps; c++) { |
1094 |
|
✗ |
if ((1 << c) & s->components) { |
1095 |
|
✗ |
const char rgba[4] = { 'R', 'G', 'B', 'A' }; |
1096 |
|
✗ |
const char yuva[4] = { 'Y', 'U', 'V', 'A' }; |
1097 |
|
|
char text[128]; |
1098 |
|
|
|
1099 |
|
✗ |
snprintf(text, sizeof(text), "%c avg:%.1f min:%d max:%d\n", s->is_rgb ? rgba[c] : yuva[c], average[c], min[c], max[c]); |
1100 |
|
✗ |
draw_text(&s->draw, frame, &s->white, s->ox + 2 + 280 * i++, s->oy + s->height + 4, text, 0); |
1101 |
|
|
} |
1102 |
|
|
} |
1103 |
|
|
} |
1104 |
|
|
|
1105 |
|
✗ |
return ff_filter_frame(outlink, frame); |
1106 |
|
|
} |
1107 |
|
|
|
1108 |
|
✗ |
static int oscilloscope_process_command(AVFilterContext *ctx, const char *cmd, const char *args, |
1109 |
|
|
char *res, int res_len, int flags) |
1110 |
|
|
{ |
1111 |
|
|
int ret; |
1112 |
|
|
|
1113 |
|
✗ |
ret = ff_filter_process_command(ctx, cmd, args, res, res_len, flags); |
1114 |
|
✗ |
if (ret < 0) |
1115 |
|
✗ |
return ret; |
1116 |
|
|
|
1117 |
|
✗ |
update_oscilloscope(ctx); |
1118 |
|
|
|
1119 |
|
✗ |
return 0; |
1120 |
|
|
} |
1121 |
|
|
|
1122 |
|
|
static const AVFilterPad oscilloscope_inputs[] = { |
1123 |
|
|
{ |
1124 |
|
|
.name = "default", |
1125 |
|
|
.type = AVMEDIA_TYPE_VIDEO, |
1126 |
|
|
.flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, |
1127 |
|
|
.filter_frame = oscilloscope_filter_frame, |
1128 |
|
|
.config_props = oscilloscope_config_input, |
1129 |
|
|
}, |
1130 |
|
|
}; |
1131 |
|
|
|
1132 |
|
|
const AVFilter ff_vf_oscilloscope = { |
1133 |
|
|
.name = "oscilloscope", |
1134 |
|
|
.description = NULL_IF_CONFIG_SMALL("2D Video Oscilloscope."), |
1135 |
|
|
.priv_size = sizeof(OscilloscopeContext), |
1136 |
|
|
.priv_class = &oscilloscope_class, |
1137 |
|
|
.uninit = oscilloscope_uninit, |
1138 |
|
|
FILTER_INPUTS(oscilloscope_inputs), |
1139 |
|
|
FILTER_OUTPUTS(ff_video_default_filterpad), |
1140 |
|
|
FILTER_QUERY_FUNC2(query_formats), |
1141 |
|
|
.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, |
1142 |
|
|
.process_command = oscilloscope_process_command, |
1143 |
|
|
}; |
1144 |
|
|
|