FFmpeg
vf_framepack.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 Vittorio Giovara
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 /**
22  * @file
23  * Generate a frame packed video, by combining two views in a single surface.
24  */
25 
26 #include <string.h>
27 
28 #include "libavutil/common.h"
29 #include "libavutil/imgutils.h"
30 #include "libavutil/opt.h"
31 #include "libavutil/pixdesc.h"
32 #include "libavutil/rational.h"
33 #include "libavutil/stereo3d.h"
34 
35 #include "avfilter.h"
36 #include "filters.h"
37 #include "formats.h"
38 #include "internal.h"
39 #include "video.h"
40 
41 #define LEFT 0
42 #define RIGHT 1
43 
44 typedef struct FramepackContext {
45  const AVClass *class;
46 
47  const AVPixFmtDescriptor *pix_desc; ///< agreed pixel format
48 
49  enum AVStereo3DType format; ///< frame pack type output
50 
51  AVFrame *input_views[2]; ///< input frames
53 
54 static const enum AVPixelFormat formats_supported[] = {
59 };
60 
62 {
63  // this will ensure that formats are the same on all pads
65  if (!fmts_list)
66  return AVERROR(ENOMEM);
67  return ff_set_common_formats(ctx, fmts_list);
68 }
69 
71 {
72  FramepackContext *s = ctx->priv;
73 
74  // clean any leftover frame
77 }
78 
79 static int config_output(AVFilterLink *outlink)
80 {
81  AVFilterContext *ctx = outlink->src;
82  FramepackContext *s = outlink->src->priv;
83 
84  int width = ctx->inputs[LEFT]->w;
85  int height = ctx->inputs[LEFT]->h;
86  AVRational time_base = ctx->inputs[LEFT]->time_base;
87  AVRational frame_rate = ctx->inputs[LEFT]->frame_rate;
88 
89  // check size and fps match on the other input
90  if (width != ctx->inputs[RIGHT]->w ||
91  height != ctx->inputs[RIGHT]->h) {
92  av_log(ctx, AV_LOG_ERROR,
93  "Left and right sizes differ (%dx%d vs %dx%d).\n",
94  width, height,
95  ctx->inputs[RIGHT]->w, ctx->inputs[RIGHT]->h);
96  return AVERROR_INVALIDDATA;
97  } else if (av_cmp_q(time_base, ctx->inputs[RIGHT]->time_base) != 0) {
98  av_log(ctx, AV_LOG_ERROR,
99  "Left and right time bases differ (%d/%d vs %d/%d).\n",
100  time_base.num, time_base.den,
101  ctx->inputs[RIGHT]->time_base.num,
102  ctx->inputs[RIGHT]->time_base.den);
103  return AVERROR_INVALIDDATA;
104  } else if (av_cmp_q(frame_rate, ctx->inputs[RIGHT]->frame_rate) != 0) {
105  av_log(ctx, AV_LOG_ERROR,
106  "Left and right framerates differ (%d/%d vs %d/%d).\n",
107  frame_rate.num, frame_rate.den,
108  ctx->inputs[RIGHT]->frame_rate.num,
109  ctx->inputs[RIGHT]->frame_rate.den);
110  return AVERROR_INVALIDDATA;
111  }
112 
113  s->pix_desc = av_pix_fmt_desc_get(outlink->format);
114  if (!s->pix_desc)
115  return AVERROR_BUG;
116 
117  // modify output properties as needed
118  switch (s->format) {
120  time_base.den *= 2;
121  frame_rate.num *= 2;
122  break;
123  case AV_STEREO3D_COLUMNS:
125  width *= 2;
126  break;
127  case AV_STEREO3D_LINES:
129  height *= 2;
130  break;
131  default:
132  av_log(ctx, AV_LOG_ERROR, "Unknown packing mode.");
133  return AVERROR_INVALIDDATA;
134  }
135 
136  outlink->w = width;
137  outlink->h = height;
138  outlink->time_base = time_base;
139  outlink->frame_rate = frame_rate;
140 
141  return 0;
142 }
143 
144 static void horizontal_frame_pack(AVFilterLink *outlink,
145  AVFrame *out,
146  int interleaved)
147 {
148  AVFilterContext *ctx = outlink->src;
149  FramepackContext *s = ctx->priv;
150  int i, plane;
151 
152  if (interleaved) {
153  const uint8_t *leftp = s->input_views[LEFT]->data[0];
154  const uint8_t *rightp = s->input_views[RIGHT]->data[0];
155  uint8_t *dstp = out->data[0];
156  int length = out->width / 2;
157  int lines = out->height;
158 
159  for (plane = 0; plane < s->pix_desc->nb_components; plane++) {
160  if (plane == 1 || plane == 2) {
161  length = AV_CEIL_RSHIFT(out->width / 2, s->pix_desc->log2_chroma_w);
162  lines = AV_CEIL_RSHIFT(out->height, s->pix_desc->log2_chroma_h);
163  }
164  for (i = 0; i < lines; i++) {
165  int j;
166  leftp = s->input_views[LEFT]->data[plane] +
167  s->input_views[LEFT]->linesize[plane] * i;
168  rightp = s->input_views[RIGHT]->data[plane] +
169  s->input_views[RIGHT]->linesize[plane] * i;
170  dstp = out->data[plane] + out->linesize[plane] * i;
171  for (j = 0; j < length; j++) {
172  // interpolate chroma as necessary
173  if ((s->pix_desc->log2_chroma_w ||
174  s->pix_desc->log2_chroma_h) &&
175  (plane == 1 || plane == 2)) {
176  *dstp++ = (*leftp + *rightp) / 2;
177  *dstp++ = (*leftp + *rightp) / 2;
178  } else {
179  *dstp++ = *leftp;
180  *dstp++ = *rightp;
181  }
182  leftp += 1;
183  rightp += 1;
184  }
185  }
186  }
187  } else {
188  for (i = 0; i < 2; i++) {
189  const uint8_t *src[4];
190  uint8_t *dst[4];
191  int sub_w = s->input_views[i]->width >> s->pix_desc->log2_chroma_w;
192 
193  src[0] = s->input_views[i]->data[0];
194  src[1] = s->input_views[i]->data[1];
195  src[2] = s->input_views[i]->data[2];
196 
197  dst[0] = out->data[0] + i * s->input_views[i]->width;
198  dst[1] = out->data[1] + i * sub_w;
199  dst[2] = out->data[2] + i * sub_w;
200 
201  av_image_copy(dst, out->linesize, src, s->input_views[i]->linesize,
202  s->input_views[i]->format,
203  s->input_views[i]->width,
204  s->input_views[i]->height);
205  }
206  }
207 }
208 
209 static void vertical_frame_pack(AVFilterLink *outlink,
210  AVFrame *out,
211  int interleaved)
212 {
213  AVFilterContext *ctx = outlink->src;
214  FramepackContext *s = ctx->priv;
215  int i;
216 
217  for (i = 0; i < 2; i++) {
218  const uint8_t *src[4];
219  uint8_t *dst[4];
220  int linesizes[4];
221  int sub_h = s->input_views[i]->height >> s->pix_desc->log2_chroma_h;
222 
223  src[0] = s->input_views[i]->data[0];
224  src[1] = s->input_views[i]->data[1];
225  src[2] = s->input_views[i]->data[2];
226 
227  dst[0] = out->data[0] + i * out->linesize[0] *
228  (interleaved + s->input_views[i]->height * (1 - interleaved));
229  dst[1] = out->data[1] + i * out->linesize[1] *
230  (interleaved + sub_h * (1 - interleaved));
231  dst[2] = out->data[2] + i * out->linesize[2] *
232  (interleaved + sub_h * (1 - interleaved));
233 
234  linesizes[0] = out->linesize[0] +
235  interleaved * out->linesize[0];
236  linesizes[1] = out->linesize[1] +
237  interleaved * out->linesize[1];
238  linesizes[2] = out->linesize[2] +
239  interleaved * out->linesize[2];
240 
241  av_image_copy(dst, linesizes, src, s->input_views[i]->linesize,
242  s->input_views[i]->format,
243  s->input_views[i]->width,
244  s->input_views[i]->height);
245  }
246 }
247 
249  AVFrame *dst)
250 {
251  AVFilterContext *ctx = outlink->src;
252  FramepackContext *s = ctx->priv;
253  switch (s->format) {
255  horizontal_frame_pack(outlink, dst, 0);
256  break;
257  case AV_STEREO3D_COLUMNS:
258  horizontal_frame_pack(outlink, dst, 1);
259  break;
261  vertical_frame_pack(outlink, dst, 0);
262  break;
263  case AV_STEREO3D_LINES:
264  vertical_frame_pack(outlink, dst, 1);
265  break;
266  }
267 }
268 
270 {
271  FramepackContext *s = ctx->priv;
272  AVFilterLink *outlink = ctx->outputs[0];
273  AVStereo3D *stereo;
274  int ret, i;
275 
276  if (!(s->input_views[0] && s->input_views[1]))
277  return 0;
278  if (s->format == AV_STEREO3D_FRAMESEQUENCE) {
279  int64_t pts = s->input_views[0]->pts;
280 
281  for (i = 0; i < 2; i++) {
282  // set correct timestamps
283  if (pts != AV_NOPTS_VALUE)
284  s->input_views[i]->pts = i == 0 ? pts * 2 : pts * 2 + av_rescale_q(1, av_inv_q(outlink->frame_rate), outlink->time_base);
285 
286  // set stereo3d side data
288  if (!stereo)
289  return AVERROR(ENOMEM);
290  stereo->type = s->format;
291  stereo->view = i == LEFT ? AV_STEREO3D_VIEW_LEFT
293 
294  // filter the frame and immediately relinquish its pointer
295  ret = ff_filter_frame(outlink, s->input_views[i]);
296  s->input_views[i] = NULL;
297  if (ret < 0)
298  return ret;
299  }
300  return ret;
301  } else {
302  AVFrame *dst = ff_get_video_buffer(outlink, outlink->w, outlink->h);
303  if (!dst)
304  return AVERROR(ENOMEM);
305 
306  spatial_frame_pack(outlink, dst);
307 
308  // get any property from the original frame
309  ret = av_frame_copy_props(dst, s->input_views[LEFT]);
310  if (ret < 0) {
311  av_frame_free(&dst);
312  return ret;
313  }
314 
315  for (i = 0; i < 2; i++)
316  av_frame_free(&s->input_views[i]);
317 
318  // set stereo3d side data
319  stereo = av_stereo3d_create_side_data(dst);
320  if (!stereo) {
321  av_frame_free(&dst);
322  return AVERROR(ENOMEM);
323  }
324  stereo->type = s->format;
325 
326  return ff_filter_frame(outlink, dst);
327  }
328 }
329 
331 {
332  AVFilterLink *outlink = ctx->outputs[0];
333  FramepackContext *s = ctx->priv;
334  int ret;
335 
336  FF_FILTER_FORWARD_STATUS_BACK_ALL(outlink, ctx);
337 
338  if (!s->input_views[0]) {
339  ret = ff_inlink_consume_frame(ctx->inputs[0], &s->input_views[0]);
340  if (ret < 0)
341  return ret;
342  }
343 
344  if (!s->input_views[1]) {
345  ret = ff_inlink_consume_frame(ctx->inputs[1], &s->input_views[1]);
346  if (ret < 0)
347  return ret;
348  }
349 
350  if (s->input_views[0] && s->input_views[1])
351  return try_push_frame(ctx);
352 
353  FF_FILTER_FORWARD_STATUS(ctx->inputs[0], outlink);
354  FF_FILTER_FORWARD_STATUS(ctx->inputs[1], outlink);
355 
356  if (ff_outlink_frame_wanted(ctx->outputs[0]) &&
357  !ff_outlink_get_status(ctx->inputs[0]) &&
358  !s->input_views[0]) {
360  return 0;
361  }
362 
363  if (ff_outlink_frame_wanted(ctx->outputs[0]) &&
364  !ff_outlink_get_status(ctx->inputs[1]) &&
365  !s->input_views[1]) {
367  return 0;
368  }
369 
370  return FFERROR_NOT_READY;
371 }
372 
373 #define OFFSET(x) offsetof(FramepackContext, x)
374 #define VF AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM
375 static const AVOption framepack_options[] = {
376  { "format", "Frame pack output format", OFFSET(format), AV_OPT_TYPE_INT,
377  { .i64 = AV_STEREO3D_SIDEBYSIDE }, 0, INT_MAX, .flags = VF, .unit = "format" },
378  { "sbs", "Views are packed next to each other", 0, AV_OPT_TYPE_CONST,
379  { .i64 = AV_STEREO3D_SIDEBYSIDE }, INT_MIN, INT_MAX, .flags = VF, .unit = "format" },
380  { "tab", "Views are packed on top of each other", 0, AV_OPT_TYPE_CONST,
381  { .i64 = AV_STEREO3D_TOPBOTTOM }, INT_MIN, INT_MAX, .flags = VF, .unit = "format" },
382  { "frameseq", "Views are one after the other", 0, AV_OPT_TYPE_CONST,
383  { .i64 = AV_STEREO3D_FRAMESEQUENCE }, INT_MIN, INT_MAX, .flags = VF, .unit = "format" },
384  { "lines", "Views are interleaved by lines", 0, AV_OPT_TYPE_CONST,
385  { .i64 = AV_STEREO3D_LINES }, INT_MIN, INT_MAX, .flags = VF, .unit = "format" },
386  { "columns", "Views are interleaved by columns", 0, AV_OPT_TYPE_CONST,
387  { .i64 = AV_STEREO3D_COLUMNS }, INT_MIN, INT_MAX, .flags = VF, .unit = "format" },
388  { NULL },
389 };
390 
391 AVFILTER_DEFINE_CLASS(framepack);
392 
393 static const AVFilterPad framepack_inputs[] = {
394  {
395  .name = "left",
396  .type = AVMEDIA_TYPE_VIDEO,
397  },
398  {
399  .name = "right",
400  .type = AVMEDIA_TYPE_VIDEO,
401  },
402  { NULL }
403 };
404 
405 static const AVFilterPad framepack_outputs[] = {
406  {
407  .name = "packed",
408  .type = AVMEDIA_TYPE_VIDEO,
409  .config_props = config_output,
410  },
411  { NULL }
412 };
413 
415  .name = "framepack",
416  .description = NULL_IF_CONFIG_SMALL("Generate a frame packed stereoscopic video."),
417  .priv_size = sizeof(FramepackContext),
418  .priv_class = &framepack_class,
420  .inputs = framepack_inputs,
421  .outputs = framepack_outputs,
422  .activate = activate,
424 };
int plane
Definition: avisynth_c.h:384
int ff_inlink_consume_frame(AVFilterLink *link, AVFrame **rframe)
Take a frame from the link&#39;s FIFO and update the link&#39;s stats.
Definition: avfilter.c:1476
#define NULL
Definition: coverity.c:32
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:59
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2549
This structure describes decoded (raw) audio or video data.
Definition: frame.h:295
AVOption.
Definition: opt.h:246
enum AVStereo3DView view
Determines which views are packed.
Definition: stereo3d.h:190
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:71
misc image utilities
#define FF_FILTER_FORWARD_STATUS_BACK_ALL(outlink, filter)
Forward the status on an output link to all input links.
Definition: filters.h:212
Main libavfilter public API header.
FF_FILTER_FORWARD_STATUS(inlink, outlink)
static int try_push_frame(AVFilterContext *ctx)
Definition: vf_framepack.c:269
int num
Numerator.
Definition: rational.h:59
Frame contains only the right view.
Definition: stereo3d.h:161
static enum AVPixelFormat formats_supported[]
Definition: vf_framepack.c:54
return FFERROR_NOT_READY
Views are next to each other.
Definition: stereo3d.h:67
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
static void vertical_frame_pack(AVFilterLink *outlink, AVFrame *out, int interleaved)
Definition: vf_framepack.c:209
#define RIGHT
Definition: vf_framepack.c:42
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
Definition: pixdesc.h:92
void ff_inlink_request_frame(AVFilterLink *link)
Mark that a frame is wanted on the link.
Definition: avfilter.c:1602
Frame contains only the left view.
Definition: stereo3d.h:156
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
#define OFFSET(x)
Definition: vf_framepack.c:373
AVFilterLink ** inputs
array of pointers to input links
Definition: avfilter.h:346
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1075
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Definition: pixfmt.h:101
uint8_t
#define av_cold
Definition: attributes.h:82
AVFILTER_DEFINE_CLASS(framepack)
static av_cold int uninit(AVCodecContext *avctx)
Definition: crystalhd.c:279
AVOptions.
Stereo 3D type: this structure describes how two videos are packed within a single video surface...
Definition: stereo3d.h:176
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
Definition: frame.h:388
static int query_formats(AVFilterContext *ctx)
Definition: vf_framepack.c:61
#define height
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range...
Definition: pixfmt.h:100
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
Definition: pixfmt.h:79
the definition of that something depends on the semantic of the filter The callback must examine the status of the filter s links and proceed accordingly The status of output links is stored in the status_in and status_out fields and tested by the ff_outlink_frame_wanted() function.If this function returns true
static void horizontal_frame_pack(AVFilterLink *outlink, AVFrame *out, int interleaved)
Definition: vf_framepack.c:144
#define av_log(a,...)
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
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:259
int width
Definition: frame.h:353
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
int ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats)
A helper for query_formats() which sets all links to the same list of formats.
Definition: formats.c:569
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
Definition: pixdesc.h:101
AVFilter ff_vf_framepack
Definition: vf_framepack.c:414
BYTE * dstp
Definition: avisynth_c.h:908
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:203
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
Views are packed per line, as if interlaced.
Definition: stereo3d.h:129
void * priv
private data for use by the filter
Definition: avfilter.h:353
GLsizei GLsizei * length
Definition: opengl_enc.c:114
void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4], const uint8_t *src_data[4], const int src_linesizes[4], enum AVPixelFormat pix_fmt, int width, int height)
Copy image in src_data to dst_data.
Definition: imgutils.c:387
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:70
AVStereo3D * av_stereo3d_create_side_data(AVFrame *frame)
Allocate a complete AVFrameSideData and add it to the frame.
Definition: stereo3d.c:33
Views are alternated temporally.
Definition: stereo3d.h:92
uint8_t nb_components
The number of components each pixel has, (1-4)
Definition: pixdesc.h:83
AVStereo3DType
List of possible 3D Types.
Definition: stereo3d.h:51
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
Definition: pixfmt.h:78
#define width
AVFrame * input_views[2]
input frames
Definition: vf_framepack.c:51
AVFormatContext * ctx
Definition: movenc.c:48
#define s(width, name)
Definition: cbs_vp9.c:257
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames...
Definition: frame.h:368
enum AVStereo3DType type
How views are packed within the video.
Definition: stereo3d.h:180
Views are on top of each other.
Definition: stereo3d.h:79
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Definition: frame.h:326
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:81
#define LEFT
Definition: vf_framepack.c:41
enum AVStereo3DType format
frame pack type output
Definition: vf_framepack.c:49
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
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
Definition: error.h:50
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition: pixfmt.h:72
Describe the class of an AVClass context structure.
Definition: log.h:67
Filter definition.
Definition: avfilter.h:144
int ff_outlink_get_status(AVFilterLink *link)
Get the status on an output link.
Definition: avfilter.c:1625
Rational number (pair of numerator and denominator).
Definition: rational.h:58
static const AVFilterPad framepack_inputs[]
Definition: vf_framepack.c:393
const char * name
Filter name.
Definition: avfilter.h:148
AVFilterLink ** outputs
array of pointers to output links
Definition: avfilter.h:350
const AVPixFmtDescriptor * pix_desc
agreed pixel format
Definition: vf_framepack.c:47
static int activate(AVFilterContext *ctx)
Definition: vf_framepack.c:330
static int64_t pts
static int config_output(AVFilterLink *outlink)
Definition: vf_framepack.c:79
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:309
static av_cold void framepack_uninit(AVFilterContext *ctx)
Definition: vf_framepack.c:70
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
Definition: rational.h:159
static int av_cmp_q(AVRational a, AVRational b)
Compare two rationals.
Definition: rational.h:89
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:66
common internal and external API header
Utilties for rational number calculation.
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
Definition: pixfmt.h:80
Stereoscopic video.
Views are packed per column.
Definition: stereo3d.h:141
int den
Denominator.
Definition: rational.h:60
static const AVOption framepack_options[]
Definition: vf_framepack.c:375
A list of supported formats for one end of a filter link.
Definition: formats.h:64
#define VF
Definition: vf_framepack.c:374
An instance of a filter.
Definition: avfilter.h:338
int height
Definition: frame.h:353
FILE * out
Definition: movenc.c:54
static const AVFilterPad framepack_outputs[]
Definition: vf_framepack.c:405
#define av_always_inline
Definition: attributes.h:39
static av_always_inline void spatial_frame_pack(AVFilterLink *outlink, AVFrame *dst)
Definition: vf_framepack.c:248
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
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
Definition: frame.c:659
#define AV_NOPTS_VALUE
Undefined timestamp value.
Definition: avutil.h:248
#define AV_CEIL_RSHIFT(a, b)
Definition: common.h:58