comparison libmpcodecs/vf_stereo3d.c @ 33560:16cf555989a9

Add support for converting to interleaved 3D in vf_stereo3d. Patch by Steaphan Greene [sgreene cs.binghamton.edu]
author reimar
date Sun, 19 Jun 2011 08:33:57 +0000
parents 45b3a91e8fb7
children 6d690eac34eb
comparison
equal deleted inserted replaced
33559:0d4edb3f75c6 33560:16cf555989a9
54 SIDE_BY_SIDE_RL, //side by side crosseye (right eye left, left 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) 55 ABOVE_BELOW_LR, //above-below (left eye above, right eye below)
56 ABOVE_BELOW_RL, //above-below (right eye above, left 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 57 ABOVE_BELOW_2_LR, //above-below with half height resolution
58 ABOVE_BELOW_2_RL, //above-below with half height resolution 58 ABOVE_BELOW_2_RL, //above-below with half height resolution
59 INTERLEAVE_ROWS_LR, //row-interleave (left eye has top row)
60 INTERLEAVE_ROWS_RL, //row-interleave (right eye has top row)
59 STEREO_CODE_COUNT //no value set - TODO: needs autodetection 61 STEREO_CODE_COUNT //no value set - TODO: needs autodetection
60 } stereo_code; 62 } stereo_code;
61 63
62 typedef struct component { 64 typedef struct component {
63 stereo_code fmt; 65 stereo_code fmt;
107 component in; 109 component in;
108 component out; 110 component out;
109 int ana_matrix[3][6]; 111 int ana_matrix[3][6];
110 unsigned int width; 112 unsigned int width;
111 unsigned int height; 113 unsigned int height;
114 unsigned int row_step;
112 } const vf_priv_default = { 115 } const vf_priv_default = {
113 {SIDE_BY_SIDE_LR}, 116 {SIDE_BY_SIDE_LR},
114 {ANAGLYPH_RC_DUBOIS} 117 {ANAGLYPH_RC_DUBOIS}
115 }; 118 };
116 119
133 return 0; 136 return 0;
134 } 137 }
135 //default input values 138 //default input values
136 vf->priv->width = width; 139 vf->priv->width = width;
137 vf->priv->height = height; 140 vf->priv->height = height;
141 vf->priv->row_step = 1;
138 vf->priv->in.width = width; 142 vf->priv->in.width = width;
139 vf->priv->in.height = height; 143 vf->priv->in.height = height;
140 vf->priv->in.off_left = 0; 144 vf->priv->in.off_left = 0;
141 vf->priv->in.off_right = 0; 145 vf->priv->in.off_right = 0;
142 vf->priv->in.row_left = 0; 146 vf->priv->in.row_left = 0;
211 d_height /= 2; 215 d_height /= 2;
212 case ABOVE_BELOW_RL: 216 case ABOVE_BELOW_RL:
213 vf->priv->out.height = vf->priv->height * 2; 217 vf->priv->out.height = vf->priv->height * 2;
214 vf->priv->out.row_left = vf->priv->height; 218 vf->priv->out.row_left = vf->priv->height;
215 break; 219 break;
220 case INTERLEAVE_ROWS_LR:
221 vf->priv->row_step = 2;
222 vf->priv->height = vf->priv->height / 2;
223 vf->priv->out.off_right = vf->priv->width * 3;
224 vf->priv->in.off_right += vf->priv->in.width * 3;
225 break;
226 case INTERLEAVE_ROWS_RL:
227 vf->priv->row_step = 2;
228 vf->priv->height = vf->priv->height / 2;
229 vf->priv->out.off_left = vf->priv->width * 3;
230 vf->priv->in.off_left += vf->priv->in.width * 3;
231 break;
216 case MONO_R: 232 case MONO_R:
217 //same as MONO_L only needs switching of input offsets 233 //same as MONO_L only needs switching of input offsets
218 vf->priv->in.off_left = vf->priv->in.off_right; 234 vf->priv->in.off_left = vf->priv->in.off_right;
219 vf->priv->in.row_left = vf->priv->in.row_right; 235 vf->priv->in.row_left = vf->priv->in.row_right;
220 //nobreak; 236 //nobreak;
260 case SIDE_BY_SIDE_RL: 276 case SIDE_BY_SIDE_RL:
261 case ABOVE_BELOW_LR: 277 case ABOVE_BELOW_LR:
262 case ABOVE_BELOW_RL: 278 case ABOVE_BELOW_RL:
263 case ABOVE_BELOW_2_LR: 279 case ABOVE_BELOW_2_LR:
264 case ABOVE_BELOW_2_RL: 280 case ABOVE_BELOW_2_RL:
281 case INTERLEAVE_ROWS_LR:
282 case INTERLEAVE_ROWS_RL:
265 memcpy_pic(dmpi->planes[0] + out_off_left, 283 memcpy_pic(dmpi->planes[0] + out_off_left,
266 mpi->planes[0] + in_off_left, 284 mpi->planes[0] + in_off_left,
267 3 * vf->priv->width, 285 3 * vf->priv->width,
268 vf->priv->height, 286 vf->priv->height,
269 dmpi->stride[0], 287 dmpi->stride[0] * vf->priv->row_step,
270 mpi->stride[0]); 288 mpi->stride[0] * vf->priv->row_step);
271 memcpy_pic(dmpi->planes[0] + out_off_right, 289 memcpy_pic(dmpi->planes[0] + out_off_right,
272 mpi->planes[0] + in_off_right, 290 mpi->planes[0] + in_off_right,
273 3 * vf->priv->width, 291 3 * vf->priv->width,
274 vf->priv->height, 292 vf->priv->height,
275 dmpi->stride[0], 293 dmpi->stride[0] * vf->priv->row_step,
276 mpi->stride[0]); 294 mpi->stride[0] * vf->priv->row_step);
277 break; 295 break;
278 case MONO_L: 296 case MONO_L:
279 case MONO_R: 297 case MONO_R:
280 memcpy_pic(dmpi->planes[0], 298 memcpy_pic(dmpi->planes[0],
281 mpi->planes[0] + in_off_left, 299 mpi->planes[0] + in_off_left,
393 {"above_below_right_first", ABOVE_BELOW_RL}, 411 {"above_below_right_first", ABOVE_BELOW_RL},
394 {"ab2l", ABOVE_BELOW_2_LR}, 412 {"ab2l", ABOVE_BELOW_2_LR},
395 {"above_below_half_height_left_first", ABOVE_BELOW_2_LR}, 413 {"above_below_half_height_left_first", ABOVE_BELOW_2_LR},
396 {"ab2r", ABOVE_BELOW_2_RL}, 414 {"ab2r", ABOVE_BELOW_2_RL},
397 {"above_below_half_height_right_first",ABOVE_BELOW_2_RL}, 415 {"above_below_half_height_right_first",ABOVE_BELOW_2_RL},
416 {"irl", INTERLEAVE_ROWS_LR},
417 {"interleave_rows_left_first", INTERLEAVE_ROWS_LR},
418 {"irr", INTERLEAVE_ROWS_RL},
419 {"interleave_rows_right_first", INTERLEAVE_ROWS_RL},
398 { NULL, 0} 420 { NULL, 0}
399 }; 421 };
400 422
401 #define ST_OFF(f) M_ST_OFF(struct format_preset,f) 423 #define ST_OFF(f) M_ST_OFF(struct format_preset,f)
402 static const m_option_t vf_format_preset_fields_in[] = { 424 static const m_option_t vf_format_preset_fields_in[] = {