summaryrefslogtreecommitdiffstats
path: root/libmpcodecs/vf_stereo3d.c
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2011-06-19 08:33:57 +0000
committerUoti Urpala <uau@mplayer2.org>2011-07-06 13:01:07 +0300
commitb0a88d1362dd59fd02f27cca0a0683024266c36f (patch)
treeba483913db52ead9ee0e9ce2c18006b0e1f9d844 /libmpcodecs/vf_stereo3d.c
parentdbff0e49baccb16929435bbf680e70cd628b21ac (diff)
downloadmpv-b0a88d1362dd59fd02f27cca0a0683024266c36f.tar.bz2
mpv-b0a88d1362dd59fd02f27cca0a0683024266c36f.tar.xz
vf_stereo3d: Add support for converting to interleaved 3D
Patch by Steaphan Greene [sgreene cs.binghamton.edu] git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33648 b3059339-0415-0410-9bf9-f77b7e298cf2 Improve stereo3d interleaved man page description. Patch by Steaphan Greene [sgreene cs.binghamton.edu] git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33689 b3059339-0415-0410-9bf9-f77b7e298cf2 Change memcpy_pic to force it to never write to image parts between width and stride if creating a row-interleaved format, otherwise the second memcpy_pic might overwrite what the first wrote. Changing the first should not be necessary but might result in better performance. Patch by Steaphan Greene [sgreene cs.binghamton.edu] git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33690 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs/vf_stereo3d.c')
-rw-r--r--libmpcodecs/vf_stereo3d.c36
1 files changed, 30 insertions, 6 deletions
diff --git a/libmpcodecs/vf_stereo3d.c b/libmpcodecs/vf_stereo3d.c
index 4e9c7713d9..2c6f289e5d 100644
--- a/libmpcodecs/vf_stereo3d.c
+++ b/libmpcodecs/vf_stereo3d.c
@@ -56,6 +56,8 @@ typedef enum stereo_code {
ABOVE_BELOW_RL, //above-below (right eye above, left eye below)
ABOVE_BELOW_2_LR, //above-below with half height resolution
ABOVE_BELOW_2_RL, //above-below with half height resolution
+ INTERLEAVE_ROWS_LR, //row-interleave (left eye has top row)
+ INTERLEAVE_ROWS_RL, //row-interleave (right eye has top row)
STEREO_CODE_COUNT //no value set - TODO: needs autodetection
} stereo_code;
@@ -109,6 +111,7 @@ struct vf_priv_s {
int ana_matrix[3][6];
unsigned int width;
unsigned int height;
+ unsigned int row_step;
} const vf_priv_default = {
{SIDE_BY_SIDE_LR},
{ANAGLYPH_RC_DUBOIS}
@@ -137,6 +140,7 @@ static int config(struct vf_instance *vf, int width, int height, int d_width,
//default input values
vf->priv->width = width;
vf->priv->height = height;
+ vf->priv->row_step = 1;
vf->priv->in.width = width;
vf->priv->in.height = height;
vf->priv->in.off_left = 0;
@@ -215,6 +219,18 @@ static int config(struct vf_instance *vf, int width, int height, int d_width,
vf->priv->out.height = vf->priv->height * 2;
vf->priv->out.row_left = vf->priv->height;
break;
+ case INTERLEAVE_ROWS_LR:
+ vf->priv->row_step = 2;
+ vf->priv->height = vf->priv->height / 2;
+ vf->priv->out.off_right = vf->priv->width * 3;
+ vf->priv->in.off_right += vf->priv->in.width * 3;
+ break;
+ case INTERLEAVE_ROWS_RL:
+ vf->priv->row_step = 2;
+ vf->priv->height = vf->priv->height / 2;
+ vf->priv->out.off_left = vf->priv->width * 3;
+ vf->priv->in.off_left += vf->priv->in.width * 3;
+ break;
case MONO_R:
//same as MONO_L only needs switching of input offsets
vf->priv->in.off_left = vf->priv->in.off_right;
@@ -264,18 +280,22 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
case ABOVE_BELOW_RL:
case ABOVE_BELOW_2_LR:
case ABOVE_BELOW_2_RL:
- memcpy_pic(dmpi->planes[0] + out_off_left,
+ case INTERLEAVE_ROWS_LR:
+ case INTERLEAVE_ROWS_RL:
+ memcpy_pic2(dmpi->planes[0] + out_off_left,
mpi->planes[0] + in_off_left,
3 * vf->priv->width,
vf->priv->height,
- dmpi->stride[0],
- mpi->stride[0]);
- memcpy_pic(dmpi->planes[0] + out_off_right,
+ dmpi->stride[0] * vf->priv->row_step,
+ mpi->stride[0] * vf->priv->row_step,
+ vf->priv->row_step != 1);
+ memcpy_pic2(dmpi->planes[0] + out_off_right,
mpi->planes[0] + in_off_right,
3 * vf->priv->width,
vf->priv->height,
- dmpi->stride[0],
- mpi->stride[0]);
+ dmpi->stride[0] * vf->priv->row_step,
+ mpi->stride[0] * vf->priv->row_step,
+ vf->priv->row_step != 1);
break;
case MONO_L:
case MONO_R:
@@ -397,6 +417,10 @@ static const struct format_preset {
{"above_below_half_height_left_first", ABOVE_BELOW_2_LR},
{"ab2r", ABOVE_BELOW_2_RL},
{"above_below_half_height_right_first",ABOVE_BELOW_2_RL},
+ {"irl", INTERLEAVE_ROWS_LR},
+ {"interleave_rows_left_first", INTERLEAVE_ROWS_LR},
+ {"irr", INTERLEAVE_ROWS_RL},
+ {"interleave_rows_right_first", INTERLEAVE_ROWS_RL},
{ NULL, 0}
};