Mercurial > mplayer.hg
annotate libmpcodecs/vf_stereo3d.c @ 34252:0d7b77bd5744
Add lmlm4 regression test.
author | cehoyos |
---|---|
date | Thu, 10 Nov 2011 16:06:23 +0000 |
parents | 475d96f700d4 |
children | c24d1a0c7665 |
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) | |
33789 | 55 SIDE_BY_SIDE_2_LR, //side by side parallel with half width resolution |
56 SIDE_BY_SIDE_2_RL, //side by side crosseye with half width resolution | |
32441 | 57 ABOVE_BELOW_LR, //above-below (left eye above, right eye below) |
58 ABOVE_BELOW_RL, //above-below (right eye above, left eye below) | |
59 ABOVE_BELOW_2_LR, //above-below with half height resolution | |
60 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
|
61 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
|
62 INTERLEAVE_ROWS_RL, //row-interleave (right eye has top row) |
32441 | 63 STEREO_CODE_COUNT //no value set - TODO: needs autodetection |
64 } stereo_code; | |
65 | |
66 typedef struct component { | |
67 stereo_code fmt; | |
68 unsigned int width; | |
69 unsigned int height; | |
70 unsigned int off_left; | |
71 unsigned int off_right; | |
32539 | 72 unsigned int row_left; |
73 unsigned int row_right; | |
32441 | 74 } component; |
75 | |
76 //==global variables==// | |
77 static const int ana_coeff[10][3][6] = { | |
78 {{19595, 38470, 7471, 0, 0, 0}, //ANAGLYPH_RC_GRAY | |
79 { 0, 0, 0, 19595, 38470, 7471}, | |
80 { 0, 0, 0, 19595, 38470, 7471}}, | |
81 {{19595, 38470, 7471, 0, 0, 0}, //ANAGLYPH_RC_HALF | |
82 { 0, 0, 0, 0, 65536, 0}, | |
83 { 0, 0, 0, 0, 0, 65536}}, | |
84 {{65536, 0, 0, 0, 0, 0}, //ANAGLYPH_RC_COLOR | |
85 { 0, 0, 0, 0, 65536, 0}, | |
86 { 0, 0, 0, 0, 0, 65536}}, | |
87 {{29891, 32800, 11559, -2849, -5763, -102}, //ANAGLYPH_RC_DUBOIS | |
88 {-2627, -2479, -1033, 24804, 48080, -1209}, | |
89 { -997, -1350, -358, -4729, -7403, 80373}}, | |
90 {{ 0, 0, 0, 19595, 38470, 7471}, //ANAGLYPH_GM_GRAY | |
91 {19595, 38470, 7471, 0, 0, 0}, | |
92 { 0, 0, 0, 19595, 38470, 7471}}, | |
93 {{ 0, 0, 0, 65536, 0, 0}, //ANAGLYPH_GM_HALF | |
94 {19595, 38470, 7471, 0, 0, 0}, | |
95 { 0, 0, 0, 0, 0, 65536}}, | |
96 {{ 0, 0, 0, 65536, 0, 0}, //ANAGLYPH_GM_COLOR | |
97 { 0, 65536, 0, 0, 0, 0}, | |
98 { 0, 0, 0, 0, 0, 65536}}, | |
99 {{ 0, 0, 0, 19595, 38470, 7471}, //ANAGLYPH_YB_GRAY | |
100 { 0, 0, 0, 19595, 38470, 7471}, | |
101 {19595, 38470, 7471, 0, 0, 0}}, | |
102 {{ 0, 0, 0, 65536, 0, 0}, //ANAGLYPH_YB_HALF | |
103 { 0, 0, 0, 0, 65536, 0}, | |
104 {19595, 38470, 7471, 0, 0, 0}}, | |
105 {{ 0, 0, 0, 65536, 0, 0}, //ANAGLYPH_YB_COLOR | |
106 { 0, 0, 0, 0, 65536, 0}, | |
107 { 0, 0, 65536, 0, 0, 0}} | |
108 }; | |
109 | |
110 struct vf_priv_s { | |
111 component in; | |
112 component out; | |
113 int ana_matrix[3][6]; | |
114 unsigned int width; | |
115 unsigned int height; | |
33560
16cf555989a9
Add support for converting to interleaved 3D in vf_stereo3d.
reimar
parents:
32541
diff
changeset
|
116 unsigned int row_step; |
32441 | 117 } const vf_priv_default = { |
118 {SIDE_BY_SIDE_LR}, | |
119 {ANAGLYPH_RC_DUBOIS} | |
120 }; | |
121 | |
122 //==functions==// | |
123 static inline uint8_t ana_convert(int coeff[6], uint8_t left[3], uint8_t right[3]) | |
124 { | |
125 int sum; | |
126 | |
127 sum = coeff[0] * left[0] + coeff[3] * right[0]; //red in | |
128 sum += coeff[1] * left[1] + coeff[4] * right[1]; //green in | |
129 sum += coeff[2] * left[2] + coeff[5] * right[2]; //blue in | |
130 return av_clip_uint8(sum >> 16); | |
131 } | |
132 | |
133 static int config(struct vf_instance *vf, int width, int height, int d_width, | |
134 int d_height, unsigned int flags, unsigned int outfmt) | |
135 { | |
136 if ((width & 1) || (height & 1)) { | |
137 mp_msg(MSGT_VFILTER, MSGL_WARN, "[stereo3d] invalid height or width\n"); | |
138 return 0; | |
139 } | |
140 //default input values | |
141 vf->priv->width = width; | |
142 vf->priv->height = height; | |
33560
16cf555989a9
Add support for converting to interleaved 3D in vf_stereo3d.
reimar
parents:
32541
diff
changeset
|
143 vf->priv->row_step = 1; |
32441 | 144 vf->priv->in.width = width; |
145 vf->priv->in.height = height; | |
146 vf->priv->in.off_left = 0; | |
147 vf->priv->in.off_right = 0; | |
32539 | 148 vf->priv->in.row_left = 0; |
149 vf->priv->in.row_right = 0; | |
32441 | 150 |
151 //check input format | |
152 switch (vf->priv->in.fmt) { | |
33789 | 153 case SIDE_BY_SIDE_2_LR: |
154 d_width *= 2; | |
32441 | 155 case SIDE_BY_SIDE_LR: |
156 vf->priv->width = width / 2; | |
157 vf->priv->in.off_right = vf->priv->width * 3; | |
158 break; | |
33789 | 159 case SIDE_BY_SIDE_2_RL: |
160 d_width *= 2; | |
32441 | 161 case SIDE_BY_SIDE_RL: |
162 vf->priv->width = width / 2; | |
163 vf->priv->in.off_left = vf->priv->width * 3; | |
164 break; | |
32538 | 165 case ABOVE_BELOW_2_LR: |
166 d_height *= 2; | |
32441 | 167 case ABOVE_BELOW_LR: |
168 vf->priv->height = height / 2; | |
32539 | 169 vf->priv->in.row_right = vf->priv->height; |
32441 | 170 break; |
32538 | 171 case ABOVE_BELOW_2_RL: |
172 d_height *= 2; | |
32441 | 173 case ABOVE_BELOW_RL: |
174 vf->priv->height = height / 2; | |
32539 | 175 vf->priv->in.row_left = vf->priv->height; |
32441 | 176 break; |
177 default: | |
178 mp_msg(MSGT_VFILTER, MSGL_WARN, | |
179 "[stereo3d] stereo format of input is not supported\n"); | |
180 return 0; | |
181 break; | |
182 } | |
183 //default output values | |
184 vf->priv->out.width = vf->priv->width; | |
185 vf->priv->out.height = vf->priv->height; | |
186 vf->priv->out.off_left = 0; | |
187 vf->priv->out.off_right = 0; | |
32539 | 188 vf->priv->out.row_left = 0; |
189 vf->priv->out.row_right = 0; | |
32441 | 190 |
191 //check output format | |
192 switch (vf->priv->out.fmt) { | |
193 case ANAGLYPH_RC_GRAY: | |
194 case ANAGLYPH_RC_HALF: | |
195 case ANAGLYPH_RC_COLOR: | |
196 case ANAGLYPH_RC_DUBOIS: | |
197 case ANAGLYPH_GM_GRAY: | |
198 case ANAGLYPH_GM_HALF: | |
199 case ANAGLYPH_GM_COLOR: | |
200 case ANAGLYPH_YB_GRAY: | |
201 case ANAGLYPH_YB_HALF: | |
202 case ANAGLYPH_YB_COLOR: | |
203 memcpy(vf->priv->ana_matrix, ana_coeff[vf->priv->out.fmt], | |
204 sizeof(vf->priv->ana_matrix)); | |
205 break; | |
33789 | 206 case SIDE_BY_SIDE_2_LR: |
207 d_width /= 2; | |
32441 | 208 case SIDE_BY_SIDE_LR: |
209 vf->priv->out.width = vf->priv->width * 2; | |
210 vf->priv->out.off_right = vf->priv->width * 3; | |
211 break; | |
33789 | 212 case SIDE_BY_SIDE_2_RL: |
213 d_width /= 2; | |
32441 | 214 case SIDE_BY_SIDE_RL: |
215 vf->priv->out.width = vf->priv->width * 2; | |
216 vf->priv->out.off_left = vf->priv->width * 3; | |
217 break; | |
32538 | 218 case ABOVE_BELOW_2_LR: |
219 d_height /= 2; | |
32441 | 220 case ABOVE_BELOW_LR: |
221 vf->priv->out.height = vf->priv->height * 2; | |
32539 | 222 vf->priv->out.row_right = vf->priv->height; |
32441 | 223 break; |
32538 | 224 case ABOVE_BELOW_2_RL: |
225 d_height /= 2; | |
32441 | 226 case ABOVE_BELOW_RL: |
227 vf->priv->out.height = vf->priv->height * 2; | |
32539 | 228 vf->priv->out.row_left = vf->priv->height; |
32441 | 229 break; |
33560
16cf555989a9
Add support for converting to interleaved 3D in vf_stereo3d.
reimar
parents:
32541
diff
changeset
|
230 case INTERLEAVE_ROWS_LR: |
16cf555989a9
Add support for converting to interleaved 3D in vf_stereo3d.
reimar
parents:
32541
diff
changeset
|
231 vf->priv->row_step = 2; |
16cf555989a9
Add support for converting to interleaved 3D in vf_stereo3d.
reimar
parents:
32541
diff
changeset
|
232 vf->priv->height = vf->priv->height / 2; |
16cf555989a9
Add support for converting to interleaved 3D in vf_stereo3d.
reimar
parents:
32541
diff
changeset
|
233 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
|
234 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
|
235 break; |
16cf555989a9
Add support for converting to interleaved 3D in vf_stereo3d.
reimar
parents:
32541
diff
changeset
|
236 case INTERLEAVE_ROWS_RL: |
16cf555989a9
Add support for converting to interleaved 3D in vf_stereo3d.
reimar
parents:
32541
diff
changeset
|
237 vf->priv->row_step = 2; |
16cf555989a9
Add support for converting to interleaved 3D in vf_stereo3d.
reimar
parents:
32541
diff
changeset
|
238 vf->priv->height = vf->priv->height / 2; |
16cf555989a9
Add support for converting to interleaved 3D in vf_stereo3d.
reimar
parents:
32541
diff
changeset
|
239 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
|
240 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
|
241 break; |
32441 | 242 case MONO_R: |
243 //same as MONO_L only needs switching of input offsets | |
244 vf->priv->in.off_left = vf->priv->in.off_right; | |
32539 | 245 vf->priv->in.row_left = vf->priv->in.row_right; |
32441 | 246 //nobreak; |
247 case MONO_L: | |
248 //use default settings | |
249 break; | |
250 default: | |
251 mp_msg(MSGT_VFILTER, MSGL_WARN, | |
252 "[stereo3d] stereo format of output is not supported\n"); | |
253 return 0; | |
254 break; | |
255 } | |
256 if (!opt_screen_size_x && !opt_screen_size_y) { | |
257 d_width = d_width * vf->priv->out.width / width; | |
258 d_height = d_height * vf->priv->out.height / height; | |
259 } | |
260 return vf_next_config(vf, vf->priv->out.width, vf->priv->out.height, | |
261 d_width, d_height, flags, outfmt); | |
262 } | |
263 | |
264 static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts) | |
265 { | |
266 mp_image_t *dmpi; | |
267 if (vf->priv->in.fmt == vf->priv->out.fmt) { //nothing to do | |
268 dmpi = mpi; | |
269 } else { | |
32539 | 270 int out_off_left, out_off_right; |
271 int in_off_left = vf->priv->in.row_left * mpi->stride[0] + | |
272 vf->priv->in.off_left; | |
273 int in_off_right = vf->priv->in.row_right * mpi->stride[0] + | |
274 vf->priv->in.off_right; | |
275 | |
32541
45b3a91e8fb7
Indicate that stereo3d can now handle strides properly.
reimar
parents:
32540
diff
changeset
|
276 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
|
277 MP_IMGFLAG_ACCEPT_STRIDE, |
32441 | 278 vf->priv->out.width, vf->priv->out.height); |
32539 | 279 out_off_left = vf->priv->out.row_left * dmpi->stride[0] + |
280 vf->priv->out.off_left; | |
281 out_off_right = vf->priv->out.row_right * dmpi->stride[0] + | |
282 vf->priv->out.off_right; | |
283 | |
32441 | 284 switch (vf->priv->out.fmt) { |
285 case SIDE_BY_SIDE_LR: | |
286 case SIDE_BY_SIDE_RL: | |
33789 | 287 case SIDE_BY_SIDE_2_LR: |
288 case SIDE_BY_SIDE_2_RL: | |
32441 | 289 case ABOVE_BELOW_LR: |
290 case ABOVE_BELOW_RL: | |
291 case ABOVE_BELOW_2_LR: | |
292 case ABOVE_BELOW_2_RL: | |
33560
16cf555989a9
Add support for converting to interleaved 3D in vf_stereo3d.
reimar
parents:
32541
diff
changeset
|
293 case INTERLEAVE_ROWS_LR: |
16cf555989a9
Add support for converting to interleaved 3D in vf_stereo3d.
reimar
parents:
32541
diff
changeset
|
294 case INTERLEAVE_ROWS_RL: |
33602
042b10b477fa
Change memcpy_pic to force it to never write to image parts between
reimar
parents:
33599
diff
changeset
|
295 memcpy_pic2(dmpi->planes[0] + out_off_left, |
32539 | 296 mpi->planes[0] + in_off_left, |
32538 | 297 3 * vf->priv->width, |
298 vf->priv->height, | |
33560
16cf555989a9
Add support for converting to interleaved 3D in vf_stereo3d.
reimar
parents:
32541
diff
changeset
|
299 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
|
300 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
|
301 vf->priv->row_step != 1); |
042b10b477fa
Change memcpy_pic to force it to never write to image parts between
reimar
parents:
33599
diff
changeset
|
302 memcpy_pic2(dmpi->planes[0] + out_off_right, |
32539 | 303 mpi->planes[0] + in_off_right, |
32538 | 304 3 * vf->priv->width, |
305 vf->priv->height, | |
33560
16cf555989a9
Add support for converting to interleaved 3D in vf_stereo3d.
reimar
parents:
32541
diff
changeset
|
306 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
|
307 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
|
308 vf->priv->row_step != 1); |
32441 | 309 break; |
310 case MONO_L: | |
311 case MONO_R: | |
32538 | 312 memcpy_pic(dmpi->planes[0], |
32539 | 313 mpi->planes[0] + in_off_left, |
32538 | 314 3 * vf->priv->width, |
315 vf->priv->height, | |
32539 | 316 dmpi->stride[0], |
317 mpi->stride[0]); | |
32441 | 318 break; |
319 case ANAGLYPH_RC_GRAY: | |
320 case ANAGLYPH_RC_HALF: | |
321 case ANAGLYPH_RC_COLOR: | |
322 case ANAGLYPH_RC_DUBOIS: | |
323 case ANAGLYPH_GM_GRAY: | |
324 case ANAGLYPH_GM_HALF: | |
325 case ANAGLYPH_GM_COLOR: | |
326 case ANAGLYPH_YB_GRAY: | |
327 case ANAGLYPH_YB_HALF: | |
328 case ANAGLYPH_YB_COLOR: { | |
33599
6d690eac34eb
Avoid C99 syntax not supported by some old compilers.
reimar
parents:
33560
diff
changeset
|
329 int i,x,y,il,ir,o; |
32441 | 330 unsigned char *source = mpi->planes[0]; |
331 unsigned char *dest = dmpi->planes[0]; | |
332 unsigned int out_width = vf->priv->out.width; | |
333 int *ana_matrix[3]; | |
334 | |
33599
6d690eac34eb
Avoid C99 syntax not supported by some old compilers.
reimar
parents:
33560
diff
changeset
|
335 for(i = 0; i < 3; i++) |
32441 | 336 ana_matrix[i] = vf->priv->ana_matrix[i]; |
337 | |
338 for (y = 0; y < vf->priv->out.height; y++) { | |
32539 | 339 o = dmpi->stride[0] * y; |
340 il = in_off_left + y * mpi->stride[0]; | |
341 ir = in_off_right + y * mpi->stride[0]; | |
32441 | 342 for (x = 0; x < out_width; x++) { |
343 dest[o ] = ana_convert( | |
344 ana_matrix[0], source + il, source + ir); //red out | |
345 dest[o + 1] = ana_convert( | |
346 ana_matrix[1], source + il, source + ir); //green out | |
347 dest[o + 2] = ana_convert( | |
348 ana_matrix[2], source + il, source + ir); //blue out | |
349 il += 3; | |
350 ir += 3; | |
351 o += 3; | |
352 } | |
353 } | |
354 break; | |
355 } | |
356 default: | |
357 mp_msg(MSGT_VFILTER, MSGL_WARN, | |
358 "[stereo3d] stereo format of output is not supported\n"); | |
359 return 0; | |
360 break; | |
361 } | |
362 } | |
363 return vf_next_put_image(vf, dmpi, pts); | |
364 } | |
365 | |
366 static int query_format(struct vf_instance *vf, unsigned int fmt) | |
367 { | |
368 switch (fmt) | |
369 case IMGFMT_RGB24: | |
370 return vf_next_query_format(vf, fmt); | |
371 return 0; | |
372 } | |
373 | |
374 static void uninit(vf_instance_t *vf) | |
375 { | |
376 free(vf->priv); | |
377 } | |
378 | |
379 static int vf_open(vf_instance_t *vf, char *args) | |
380 { | |
381 vf->config = config; | |
382 vf->uninit = uninit; | |
383 vf->put_image = put_image; | |
384 vf->query_format = query_format; | |
385 | |
386 return 1; | |
387 } | |
388 | |
389 ///Presets usage | |
390 static const struct format_preset { | |
391 char* name; | |
392 stereo_code scode; | |
393 } vf_format_presets_defs[] = { | |
394 {"arcg", ANAGLYPH_RC_GRAY}, | |
395 {"anaglyph_red_cyan_gray", ANAGLYPH_RC_GRAY}, | |
396 {"arch", ANAGLYPH_RC_HALF}, | |
397 {"anaglyph_red_cyan_half_color", ANAGLYPH_RC_HALF}, | |
398 {"arcc", ANAGLYPH_RC_COLOR}, | |
399 {"anaglyph_red_cyan_color", ANAGLYPH_RC_COLOR}, | |
400 {"arcd", ANAGLYPH_RC_DUBOIS}, | |
401 {"anaglyph_red_cyan_dubios", ANAGLYPH_RC_DUBOIS}, | |
402 {"agmg", ANAGLYPH_GM_GRAY}, | |
403 {"anaglyph_green_magenta_gray", ANAGLYPH_GM_GRAY}, | |
404 {"agmh", ANAGLYPH_GM_HALF}, | |
405 {"anaglyph_green_magenta_half_color",ANAGLYPH_GM_HALF}, | |
406 {"agmc", ANAGLYPH_GM_COLOR}, | |
407 {"anaglyph_green_magenta_color", ANAGLYPH_GM_COLOR}, | |
408 {"aybg", ANAGLYPH_YB_GRAY}, | |
409 {"anaglyph_yellow_blue_gray", ANAGLYPH_YB_GRAY}, | |
410 {"aybh", ANAGLYPH_YB_HALF}, | |
411 {"anaglyph_yellow_blue_half_color", ANAGLYPH_YB_HALF}, | |
412 {"aybc", ANAGLYPH_YB_COLOR}, | |
413 {"anaglyph_yellow_blue_color", ANAGLYPH_YB_COLOR}, | |
414 {"ml", MONO_L}, | |
415 {"mono_left", MONO_L}, | |
416 {"mr", MONO_R}, | |
417 {"mono_right", MONO_R}, | |
418 {"sbsl", SIDE_BY_SIDE_LR}, | |
419 {"side_by_side_left_first", SIDE_BY_SIDE_LR}, | |
420 {"sbsr", SIDE_BY_SIDE_RL}, | |
421 {"side_by_side_right_first", SIDE_BY_SIDE_RL}, | |
33789 | 422 {"sbs2l", SIDE_BY_SIDE_2_LR}, |
423 {"side_by_side_half_width_left_first", SIDE_BY_SIDE_2_LR}, | |
424 {"sbs2r", SIDE_BY_SIDE_2_RL}, | |
425 {"side_by_side_half_width_right_first",SIDE_BY_SIDE_2_RL}, | |
32441 | 426 {"abl", ABOVE_BELOW_LR}, |
427 {"above_below_left_first", ABOVE_BELOW_LR}, | |
428 {"abr", ABOVE_BELOW_RL}, | |
429 {"above_below_right_first", ABOVE_BELOW_RL}, | |
430 {"ab2l", ABOVE_BELOW_2_LR}, | |
431 {"above_below_half_height_left_first", ABOVE_BELOW_2_LR}, | |
432 {"ab2r", ABOVE_BELOW_2_RL}, | |
433 {"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
|
434 {"irl", INTERLEAVE_ROWS_LR}, |
16cf555989a9
Add support for converting to interleaved 3D in vf_stereo3d.
reimar
parents:
32541
diff
changeset
|
435 {"interleave_rows_left_first", INTERLEAVE_ROWS_LR}, |
16cf555989a9
Add support for converting to interleaved 3D in vf_stereo3d.
reimar
parents:
32541
diff
changeset
|
436 {"irr", INTERLEAVE_ROWS_RL}, |
16cf555989a9
Add support for converting to interleaved 3D in vf_stereo3d.
reimar
parents:
32541
diff
changeset
|
437 {"interleave_rows_right_first", INTERLEAVE_ROWS_RL}, |
32441 | 438 { NULL, 0} |
439 }; | |
440 | |
441 #define ST_OFF(f) M_ST_OFF(struct format_preset,f) | |
442 static const m_option_t vf_format_preset_fields_in[] = { | |
443 {"in", ST_OFF(scode), CONF_TYPE_INT, 0,0,0, NULL}, | |
444 { NULL, NULL, 0, 0, 0, 0, NULL } | |
445 }; | |
446 static const m_option_t vf_format_preset_fields_out[] = { | |
447 {"out", ST_OFF(scode), CONF_TYPE_INT, 0,0,0, NULL}, | |
448 { NULL, NULL, 0, 0, 0, 0, NULL } | |
449 }; | |
450 | |
451 static const m_struct_t vf_format_preset_in = { | |
452 "stereo_format_preset_in", | |
453 sizeof(struct format_preset), | |
454 NULL, | |
455 vf_format_preset_fields_in | |
456 }; | |
457 static const m_struct_t vf_format_preset_out = { | |
458 "stereo_format_preset_out", | |
459 sizeof(struct format_preset), | |
460 NULL, | |
461 vf_format_preset_fields_out | |
462 }; | |
463 | |
464 static const m_struct_t vf_opts; | |
465 static const m_obj_presets_t format_preset_in = { | |
466 (struct m_struct_st*)&vf_format_preset_in, | |
467 (struct m_struct_st*)&vf_opts, | |
468 (struct format_preset*)vf_format_presets_defs, | |
469 ST_OFF(name) | |
470 }; | |
471 static const m_obj_presets_t format_preset_out = { | |
472 (struct m_struct_st*)&vf_format_preset_out, | |
473 (struct m_struct_st*)&vf_opts, | |
474 (struct format_preset*)vf_format_presets_defs, | |
475 ST_OFF(name) | |
476 }; | |
477 | |
478 /// Now the options | |
479 #undef ST_OFF | |
480 #define ST_OFF(f) M_ST_OFF(struct vf_priv_s,f) | |
481 static const m_option_t vf_opts_fields[] = { | |
482 {"stereo_in", 0, CONF_TYPE_OBJ_PRESETS, 0, 0, 0, | |
483 (m_obj_presets_t*)&format_preset_in}, | |
484 {"stereo_out", 0, CONF_TYPE_OBJ_PRESETS, 0, 0, 0, | |
485 (m_obj_presets_t*)&format_preset_out}, | |
486 {"in", ST_OFF(in.fmt), CONF_TYPE_INT, 0,0,0, NULL}, | |
487 {"out", ST_OFF(out.fmt), CONF_TYPE_INT, 0,0,0, NULL}, | |
488 { NULL, NULL, 0, 0, 0, 0, NULL } | |
489 }; | |
490 | |
491 static const m_struct_t vf_opts = { | |
492 "stereo3d", | |
493 sizeof(struct vf_priv_s), | |
494 &vf_priv_default, | |
495 vf_opts_fields | |
496 }; | |
497 | |
498 | |
499 //==info struct==// | |
500 const vf_info_t vf_info_stereo3d = { | |
501 "stereoscopic 3d view", | |
502 "stereo3d", | |
503 "Gordon Schmidt", | |
504 "view stereoscopic videos", | |
505 vf_open, | |
506 &vf_opts | |
507 }; |