FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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 "libavutil/avstring.h"
22 #include "libavutil/imgutils.h"
23 #include "libavutil/opt.h"
24 #include "libavutil/pixdesc.h"
25 
26 #define FF_INTERNAL_FIELDS 1
27 #include "libavfilter/framequeue.h"
28 
29 #include "avfilter.h"
30 #include "drawutils.h"
31 #include "internal.h"
32 
33 #define PLANE_R 0x01
34 #define PLANE_G 0x02
35 #define PLANE_B 0x04
36 #define PLANE_A 0x08
37 #define PLANE_Y 0x10
38 #define PLANE_U 0x20
39 #define PLANE_V 0x40
40 
41 typedef struct ExtractPlanesContext {
42  const AVClass *class;
44  int map[4];
45  int linesize[4];
46  int is_packed;
47  int depth;
48  int step;
50 
51 #define OFFSET(x) offsetof(ExtractPlanesContext, x)
52 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
53 static const AVOption extractplanes_options[] = {
54  { "planes", "set planes", OFFSET(requested_planes), AV_OPT_TYPE_FLAGS, {.i64=1}, 1, 0xff, FLAGS, "flags"},
55  { "y", "set luma plane", 0, AV_OPT_TYPE_CONST, {.i64=PLANE_Y}, 0, 0, FLAGS, "flags"},
56  { "u", "set u plane", 0, AV_OPT_TYPE_CONST, {.i64=PLANE_U}, 0, 0, FLAGS, "flags"},
57  { "v", "set v plane", 0, AV_OPT_TYPE_CONST, {.i64=PLANE_V}, 0, 0, FLAGS, "flags"},
58  { "r", "set red plane", 0, AV_OPT_TYPE_CONST, {.i64=PLANE_R}, 0, 0, FLAGS, "flags"},
59  { "g", "set green plane", 0, AV_OPT_TYPE_CONST, {.i64=PLANE_G}, 0, 0, FLAGS, "flags"},
60  { "b", "set blue plane", 0, AV_OPT_TYPE_CONST, {.i64=PLANE_B}, 0, 0, FLAGS, "flags"},
61  { "a", "set alpha plane", 0, AV_OPT_TYPE_CONST, {.i64=PLANE_A}, 0, 0, FLAGS, "flags"},
62  { NULL }
63 };
64 
65 AVFILTER_DEFINE_CLASS(extractplanes);
66 
68 {
69  static const enum AVPixelFormat in_pixfmts_le[] = {
114  };
115  static const enum AVPixelFormat in_pixfmts_be[] = {
160  };
161  static const enum AVPixelFormat out8_pixfmts[] = { AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE };
162  static const enum AVPixelFormat out9le_pixfmts[] = { AV_PIX_FMT_GRAY9LE, AV_PIX_FMT_NONE };
163  static const enum AVPixelFormat out9be_pixfmts[] = { AV_PIX_FMT_GRAY9BE, AV_PIX_FMT_NONE };
164  static const enum AVPixelFormat out10le_pixfmts[] = { AV_PIX_FMT_GRAY10LE, AV_PIX_FMT_NONE };
165  static const enum AVPixelFormat out10be_pixfmts[] = { AV_PIX_FMT_GRAY10BE, AV_PIX_FMT_NONE };
166  static const enum AVPixelFormat out12le_pixfmts[] = { AV_PIX_FMT_GRAY12LE, AV_PIX_FMT_NONE };
167  static const enum AVPixelFormat out12be_pixfmts[] = { AV_PIX_FMT_GRAY12BE, AV_PIX_FMT_NONE };
168  static const enum AVPixelFormat out16le_pixfmts[] = { AV_PIX_FMT_GRAY16LE, AV_PIX_FMT_NONE };
169  static const enum AVPixelFormat out16be_pixfmts[] = { AV_PIX_FMT_GRAY16BE, AV_PIX_FMT_NONE };
170  const enum AVPixelFormat *out_pixfmts, *in_pixfmts;
171  const AVPixFmtDescriptor *desc;
172  AVFilterFormats *avff;
173  int i, ret, depth = 0, be = 0;
174 
175  if (!ctx->inputs[0]->in_formats ||
176  !ctx->inputs[0]->in_formats->nb_formats) {
177  return AVERROR(EAGAIN);
178  }
179 
180  avff = ctx->inputs[0]->in_formats;
181  desc = av_pix_fmt_desc_get(avff->formats[0]);
182  depth = desc->comp[0].depth;
183  be = desc->flags & AV_PIX_FMT_FLAG_BE;
184  if (be) {
185  in_pixfmts = in_pixfmts_be;
186  } else {
187  in_pixfmts = in_pixfmts_le;
188  }
189  if (!ctx->inputs[0]->out_formats)
190  if ((ret = ff_formats_ref(ff_make_format_list(in_pixfmts), &ctx->inputs[0]->out_formats)) < 0)
191  return ret;
192 
193  for (i = 1; i < avff->nb_formats; i++) {
194  desc = av_pix_fmt_desc_get(avff->formats[i]);
195  if (depth != desc->comp[0].depth ||
196  be != (desc->flags & AV_PIX_FMT_FLAG_BE)) {
197  return AVERROR(EAGAIN);
198  }
199  }
200 
201  if (depth == 8)
202  out_pixfmts = out8_pixfmts;
203  else if (!be && depth == 9)
204  out_pixfmts = out9le_pixfmts;
205  else if (be && depth == 9)
206  out_pixfmts = out9be_pixfmts;
207  else if (!be && depth == 10)
208  out_pixfmts = out10le_pixfmts;
209  else if (be && depth == 10)
210  out_pixfmts = out10be_pixfmts;
211  else if (!be && depth == 12)
212  out_pixfmts = out12le_pixfmts;
213  else if (be && depth == 12)
214  out_pixfmts = out12be_pixfmts;
215  else if (be)
216  out_pixfmts = out16be_pixfmts;
217  else
218  out_pixfmts = out16le_pixfmts;
219 
220  for (i = 0; i < ctx->nb_outputs; i++)
221  if ((ret = ff_formats_ref(ff_make_format_list(out_pixfmts), &ctx->outputs[i]->in_formats)) < 0)
222  return ret;
223  return 0;
224 }
225 
226 static 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 
258 static 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 
274 static 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  }
294  dst += dst_linesize;
295  src += src_linesize;
296  }
297 }
298 
299 static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
300 {
301  AVFilterContext *ctx = inlink->dst;
302  ExtractPlanesContext *s = ctx->priv;
303  int i, eof = 0, ret = 0;
304 
305  for (i = 0; i < ctx->nb_outputs; i++) {
306  AVFilterLink *outlink = ctx->outputs[i];
307  const int idx = s->map[i];
308  AVFrame *out;
309 
310  if (outlink->status_in)
311  continue;
312 
313  out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
314  if (!out) {
315  ret = AVERROR(ENOMEM);
316  break;
317  }
318  av_frame_copy_props(out, frame);
319 
320  if (s->is_packed) {
321  extract_from_packed(out->data[0], out->linesize[0],
322  frame->data[0], frame->linesize[0],
323  outlink->w, outlink->h,
324  s->depth,
325  s->step, idx);
326  } else {
327  av_image_copy_plane(out->data[0], out->linesize[0],
328  frame->data[idx], frame->linesize[idx],
329  s->linesize[idx], outlink->h);
330  }
331 
332  ret = ff_filter_frame(outlink, out);
333  if (ret == AVERROR_EOF)
334  eof++;
335  else if (ret < 0)
336  break;
337  }
338  av_frame_free(&frame);
339 
340  if (eof == ctx->nb_outputs)
341  ret = AVERROR_EOF;
342  else if (ret == AVERROR_EOF)
343  ret = 0;
344  return ret;
345 }
346 
348 {
349  ExtractPlanesContext *s = ctx->priv;
350  int planes = (s->requested_planes & 0xf) | (s->requested_planes >> 4);
351  int i, ret;
352 
353  for (i = 0; i < 4; i++) {
354  char *name;
355  AVFilterPad pad = { 0 };
356 
357  if (!(planes & (1 << i)))
358  continue;
359 
360  name = av_asprintf("out%d", ctx->nb_outputs);
361  if (!name)
362  return AVERROR(ENOMEM);
363  s->map[ctx->nb_outputs] = i;
364  pad.name = name;
365  pad.type = AVMEDIA_TYPE_VIDEO;
367 
368  if ((ret = ff_insert_outpad(ctx, ctx->nb_outputs, &pad)) < 0) {
369  av_freep(&pad.name);
370  return ret;
371  }
372  }
373 
374  return 0;
375 }
376 
378 {
379  int i;
380 
381  for (i = 0; i < ctx->nb_outputs; i++)
382  av_freep(&ctx->output_pads[i].name);
383 }
384 
386  {
387  .name = "default",
388  .type = AVMEDIA_TYPE_VIDEO,
389  .filter_frame = filter_frame,
390  .config_props = config_input,
391  },
392  { NULL }
393 };
394 
396  .name = "extractplanes",
397  .description = NULL_IF_CONFIG_SMALL("Extract planes as grayscale frames."),
398  .priv_size = sizeof(ExtractPlanesContext),
399  .priv_class = &extractplanes_class,
400  .init = init,
401  .uninit = uninit,
403  .inputs = extractplanes_inputs,
404  .outputs = NULL,
406 };
407 
408 #if CONFIG_ALPHAEXTRACT_FILTER
409 
410 static av_cold int init_alphaextract(AVFilterContext *ctx)
411 {
412  ExtractPlanesContext *s = ctx->priv;
413 
415 
416  return init(ctx);
417 }
418 
420  .name = "alphaextract",
421  .description = NULL_IF_CONFIG_SMALL("Extract an alpha channel as a "
422  "grayscale image component."),
423  .priv_size = sizeof(ExtractPlanesContext),
424  .init = init_alphaextract,
425  .uninit = uninit,
427  .inputs = extractplanes_inputs,
428  .outputs = NULL,
430 };
431 #endif /* CONFIG_ALPHAEXTRACT_FILTER */
planar GBR 4:4:4:4 40bpp, little-endian
Definition: pixfmt.h:287
#define NULL
Definition: coverity.c:32
static const AVFilterPad extractplanes_inputs[]
planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition: pixfmt.h:162
#define PLANE_U
planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian
Definition: pixfmt.h:271
const char * s
Definition: avisynth_c.h:768
#define PLANE_A
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2363
This structure describes decoded (raw) audio or video data.
Definition: frame.h:218
AVFILTER_DEFINE_CLASS(extractplanes)
AVOption.
Definition: opt.h:246
planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition: pixfmt.h:155
packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is st...
Definition: pixfmt.h:204
static av_cold void uninit(AVFilterContext *ctx)
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:67
misc image utilities
#define OFFSET(x)
Main libavfilter public API header.
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition: pixfmt.h:64
const char * desc
Definition: nvenc.c:65
planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition: pixfmt.h:158
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition: pixfmt.h:246
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:164
packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is st...
Definition: pixfmt.h:203
planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian)
Definition: pixfmt.h:185
planar GBR 4:4:4 36bpp, little-endian
Definition: pixfmt.h:251
The following 12 formats have the disadvantage of needing 1 format for each bit depth.
Definition: pixfmt.h:152
enum AVMediaType type
AVFilterPad type.
Definition: internal.h:65
packed BGR 8:8:8, 32bpp, XBGRXBGR... X=unused/undefined
Definition: pixfmt.h:235
static int config_input(AVFilterLink *inlink)
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
Definition: video.c:99
#define src
Definition: vp8dsp.c:254
#define FLAGS
Y , 12bpp, little-endian.
Definition: pixfmt.h:292
planar GBR 4:4:4 36bpp, big-endian
Definition: pixfmt.h:250
planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition: pixfmt.h:127
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
Definition: pixdesc.h:92
AVFilterFormats * ff_make_format_list(const int *fmts)
Create a list of supported formats.
Definition: formats.c:283
const char * name
Pad name.
Definition: internal.h:60
planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), little-endian ...
Definition: pixfmt.h:175
AVFilterLink ** inputs
array of pointers to input links
Definition: avfilter.h:346
planar GBRA 4:4:4:4 64bpp, big-endian
Definition: pixfmt.h:212
planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian)
Definition: pixfmt.h:186
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1080
AVFilterPad * output_pads
array of output pads
Definition: avfilter.h:349
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Definition: pixfmt.h:97
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
Definition: pixdesc.h:117
uint8_t
#define av_cold
Definition: attributes.h:82
#define AV_PIX_FMT_FLAG_ALPHA
The pixel format has an alpha channel.
Definition: pixdesc.h:181
packed RGB 8:8:8, 32bpp, RGBXRGBX... X=unused/undefined
Definition: pixfmt.h:234
AVOptions.
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as lit...
Definition: pixfmt.h:99
packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is st...
Definition: pixfmt.h:201
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:247
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
Definition: pixfmt.h:90
static AVFrame * frame
planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian)
Definition: pixfmt.h:187
#define height
planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), big-endian
Definition: pixfmt.h:272
planar GBR 4:4:4 48bpp, big-endian
Definition: pixfmt.h:170
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range...
Definition: pixfmt.h:96
Y , 9bpp, little-endian.
Definition: pixfmt.h:312
static int flags
Definition: log.c:55
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
Definition: pixfmt.h:75
#define AVERROR_EOF
End of file.
Definition: error.h:55
planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian)
Definition: pixfmt.h:190
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)
Y , 10bpp, little-endian.
Definition: pixfmt.h:294
#define AVFILTER_FLAG_DYNAMIC_OUTPUTS
The number of the filter outputs is not determined just by AVFilter.outputs.
Definition: avfilter.h:111
planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), big-endian
Definition: pixfmt.h:274
#define av_log(a,...)
A filter pad used for either input or output.
Definition: internal.h:54
planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition: pixfmt.h:153
planar GBR 4:4:4 27bpp, big-endian
Definition: pixfmt.h:166
planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:161
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
Definition: pixfmt.h:172
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
16 bits gray, 16 bits alpha (big-endian)
Definition: pixfmt.h:208
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
Definition: pixdesc.h:101
static const AVOption extractplanes_options[]
planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition: pixfmt.h:132
#define AVERROR(e)
Definition: error.h:43
#define AV_PIX_FMT_FLAG_RGB
The pixel format contains RGB-like data (as opposed to YUV/grayscale).
Definition: pixdesc.h:148
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:202
unsigned nb_outputs
number of output pads
Definition: avfilter.h:351
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
Definition: pixfmt.h:91
void * priv
private data for use by the filter
Definition: avfilter.h:353
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:2328
static int config_output(AVFilterLink *outlink)
planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), big-endian
Definition: pixfmt.h:178
planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition: pixfmt.h:157
uint16_t width
Definition: gdv.c:47
planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition: pixfmt.h:130
planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), little-endian
Definition: pixfmt.h:179
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
Definition: pixfmt.h:88
packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as lit...
Definition: pixfmt.h:145
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
Definition: pixfmt.h:89
planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian)
Definition: pixfmt.h:180
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:66
char * av_asprintf(const char *fmt,...)
Definition: avstring.c:113
uint64_t flags
Combination of AV_PIX_FMT_FLAG_...
Definition: pixdesc.h:106
AVFilter ff_vf_extractplanes
planar GBR 4:4:4:4 48bpp, big-endian
Definition: pixfmt.h:283
uint8_t nb_components
The number of components each pixel has, (1-4)
Definition: pixdesc.h:83
planar GBR 4:4:4:4 40bpp, big-endian
Definition: pixfmt.h:286
alias for AV_PIX_FMT_YA8
Definition: pixfmt.h:142
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
Definition: pixfmt.h:74
int ff_formats_ref(AVFilterFormats *f, AVFilterFormats **ref)
Add *ref as a new reference to formats.
Definition: formats.c:440
AVFormatContext * ctx
Definition: movenc.c:48
planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian)
Definition: pixfmt.h:184
planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), big-endian
Definition: pixfmt.h:176
unsigned nb_formats
number of formats
Definition: formats.h:65
packed RGB 8:8:8, 24bpp, BGRBGR...
Definition: pixfmt.h:65
planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition: pixfmt.h:239
planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
Definition: pixfmt.h:154
#define PLANE_Y
static const AVFilterPad inputs[]
Definition: af_acontrast.c:193
planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition: pixfmt.h:163
packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as big...
Definition: pixfmt.h:144
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
int ff_fill_rgba_map(uint8_t *rgba_map, enum AVPixelFormat pix_fmt)
Definition: drawutils.c:35
static void comp(unsigned char *dst, ptrdiff_t dst_stride, unsigned char *src, ptrdiff_t src_stride, int add)
Definition: eamad.c:83
planar GBR 4:4:4:4 48bpp, little-endian
Definition: pixfmt.h:284
#define PLANE_V
planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
Definition: pixfmt.h:128
#define PLANE_R
misc drawing utilities
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Definition: frame.h:249
static int query_formats(AVFilterContext *ctx)
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition: pixfmt.h:173
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:81
planar GBR 4:4:4 30bpp, big-endian
Definition: pixfmt.h:168
planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian)
Definition: pixfmt.h:188
planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian
Definition: pixfmt.h:273
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition: pixfmt.h:68
planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian)
Definition: pixfmt.h:189
AVFilter ff_vf_alphaextract
Describe the class of an AVClass context structure.
Definition: log.h:67
Filter definition.
Definition: avfilter.h:144
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
planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian)
Definition: pixfmt.h:191
Y , 16bpp, big-endian.
Definition: pixfmt.h:93
#define PLANE_G
packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
Definition: pixfmt.h:236
const char * name
Filter name.
Definition: avfilter.h:148
Y , 9bpp, big-endian.
Definition: pixfmt.h:311
planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), big-endian
Definition: pixfmt.h:174
AVFilterLink ** outputs
array of pointers to output links
Definition: avfilter.h:350
static av_cold int init(AVFilterContext *ctx)
planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian)
Definition: pixfmt.h:183
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:232
Y , 10bpp, big-endian.
Definition: pixfmt.h:293
planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:159
planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:131
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:62
planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition: pixfmt.h:243
Y , 8bpp.
Definition: pixfmt.h:70
planar GBRA 4:4:4:4 32bpp
Definition: pixfmt.h:211
planar GBR 4:4:4 27bpp, little-endian
Definition: pixfmt.h:167
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big...
Definition: pixfmt.h:98
planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition: pixfmt.h:129
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
Definition: pixfmt.h:76
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition: pixfmt.h:69
static const struct @272 planes[]
planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian)
Definition: pixfmt.h:181
#define AV_PIX_FMT_FLAG_BE
Pixel format is big-endian.
Definition: pixdesc.h:128
Y , 16bpp, little-endian.
Definition: pixfmt.h:94
A list of supported formats for one end of a filter link.
Definition: formats.h:64
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
Definition: pixfmt.h:254
16 bits gray, 16 bits alpha (little-endian)
Definition: pixfmt.h:209
static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
An instance of a filter.
Definition: avfilter.h:338
planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian)
Definition: pixfmt.h:182
Y , 12bpp, big-endian.
Definition: pixfmt.h:291
#define PLANE_B
FILE * out
Definition: movenc.c:54
#define av_freep(p)
int(* config_props)(AVFilterLink *link)
Link configuration callback.
Definition: internal.h:129
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition: pixfmt.h:95
planar GBR 4:4:4 48bpp, little-endian
Definition: pixfmt.h:171
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:338
planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), little-endian
Definition: pixfmt.h:177
internal API functions
int depth
Number of bits in the component.
Definition: pixdesc.h:58
planar GBRA 4:4:4:4 64bpp, little-endian
Definition: pixfmt.h:213
packed RGB 8:8:8, 32bpp, XRGBXRGB... X=unused/undefined
Definition: pixfmt.h:233
static int ff_insert_outpad(AVFilterContext *f, unsigned index, AVFilterPad *p)
Insert a new output pad for the filter.
Definition: internal.h:285
AVPixelFormat
Pixel format.
Definition: pixfmt.h:60
#define AV_PIX_FMT_FLAG_PLANAR
At least one pixel component is not in the first data plane.
Definition: pixdesc.h:144
planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
Definition: pixfmt.h:238
planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition: pixfmt.h:160
planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition: pixfmt.h:242
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
Definition: frame.c:652
planar GBR 4:4:4 30bpp, little-endian
Definition: pixfmt.h:169
packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is st...
Definition: pixfmt.h:202
#define AV_CEIL_RSHIFT(a, b)
Definition: common.h:58
const char * name
Definition: opengl_enc.c:103
int * formats
list of media formats
Definition: formats.h:66
planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition: pixfmt.h:156