From b0a88d1362dd59fd02f27cca0a0683024266c36f Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 19 Jun 2011 08:33:57 +0000 Subject: 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 --- libmpcodecs/vf_stereo3d.c | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) (limited to 'libmpcodecs') 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} }; -- cgit v1.2.3