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