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  int depth;
48  const AVPixFmtDescriptor *pix_desc; ///< agreed pixel format
49 
50  enum AVStereo3DType format; ///< frame pack type output
51 
52  AVFrame *input_views[2]; ///< input frames
54 
55 static const enum AVPixelFormat formats_supported[] = {
80 };
81 
83 {
84  FramepackContext *s = ctx->priv;
85 
86  // clean any leftover frame
87  av_frame_free(&s->input_views[LEFT]);
88  av_frame_free(&s->input_views[RIGHT]);
89 }
90 
91 static int config_output(AVFilterLink *outlink)
92 {
93  AVFilterContext *ctx = outlink->src;
94  FramepackContext *s = outlink->src->priv;
95 
96  int width = ctx->inputs[LEFT]->w;
97  int height = ctx->inputs[LEFT]->h;
98  AVRational time_base = ctx->inputs[LEFT]->time_base;
99  AVRational frame_rate = ctx->inputs[LEFT]->frame_rate;
100 
101  // check size and fps match on the other input
102  if (width != ctx->inputs[RIGHT]->w ||
103  height != ctx->inputs[RIGHT]->h) {
105  "Left and right sizes differ (%dx%d vs %dx%d).\n",
106  width, height,
107  ctx->inputs[RIGHT]->w, ctx->inputs[RIGHT]->h);
108  return AVERROR_INVALIDDATA;
109  } else if (av_cmp_q(time_base, ctx->inputs[RIGHT]->time_base) != 0) {
111  "Left and right time bases differ (%d/%d vs %d/%d).\n",
112  time_base.num, time_base.den,
113  ctx->inputs[RIGHT]->time_base.num,
114  ctx->inputs[RIGHT]->time_base.den);
115  return AVERROR_INVALIDDATA;
116  } else if (av_cmp_q(frame_rate, ctx->inputs[RIGHT]->frame_rate) != 0) {
118  "Left and right framerates differ (%d/%d vs %d/%d).\n",
119  frame_rate.num, frame_rate.den,
120  ctx->inputs[RIGHT]->frame_rate.num,
121  ctx->inputs[RIGHT]->frame_rate.den);
122  return AVERROR_INVALIDDATA;
123  }
124 
125  s->pix_desc = av_pix_fmt_desc_get(outlink->format);
126  if (!s->pix_desc)
127  return AVERROR_BUG;
128  s->depth = s->pix_desc->comp[0].depth;
129 
130  // modify output properties as needed
131  switch (s->format) {
133  time_base.den *= 2;
134  frame_rate.num *= 2;
135  break;
136  case AV_STEREO3D_COLUMNS:
138  width *= 2;
139  break;
140  case AV_STEREO3D_LINES:
142  height *= 2;
143  break;
144  default:
145  av_log(ctx, AV_LOG_ERROR, "Unknown packing mode.");
146  return AVERROR_INVALIDDATA;
147  }
148 
149  outlink->w = width;
150  outlink->h = height;
151  outlink->time_base = time_base;
152  outlink->frame_rate = frame_rate;
153 
154  return 0;
155 }
156 
157 static void horizontal_frame_pack(AVFilterLink *outlink,
158  AVFrame *out,
159  int interleaved)
160 {
161  AVFilterContext *ctx = outlink->src;
162  FramepackContext *s = ctx->priv;
163  int i, plane;
164 
165  if (interleaved && s->depth <= 8) {
166  const uint8_t *leftp = s->input_views[LEFT]->data[0];
167  const uint8_t *rightp = s->input_views[RIGHT]->data[0];
168  uint8_t *dstp = out->data[0];
169  int length = out->width / 2;
170  int lines = out->height;
171 
172  for (plane = 0; plane < s->pix_desc->nb_components; plane++) {
173  if (plane == 1 || plane == 2) {
174  length = AV_CEIL_RSHIFT(out->width / 2, s->pix_desc->log2_chroma_w);
175  lines = AV_CEIL_RSHIFT(out->height, s->pix_desc->log2_chroma_h);
176  }
177  for (i = 0; i < lines; i++) {
178  int j;
179  leftp = s->input_views[LEFT]->data[plane] +
180  s->input_views[LEFT]->linesize[plane] * i;
181  rightp = s->input_views[RIGHT]->data[plane] +
182  s->input_views[RIGHT]->linesize[plane] * i;
183  dstp = out->data[plane] + out->linesize[plane] * i;
184  for (j = 0; j < length; j++) {
185  // interpolate chroma as necessary
186  if ((s->pix_desc->log2_chroma_w ||
187  s->pix_desc->log2_chroma_h) &&
188  (plane == 1 || plane == 2)) {
189  *dstp++ = (*leftp + *rightp) / 2;
190  *dstp++ = (*leftp + *rightp) / 2;
191  } else {
192  *dstp++ = *leftp;
193  *dstp++ = *rightp;
194  }
195  leftp += 1;
196  rightp += 1;
197  }
198  }
199  }
200  } else if (interleaved && s->depth > 8) {
201  const uint16_t *leftp = (const uint16_t *)s->input_views[LEFT]->data[0];
202  const uint16_t *rightp = (const uint16_t *)s->input_views[RIGHT]->data[0];
203  uint16_t *dstp = (uint16_t *)out->data[0];
204  int length = out->width / 2;
205  int lines = out->height;
206 
207  for (plane = 0; plane < s->pix_desc->nb_components; plane++) {
208  if (plane == 1 || plane == 2) {
209  length = AV_CEIL_RSHIFT(out->width / 2, s->pix_desc->log2_chroma_w);
210  lines = AV_CEIL_RSHIFT(out->height, s->pix_desc->log2_chroma_h);
211  }
212  for (i = 0; i < lines; i++) {
213  int j;
214  leftp = (const uint16_t *)s->input_views[LEFT]->data[plane] +
215  s->input_views[LEFT]->linesize[plane] * i / 2;
216  rightp = (const uint16_t *)s->input_views[RIGHT]->data[plane] +
217  s->input_views[RIGHT]->linesize[plane] * i / 2;
218  dstp = (uint16_t *)out->data[plane] + out->linesize[plane] * i / 2;
219  for (j = 0; j < length; j++) {
220  // interpolate chroma as necessary
221  if ((s->pix_desc->log2_chroma_w ||
222  s->pix_desc->log2_chroma_h) &&
223  (plane == 1 || plane == 2)) {
224  *dstp++ = (*leftp + *rightp) / 2;
225  *dstp++ = (*leftp + *rightp) / 2;
226  } else {
227  *dstp++ = *leftp;
228  *dstp++ = *rightp;
229  }
230  leftp += 1;
231  rightp += 1;
232  }
233  }
234  }
235  } else {
236  for (i = 0; i < 2; i++) {
237  const int psize = 1 + (s->depth > 8);
238  const uint8_t *src[4];
239  uint8_t *dst[4];
240  int sub_w = psize * s->input_views[i]->width >> s->pix_desc->log2_chroma_w;
241 
242  src[0] = s->input_views[i]->data[0];
243  src[1] = s->input_views[i]->data[1];
244  src[2] = s->input_views[i]->data[2];
245 
246  dst[0] = out->data[0] + i * s->input_views[i]->width * psize;
247  dst[1] = out->data[1] + i * sub_w;
248  dst[2] = out->data[2] + i * sub_w;
249 
250  av_image_copy(dst, out->linesize, src, s->input_views[i]->linesize,
251  s->input_views[i]->format,
252  s->input_views[i]->width,
253  s->input_views[i]->height);
254  }
255  }
256 }
257 
258 static void vertical_frame_pack(AVFilterLink *outlink,
259  AVFrame *out,
260  int interleaved)
261 {
262  AVFilterContext *ctx = outlink->src;
263  FramepackContext *s = ctx->priv;
264  int i;
265 
266  for (i = 0; i < 2; i++) {
267  const uint8_t *src[4];
268  uint8_t *dst[4];
269  int linesizes[4];
270  int sub_h = s->input_views[i]->height >> s->pix_desc->log2_chroma_h;
271 
272  src[0] = s->input_views[i]->data[0];
273  src[1] = s->input_views[i]->data[1];
274  src[2] = s->input_views[i]->data[2];
275 
276  dst[0] = out->data[0] + i * out->linesize[0] *
277  (interleaved + s->input_views[i]->height * (1 - interleaved));
278  dst[1] = out->data[1] + i * out->linesize[1] *
279  (interleaved + sub_h * (1 - interleaved));
280  dst[2] = out->data[2] + i * out->linesize[2] *
281  (interleaved + sub_h * (1 - interleaved));
282 
283  linesizes[0] = out->linesize[0] +
284  interleaved * out->linesize[0];
285  linesizes[1] = out->linesize[1] +
286  interleaved * out->linesize[1];
287  linesizes[2] = out->linesize[2] +
288  interleaved * out->linesize[2];
289 
290  av_image_copy(dst, linesizes, src, s->input_views[i]->linesize,
291  s->input_views[i]->format,
292  s->input_views[i]->width,
293  s->input_views[i]->height);
294  }
295 }
296 
298  AVFrame *dst)
299 {
300  AVFilterContext *ctx = outlink->src;
301  FramepackContext *s = ctx->priv;
302  switch (s->format) {
304  horizontal_frame_pack(outlink, dst, 0);
305  break;
306  case AV_STEREO3D_COLUMNS:
307  horizontal_frame_pack(outlink, dst, 1);
308  break;
310  vertical_frame_pack(outlink, dst, 0);
311  break;
312  case AV_STEREO3D_LINES:
313  vertical_frame_pack(outlink, dst, 1);
314  break;
315  }
316 }
317 
319 {
320  FramepackContext *s = ctx->priv;
321  AVFilterLink *outlink = ctx->outputs[0];
322  AVStereo3D *stereo;
323  int ret, i;
324 
325  if (!(s->input_views[0] && s->input_views[1]))
326  return 0;
327  if (s->format == AV_STEREO3D_FRAMESEQUENCE) {
328  int64_t pts = s->input_views[0]->pts;
329 
330  for (i = 0; i < 2; i++) {
331  // set correct timestamps
332  if (pts != AV_NOPTS_VALUE)
333  s->input_views[i]->pts = i == 0 ? pts * 2 : pts * 2 + av_rescale_q(1, av_inv_q(outlink->frame_rate), outlink->time_base);
334 
335  // set stereo3d side data
336  stereo = av_stereo3d_create_side_data(s->input_views[i]);
337  if (!stereo)
338  return AVERROR(ENOMEM);
339  stereo->type = s->format;
340  stereo->view = i == LEFT ? AV_STEREO3D_VIEW_LEFT
342 
343  // filter the frame and immediately relinquish its pointer
344  ret = ff_filter_frame(outlink, s->input_views[i]);
345  s->input_views[i] = NULL;
346  if (ret < 0)
347  return ret;
348  }
349  return ret;
350  } else {
351  AVFrame *dst = ff_get_video_buffer(outlink, outlink->w, outlink->h);
352  if (!dst)
353  return AVERROR(ENOMEM);
354 
355  spatial_frame_pack(outlink, dst);
356 
357  // get any property from the original frame
358  ret = av_frame_copy_props(dst, s->input_views[LEFT]);
359  if (ret < 0) {
360  av_frame_free(&dst);
361  return ret;
362  }
363 
364  for (i = 0; i < 2; i++)
365  av_frame_free(&s->input_views[i]);
366 
367  // set stereo3d side data
368  stereo = av_stereo3d_create_side_data(dst);
369  if (!stereo) {
370  av_frame_free(&dst);
371  return AVERROR(ENOMEM);
372  }
373  stereo->type = s->format;
374 
375  return ff_filter_frame(outlink, dst);
376  }
377 }
378 
380 {
381  AVFilterLink *outlink = ctx->outputs[0];
382  FramepackContext *s = ctx->priv;
383  int ret;
384 
386 
387  if (!s->input_views[0]) {
388  ret = ff_inlink_consume_frame(ctx->inputs[0], &s->input_views[0]);
389  if (ret < 0)
390  return ret;
391  }
392 
393  if (!s->input_views[1]) {
394  ret = ff_inlink_consume_frame(ctx->inputs[1], &s->input_views[1]);
395  if (ret < 0)
396  return ret;
397  }
398 
399  if (s->input_views[0] && s->input_views[1])
400  return try_push_frame(ctx);
401 
402  FF_FILTER_FORWARD_STATUS(ctx->inputs[0], outlink);
403  FF_FILTER_FORWARD_STATUS(ctx->inputs[1], outlink);
404 
405  if (ff_outlink_frame_wanted(ctx->outputs[0]) &&
406  !ff_outlink_get_status(ctx->inputs[0]) &&
407  !s->input_views[0]) {
408  ff_inlink_request_frame(ctx->inputs[0]);
409  return 0;
410  }
411 
412  if (ff_outlink_frame_wanted(ctx->outputs[0]) &&
413  !ff_outlink_get_status(ctx->inputs[1]) &&
414  !s->input_views[1]) {
415  ff_inlink_request_frame(ctx->inputs[1]);
416  return 0;
417  }
418 
419  return FFERROR_NOT_READY;
420 }
421 
422 #define OFFSET(x) offsetof(FramepackContext, x)
423 #define VF AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM
424 static const AVOption framepack_options[] = {
425  { "format", "Frame pack output format", OFFSET(format), AV_OPT_TYPE_INT,
426  { .i64 = AV_STEREO3D_SIDEBYSIDE }, 0, INT_MAX, .flags = VF, .unit = "format" },
427  { "sbs", "Views are packed next to each other", 0, AV_OPT_TYPE_CONST,
428  { .i64 = AV_STEREO3D_SIDEBYSIDE }, INT_MIN, INT_MAX, .flags = VF, .unit = "format" },
429  { "tab", "Views are packed on top of each other", 0, AV_OPT_TYPE_CONST,
430  { .i64 = AV_STEREO3D_TOPBOTTOM }, INT_MIN, INT_MAX, .flags = VF, .unit = "format" },
431  { "frameseq", "Views are one after the other", 0, AV_OPT_TYPE_CONST,
432  { .i64 = AV_STEREO3D_FRAMESEQUENCE }, INT_MIN, INT_MAX, .flags = VF, .unit = "format" },
433  { "lines", "Views are interleaved by lines", 0, AV_OPT_TYPE_CONST,
434  { .i64 = AV_STEREO3D_LINES }, INT_MIN, INT_MAX, .flags = VF, .unit = "format" },
435  { "columns", "Views are interleaved by columns", 0, AV_OPT_TYPE_CONST,
436  { .i64 = AV_STEREO3D_COLUMNS }, INT_MIN, INT_MAX, .flags = VF, .unit = "format" },
437  { NULL },
438 };
439 
440 AVFILTER_DEFINE_CLASS(framepack);
441 
442 static const AVFilterPad framepack_inputs[] = {
443  {
444  .name = "left",
445  .type = AVMEDIA_TYPE_VIDEO,
446  },
447  {
448  .name = "right",
449  .type = AVMEDIA_TYPE_VIDEO,
450  },
451 };
452 
453 static const AVFilterPad framepack_outputs[] = {
454  {
455  .name = "packed",
456  .type = AVMEDIA_TYPE_VIDEO,
457  .config_props = config_output,
458  },
459 };
460 
462  .name = "framepack",
463  .description = NULL_IF_CONFIG_SMALL("Generate a frame packed stereoscopic video."),
464  .priv_size = sizeof(FramepackContext),
465  .priv_class = &framepack_class,
469  .activate = activate,
470  .uninit = framepack_uninit,
471 };
ff_get_video_buffer
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
Definition: video.c:98
AV_PIX_FMT_YUVA422P16
#define AV_PIX_FMT_YUVA422P16
Definition: pixfmt.h:447
AV_PIX_FMT_GBRAP16
#define AV_PIX_FMT_GBRAP16
Definition: pixfmt.h:426
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
AV_STEREO3D_VIEW_LEFT
@ AV_STEREO3D_VIEW_LEFT
Frame contains only the left view.
Definition: stereo3d.h:156
AVERROR
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
opt.h
out
FILE * out
Definition: movenc.c:54
ff_filter_frame
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1018
spatial_frame_pack
static av_always_inline void spatial_frame_pack(AVFilterLink *outlink, AVFrame *dst)
Definition: vf_framepack.c:297
av_pix_fmt_desc_get
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2660
FFERROR_NOT_READY
return FFERROR_NOT_READY
Definition: filter_design.txt:204
FILTER_PIXFMTS_ARRAY
#define FILTER_PIXFMTS_ARRAY(array)
Definition: internal.h:171
rational.h
framepack_outputs
static const AVFilterPad framepack_outputs[]
Definition: vf_framepack.c:453
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:109
AV_PIX_FMT_YUVA422P9
#define AV_PIX_FMT_YUVA422P9
Definition: pixfmt.h:439
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:317
pixdesc.h
AV_PIX_FMT_YUVA420P16
#define AV_PIX_FMT_YUVA420P16
Definition: pixfmt.h:446
AV_PIX_FMT_YUVA420P10
#define AV_PIX_FMT_YUVA420P10
Definition: pixfmt.h:441
AVOption
AVOption.
Definition: opt.h:247
RIGHT
#define RIGHT
Definition: vf_framepack.c:42
AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:404
AV_PIX_FMT_YUV440P
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition: pixfmt.h:99
try_push_frame
static int try_push_frame(AVFilterContext *ctx)
Definition: vf_framepack.c:318
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:169
video.h
AV_PIX_FMT_YUVA422P10
#define AV_PIX_FMT_YUVA422P10
Definition: pixfmt.h:442
AV_STEREO3D_VIEW_RIGHT
@ AV_STEREO3D_VIEW_RIGHT
Frame contains only the right view.
Definition: stereo3d.h:161
AV_PIX_FMT_GRAY9
#define AV_PIX_FMT_GRAY9
Definition: pixfmt.h:384
formats.h
AV_STEREO3D_SIDEBYSIDE
@ AV_STEREO3D_SIDEBYSIDE
Views are next to each other.
Definition: stereo3d.h:67
ff_inlink_consume_frame
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:1417
AV_PIX_FMT_YUVA420P9
#define AV_PIX_FMT_YUVA420P9
Definition: pixfmt.h:438
FramepackContext
Definition: vf_framepack.c:44
FF_FILTER_FORWARD_STATUS_BACK_ALL
#define FF_FILTER_FORWARD_STATUS_BACK_ALL(outlink, filter)
Forward the status on an output link to all input links.
Definition: filters.h:212
AV_PIX_FMT_GBRP14
#define AV_PIX_FMT_GBRP14
Definition: pixfmt.h:422
AV_PIX_FMT_GBRAP
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
Definition: pixfmt.h:205
AVFilterContext::priv
void * priv
private data for use by the filter
Definition: avfilter.h:417
AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_GBRP10
Definition: pixfmt.h:420
AV_PIX_FMT_YUVA444P16
#define AV_PIX_FMT_YUVA444P16
Definition: pixfmt.h:448
AV_PIX_FMT_YUV422P9
#define AV_PIX_FMT_YUV422P9
Definition: pixfmt.h:402
OFFSET
#define OFFSET(x)
Definition: vf_framepack.c:422
pts
static int64_t pts
Definition: transcode_aac.c:653
AV_PIX_FMT_GRAY16
#define AV_PIX_FMT_GRAY16
Definition: pixfmt.h:388
FramepackContext::depth
int depth
Definition: vf_framepack.c:47
AVRational::num
int num
Numerator.
Definition: rational.h:59
AVFilterPad
A filter pad used for either input or output.
Definition: internal.h:50
AV_PIX_FMT_YUV444P10
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:407
AV_PIX_FMT_YUVJ411P
@ AV_PIX_FMT_YUVJ411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
Definition: pixfmt.h:248
AV_STEREO3D_FRAMESEQUENCE
@ AV_STEREO3D_FRAMESEQUENCE
Views are alternated temporally.
Definition: stereo3d.h:92
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
av_cold
#define av_cold
Definition: attributes.h:90
vertical_frame_pack
static void vertical_frame_pack(AVFilterLink *outlink, AVFrame *out, int interleaved)
Definition: vf_framepack.c:258
AV_PIX_FMT_YUV422P16
#define AV_PIX_FMT_YUV422P16
Definition: pixfmt.h:416
AV_PIX_FMT_YUVJ422P
@ AV_PIX_FMT_YUVJ422P
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
Definition: pixfmt.h:79
AV_PIX_FMT_GBRAP10
#define AV_PIX_FMT_GBRAP10
Definition: pixfmt.h:424
ff_inlink_request_frame
void ff_inlink_request_frame(AVFilterLink *link)
Mark that a frame is wanted on the link.
Definition: avfilter.c:1534
width
#define width
AV_STEREO3D_LINES
@ AV_STEREO3D_LINES
Views are packed per line, as if interlaced.
Definition: stereo3d.h:129
stereo3d.h
s
#define s(width, name)
Definition: cbs_vp9.c:257
AV_PIX_FMT_GBRAP12
#define AV_PIX_FMT_GBRAP12
Definition: pixfmt.h:425
AV_PIX_FMT_YUVA420P
@ AV_PIX_FMT_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Definition: pixfmt.h:101
AV_PIX_FMT_YUV444P16
#define AV_PIX_FMT_YUV444P16
Definition: pixfmt.h:417
AV_CEIL_RSHIFT
#define AV_CEIL_RSHIFT(a, b)
Definition: common.h:51
filters.h
AV_PIX_FMT_YUVA444P12
#define AV_PIX_FMT_YUVA444P12
Definition: pixfmt.h:445
AV_PIX_FMT_YUV420P9
#define AV_PIX_FMT_YUV420P9
Definition: pixfmt.h:401
AV_PIX_FMT_YUV420P16
#define AV_PIX_FMT_YUV420P16
Definition: pixfmt.h:415
ctx
AVFormatContext * ctx
Definition: movenc.c:48
AVFILTER_DEFINE_CLASS
AVFILTER_DEFINE_CLASS(framepack)
AV_PIX_FMT_GRAY14
#define AV_PIX_FMT_GRAY14
Definition: pixfmt.h:387
av_rescale_q
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
Definition: mathematics.c:141
AV_PIX_FMT_YUV420P
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:66
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:191
AV_PIX_FMT_YUVJ444P
@ AV_PIX_FMT_YUVJ444P
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
Definition: pixfmt.h:80
AV_PIX_FMT_GRAY10
#define AV_PIX_FMT_GRAY10
Definition: pixfmt.h:385
AV_PIX_FMT_GBRP16
#define AV_PIX_FMT_GBRP16
Definition: pixfmt.h:423
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
NULL
#define NULL
Definition: coverity.c:32
av_frame_copy_props
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
Definition: frame.c:537
FramepackContext::input_views
AVFrame * input_views[2]
input frames
Definition: vf_framepack.c:52
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
horizontal_frame_pack
static void horizontal_frame_pack(AVFilterLink *outlink, AVFrame *out, int interleaved)
Definition: vf_framepack.c:157
AV_PIX_FMT_YUVJ420P
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
Definition: pixfmt.h:78
src
#define src
Definition: vp8dsp.c:255
AV_PIX_FMT_YUV440P10
#define AV_PIX_FMT_YUV440P10
Definition: pixfmt.h:406
AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:405
AV_PIX_FMT_GRAY8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:74
AV_PIX_FMT_GBRP9
#define AV_PIX_FMT_GBRP9
Definition: pixfmt.h:419
for
for(j=16;j >0;--j)
Definition: h264pred_template.c:469
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:117
ff_vf_framepack
const AVFilter ff_vf_framepack
Definition: vf_framepack.c:461
AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_YUV422P12
Definition: pixfmt.h:409
AV_NOPTS_VALUE
#define AV_NOPTS_VALUE
Undefined timestamp value.
Definition: avutil.h:248
FramepackContext::format
enum AVStereo3DType format
frame pack type output
Definition: vf_framepack.c:50
AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:411
format
ofilter format
Definition: ffmpeg_filter.c:172
activate
static int activate(AVFilterContext *ctx)
Definition: vf_framepack.c:379
LEFT
#define LEFT
Definition: vf_framepack.c:41
height
#define height
AV_PIX_FMT_YUVA444P
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition: pixfmt.h:167
AV_PIX_FMT_YUVA444P10
#define AV_PIX_FMT_YUVA444P10
Definition: pixfmt.h:443
internal.h
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:271
config_output
static int config_output(AVFilterLink *outlink)
Definition: vf_framepack.c:91
AV_PIX_FMT_GBRP12
#define AV_PIX_FMT_GBRP12
Definition: pixfmt.h:421
AV_STEREO3D_TOPBOTTOM
@ AV_STEREO3D_TOPBOTTOM
Views are on top of each other.
Definition: stereo3d.h:79
common.h
av_always_inline
#define av_always_inline
Definition: attributes.h:49
AV_PIX_FMT_YUVJ440P
@ AV_PIX_FMT_YUVJ440P
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range
Definition: pixfmt.h:100
av_inv_q
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
Definition: rational.h:159
AVFilterPad::name
const char * name
Pad name.
Definition: internal.h:56
framepack_uninit
static av_cold void framepack_uninit(AVFilterContext *ctx)
Definition: vf_framepack.c:82
VF
#define VF
Definition: vf_framepack.c:423
framepack_options
static const AVOption framepack_options[]
Definition: vf_framepack.c:424
AV_PIX_FMT_YUV444P9
#define AV_PIX_FMT_YUV444P9
Definition: pixfmt.h:403
av_cmp_q
static int av_cmp_q(AVRational a, AVRational b)
Compare two rationals.
Definition: rational.h:89
AVFilter
Filter definition.
Definition: avfilter.h:165
ret
ret
Definition: filter_design.txt:187
AV_STEREO3D_COLUMNS
@ AV_STEREO3D_COLUMNS
Views are packed per column.
Definition: stereo3d.h:141
AVStereo3D::type
enum AVStereo3DType type
How views are packed within the video.
Definition: stereo3d.h:180
AV_PIX_FMT_YUVA444P9
#define AV_PIX_FMT_YUVA444P9
Definition: pixfmt.h:440
AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUV420P12
Definition: pixfmt.h:408
AV_PIX_FMT_YUV422P14
#define AV_PIX_FMT_YUV422P14
Definition: pixfmt.h:413
FramepackContext::pix_desc
const AVPixFmtDescriptor * pix_desc
agreed pixel format
Definition: vf_framepack.c:48
av_image_copy
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:422
AVRational::den
int den
Denominator.
Definition: rational.h:60
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:65
AV_PIX_FMT_YUVA422P12
#define AV_PIX_FMT_YUVA422P12
Definition: pixfmt.h:444
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:224
avfilter.h
AV_PIX_FMT_YUV444P
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:71
ff_outlink_get_status
int ff_outlink_get_status(AVFilterLink *link)
Get the status on an output link.
Definition: avfilter.c:1557
AVFilterContext
An instance of a filter.
Definition: avfilter.h:402
AV_PIX_FMT_GBRP
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:158
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AV_PIX_FMT_YUV422P
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:70
av_stereo3d_create_side_data
AVStereo3D * av_stereo3d_create_side_data(AVFrame *frame)
Allocate a complete AVFrameSideData and add it to the frame.
Definition: stereo3d.c:33
AVPixFmtDescriptor
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:69
AVStereo3D::view
enum AVStereo3DView view
Determines which views are packed.
Definition: stereo3d.h:190
FF_FILTER_FORWARD_STATUS
FF_FILTER_FORWARD_STATUS(inlink, outlink)
framepack_inputs
static const AVFilterPad framepack_inputs[]
Definition: vf_framepack.c:442
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:192
AV_PIX_FMT_YUV411P
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition: pixfmt.h:73
imgutils.h
AVERROR_BUG
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
Definition: error.h:52
AVStereo3DType
AVStereo3DType
List of possible 3D Types.
Definition: stereo3d.h:51
AV_PIX_FMT_YUV410P
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition: pixfmt.h:72
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:28
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
AV_PIX_FMT_YUV440P12
#define AV_PIX_FMT_YUV440P12
Definition: pixfmt.h:410
ff_outlink_frame_wanted
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
AV_PIX_FMT_YUV444P14
#define AV_PIX_FMT_YUV444P14
Definition: pixfmt.h:414
AVStereo3D
Stereo 3D type: this structure describes how two videos are packed within a single video surface,...
Definition: stereo3d.h:176
AV_PIX_FMT_GRAY12
#define AV_PIX_FMT_GRAY12
Definition: pixfmt.h:386
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:233
AV_PIX_FMT_YUVA422P
@ AV_PIX_FMT_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
Definition: pixfmt.h:166
AV_PIX_FMT_YUV420P14
#define AV_PIX_FMT_YUV420P14
Definition: pixfmt.h:412
formats_supported
static enum AVPixelFormat formats_supported[]
Definition: vf_framepack.c:55