FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavfilter/vf_framepack.c
Date: 2024-04-26 14:42:52
Exec Total Coverage
Lines: 171 222 77.0%
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 "internal.h"
38 #include "video.h"
39
40 #define LEFT 0
41 #define RIGHT 1
42
43 typedef struct FramepackContext {
44 const AVClass *class;
45
46 int depth;
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
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
95 5 int width = ctx->inputs[LEFT]->w;
96 5 int height = ctx->inputs[LEFT]->h;
97 5 AVRational time_base = ctx->inputs[LEFT]->time_base;
98 5 AVRational frame_rate = ctx->inputs[LEFT]->frame_rate;
99
100 // check size and fps match on the other input
101
1/2
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
5 if (width != ctx->inputs[RIGHT]->w ||
102
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
5 height != ctx->inputs[RIGHT]->h) {
103 av_log(ctx, AV_LOG_ERROR,
104 "Left and right sizes differ (%dx%d vs %dx%d).\n",
105 width, height,
106 ctx->inputs[RIGHT]->w, ctx->inputs[RIGHT]->h);
107 return AVERROR_INVALIDDATA;
108
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) {
109 av_log(ctx, AV_LOG_ERROR,
110 "Left and right time bases differ (%d/%d vs %d/%d).\n",
111 time_base.num, time_base.den,
112 ctx->inputs[RIGHT]->time_base.num,
113 ctx->inputs[RIGHT]->time_base.den);
114 return AVERROR_INVALIDDATA;
115
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
5 } else if (av_cmp_q(frame_rate, ctx->inputs[RIGHT]->frame_rate) != 0) {
116 av_log(ctx, AV_LOG_ERROR,
117 "Left and right framerates differ (%d/%d vs %d/%d).\n",
118 frame_rate.num, frame_rate.den,
119 ctx->inputs[RIGHT]->frame_rate.num,
120 ctx->inputs[RIGHT]->frame_rate.den);
121 return AVERROR_INVALIDDATA;
122 }
123
124 5 s->pix_desc = av_pix_fmt_desc_get(outlink->format);
125
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
5 if (!s->pix_desc)
126 return AVERROR_BUG;
127 5 s->depth = s->pix_desc->comp[0].depth;
128
129 // modify output properties as needed
130
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) {
131 1 case AV_STEREO3D_FRAMESEQUENCE:
132 1 time_base.den *= 2;
133 1 frame_rate.num *= 2;
134 1 break;
135 2 case AV_STEREO3D_COLUMNS:
136 case AV_STEREO3D_SIDEBYSIDE:
137 2 width *= 2;
138 2 break;
139 2 case AV_STEREO3D_LINES:
140 case AV_STEREO3D_TOPBOTTOM:
141 2 height *= 2;
142 2 break;
143 default:
144 av_log(ctx, AV_LOG_ERROR, "Unknown packing mode.\n");
145 return AVERROR_INVALIDDATA;
146 }
147
148 5 outlink->w = width;
149 5 outlink->h = height;
150 5 outlink->time_base = time_base;
151 5 outlink->frame_rate = frame_rate;
152
153 5 return 0;
154 }
155
156 30 static void horizontal_frame_pack(AVFilterLink *outlink,
157 AVFrame *out,
158 int interleaved)
159 {
160 30 AVFilterContext *ctx = outlink->src;
161 30 FramepackContext *s = ctx->priv;
162 int i, plane;
163
164
3/4
✓ Branch 0 taken 15 times.
✓ Branch 1 taken 15 times.
✓ Branch 2 taken 15 times.
✗ Branch 3 not taken.
45 if (interleaved && s->depth <= 8) {
165 15 const uint8_t *leftp = s->input_views[LEFT]->data[0];
166 15 const uint8_t *rightp = s->input_views[RIGHT]->data[0];
167 15 uint8_t *dstp = out->data[0];
168 15 int length = out->width / 2;
169 15 int lines = out->height;
170
171
2/2
✓ Branch 0 taken 45 times.
✓ Branch 1 taken 15 times.
60 for (plane = 0; plane < s->pix_desc->nb_components; plane++) {
172
4/4
✓ Branch 0 taken 30 times.
✓ Branch 1 taken 15 times.
✓ Branch 2 taken 15 times.
✓ Branch 3 taken 15 times.
45 if (plane == 1 || plane == 2) {
173 30 length = AV_CEIL_RSHIFT(out->width / 2, s->pix_desc->log2_chroma_w);
174 30 lines = AV_CEIL_RSHIFT(out->height, s->pix_desc->log2_chroma_h);
175 }
176
2/2
✓ Branch 0 taken 8640 times.
✓ Branch 1 taken 45 times.
8685 for (i = 0; i < lines; i++) {
177 int j;
178 8640 leftp = s->input_views[LEFT]->data[plane] +
179 8640 s->input_views[LEFT]->linesize[plane] * i;
180 8640 rightp = s->input_views[RIGHT]->data[plane] +
181 8640 s->input_views[RIGHT]->linesize[plane] * i;
182 8640 dstp = out->data[plane] + out->linesize[plane] * i;
183
2/2
✓ Branch 0 taken 2280960 times.
✓ Branch 1 taken 8640 times.
2289600 for (j = 0; j < length; j++) {
184 // interpolate chroma as necessary
185
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2280960 times.
2280960 if ((s->pix_desc->log2_chroma_w ||
186
2/4
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 1900800 times.
✓ Branch 3 taken 380160 times.
2280960 s->pix_desc->log2_chroma_h) &&
187
2/2
✓ Branch 0 taken 380160 times.
✓ Branch 1 taken 1520640 times.
1900800 (plane == 1 || plane == 2)) {
188 760320 *dstp++ = (*leftp + *rightp) / 2;
189 760320 *dstp++ = (*leftp + *rightp) / 2;
190 } else {
191 1520640 *dstp++ = *leftp;
192 1520640 *dstp++ = *rightp;
193 }
194 2280960 leftp += 1;
195 2280960 rightp += 1;
196 }
197 }
198 }
199
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) {
200 const uint16_t *leftp = (const uint16_t *)s->input_views[LEFT]->data[0];
201 const uint16_t *rightp = (const uint16_t *)s->input_views[RIGHT]->data[0];
202 uint16_t *dstp = (uint16_t *)out->data[0];
203 int length = out->width / 2;
204 int lines = out->height;
205
206 for (plane = 0; plane < s->pix_desc->nb_components; plane++) {
207 if (plane == 1 || plane == 2) {
208 length = AV_CEIL_RSHIFT(out->width / 2, s->pix_desc->log2_chroma_w);
209 lines = AV_CEIL_RSHIFT(out->height, s->pix_desc->log2_chroma_h);
210 }
211 for (i = 0; i < lines; i++) {
212 int j;
213 leftp = (const uint16_t *)s->input_views[LEFT]->data[plane] +
214 s->input_views[LEFT]->linesize[plane] * i / 2;
215 rightp = (const uint16_t *)s->input_views[RIGHT]->data[plane] +
216 s->input_views[RIGHT]->linesize[plane] * i / 2;
217 dstp = (uint16_t *)out->data[plane] + out->linesize[plane] * i / 2;
218 for (j = 0; j < length; j++) {
219 // interpolate chroma as necessary
220 if ((s->pix_desc->log2_chroma_w ||
221 s->pix_desc->log2_chroma_h) &&
222 (plane == 1 || plane == 2)) {
223 *dstp++ = (*leftp + *rightp) / 2;
224 *dstp++ = (*leftp + *rightp) / 2;
225 } else {
226 *dstp++ = *leftp;
227 *dstp++ = *rightp;
228 }
229 leftp += 1;
230 rightp += 1;
231 }
232 }
233 }
234 } else {
235
2/2
✓ Branch 0 taken 30 times.
✓ Branch 1 taken 15 times.
45 for (i = 0; i < 2; i++) {
236 30 const AVFrame *const input_view = s->input_views[i];
237
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 30 times.
30 const int psize = 1 + (s->depth > 8);
238 uint8_t *dst[4];
239 30 int sub_w = psize * input_view->width >> s->pix_desc->log2_chroma_w;
240
241 30 dst[0] = out->data[0] + i * input_view->width * psize;
242 30 dst[1] = out->data[1] + i * sub_w;
243 30 dst[2] = out->data[2] + i * sub_w;
244
245 30 av_image_copy2(dst, out->linesize,
246 30 input_view->data, input_view->linesize,
247 30 input_view->format,
248 30 input_view->width,
249 30 input_view->height);
250 }
251 }
252 30 }
253
254 30 static void vertical_frame_pack(AVFilterLink *outlink,
255 AVFrame *out,
256 int interleaved)
257 {
258 30 AVFilterContext *ctx = outlink->src;
259 30 FramepackContext *s = ctx->priv;
260 int i;
261
262
2/2
✓ Branch 0 taken 60 times.
✓ Branch 1 taken 30 times.
90 for (i = 0; i < 2; i++) {
263 60 const AVFrame *const input_view = s->input_views[i];
264 uint8_t *dst[4];
265 int linesizes[4];
266 60 int sub_h = input_view->height >> s->pix_desc->log2_chroma_h;
267
268 60 dst[0] = out->data[0] + i * out->linesize[0] *
269 60 (interleaved + input_view->height * (1 - interleaved));
270 60 dst[1] = out->data[1] + i * out->linesize[1] *
271 60 (interleaved + sub_h * (1 - interleaved));
272 60 dst[2] = out->data[2] + i * out->linesize[2] *
273 60 (interleaved + sub_h * (1 - interleaved));
274
275 60 linesizes[0] = out->linesize[0] +
276 60 interleaved * out->linesize[0];
277 60 linesizes[1] = out->linesize[1] +
278 60 interleaved * out->linesize[1];
279 60 linesizes[2] = out->linesize[2] +
280 60 interleaved * out->linesize[2];
281
282 60 av_image_copy2(dst, linesizes,
283 60 input_view->data, input_view->linesize,
284 60 input_view->format,
285 60 input_view->width,
286 60 input_view->height);
287 }
288 30 }
289
290 60 static av_always_inline void spatial_frame_pack(AVFilterLink *outlink,
291 AVFrame *dst)
292 {
293 60 AVFilterContext *ctx = outlink->src;
294 60 FramepackContext *s = ctx->priv;
295
4/5
✓ Branch 0 taken 15 times.
✓ Branch 1 taken 15 times.
✓ Branch 2 taken 15 times.
✓ Branch 3 taken 15 times.
✗ Branch 4 not taken.
60 switch (s->format) {
296 15 case AV_STEREO3D_SIDEBYSIDE:
297 15 horizontal_frame_pack(outlink, dst, 0);
298 15 break;
299 15 case AV_STEREO3D_COLUMNS:
300 15 horizontal_frame_pack(outlink, dst, 1);
301 15 break;
302 15 case AV_STEREO3D_TOPBOTTOM:
303 15 vertical_frame_pack(outlink, dst, 0);
304 15 break;
305 15 case AV_STEREO3D_LINES:
306 15 vertical_frame_pack(outlink, dst, 1);
307 15 break;
308 }
309 60 }
310
311 68 static int try_push_frame(AVFilterContext *ctx)
312 {
313 68 FramepackContext *s = ctx->priv;
314 68 AVFilterLink *outlink = ctx->outputs[0];
315 AVStereo3D *stereo;
316 int ret, i;
317
318
2/4
✓ Branch 0 taken 68 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 68 times.
68 if (!(s->input_views[0] && s->input_views[1]))
319 return 0;
320
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 60 times.
68 if (s->format == AV_STEREO3D_FRAMESEQUENCE) {
321 8 int64_t pts = s->input_views[0]->pts;
322
323
2/2
✓ Branch 0 taken 16 times.
✓ Branch 1 taken 8 times.
24 for (i = 0; i < 2; i++) {
324 // set correct timestamps
325
1/2
✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
16 if (pts != AV_NOPTS_VALUE) {
326
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(outlink->frame_rate), outlink->time_base);
327 16 s->input_views[i]->duration = av_rescale_q(1, av_inv_q(outlink->frame_rate), outlink->time_base);
328 }
329
330 // set stereo3d side data
331 16 stereo = av_stereo3d_create_side_data(s->input_views[i]);
332
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
16 if (!stereo)
333 return AVERROR(ENOMEM);
334 16 stereo->type = s->format;
335 16 stereo->view = i == LEFT ? AV_STEREO3D_VIEW_LEFT
336
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 8 times.
16 : AV_STEREO3D_VIEW_RIGHT;
337
338 // filter the frame and immediately relinquish its pointer
339 16 ret = ff_filter_frame(outlink, s->input_views[i]);
340 16 s->input_views[i] = NULL;
341
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
16 if (ret < 0)
342 return ret;
343 }
344 8 return ret;
345 } else {
346 60 AVFrame *dst = ff_get_video_buffer(outlink, outlink->w, outlink->h);
347
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 60 times.
60 if (!dst)
348 return AVERROR(ENOMEM);
349
350 60 spatial_frame_pack(outlink, dst);
351
352 // get any property from the original frame
353 60 ret = av_frame_copy_props(dst, s->input_views[LEFT]);
354
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 60 times.
60 if (ret < 0) {
355 av_frame_free(&dst);
356 return ret;
357 }
358
359
2/2
✓ Branch 0 taken 120 times.
✓ Branch 1 taken 60 times.
180 for (i = 0; i < 2; i++)
360 120 av_frame_free(&s->input_views[i]);
361
362 // set stereo3d side data
363 60 stereo = av_stereo3d_create_side_data(dst);
364
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 60 times.
60 if (!stereo) {
365 av_frame_free(&dst);
366 return AVERROR(ENOMEM);
367 }
368 60 stereo->type = s->format;
369
370 60 return ff_filter_frame(outlink, dst);
371 }
372 }
373
374 217 static int activate(AVFilterContext *ctx)
375 {
376 217 AVFilterLink *outlink = ctx->outputs[0];
377 217 FramepackContext *s = ctx->priv;
378 int ret;
379
380
1/4
✗ Branch 1 not taken.
✓ Branch 2 taken 217 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
217 FF_FILTER_FORWARD_STATUS_BACK_ALL(outlink, ctx);
381
382
2/2
✓ Branch 0 taken 201 times.
✓ Branch 1 taken 16 times.
217 if (!s->input_views[0]) {
383 201 ret = ff_inlink_consume_frame(ctx->inputs[0], &s->input_views[0]);
384
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 201 times.
201 if (ret < 0)
385 return ret;
386 }
387
388
2/2
✓ Branch 0 taken 89 times.
✓ Branch 1 taken 128 times.
217 if (!s->input_views[1]) {
389 89 ret = ff_inlink_consume_frame(ctx->inputs[1], &s->input_views[1]);
390
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 89 times.
89 if (ret < 0)
391 return ret;
392 }
393
394
4/4
✓ Branch 0 taken 84 times.
✓ Branch 1 taken 133 times.
✓ Branch 2 taken 68 times.
✓ Branch 3 taken 16 times.
217 if (s->input_views[0] && s->input_views[1])
395 68 return try_push_frame(ctx);
396
397
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 149 times.
149 FF_FILTER_FORWARD_STATUS(ctx->inputs[0], outlink);
398
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 149 times.
149 FF_FILTER_FORWARD_STATUS(ctx->inputs[1], outlink);
399
400
1/2
✓ Branch 1 taken 149 times.
✗ Branch 2 not taken.
149 if (ff_outlink_frame_wanted(ctx->outputs[0]) &&
401
2/2
✓ Branch 0 taken 133 times.
✓ Branch 1 taken 16 times.
149 !s->input_views[0]) {
402 133 ff_inlink_request_frame(ctx->inputs[0]);
403 133 return 0;
404 }
405
406
1/2
✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
16 if (ff_outlink_frame_wanted(ctx->outputs[0]) &&
407
1/2
✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
16 !s->input_views[1]) {
408 16 ff_inlink_request_frame(ctx->inputs[1]);
409 16 return 0;
410 }
411
412 return FFERROR_NOT_READY;
413 }
414
415 #define OFFSET(x) offsetof(FramepackContext, x)
416 #define VF AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM
417 static const AVOption framepack_options[] = {
418 { "format", "Frame pack output format", OFFSET(format), AV_OPT_TYPE_INT,
419 { .i64 = AV_STEREO3D_SIDEBYSIDE }, 0, INT_MAX, .flags = VF, .unit = "format" },
420 { "sbs", "Views are packed next to each other", 0, AV_OPT_TYPE_CONST,
421 { .i64 = AV_STEREO3D_SIDEBYSIDE }, INT_MIN, INT_MAX, .flags = VF, .unit = "format" },
422 { "tab", "Views are packed on top of each other", 0, AV_OPT_TYPE_CONST,
423 { .i64 = AV_STEREO3D_TOPBOTTOM }, INT_MIN, INT_MAX, .flags = VF, .unit = "format" },
424 { "frameseq", "Views are one after the other", 0, AV_OPT_TYPE_CONST,
425 { .i64 = AV_STEREO3D_FRAMESEQUENCE }, INT_MIN, INT_MAX, .flags = VF, .unit = "format" },
426 { "lines", "Views are interleaved by lines", 0, AV_OPT_TYPE_CONST,
427 { .i64 = AV_STEREO3D_LINES }, INT_MIN, INT_MAX, .flags = VF, .unit = "format" },
428 { "columns", "Views are interleaved by columns", 0, AV_OPT_TYPE_CONST,
429 { .i64 = AV_STEREO3D_COLUMNS }, INT_MIN, INT_MAX, .flags = VF, .unit = "format" },
430 { NULL },
431 };
432
433 AVFILTER_DEFINE_CLASS(framepack);
434
435 static const AVFilterPad framepack_inputs[] = {
436 {
437 .name = "left",
438 .type = AVMEDIA_TYPE_VIDEO,
439 },
440 {
441 .name = "right",
442 .type = AVMEDIA_TYPE_VIDEO,
443 },
444 };
445
446 static const AVFilterPad framepack_outputs[] = {
447 {
448 .name = "packed",
449 .type = AVMEDIA_TYPE_VIDEO,
450 .config_props = config_output,
451 },
452 };
453
454 const AVFilter ff_vf_framepack = {
455 .name = "framepack",
456 .description = NULL_IF_CONFIG_SMALL("Generate a frame packed stereoscopic video."),
457 .priv_size = sizeof(FramepackContext),
458 .priv_class = &framepack_class,
459 FILTER_INPUTS(framepack_inputs),
460 FILTER_OUTPUTS(framepack_outputs),
461 FILTER_PIXFMTS_ARRAY(formats_supported),
462 .activate = activate,
463 .uninit = framepack_uninit,
464 };
465