FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavfilter/vf_framepack.c
Date: 2026-04-30 18:27:06
Exec Total Coverage
Lines: 175 224 78.1%
Functions: 7 7 100.0%
Branches: 72 123 58.5%

Line Branch Exec Source
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
42 typedef 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
52 } FramepackContext;
53
54 static const enum AVPixelFormat formats_supported[] = {
55 AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY9,
56 AV_PIX_FMT_GRAY10, AV_PIX_FMT_GRAY12, AV_PIX_FMT_GRAY14,
57 AV_PIX_FMT_GRAY16,
58 AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUV411P,
59 AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P,
60 AV_PIX_FMT_YUV440P, AV_PIX_FMT_YUV444P,
61 AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P,
62 AV_PIX_FMT_YUVJ440P, AV_PIX_FMT_YUVJ444P,
63 AV_PIX_FMT_YUVJ411P,
64 AV_PIX_FMT_YUV420P9, AV_PIX_FMT_YUV422P9, AV_PIX_FMT_YUV444P9,
65 AV_PIX_FMT_YUV420P10, AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV444P10,
66 AV_PIX_FMT_YUV440P10,
67 AV_PIX_FMT_YUV444P12, AV_PIX_FMT_YUV422P12, AV_PIX_FMT_YUV420P12,
68 AV_PIX_FMT_YUV440P12,
69 AV_PIX_FMT_YUV444P14, AV_PIX_FMT_YUV422P14, AV_PIX_FMT_YUV420P14,
70 AV_PIX_FMT_YUV420P16, AV_PIX_FMT_YUV422P16, AV_PIX_FMT_YUV444P16,
71 AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRP9, AV_PIX_FMT_GBRP10,
72 AV_PIX_FMT_GBRP12, AV_PIX_FMT_GBRP14, AV_PIX_FMT_GBRP16,
73 AV_PIX_FMT_YUVA420P, AV_PIX_FMT_YUVA422P, AV_PIX_FMT_YUVA444P,
74 AV_PIX_FMT_YUVA444P9, AV_PIX_FMT_YUVA444P10, AV_PIX_FMT_YUVA444P12, AV_PIX_FMT_YUVA444P16,
75 AV_PIX_FMT_YUVA422P9, AV_PIX_FMT_YUVA422P10, AV_PIX_FMT_YUVA422P12, AV_PIX_FMT_YUVA422P16,
76 AV_PIX_FMT_YUVA420P9, AV_PIX_FMT_YUVA420P10, AV_PIX_FMT_YUVA420P16,
77 AV_PIX_FMT_GBRAP, AV_PIX_FMT_GBRAP10, AV_PIX_FMT_GBRAP12, AV_PIX_FMT_GBRAP16,
78 AV_PIX_FMT_NONE
79 };
80
81 10 static av_cold void framepack_uninit(AVFilterContext *ctx)
82 {
83 10 FramepackContext *s = ctx->priv;
84
85 // clean any leftover frame
86 10 av_frame_free(&s->input_views[LEFT]);
87 10 av_frame_free(&s->input_views[RIGHT]);
88 10 }
89
90 5 static int config_output(AVFilterLink *outlink)
91 {
92 5 AVFilterContext *ctx = outlink->src;
93 5 FramepackContext *s = outlink->src->priv;
94 5 FilterLink *leftl = ff_filter_link(ctx->inputs[LEFT]);
95 5 FilterLink *rightl = ff_filter_link(ctx->inputs[RIGHT]);
96 5 FilterLink *ol = ff_filter_link(outlink);
97
98 5 int width = ctx->inputs[LEFT]->w;
99 5 int height = ctx->inputs[LEFT]->h;
100 5 AVRational time_base = ctx->inputs[LEFT]->time_base;
101 5 AVRational frame_rate = leftl->frame_rate;
102
103 // check size and fps match on the other input
104
1/2
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
5 if (width != ctx->inputs[RIGHT]->w ||
105
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
5 height != ctx->inputs[RIGHT]->h) {
106 av_log(ctx, AV_LOG_ERROR,
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
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
5 } else if (av_cmp_q(time_base, ctx->inputs[RIGHT]->time_base) != 0) {
112 av_log(ctx, AV_LOG_ERROR,
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
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
5 } else if (av_cmp_q(frame_rate, rightl->frame_rate) != 0) {
119 av_log(ctx, AV_LOG_ERROR,
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 5 s->pix_desc = av_pix_fmt_desc_get(outlink->format);
128
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
5 if (!s->pix_desc)
129 return AVERROR_BUG;
130 5 s->depth = s->pix_desc->comp[0].depth;
131
132 // modify output properties as needed
133
3/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
5 switch (s->format) {
134 1 case AV_STEREO3D_FRAMESEQUENCE:
135 1 time_base.den *= 2;
136 1 frame_rate.num *= 2;
137 1 break;
138 2 case AV_STEREO3D_COLUMNS:
139 case AV_STEREO3D_SIDEBYSIDE:
140 2 width *= 2;
141 2 break;
142 2 case AV_STEREO3D_LINES:
143 case AV_STEREO3D_TOPBOTTOM:
144 2 height *= 2;
145 2 break;
146 default:
147 av_log(ctx, AV_LOG_ERROR, "Unknown packing mode.\n");
148 return AVERROR_INVALIDDATA;
149 }
150
151 5 outlink->w = width;
152 5 outlink->h = height;
153 5 outlink->time_base = time_base;
154 5 ol->frame_rate = frame_rate;
155
156 5 return 0;
157 }
158
159 31 static void horizontal_frame_pack(AVFilterLink *outlink,
160 AVFrame *out,
161 int interleaved)
162 {
163 31 AVFilterContext *ctx = outlink->src;
164 31 FramepackContext *s = ctx->priv;
165 int i, plane;
166
167
3/4
✓ Branch 0 taken 16 times.
✓ Branch 1 taken 15 times.
✓ Branch 2 taken 16 times.
✗ Branch 3 not taken.
47 if (interleaved && s->depth <= 8) {
168 16 const uint8_t *leftp = s->input_views[LEFT]->data[0];
169 16 const uint8_t *rightp = s->input_views[RIGHT]->data[0];
170 16 uint8_t *dstp = out->data[0];
171 16 int length = out->width / 2;
172 16 int lines = out->height;
173
174
2/2
✓ Branch 0 taken 48 times.
✓ Branch 1 taken 16 times.
64 for (plane = 0; plane < s->pix_desc->nb_components; plane++) {
175
4/4
✓ Branch 0 taken 32 times.
✓ Branch 1 taken 16 times.
✓ Branch 2 taken 16 times.
✓ Branch 3 taken 16 times.
48 if (plane == 1 || plane == 2) {
176 32 length = AV_CEIL_RSHIFT(out->width / 2, s->pix_desc->log2_chroma_w);
177 32 lines = AV_CEIL_RSHIFT(out->height, s->pix_desc->log2_chroma_h);
178 }
179
2/2
✓ Branch 0 taken 9216 times.
✓ Branch 1 taken 48 times.
9264 for (i = 0; i < lines; i++) {
180 int j;
181 9216 leftp = s->input_views[LEFT]->data[plane] +
182 9216 s->input_views[LEFT]->linesize[plane] * i;
183 9216 rightp = s->input_views[RIGHT]->data[plane] +
184 9216 s->input_views[RIGHT]->linesize[plane] * i;
185 9216 dstp = out->data[plane] + out->linesize[plane] * i;
186
2/2
✓ Branch 0 taken 2433024 times.
✓ Branch 1 taken 9216 times.
2442240 for (j = 0; j < length; j++) {
187 // interpolate chroma as necessary
188
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2433024 times.
2433024 if ((s->pix_desc->log2_chroma_w ||
189
2/4
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 2027520 times.
✓ Branch 3 taken 405504 times.
2433024 s->pix_desc->log2_chroma_h) &&
190
2/2
✓ Branch 0 taken 405504 times.
✓ Branch 1 taken 1622016 times.
2027520 (plane == 1 || plane == 2)) {
191 811008 *dstp++ = (*leftp + *rightp) / 2;
192 811008 *dstp++ = (*leftp + *rightp) / 2;
193 } else {
194 1622016 *dstp++ = *leftp;
195 1622016 *dstp++ = *rightp;
196 }
197 2433024 leftp += 1;
198 2433024 rightp += 1;
199 }
200 }
201 }
202
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 15 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
15 } 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
2/2
✓ Branch 0 taken 30 times.
✓ Branch 1 taken 15 times.
45 for (i = 0; i < 2; i++) {
239 30 const AVFrame *const input_view = s->input_views[i];
240
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 30 times.
30 const int psize = 1 + (s->depth > 8);
241 uint8_t *dst[4];
242 30 int sub_w = psize * input_view->width >> s->pix_desc->log2_chroma_w;
243
244 30 dst[0] = out->data[0] + i * input_view->width * psize;
245 30 dst[1] = out->data[1] + i * sub_w;
246 30 dst[2] = out->data[2] + i * sub_w;
247
248 30 av_image_copy2(dst, out->linesize,
249 30 input_view->data, input_view->linesize,
250 30 input_view->format,
251 30 input_view->width,
252 30 input_view->height);
253 }
254 }
255 31 }
256
257 30 static void vertical_frame_pack(AVFilterLink *outlink,
258 AVFrame *out,
259 int interleaved)
260 {
261 30 AVFilterContext *ctx = outlink->src;
262 30 FramepackContext *s = ctx->priv;
263 int i;
264
265
2/2
✓ Branch 0 taken 60 times.
✓ Branch 1 taken 30 times.
90 for (i = 0; i < 2; i++) {
266 60 const AVFrame *const input_view = s->input_views[i];
267 uint8_t *dst[4];
268 int linesizes[4];
269 60 int sub_h = input_view->height >> s->pix_desc->log2_chroma_h;
270
271 60 dst[0] = out->data[0] + i * out->linesize[0] *
272 60 (interleaved + input_view->height * (1 - interleaved));
273 60 dst[1] = out->data[1] + i * out->linesize[1] *
274 60 (interleaved + sub_h * (1 - interleaved));
275 60 dst[2] = out->data[2] + i * out->linesize[2] *
276 60 (interleaved + sub_h * (1 - interleaved));
277
278 60 linesizes[0] = out->linesize[0] +
279 60 interleaved * out->linesize[0];
280 60 linesizes[1] = out->linesize[1] +
281 60 interleaved * out->linesize[1];
282 60 linesizes[2] = out->linesize[2] +
283 60 interleaved * out->linesize[2];
284
285 60 av_image_copy2(dst, linesizes,
286 60 input_view->data, input_view->linesize,
287 60 input_view->format,
288 60 input_view->width,
289 60 input_view->height);
290 }
291 30 }
292
293 61 static av_always_inline void spatial_frame_pack(AVFilterLink *outlink,
294 AVFrame *dst)
295 {
296 61 AVFilterContext *ctx = outlink->src;
297 61 FramepackContext *s = ctx->priv;
298
4/5
✓ Branch 0 taken 15 times.
✓ Branch 1 taken 16 times.
✓ Branch 2 taken 15 times.
✓ Branch 3 taken 15 times.
✗ Branch 4 not taken.
61 switch (s->format) {
299 15 case AV_STEREO3D_SIDEBYSIDE:
300 15 horizontal_frame_pack(outlink, dst, 0);
301 15 break;
302 16 case AV_STEREO3D_COLUMNS:
303 16 horizontal_frame_pack(outlink, dst, 1);
304 16 break;
305 15 case AV_STEREO3D_TOPBOTTOM:
306 15 vertical_frame_pack(outlink, dst, 0);
307 15 break;
308 15 case AV_STEREO3D_LINES:
309 15 vertical_frame_pack(outlink, dst, 1);
310 15 break;
311 }
312 61 }
313
314 69 static int try_push_frame(AVFilterContext *ctx)
315 {
316 69 FramepackContext *s = ctx->priv;
317 69 AVFilterLink *outlink = ctx->outputs[0];
318 69 FilterLink *l = ff_filter_link(outlink);
319 AVStereo3D *stereo;
320 int ret, i;
321
322
2/4
✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 69 times.
69 if (!(s->input_views[0] && s->input_views[1]))
323 return 0;
324
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 61 times.
69 if (s->format == AV_STEREO3D_FRAMESEQUENCE) {
325 8 int64_t pts = s->input_views[0]->pts;
326
327
2/2
✓ Branch 0 taken 16 times.
✓ Branch 1 taken 8 times.
24 for (i = 0; i < 2; i++) {
328 // set correct timestamps
329
1/2
✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
16 if (pts != AV_NOPTS_VALUE) {
330
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 8 times.
16 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 16 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 16 stereo = av_stereo3d_create_side_data(s->input_views[i]);
336
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
16 if (!stereo)
337 return AVERROR(ENOMEM);
338 16 stereo->type = s->format;
339 16 stereo->view = i == LEFT ? AV_STEREO3D_VIEW_LEFT
340
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 8 times.
16 : AV_STEREO3D_VIEW_RIGHT;
341
342 // filter the frame and immediately relinquish its pointer
343 16 ret = ff_filter_frame(outlink, s->input_views[i]);
344 16 s->input_views[i] = NULL;
345
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
16 if (ret < 0)
346 return ret;
347 }
348 8 return ret;
349 } else {
350 61 AVFrame *dst = ff_get_video_buffer(outlink, outlink->w, outlink->h);
351
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 61 times.
61 if (!dst)
352 return AVERROR(ENOMEM);
353
354 61 spatial_frame_pack(outlink, dst);
355
356 // get any property from the original frame
357 61 ret = av_frame_copy_props(dst, s->input_views[LEFT]);
358
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 61 times.
61 if (ret < 0) {
359 av_frame_free(&dst);
360 return ret;
361 }
362
363
2/2
✓ Branch 0 taken 122 times.
✓ Branch 1 taken 61 times.
183 for (i = 0; i < 2; i++)
364 122 av_frame_free(&s->input_views[i]);
365
366 // set stereo3d side data
367 61 stereo = av_stereo3d_create_side_data(dst);
368
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 61 times.
61 if (!stereo) {
369 av_frame_free(&dst);
370 return AVERROR(ENOMEM);
371 }
372 61 stereo->type = s->format;
373
374 61 return ff_filter_frame(outlink, dst);
375 }
376 }
377
378 265 static int activate(AVFilterContext *ctx)
379 {
380 265 AVFilterLink *outlink = ctx->outputs[0];
381 265 FramepackContext *s = ctx->priv;
382 int ret;
383
384
1/4
✗ Branch 1 not taken.
✓ Branch 2 taken 265 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
265 FF_FILTER_FORWARD_STATUS_BACK_ALL(outlink, ctx);
385
386
2/2
✓ Branch 0 taken 176 times.
✓ Branch 1 taken 89 times.
265 if (!s->input_views[0]) {
387 176 ret = ff_inlink_consume_frame(ctx->inputs[0], &s->input_views[0]);
388
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 176 times.
176 if (ret < 0)
389 return ret;
390 }
391
392
2/2
✓ Branch 0 taken 206 times.
✓ Branch 1 taken 59 times.
265 if (!s->input_views[1]) {
393 206 ret = ff_inlink_consume_frame(ctx->inputs[1], &s->input_views[1]);
394
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 206 times.
206 if (ret < 0)
395 return ret;
396 }
397
398
4/4
✓ Branch 0 taken 161 times.
✓ Branch 1 taken 104 times.
✓ Branch 2 taken 69 times.
✓ Branch 3 taken 92 times.
265 if (s->input_views[0] && s->input_views[1])
399 69 return try_push_frame(ctx);
400
401
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 196 times.
196 FF_FILTER_FORWARD_STATUS(ctx->inputs[0], outlink);
402
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 196 times.
196 FF_FILTER_FORWARD_STATUS(ctx->inputs[1], outlink);
403
404
1/2
✓ Branch 1 taken 196 times.
✗ Branch 2 not taken.
196 if (ff_outlink_frame_wanted(ctx->outputs[0]) &&
405
2/2
✓ Branch 0 taken 104 times.
✓ Branch 1 taken 92 times.
196 !s->input_views[0]) {
406 104 ff_inlink_request_frame(ctx->inputs[0]);
407 104 return 0;
408 }
409
410
1/2
✓ Branch 1 taken 92 times.
✗ Branch 2 not taken.
92 if (ff_outlink_frame_wanted(ctx->outputs[0]) &&
411
1/2
✓ Branch 0 taken 92 times.
✗ Branch 1 not taken.
92 !s->input_views[1]) {
412 92 ff_inlink_request_frame(ctx->inputs[1]);
413 92 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
421 static 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
437 AVFILTER_DEFINE_CLASS(framepack);
438
439 static const AVFilterPad framepack_inputs[] = {
440 {
441 .name = "left",
442 .type = AVMEDIA_TYPE_VIDEO,
443 },
444 {
445 .name = "right",
446 .type = AVMEDIA_TYPE_VIDEO,
447 },
448 };
449
450 static const AVFilterPad framepack_outputs[] = {
451 {
452 .name = "packed",
453 .type = AVMEDIA_TYPE_VIDEO,
454 .config_props = config_output,
455 },
456 };
457
458 const FFFilter ff_vf_framepack = {
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),
463 FILTER_INPUTS(framepack_inputs),
464 FILTER_OUTPUTS(framepack_outputs),
465 FILTER_PIXFMTS_ARRAY(formats_supported),
466 .activate = activate,
467 .uninit = framepack_uninit,
468 };
469