76 {{19595, 38470, 7471, 0, 0, 0},
77 { 0, 0, 0, 19595, 38470, 7471},
78 { 0, 0, 0, 19595, 38470, 7471}},
79 {{19595, 38470, 7471, 0, 0, 0},
80 { 0, 0, 0, 0, 65536, 0},
81 { 0, 0, 0, 0, 0, 65536}},
82 {{65536, 0, 0, 0, 0, 0},
83 { 0, 0, 0, 0, 65536, 0},
84 { 0, 0, 0, 0, 0, 65536}},
85 {{29891, 32800, 11559, -2849, -5763, -102},
86 {-2627, -2479, -1033, 24804, 48080, -1209},
87 { -997, -1350, -358, -4729, -7403, 80373}},
88 {{ 0, 0, 0, 19595, 38470, 7471},
89 {19595, 38470, 7471, 0, 0, 0},
90 { 0, 0, 0, 19595, 38470, 7471}},
91 {{ 0, 0, 0, 65536, 0, 0},
92 {19595, 38470, 7471, 0, 0, 0},
93 { 0, 0, 0, 0, 0, 65536}},
94 {{ 0, 0, 0, 65536, 0, 0},
95 { 0, 65536, 0, 0, 0, 0},
96 { 0, 0, 0, 0, 0, 65536}},
97 {{ 0, 0, 0, 19595, 38470, 7471},
98 { 0, 0, 0, 19595, 38470, 7471},
99 {19595, 38470, 7471, 0, 0, 0}},
100 {{ 0, 0, 0, 65536, 0, 0},
101 { 0, 0, 0, 0, 65536, 0},
102 {19595, 38470, 7471, 0, 0, 0}},
103 {{ 0, 0, 0, 65536, 0, 0},
104 { 0, 0, 0, 0, 65536, 0},
105 { 0, 0, 65536, 0, 0, 0}}
125 sum = coeff[0] * left[0] + coeff[3] * right[0];
126 sum += coeff[1] * left[1] + coeff[4] * right[1];
127 sum += coeff[2] * left[2] + coeff[5] * right[2];
128 return av_clip_uint8(sum >> 16);
132 int d_height,
unsigned int flags,
unsigned int outfmt)
134 if ((width & 1) || (height & 1)) {
139 vf->priv->width =
width;
140 vf->priv->height =
height;
141 vf->priv->row_step = 1;
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;
146 vf->priv->in.row_left = 0;
147 vf->priv->in.row_right = 0;
150 switch (vf->priv->in.fmt) {
154 vf->priv->width = width / 2;
155 vf->priv->in.off_right = vf->priv->width * 3;
160 vf->priv->width = width / 2;
161 vf->priv->in.off_left = vf->priv->width * 3;
166 vf->priv->height = height / 2;
167 vf->priv->in.row_right = vf->priv->height;
172 vf->priv->height = height / 2;
173 vf->priv->in.row_left = vf->priv->height;
177 "[stereo3d] stereo format of input is not supported\n");
182 vf->priv->out.width = vf->priv->width;
183 vf->priv->out.height = vf->priv->height;
184 vf->priv->out.off_left = 0;
185 vf->priv->out.off_right = 0;
186 vf->priv->out.row_left = 0;
187 vf->priv->out.row_right = 0;
190 switch (vf->priv->out.fmt) {
201 memcpy(vf->priv->ana_matrix,
ana_coeff[vf->priv->out.fmt],
202 sizeof(vf->priv->ana_matrix));
207 vf->priv->out.width = vf->priv->width * 2;
208 vf->priv->out.off_right = vf->priv->width * 3;
213 vf->priv->out.width = vf->priv->width * 2;
214 vf->priv->out.off_left = vf->priv->width * 3;
219 vf->priv->out.height = vf->priv->height * 2;
220 vf->priv->out.row_right = vf->priv->height;
225 vf->priv->out.height = vf->priv->height * 2;
226 vf->priv->out.row_left = vf->priv->height;
229 vf->priv->row_step = 2;
230 vf->priv->height = vf->priv->height / 2;
231 vf->priv->out.off_right = vf->priv->width * 3;
232 vf->priv->in.off_right += vf->priv->in.width * 3;
235 vf->priv->row_step = 2;
236 vf->priv->height = vf->priv->height / 2;
237 vf->priv->out.off_left = vf->priv->width * 3;
238 vf->priv->in.off_left += vf->priv->in.width * 3;
242 vf->priv->in.off_left = vf->priv->in.off_right;
243 vf->priv->in.row_left = vf->priv->in.row_right;
250 "[stereo3d] stereo format of output is not supported\n");
255 d_width = d_width * vf->priv->out.width /
width;
256 d_height = d_height * vf->priv->out.height /
height;
260 d_width, d_height, flags, outfmt);
266 if (vf->priv->in.fmt == vf->priv->out.fmt) {
269 int out_off_left, out_off_right;
270 int in_off_left = vf->
priv->in.row_left * mpi->
stride[0] +
271 vf->priv->in.off_left;
272 int in_off_right = vf->priv->in.row_right * mpi->
stride[0] +
273 vf->priv->in.off_right;
277 vf->priv->out.width, vf->priv->out.height);
278 out_off_left = vf->priv->out.row_left * dmpi->
stride[0] +
279 vf->priv->out.off_left;
280 out_off_right = vf->priv->out.row_right * dmpi->
stride[0] +
281 vf->priv->out.off_right;
283 switch (vf->priv->out.fmt) {
295 mpi->
planes[0] + in_off_left,
298 dmpi->
stride[0] * vf->priv->row_step,
299 mpi->
stride[0] * vf->priv->row_step,
300 vf->priv->row_step != 1);
302 mpi->
planes[0] + in_off_right,
305 dmpi->
stride[0] * vf->priv->row_step,
306 mpi->
stride[0] * vf->priv->row_step,
307 vf->priv->row_step != 1);
312 mpi->
planes[0] + in_off_left,
329 unsigned char *source = mpi->
planes[0];
330 unsigned char *dest = dmpi->
planes[0];
331 unsigned int out_width = vf->priv->out.width;
334 for(i = 0; i < 3; i++)
335 ana_matrix[i] = vf->priv->ana_matrix[i];
337 for (y = 0; y < vf->priv->out.height; y++) {
339 il = in_off_left + y * mpi->
stride[0];
340 ir = in_off_right + y * mpi->
stride[0];
341 for (x = 0; x < out_width; x++) {
343 ana_matrix[0], source + il, source + ir);
345 ana_matrix[1], source + il, source + ir);
347 ana_matrix[2], source + il, source + ir);
357 "[stereo3d] stereo format of output is not supported\n");
389 if (args) sscanf(args,
"%d:%d", &vf->
priv->
in.fmt, &vf->
priv->
out.fmt);
395 static const struct format_preset {
398 } vf_format_presets_defs[] = {
446 #define ST_OFF(f) M_ST_OFF(struct format_preset,f)
447 static const m_option_t vf_format_preset_fields_in[] = {
448 {
"in", ST_OFF(scode), CONF_TYPE_INT, 0,0,0,
NULL},
451 static const m_option_t vf_format_preset_fields_out[] = {
452 {
"out", ST_OFF(scode), CONF_TYPE_INT, 0,0,0,
NULL},
456 static const m_struct_t vf_format_preset_in = {
457 "stereo_format_preset_in",
458 sizeof(
struct format_preset),
460 vf_format_preset_fields_in
462 static const m_struct_t vf_format_preset_out = {
463 "stereo_format_preset_out",
464 sizeof(
struct format_preset),
466 vf_format_preset_fields_out
469 static const m_struct_t vf_opts;
470 static const m_obj_presets_t format_preset_in = {
471 (
struct m_struct_st*)&vf_format_preset_in,
472 (
struct m_struct_st*)&vf_opts,
473 (
struct format_preset*)vf_format_presets_defs,
476 static const m_obj_presets_t format_preset_out = {
477 (
struct m_struct_st*)&vf_format_preset_out,
478 (
struct m_struct_st*)&vf_opts,
479 (
struct format_preset*)vf_format_presets_defs,
485 #define ST_OFF(f) M_ST_OFF(struct vf_priv_s,f)
486 static const m_option_t vf_opts_fields[] = {
487 {
"stereo_in", 0, CONF_TYPE_OBJ_PRESETS, 0, 0, 0,
488 (m_obj_presets_t*)&format_preset_in},
489 {
"stereo_out", 0, CONF_TYPE_OBJ_PRESETS, 0, 0, 0,
490 (m_obj_presets_t*)&format_preset_out},
491 {
"in", ST_OFF(in.fmt), CONF_TYPE_INT, 0,0,0,
NULL},
492 {
"out", ST_OFF(out.fmt), CONF_TYPE_INT, 0,0,0,
NULL},
496 static const m_struct_t vf_opts = {
506 "stereoscopic 3d view",
509 "view stereoscopic videos",