Mercurial > mplayer.hg
annotate libmpcodecs/vf_stereo3d.c @ 33662:03117468ae0e
Remove needless memset initialization of guiInfo.
Use designators for structure initialization and
symbolic constant instead of numeric constant for
StreamType.
author | ib |
---|---|
date | Tue, 28 Jun 2011 09:07:43 +0000 |
parents | 042b10b477fa |
children | 475d96f700d4 |
rev | line source |
---|---|
32441 | 1 /* |
2 * Copyright (C) 2010 Gordon Schmidt <gordon.schmidt <at> s2000.tu-chemnitz.de> | |
3 * | |
4 * This file is part of MPlayer. | |
5 * | |
6 * MPlayer is free software; you can redistribute it and/or modify | |
7 * it under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation; either version 2 of the License, or | |
9 * (at your option) any later version. | |
10 * | |
11 * MPlayer is distributed in the hope that it will be useful, | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 * GNU General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License along | |
17 * with MPlayer; if not, write to the Free Software Foundation, Inc., | |
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
19 */ | |
20 | |
21 //==includes==// | |
22 #include <stdio.h> | |
23 #include <stdlib.h> | |
24 #include <string.h> | |
25 | |
26 #include "config.h" | |
27 #include "mp_msg.h" | |
28 #include "help_mp.h" | |
29 | |
30 #include "img_format.h" | |
31 #include "mp_image.h" | |
32445
7ec524214684
Use proper include instead of extern declarations in the .c file.
reimar
parents:
32441
diff
changeset
|
32 #include "vd.h" |
32441 | 33 #include "vf.h" |
34 #include "m_struct.h" | |
35 | |
36 #include "libavutil/common.h" | |
37 #include "libvo/fastmemcpy.h" | |
38 | |
39 //==types==// | |
40 typedef enum stereo_code { | |
41 ANAGLYPH_RC_GRAY, //anaglyph red/cyan gray | |
42 ANAGLYPH_RC_HALF, //anaglyph red/cyan half colored | |
43 ANAGLYPH_RC_COLOR, //anaglyph red/cyan colored | |
44 ANAGLYPH_RC_DUBOIS, //anaglyph red/cyan dubois | |
45 ANAGLYPH_GM_GRAY, //anaglyph green/magenta gray | |
46 ANAGLYPH_GM_HALF, //anaglyph green/magenta half colored | |
47 ANAGLYPH_GM_COLOR, //anaglyph green/magenta colored | |
48 ANAGLYPH_YB_GRAY, //anaglyph yellow/blue gray | |
49 ANAGLYPH_YB_HALF, //anaglyph yellow/blue half colored | |
50 ANAGLYPH_YB_COLOR, //anaglyph yellow/blue colored | |
51 MONO_L, //mono output for debugging (left eye only) | |
52 MONO_R, //mono output for debugging (right eye only) | |
53 SIDE_BY_SIDE_LR, //side by side parallel (left eye left, right eye right) | |
54 SIDE_BY_SIDE_RL, //side by side crosseye (right eye left, left eye right) | |
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 | |
33560
16cf555989a9
Add support for converting to interleaved 3D in vf_stereo3d.
reimar
parents:
32541
diff
changeset
|
59 INTERLEAVE_ROWS_LR, //row-interleave (left eye has top row) |
16cf555989a9
Add support for converting to interleaved 3D in vf_stereo3d.
reimar
parents:
32541
diff
changeset
|
60 INTERLEAVE_ROWS_RL, //row-interleave (right eye has top row) |
32441 | 61 STEREO_CODE_COUNT //no value set - TODO: needs autodetection |
62 } stereo_code; | |
63 | |
64 typedef struct component { | |
65 stereo_code fmt; | |
66 unsigned int width; | |
67 unsigned int height; | |
68 unsigned int off_left; | |
69 unsigned int off_right; | |
32539 | 70 unsigned int row_left; |
71 unsigned int row_right; | |
32441 | 72 } component; |
73 | |
74 //==global variables==// | |
75 static const int ana_coeff[10][3][6] = { | |
76 {{19595, 38470, 7471, 0, 0, 0}, //ANAGLYPH_RC_GRAY | |
77 { 0, 0, 0, 19595, 38470, 7471}, | |
78 { 0, 0, 0, 19595, 38470, 7471}}, | |
79 {{19595, 38470, 7471, 0, 0, 0}, //ANAGLYPH_RC_HALF | |
80 { 0, 0, 0, 0, 65536, 0}, | |
81 { 0, 0, 0, 0, 0, 65536}}, | |
82 {{65536, 0, 0, 0, 0, 0}, //ANAGLYPH_RC_COLOR | |
83 { 0, 0, 0, 0, 65536, 0}, | |
84 { 0, 0, 0, 0, 0, 65536}}, | |
85 {{29891, 32800, 11559, -2849, -5763, -102}, //ANAGLYPH_RC_DUBOIS | |
86 {-2627, -2479, -1033, 24804, 48080, -1209}, | |
87 { -997, -1350, -358, -4729, -7403, 80373}}, | |
88 {{ 0, 0, 0, 19595, 38470, 7471}, //ANAGLYPH_GM_GRAY | |
89 {19595, 38470, 7471, 0, 0, 0}, | |
90 { 0, 0, 0, 19595, 38470, 7471}}, | |
91 {{ 0, 0, 0, 65536, 0, 0}, //ANAGLYPH_GM_HALF | |
92 {19595, 38470, 7471, 0, 0, 0}, | |
93 { 0, 0, 0, 0, 0, 65536}}, | |
94 {{ 0, 0, 0, 65536, 0, 0}, //ANAGLYPH_GM_COLOR | |
95 { 0, 65536, 0, 0, 0, 0}, | |
96 { 0, 0, 0, 0, 0, 65536}}, | |
97 {{ 0, 0, 0, 19595, 38470, 7471}, //ANAGLYPH_YB_GRAY | |
98 { 0, 0, 0, 19595, 38470, 7471}, | |
99 {19595, 38470, 7471, 0, 0, 0}}, | |
100 {{ 0, 0, 0, 65536, 0, 0}, //ANAGLYPH_YB_HALF | |
101 { 0, 0, 0, 0, 65536, 0}, | |
102 {19595, 38470, 7471, 0, 0, 0}}, | |
103 {{ 0, 0, 0, 65536, 0, 0}, //ANAGLYPH_YB_COLOR | |
104 { 0, 0, 0, 0, 65536, 0}, | |
105 { 0, 0, 65536, 0, 0, 0}} | |
106 }; | |
107 | |
108 struct vf_priv_s { | |
109 component in; | |
110 component out; | |
111 int ana_matrix[3][6]; | |
112 unsigned int width; | |
113 unsigned int height; | |
33560
16cf555989a9
Add support for converting to interleaved 3D in vf_stereo3d.
reimar
parents:
32541
diff
changeset
|
114 unsigned int row_step; |
32441 | 115 } const vf_priv_default = { |
116 {SIDE_BY_SIDE_LR}, | |
117 {ANAGLYPH_RC_DUBOIS} | |
118 }; | |
119 | |
120 //==functions==// | |
121 static inline uint8_t ana_convert(int coeff[6], uint8_t left[3], uint8_t right[3]) | |
122 { | |
123 int sum; | |
124 | |
125 sum = coeff[0] * left[0] + coeff[3] * right[0]; //red in | |
126 sum += coeff[1] * left[1] + coeff[4] * right[1]; //green in | |
127 sum += coeff[2] * left[2] + coeff[5] * right[2]; //blue in | |
128 return av_clip_uint8(sum >> 16); | |
129 } | |
130 | |
131 static int config(struct vf_instance *vf, int width, int height, int d_width, | |
132 int d_height, unsigned int flags, unsigned int outfmt) | |
133 { | |
134 if ((width & 1) || (height & 1)) { | |
135 mp_msg(MSGT_VFILTER, MSGL_WARN, "[stereo3d] invalid height or width\n"); | |
136 return 0; | |
137 } | |
138 //default input values | |
139 vf->priv->width = width; | |
140 vf->priv->height = height; | |
33560
16cf555989a9
Add support for converting to interleaved 3D in vf_stereo3d.
reimar
parents:
32541
diff
changeset
|
141 vf->priv->row_step = 1; |
32441 | 142 vf->priv->in.width = width; |
143 vf->priv->in.height = height; | |
144 vf->priv->in.off_left = 0; | |
145 vf->priv->in.off_right = 0; | |
32539 | 146 vf->priv->in.row_left = 0; |
147 vf->priv->in.row_right = 0; | |
32441 | 148 |
149 //check input format | |
150 switch (vf->priv->in.fmt) { | |
151 case SIDE_BY_SIDE_LR: | |
152 vf->priv->width = width / 2; | |
153 vf->priv->in.off_right = vf->priv->width * 3; | |
154 break; | |
155 case SIDE_BY_SIDE_RL: | |
156 vf->priv->width = width / 2; | |
157 vf->priv->in.off_left = vf->priv->width * 3; | |
158 break; | |
32538 | 159 case ABOVE_BELOW_2_LR: |
160 d_height *= 2; | |
32441 | 161 case ABOVE_BELOW_LR: |
162 vf->priv->height = height / 2; | |
32539 | 163 vf->priv->in.row_right = vf->priv->height; |
32441 | 164 break; |
32538 | 165 case ABOVE_BELOW_2_RL: |
166 d_height *= 2; | |
32441 | 167 case ABOVE_BELOW_RL: |
168 vf->priv->height = height / 2; | |
32539 | 169 vf->priv->in.row_left = vf->priv->height; |
32441 | 170 break; |
171 default: | |
172 mp_msg(MSGT_VFILTER, MSGL_WARN, | |
173 "[stereo3d] stereo format of input is not supported\n"); | |
174 return 0; | |
175 break; | |
176 } | |
177 //default output values | |
178 vf->priv->out.width = vf->priv->width; | |
179 vf->priv->out.height = vf->priv->height; | |
180 vf->priv->out.off_left = 0; | |
181 vf->priv->out.off_right = 0; | |
32539 | 182 vf->priv->out.row_left = 0; |
183 vf->priv->out.row_right = 0; | |
32441 | 184 |
185 //check output format | |
186 switch (vf->priv->out.fmt) { | |
187 case ANAGLYPH_RC_GRAY: | |
188 case ANAGLYPH_RC_HALF: | |
189 case ANAGLYPH_RC_COLOR: | |
190 case ANAGLYPH_RC_DUBOIS: | |
191 case ANAGLYPH_GM_GRAY: | |
192 case ANAGLYPH_GM_HALF: | |
193 case ANAGLYPH_GM_COLOR: | |
194 case ANAGLYPH_YB_GRAY: | |
195 case ANAGLYPH_YB_HALF: | |
196 case ANAGLYPH_YB_COLOR: | |
197 memcpy(vf->priv->ana_matrix, ana_coeff[vf->priv->out.fmt], | |
198 sizeof(vf->priv->ana_matrix)); | |
199 break; | |
200 case SIDE_BY_SIDE_LR: | |
201 vf->priv->out.width = vf->priv->width * 2; | |
202 vf->priv->out.off_right = vf->priv->width * 3; | |
203 break; | |
204 case SIDE_BY_SIDE_RL: | |
205 vf->priv->out.width = vf->priv->width * 2; | |
206 vf->priv->out.off_left = vf->priv->width * 3; | |
207 break; | |
32538 | 208 case ABOVE_BELOW_2_LR: |
209 d_height /= 2; | |
32441 | 210 case ABOVE_BELOW_LR: |
211 vf->priv->out.height = vf->priv->height * 2; | |
32539 | 212 vf->priv->out.row_right = vf->priv->height; |
32441 | 213 break; |
32538 | 214 case ABOVE_BELOW_2_RL: |
215 d_height /= 2; | |
32441 | 216 case ABOVE_BELOW_RL: |
217 vf->priv->out.height = vf->priv->height * 2; | |
32539 | 218 vf->priv->out.row_left = vf->priv->height; |
32441 | 219 break; |
33560
16cf555989a9
Add support for converting to interleaved 3D in vf_stereo3d.
reimar
parents:
32541
diff
changeset
|
220 case INTERLEAVE_ROWS_LR: |
16cf555989a9
Add support for converting to interleaved 3D in vf_stereo3d.
reimar
parents:
32541
diff
changeset
|
221 vf->priv->row_step = 2; |
16cf555989a9
Add support for converting to interleaved 3D in vf_stereo3d.
reimar
parents:
32541
diff
changeset
|
222 vf->priv->height = vf->priv->height / 2; |
16cf555989a9
Add support for converting to interleaved 3D in vf_stereo3d.
reimar
parents:
32541
diff
changeset
|
223 vf->priv->out.off_right = vf->priv->width * 3; |
16cf555989a9
Add support for converting to interleaved 3D in vf_stereo3d.
reimar
parents:
32541
diff
changeset
|
224 vf->priv->in.off_right += vf->priv->in.width * 3; |
16cf555989a9
Add support for converting to interleaved 3D in vf_stereo3d.
reimar
parents:
32541
diff
changeset
|
225 break; |
16cf555989a9
Add support for converting to interleaved 3D in vf_stereo3d.
reimar
parents:
32541
diff
changeset
|
226 case INTERLEAVE_ROWS_RL: |
16cf555989a9
Add support for converting to interleaved 3D in vf_stereo3d.
reimar
parents:
32541
diff
changeset
|
227 vf->priv->row_step = 2; |
16cf555989a9
Add support for converting to interleaved 3D in vf_stereo3d.
reimar
parents:
32541
diff
changeset
|
228 vf->priv->height = vf->priv->height / 2; |
16cf555989a9
Add support for converting to interleaved 3D in vf_stereo3d.
reimar
parents:
32541
diff
changeset
|
229 vf->priv->out.off_left = vf->priv->width * 3; |
16cf555989a9
Add support for converting to interleaved 3D in vf_stereo3d.
reimar
parents:
32541
diff
changeset
|
230 vf->priv->in.off_left += vf->priv->in.width * 3; |
16cf555989a9
Add support for converting to interleaved 3D in vf_stereo3d.
reimar
parents:
32541
diff
changeset
|
231 break; |
32441 | 232 case MONO_R: |
233 //same as MONO_L only needs switching of input offsets | |
234 vf->priv->in.off_left = vf->priv->in.off_right; | |
32539 | 235 vf->priv->in.row_left = vf->priv->in.row_right; |
32441 | 236 //nobreak; |
237 case MONO_L: | |
238 //use default settings | |
239 break; | |
240 default: | |
241 mp_msg(MSGT_VFILTER, MSGL_WARN, | |
242 "[stereo3d] stereo format of output is not supported\n"); | |
243 return 0; | |
244 break; | |
245 } | |
246 if (!opt_screen_size_x && !opt_screen_size_y) { | |
247 d_width = d_width * vf->priv->out.width / width; | |
248 d_height = d_height * vf->priv->out.height / height; | |
249 } | |
250 return vf_next_config(vf, vf->priv->out.width, vf->priv->out.height, | |
251 d_width, d_height, flags, outfmt); | |
252 } | |
253 | |
254 static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts) | |
255 { | |
256 mp_image_t *dmpi; | |
257 if (vf->priv->in.fmt == vf->priv->out.fmt) { //nothing to do | |
258 dmpi = mpi; | |
259 } else { | |
32539 | 260 int out_off_left, out_off_right; |
261 int in_off_left = vf->priv->in.row_left * mpi->stride[0] + | |
262 vf->priv->in.off_left; | |
263 int in_off_right = vf->priv->in.row_right * mpi->stride[0] + | |
264 vf->priv->in.off_right; | |
265 | |
32541
45b3a91e8fb7
Indicate that stereo3d can now handle strides properly.
reimar
parents:
32540
diff
changeset
|
266 dmpi = vf_get_image(vf->next, IMGFMT_RGB24, MP_IMGTYPE_TEMP, |
45b3a91e8fb7
Indicate that stereo3d can now handle strides properly.
reimar
parents:
32540
diff
changeset
|
267 MP_IMGFLAG_ACCEPT_STRIDE, |
32441 | 268 vf->priv->out.width, vf->priv->out.height); |
32539 | 269 out_off_left = vf->priv->out.row_left * dmpi->stride[0] + |
270 vf->priv->out.off_left; | |
271 out_off_right = vf->priv->out.row_right * dmpi->stride[0] + | |
272 vf->priv->out.off_right; | |
273 | |
32441 | 274 switch (vf->priv->out.fmt) { |
275 case SIDE_BY_SIDE_LR: | |
276 case SIDE_BY_SIDE_RL: | |
277 case ABOVE_BELOW_LR: | |
278 case ABOVE_BELOW_RL: | |
279 case ABOVE_BELOW_2_LR: | |
280 case ABOVE_BELOW_2_RL: | |
33560
16cf555989a9
Add support for converting to interleaved 3D in vf_stereo3d.
reimar
parents:
32541
diff
changeset
|
281 case INTERLEAVE_ROWS_LR: |
16cf555989a9
Add support for converting to interleaved 3D in vf_stereo3d.
reimar
parents:
32541
diff
changeset
|
282 case INTERLEAVE_ROWS_RL: |
33602
042b10b477fa
Change memcpy_pic to force it to never write to image parts between
reimar
parents:
33599
diff
changeset
|
283 memcpy_pic2(dmpi->planes[0] + out_off_left, |
32539 | 284 mpi->planes[0] + in_off_left, |
32538 | 285 3 * vf->priv->width, |
286 vf->priv->height, | |
33560
16cf555989a9
Add support for converting to interleaved 3D in vf_stereo3d.
reimar
parents:
32541
diff
changeset
|
287 dmpi->stride[0] * vf->priv->row_step, |
33602
042b10b477fa
Change memcpy_pic to force it to never write to image parts between
reimar
parents:
33599
diff
changeset
|
288 mpi->stride[0] * vf->priv->row_step, |
042b10b477fa
Change memcpy_pic to force it to never write to image parts between
reimar
parents:
33599
diff
changeset
|
289 vf->priv->row_step != 1); |
042b10b477fa
Change memcpy_pic to force it to never write to image parts between
reimar
parents:
33599
diff
changeset
|
290 memcpy_pic2(dmpi->planes[0] + out_off_right, |
32539 | 291 mpi->planes[0] + in_off_right, |
32538 | 292 3 * vf->priv->width, |
293 vf->priv->height, | |
33560
16cf555989a9
Add support for converting to interleaved 3D in vf_stereo3d.
reimar
parents:
32541
diff
changeset
|
294 dmpi->stride[0] * vf->priv->row_step, |
33602
042b10b477fa
Change memcpy_pic to force it to never write to image parts between
reimar
parents:
33599
diff
changeset
|
295 mpi->stride[0] * vf->priv->row_step, |
042b10b477fa
Change memcpy_pic to force it to never write to image parts between
reimar
parents:
33599
diff
changeset
|
296 vf->priv->row_step != 1); |
32441 | 297 break; |
298 case MONO_L: | |
299 case MONO_R: | |
32538 | 300 memcpy_pic(dmpi->planes[0], |
32539 | 301 mpi->planes[0] + in_off_left, |
32538 | 302 3 * vf->priv->width, |
303 vf->priv->height, | |
32539 | 304 dmpi->stride[0], |
305 mpi->stride[0]); | |
32441 | 306 break; |
307 case ANAGLYPH_RC_GRAY: | |
308 case ANAGLYPH_RC_HALF: | |
309 case ANAGLYPH_RC_COLOR: | |
310 case ANAGLYPH_RC_DUBOIS: | |
311 case ANAGLYPH_GM_GRAY: | |
312 case ANAGLYPH_GM_HALF: | |
313 case ANAGLYPH_GM_COLOR: | |
314 case ANAGLYPH_YB_GRAY: | |
315 case ANAGLYPH_YB_HALF: | |
316 case ANAGLYPH_YB_COLOR: { | |
33599
6d690eac34eb
Avoid C99 syntax not supported by some old compilers.
reimar
parents:
33560
diff
changeset
|
317 int i,x,y,il,ir,o; |
32441 | 318 unsigned char *source = mpi->planes[0]; |
319 unsigned char *dest = dmpi->planes[0]; | |
320 unsigned int out_width = vf->priv->out.width; | |
321 int *ana_matrix[3]; | |
322 | |
33599
6d690eac34eb
Avoid C99 syntax not supported by some old compilers.
reimar
parents:
33560
diff
changeset
|
323 for(i = 0; i < 3; i++) |
32441 | 324 ana_matrix[i] = vf->priv->ana_matrix[i]; |
325 | |
326 for (y = 0; y < vf->priv->out.height; y++) { | |
32539 | 327 o = dmpi->stride[0] * y; |
328 il = in_off_left + y * mpi->stride[0]; | |
329 ir = in_off_right + y * mpi->stride[0]; | |
32441 | 330 for (x = 0; x < out_width; x++) { |
331 dest[o ] = ana_convert( | |
332 ana_matrix[0], source + il, source + ir); //red out | |
333 dest[o + 1] = ana_convert( | |
334 ana_matrix[1], source + il, source + ir); //green out | |
335 dest[o + 2] = ana_convert( | |
336 ana_matrix[2], source + il, source + ir); //blue out | |
337 il += 3; | |
338 ir += 3; | |
339 o += 3; | |
340 } | |
341 } | |
342 break; | |
343 } | |
344 default: | |
345 mp_msg(MSGT_VFILTER, MSGL_WARN, | |
346 "[stereo3d] stereo format of output is not supported\n"); | |
347 return 0; | |
348 break; | |
349 } | |
350 } | |
351 return vf_next_put_image(vf, dmpi, pts); | |
352 } | |
353 | |
354 static int query_format(struct vf_instance *vf, unsigned int fmt) | |
355 { | |
356 switch (fmt) | |
357 case IMGFMT_RGB24: | |
358 return vf_next_query_format(vf, fmt); | |
359 return 0; | |
360 } | |
361 | |
362 static void uninit(vf_instance_t *vf) | |
363 { | |
364 free(vf->priv); | |
365 } | |
366 | |
367 static int vf_open(vf_instance_t *vf, char *args) | |
368 { | |
369 vf->config = config; | |
370 vf->uninit = uninit; | |
371 vf->put_image = put_image; | |
372 vf->query_format = query_format; | |
373 | |
374 return 1; | |
375 } | |
376 | |
377 ///Presets usage | |
378 static const struct format_preset { | |
379 char* name; | |
380 stereo_code scode; | |
381 } vf_format_presets_defs[] = { | |
382 {"arcg", ANAGLYPH_RC_GRAY}, | |
383 {"anaglyph_red_cyan_gray", ANAGLYPH_RC_GRAY}, | |
384 {"arch", ANAGLYPH_RC_HALF}, | |
385 {"anaglyph_red_cyan_half_color", ANAGLYPH_RC_HALF}, | |
386 {"arcc", ANAGLYPH_RC_COLOR}, | |
387 {"anaglyph_red_cyan_color", ANAGLYPH_RC_COLOR}, | |
388 {"arcd", ANAGLYPH_RC_DUBOIS}, | |
389 {"anaglyph_red_cyan_dubios", ANAGLYPH_RC_DUBOIS}, | |
390 {"agmg", ANAGLYPH_GM_GRAY}, | |
391 {"anaglyph_green_magenta_gray", ANAGLYPH_GM_GRAY}, | |
392 {"agmh", ANAGLYPH_GM_HALF}, | |
393 {"anaglyph_green_magenta_half_color",ANAGLYPH_GM_HALF}, | |
394 {"agmc", ANAGLYPH_GM_COLOR}, | |
395 {"anaglyph_green_magenta_color", ANAGLYPH_GM_COLOR}, | |
396 {"aybg", ANAGLYPH_YB_GRAY}, | |
397 {"anaglyph_yellow_blue_gray", ANAGLYPH_YB_GRAY}, | |
398 {"aybh", ANAGLYPH_YB_HALF}, | |
399 {"anaglyph_yellow_blue_half_color", ANAGLYPH_YB_HALF}, | |
400 {"aybc", ANAGLYPH_YB_COLOR}, | |
401 {"anaglyph_yellow_blue_color", ANAGLYPH_YB_COLOR}, | |
402 {"ml", MONO_L}, | |
403 {"mono_left", MONO_L}, | |
404 {"mr", MONO_R}, | |
405 {"mono_right", MONO_R}, | |
406 {"sbsl", SIDE_BY_SIDE_LR}, | |
407 {"side_by_side_left_first", SIDE_BY_SIDE_LR}, | |
408 {"sbsr", SIDE_BY_SIDE_RL}, | |
409 {"side_by_side_right_first", SIDE_BY_SIDE_RL}, | |
410 {"abl", ABOVE_BELOW_LR}, | |
411 {"above_below_left_first", ABOVE_BELOW_LR}, | |
412 {"abr", ABOVE_BELOW_RL}, | |
413 {"above_below_right_first", ABOVE_BELOW_RL}, | |
414 {"ab2l", ABOVE_BELOW_2_LR}, | |
415 {"above_below_half_height_left_first", ABOVE_BELOW_2_LR}, | |
416 {"ab2r", ABOVE_BELOW_2_RL}, | |
417 {"above_below_half_height_right_first",ABOVE_BELOW_2_RL}, | |
33560
16cf555989a9
Add support for converting to interleaved 3D in vf_stereo3d.
reimar
parents:
32541
diff
changeset
|
418 {"irl", INTERLEAVE_ROWS_LR}, |
16cf555989a9
Add support for converting to interleaved 3D in vf_stereo3d.
reimar
parents:
32541
diff
changeset
|
419 {"interleave_rows_left_first", INTERLEAVE_ROWS_LR}, |
16cf555989a9
Add support for converting to interleaved 3D in vf_stereo3d.
reimar
parents:
32541
diff
changeset
|
420 {"irr", INTERLEAVE_ROWS_RL}, |
16cf555989a9
Add support for converting to interleaved 3D in vf_stereo3d.
reimar
parents:
32541
diff
changeset
|
421 {"interleave_rows_right_first", INTERLEAVE_ROWS_RL}, |
32441 | 422 { NULL, 0} |
423 }; | |
424 | |
425 #define ST_OFF(f) M_ST_OFF(struct format_preset,f) | |
426 static const m_option_t vf_format_preset_fields_in[] = { | |
427 {"in", ST_OFF(scode), CONF_TYPE_INT, 0,0,0, NULL}, | |
428 { NULL, NULL, 0, 0, 0, 0, NULL } | |
429 }; | |
430 static const m_option_t vf_format_preset_fields_out[] = { | |
431 {"out", ST_OFF(scode), CONF_TYPE_INT, 0,0,0, NULL}, | |
432 { NULL, NULL, 0, 0, 0, 0, NULL } | |
433 }; | |
434 | |
435 static const m_struct_t vf_format_preset_in = { | |
436 "stereo_format_preset_in", | |
437 sizeof(struct format_preset), | |
438 NULL, | |
439 vf_format_preset_fields_in | |
440 }; | |
441 static const m_struct_t vf_format_preset_out = { | |
442 "stereo_format_preset_out", | |
443 sizeof(struct format_preset), | |
444 NULL, | |
445 vf_format_preset_fields_out | |
446 }; | |
447 | |
448 static const m_struct_t vf_opts; | |
449 static const m_obj_presets_t format_preset_in = { | |
450 (struct m_struct_st*)&vf_format_preset_in, | |
451 (struct m_struct_st*)&vf_opts, | |
452 (struct format_preset*)vf_format_presets_defs, | |
453 ST_OFF(name) | |
454 }; | |
455 static const m_obj_presets_t format_preset_out = { | |
456 (struct m_struct_st*)&vf_format_preset_out, | |
457 (struct m_struct_st*)&vf_opts, | |
458 (struct format_preset*)vf_format_presets_defs, | |
459 ST_OFF(name) | |
460 }; | |
461 | |
462 /// Now the options | |
463 #undef ST_OFF | |
464 #define ST_OFF(f) M_ST_OFF(struct vf_priv_s,f) | |
465 static const m_option_t vf_opts_fields[] = { | |
466 {"stereo_in", 0, CONF_TYPE_OBJ_PRESETS, 0, 0, 0, | |
467 (m_obj_presets_t*)&format_preset_in}, | |
468 {"stereo_out", 0, CONF_TYPE_OBJ_PRESETS, 0, 0, 0, | |
469 (m_obj_presets_t*)&format_preset_out}, | |
470 {"in", ST_OFF(in.fmt), CONF_TYPE_INT, 0,0,0, NULL}, | |
471 {"out", ST_OFF(out.fmt), CONF_TYPE_INT, 0,0,0, NULL}, | |
472 { NULL, NULL, 0, 0, 0, 0, NULL } | |
473 }; | |
474 | |
475 static const m_struct_t vf_opts = { | |
476 "stereo3d", | |
477 sizeof(struct vf_priv_s), | |
478 &vf_priv_default, | |
479 vf_opts_fields | |
480 }; | |
481 | |
482 | |
483 //==info struct==// | |
484 const vf_info_t vf_info_stereo3d = { | |
485 "stereoscopic 3d view", | |
486 "stereo3d", | |
487 "Gordon Schmidt", | |
488 "view stereoscopic videos", | |
489 vf_open, | |
490 &vf_opts | |
491 }; |