FFmpeg
vf_stereo3d.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010 Gordon Schmidt <gordon.schmidt <at> s2000.tu-chemnitz.de>
3  * Copyright (c) 2013-2015 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/intreadwrite.h"
25 #include "libavutil/opt.h"
26 #include "libavutil/parseutils.h"
27 #include "libavutil/pixdesc.h"
28 #include "avfilter.h"
29 #include "drawutils.h"
30 #include "filters.h"
31 #include "formats.h"
32 #include "video.h"
33 #include "stereo3d.h"
34 
35 enum StereoCode {
36  ANAGLYPH_RC_GRAY, // anaglyph red/cyan gray
37  ANAGLYPH_RC_HALF, // anaglyph red/cyan half colored
38  ANAGLYPH_RC_COLOR, // anaglyph red/cyan colored
39  ANAGLYPH_RC_DUBOIS, // anaglyph red/cyan dubois
40  ANAGLYPH_GM_GRAY, // anaglyph green/magenta gray
41  ANAGLYPH_GM_HALF, // anaglyph green/magenta half colored
42  ANAGLYPH_GM_COLOR, // anaglyph green/magenta colored
43  ANAGLYPH_GM_DUBOIS, // anaglyph green/magenta dubois
44  ANAGLYPH_YB_GRAY, // anaglyph yellow/blue gray
45  ANAGLYPH_YB_HALF, // anaglyph yellow/blue half colored
46  ANAGLYPH_YB_COLOR, // anaglyph yellow/blue colored
47  ANAGLYPH_YB_DUBOIS, // anaglyph yellow/blue dubois
48  ANAGLYPH_RB_GRAY, // anaglyph red/blue gray
49  ANAGLYPH_RG_GRAY, // anaglyph red/green gray
50  MONO_L, // mono output for debugging (left eye only)
51  MONO_R, // mono output for debugging (right eye only)
52  INTERLEAVE_ROWS_LR, // row-interleave (left eye has top row)
53  INTERLEAVE_ROWS_RL, // row-interleave (right eye has top row)
54  SIDE_BY_SIDE_LR, // side by side parallel (left eye left, right eye right)
55  SIDE_BY_SIDE_RL, // side by side crosseye (right eye left, left eye right)
56  SIDE_BY_SIDE_2_LR, // side by side parallel with half width resolution
57  SIDE_BY_SIDE_2_RL, // side by side crosseye with half width resolution
58  ABOVE_BELOW_LR, // above-below (left eye above, right eye below)
59  ABOVE_BELOW_RL, // above-below (right eye above, left eye below)
60  ABOVE_BELOW_2_LR, // above-below with half height resolution
61  ABOVE_BELOW_2_RL, // above-below with half height resolution
62  ALTERNATING_LR, // alternating frames (left eye first, right eye second)
63  ALTERNATING_RL, // alternating frames (right eye first, left eye second)
64  CHECKERBOARD_LR, // checkerboard pattern (left eye first, right eye second)
65  CHECKERBOARD_RL, // checkerboard pattern (right eye first, left eye second)
66  INTERLEAVE_COLS_LR, // column-interleave (left eye first, right eye second)
67  INTERLEAVE_COLS_RL, // column-interleave (right eye first, left eye second)
68  HDMI, // HDMI frame pack (left eye first, right eye second)
69  STEREO_CODE_COUNT // TODO: needs autodetection
70 };
71 
72 typedef struct StereoComponent {
73  int format; ///< StereoCode
74  int width, height;
78  int row_step;
80 
81 static const int ana_coeff[][3][6] = {
83  {{19595, 38470, 7471, 0, 0, 0},
84  { 0, 0, 0, 0, 0, 0},
85  { 0, 0, 0, 19595, 38470, 7471}},
87  {{19595, 38470, 7471, 0, 0, 0},
88  { 0, 0, 0, 19595, 38470, 7471},
89  { 0, 0, 0, 0, 0, 0}},
91  {{19595, 38470, 7471, 0, 0, 0},
92  { 0, 0, 0, 19595, 38470, 7471},
93  { 0, 0, 0, 19595, 38470, 7471}},
95  {{19595, 38470, 7471, 0, 0, 0},
96  { 0, 0, 0, 0, 65536, 0},
97  { 0, 0, 0, 0, 0, 65536}},
99  {{65536, 0, 0, 0, 0, 0},
100  { 0, 0, 0, 0, 65536, 0},
101  { 0, 0, 0, 0, 0, 65536}},
103  {{29884, 32768, 11534, -2818, -5767, -131},
104  {-2621, -2490, -1049, 24773, 48103, -1180},
105  { -983, -1376, -328, -4719, -7406, 80347}},
106  [ANAGLYPH_GM_GRAY] =
107  {{ 0, 0, 0, 19595, 38470, 7471},
108  {19595, 38470, 7471, 0, 0, 0},
109  { 0, 0, 0, 19595, 38470, 7471}},
110  [ANAGLYPH_GM_HALF] =
111  {{ 0, 0, 0, 65536, 0, 0},
112  {19595, 38470, 7471, 0, 0, 0},
113  { 0, 0, 0, 0, 0, 65536}},
115  {{ 0, 0, 0, 65536, 0, 0},
116  { 0, 65536, 0, 0, 0, 0},
117  { 0, 0, 0, 0, 0, 65536}},
119  {{-4063,-10354, -2556, 34669, 46203, 1573},
120  {18612, 43778, 9372, -1049, -983, -4260},
121  { -983, -1769, 1376, 590, 4915, 61407}},
122  [ANAGLYPH_YB_GRAY] =
123  {{ 0, 0, 0, 19595, 38470, 7471},
124  { 0, 0, 0, 19595, 38470, 7471},
125  {19595, 38470, 7471, 0, 0, 0}},
126  [ANAGLYPH_YB_HALF] =
127  {{ 0, 0, 0, 65536, 0, 0},
128  { 0, 0, 0, 0, 65536, 0},
129  {19595, 38470, 7471, 0, 0, 0}},
131  {{ 0, 0, 0, 65536, 0, 0},
132  { 0, 0, 0, 0, 65536, 0},
133  { 0, 0, 65536, 0, 0, 0}},
135  {{69599,-13435,19595, -1048, -8061, -1114},
136  {-1704, 59507, 4456, 393, 4063, -1114},
137  {-2490,-11338, 1442, 6160, 12124, 59703}},
138 };
139 
140 typedef struct Stereo3DContext {
141  const AVClass *class;
143  int width, height;
144  const int *ana_matrix[3];
146  int linesize[4];
147  int pheight[4];
148  int hsub, vsub;
149  int pixstep[4];
151  int blanks;
156 
157 #define OFFSET(x) offsetof(Stereo3DContext, x)
158 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
159 
160 static const AVOption stereo3d_options[] = {
161  { "in", "set input format", OFFSET(in.format), AV_OPT_TYPE_INT, {.i64=SIDE_BY_SIDE_LR}, INTERLEAVE_ROWS_LR, STEREO_CODE_COUNT-1, FLAGS, .unit = "in"},
162  { "ab2l", "above below half height left first", 0, AV_OPT_TYPE_CONST, {.i64=ABOVE_BELOW_2_LR}, 0, 0, FLAGS, .unit = "in" },
163  { "tb2l", "above below half height left first", 0, AV_OPT_TYPE_CONST, {.i64=ABOVE_BELOW_2_LR}, 0, 0, FLAGS, .unit = "in" },
164  { "ab2r", "above below half height right first", 0, AV_OPT_TYPE_CONST, {.i64=ABOVE_BELOW_2_RL}, 0, 0, FLAGS, .unit = "in" },
165  { "tb2r", "above below half height right first", 0, AV_OPT_TYPE_CONST, {.i64=ABOVE_BELOW_2_RL}, 0, 0, FLAGS, .unit = "in" },
166  { "abl", "above below left first", 0, AV_OPT_TYPE_CONST, {.i64=ABOVE_BELOW_LR}, 0, 0, FLAGS, .unit = "in" },
167  { "tbl", "above below left first", 0, AV_OPT_TYPE_CONST, {.i64=ABOVE_BELOW_LR}, 0, 0, FLAGS, .unit = "in" },
168  { "abr", "above below right first", 0, AV_OPT_TYPE_CONST, {.i64=ABOVE_BELOW_RL}, 0, 0, FLAGS, .unit = "in" },
169  { "tbr", "above below right first", 0, AV_OPT_TYPE_CONST, {.i64=ABOVE_BELOW_RL}, 0, 0, FLAGS, .unit = "in" },
170  { "al", "alternating frames left first", 0, AV_OPT_TYPE_CONST, {.i64=ALTERNATING_LR}, 0, 0, FLAGS, .unit = "in" },
171  { "ar", "alternating frames right first", 0, AV_OPT_TYPE_CONST, {.i64=ALTERNATING_RL}, 0, 0, FLAGS, .unit = "in" },
172  { "sbs2l", "side by side half width left first", 0, AV_OPT_TYPE_CONST, {.i64=SIDE_BY_SIDE_2_LR}, 0, 0, FLAGS, .unit = "in" },
173  { "sbs2r", "side by side half width right first", 0, AV_OPT_TYPE_CONST, {.i64=SIDE_BY_SIDE_2_RL}, 0, 0, FLAGS, .unit = "in" },
174  { "sbsl", "side by side left first", 0, AV_OPT_TYPE_CONST, {.i64=SIDE_BY_SIDE_LR}, 0, 0, FLAGS, .unit = "in" },
175  { "sbsr", "side by side right first", 0, AV_OPT_TYPE_CONST, {.i64=SIDE_BY_SIDE_RL}, 0, 0, FLAGS, .unit = "in" },
176  { "irl", "interleave rows left first", 0, AV_OPT_TYPE_CONST, {.i64=INTERLEAVE_ROWS_LR}, 0, 0, FLAGS, .unit = "in" },
177  { "irr", "interleave rows right first", 0, AV_OPT_TYPE_CONST, {.i64=INTERLEAVE_ROWS_RL}, 0, 0, FLAGS, .unit = "in" },
178  { "icl", "interleave columns left first", 0, AV_OPT_TYPE_CONST, {.i64=INTERLEAVE_COLS_LR}, 0, 0, FLAGS, .unit = "in" },
179  { "icr", "interleave columns right first", 0, AV_OPT_TYPE_CONST, {.i64=INTERLEAVE_COLS_RL}, 0, 0, FLAGS, .unit = "in" },
180  { "out", "set output format", OFFSET(out.format), AV_OPT_TYPE_INT, {.i64=ANAGLYPH_RC_DUBOIS}, 0, STEREO_CODE_COUNT-1, FLAGS, .unit = "out"},
181  { "ab2l", "above below half height left first", 0, AV_OPT_TYPE_CONST, {.i64=ABOVE_BELOW_2_LR}, 0, 0, FLAGS, .unit = "out" },
182  { "tb2l", "above below half height left first", 0, AV_OPT_TYPE_CONST, {.i64=ABOVE_BELOW_2_LR}, 0, 0, FLAGS, .unit = "out" },
183  { "ab2r", "above below half height right first", 0, AV_OPT_TYPE_CONST, {.i64=ABOVE_BELOW_2_RL}, 0, 0, FLAGS, .unit = "out" },
184  { "tb2r", "above below half height right first", 0, AV_OPT_TYPE_CONST, {.i64=ABOVE_BELOW_2_RL}, 0, 0, FLAGS, .unit = "out" },
185  { "abl", "above below left first", 0, AV_OPT_TYPE_CONST, {.i64=ABOVE_BELOW_LR}, 0, 0, FLAGS, .unit = "out" },
186  { "tbl", "above below left first", 0, AV_OPT_TYPE_CONST, {.i64=ABOVE_BELOW_LR}, 0, 0, FLAGS, .unit = "out" },
187  { "abr", "above below right first", 0, AV_OPT_TYPE_CONST, {.i64=ABOVE_BELOW_RL}, 0, 0, FLAGS, .unit = "out" },
188  { "tbr", "above below right first", 0, AV_OPT_TYPE_CONST, {.i64=ABOVE_BELOW_RL}, 0, 0, FLAGS, .unit = "out" },
189  { "agmc", "anaglyph green magenta color", 0, AV_OPT_TYPE_CONST, {.i64=ANAGLYPH_GM_COLOR}, 0, 0, FLAGS, .unit = "out" },
190  { "agmd", "anaglyph green magenta dubois", 0, AV_OPT_TYPE_CONST, {.i64=ANAGLYPH_GM_DUBOIS}, 0, 0, FLAGS, .unit = "out" },
191  { "agmg", "anaglyph green magenta gray", 0, AV_OPT_TYPE_CONST, {.i64=ANAGLYPH_GM_GRAY}, 0, 0, FLAGS, .unit = "out" },
192  { "agmh", "anaglyph green magenta half color", 0, AV_OPT_TYPE_CONST, {.i64=ANAGLYPH_GM_HALF}, 0, 0, FLAGS, .unit = "out" },
193  { "al", "alternating frames left first", 0, AV_OPT_TYPE_CONST, {.i64=ALTERNATING_LR}, 0, 0, FLAGS, .unit = "out" },
194  { "ar", "alternating frames right first", 0, AV_OPT_TYPE_CONST, {.i64=ALTERNATING_RL}, 0, 0, FLAGS, .unit = "out" },
195  { "arbg", "anaglyph red blue gray", 0, AV_OPT_TYPE_CONST, {.i64=ANAGLYPH_RB_GRAY}, 0, 0, FLAGS, .unit = "out" },
196  { "arcc", "anaglyph red cyan color", 0, AV_OPT_TYPE_CONST, {.i64=ANAGLYPH_RC_COLOR}, 0, 0, FLAGS, .unit = "out" },
197  { "arcd", "anaglyph red cyan dubois", 0, AV_OPT_TYPE_CONST, {.i64=ANAGLYPH_RC_DUBOIS}, 0, 0, FLAGS, .unit = "out" },
198  { "arcg", "anaglyph red cyan gray", 0, AV_OPT_TYPE_CONST, {.i64=ANAGLYPH_RC_GRAY}, 0, 0, FLAGS, .unit = "out" },
199  { "arch", "anaglyph red cyan half color", 0, AV_OPT_TYPE_CONST, {.i64=ANAGLYPH_RC_HALF}, 0, 0, FLAGS, .unit = "out" },
200  { "argg", "anaglyph red green gray", 0, AV_OPT_TYPE_CONST, {.i64=ANAGLYPH_RG_GRAY}, 0, 0, FLAGS, .unit = "out" },
201  { "aybc", "anaglyph yellow blue color", 0, AV_OPT_TYPE_CONST, {.i64=ANAGLYPH_YB_COLOR}, 0, 0, FLAGS, .unit = "out" },
202  { "aybd", "anaglyph yellow blue dubois", 0, AV_OPT_TYPE_CONST, {.i64=ANAGLYPH_YB_DUBOIS}, 0, 0, FLAGS, .unit = "out" },
203  { "aybg", "anaglyph yellow blue gray", 0, AV_OPT_TYPE_CONST, {.i64=ANAGLYPH_YB_GRAY}, 0, 0, FLAGS, .unit = "out" },
204  { "aybh", "anaglyph yellow blue half color", 0, AV_OPT_TYPE_CONST, {.i64=ANAGLYPH_YB_HALF}, 0, 0, FLAGS, .unit = "out" },
205  { "irl", "interleave rows left first", 0, AV_OPT_TYPE_CONST, {.i64=INTERLEAVE_ROWS_LR}, 0, 0, FLAGS, .unit = "out" },
206  { "irr", "interleave rows right first", 0, AV_OPT_TYPE_CONST, {.i64=INTERLEAVE_ROWS_RL}, 0, 0, FLAGS, .unit = "out" },
207  { "ml", "mono left", 0, AV_OPT_TYPE_CONST, {.i64=MONO_L}, 0, 0, FLAGS, .unit = "out" },
208  { "mr", "mono right", 0, AV_OPT_TYPE_CONST, {.i64=MONO_R}, 0, 0, FLAGS, .unit = "out" },
209  { "sbs2l", "side by side half width left first", 0, AV_OPT_TYPE_CONST, {.i64=SIDE_BY_SIDE_2_LR}, 0, 0, FLAGS, .unit = "out" },
210  { "sbs2r", "side by side half width right first", 0, AV_OPT_TYPE_CONST, {.i64=SIDE_BY_SIDE_2_RL}, 0, 0, FLAGS, .unit = "out" },
211  { "sbsl", "side by side left first", 0, AV_OPT_TYPE_CONST, {.i64=SIDE_BY_SIDE_LR}, 0, 0, FLAGS, .unit = "out" },
212  { "sbsr", "side by side right first", 0, AV_OPT_TYPE_CONST, {.i64=SIDE_BY_SIDE_RL}, 0, 0, FLAGS, .unit = "out" },
213  { "chl", "checkerboard left first", 0, AV_OPT_TYPE_CONST, {.i64=CHECKERBOARD_LR}, 0, 0, FLAGS, .unit = "out" },
214  { "chr", "checkerboard right first", 0, AV_OPT_TYPE_CONST, {.i64=CHECKERBOARD_RL}, 0, 0, FLAGS, .unit = "out" },
215  { "icl", "interleave columns left first", 0, AV_OPT_TYPE_CONST, {.i64=INTERLEAVE_COLS_LR}, 0, 0, FLAGS, .unit = "out" },
216  { "icr", "interleave columns right first", 0, AV_OPT_TYPE_CONST, {.i64=INTERLEAVE_COLS_RL}, 0, 0, FLAGS, .unit = "out" },
217  { "hdmi", "HDMI frame pack", 0, AV_OPT_TYPE_CONST, {.i64=HDMI}, 0, 0, FLAGS, .unit = "out" },
218  { NULL }
219 };
220 
221 AVFILTER_DEFINE_CLASS(stereo3d);
222 
223 static const enum AVPixelFormat anaglyph_pix_fmts[] = {
226 };
227 
228 static const enum AVPixelFormat other_pix_fmts[] = {
280 };
281 
283 {
284  Stereo3DContext *s = ctx->priv;
285  const enum AVPixelFormat *pix_fmts;
286 
287  switch (s->out.format) {
288  case ANAGLYPH_GM_COLOR:
289  case ANAGLYPH_GM_DUBOIS:
290  case ANAGLYPH_GM_GRAY:
291  case ANAGLYPH_GM_HALF:
292  case ANAGLYPH_RB_GRAY:
293  case ANAGLYPH_RC_COLOR:
294  case ANAGLYPH_RC_DUBOIS:
295  case ANAGLYPH_RC_GRAY:
296  case ANAGLYPH_RC_HALF:
297  case ANAGLYPH_RG_GRAY:
298  case ANAGLYPH_YB_COLOR:
299  case ANAGLYPH_YB_DUBOIS:
300  case ANAGLYPH_YB_GRAY:
301  case ANAGLYPH_YB_HALF:
303  break;
304  default:
306  }
307 
309 }
310 
311 static inline uint8_t ana_convert(const int *coeff, const uint8_t *left, const uint8_t *right)
312 {
313  int sum;
314 
315  sum = coeff[0] * left[0] + coeff[3] * right[0]; //red in
316  sum += coeff[1] * left[1] + coeff[4] * right[1]; //green in
317  sum += coeff[2] * left[2] + coeff[5] * right[2]; //blue in
318 
319  return av_clip_uint8(sum >> 16);
320 }
321 
322 static void anaglyph_ic(uint8_t *dst, uint8_t *lsrc, uint8_t *rsrc,
323  ptrdiff_t dst_linesize, ptrdiff_t l_linesize, ptrdiff_t r_linesize,
324  int width, int height,
325  const int *ana_matrix_r, const int *ana_matrix_g, const int *ana_matrix_b)
326 {
327  int x, y, o;
328 
329  for (y = 0; y < height; y++) {
330  for (o = 0, x = 0; x < width; x++, o+= 3) {
331  dst[o ] = ana_convert(ana_matrix_r, lsrc + o * 2, rsrc + o * 2);
332  dst[o + 1] = ana_convert(ana_matrix_g, lsrc + o * 2, rsrc + o * 2);
333  dst[o + 2] = ana_convert(ana_matrix_b, lsrc + o * 2, rsrc + o * 2);
334  }
335 
336  dst += dst_linesize;
337  lsrc += l_linesize;
338  rsrc += r_linesize;
339  }
340 }
341 
342 static void anaglyph(uint8_t *dst, uint8_t *lsrc, uint8_t *rsrc,
343  ptrdiff_t dst_linesize, ptrdiff_t l_linesize, ptrdiff_t r_linesize,
344  int width, int height,
345  const int *ana_matrix_r, const int *ana_matrix_g, const int *ana_matrix_b)
346 {
347  int x, y, o;
348 
349  for (y = 0; y < height; y++) {
350  for (o = 0, x = 0; x < width; x++, o+= 3) {
351  dst[o ] = ana_convert(ana_matrix_r, lsrc + o, rsrc + o);
352  dst[o + 1] = ana_convert(ana_matrix_g, lsrc + o, rsrc + o);
353  dst[o + 2] = ana_convert(ana_matrix_b, lsrc + o, rsrc + o);
354  }
355 
356  dst += dst_linesize;
357  lsrc += l_linesize;
358  rsrc += r_linesize;
359  }
360 }
361 
362 static int config_output(AVFilterLink *outlink)
363 {
364  AVFilterContext *ctx = outlink->src;
365  AVFilterLink *inlink = ctx->inputs[0];
366  Stereo3DContext *s = ctx->priv;
368  FilterLink *ol = ff_filter_link(outlink);
369  AVRational fps = il->frame_rate;
370  AVRational tb = inlink->time_base;
372  int ret;
373  s->aspect = inlink->sample_aspect_ratio;
374 
375  switch (s->in.format) {
376  case INTERLEAVE_COLS_LR:
377  case INTERLEAVE_COLS_RL:
378  case SIDE_BY_SIDE_2_LR:
379  case SIDE_BY_SIDE_LR:
380  case SIDE_BY_SIDE_2_RL:
381  case SIDE_BY_SIDE_RL:
382  if (inlink->w & 1) {
383  av_log(ctx, AV_LOG_ERROR, "width must be even\n");
384  return AVERROR_INVALIDDATA;
385  }
386  break;
387  case INTERLEAVE_ROWS_LR:
388  case INTERLEAVE_ROWS_RL:
389  case ABOVE_BELOW_2_LR:
390  case ABOVE_BELOW_LR:
391  case ABOVE_BELOW_2_RL:
392  case ABOVE_BELOW_RL:
393  if (inlink->h & 1) {
394  av_log(ctx, AV_LOG_ERROR, "height must be even\n");
395  return AVERROR_INVALIDDATA;
396  }
397  break;
398  }
399 
400  s->in.width =
401  s->width = inlink->w;
402  s->in.height =
403  s->height = inlink->h;
404  s->in.off_lstep =
405  s->in.off_rstep =
406  s->in.off_left =
407  s->in.off_right =
408  s->in.row_left =
409  s->in.row_right = 0;
410  s->in.row_step = 1;
411 
412  switch (s->in.format) {
413  case SIDE_BY_SIDE_2_LR:
414  s->aspect.num *= 2;
415  case SIDE_BY_SIDE_LR:
416  s->width = inlink->w / 2;
417  s->in.off_right = s->width;
418  break;
419  case SIDE_BY_SIDE_2_RL:
420  s->aspect.num *= 2;
421  case SIDE_BY_SIDE_RL:
422  s->width = inlink->w / 2;
423  s->in.off_left = s->width;
424  break;
425  case ABOVE_BELOW_2_LR:
426  s->aspect.den *= 2;
427  case ABOVE_BELOW_LR:
428  s->in.row_right =
429  s->height = inlink->h / 2;
430  break;
431  case ABOVE_BELOW_2_RL:
432  s->aspect.den *= 2;
433  case ABOVE_BELOW_RL:
434  s->in.row_left =
435  s->height = inlink->h / 2;
436  break;
437  case ALTERNATING_RL:
438  case ALTERNATING_LR:
439  fps.den *= 2;
440  tb.num *= 2;
441  break;
442  case INTERLEAVE_COLS_RL:
443  case INTERLEAVE_COLS_LR:
444  s->width = inlink->w / 2;
445  break;
446  case INTERLEAVE_ROWS_LR:
447  case INTERLEAVE_ROWS_RL:
448  s->in.row_step = 2;
449  if (s->in.format == INTERLEAVE_ROWS_RL)
450  s->in.off_lstep = 1;
451  else
452  s->in.off_rstep = 1;
453  if (s->out.format != CHECKERBOARD_LR &&
454  s->out.format != CHECKERBOARD_RL)
455  s->height = inlink->h / 2;
456  break;
457  default:
458  av_log(ctx, AV_LOG_ERROR, "input format %d is not supported\n", s->in.format);
459  return AVERROR(EINVAL);
460  }
461 
462  s->out.width = s->width;
463  s->out.height = s->height;
464  s->out.off_lstep =
465  s->out.off_rstep =
466  s->out.off_left =
467  s->out.off_right =
468  s->out.row_left =
469  s->out.row_right = 0;
470  s->out.row_step = 1;
471 
472  switch (s->out.format) {
473  case ANAGLYPH_RB_GRAY:
474  case ANAGLYPH_RG_GRAY:
475  case ANAGLYPH_RC_GRAY:
476  case ANAGLYPH_RC_HALF:
477  case ANAGLYPH_RC_COLOR:
478  case ANAGLYPH_RC_DUBOIS:
479  case ANAGLYPH_GM_GRAY:
480  case ANAGLYPH_GM_HALF:
481  case ANAGLYPH_GM_COLOR:
482  case ANAGLYPH_GM_DUBOIS:
483  case ANAGLYPH_YB_GRAY:
484  case ANAGLYPH_YB_HALF:
485  case ANAGLYPH_YB_COLOR:
486  case ANAGLYPH_YB_DUBOIS: {
487  uint8_t rgba_map[4];
488 
489  ff_fill_rgba_map(rgba_map, outlink->format);
490  s->ana_matrix[rgba_map[0]] = &ana_coeff[s->out.format][0][0];
491  s->ana_matrix[rgba_map[1]] = &ana_coeff[s->out.format][1][0];
492  s->ana_matrix[rgba_map[2]] = &ana_coeff[s->out.format][2][0];
493  break;
494  }
495  case SIDE_BY_SIDE_2_LR:
496  s->aspect.den *= 2;
497  case SIDE_BY_SIDE_LR:
498  s->out.width = s->width * 2;
499  s->out.off_right = s->width;
500  break;
501  case SIDE_BY_SIDE_2_RL:
502  s->aspect.den *= 2;
503  case SIDE_BY_SIDE_RL:
504  s->out.width = s->width * 2;
505  s->out.off_left = s->width;
506  break;
507  case ABOVE_BELOW_2_LR:
508  s->aspect.num *= 2;
509  case ABOVE_BELOW_LR:
510  s->out.height = s->height * 2;
511  s->out.row_right = s->height;
512  break;
513  case HDMI:
514  if (s->height != 720 && s->height != 1080) {
515  av_log(ctx, AV_LOG_ERROR, "Only 720 and 1080 height supported\n");
516  return AVERROR(EINVAL);
517  }
518 
519  s->blanks = s->height / 24;
520  s->out.height = s->height * 2 + s->blanks;
521  s->out.row_right = s->height + s->blanks;
522  break;
523  case ABOVE_BELOW_2_RL:
524  s->aspect.num *= 2;
525  case ABOVE_BELOW_RL:
526  s->out.height = s->height * 2;
527  s->out.row_left = s->height;
528  break;
529  case INTERLEAVE_ROWS_LR:
530  s->in.row_step = 1 + (s->in.format == INTERLEAVE_ROWS_RL);
531  s->out.row_step = 2;
532  s->out.height = s->height * 2;
533  s->out.off_rstep = 1;
534  break;
535  case INTERLEAVE_ROWS_RL:
536  s->in.row_step = 1 + (s->in.format == INTERLEAVE_ROWS_LR);
537  s->out.row_step = 2;
538  s->out.height = s->height * 2;
539  s->out.off_lstep = 1;
540  break;
541  case MONO_R:
542  if (s->in.format != INTERLEAVE_COLS_LR) {
543  s->in.off_left = s->in.off_right;
544  s->in.row_left = s->in.row_right;
545  }
546  if (s->in.format == INTERLEAVE_ROWS_LR)
547  FFSWAP(int, s->in.off_lstep, s->in.off_rstep);
548  break;
549  case MONO_L:
550  if (s->in.format == INTERLEAVE_ROWS_RL)
551  FFSWAP(int, s->in.off_lstep, s->in.off_rstep);
552  break;
553  case ALTERNATING_RL:
554  case ALTERNATING_LR:
555  fps.num *= 2;
556  tb.den *= 2;
557  break;
558  case CHECKERBOARD_LR:
559  case CHECKERBOARD_RL:
560  case INTERLEAVE_COLS_LR:
561  case INTERLEAVE_COLS_RL:
562  s->out.width = s->width * 2;
563  break;
564  default:
565  av_log(ctx, AV_LOG_ERROR, "output format %d is not supported\n", s->out.format);
566  return AVERROR(EINVAL);
567  }
568 
569  if (s->in.format == INTERLEAVE_COLS_LR || s->in.format == INTERLEAVE_COLS_RL) {
570  if ((s->in.format & 1) != (s->out.format & 1)) {
571  FFSWAP(int, s->in.row_left, s->in.row_right);
572  FFSWAP(int, s->in.off_lstep, s->in.off_rstep);
573  FFSWAP(int, s->in.off_left, s->in.off_right);
574  FFSWAP(int, s->out.row_left, s->out.row_right);
575  FFSWAP(int, s->out.off_lstep, s->out.off_rstep);
576  FFSWAP(int, s->out.off_left, s->out.off_right);
577  }
578  }
579 
580  outlink->w = s->out.width;
581  outlink->h = s->out.height;
582  ol->frame_rate = fps;
583  outlink->time_base = tb;
584  outlink->sample_aspect_ratio = s->aspect;
585 
586  if ((ret = av_image_fill_linesizes(s->linesize, outlink->format, s->width)) < 0)
587  return ret;
588  s->nb_planes = av_pix_fmt_count_planes(outlink->format);
590  s->pheight[1] = s->pheight[2] = AV_CEIL_RSHIFT(s->height, desc->log2_chroma_h);
591  s->pheight[0] = s->pheight[3] = s->height;
592  s->hsub = desc->log2_chroma_w;
593  s->vsub = desc->log2_chroma_h;
594 
595  s->dsp.anaglyph = anaglyph;
596 #if ARCH_X86
597  ff_stereo3d_init_x86(&s->dsp);
598 #endif
599 
600  return 0;
601 }
602 
603 typedef struct ThreadData {
605  AVFrame *out;
606 } ThreadData;
607 
608 static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
609 {
610  Stereo3DContext *s = ctx->priv;
611  ThreadData *td = arg;
612  AVFrame *ileft = td->ileft;
613  AVFrame *iright = td->iright;
614  AVFrame *out = td->out;
615  int height = s->out.height;
616  int start = (height * jobnr ) / nb_jobs;
617  int end = (height * (jobnr+1)) / nb_jobs;
618  const int **ana_matrix = s->ana_matrix;
619 
620  s->dsp.anaglyph(out->data[0] + out->linesize[0] * start,
621  ileft ->data[0] + s->in_off_left [0] + ileft->linesize[0] * start * s->in.row_step,
622  iright->data[0] + s->in_off_right[0] + iright->linesize[0] * start * s->in.row_step,
623  out->linesize[0],
624  ileft->linesize[0] * s->in.row_step,
625  iright->linesize[0] * s->in.row_step,
626  s->out.width, end - start,
627  ana_matrix[0], ana_matrix[1], ana_matrix[2]);
628 
629  return 0;
630 }
631 
632 static void interleave_cols_to_any(Stereo3DContext *s, int *out_off, int p, AVFrame *in, AVFrame *out, int d)
633 {
634  int y, x;
635 
636  for (y = 0; y < s->pheight[p]; y++) {
637  const uint8_t *src = (const uint8_t*)in->data[p] + y * in->linesize[p] + d * s->pixstep[p];
638  uint8_t *dst = out->data[p] + out_off[p] + y * out->linesize[p] * s->out.row_step;
639 
640  switch (s->pixstep[p]) {
641  case 1:
642  for (x = 0; x < s->linesize[p]; x++)
643  dst[x] = src[x * 2];
644  break;
645  case 2:
646  for (x = 0; x < s->linesize[p]; x+=2)
647  AV_WN16(&dst[x], AV_RN16(&src[x * 2]));
648  break;
649  case 3:
650  for (x = 0; x < s->linesize[p]; x+=3)
651  AV_WB24(&dst[x], AV_RB24(&src[x * 2]));
652  break;
653  case 4:
654  for (x = 0; x < s->linesize[p]; x+=4)
655  AV_WN32(&dst[x], AV_RN32(&src[x * 2]));
656  break;
657  case 6:
658  for (x = 0; x < s->linesize[p]; x+=6)
659  AV_WB48(&dst[x], AV_RB48(&src[x * 2]));
660  break;
661  case 8:
662  for (x = 0; x < s->linesize[p]; x+=8)
663  AV_WN64(&dst[x], AV_RN64(&src[x * 2]));
664  break;
665  }
666  }
667 }
668 
669 static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref)
670 {
671  AVFilterContext *ctx = inlink->dst;
672  Stereo3DContext *s = ctx->priv;
673  AVFilterLink *outlink = ctx->outputs[0];
674  AVFrame *out = NULL, *oleft, *oright, *ileft, *iright;
675  int out_off_left[4], out_off_right[4];
676  int i, ret;
677 
678  if (s->in.format == s->out.format)
679  return ff_filter_frame(outlink, inpicref);
680 
681  switch (s->out.format) {
682  case ALTERNATING_LR:
683  case ALTERNATING_RL:
684  if (!s->prev) {
685  s->prev = inpicref;
686  return 0;
687  }
688  break;
689  };
690 
691  switch (s->in.format) {
692  case ALTERNATING_LR:
693  case ALTERNATING_RL:
694  if (!s->prev) {
695  s->prev = inpicref;
696  return 0;
697  }
698  ileft = s->prev;
699  iright = inpicref;
700  if (s->in.format == ALTERNATING_RL)
701  FFSWAP(AVFrame *, ileft, iright);
702  break;
703  default:
704  ileft = iright = inpicref;
705  };
706 
707  if ((s->out.format == ALTERNATING_LR ||
708  s->out.format == ALTERNATING_RL) &&
709  (s->in.format == SIDE_BY_SIDE_LR ||
710  s->in.format == SIDE_BY_SIDE_RL ||
711  s->in.format == SIDE_BY_SIDE_2_LR ||
712  s->in.format == SIDE_BY_SIDE_2_RL ||
713  s->in.format == ABOVE_BELOW_LR ||
714  s->in.format == ABOVE_BELOW_RL ||
715  s->in.format == ABOVE_BELOW_2_LR ||
716  s->in.format == ABOVE_BELOW_2_RL ||
717  s->in.format == INTERLEAVE_ROWS_LR ||
718  s->in.format == INTERLEAVE_ROWS_RL)) {
719  oright = av_frame_clone(s->prev);
720  oleft = av_frame_clone(s->prev);
721  if (!oright || !oleft) {
722  av_frame_free(&oright);
723  av_frame_free(&oleft);
724  av_frame_free(&s->prev);
725  av_frame_free(&inpicref);
726  return AVERROR(ENOMEM);
727  }
728  } else if ((s->out.format == MONO_L ||
729  s->out.format == MONO_R) &&
730  (s->in.format == SIDE_BY_SIDE_LR ||
731  s->in.format == SIDE_BY_SIDE_RL ||
732  s->in.format == SIDE_BY_SIDE_2_LR ||
733  s->in.format == SIDE_BY_SIDE_2_RL ||
734  s->in.format == ABOVE_BELOW_LR ||
735  s->in.format == ABOVE_BELOW_RL ||
736  s->in.format == ABOVE_BELOW_2_LR ||
737  s->in.format == ABOVE_BELOW_2_RL ||
738  s->in.format == INTERLEAVE_ROWS_LR ||
739  s->in.format == INTERLEAVE_ROWS_RL)) {
740  out = oleft = oright = av_frame_clone(inpicref);
741  if (!out) {
742  av_frame_free(&s->prev);
743  av_frame_free(&inpicref);
744  return AVERROR(ENOMEM);
745  }
746  } else if ((s->out.format == MONO_L && s->in.format == ALTERNATING_LR) ||
747  (s->out.format == MONO_R && s->in.format == ALTERNATING_RL)) {
748  s->prev->pts /= 2;
749  ret = ff_filter_frame(outlink, s->prev);
750  av_frame_free(&inpicref);
751  s->prev = NULL;
752  return ret;
753  } else if ((s->out.format == MONO_L && s->in.format == ALTERNATING_RL) ||
754  (s->out.format == MONO_R && s->in.format == ALTERNATING_LR)) {
755  av_frame_free(&s->prev);
756  inpicref->pts /= 2;
757  return ff_filter_frame(outlink, inpicref);
758  } else if ((s->out.format == ALTERNATING_LR && s->in.format == ALTERNATING_RL) ||
759  (s->out.format == ALTERNATING_RL && s->in.format == ALTERNATING_LR)) {
760  FFSWAP(int64_t, s->prev->pts, inpicref->pts);
761  ff_filter_frame(outlink, inpicref);
762  ret = ff_filter_frame(outlink, s->prev);
763  s->prev = NULL;
764  return ret;
765  } else {
766  out = oleft = oright = ff_get_video_buffer(outlink, outlink->w, outlink->h);
767  if (!out) {
768  av_frame_free(&s->prev);
769  av_frame_free(&inpicref);
770  return AVERROR(ENOMEM);
771  }
772  av_frame_copy_props(out, inpicref);
773 
774  if (s->out.format == ALTERNATING_LR ||
775  s->out.format == ALTERNATING_RL) {
776  oright = ff_get_video_buffer(outlink, outlink->w, outlink->h);
777  if (!oright) {
778  av_frame_free(&oleft);
779  av_frame_free(&s->prev);
780  av_frame_free(&inpicref);
781  return AVERROR(ENOMEM);
782  }
783  av_frame_copy_props(oright, s->prev);
784  }
785  }
786 
787  for (i = 0; i < 4; i++) {
788  int hsub = i == 1 || i == 2 ? s->hsub : 0;
789  int vsub = i == 1 || i == 2 ? s->vsub : 0;
790  s->in_off_left[i] = (AV_CEIL_RSHIFT(s->in.row_left, vsub) + s->in.off_lstep) * ileft->linesize[i] + AV_CEIL_RSHIFT(s->in.off_left * s->pixstep[i], hsub);
791  s->in_off_right[i] = (AV_CEIL_RSHIFT(s->in.row_right, vsub) + s->in.off_rstep) * iright->linesize[i] + AV_CEIL_RSHIFT(s->in.off_right * s->pixstep[i], hsub);
792  out_off_left[i] = (AV_CEIL_RSHIFT(s->out.row_left, vsub) + s->out.off_lstep) * oleft->linesize[i] + AV_CEIL_RSHIFT(s->out.off_left * s->pixstep[i], hsub);
793  out_off_right[i] = (AV_CEIL_RSHIFT(s->out.row_right, vsub) + s->out.off_rstep) * oright->linesize[i] + AV_CEIL_RSHIFT(s->out.off_right * s->pixstep[i], hsub);
794  }
795 
796  switch (s->out.format) {
797  case ALTERNATING_LR:
798  case ALTERNATING_RL:
799  switch (s->in.format) {
800  case INTERLEAVE_ROWS_LR:
801  case INTERLEAVE_ROWS_RL:
802  for (i = 0; i < s->nb_planes; i++) {
803  oleft->linesize[i] *= 2;
804  oright->linesize[i] *= 2;
805  }
806  case ABOVE_BELOW_LR:
807  case ABOVE_BELOW_RL:
808  case ABOVE_BELOW_2_LR:
809  case ABOVE_BELOW_2_RL:
810  case SIDE_BY_SIDE_LR:
811  case SIDE_BY_SIDE_RL:
812  case SIDE_BY_SIDE_2_LR:
813  case SIDE_BY_SIDE_2_RL:
814  oleft->width = outlink->w;
815  oright->width = outlink->w;
816  oleft->height = outlink->h;
817  oright->height = outlink->h;
818 
819  for (i = 0; i < s->nb_planes; i++) {
820  oleft->data[i] += s->in_off_left[i];
821  oright->data[i] += s->in_off_right[i];
822  }
823  break;
824  default:
825  goto copy;
826  break;
827  }
828  break;
829  case HDMI:
830  for (i = 0; i < s->nb_planes; i++) {
831  int j, h = s->height >> ((i == 1 || i == 2) ? s->vsub : 0);
832  int b = (s->blanks) >> ((i == 1 || i == 2) ? s->vsub : 0);
833 
834  for (j = h; j < h + b; j++)
835  memset(oleft->data[i] + j * s->linesize[i], 0, s->linesize[i]);
836  }
837  case SIDE_BY_SIDE_LR:
838  case SIDE_BY_SIDE_RL:
839  case SIDE_BY_SIDE_2_LR:
840  case SIDE_BY_SIDE_2_RL:
841  case ABOVE_BELOW_LR:
842  case ABOVE_BELOW_RL:
843  case ABOVE_BELOW_2_LR:
844  case ABOVE_BELOW_2_RL:
845  case INTERLEAVE_ROWS_LR:
846  case INTERLEAVE_ROWS_RL:
847 copy:
848  if (s->in.format == INTERLEAVE_COLS_LR ||
849  s->in.format == INTERLEAVE_COLS_RL) {
850  for (i = 0; i < s->nb_planes; i++) {
851  int d = (s->in.format & 1) != (s->out.format & 1);
852 
853  interleave_cols_to_any(s, out_off_left, i, ileft, oleft, d);
854  interleave_cols_to_any(s, out_off_right, i, iright, oright, !d);
855  }
856  } else {
857  for (i = 0; i < s->nb_planes; i++) {
858  av_image_copy_plane(oleft->data[i] + out_off_left[i],
859  oleft->linesize[i] * s->out.row_step,
860  ileft->data[i] + s->in_off_left[i],
861  ileft->linesize[i] * s->in.row_step,
862  s->linesize[i], s->pheight[i]);
863  av_image_copy_plane(oright->data[i] + out_off_right[i],
864  oright->linesize[i] * s->out.row_step,
865  iright->data[i] + s->in_off_right[i],
866  iright->linesize[i] * s->in.row_step,
867  s->linesize[i], s->pheight[i]);
868  }
869  }
870  break;
871  case MONO_L:
872  iright = ileft;
873  case MONO_R:
874  switch (s->in.format) {
875  case INTERLEAVE_ROWS_LR:
876  case INTERLEAVE_ROWS_RL:
877  for (i = 0; i < s->nb_planes; i++) {
878  out->linesize[i] *= 2;
879  }
880  case ABOVE_BELOW_LR:
881  case ABOVE_BELOW_RL:
882  case ABOVE_BELOW_2_LR:
883  case ABOVE_BELOW_2_RL:
884  case SIDE_BY_SIDE_LR:
885  case SIDE_BY_SIDE_RL:
886  case SIDE_BY_SIDE_2_LR:
887  case SIDE_BY_SIDE_2_RL:
888  out->width = outlink->w;
889  out->height = outlink->h;
890 
891  for (i = 0; i < s->nb_planes; i++) {
892  out->data[i] += s->in_off_left[i];
893  }
894  break;
895  case INTERLEAVE_COLS_LR:
896  case INTERLEAVE_COLS_RL:
897  for (i = 0; i < s->nb_planes; i++) {
898  const int d = (s->in.format & 1) != (s->out.format & 1);
899 
900  interleave_cols_to_any(s, out_off_right, i, iright, out, d);
901  }
902  break;
903  default:
904  for (i = 0; i < s->nb_planes; i++) {
905  av_image_copy_plane(out->data[i], out->linesize[i],
906  iright->data[i] + s->in_off_left[i],
907  iright->linesize[i] * s->in.row_step,
908  s->linesize[i], s->pheight[i]);
909  }
910  break;
911  }
912  break;
913  case ANAGLYPH_RB_GRAY:
914  case ANAGLYPH_RG_GRAY:
915  case ANAGLYPH_RC_GRAY:
916  case ANAGLYPH_RC_HALF:
917  case ANAGLYPH_RC_COLOR:
918  case ANAGLYPH_RC_DUBOIS:
919  case ANAGLYPH_GM_GRAY:
920  case ANAGLYPH_GM_HALF:
921  case ANAGLYPH_GM_COLOR:
922  case ANAGLYPH_GM_DUBOIS:
923  case ANAGLYPH_YB_GRAY:
924  case ANAGLYPH_YB_HALF:
925  case ANAGLYPH_YB_COLOR:
926  case ANAGLYPH_YB_DUBOIS: {
927  if (s->in.format == INTERLEAVE_COLS_LR ||
928  s->in.format == INTERLEAVE_COLS_RL) {
929  const int d = (s->in.format & 1);
930 
931  anaglyph_ic(out->data[0],
932  ileft ->data[0] + s->in_off_left [0] + d * 3,
933  iright->data[0] + s->in_off_right[0] + (!d) * 3,
934  out->linesize[0],
935  ileft->linesize[0] * s->in.row_step,
936  iright->linesize[0] * s->in.row_step,
937  s->out.width, s->out.height,
938  s->ana_matrix[0], s->ana_matrix[1], s->ana_matrix[2]);
939  } else {
940  ThreadData td;
941 
942  td.ileft = ileft; td.iright = iright; td.out = out;
944  FFMIN(s->out.height, ff_filter_get_nb_threads(ctx)));
945  }
946  break;
947  }
948  case CHECKERBOARD_RL:
949  case CHECKERBOARD_LR:
950  for (i = 0; i < s->nb_planes; i++) {
951  int x, y;
952 
953  for (y = 0; y < s->pheight[i]; y++) {
954  uint8_t *dst = out->data[i] + out->linesize[i] * y;
955  const int d1 = (s->in.format == INTERLEAVE_COLS_LR || s->in.format == INTERLEAVE_COLS_RL) && (s->in.format & 1) != (s->out.format & 1);
956  const int d2 = (s->in.format == INTERLEAVE_COLS_LR || s->in.format == INTERLEAVE_COLS_RL) ? !d1 : 0;
957  const int m = 1 + (s->in.format == INTERLEAVE_COLS_LR || s->in.format == INTERLEAVE_COLS_RL);
958  uint8_t *left = ileft->data[i] + ileft->linesize[i] * y + s->in_off_left[i] + d1 * s->pixstep[i];
959  uint8_t *right = iright->data[i] + iright->linesize[i] * y + s->in_off_right[i] + d2 * s->pixstep[i];
960  int p, b;
961 
962  if (s->out.format == CHECKERBOARD_RL && s->in.format != INTERLEAVE_COLS_LR && s->in.format != INTERLEAVE_COLS_RL)
963  FFSWAP(uint8_t*, left, right);
964  switch (s->pixstep[i]) {
965  case 1:
966  for (x = 0, b = 0, p = 0; x < s->linesize[i] * 2; x+=2, p++, b+=2) {
967  dst[x ] = (b&1) == (y&1) ? left[p*m] : right[p*m];
968  dst[x+1] = (b&1) != (y&1) ? left[p*m] : right[p*m];
969  }
970  break;
971  case 2:
972  for (x = 0, b = 0, p = 0; x < s->linesize[i] * 2; x+=4, p+=2, b+=2) {
973  AV_WN16(&dst[x ], (b&1) == (y&1) ? AV_RN16(&left[p*m]) : AV_RN16(&right[p*m]));
974  AV_WN16(&dst[x+2], (b&1) != (y&1) ? AV_RN16(&left[p*m]) : AV_RN16(&right[p*m]));
975  }
976  break;
977  case 3:
978  for (x = 0, b = 0, p = 0; x < s->linesize[i] * 2; x+=6, p+=3, b+=2) {
979  AV_WB24(&dst[x ], (b&1) == (y&1) ? AV_RB24(&left[p*m]) : AV_RB24(&right[p*m]));
980  AV_WB24(&dst[x+3], (b&1) != (y&1) ? AV_RB24(&left[p*m]) : AV_RB24(&right[p*m]));
981  }
982  break;
983  case 4:
984  for (x = 0, b = 0, p = 0; x < s->linesize[i] * 2; x+=8, p+=4, b+=2) {
985  AV_WN32(&dst[x ], (b&1) == (y&1) ? AV_RN32(&left[p*m]) : AV_RN32(&right[p*m]));
986  AV_WN32(&dst[x+4], (b&1) != (y&1) ? AV_RN32(&left[p*m]) : AV_RN32(&right[p*m]));
987  }
988  break;
989  case 6:
990  for (x = 0, b = 0, p = 0; x < s->linesize[i] * 2; x+=12, p+=6, b+=2) {
991  AV_WB48(&dst[x ], (b&1) == (y&1) ? AV_RB48(&left[p*m]) : AV_RB48(&right[p*m]));
992  AV_WB48(&dst[x+6], (b&1) != (y&1) ? AV_RB48(&left[p*m]) : AV_RB48(&right[p*m]));
993  }
994  break;
995  case 8:
996  for (x = 0, b = 0, p = 0; x < s->linesize[i] * 2; x+=16, p+=8, b+=2) {
997  AV_WN64(&dst[x ], (b&1) == (y&1) ? AV_RN64(&left[p*m]) : AV_RN64(&right[p*m]));
998  AV_WN64(&dst[x+8], (b&1) != (y&1) ? AV_RN64(&left[p*m]) : AV_RN64(&right[p*m]));
999  }
1000  break;
1001  }
1002  }
1003  }
1004  break;
1005  case INTERLEAVE_COLS_LR:
1006  case INTERLEAVE_COLS_RL:
1007  for (i = 0; i < s->nb_planes; i++) {
1008  const int d = (s->in.format == INTERLEAVE_COLS_LR || s->in.format == INTERLEAVE_COLS_RL);
1009  const int m = 1 + d;
1010  int x, y;
1011 
1012  for (y = 0; y < s->pheight[i]; y++) {
1013  uint8_t *dst = out->data[i] + out->linesize[i] * y;
1014  uint8_t *left = ileft->data[i] + ileft->linesize[i] * y * s->in.row_step + s->in_off_left[i] + d * s->pixstep[i];
1015  uint8_t *right = iright->data[i] + iright->linesize[i] * y * s->in.row_step + s->in_off_right[i];
1016  int p, b;
1017 
1018  if (s->out.format == INTERLEAVE_COLS_LR)
1019  FFSWAP(uint8_t*, left, right);
1020 
1021  switch (s->pixstep[i]) {
1022  case 1:
1023  for (x = 0, b = 0, p = 0; x < s->linesize[i] * 2; x+=2, p++, b+=2) {
1024  dst[x ] = b&1 ? left[p*m] : right[p*m];
1025  dst[x+1] = !(b&1) ? left[p*m] : right[p*m];
1026  }
1027  break;
1028  case 2:
1029  for (x = 0, b = 0, p = 0; x < s->linesize[i] * 2; x+=4, p+=2, b+=2) {
1030  AV_WN16(&dst[x ], b&1 ? AV_RN16(&left[p*m]) : AV_RN16(&right[p*m]));
1031  AV_WN16(&dst[x+2], !(b&1) ? AV_RN16(&left[p*m]) : AV_RN16(&right[p*m]));
1032  }
1033  break;
1034  case 3:
1035  for (x = 0, b = 0, p = 0; x < s->linesize[i] * 2; x+=6, p+=3, b+=2) {
1036  AV_WB24(&dst[x ], b&1 ? AV_RB24(&left[p*m]) : AV_RB24(&right[p*m]));
1037  AV_WB24(&dst[x+3], !(b&1) ? AV_RB24(&left[p*m]) : AV_RB24(&right[p*m]));
1038  }
1039  break;
1040  case 4:
1041  for (x = 0, b = 0, p = 0; x < s->linesize[i] * 2; x+=8, p+=4, b+=2) {
1042  AV_WN32(&dst[x ], b&1 ? AV_RN32(&left[p*m]) : AV_RN32(&right[p*m]));
1043  AV_WN32(&dst[x+4], !(b&1) ? AV_RN32(&left[p*m]) : AV_RN32(&right[p*m]));
1044  }
1045  break;
1046  case 6:
1047  for (x = 0, b = 0, p = 0; x < s->linesize[i] * 2; x+=12, p+=6, b+=2) {
1048  AV_WB48(&dst[x ], b&1 ? AV_RB48(&left[p*m]) : AV_RB48(&right[p*m]));
1049  AV_WB48(&dst[x+6], !(b&1) ? AV_RB48(&left[p*m]) : AV_RB48(&right[p*m]));
1050  }
1051  break;
1052  case 8:
1053  for (x = 0, b = 0, p = 0; x < s->linesize[i] * 2; x+=16, p+=8, b+=2) {
1054  AV_WN64(&dst[x ], b&1 ? AV_RN64(&left[p*m]) : AV_RN64(&right[p*m]));
1055  AV_WN64(&dst[x+8], !(b&1) ? AV_RN64(&left[p*m]) : AV_RN64(&right[p*m]));
1056  }
1057  break;
1058  }
1059  }
1060  }
1061  break;
1062  default:
1063  av_assert0(0);
1064  }
1065 
1066  if (oright != oleft) {
1067  if (s->out.format == ALTERNATING_LR)
1068  FFSWAP(AVFrame *, oleft, oright);
1069  oright->pts = s->prev->pts * 2;
1070  ff_filter_frame(outlink, oright);
1071  out = oleft;
1072  oleft->pts = s->prev->pts + inpicref->pts;
1073  av_frame_free(&s->prev);
1074  s->prev = inpicref;
1075  } else if (s->in.format == ALTERNATING_LR ||
1076  s->in.format == ALTERNATING_RL) {
1077  out->pts = s->prev->pts / 2;
1078  av_frame_free(&s->prev);
1079  av_frame_free(&inpicref);
1080  } else {
1081  av_frame_free(&s->prev);
1082  av_frame_free(&inpicref);
1083  }
1084  av_assert0(out);
1085  out->sample_aspect_ratio = s->aspect;
1086  return ff_filter_frame(outlink, out);
1087 }
1088 
1090 {
1091  Stereo3DContext *s = ctx->priv;
1092 
1093  av_frame_free(&s->prev);
1094 }
1095 
1096 static const AVFilterPad stereo3d_inputs[] = {
1097  {
1098  .name = "default",
1099  .type = AVMEDIA_TYPE_VIDEO,
1100  .filter_frame = filter_frame,
1101  },
1102 };
1103 
1104 static const AVFilterPad stereo3d_outputs[] = {
1105  {
1106  .name = "default",
1107  .type = AVMEDIA_TYPE_VIDEO,
1108  .config_props = config_output,
1109  },
1110 };
1111 
1113  .name = "stereo3d",
1114  .description = NULL_IF_CONFIG_SMALL("Convert video stereoscopic 3D view."),
1115  .priv_size = sizeof(Stereo3DContext),
1116  .uninit = uninit,
1120  .priv_class = &stereo3d_class,
1121  .flags = AVFILTER_FLAG_SLICE_THREADS,
1122 };
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:116
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref)
Definition: vf_stereo3d.c:669
ABOVE_BELOW_LR
@ ABOVE_BELOW_LR
Definition: vf_stereo3d.c:58
ana_convert
static uint8_t ana_convert(const int *coeff, const uint8_t *left, const uint8_t *right)
Definition: vf_stereo3d.c:311
AV_PIX_FMT_YUV420P9LE
@ AV_PIX_FMT_YUV420P9LE
planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition: pixfmt.h:154
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:71
AV_PIX_FMT_BGR48LE
@ AV_PIX_FMT_BGR48LE
packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as lit...
Definition: pixfmt.h:146
Stereo3DContext::hsub
int hsub
Definition: vf_stereo3d.c:148
MONO_R
@ MONO_R
Definition: vf_stereo3d.c:51
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
AV_PIX_FMT_BGRA64BE
@ AV_PIX_FMT_BGRA64BE
packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is st...
Definition: pixfmt.h:204
AV_RB48
#define AV_RB48(x)
Definition: intreadwrite.h:468
out
FILE * out
Definition: movenc.c:55
Stereo3DContext::nb_planes
int nb_planes
Definition: vf_stereo3d.c:145
CHECKERBOARD_RL
@ CHECKERBOARD_RL
Definition: vf_stereo3d.c:65
Stereo3DContext::in_off_left
int in_off_left[4]
Definition: vf_stereo3d.c:152
AV_PIX_FMT_GBRP16BE
@ AV_PIX_FMT_GBRP16BE
planar GBR 4:4:4 48bpp, big-endian
Definition: pixfmt.h:171
ff_filter_frame
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1023
AV_PIX_FMT_GBRP10BE
@ AV_PIX_FMT_GBRP10BE
planar GBR 4:4:4 30bpp, big-endian
Definition: pixfmt.h:169
av_pix_fmt_desc_get
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2965
config_output
static int config_output(AVFilterLink *outlink)
Definition: vf_stereo3d.c:362
AV_PIX_FMT_YUV422P14LE
@ AV_PIX_FMT_YUV422P14LE
planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition: pixfmt.h:274
int64_t
long long int64_t
Definition: coverity.c:34
inlink
The exact code depends on how similar the blocks are and how related they are to the and needs to apply these operations to the correct inlink or outlink if there are several Macros are available to factor that when no extra processing is inlink
Definition: filter_design.txt:212
AV_RN16
#define AV_RN16(p)
Definition: intreadwrite.h:356
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:160
Stereo3DContext::dsp
Stereo3DDSPContext dsp
Definition: vf_stereo3d.c:154
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: filters.h:262
AV_RN64
#define AV_RN64(p)
Definition: intreadwrite.h:364
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:374
AV_PIX_FMT_YUVA444P10BE
@ AV_PIX_FMT_YUVA444P10BE
planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian)
Definition: pixfmt.h:185
pixdesc.h
AV_PIX_FMT_RGBA64BE
@ AV_PIX_FMT_RGBA64BE
packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is st...
Definition: pixfmt.h:202
AVFrame::pts
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
Definition: frame.h:486
AVOption
AVOption.
Definition: opt.h:429
b
#define b
Definition: input.c:41
ANAGLYPH_YB_DUBOIS
@ ANAGLYPH_YB_DUBOIS
Definition: vf_stereo3d.c:47
AV_PIX_FMT_YUV420P14BE
@ AV_PIX_FMT_YUV420P14BE
planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
Definition: pixfmt.h:269
StereoComponent::format
int format
StereoCode.
Definition: vf_stereo3d.c:73
AV_PIX_FMT_YUV420P16LE
@ AV_PIX_FMT_YUV420P16LE
planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition: pixfmt.h:128
Stereo3DContext::vsub
int vsub
Definition: vf_stereo3d.c:148
AV_PIX_FMT_GBRP14BE
@ AV_PIX_FMT_GBRP14BE
planar GBR 4:4:4 42bpp, big-endian
Definition: pixfmt.h:281
AV_PIX_FMT_BGR24
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
Definition: pixfmt.h:76
AV_PIX_FMT_BGRA
@ AV_PIX_FMT_BGRA
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
Definition: pixfmt.h:102
AV_PIX_FMT_YUV440P
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition: pixfmt.h:106
Stereo3DContext::in_off_right
int in_off_right[4]
Definition: vf_stereo3d.c:152
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:205
AV_PIX_FMT_YUVA444P9BE
@ AV_PIX_FMT_YUVA444P9BE
planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), big-endian
Definition: pixfmt.h:179
AV_PIX_FMT_YUV422P9BE
@ AV_PIX_FMT_YUV422P9BE
planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition: pixfmt.h:163
stereo3d_inputs
static const AVFilterPad stereo3d_inputs[]
Definition: vf_stereo3d.c:1096
ANAGLYPH_RC_HALF
@ ANAGLYPH_RC_HALF
Definition: vf_stereo3d.c:37
ThreadData::out
AVFrame * out
Definition: af_adeclick.c:526
video.h
StereoComponent::off_rstep
int off_rstep
Definition: vf_stereo3d.c:76
Stereo3DContext::pheight
int pheight[4]
Definition: vf_stereo3d.c:147
AVFrame::data
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:395
av_image_copy_plane
void av_image_copy_plane(uint8_t *dst, int dst_linesize, const uint8_t *src, int src_linesize, int bytewidth, int height)
Copy image plane from src to dst.
Definition: imgutils.c:374
AV_PIX_FMT_YUV444P16LE
@ AV_PIX_FMT_YUV444P16LE
planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:132
hsub
static void hsub(htype *dst, const htype *src, int bins)
Definition: vf_median.c:74
INTERLEAVE_ROWS_LR
@ INTERLEAVE_ROWS_LR
Definition: vf_stereo3d.c:52
formats.h
ana_coeff
static const int ana_coeff[][3][6]
Definition: vf_stereo3d.c:81
CHECKERBOARD_LR
@ CHECKERBOARD_LR
Definition: vf_stereo3d.c:64
av_pix_fmt_count_planes
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:3005
MONO_L
@ MONO_L
Definition: vf_stereo3d.c:50
AV_PIX_FMT_YUV420P12LE
@ AV_PIX_FMT_YUV420P12LE
planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition: pixfmt.h:268
Stereo3DContext
Definition: vf_stereo3d.c:140
ThreadData::ileft
AVFrame * ileft
Definition: vf_stereo3d.c:604
Stereo3DContext::prev
AVFrame * prev
Definition: vf_stereo3d.c:150
AV_PIX_FMT_YUVA444P16BE
@ AV_PIX_FMT_YUVA444P16BE
planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian)
Definition: pixfmt.h:191
ANAGLYPH_GM_COLOR
@ ANAGLYPH_GM_COLOR
Definition: vf_stereo3d.c:42
AVRational::num
int num
Numerator.
Definition: rational.h:59
Stereo3DContext::out
StereoComponent out
Definition: vf_stereo3d.c:142
AV_PIX_FMT_YUV444P10BE
@ AV_PIX_FMT_YUV444P10BE
planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition: pixfmt.h:161
AVFilterPad
A filter pad used for either input or output.
Definition: filters.h:38
AV_PIX_FMT_YUV420P10LE
@ AV_PIX_FMT_YUV420P10LE
planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition: pixfmt.h:156
StereoComponent::row_step
int row_step
Definition: vf_stereo3d.c:78
AV_PIX_FMT_YUV444P12LE
@ AV_PIX_FMT_YUV444P12LE
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:276
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:283
AV_PIX_FMT_YUV422P12BE
@ AV_PIX_FMT_YUV422P12BE
planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition: pixfmt.h:271
AV_PIX_FMT_YUV444P14LE
@ AV_PIX_FMT_YUV444P14LE
planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:278
avassert.h
ANAGLYPH_RG_GRAY
@ ANAGLYPH_RG_GRAY
Definition: vf_stereo3d.c:49
INTERLEAVE_ROWS_RL
@ INTERLEAVE_ROWS_RL
Definition: vf_stereo3d.c:53
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
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:86
width
#define width
av_image_fill_linesizes
int av_image_fill_linesizes(int linesizes[4], enum AVPixelFormat pix_fmt, int width)
Fill plane linesizes for an image with pixel format pix_fmt and width width.
Definition: imgutils.c:89
intreadwrite.h
s
#define s(width, name)
Definition: cbs_vp9.c:198
AV_PIX_FMT_GBRP16LE
@ AV_PIX_FMT_GBRP16LE
planar GBR 4:4:4 48bpp, little-endian
Definition: pixfmt.h:172
ALTERNATING_LR
@ ALTERNATING_LR
Definition: vf_stereo3d.c:62
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:108
ANAGLYPH_RC_COLOR
@ ANAGLYPH_RC_COLOR
Definition: vf_stereo3d.c:38
AV_CEIL_RSHIFT
#define AV_CEIL_RSHIFT(a, b)
Definition: common.h:60
ff_set_common_formats_from_list
int ff_set_common_formats_from_list(AVFilterContext *ctx, const int *fmts)
Equivalent to ff_set_common_formats(ctx, ff_make_format_list(fmts))
Definition: formats.c:873
AV_PIX_FMT_GBRP12LE
@ AV_PIX_FMT_GBRP12LE
planar GBR 4:4:4 36bpp, little-endian
Definition: pixfmt.h:280
av_assert0
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:40
filters.h
pix_fmts
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:304
AV_PIX_FMT_YUVA420P16BE
@ AV_PIX_FMT_YUVA420P16BE
planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian)
Definition: pixfmt.h:187
ABOVE_BELOW_2_RL
@ ABOVE_BELOW_2_RL
Definition: vf_stereo3d.c:61
ctx
AVFormatContext * ctx
Definition: movenc.c:49
ThreadData::iright
AVFrame * iright
Definition: vf_stereo3d.c:604
av_frame_clone
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
Definition: frame.c:595
SIDE_BY_SIDE_LR
@ SIDE_BY_SIDE_LR
Definition: vf_stereo3d.c:54
ANAGLYPH_YB_COLOR
@ ANAGLYPH_YB_COLOR
Definition: vf_stereo3d.c:46
AV_PIX_FMT_GBRP10LE
@ AV_PIX_FMT_GBRP10LE
planar GBR 4:4:4 30bpp, little-endian
Definition: pixfmt.h:170
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:73
anaglyph_pix_fmts
static enum AVPixelFormat anaglyph_pix_fmts[]
Definition: vf_stereo3d.c:223
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: filters.h:263
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:87
AV_PIX_FMT_RGBA
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
Definition: pixfmt.h:100
AV_PIX_FMT_YUV444P10LE
@ AV_PIX_FMT_YUV444P10LE
planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:162
arg
const char * arg
Definition: jacosubdec.c:67
AV_PIX_FMT_YUVA422P10LE
@ AV_PIX_FMT_YUVA422P10LE
planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian)
Definition: pixfmt.h:184
Stereo3DContext::blanks
int blanks
Definition: vf_stereo3d.c:151
AV_PIX_FMT_YUV444P9BE
@ AV_PIX_FMT_YUV444P9BE
planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition: pixfmt.h:159
AV_PIX_FMT_YUV422P10BE
@ AV_PIX_FMT_YUV422P10BE
planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition: pixfmt.h:157
AV_PIX_FMT_YUV422P16LE
@ AV_PIX_FMT_YUV422P16LE
planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition: pixfmt.h:130
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
other_pix_fmts
static enum AVPixelFormat other_pix_fmts[]
Definition: vf_stereo3d.c:228
stereo3d_options
static const AVOption stereo3d_options[]
Definition: vf_stereo3d.c:160
NULL
#define NULL
Definition: coverity.c:32
StereoComponent
Definition: vf_stereo3d.c:72
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:711
Stereo3DContext::linesize
int linesize[4]
Definition: vf_stereo3d.c:146
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
AV_PIX_FMT_RGB48LE
@ AV_PIX_FMT_RGB48LE
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as lit...
Definition: pixfmt.h:110
stereo3d_outputs
static const AVFilterPad stereo3d_outputs[]
Definition: vf_stereo3d.c:1104
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:85
AV_PIX_FMT_RGBA64LE
@ AV_PIX_FMT_RGBA64LE
packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is st...
Definition: pixfmt.h:203
AV_RN32
#define AV_RN32(p)
Definition: intreadwrite.h:360
StereoComponent::off_right
int off_right
Definition: vf_stereo3d.c:75
INTERLEAVE_COLS_RL
@ INTERLEAVE_COLS_RL
Definition: vf_stereo3d.c:67
parseutils.h
ANAGLYPH_RB_GRAY
@ ANAGLYPH_RB_GRAY
Definition: vf_stereo3d.c:48
AV_PIX_FMT_YUVA444P9LE
@ AV_PIX_FMT_YUVA444P9LE
planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), little-endian
Definition: pixfmt.h:180
Stereo3DContext::height
int height
Definition: vf_stereo3d.c:143
AV_PIX_FMT_YUVA420P16LE
@ AV_PIX_FMT_YUVA420P16LE
planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian)
Definition: pixfmt.h:188
AV_PIX_FMT_BGR0
@ AV_PIX_FMT_BGR0
packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
Definition: pixfmt.h:265
HDMI
@ HDMI
Definition: vf_stereo3d.c:68
AV_PIX_FMT_YUVA420P9LE
@ AV_PIX_FMT_YUVA420P9LE
planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), little-endian
Definition: pixfmt.h:176
AV_PIX_FMT_ABGR
@ AV_PIX_FMT_ABGR
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
Definition: pixfmt.h:101
ff_filter_link
static FilterLink * ff_filter_link(AVFilterLink *link)
Definition: filters.h:197
AV_PIX_FMT_YUV420P14LE
@ AV_PIX_FMT_YUV420P14LE
planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition: pixfmt.h:270
AV_PIX_FMT_YUV444P14BE
@ AV_PIX_FMT_YUV444P14BE
planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition: pixfmt.h:277
AV_PIX_FMT_YUV420P9BE
@ AV_PIX_FMT_YUV420P9BE
The following 12 formats have the disadvantage of needing 1 format for each bit depth.
Definition: pixfmt.h:153
Stereo3DContext::ana_matrix
const int * ana_matrix[3]
Definition: vf_stereo3d.c:144
ABOVE_BELOW_2_LR
@ ABOVE_BELOW_2_LR
Definition: vf_stereo3d.c:60
AV_PIX_FMT_RGB24
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition: pixfmt.h:75
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:94
copy
static void copy(const float *p1, float *p2, const int length)
Definition: vf_vaguedenoiser.c:186
ANAGLYPH_YB_HALF
@ ANAGLYPH_YB_HALF
Definition: vf_stereo3d.c:45
AV_WN32
#define AV_WN32(p, v)
Definition: intreadwrite.h:372
AV_PIX_FMT_YUV420P12BE
@ AV_PIX_FMT_YUV420P12BE
planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
Definition: pixfmt.h:267
AV_PIX_FMT_YUV422P10LE
@ AV_PIX_FMT_YUV422P10LE
planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition: pixfmt.h:158
AV_PIX_FMT_YUV422P14BE
@ AV_PIX_FMT_YUV422P14BE
planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition: pixfmt.h:273
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: vf_stereo3d.c:282
AV_PIX_FMT_GBRP9BE
@ AV_PIX_FMT_GBRP9BE
planar GBR 4:4:4 27bpp, big-endian
Definition: pixfmt.h:167
AV_WB24
#define AV_WB24(p, d)
Definition: intreadwrite.h:446
AV_PIX_FMT_YUV420P10BE
@ AV_PIX_FMT_YUV420P10BE
planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
Definition: pixfmt.h:155
AVFILTER_DEFINE_CLASS
AVFILTER_DEFINE_CLASS(stereo3d)
ANAGLYPH_RC_DUBOIS
@ ANAGLYPH_RC_DUBOIS
Definition: vf_stereo3d.c:39
interleave_cols_to_any
static void interleave_cols_to_any(Stereo3DContext *s, int *out_off, int p, AVFrame *in, AVFrame *out, int d)
Definition: vf_stereo3d.c:632
AV_PIX_FMT_GBRP9LE
@ AV_PIX_FMT_GBRP9LE
planar GBR 4:4:4 27bpp, little-endian
Definition: pixfmt.h:168
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_stereo3d.c:1089
INTERLEAVE_COLS_LR
@ INTERLEAVE_COLS_LR
Definition: vf_stereo3d.c:66
height
#define height
ALTERNATING_RL
@ ALTERNATING_RL
Definition: vf_stereo3d.c:63
ANAGLYPH_YB_GRAY
@ ANAGLYPH_YB_GRAY
Definition: vf_stereo3d.c:44
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:174
AV_PIX_FMT_RGB0
@ AV_PIX_FMT_RGB0
packed RGB 8:8:8, 32bpp, RGBXRGBX... X=unused/undefined
Definition: pixfmt.h:263
OFFSET
#define OFFSET(x)
Definition: vf_stereo3d.c:157
AV_PIX_FMT_YUVA420P10LE
@ AV_PIX_FMT_YUVA420P10LE
planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian)
Definition: pixfmt.h:182
AV_PIX_FMT_ARGB
@ AV_PIX_FMT_ARGB
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
Definition: pixfmt.h:99
AV_PIX_FMT_BGRA64LE
@ AV_PIX_FMT_BGRA64LE
packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is st...
Definition: pixfmt.h:205
AV_PIX_FMT_YUVA422P10BE
@ AV_PIX_FMT_YUVA422P10BE
planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian)
Definition: pixfmt.h:183
Stereo3DContext::aspect
AVRational aspect
Definition: vf_stereo3d.c:153
ANAGLYPH_GM_DUBOIS
@ ANAGLYPH_GM_DUBOIS
Definition: vf_stereo3d.c:43
AV_PIX_FMT_YUVA422P9BE
@ AV_PIX_FMT_YUVA422P9BE
planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), big-endian
Definition: pixfmt.h:177
AV_PIX_FMT_RGB48BE
@ AV_PIX_FMT_RGB48BE
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big...
Definition: pixfmt.h:109
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
ff_filter_get_nb_threads
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
Definition: avfilter.c:834
ThreadData
Used for passing data between threads.
Definition: dsddec.c:71
StereoCode
StereoCode
Definition: vf_stereo3d.c:35
FLAGS
#define FLAGS
Definition: vf_stereo3d.c:158
FFMIN
#define FFMIN(a, b)
Definition: macros.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:107
filter_slice
static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_stereo3d.c:608
AVFilterPad::name
const char * name
Pad name.
Definition: filters.h:44
AV_WB48
#define AV_WB48(p, darg)
Definition: intreadwrite.h:477
AV_PIX_FMT_YUV444P16BE
@ AV_PIX_FMT_YUV444P16BE
planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition: pixfmt.h:133
Stereo3DContext::width
int width
Definition: vf_stereo3d.c:143
AVFilter
Filter definition.
Definition: avfilter.h:201
ANAGLYPH_GM_GRAY
@ ANAGLYPH_GM_GRAY
Definition: vf_stereo3d.c:40
ANAGLYPH_GM_HALF
@ ANAGLYPH_GM_HALF
Definition: vf_stereo3d.c:41
ret
ret
Definition: filter_design.txt:187
AV_PIX_FMT_0BGR
@ AV_PIX_FMT_0BGR
packed BGR 8:8:8, 32bpp, XBGRXBGR... X=unused/undefined
Definition: pixfmt.h:264
FFSWAP
#define FFSWAP(type, a, b)
Definition: macros.h:52
StereoComponent::height
int height
Definition: vf_stereo3d.c:74
stereo3d.h
left
Tag MUST be and< 10hcoeff half pel interpolation filter coefficients, hcoeff[0] are the 2 middle coefficients[1] are the next outer ones and so on, resulting in a filter like:...eff[2], hcoeff[1], hcoeff[0], hcoeff[0], hcoeff[1], hcoeff[2] ... the sign of the coefficients is not explicitly stored but alternates after each coeff and coeff[0] is positive, so ...,+,-,+,-,+,+,-,+,-,+,... hcoeff[0] is not explicitly stored but found by subtracting the sum of all stored coefficients with signs from 32 hcoeff[0]=32 - hcoeff[1] - hcoeff[2] - ... a good choice for hcoeff and htaps is htaps=6 hcoeff={40,-10, 2} an alternative which requires more computations at both encoder and decoder side and may or may not be better is htaps=8 hcoeff={42,-14, 6,-2}ref_frames minimum of the number of available reference frames and max_ref_frames for example the first frame after a key frame always has ref_frames=1spatial_decomposition_type wavelet type 0 is a 9/7 symmetric compact integer wavelet 1 is a 5/3 symmetric compact integer wavelet others are reserved stored as delta from last, last is reset to 0 if always_reset||keyframeqlog quality(logarithmic quantizer scale) stored as delta from last, last is reset to 0 if always_reset||keyframemv_scale stored as delta from last, last is reset to 0 if always_reset||keyframe FIXME check that everything works fine if this changes between framesqbias dequantization bias stored as delta from last, last is reset to 0 if always_reset||keyframeblock_max_depth maximum depth of the block tree stored as delta from last, last is reset to 0 if always_reset||keyframequant_table quantization tableHighlevel bitstream structure:==============================--------------------------------------------|Header|--------------------------------------------|------------------------------------|||Block0||||split?||||yes no||||......... intra?||||:Block01 :yes no||||:Block02 :....... ..........||||:Block03 ::y DC ::ref index:||||:Block04 ::cb DC ::motion x :||||......... :cr DC ::motion y :||||....... ..........|||------------------------------------||------------------------------------|||Block1|||...|--------------------------------------------|------------ ------------ ------------|||Y subbands||Cb subbands||Cr subbands||||--- ---||--- ---||--- ---|||||LL0||HL0||||LL0||HL0||||LL0||HL0|||||--- ---||--- ---||--- ---||||--- ---||--- ---||--- ---|||||LH0||HH0||||LH0||HH0||||LH0||HH0|||||--- ---||--- ---||--- ---||||--- ---||--- ---||--- ---|||||HL1||LH1||||HL1||LH1||||HL1||LH1|||||--- ---||--- ---||--- ---||||--- ---||--- ---||--- ---|||||HH1||HL2||||HH1||HL2||||HH1||HL2|||||...||...||...|||------------ ------------ ------------|--------------------------------------------Decoding process:=================------------|||Subbands|------------||||------------|Intra DC||||LL0 subband prediction ------------|\ Dequantization ------------------- \||Reference frames|\ IDWT|------- -------|Motion \|||Frame 0||Frame 1||Compensation . OBMC v -------|------- -------|--------------. \------> Frame n output Frame Frame<----------------------------------/|...|------------------- Range Coder:============Binary Range Coder:------------------- The implemented range coder is an adapted version based upon "Range encoding: an algorithm for removing redundancy from a digitised message." by G. N. N. Martin. The symbols encoded by the Snow range coder are bits(0|1). The associated probabilities are not fix but change depending on the symbol mix seen so far. bit seen|new state ---------+----------------------------------------------- 0|256 - state_transition_table[256 - old_state];1|state_transition_table[old_state];state_transition_table={ 0, 0, 0, 0, 0, 0, 0, 0, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 190, 191, 192, 194, 194, 195, 196, 197, 198, 199, 200, 201, 202, 202, 204, 205, 206, 207, 208, 209, 209, 210, 211, 212, 213, 215, 215, 216, 217, 218, 219, 220, 220, 222, 223, 224, 225, 226, 227, 227, 229, 229, 230, 231, 232, 234, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 248, 0, 0, 0, 0, 0, 0, 0};FIXME Range Coding of integers:------------------------- FIXME Neighboring Blocks:===================left and top are set to the respective blocks unless they are outside of the image in which case they are set to the Null block top-left is set to the top left block unless it is outside of the image in which case it is set to the left block if this block has no larger parent block or it is at the left side of its parent block and the top right block is not outside of the image then the top right block is used for top-right else the top-left block is used Null block y, cb, cr are 128 level, ref, mx and my are 0 Motion Vector Prediction:=========================1. the motion vectors of all the neighboring blocks are scaled to compensate for the difference of reference frames scaled_mv=(mv *(256 *(current_reference+1)/(mv.reference+1))+128)> the median of the scaled left
Definition: snow.txt:386
AV_PIX_FMT_GBRP12BE
@ AV_PIX_FMT_GBRP12BE
planar GBR 4:4:4 36bpp, big-endian
Definition: pixfmt.h:279
AV_PIX_FMT_YUV444P12BE
@ AV_PIX_FMT_YUV444P12BE
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition: pixfmt.h:275
StereoComponent::row_right
int row_right
Definition: vf_stereo3d.c:77
ff_filter_execute
int ff_filter_execute(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs)
Definition: avfilter.c:1651
ff_stereo3d_init_x86
void ff_stereo3d_init_x86(Stereo3DDSPContext *dsp)
Definition: vf_stereo3d_init.c:30
AVRational::den
int den
Denominator.
Definition: rational.h:60
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
avfilter.h
AV_PIX_FMT_YUV444P9LE
@ AV_PIX_FMT_YUV444P9LE
planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:160
StereoComponent::row_left
int row_left
Definition: vf_stereo3d.c:77
ANAGLYPH_RC_GRAY
@ ANAGLYPH_RC_GRAY
Definition: vf_stereo3d.c:36
AV_PIX_FMT_YUVA420P10BE
@ AV_PIX_FMT_YUVA420P10BE
planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian)
Definition: pixfmt.h:181
av_image_fill_max_pixsteps
void av_image_fill_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4], const AVPixFmtDescriptor *pixdesc)
Compute the max pixel step for each plane of an image with a format described by pixdesc.
Definition: imgutils.c:35
av_clip_uint8
#define av_clip_uint8
Definition: common.h:106
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:78
SIDE_BY_SIDE_2_RL
@ SIDE_BY_SIDE_2_RL
Definition: vf_stereo3d.c:57
AVFilterContext
An instance of a filter.
Definition: avfilter.h:457
AV_PIX_FMT_YUV420P16BE
@ AV_PIX_FMT_YUV420P16BE
planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
Definition: pixfmt.h:129
Stereo3DDSPContext
Definition: stereo3d.h:27
AV_PIX_FMT_GBRP
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:165
AV_PIX_FMT_YUV422P16BE
@ AV_PIX_FMT_YUV422P16BE
planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition: pixfmt.h:131
AVFILTER_FLAG_SLICE_THREADS
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition: avfilter.h:152
desc
const char * desc
Definition: libsvtav1.c:79
Stereo3DContext::pixstep
int pixstep[4]
Definition: vf_stereo3d.c:149
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
Stereo3DContext::in
StereoComponent in
Definition: vf_stereo3d.c:142
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:77
AV_PIX_FMT_YUVA444P10LE
@ AV_PIX_FMT_YUVA444P10LE
planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian)
Definition: pixfmt.h:186
AVPixFmtDescriptor
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:69
ff_vf_stereo3d
const AVFilter ff_vf_stereo3d
Definition: vf_stereo3d.c:1112
src
INIT_CLIP pixel * src
Definition: h264pred_template.c:418
anaglyph
static void anaglyph(uint8_t *dst, uint8_t *lsrc, uint8_t *rsrc, ptrdiff_t dst_linesize, ptrdiff_t l_linesize, ptrdiff_t r_linesize, int width, int height, const int *ana_matrix_r, const int *ana_matrix_g, const int *ana_matrix_b)
Definition: vf_stereo3d.c:342
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:80
ff_fill_rgba_map
int ff_fill_rgba_map(uint8_t *rgba_map, enum AVPixelFormat pix_fmt)
Definition: drawutils.c:35
AV_PIX_FMT_YUVA422P16BE
@ AV_PIX_FMT_YUVA422P16BE
planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian)
Definition: pixfmt.h:189
AV_PIX_FMT_YUV422P9LE
@ AV_PIX_FMT_YUV422P9LE
planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition: pixfmt.h:164
AV_PIX_FMT_YUVA422P16LE
@ AV_PIX_FMT_YUVA422P16LE
planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian)
Definition: pixfmt.h:190
AV_PIX_FMT_GBRP14LE
@ AV_PIX_FMT_GBRP14LE
planar GBR 4:4:4 42bpp, little-endian
Definition: pixfmt.h:282
d
d
Definition: ffmpeg_filter.c:424
imgutils.h
AVFrame::linesize
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:419
AV_PIX_FMT_0RGB
@ AV_PIX_FMT_0RGB
packed RGB 8:8:8, 32bpp, XRGBXRGB... X=unused/undefined
Definition: pixfmt.h:262
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:79
coeff
static const double coeff[2][5]
Definition: vf_owdenoise.c:80
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
AV_WN64
#define AV_WN64(p, v)
Definition: intreadwrite.h:376
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
StereoComponent::width
int width
Definition: vf_stereo3d.c:74
SIDE_BY_SIDE_2_LR
@ SIDE_BY_SIDE_2_LR
Definition: vf_stereo3d.c:56
SIDE_BY_SIDE_RL
@ SIDE_BY_SIDE_RL
Definition: vf_stereo3d.c:55
anaglyph_ic
static void anaglyph_ic(uint8_t *dst, uint8_t *lsrc, uint8_t *rsrc, ptrdiff_t dst_linesize, ptrdiff_t l_linesize, ptrdiff_t r_linesize, int width, int height, const int *ana_matrix_r, const int *ana_matrix_g, const int *ana_matrix_b)
Definition: vf_stereo3d.c:322
h
h
Definition: vp9dsp_template.c:2070
ABOVE_BELOW_RL
@ ABOVE_BELOW_RL
Definition: vf_stereo3d.c:59
StereoComponent::off_lstep
int off_lstep
Definition: vf_stereo3d.c:76
AV_PIX_FMT_YUVA444P16LE
@ AV_PIX_FMT_YUVA444P16LE
planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian)
Definition: pixfmt.h:192
drawutils.h
AV_RB24
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_RB24
Definition: bytestream.h:97
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition: opt.h:299
AV_PIX_FMT_YUV422P12LE
@ AV_PIX_FMT_YUV422P12LE
planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition: pixfmt.h:272
AV_PIX_FMT_YUVA420P9BE
@ AV_PIX_FMT_YUVA420P9BE
planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), big-endian
Definition: pixfmt.h:175
StereoComponent::off_left
int off_left
Definition: vf_stereo3d.c:75
FILTER_QUERY_FUNC
#define FILTER_QUERY_FUNC(func)
Definition: filters.h:236
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:173
AV_PIX_FMT_BGR48BE
@ AV_PIX_FMT_BGR48BE
packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as big...
Definition: pixfmt.h:145
STEREO_CODE_COUNT
@ STEREO_CODE_COUNT
Definition: vf_stereo3d.c:69
AV_PIX_FMT_YUVA422P9LE
@ AV_PIX_FMT_YUVA422P9LE
planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), little-endian
Definition: pixfmt.h:178
AV_WN16
#define AV_WN16(p, v)
Definition: intreadwrite.h:368