]> git.sesse.net Git - ffmpeg/blob - libavfilter/vf_stereo3d.c
Merge commit '556aab8f11b045a21182eee32413aa78d5c8539b'
[ffmpeg] / libavfilter / vf_stereo3d.c
1 /*
2  * Copyright (c) 2010 Gordon Schmidt <gordon.schmidt <at> s2000.tu-chemnitz.de>
3  * Copyright (c) 2013 Paul B Mahol
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21
22 #include "libavutil/avassert.h"
23 #include "libavutil/imgutils.h"
24 #include "libavutil/opt.h"
25 #include "libavutil/parseutils.h"
26 #include "libavutil/pixdesc.h"
27 #include "avfilter.h"
28 #include "formats.h"
29 #include "internal.h"
30 #include "video.h"
31
32 enum StereoCode {
33     ANAGLYPH_RC_GRAY,   // anaglyph red/cyan gray
34     ANAGLYPH_RC_HALF,   // anaglyph red/cyan half colored
35     ANAGLYPH_RC_COLOR,  // anaglyph red/cyan colored
36     ANAGLYPH_RC_DUBOIS, // anaglyph red/cyan dubois
37     ANAGLYPH_GM_GRAY,   // anaglyph green/magenta gray
38     ANAGLYPH_GM_HALF,   // anaglyph green/magenta half colored
39     ANAGLYPH_GM_COLOR,  // anaglyph green/magenta colored
40     ANAGLYPH_GM_DUBOIS, // anaglyph green/magenta dubois
41     ANAGLYPH_YB_GRAY,   // anaglyph yellow/blue gray
42     ANAGLYPH_YB_HALF,   // anaglyph yellow/blue half colored
43     ANAGLYPH_YB_COLOR,  // anaglyph yellow/blue colored
44     ANAGLYPH_YB_DUBOIS, // anaglyph yellow/blue dubois
45     ANAGLYPH_RB_GRAY,   // anaglyph red/blue gray
46     ANAGLYPH_RG_GRAY,   // anaglyph red/green gray
47     MONO_L,             // mono output for debugging (left eye only)
48     MONO_R,             // mono output for debugging (right eye only)
49     INTERLEAVE_ROWS_LR, // row-interleave (left eye has top row)
50     INTERLEAVE_ROWS_RL, // row-interleave (right eye has top row)
51     SIDE_BY_SIDE_LR,    // side by side parallel (left eye left, right eye right)
52     SIDE_BY_SIDE_RL,    // side by side crosseye (right eye left, left eye right)
53     SIDE_BY_SIDE_2_LR,  // side by side parallel with half width resolution
54     SIDE_BY_SIDE_2_RL,  // side by side crosseye with half width resolution
55     ABOVE_BELOW_LR,     // above-below (left eye above, right eye below)
56     ABOVE_BELOW_RL,     // above-below (right eye above, left eye below)
57     ABOVE_BELOW_2_LR,   // above-below with half height resolution
58     ABOVE_BELOW_2_RL,   // above-below with half height resolution
59     STEREO_CODE_COUNT   // TODO: needs autodetection
60 };
61
62 typedef struct StereoComponent {
63     enum StereoCode format;
64     int width, height;
65     int off_left, off_right;
66     int row_left, row_right;
67 } StereoComponent;
68
69 static const int ana_coeff[][3][6] = {
70   [ANAGLYPH_RB_GRAY]   =
71     {{19595, 38470,  7471,     0,     0,     0},
72      {    0,     0,     0,     0,     0,     0},
73      {    0,     0,     0, 19595, 38470,  7471}},
74   [ANAGLYPH_RG_GRAY]   =
75     {{19595, 38470,  7471,     0,     0,     0},
76      {    0,     0,     0, 19595, 38470,  7471},
77      {    0,     0,     0,     0,     0,     0}},
78   [ANAGLYPH_RC_GRAY]   =
79     {{19595, 38470,  7471,     0,     0,     0},
80      {    0,     0,     0, 19595, 38470,  7471},
81      {    0,     0,     0, 19595, 38470,  7471}},
82   [ANAGLYPH_RC_HALF]   =
83     {{19595, 38470,  7471,     0,     0,     0},
84      {    0,     0,     0,     0, 65536,     0},
85      {    0,     0,     0,     0,     0, 65536}},
86   [ANAGLYPH_RC_COLOR]  =
87     {{65536,     0,     0,     0,     0,     0},
88      {    0,     0,     0,     0, 65536,     0},
89      {    0,     0,     0,     0,     0, 65536}},
90   [ANAGLYPH_RC_DUBOIS] =
91     {{29891, 32800, 11559, -2849, -5763,  -102},
92      {-2627, -2479, -1033, 24804, 48080, -1209},
93      { -997, -1350,  -358, -4729, -7403, 80373}},
94   [ANAGLYPH_GM_GRAY]   =
95     {{    0,     0,     0, 19595, 38470,  7471},
96      {19595, 38470,  7471,     0,     0,     0},
97      {    0,     0,     0, 19595, 38470,  7471}},
98   [ANAGLYPH_GM_HALF]   =
99     {{    0,     0,     0, 65536,     0,     0},
100      {19595, 38470,  7471,     0,     0,     0},
101      {    0,     0,     0,     0,     0, 65536}},
102   [ANAGLYPH_GM_COLOR]  =
103     {{    0,     0,     0, 65536,     0,     0},
104      {    0, 65536,     0,     0,     0,     0},
105      {    0,     0,     0,     0,     0, 65536}},
106   [ANAGLYPH_GM_DUBOIS]  =
107     {{-4063,-10354, -2556, 34669, 46203,  1573},
108      {18612, 43778,  9372, -1049,  -983, -4260},
109      { -983, -1769,  1376,   590,  4915, 61407}},
110   [ANAGLYPH_YB_GRAY]   =
111     {{    0,     0,     0, 19595, 38470,  7471},
112      {    0,     0,     0, 19595, 38470,  7471},
113      {19595, 38470,  7471,     0,     0,     0}},
114   [ANAGLYPH_YB_HALF]   =
115     {{    0,     0,     0, 65536,     0,     0},
116      {    0,     0,     0,     0, 65536,     0},
117      {19595, 38470,  7471,     0,     0,     0}},
118   [ANAGLYPH_YB_COLOR]  =
119     {{    0,     0,     0, 65536,     0,     0},
120      {    0,     0,     0,     0, 65536,     0},
121      {    0,     0, 65536,     0,     0,     0}},
122   [ANAGLYPH_YB_DUBOIS] =
123     {{65535,-12650,18451,   -987, -7590, -1049},
124      {-1604, 56032, 4196,    370,  3826, -1049},
125      {-2345,-10676, 1358,   5801, 11416, 56217}},
126 };
127
128 typedef struct Stereo3DContext {
129     const AVClass *class;
130     StereoComponent in, out;
131     int width, height;
132     int row_step;
133     int ana_matrix[3][6];
134 } Stereo3DContext;
135
136 #define OFFSET(x) offsetof(Stereo3DContext, x)
137 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
138
139 static const AVOption stereo3d_options[] = {
140     { "in",    "set input format",  OFFSET(in.format),  AV_OPT_TYPE_INT, {.i64=SIDE_BY_SIDE_LR}, SIDE_BY_SIDE_LR, ABOVE_BELOW_2_RL, FLAGS, "in"},
141     { "ab2l",  "above below half height left first",  0, AV_OPT_TYPE_CONST, {.i64=ABOVE_BELOW_2_LR},  0, 0, FLAGS, "in" },
142     { "ab2r",  "above below half height right first", 0, AV_OPT_TYPE_CONST, {.i64=ABOVE_BELOW_2_RL},  0, 0, FLAGS, "in" },
143     { "abl",   "above below left first",              0, AV_OPT_TYPE_CONST, {.i64=ABOVE_BELOW_LR},    0, 0, FLAGS, "in" },
144     { "abr",   "above below right first",             0, AV_OPT_TYPE_CONST, {.i64=ABOVE_BELOW_RL},    0, 0, FLAGS, "in" },
145     { "sbs2l", "side by side half width left first",  0, AV_OPT_TYPE_CONST, {.i64=SIDE_BY_SIDE_2_LR}, 0, 0, FLAGS, "in" },
146     { "sbs2r", "side by side half width right first", 0, AV_OPT_TYPE_CONST, {.i64=SIDE_BY_SIDE_2_RL}, 0, 0, FLAGS, "in" },
147     { "sbsl",  "side by side left first",             0, AV_OPT_TYPE_CONST, {.i64=SIDE_BY_SIDE_LR},   0, 0, FLAGS, "in" },
148     { "sbsr",  "side by side right first",            0, AV_OPT_TYPE_CONST, {.i64=SIDE_BY_SIDE_RL},   0, 0, FLAGS, "in" },
149     { "out",   "set output format", OFFSET(out.format), AV_OPT_TYPE_INT, {.i64=ANAGLYPH_RC_DUBOIS}, 0, STEREO_CODE_COUNT-1, FLAGS, "out"},
150     { "ab2l",  "above below half height left first",  0, AV_OPT_TYPE_CONST, {.i64=ABOVE_BELOW_2_LR},   0, 0, FLAGS, "out" },
151     { "ab2r",  "above below half height right first", 0, AV_OPT_TYPE_CONST, {.i64=ABOVE_BELOW_2_RL},   0, 0, FLAGS, "out" },
152     { "abl",   "above below left first",              0, AV_OPT_TYPE_CONST, {.i64=ABOVE_BELOW_LR},     0, 0, FLAGS, "out" },
153     { "abr",   "above below right first",             0, AV_OPT_TYPE_CONST, {.i64=ABOVE_BELOW_RL},     0, 0, FLAGS, "out" },
154     { "agmc",  "anaglyph green magenta color",        0, AV_OPT_TYPE_CONST, {.i64=ANAGLYPH_GM_COLOR},  0, 0, FLAGS, "out" },
155     { "agmd",  "anaglyph green magenta dubois",       0, AV_OPT_TYPE_CONST, {.i64=ANAGLYPH_GM_DUBOIS}, 0, 0, FLAGS, "out" },
156     { "agmg",  "anaglyph green magenta gray",         0, AV_OPT_TYPE_CONST, {.i64=ANAGLYPH_GM_GRAY},   0, 0, FLAGS, "out" },
157     { "agmh",  "anaglyph green magenta half color",   0, AV_OPT_TYPE_CONST, {.i64=ANAGLYPH_GM_HALF},   0, 0, FLAGS, "out" },
158     { "arbg",  "anaglyph red blue gray",              0, AV_OPT_TYPE_CONST, {.i64=ANAGLYPH_RB_GRAY},   0, 0, FLAGS, "out" },
159     { "arcc",  "anaglyph red cyan color",             0, AV_OPT_TYPE_CONST, {.i64=ANAGLYPH_RC_COLOR},  0, 0, FLAGS, "out" },
160     { "arcd",  "anaglyph red cyan dubois",            0, AV_OPT_TYPE_CONST, {.i64=ANAGLYPH_RC_DUBOIS}, 0, 0, FLAGS, "out" },
161     { "arcg",  "anaglyph red cyan gray",              0, AV_OPT_TYPE_CONST, {.i64=ANAGLYPH_RC_GRAY},   0, 0, FLAGS, "out" },
162     { "arch",  "anaglyph red cyan half color",        0, AV_OPT_TYPE_CONST, {.i64=ANAGLYPH_RC_HALF},   0, 0, FLAGS, "out" },
163     { "argg",  "anaglyph red green gray",             0, AV_OPT_TYPE_CONST, {.i64=ANAGLYPH_RG_GRAY},   0, 0, FLAGS, "out" },
164     { "aybc",  "anaglyph yellow blue color",          0, AV_OPT_TYPE_CONST, {.i64=ANAGLYPH_YB_COLOR},  0, 0, FLAGS, "out" },
165     { "aybd",  "anaglyph yellow blue dubois",         0, AV_OPT_TYPE_CONST, {.i64=ANAGLYPH_YB_DUBOIS}, 0, 0, FLAGS, "out" },
166     { "aybg",  "anaglyph yellow blue gray",           0, AV_OPT_TYPE_CONST, {.i64=ANAGLYPH_YB_GRAY},   0, 0, FLAGS, "out" },
167     { "aybh",  "anaglyph yellow blue half color",     0, AV_OPT_TYPE_CONST, {.i64=ANAGLYPH_YB_HALF},   0, 0, FLAGS, "out" },
168     { "irl",   "interleave rows left first",          0, AV_OPT_TYPE_CONST, {.i64=INTERLEAVE_ROWS_LR}, 0, 0, FLAGS, "out" },
169     { "irr",   "interleave rows right first",         0, AV_OPT_TYPE_CONST, {.i64=INTERLEAVE_ROWS_RL}, 0, 0, FLAGS, "out" },
170     { "ml",    "mono left",                           0, AV_OPT_TYPE_CONST, {.i64=MONO_L},             0, 0, FLAGS, "out" },
171     { "mr",    "mono right",                          0, AV_OPT_TYPE_CONST, {.i64=MONO_R},             0, 0, FLAGS, "out" },
172     { "sbs2l", "side by side half width left first",  0, AV_OPT_TYPE_CONST, {.i64=SIDE_BY_SIDE_2_LR},  0, 0, FLAGS, "out" },
173     { "sbs2r", "side by side half width right first", 0, AV_OPT_TYPE_CONST, {.i64=SIDE_BY_SIDE_2_RL},  0, 0, FLAGS, "out" },
174     { "sbsl",  "side by side left first",             0, AV_OPT_TYPE_CONST, {.i64=SIDE_BY_SIDE_LR},    0, 0, FLAGS, "out" },
175     { "sbsr",  "side by side right first",            0, AV_OPT_TYPE_CONST, {.i64=SIDE_BY_SIDE_RL},    0, 0, FLAGS, "out" },
176     {NULL},
177 };
178
179 AVFILTER_DEFINE_CLASS(stereo3d);
180
181 static av_cold int init(AVFilterContext *ctx, const char *args)
182 {
183     Stereo3DContext *s = ctx->priv;
184     static const char *shorthand[] = { "in", "out", NULL };
185     int ret;
186
187     s->class = &stereo3d_class;
188     av_opt_set_defaults(s);
189
190     if ((ret = av_opt_set_from_string(s, args, shorthand, "=", ":")) < 0)
191         return ret;
192
193     return 0;
194 }
195
196 static int query_formats(AVFilterContext *ctx)
197 {
198     static const enum AVPixelFormat pix_fmts[] = {
199         AV_PIX_FMT_RGB24, AV_PIX_FMT_NONE
200     };
201
202     ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
203
204     return 0;
205 }
206
207 static int config_output(AVFilterLink *outlink)
208 {
209     AVFilterContext *ctx = outlink->src;
210     AVFilterLink *inlink = ctx->inputs[0];
211     Stereo3DContext *s = ctx->priv;
212     AVRational aspect = inlink->sample_aspect_ratio;
213
214     s->in.width     =
215     s->width        = inlink->w;
216     s->in.height    =
217     s->height       = inlink->h;
218     s->row_step     = 1;
219     s->in.off_left  =
220     s->in.off_right =
221     s->in.row_left  =
222     s->in.row_right = 0;
223
224     switch (s->in.format) {
225     case SIDE_BY_SIDE_2_LR:
226         aspect.num     *= 2;
227     case SIDE_BY_SIDE_LR:
228         s->width        = inlink->w / 2;
229         s->in.off_right = s->width * 3;
230         break;
231     case SIDE_BY_SIDE_2_RL:
232         aspect.num     *= 2;
233     case SIDE_BY_SIDE_RL:
234         s->width        = inlink->w / 2;
235         s->in.off_left  = s->width * 3;
236         break;
237     case ABOVE_BELOW_2_LR:
238         aspect.den     *= 2;
239     case ABOVE_BELOW_LR:
240         s->in.row_right =
241         s->height       = inlink->h / 2;
242         break;
243     case ABOVE_BELOW_2_RL:
244         aspect.den     *= 2;
245     case ABOVE_BELOW_RL:
246         s->in.row_left  =
247         s->height       = inlink->h / 2;
248         break;
249     default:
250         av_log(ctx, AV_LOG_ERROR, "input format %d is not supported\n", s->in.format);
251         return AVERROR(EINVAL);
252     }
253
254     s->out.width     = s->width;
255     s->out.height    = s->height;
256     s->out.off_left  =
257     s->out.off_right =
258     s->out.row_left  =
259     s->out.row_right = 0;
260
261     switch (s->out.format) {
262     case ANAGLYPH_RB_GRAY:
263     case ANAGLYPH_RG_GRAY:
264     case ANAGLYPH_RC_GRAY:
265     case ANAGLYPH_RC_HALF:
266     case ANAGLYPH_RC_COLOR:
267     case ANAGLYPH_RC_DUBOIS:
268     case ANAGLYPH_GM_GRAY:
269     case ANAGLYPH_GM_HALF:
270     case ANAGLYPH_GM_COLOR:
271     case ANAGLYPH_GM_DUBOIS:
272     case ANAGLYPH_YB_GRAY:
273     case ANAGLYPH_YB_HALF:
274     case ANAGLYPH_YB_COLOR:
275     case ANAGLYPH_YB_DUBOIS:
276         memcpy(s->ana_matrix, ana_coeff[s->out.format], sizeof(s->ana_matrix));
277         break;
278     case SIDE_BY_SIDE_2_LR:
279         aspect.num      /= 2;
280     case SIDE_BY_SIDE_LR:
281         s->out.width     =
282         s->out.off_right = s->width * 3;
283         break;
284     case SIDE_BY_SIDE_2_RL:
285         aspect.num      /= 2;
286     case SIDE_BY_SIDE_RL:
287         s->out.width     = s->width * 2;
288         s->out.off_left  = s->width * 3;
289         break;
290     case ABOVE_BELOW_2_LR:
291         aspect.den      /= 2;
292     case ABOVE_BELOW_LR:
293         s->out.height    = s->height * 2;
294         s->out.row_right = s->height;
295         break;
296     case ABOVE_BELOW_2_RL:
297         aspect.den      /= 2;
298     case ABOVE_BELOW_RL:
299         s->out.height    = s->height * 2;
300         s->out.row_left  = s->height;
301         break;
302     case INTERLEAVE_ROWS_LR:
303         s->row_step      = 2;
304         s->height        = s->height / 2;
305         s->out.off_right = s->width * 3;
306         s->in.off_right += s->in.width * 3;
307         break;
308     case INTERLEAVE_ROWS_RL:
309         s->row_step      = 2;
310         s->height        = s->height / 2;
311         s->out.off_left  = s->width * 3;
312         s->in.off_left  += s->in.width * 3;
313         break;
314     case MONO_R:
315         s->in.off_left   = s->in.off_right;
316         s->in.row_left   = s->in.row_right;
317     case MONO_L:
318         break;
319     default:
320         av_log(ctx, AV_LOG_ERROR, "output format is not supported\n");
321         return AVERROR(EINVAL);
322     }
323
324     outlink->w = s->out.width;
325     outlink->h = s->out.height;
326     outlink->sample_aspect_ratio = aspect;
327
328     return 0;
329 }
330
331 static inline uint8_t ana_convert(const int *coeff, uint8_t *left, uint8_t *right)
332 {
333     int sum;
334
335     sum  = coeff[0] * left[0] + coeff[3] * right[0]; //red in
336     sum += coeff[1] * left[1] + coeff[4] * right[1]; //green in
337     sum += coeff[2] * left[2] + coeff[5] * right[2]; //blue in
338
339     return av_clip_uint8(sum >> 16);
340 }
341
342 static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref)
343 {
344     AVFilterContext *ctx  = inlink->dst;
345     Stereo3DContext *s = ctx->priv;
346     AVFilterLink *outlink = ctx->outputs[0];
347     AVFrame *out;
348     int out_off_left, out_off_right;
349     int in_off_left, in_off_right;
350     int ret;
351
352     out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
353     if (!out) {
354         av_frame_free(&inpicref);
355         return AVERROR(ENOMEM);
356     }
357     av_frame_copy_props(out, inpicref);
358
359     in_off_left   = s->in.row_left  * inpicref->linesize[0] + s->in.off_left;
360     in_off_right  = s->in.row_right * inpicref->linesize[0] + s->in.off_right;
361     out_off_left  = s->out.row_left  * out->linesize[0] + s->out.off_left;
362     out_off_right = s->out.row_right * out->linesize[0] + s->out.off_right;
363
364     switch (s->out.format) {
365     case SIDE_BY_SIDE_LR:
366     case SIDE_BY_SIDE_RL:
367     case SIDE_BY_SIDE_2_LR:
368     case SIDE_BY_SIDE_2_RL:
369     case ABOVE_BELOW_LR:
370     case ABOVE_BELOW_RL:
371     case ABOVE_BELOW_2_LR:
372     case ABOVE_BELOW_2_RL:
373     case INTERLEAVE_ROWS_LR:
374     case INTERLEAVE_ROWS_RL:
375         av_image_copy_plane(out->data[0] + out_off_left,
376                             out->linesize[0] * s->row_step,
377                             inpicref->data[0] + in_off_left,
378                             inpicref->linesize[0] * s->row_step,
379                             3 * s->width, s->height);
380         av_image_copy_plane(out->data[0] + out_off_right,
381                             out->linesize[0] * s->row_step,
382                             inpicref->data[0] + in_off_right,
383                             inpicref->linesize[0] * s->row_step,
384                             3 * s->width, s->height);
385         break;
386     case MONO_L:
387     case MONO_R:
388         av_image_copy_plane(out->data[0], out->linesize[0],
389                             inpicref->data[0] + in_off_left,
390                             inpicref->linesize[0],
391                             3 * s->width, s->height);
392         break;
393     case ANAGLYPH_RB_GRAY:
394     case ANAGLYPH_RG_GRAY:
395     case ANAGLYPH_RC_GRAY:
396     case ANAGLYPH_RC_HALF:
397     case ANAGLYPH_RC_COLOR:
398     case ANAGLYPH_RC_DUBOIS:
399     case ANAGLYPH_GM_GRAY:
400     case ANAGLYPH_GM_HALF:
401     case ANAGLYPH_GM_COLOR:
402     case ANAGLYPH_GM_DUBOIS:
403     case ANAGLYPH_YB_GRAY:
404     case ANAGLYPH_YB_HALF:
405     case ANAGLYPH_YB_COLOR:
406     case ANAGLYPH_YB_DUBOIS: {
407         int i, x, y, il, ir, o;
408         uint8_t *src = inpicref->data[0];
409         uint8_t *dst = out->data[0];
410         int out_width = s->out.width;
411         int *ana_matrix[3];
412
413         for (i = 0; i < 3; i++)
414             ana_matrix[i] = s->ana_matrix[i];
415
416         for (y = 0; y < s->out.height; y++) {
417             o   = out->linesize[0] * y;
418             il  = in_off_left  + y * inpicref->linesize[0];
419             ir  = in_off_right + y * inpicref->linesize[0];
420             for (x = 0; x < out_width; x++, il += 3, ir += 3, o+= 3) {
421                 dst[o    ] = ana_convert(ana_matrix[0], src + il, src + ir);
422                 dst[o + 1] = ana_convert(ana_matrix[1], src + il, src + ir);
423                 dst[o + 2] = ana_convert(ana_matrix[2], src + il, src + ir);
424             }
425         }
426         break;
427     }
428     default:
429         av_assert0(0);
430     }
431
432     ret = ff_filter_frame(outlink, out);
433     av_frame_free(&inpicref);
434     if (ret < 0)
435         return ret;
436     return 0;
437 }
438
439 static av_cold void uninit(AVFilterContext *ctx)
440 {
441     Stereo3DContext *s = ctx->priv;
442
443     av_opt_free(s);
444 }
445
446 static const AVFilterPad stereo3d_inputs[] = {
447     {
448         .name             = "default",
449         .type             = AVMEDIA_TYPE_VIDEO,
450         .get_video_buffer = ff_null_get_video_buffer,
451         .filter_frame     = filter_frame,
452     },
453     { NULL }
454 };
455
456 static const AVFilterPad stereo3d_outputs[] = {
457     {
458         .name         = "default",
459         .type         = AVMEDIA_TYPE_VIDEO,
460         .config_props = config_output,
461     },
462     { NULL }
463 };
464
465 AVFilter avfilter_vf_stereo3d = {
466     .name          = "stereo3d",
467     .description   = NULL_IF_CONFIG_SMALL("Convert video stereoscopic 3D view."),
468     .priv_size     = sizeof(Stereo3DContext),
469     .init          = init,
470     .uninit        = uninit,
471     .query_formats = query_formats,
472     .inputs        = stereo3d_inputs,
473     .outputs       = stereo3d_outputs,
474     .priv_class    = &stereo3d_class,
475 };