FFmpeg
vf_mergeplanes.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/avassert.h"
22 #include "libavutil/avstring.h"
23 #include "libavutil/imgutils.h"
24 #include "libavutil/opt.h"
25 #include "libavutil/pixdesc.h"
26 #include "avfilter.h"
27 #include "internal.h"
28 #include "framesync.h"
29 
30 typedef struct InputParam {
31  int depth[4];
32  int nb_planes;
33  int planewidth[4];
34  int planeheight[4];
35 } InputParam;
36 
37 typedef struct MergePlanesContext {
38  const AVClass *class;
39  int64_t mapping;
40  const enum AVPixelFormat out_fmt;
41  int nb_inputs;
42  int nb_planes;
43  int planewidth[4];
44  int planeheight[4];
45  int map[4][2];
47 
50 
51 #define OFFSET(x) offsetof(MergePlanesContext, x)
52 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
53 static const AVOption mergeplanes_options[] = {
54  { "mapping", "set input to output plane mapping", OFFSET(mapping), AV_OPT_TYPE_INT, {.i64=0}, 0, 0x33333333, FLAGS },
55  { "format", "set output pixel format", OFFSET(out_fmt), AV_OPT_TYPE_PIXEL_FMT, {.i64=AV_PIX_FMT_YUVA444P}, 0, INT_MAX, .flags=FLAGS },
56  { NULL }
57 };
58 
59 AVFILTER_DEFINE_CLASS(mergeplanes);
60 
62 {
63  MergePlanesContext *s = ctx->priv;
64  int64_t m = s->mapping;
65  int i, ret;
66 
68  if (!(s->outdesc->flags & AV_PIX_FMT_FLAG_PLANAR) ||
69  s->outdesc->nb_components < 2) {
70  av_log(ctx, AV_LOG_ERROR, "Only planar formats with more than one component are supported.\n");
71  return AVERROR(EINVAL);
72  }
74 
75  for (i = s->nb_planes - 1; i >= 0; i--) {
76  s->map[i][0] = m & 0xf;
77  m >>= 4;
78  s->map[i][1] = m & 0xf;
79  m >>= 4;
80 
81  if (s->map[i][0] > 3 || s->map[i][1] > 3) {
82  av_log(ctx, AV_LOG_ERROR, "Mapping with out of range input and/or plane number.\n");
83  return AVERROR(EINVAL);
84  }
85 
86  s->nb_inputs = FFMAX(s->nb_inputs, s->map[i][1] + 1);
87  }
88 
89  av_assert0(s->nb_inputs && s->nb_inputs <= 4);
90 
91  for (i = 0; i < s->nb_inputs; i++) {
92  AVFilterPad pad = { 0 };
93 
95  pad.name = av_asprintf("in%d", i);
96  if (!pad.name)
97  return AVERROR(ENOMEM);
98 
99  if ((ret = ff_insert_inpad(ctx, i, &pad)) < 0){
100  av_freep(&pad.name);
101  return ret;
102  }
103  }
104 
105  return 0;
106 }
107 
109 {
110  MergePlanesContext *s = ctx->priv;
112  int i, ret;
113 
115  for (i = 0; av_pix_fmt_desc_get(i); i++) {
117  if (desc->comp[0].depth == s->outdesc->comp[0].depth &&
118  (desc->comp[0].depth <= 8 || (desc->flags & AV_PIX_FMT_FLAG_BE) == (s->outdesc->flags & AV_PIX_FMT_FLAG_BE)) &&
120  (ret = ff_add_format(&formats, i)) < 0)
121  return ret;
122  }
123 
124  for (i = 0; i < s->nb_inputs; i++)
125  if ((ret = ff_formats_ref(formats, &ctx->inputs[i]->out_formats)) < 0)
126  return ret;
127 
128  formats = NULL;
129  if ((ret = ff_add_format(&formats, s->out_fmt)) < 0 ||
130  (ret = ff_formats_ref(formats, &ctx->outputs[0]->in_formats)) < 0)
131  return ret;
132 
133  return 0;
134 }
135 
137 {
138  AVFilterContext *ctx = fs->parent;
139  AVFilterLink *outlink = ctx->outputs[0];
140  MergePlanesContext *s = fs->opaque;
141  AVFrame *in[4] = { NULL };
142  AVFrame *out;
143  int i, ret;
144 
145  for (i = 0; i < s->nb_inputs; i++) {
146  if ((ret = ff_framesync_get_frame(&s->fs, i, &in[i], 0)) < 0)
147  return ret;
148  }
149 
150  out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
151  if (!out)
152  return AVERROR(ENOMEM);
153  out->pts = av_rescale_q(s->fs.pts, s->fs.time_base, outlink->time_base);
154 
155  for (i = 0; i < s->nb_planes; i++) {
156  const int input = s->map[i][1];
157  const int plane = s->map[i][0];
158 
159  av_image_copy_plane(out->data[i], out->linesize[i],
160  in[input]->data[plane], in[input]->linesize[plane],
161  s->planewidth[i], s->planeheight[i]);
162  }
163 
164  return ff_filter_frame(outlink, out);
165 }
166 
167 static int config_output(AVFilterLink *outlink)
168 {
169  AVFilterContext *ctx = outlink->src;
170  MergePlanesContext *s = ctx->priv;
171  InputParam inputsp[4];
172  FFFrameSyncIn *in;
173  int i, ret;
174 
175  if ((ret = ff_framesync_init(&s->fs, ctx, s->nb_inputs)) < 0)
176  return ret;
177 
178  in = s->fs.in;
179  s->fs.opaque = s;
181 
182  outlink->w = ctx->inputs[0]->w;
183  outlink->h = ctx->inputs[0]->h;
184  outlink->time_base = ctx->inputs[0]->time_base;
185  outlink->frame_rate = ctx->inputs[0]->frame_rate;
186  outlink->sample_aspect_ratio = ctx->inputs[0]->sample_aspect_ratio;
187 
188  s->planewidth[1] =
189  s->planewidth[2] = AV_CEIL_RSHIFT(((s->outdesc->comp[1].depth > 8) + 1) * outlink->w, s->outdesc->log2_chroma_w);
190  s->planewidth[0] =
191  s->planewidth[3] = ((s->outdesc->comp[0].depth > 8) + 1) * outlink->w;
192  s->planeheight[1] =
193  s->planeheight[2] = AV_CEIL_RSHIFT(outlink->h, s->outdesc->log2_chroma_h);
194  s->planeheight[0] =
195  s->planeheight[3] = outlink->h;
196 
197  for (i = 0; i < s->nb_inputs; i++) {
198  InputParam *inputp = &inputsp[i];
199  AVFilterLink *inlink = ctx->inputs[i];
200  const AVPixFmtDescriptor *indesc = av_pix_fmt_desc_get(inlink->format);
201  int j;
202 
203  if (outlink->sample_aspect_ratio.num != inlink->sample_aspect_ratio.num ||
204  outlink->sample_aspect_ratio.den != inlink->sample_aspect_ratio.den) {
205  av_log(ctx, AV_LOG_ERROR, "input #%d link %s SAR %d:%d "
206  "does not match output link %s SAR %d:%d\n",
207  i, ctx->input_pads[i].name,
208  inlink->sample_aspect_ratio.num,
209  inlink->sample_aspect_ratio.den,
210  ctx->output_pads[0].name,
211  outlink->sample_aspect_ratio.num,
212  outlink->sample_aspect_ratio.den);
213  return AVERROR(EINVAL);
214  }
215 
216  inputp->planewidth[1] =
217  inputp->planewidth[2] = AV_CEIL_RSHIFT(((indesc->comp[1].depth > 8) + 1) * inlink->w, indesc->log2_chroma_w);
218  inputp->planewidth[0] =
219  inputp->planewidth[3] = ((indesc->comp[0].depth > 8) + 1) * inlink->w;
220  inputp->planeheight[1] =
221  inputp->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, indesc->log2_chroma_h);
222  inputp->planeheight[0] =
223  inputp->planeheight[3] = inlink->h;
224  inputp->nb_planes = av_pix_fmt_count_planes(inlink->format);
225 
226  for (j = 0; j < inputp->nb_planes; j++)
227  inputp->depth[j] = indesc->comp[j].depth;
228 
229  in[i].time_base = inlink->time_base;
230  in[i].sync = 1;
231  in[i].before = EXT_STOP;
232  in[i].after = EXT_STOP;
233  }
234 
235  for (i = 0; i < s->nb_planes; i++) {
236  const int input = s->map[i][1];
237  const int plane = s->map[i][0];
238  InputParam *inputp = &inputsp[input];
239 
240  if (plane + 1 > inputp->nb_planes) {
241  av_log(ctx, AV_LOG_ERROR, "input %d does not have %d plane\n",
242  input, plane);
243  goto fail;
244  }
245  if (s->outdesc->comp[i].depth != inputp->depth[plane]) {
246  av_log(ctx, AV_LOG_ERROR, "output plane %d depth %d does not "
247  "match input %d plane %d depth %d\n",
248  i, s->outdesc->comp[i].depth,
249  input, plane, inputp->depth[plane]);
250  goto fail;
251  }
252  if (s->planewidth[i] != inputp->planewidth[plane]) {
253  av_log(ctx, AV_LOG_ERROR, "output plane %d width %d does not "
254  "match input %d plane %d width %d\n",
255  i, s->planewidth[i],
256  input, plane, inputp->planewidth[plane]);
257  goto fail;
258  }
259  if (s->planeheight[i] != inputp->planeheight[plane]) {
260  av_log(ctx, AV_LOG_ERROR, "output plane %d height %d does not "
261  "match input %d plane %d height %d\n",
262  i, s->planeheight[i],
263  input, plane, inputp->planeheight[plane]);
264  goto fail;
265  }
266  }
267 
268  return ff_framesync_configure(&s->fs);
269 fail:
270  return AVERROR(EINVAL);
271 }
272 
274 {
275  MergePlanesContext *s = ctx->priv;
276  return ff_framesync_activate(&s->fs);
277 }
278 
280 {
281  MergePlanesContext *s = ctx->priv;
282  int i;
283 
284  ff_framesync_uninit(&s->fs);
285 
286  for (i = 0; i < ctx->nb_inputs; i++)
287  av_freep(&ctx->input_pads[i].name);
288 }
289 
291  {
292  .name = "default",
293  .type = AVMEDIA_TYPE_VIDEO,
294  .config_props = config_output,
295  },
296  { NULL }
297 };
298 
300  .name = "mergeplanes",
301  .description = NULL_IF_CONFIG_SMALL("Merge planes."),
302  .priv_size = sizeof(MergePlanesContext),
303  .priv_class = &mergeplanes_class,
304  .init = init,
305  .uninit = uninit,
307  .activate = activate,
308  .inputs = NULL,
309  .outputs = mergeplanes_outputs,
311 };
static int config_output(AVFilterLink *outlink)
int plane
Definition: avisynth_c.h:384
#define NULL
Definition: coverity.c:32
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2522
This structure describes decoded (raw) audio or video data.
Definition: frame.h:295
static const AVOption mergeplanes_options[]
AVOption.
Definition: opt.h:246
static av_cold int init(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
misc image utilities
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2562
Main libavfilter public API header.
const char * desc
Definition: nvenc.c:68
#define AVFILTER_FLAG_DYNAMIC_INPUTS
The number of the filter inputs is not determined just by AVFilter.inputs.
Definition: avfilter.h:105
int planeheight[4]
int num
Numerator.
Definition: rational.h:59
AVFilter ff_vf_mergeplanes
enum AVMediaType type
AVFilterPad type.
Definition: internal.h:65
int ff_framesync_configure(FFFrameSync *fs)
Configure a frame sync structure.
Definition: framesync.c:117
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
int64_t pts
Timestamp of the current event.
Definition: framesync.h:167
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
Definition: pixdesc.h:92
enum FFFrameSyncExtMode before
Extrapolation mode for timestamps before the first frame.
Definition: framesync.h:86
const char * name
Pad name.
Definition: internal.h:60
AVFilterContext * parent
Parent filter context.
Definition: framesync.h:152
AVFilterLink ** inputs
array of pointers to input links
Definition: avfilter.h:346
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:37
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
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
Definition: pixdesc.h:117
#define av_cold
Definition: attributes.h:82
#define fs(width, name, subs,...)
Definition: cbs_vp9.c:259
enum AVPixelFormat out_fmt
AVOptions.
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
Definition: frame.h:388
int planewidth[4]
FFFrameSyncIn * in
Pointer to array of inputs.
Definition: framesync.h:203
enum FFFrameSyncExtMode after
Extrapolation mode for timestamps after the last frame.
Definition: framesync.h:91
Input stream structure.
Definition: framesync.h:81
#define av_log(a,...)
#define OFFSET(x)
A filter pad used for either input or output.
Definition: internal.h:54
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
Definition: mathematics.c:142
AVFilterPad * input_pads
array of input pads
Definition: avfilter.h:345
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:259
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
Definition: pixdesc.h:101
void ff_framesync_uninit(FFFrameSync *fs)
Free all memory currently allocated.
Definition: framesync.c:293
static av_cold void uninit(AVFilterContext *ctx)
Frame sync structure.
Definition: framesync.h:146
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
void * priv
private data for use by the filter
Definition: avfilter.h:353
simple assert() macros that are a bit more flexible than ISO C assert().
AVRational time_base
Time base for the incoming frames.
Definition: framesync.h:96
int ff_add_format(AVFilterFormats **avff, int64_t fmt)
Add fmt to the list of media formats contained in *avff.
Definition: formats.c:337
int ff_framesync_activate(FFFrameSync *fs)
Examine the frames in the filter&#39;s input and try to produce output.
Definition: framesync.c:344
int(* on_event)(struct FFFrameSync *fs)
Callback called when a frame event is ready.
Definition: framesync.h:172
#define FFMAX(a, b)
Definition: common.h:94
#define fail()
Definition: checkasm.h:121
static int activate(AVFilterContext *ctx)
char * av_asprintf(const char *fmt,...)
Definition: avstring.c:113
uint64_t flags
Combination of AV_PIX_FMT_FLAG_...
Definition: pixdesc.h:106
const AVPixFmtDescriptor * outdesc
uint8_t nb_components
The number of components each pixel has, (1-4)
Definition: pixdesc.h:83
unsigned nb_inputs
number of input pads
Definition: avfilter.h:347
int ff_formats_ref(AVFilterFormats *f, AVFilterFormats **ref)
Add *ref as a new reference to formats.
Definition: formats.c:440
#define FLAGS
AVFormatContext * ctx
Definition: movenc.c:48
AVRational time_base
Time base for the output events.
Definition: framesync.h:162
#define s(width, name)
Definition: cbs_vp9.c:257
void * opaque
Opaque pointer, not used by the API.
Definition: framesync.h:177
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
int depth[4]
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Definition: frame.h:326
int ff_framesync_init(FFFrameSync *fs, AVFilterContext *parent, unsigned nb_in)
Initialize a frame sync structure.
Definition: framesync.c:77
static int process_frame(FFFrameSync *fs)
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition: pixfmt.h:177
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:81
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several inputs
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(const int16_t *) pi >> 8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(const int32_t *) pi >> 24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31))))#define SET_CONV_FUNC_GROUP(ofmt, ifmt) static void set_generic_function(AudioConvert *ac){}void ff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, int sample_rate, int apply_map){AudioConvert *ac;int in_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) return NULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method!=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt) > 2){ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc){av_free(ac);return NULL;}return ac;}in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar){ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar?ac->channels:1;}else if(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;else ac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);return ac;}int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){int use_generic=1;int len=in->nb_samples;int p;if(ac->dc){av_log(ac->avr, AV_LOG_TRACE,"%d samples - audio_convert: %s to %s (dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));return ff_convert_dither(ac-> in
unsigned sync
Synchronization level: frames on input at the highest sync level will generate output frame events...
Definition: framesync.h:139
Describe the class of an AVClass context structure.
Definition: log.h:67
Filter definition.
Definition: avfilter.h:144
const char * name
Filter name.
Definition: avfilter.h:148
and forward the test the status of outputs and forward it to the corresponding return FFERROR_NOT_READY If the filters stores internally one or a few frame for some input
const VDPAUPixFmtMap * map
AVFilterLink ** outputs
array of pointers to output links
Definition: avfilter.h:350
#define flags(name, subs,...)
Definition: cbs_av1.c:561
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:309
The exact code depends on how similar the blocks are and how related they are to the and needs to apply these operations to the correct inlink or outlink if there are several Macros are available to factor that when no extra processing is inlink
static const AVFilterPad mergeplanes_outputs[]
AVFILTER_DEFINE_CLASS(mergeplanes)
int den
Denominator.
Definition: rational.h:60
#define AV_PIX_FMT_FLAG_BE
Pixel format is big-endian.
Definition: pixdesc.h:128
Completely stop all streams with this one.
Definition: framesync.h:65
A list of supported formats for one end of a filter link.
Definition: formats.h:64
An instance of a filter.
Definition: avfilter.h:338
FILE * out
Definition: movenc.c:54
#define av_freep(p)
formats
Definition: signature.h:48
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
internal API functions
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later.That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another.Frame references ownership and permissions
int ff_framesync_get_frame(FFFrameSync *fs, unsigned in, AVFrame **rframe, unsigned get)
Get the current frame in an input.
Definition: framesync.c:256
int depth
Number of bits in the component.
Definition: pixdesc.h:58
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
#define AV_PIX_FMT_FLAG_PLANAR
At least one pixel component is not in the first data plane.
Definition: pixdesc.h:144
#define AV_CEIL_RSHIFT(a, b)
Definition: common.h:58
static int ff_insert_inpad(AVFilterContext *f, unsigned index, AVFilterPad *p)
Insert a new input pad for the filter.
Definition: internal.h:277