FFmpeg
Loading...
Searching...
No Matches
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 "video.h"
38
39#define LEFT 0
40#define RIGHT 1
41
42typedef struct FramepackContext {
43 const AVClass *class;
44
45 int depth;
46 const AVPixFmtDescriptor *pix_desc; ///< agreed pixel format
47
48 /* enum AVStereo3DType */
49 int format; ///< frame pack type output
50
51 AVFrame *input_views[2]; ///< input frames
53
80
82{
83 FramepackContext *s = ctx->priv;
84
85 // clean any leftover frame
86 av_frame_free(&s->input_views[LEFT]);
87 av_frame_free(&s->input_views[RIGHT]);
88}
89
90static int config_output(AVFilterLink *outlink)
91{
92 AVFilterContext *ctx = outlink->src;
93 FramepackContext *s = outlink->src->priv;
94 FilterLink *leftl = ff_filter_link(ctx->inputs[LEFT]);
95 FilterLink *rightl = ff_filter_link(ctx->inputs[RIGHT]);
96 FilterLink *ol = ff_filter_link(outlink);
97
98 int width = ctx->inputs[LEFT]->w;
99 int height = ctx->inputs[LEFT]->h;
100 AVRational time_base = ctx->inputs[LEFT]->time_base;
101 AVRational frame_rate = leftl->frame_rate;
102
103 // check size and fps match on the other input
104 if (width != ctx->inputs[RIGHT]->w ||
105 height != ctx->inputs[RIGHT]->h) {
107 "Left and right sizes differ (%dx%d vs %dx%d).\n",
108 width, height,
109 ctx->inputs[RIGHT]->w, ctx->inputs[RIGHT]->h);
110 return AVERROR_INVALIDDATA;
111 } else if (av_cmp_q(time_base, ctx->inputs[RIGHT]->time_base) != 0) {
113 "Left and right time bases differ (%d/%d vs %d/%d).\n",
114 time_base.num, time_base.den,
115 ctx->inputs[RIGHT]->time_base.num,
116 ctx->inputs[RIGHT]->time_base.den);
117 return AVERROR_INVALIDDATA;
118 } else if (av_cmp_q(frame_rate, rightl->frame_rate) != 0) {
120 "Left and right framerates differ (%d/%d vs %d/%d).\n",
121 frame_rate.num, frame_rate.den,
122 rightl->frame_rate.num,
123 rightl->frame_rate.den);
124 return AVERROR_INVALIDDATA;
125 }
126
127 s->pix_desc = av_pix_fmt_desc_get(outlink->format);
128 if (!s->pix_desc)
129 return AVERROR_BUG;
130 s->depth = s->pix_desc->comp[0].depth;
131
132 // modify output properties as needed
133 switch (s->format) {
135 time_base.den *= 2;
136 frame_rate.num *= 2;
137 break;
140 width *= 2;
141 break;
144 height *= 2;
145 break;
146 default:
147 av_log(ctx, AV_LOG_ERROR, "Unknown packing mode.\n");
148 return AVERROR_INVALIDDATA;
149 }
150
151 outlink->w = width;
152 outlink->h = height;
153 outlink->time_base = time_base;
154 ol->frame_rate = frame_rate;
155
156 return 0;
157}
158
160 AVFrame *out,
161 int interleaved)
162{
163 AVFilterContext *ctx = outlink->src;
164 FramepackContext *s = ctx->priv;
165 int i, plane;
166
167 if (interleaved && s->depth <= 8) {
168 const uint8_t *leftp = s->input_views[LEFT]->data[0];
169 const uint8_t *rightp = s->input_views[RIGHT]->data[0];
170 uint8_t *dstp = out->data[0];
171 int length = out->width / 2;
172 int lines = out->height;
173
174 for (plane = 0; plane < s->pix_desc->nb_components; plane++) {
175 if (plane == 1 || plane == 2) {
176 length = AV_CEIL_RSHIFT(out->width / 2, s->pix_desc->log2_chroma_w);
177 lines = AV_CEIL_RSHIFT(out->height, s->pix_desc->log2_chroma_h);
178 }
179 for (i = 0; i < lines; i++) {
180 int j;
181 leftp = s->input_views[LEFT]->data[plane] +
182 s->input_views[LEFT]->linesize[plane] * i;
183 rightp = s->input_views[RIGHT]->data[plane] +
184 s->input_views[RIGHT]->linesize[plane] * i;
185 dstp = out->data[plane] + out->linesize[plane] * i;
186 for (j = 0; j < length; j++) {
187 // interpolate chroma as necessary
188 if ((s->pix_desc->log2_chroma_w ||
189 s->pix_desc->log2_chroma_h) &&
190 (plane == 1 || plane == 2)) {
191 *dstp++ = (*leftp + *rightp) / 2;
192 *dstp++ = (*leftp + *rightp) / 2;
193 } else {
194 *dstp++ = *leftp;
195 *dstp++ = *rightp;
196 }
197 leftp += 1;
198 rightp += 1;
199 }
200 }
201 }
202 } else if (interleaved && s->depth > 8) {
203 const uint16_t *leftp = (const uint16_t *)s->input_views[LEFT]->data[0];
204 const uint16_t *rightp = (const uint16_t *)s->input_views[RIGHT]->data[0];
205 uint16_t *dstp = (uint16_t *)out->data[0];
206 int length = out->width / 2;
207 int lines = out->height;
208
209 for (plane = 0; plane < s->pix_desc->nb_components; plane++) {
210 if (plane == 1 || plane == 2) {
211 length = AV_CEIL_RSHIFT(out->width / 2, s->pix_desc->log2_chroma_w);
212 lines = AV_CEIL_RSHIFT(out->height, s->pix_desc->log2_chroma_h);
213 }
214 for (i = 0; i < lines; i++) {
215 int j;
216 leftp = (const uint16_t *)s->input_views[LEFT]->data[plane] +
217 s->input_views[LEFT]->linesize[plane] * i / 2;
218 rightp = (const uint16_t *)s->input_views[RIGHT]->data[plane] +
219 s->input_views[RIGHT]->linesize[plane] * i / 2;
220 dstp = (uint16_t *)out->data[plane] + out->linesize[plane] * i / 2;
221 for (j = 0; j < length; j++) {
222 // interpolate chroma as necessary
223 if ((s->pix_desc->log2_chroma_w ||
224 s->pix_desc->log2_chroma_h) &&
225 (plane == 1 || plane == 2)) {
226 *dstp++ = (*leftp + *rightp) / 2;
227 *dstp++ = (*leftp + *rightp) / 2;
228 } else {
229 *dstp++ = *leftp;
230 *dstp++ = *rightp;
231 }
232 leftp += 1;
233 rightp += 1;
234 }
235 }
236 }
237 } else {
238 for (i = 0; i < 2; i++) {
239 const AVFrame *const input_view = s->input_views[i];
240 const int psize = 1 + (s->depth > 8);
241 uint8_t *dst[4];
242 int sub_w = psize * input_view->width >> s->pix_desc->log2_chroma_w;
243
244 dst[0] = out->data[0] + i * input_view->width * psize;
245 dst[1] = out->data[1] + i * sub_w;
246 dst[2] = out->data[2] + i * sub_w;
247
248 av_image_copy2(dst, out->linesize,
249 input_view->data, input_view->linesize,
250 input_view->format,
251 input_view->width,
252 input_view->height);
253 }
254 }
255}
256
258 AVFrame *out,
259 int interleaved)
260{
261 AVFilterContext *ctx = outlink->src;
262 FramepackContext *s = ctx->priv;
263 int i;
264
265 for (i = 0; i < 2; i++) {
266 const AVFrame *const input_view = s->input_views[i];
267 uint8_t *dst[4];
268 int linesizes[4];
269 int sub_h = input_view->height >> s->pix_desc->log2_chroma_h;
270
271 dst[0] = out->data[0] + i * out->linesize[0] *
272 (interleaved + input_view->height * (1 - interleaved));
273 dst[1] = out->data[1] + i * out->linesize[1] *
274 (interleaved + sub_h * (1 - interleaved));
275 dst[2] = out->data[2] + i * out->linesize[2] *
276 (interleaved + sub_h * (1 - interleaved));
277
278 linesizes[0] = out->linesize[0] +
279 interleaved * out->linesize[0];
280 linesizes[1] = out->linesize[1] +
281 interleaved * out->linesize[1];
282 linesizes[2] = out->linesize[2] +
283 interleaved * out->linesize[2];
284
285 av_image_copy2(dst, linesizes,
286 input_view->data, input_view->linesize,
287 input_view->format,
288 input_view->width,
289 input_view->height);
290 }
291}
292
294 AVFrame *dst)
295{
296 AVFilterContext *ctx = outlink->src;
297 FramepackContext *s = ctx->priv;
298 switch (s->format) {
300 horizontal_frame_pack(outlink, dst, 0);
301 break;
303 horizontal_frame_pack(outlink, dst, 1);
304 break;
306 vertical_frame_pack(outlink, dst, 0);
307 break;
309 vertical_frame_pack(outlink, dst, 1);
310 break;
311 }
312}
313
315{
316 FramepackContext *s = ctx->priv;
317 AVFilterLink *outlink = ctx->outputs[0];
318 FilterLink *l = ff_filter_link(outlink);
319 AVStereo3D *stereo;
320 int ret, i;
321
322 if (!(s->input_views[0] && s->input_views[1]))
323 return 0;
324 if (s->format == AV_STEREO3D_FRAMESEQUENCE) {
325 int64_t pts = s->input_views[0]->pts;
326
327 for (i = 0; i < 2; i++) {
328 // set correct timestamps
329 if (pts != AV_NOPTS_VALUE) {
330 s->input_views[i]->pts = i == 0 ? pts * 2 : pts * 2 + av_rescale_q(1, av_inv_q(l->frame_rate), outlink->time_base);
331 s->input_views[i]->duration = av_rescale_q(1, av_inv_q(l->frame_rate), outlink->time_base);
332 }
333
334 // set stereo3d side data
335 stereo = av_stereo3d_create_side_data(s->input_views[i]);
336 if (!stereo)
337 return AVERROR(ENOMEM);
338 stereo->type = s->format;
339 stereo->view = i == LEFT ? AV_STEREO3D_VIEW_LEFT
341
342 // filter the frame and immediately relinquish its pointer
343 ret = ff_filter_frame(outlink, s->input_views[i]);
344 s->input_views[i] = NULL;
345 if (ret < 0)
346 return ret;
347 }
348 return ret;
349 } else {
350 AVFrame *dst = ff_get_video_buffer(outlink, outlink->w, outlink->h);
351 if (!dst)
352 return AVERROR(ENOMEM);
353
354 spatial_frame_pack(outlink, dst);
355
356 // get any property from the original frame
357 ret = av_frame_copy_props(dst, s->input_views[LEFT]);
358 if (ret < 0) {
360 return ret;
361 }
362
363 for (i = 0; i < 2; i++)
364 av_frame_free(&s->input_views[i]);
365
366 // set stereo3d side data
368 if (!stereo) {
370 return AVERROR(ENOMEM);
371 }
372 stereo->type = s->format;
373
374 return ff_filter_frame(outlink, dst);
375 }
376}
377
379{
380 AVFilterLink *outlink = ctx->outputs[0];
381 FramepackContext *s = ctx->priv;
382 int ret;
383
385
386 if (!s->input_views[0]) {
387 ret = ff_inlink_consume_frame(ctx->inputs[0], &s->input_views[0]);
388 if (ret < 0)
389 return ret;
390 }
391
392 if (!s->input_views[1]) {
393 ret = ff_inlink_consume_frame(ctx->inputs[1], &s->input_views[1]);
394 if (ret < 0)
395 return ret;
396 }
397
398 if (s->input_views[0] && s->input_views[1])
399 return try_push_frame(ctx);
400
401 FF_FILTER_FORWARD_STATUS(ctx->inputs[0], outlink);
402 FF_FILTER_FORWARD_STATUS(ctx->inputs[1], outlink);
403
404 if (ff_outlink_frame_wanted(ctx->outputs[0]) &&
405 !s->input_views[0]) {
406 ff_inlink_request_frame(ctx->inputs[0]);
407 return 0;
408 }
409
410 if (ff_outlink_frame_wanted(ctx->outputs[0]) &&
411 !s->input_views[1]) {
412 ff_inlink_request_frame(ctx->inputs[1]);
413 return 0;
414 }
415
416 return FFERROR_NOT_READY;
417}
418
419#define OFFSET(x) offsetof(FramepackContext, x)
420#define VF AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM
421static const AVOption framepack_options[] = {
422 { "format", "Frame pack output format", OFFSET(format), AV_OPT_TYPE_INT,
423 { .i64 = AV_STEREO3D_SIDEBYSIDE }, 0, INT_MAX, .flags = VF, .unit = "format" },
424 { "sbs", "Views are packed next to each other", 0, AV_OPT_TYPE_CONST,
425 { .i64 = AV_STEREO3D_SIDEBYSIDE }, INT_MIN, INT_MAX, .flags = VF, .unit = "format" },
426 { "tab", "Views are packed on top of each other", 0, AV_OPT_TYPE_CONST,
427 { .i64 = AV_STEREO3D_TOPBOTTOM }, INT_MIN, INT_MAX, .flags = VF, .unit = "format" },
428 { "frameseq", "Views are one after the other", 0, AV_OPT_TYPE_CONST,
429 { .i64 = AV_STEREO3D_FRAMESEQUENCE }, INT_MIN, INT_MAX, .flags = VF, .unit = "format" },
430 { "lines", "Views are interleaved by lines", 0, AV_OPT_TYPE_CONST,
431 { .i64 = AV_STEREO3D_LINES }, INT_MIN, INT_MAX, .flags = VF, .unit = "format" },
432 { "columns", "Views are interleaved by columns", 0, AV_OPT_TYPE_CONST,
433 { .i64 = AV_STEREO3D_COLUMNS }, INT_MIN, INT_MAX, .flags = VF, .unit = "format" },
434 { NULL },
435};
436
438
440 {
441 .name = "left",
442 .type = AVMEDIA_TYPE_VIDEO,
443 },
444 {
445 .name = "right",
446 .type = AVMEDIA_TYPE_VIDEO,
447 },
448};
449
451 {
452 .name = "packed",
453 .type = AVMEDIA_TYPE_VIDEO,
454 .config_props = config_output,
455 },
456};
457
459 .p.name = "framepack",
460 .p.description = NULL_IF_CONFIG_SMALL("Generate a frame packed stereoscopic video."),
461 .p.priv_class = &framepack_class,
462 .priv_size = sizeof(FramepackContext),
466 .activate = activate,
467 .uninit = framepack_uninit,
468};
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition dsp.h:87
static const char *const format[]
Definition af_aiir.c:444
const FFFilter ff_vf_framepack
static FILE * out
static AVFormatContext * ctx
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition avfilter.c:1068
int ff_outlink_frame_wanted(AVFilterLink *link)
Test if a frame is wanted on an output link.
Definition avfilter.c:1690
int ff_inlink_consume_frame(AVFilterLink *link, AVFrame **rframe)
Take a frame from the link's FIFO and update the link's stats.
Definition avfilter.c:1520
void ff_inlink_request_frame(AVFilterLink *link)
Mark that a frame is wanted on the link.
Definition avfilter.c:1623
Main libavfilter public API header.
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
#define s(width, name)
Definition cbs_vp9.c:198
#define LEFT
Definition cdgraphics.c:168
#define RIGHT
Definition cdgraphics.c:169
common internal and external API header
#define AV_CEIL_RSHIFT(a, b)
Definition common.h:60
#define NULL
Definition coverity.c:32
long long int64_t
Definition coverity.c:34
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition opt.h:298
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
Definition error.h:52
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition error.h:61
#define AVERROR(e)
Definition error.h:45
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition frame.c:64
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
Definition frame.c:599
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition log.h:210
static int av_cmp_q(AVRational a, AVRational b)
Compare two rationals.
Definition rational.h:89
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
Definition rational.h:159
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
static void av_image_copy2(uint8_t *const dst_data[4], const int dst_linesizes[4], uint8_t *const src_data[4], const int src_linesizes[4], enum AVPixelFormat pix_fmt, int width, int height)
Wrapper around av_image_copy() to workaround the limitation that the conversion from uint8_t * const ...
Definition imgutils.h:184
#define AV_NOPTS_VALUE
Undefined timestamp value.
Definition avutil.h:247
AVStereo3D * av_stereo3d_create_side_data(AVFrame *frame)
Allocate a complete AVFrameSideData and add it to the frame.
Definition stereo3d.c:54
@ AV_STEREO3D_COLUMNS
Views are packed per column.
Definition stereo3d.h:138
@ AV_STEREO3D_LINES
Views are packed per line, as if interlaced.
Definition stereo3d.h:126
@ AV_STEREO3D_TOPBOTTOM
Views are on top of each other.
Definition stereo3d.h:76
@ AV_STEREO3D_FRAMESEQUENCE
Views are alternated temporally.
Definition stereo3d.h:89
@ AV_STEREO3D_SIDEBYSIDE
Views are next to each other.
Definition stereo3d.h:64
@ AV_STEREO3D_VIEW_RIGHT
Frame contains only the right view.
Definition stereo3d.h:163
@ AV_STEREO3D_VIEW_LEFT
Frame contains only the left view.
Definition stereo3d.h:158
misc image utilities
static int activate(AVBitStreamFilterContext *ctx)
static int config_output(AVBitStreamFilterLink *outlink)
#define VF
Definition af_afir.c:731
#define FILTER_INPUTS(array)
Definition filters.h:264
#define FILTER_OUTPUTS(array)
Definition filters.h:265
#define FILTER_PIXFMTS_ARRAY(array)
Definition filters.h:244
#define FF_FILTER_FORWARD_STATUS(inlink, outlink)
Acknowledge the status on an input link and forward it to an output link.
Definition filters.h:666
#define FFERROR_NOT_READY
Filters implementation helper functions and internal structures.
Definition filters.h:34
#define FF_FILTER_FORWARD_STATUS_BACK_ALL(outlink, filter)
Forward the status on an output link to all input links.
Definition filters.h:652
static FilterLink * ff_filter_link(AVFilterLink *link)
Definition filters.h:199
#define AVFILTER_DEFINE_CLASS(fname)
Definition filters.h:478
#define av_always_inline
Definition attributes.h:72
#define av_cold
Definition attributes.h:117
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition internal.h:88
Stereoscopic video.
AVOptions.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition pixdesc.c:3460
#define AV_PIX_FMT_GBRAP12
Definition pixfmt.h:569
#define AV_PIX_FMT_YUV420P16
Definition pixfmt.h:556
#define AV_PIX_FMT_YUV444P12
Definition pixfmt.h:552
#define AV_PIX_FMT_YUV444P9
Definition pixfmt.h:544
#define AV_PIX_FMT_YUV420P10
Definition pixfmt.h:545
#define AV_PIX_FMT_YUV440P12
Definition pixfmt.h:551
#define AV_PIX_FMT_GRAY9
Definition pixfmt.h:524
#define AV_PIX_FMT_GBRAP16
Definition pixfmt.h:571
#define AV_PIX_FMT_GBRP9
Definition pixfmt.h:563
#define AV_PIX_FMT_YUV422P9
Definition pixfmt.h:543
#define AV_PIX_FMT_YUVA444P10
Definition pixfmt.h:598
#define AV_PIX_FMT_YUVA420P16
Definition pixfmt.h:601
#define AV_PIX_FMT_YUV420P12
Definition pixfmt.h:549
#define AV_PIX_FMT_YUVA420P10
Definition pixfmt.h:596
#define AV_PIX_FMT_YUVA422P9
Definition pixfmt.h:594
#define AV_PIX_FMT_YUV422P12
Definition pixfmt.h:550
#define AV_PIX_FMT_GBRP10
Definition pixfmt.h:564
#define AV_PIX_FMT_YUV422P10
Definition pixfmt.h:546
#define AV_PIX_FMT_GRAY12
Definition pixfmt.h:526
#define AV_PIX_FMT_GBRP12
Definition pixfmt.h:565
#define AV_PIX_FMT_YUV420P9
Definition pixfmt.h:542
#define AV_PIX_FMT_YUVA420P9
Definition pixfmt.h:593
#define AV_PIX_FMT_YUVA422P10
Definition pixfmt.h:597
#define AV_PIX_FMT_YUV420P14
Definition pixfmt.h:553
AVPixelFormat
Pixel format.
Definition pixfmt.h:71
@ AV_PIX_FMT_NONE
Definition pixfmt.h:72
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition pixfmt.h:73
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition pixfmt.h:106
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition pixfmt.h:77
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition pixfmt.h:81
@ AV_PIX_FMT_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Definition pixfmt.h:108
@ 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:107
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition pixfmt.h:79
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition pixfmt.h:80
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition pixfmt.h:78
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition pixfmt.h:174
@ 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:283
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
Definition pixfmt.h:212
@ 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:86
@ AV_PIX_FMT_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
Definition pixfmt.h:173
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
Definition pixfmt.h:165
@ 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:87
@ 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:85
#define AV_PIX_FMT_YUVA422P12
Definition pixfmt.h:599
#define AV_PIX_FMT_YUV422P14
Definition pixfmt.h:554
#define AV_PIX_FMT_GRAY10
Definition pixfmt.h:525
#define AV_PIX_FMT_GRAY14
Definition pixfmt.h:527
#define AV_PIX_FMT_YUV422P16
Definition pixfmt.h:557
#define AV_PIX_FMT_YUV440P10
Definition pixfmt.h:547
#define AV_PIX_FMT_GRAY16
Definition pixfmt.h:528
#define AV_PIX_FMT_GBRAP10
Definition pixfmt.h:568
#define AV_PIX_FMT_YUVA444P16
Definition pixfmt.h:603
#define AV_PIX_FMT_YUVA422P16
Definition pixfmt.h:602
#define AV_PIX_FMT_GBRP16
Definition pixfmt.h:567
#define AV_PIX_FMT_YUV444P14
Definition pixfmt.h:555
#define AV_PIX_FMT_YUVA444P9
Definition pixfmt.h:595
#define AV_PIX_FMT_GBRP14
Definition pixfmt.h:566
#define AV_PIX_FMT_YUVA444P12
Definition pixfmt.h:600
#define AV_PIX_FMT_YUV444P16
Definition pixfmt.h:558
#define AV_PIX_FMT_YUV444P10
Definition pixfmt.h:548
Utilities for rational number calculation.
Describe the class of an AVClass context structure.
Definition log.h:76
An instance of a filter.
Definition avfilter.h:273
void * priv
private data for use by the filter
Definition avfilter.h:288
A filter pad used for either input or output.
Definition filters.h:40
This structure describes decoded (raw) audio or video data.
Definition frame.h:472
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition frame.h:493
int width
Definition frame.h:544
int height
Definition frame.h:544
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
Definition frame.h:517
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
Definition frame.h:559
AVOption.
Definition opt.h:428
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition pixdesc.h:69
Rational number (pair of numerator and denominator).
Definition rational.h:58
int num
Numerator.
Definition rational.h:59
int den
Denominator.
Definition rational.h:60
Stereo 3D type: this structure describes how two videos are packed within a single video surface,...
Definition stereo3d.h:203
enum AVStereo3DType type
How views are packed within the video.
Definition stereo3d.h:207
enum AVStereo3DView view
Determines which views are packed.
Definition stereo3d.h:217
const AVPixFmtDescriptor * pix_desc
agreed pixel format
AVFrame * input_views[2]
input frames
int format
frame pack type output
#define av_log(a,...)
#define height
Definition dsp.h:89
#define width
Definition dsp.h:89
static int64_t pts
static const AVFilterPad framepack_inputs[]
static const AVOption framepack_options[]
static const AVFilterPad framepack_outputs[]
static void horizontal_frame_pack(AVFilterLink *outlink, AVFrame *out, int interleaved)
static enum AVPixelFormat formats_supported[]
static int activate(AVFilterContext *ctx)
#define OFFSET(x)
static int config_output(AVFilterLink *outlink)
static av_always_inline void spatial_frame_pack(AVFilterLink *outlink, AVFrame *dst)
static int try_push_frame(AVFilterContext *ctx)
static av_cold void framepack_uninit(AVFilterContext *ctx)
static void vertical_frame_pack(AVFilterLink *outlink, AVFrame *out, int interleaved)
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
Definition video.c:89