FFmpeg
Loading...
Searching...
No Matches
vf_extractplanes.c
Go to the documentation of this file.
1/*
2 * Copyright (c) 2013 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 "config_components.h"
22
23#include "libavutil/avstring.h"
24#include "libavutil/imgutils.h"
25#include "libavutil/opt.h"
26#include "libavutil/pixdesc.h"
27
28#include "avfilter.h"
29#include "drawutils.h"
30#include "filters.h"
31#include "formats.h"
32#include "video.h"
33
34#define PLANE_R 0x01
35#define PLANE_G 0x02
36#define PLANE_B 0x04
37#define PLANE_A 0x08
38#define PLANE_Y 0x10
39#define PLANE_U 0x20
40#define PLANE_V 0x40
41
42typedef struct ExtractPlanesContext {
43 const AVClass *class;
45 int map[4];
46 int linesize[4];
48 int depth;
49 int step;
51
52#define OFFSET(x) offsetof(ExtractPlanesContext, x)
53#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
55 { "planes", "set planes", OFFSET(requested_planes), AV_OPT_TYPE_FLAGS, {.i64=1}, 1, 0xff, FLAGS, .unit = "flags"},
56 { "y", "set luma plane", 0, AV_OPT_TYPE_CONST, {.i64=PLANE_Y}, 0, 0, FLAGS, .unit = "flags"},
57 { "u", "set u plane", 0, AV_OPT_TYPE_CONST, {.i64=PLANE_U}, 0, 0, FLAGS, .unit = "flags"},
58 { "v", "set v plane", 0, AV_OPT_TYPE_CONST, {.i64=PLANE_V}, 0, 0, FLAGS, .unit = "flags"},
59 { "r", "set red plane", 0, AV_OPT_TYPE_CONST, {.i64=PLANE_R}, 0, 0, FLAGS, .unit = "flags"},
60 { "g", "set green plane", 0, AV_OPT_TYPE_CONST, {.i64=PLANE_G}, 0, 0, FLAGS, .unit = "flags"},
61 { "b", "set blue plane", 0, AV_OPT_TYPE_CONST, {.i64=PLANE_B}, 0, 0, FLAGS, .unit = "flags"},
62 { "a", "set alpha plane", 0, AV_OPT_TYPE_CONST, {.i64=PLANE_A}, 0, 0, FLAGS, .unit = "flags"},
63 { NULL }
64};
65
66AVFILTER_DEFINE_CLASS(extractplanes);
67
68#define EIGHTBIT_FORMATS \
69 AV_PIX_FMT_YUV410P, \
70 AV_PIX_FMT_YUV411P, \
71 AV_PIX_FMT_YUV440P, \
72 AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUVA420P, \
73 AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUVA422P, \
74 AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, \
75 AV_PIX_FMT_YUVJ440P, AV_PIX_FMT_YUVJ444P, \
76 AV_PIX_FMT_YUVJ411P, \
77 AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUVA444P, \
78 AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY8A, \
79 AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24, \
80 AV_PIX_FMT_RGBA, AV_PIX_FMT_BGRA, \
81 AV_PIX_FMT_ARGB, AV_PIX_FMT_ABGR, \
82 AV_PIX_FMT_RGB0, AV_PIX_FMT_BGR0, \
83 AV_PIX_FMT_0RGB, AV_PIX_FMT_0BGR, \
84 AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRAP
85
86#define HIGHDEPTH_FORMATS(suf) \
87 AV_PIX_FMT_YA16##suf, \
88 AV_PIX_FMT_GRAY9##suf, \
89 AV_PIX_FMT_GRAY10##suf, \
90 AV_PIX_FMT_GRAY12##suf, \
91 AV_PIX_FMT_GRAY14##suf, \
92 AV_PIX_FMT_GRAY16##suf, \
93 AV_PIX_FMT_YUV420P16##suf, AV_PIX_FMT_YUVA420P16##suf, \
94 AV_PIX_FMT_YUV422P16##suf, AV_PIX_FMT_YUVA422P16##suf, \
95 AV_PIX_FMT_YUV444P16##suf, AV_PIX_FMT_YUVA444P16##suf, \
96 AV_PIX_FMT_RGB48##suf, AV_PIX_FMT_BGR48##suf, \
97 AV_PIX_FMT_RGBA64##suf, AV_PIX_FMT_BGRA64##suf, \
98 AV_PIX_FMT_GBRP16##suf, AV_PIX_FMT_GBRAP16##suf, \
99 AV_PIX_FMT_YUV420P10##suf, \
100 AV_PIX_FMT_YUV422P10##suf, \
101 AV_PIX_FMT_YUV444P10##suf, \
102 AV_PIX_FMT_YUV440P10##suf, \
103 AV_PIX_FMT_YUVA420P10##suf, \
104 AV_PIX_FMT_YUVA422P10##suf, \
105 AV_PIX_FMT_YUVA444P10##suf, \
106 AV_PIX_FMT_YUV420P12##suf, \
107 AV_PIX_FMT_YUV422P12##suf, \
108 AV_PIX_FMT_YUV444P12##suf, \
109 AV_PIX_FMT_YUV440P12##suf, \
110 AV_PIX_FMT_YUVA422P12##suf, \
111 AV_PIX_FMT_YUVA444P12##suf, \
112 AV_PIX_FMT_GBRP10##suf, AV_PIX_FMT_GBRAP10##suf, \
113 AV_PIX_FMT_GBRP12##suf, AV_PIX_FMT_GBRAP12##suf, \
114 AV_PIX_FMT_YUV420P9##suf, \
115 AV_PIX_FMT_YUV422P9##suf, \
116 AV_PIX_FMT_YUV444P9##suf, \
117 AV_PIX_FMT_YUVA420P9##suf, \
118 AV_PIX_FMT_YUVA422P9##suf, \
119 AV_PIX_FMT_YUVA444P9##suf, \
120 AV_PIX_FMT_GBRP9##suf, \
121 AV_PIX_FMT_GBRP14##suf, AV_PIX_FMT_GBRAP14##suf, \
122 AV_PIX_FMT_YUV420P14##suf, \
123 AV_PIX_FMT_YUV422P14##suf, \
124 AV_PIX_FMT_YUV444P14##suf
125
126#define FLOAT_FORMATS(suf) \
127 AV_PIX_FMT_GRAYF32##suf, \
128 AV_PIX_FMT_RGBF32##suf, AV_PIX_FMT_RGBAF32##suf, \
129 AV_PIX_FMT_GBRPF32##suf, AV_PIX_FMT_GBRAPF32##suf \
130
132{
133 static const enum AVPixelFormat in_pixfmts_le[] = {
136 FLOAT_FORMATS(LE),
138 };
139 static const enum AVPixelFormat in_pixfmts_be[] = {
142 FLOAT_FORMATS(BE),
144 };
145 static const enum AVPixelFormat out8_pixfmts[] = { AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE };
146 static const enum AVPixelFormat out9le_pixfmts[] = { AV_PIX_FMT_GRAY9LE, AV_PIX_FMT_NONE };
147 static const enum AVPixelFormat out9be_pixfmts[] = { AV_PIX_FMT_GRAY9BE, AV_PIX_FMT_NONE };
148 static const enum AVPixelFormat out10le_pixfmts[] = { AV_PIX_FMT_GRAY10LE, AV_PIX_FMT_NONE };
149 static const enum AVPixelFormat out10be_pixfmts[] = { AV_PIX_FMT_GRAY10BE, AV_PIX_FMT_NONE };
150 static const enum AVPixelFormat out12le_pixfmts[] = { AV_PIX_FMT_GRAY12LE, AV_PIX_FMT_NONE };
151 static const enum AVPixelFormat out12be_pixfmts[] = { AV_PIX_FMT_GRAY12BE, AV_PIX_FMT_NONE };
152 static const enum AVPixelFormat out14le_pixfmts[] = { AV_PIX_FMT_GRAY14LE, AV_PIX_FMT_NONE };
153 static const enum AVPixelFormat out14be_pixfmts[] = { AV_PIX_FMT_GRAY14BE, AV_PIX_FMT_NONE };
154 static const enum AVPixelFormat out16le_pixfmts[] = { AV_PIX_FMT_GRAY16LE, AV_PIX_FMT_NONE };
155 static const enum AVPixelFormat out16be_pixfmts[] = { AV_PIX_FMT_GRAY16BE, AV_PIX_FMT_NONE };
156 static const enum AVPixelFormat out32le_pixfmts[] = { AV_PIX_FMT_GRAYF32LE, AV_PIX_FMT_NONE };
157 static const enum AVPixelFormat out32be_pixfmts[] = { AV_PIX_FMT_GRAYF32BE, AV_PIX_FMT_NONE };
158 const enum AVPixelFormat *out_pixfmts, *in_pixfmts;
160 AVFilterFormats *avff;
161 int i, ret, depth = 0, be = 0;
162
163 if (!ctx->inputs[0]->incfg.formats ||
164 !ctx->inputs[0]->incfg.formats->nb_formats) {
165 return AVERROR(EAGAIN);
166 }
167
168 avff = ctx->inputs[0]->incfg.formats;
169 desc = av_pix_fmt_desc_get(avff->formats[0]);
170 depth = desc->comp[0].depth;
171 be = desc->flags & AV_PIX_FMT_FLAG_BE;
172 if (be) {
173 in_pixfmts = in_pixfmts_be;
174 } else {
175 in_pixfmts = in_pixfmts_le;
176 }
177 if (!ctx->inputs[0]->outcfg.formats)
178 if ((ret = ff_formats_ref(ff_make_pixel_format_list(in_pixfmts), &ctx->inputs[0]->outcfg.formats)) < 0)
179 return ret;
180
181 for (i = 1; i < avff->nb_formats; i++) {
183 if (depth != desc->comp[0].depth ||
184 be != (desc->flags & AV_PIX_FMT_FLAG_BE)) {
185 return AVERROR(EAGAIN);
186 }
187 }
188
189 if (depth == 8)
190 out_pixfmts = out8_pixfmts;
191 else if (!be && depth == 9)
192 out_pixfmts = out9le_pixfmts;
193 else if (be && depth == 9)
194 out_pixfmts = out9be_pixfmts;
195 else if (!be && depth == 10)
196 out_pixfmts = out10le_pixfmts;
197 else if (be && depth == 10)
198 out_pixfmts = out10be_pixfmts;
199 else if (!be && depth == 12)
200 out_pixfmts = out12le_pixfmts;
201 else if (be && depth == 12)
202 out_pixfmts = out12be_pixfmts;
203 else if (!be && depth == 14)
204 out_pixfmts = out14le_pixfmts;
205 else if (be && depth == 14)
206 out_pixfmts = out14be_pixfmts;
207 else if (be && depth == 16)
208 out_pixfmts = out16be_pixfmts;
209 else if (!be && depth == 16)
210 out_pixfmts = out16le_pixfmts;
211 else if (be && depth == 32)
212 out_pixfmts = out32be_pixfmts;
213 else
214 out_pixfmts = out32le_pixfmts;
215
216 /* Splitting planes apart only makes sense for straight alpha */
217 if ((ret = ff_formats_ref(ff_make_formats_list_singleton(AVALPHA_MODE_STRAIGHT), &ctx->inputs[0]->outcfg.alpha_modes)) < 0)
218 return ret;
219
220 for (i = 0; i < ctx->nb_outputs; i++)
221 if ((ret = ff_formats_ref(ff_make_pixel_format_list(out_pixfmts), &ctx->outputs[i]->incfg.formats)) < 0)
222 return ret;
223 return 0;
224}
225
226static int config_input(AVFilterLink *inlink)
227{
228 AVFilterContext *ctx = inlink->dst;
229 ExtractPlanesContext *s = ctx->priv;
231 int plane_avail, ret, i;
232 uint8_t rgba_map[4];
233
234 plane_avail = ((desc->flags & AV_PIX_FMT_FLAG_RGB) ? PLANE_R|PLANE_G|PLANE_B :
235 PLANE_Y |
236 ((desc->nb_components > 2) ? PLANE_U|PLANE_V : 0)) |
237 ((desc->flags & AV_PIX_FMT_FLAG_ALPHA) ? PLANE_A : 0);
238 if (s->requested_planes & ~plane_avail) {
239 av_log(ctx, AV_LOG_ERROR, "Requested planes not available.\n");
240 return AVERROR(EINVAL);
241 }
242 if ((ret = av_image_fill_linesizes(s->linesize, inlink->format, inlink->w)) < 0)
243 return ret;
244
245 s->depth = desc->comp[0].depth >> 3;
246 s->step = av_get_padded_bits_per_pixel(desc) >> 3;
247 s->is_packed = !(desc->flags & AV_PIX_FMT_FLAG_PLANAR) &&
248 (desc->nb_components > 1);
249 if (desc->flags & AV_PIX_FMT_FLAG_RGB) {
250 ff_fill_rgba_map(rgba_map, inlink->format);
251 for (i = 0; i < 4; i++)
252 s->map[i] = rgba_map[s->map[i]];
253 }
254
255 return 0;
256}
257
258static int config_output(AVFilterLink *outlink)
259{
260 AVFilterContext *ctx = outlink->src;
261 AVFilterLink *inlink = ctx->inputs[0];
262 ExtractPlanesContext *s = ctx->priv;
264 const int output = outlink->srcpad - ctx->output_pads;
265
266 if (s->map[output] == 1 || s->map[output] == 2) {
267 outlink->h = AV_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
268 outlink->w = AV_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w);
269 }
270
271 return 0;
272}
273
274static void extract_from_packed(uint8_t *dst, int dst_linesize,
275 const uint8_t *src, int src_linesize,
276 int width, int height,
277 int depth, int step, int comp)
278{
279 int x, y;
280
281 for (y = 0; y < height; y++) {
282 switch (depth) {
283 case 1:
284 for (x = 0; x < width; x++)
285 dst[x] = src[x * step + comp];
286 break;
287 case 2:
288 for (x = 0; x < width; x++) {
289 dst[x * 2 ] = src[x * step + comp * 2 ];
290 dst[x * 2 + 1] = src[x * step + comp * 2 + 1];
291 }
292 break;
293 case 4:
294 for (x = 0; x < width; x++) {
295 dst[x * 4 ] = src[x * step + comp * 4 ];
296 dst[x * 4 + 1] = src[x * step + comp * 4 + 1];
297 dst[x * 4 + 2] = src[x * step + comp * 4 + 2];
298 dst[x * 4 + 3] = src[x * step + comp * 4 + 3];
299 }
300 break;
301 }
302 dst += dst_linesize;
303 src += src_linesize;
304 }
305}
306
308{
309 AVFilterContext *ctx = outlink->src;
310 ExtractPlanesContext *s = ctx->priv;
311 const int idx = s->map[FF_OUTLINK_IDX(outlink)];
312 AVFrame *out;
313
314 out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
315 if (!out)
316 return AVERROR(ENOMEM);
318 if (idx == 3 /* alpha */)
319 out->color_range = AVCOL_RANGE_JPEG;
320
321 if (s->is_packed) {
322 extract_from_packed(out->data[0], out->linesize[0],
323 frame->data[0], frame->linesize[0],
324 outlink->w, outlink->h,
325 s->depth,
326 s->step, idx);
327 } else {
328 av_image_copy_plane(out->data[0], out->linesize[0],
329 frame->data[idx], frame->linesize[idx],
330 s->linesize[idx], outlink->h);
331 }
332
333 return ff_filter_frame(outlink, out);
334}
335
337{
338 AVFilterLink *inlink = ctx->inputs[0];
339 int status, ret;
340 AVFrame *in;
341 int64_t pts;
342
343 for (int i = 0; i < ctx->nb_outputs; i++) {
345 }
346
347 ret = ff_inlink_consume_frame(inlink, &in);
348 if (ret < 0)
349 return ret;
350 if (ret > 0) {
351 for (int i = 0; i < ctx->nb_outputs; i++) {
352 if (ff_outlink_get_status(ctx->outputs[i]))
353 continue;
354
355 ret = extract_plane(ctx->outputs[i], in);
356 if (ret < 0)
357 break;
358 }
359
360 av_frame_free(&in);
361 if (ret < 0)
362 return ret;
363 }
364
365 if (ff_inlink_acknowledge_status(inlink, &status, &pts)) {
366 for (int i = 0; i < ctx->nb_outputs; i++) {
367 if (ff_outlink_get_status(ctx->outputs[i]))
368 continue;
369 ff_outlink_set_status(ctx->outputs[i], status, pts);
370 }
371 return 0;
372 }
373
375
376 return FFERROR_NOT_READY;
377}
378
380{
381 ExtractPlanesContext *s = ctx->priv;
382 int planes = (s->requested_planes & 0xf) | (s->requested_planes >> 4);
383 int i, ret;
384
385 for (i = 0; i < 4; i++) {
386 char *name;
387 AVFilterPad pad = { 0 };
388
389 if (!(planes & (1 << i)))
390 continue;
391
392 name = av_asprintf("out%d", ctx->nb_outputs);
393 if (!name)
394 return AVERROR(ENOMEM);
395 s->map[ctx->nb_outputs] = i;
396 pad.name = name;
399
400 if ((ret = ff_append_outpad_free_name(ctx, &pad)) < 0)
401 return ret;
402 }
403
404 return 0;
405}
406
408 {
409 .name = "default",
410 .type = AVMEDIA_TYPE_VIDEO,
411 .config_props = config_input,
412 },
413};
414
416 .p.name = "extractplanes",
417 .p.description = NULL_IF_CONFIG_SMALL("Extract planes as grayscale frames."),
418 .p.priv_class = &extractplanes_class,
419 .p.outputs = NULL,
421 .priv_size = sizeof(ExtractPlanesContext),
422 .init = init,
426};
427
428#if CONFIG_ALPHAEXTRACT_FILTER
429
430static av_cold int init_alphaextract(AVFilterContext *ctx)
431{
432 ExtractPlanesContext *s = ctx->priv;
433
434 s->requested_planes = PLANE_A;
435 s->map[0] = 3;
436
437 return 0;
438}
439
440static const AVFilterPad alphaextract_outputs[] = {
441 {
442 .name = "default",
443 .type = AVMEDIA_TYPE_VIDEO,
444 .config_props = config_output,
445 },
446};
447
449 .p.name = "alphaextract",
450 .p.description = NULL_IF_CONFIG_SMALL("Extract an alpha channel as a "
451 "grayscale image component."),
452 .priv_size = sizeof(ExtractPlanesContext),
453 .init = init_alphaextract,
456 FILTER_OUTPUTS(alphaextract_outputs),
458};
459#endif /* CONFIG_ALPHAEXTRACT_FILTER */
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition dsp.h:87
static int query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
Definition aeval.c:246
static int config_input(AVFilterLink *inlink)
const FFFilter ff_vf_alphaextract
const FFFilter ff_vf_extractplanes
int ff_outlink_get_status(AVFilterLink *link)
Get the status on an output link.
Definition avfilter.c:1648
int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts)
Test and acknowledge the change of status on the link.
Definition avfilter.c:1467
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition avfilter.c:1068
int ff_append_outpad_free_name(AVFilterContext *f, AVFilterPad *p)
Definition avfilter.c:143
int ff_inlink_consume_frame(AVFilterLink *link, AVFrame **rframe)
Take a frame from the link's FIFO and update the link's stats.
Definition avfilter.c:1520
Main libavfilter public API header.
char * av_asprintf(const char *fmt,...)
Definition avstring.c:115
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
#define s(width, name)
Definition cbs_vp9.c:198
#define FLAGS
Definition cmdutils.c:598
#define AV_CEIL_RSHIFT(a, b)
Definition common.h:60
#define NULL
Definition coverity.c:32
long long int64_t
Definition coverity.c:34
static AVFrame * frame
int ff_fill_rgba_map(uint8_t *rgba_map, enum AVPixelFormat pix_fmt)
Definition drawutils.c:80
misc drawing utilities
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
static void comp(unsigned char *dst, ptrdiff_t dst_stride, unsigned char *src, ptrdiff_t src_stride, int add)
Definition eamad.c:79
int ff_formats_ref(AVFilterFormats *f, AVFilterFormats **ref)
Add ref as a new reference to formats.
Definition formats.c:756
AVFilterFormats * ff_make_formats_list_singleton(int fmt)
Equivalent to ff_make_format_list({const int[]}{ fmt, -1 })
Definition formats.c:596
av_warn_unused_result AVFilterFormats * ff_make_pixel_format_list(const enum AVPixelFormat *fmts)
Create a list of supported pixel formats.
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition opt.h:298
@ AV_OPT_TYPE_FLAGS
Underlying C type is unsigned int.
Definition opt.h:254
#define AVFILTER_FLAG_DYNAMIC_OUTPUTS
The number of the filter outputs is not determined just by AVFilter.outputs.
Definition avfilter.h:161
#define AVERROR(e)
Definition error.h:45
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition frame.c:64
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
Definition frame.c:599
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition log.h:210
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
void av_image_copy_plane(uint8_t *dst, int dst_linesize, const uint8_t *src, int src_linesize, int bytewidth, int height)
Copy image plane from src to dst.
Definition imgutils.c:374
int av_image_fill_linesizes(int linesizes[4], enum AVPixelFormat pix_fmt, int width)
Fill plane linesizes for an image with pixel format pix_fmt and width width.
Definition imgutils.c:89
misc image utilities
static int activate(AVBitStreamFilterContext *ctx)
static int config_output(AVBitStreamFilterLink *outlink)
#define FILTER_INPUTS(array)
Definition filters.h:264
#define FILTER_OUTPUTS(array)
Definition filters.h:265
#define FF_FILTER_FORWARD_WANTED_ANY(filter, inlink)
Forward the frame_wanted_out flag from any of the output links to an input link.
Definition filters.h:705
#define FILTER_QUERY_FUNC(func)
Definition filters.h:238
static void ff_outlink_set_status(AVFilterLink *link, int status, int64_t pts)
Set the status field of a link from the source filter.
Definition filters.h:629
#define FFERROR_NOT_READY
Filters implementation helper functions and internal structures.
Definition filters.h:34
#define FF_FILTER_FORWARD_STATUS_BACK_ALL(outlink, filter)
Forward the status on an output link to all input links.
Definition filters.h:652
#define AVFILTER_DEFINE_CLASS(fname)
Definition filters.h:478
#define FF_OUTLINK_IDX(link)
Definition filters.h:216
#define av_cold
Definition attributes.h:117
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition internal.h:88
const char * desc
Definition libsvtav1.c:83
static const struct @257111027162314367033347246032313251342043035002 planes[]
AVOptions.
int av_get_padded_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
Return the number of bits per pixel for the pixel format described by pixdesc, including any padding ...
Definition pixdesc.c:3425
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition pixdesc.c:3460
#define AV_PIX_FMT_FLAG_ALPHA
The pixel format has an alpha channel.
Definition pixdesc.h:147
#define AV_PIX_FMT_FLAG_RGB
The pixel format contains RGB-like data (as opposed to YUV/grayscale).
Definition pixdesc.h:136
#define AV_PIX_FMT_FLAG_PLANAR
At least one pixel component is not in the first data plane.
Definition pixdesc.h:132
#define AV_PIX_FMT_FLAG_BE
Pixel format is big-endian.
Definition pixdesc.h:116
@ AVCOL_RANGE_JPEG
Full range content.
Definition pixfmt.h:783
@ AVALPHA_MODE_STRAIGHT
Alpha channel is independent of color values.
Definition pixfmt.h:819
AVPixelFormat
Pixel format.
Definition pixfmt.h:71
@ AV_PIX_FMT_GRAY16BE
Y , 16bpp, big-endian.
Definition pixfmt.h:104
@ AV_PIX_FMT_NONE
Definition pixfmt.h:72
@ AV_PIX_FMT_GRAY10LE
Y , 10bpp, little-endian.
Definition pixfmt.h:321
@ AV_PIX_FMT_GRAYF32LE
IEEE-754 single precision Y, 32bpp, little-endian.
Definition pixfmt.h:364
@ AV_PIX_FMT_GRAY12LE
Y , 12bpp, little-endian.
Definition pixfmt.h:319
@ AV_PIX_FMT_GRAY12BE
Y , 12bpp, big-endian.
Definition pixfmt.h:318
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition pixfmt.h:81
@ AV_PIX_FMT_GRAY14LE
Y , 14bpp, little-endian.
Definition pixfmt.h:361
@ AV_PIX_FMT_GRAY9BE
Y , 9bpp, big-endian.
Definition pixfmt.h:338
@ AV_PIX_FMT_GRAYF32BE
IEEE-754 single precision Y, 32bpp, big-endian.
Definition pixfmt.h:363
@ AV_PIX_FMT_GRAY16LE
Y , 16bpp, little-endian.
Definition pixfmt.h:105
@ AV_PIX_FMT_GRAY9LE
Y , 9bpp, little-endian.
Definition pixfmt.h:339
@ AV_PIX_FMT_GRAY10BE
Y , 10bpp, big-endian.
Definition pixfmt.h:320
@ AV_PIX_FMT_GRAY14BE
Y , 14bpp, big-endian.
Definition pixfmt.h:360
const char * name
Definition qsvenc.c:142
Describe the class of an AVClass context structure.
Definition log.h:76
An instance of a filter.
Definition avfilter.h:273
A list of supported formats for one end of a filter link.
Definition formats.h:64
int * formats
list of media formats
Definition formats.h:66
unsigned nb_formats
number of formats
Definition formats.h:65
A filter pad used for either input or output.
Definition filters.h:40
int(* config_props)(AVFilterLink *link)
Link configuration callback.
Definition filters.h:120
enum AVMediaType type
AVFilterPad type.
Definition filters.h:51
const char * name
Pad name.
Definition filters.h:46
This structure describes decoded (raw) audio or video data.
Definition frame.h:472
AVOption.
Definition opt.h:428
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition pixdesc.h:69
#define av_log(a,...)
#define src
Definition vp8dsp.c:248
static FILE * out
Definition movenc.c:55
static AVFormatContext * ctx
Definition movenc.c:49
#define height
Definition dsp.h:89
#define width
Definition dsp.h:89
static int64_t pts
#define PLANE_B
#define PLANE_R
#define PLANE_Y
#define PLANE_U
#define PLANE_G
#define PLANE_V
#define PLANE_A
static const AVOption extractplanes_options[]
static const AVFilterPad extractplanes_inputs[]
#define HIGHDEPTH_FORMATS(suf)
static int query_formats(AVFilterContext *ctx)
static int config_input(AVFilterLink *inlink)
#define EIGHTBIT_FORMATS
static int extract_plane(AVFilterLink *outlink, AVFrame *frame)
static void extract_from_packed(uint8_t *dst, int dst_linesize, const uint8_t *src, int src_linesize, int width, int height, int depth, int step, int comp)
#define FLOAT_FORMATS(suf)
static int activate(AVFilterContext *ctx)
#define OFFSET(x)
static int config_output(AVFilterLink *outlink)
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
Definition video.c:89