vf_stereo3d: Properly support src/dst stride

Patch by Endre Kollár [taxy443 gmail com]

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32626 b3059339-0415-0410-9bf9-f77b7e298cf2

Remove unused struct element.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32627 b3059339-0415-0410-9bf9-f77b7e298cf2

Indicate that stereo3d can now handle strides properly.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32628 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2010-11-14 15:33:25 +00:00 committed by Uoti Urpala
parent 0569269887
commit 970d02c791
1 changed files with 38 additions and 31 deletions

View File

@ -65,7 +65,8 @@ typedef struct component {
unsigned int height;
unsigned int off_left;
unsigned int off_right;
unsigned int stride;
unsigned int row_left;
unsigned int row_right;
} component;
//==global variables==//
@ -140,31 +141,30 @@ static int config(struct vf_instance *vf, int width, int height, int d_width,
vf->priv->in.height = height;
vf->priv->in.off_left = 0;
vf->priv->in.off_right = 0;
vf->priv->in.stride = vf->priv->width * 3;
vf->priv->in.row_left = 0;
vf->priv->in.row_right = 0;
//check input format
switch (vf->priv->in.fmt) {
case SIDE_BY_SIDE_LR:
vf->priv->width = width / 2;
vf->priv->in.off_right = vf->priv->width * 3;
vf->priv->in.stride = vf->priv->width * 6;
break;
case SIDE_BY_SIDE_RL:
vf->priv->width = width / 2;
vf->priv->in.off_left = vf->priv->width * 3;
vf->priv->in.stride = vf->priv->width * 6;
break;
case ABOVE_BELOW_2_LR:
d_height *= 2;
case ABOVE_BELOW_LR:
vf->priv->height = height / 2;
vf->priv->in.off_right = vf->priv->width * vf->priv->height * 3;
vf->priv->in.row_right = vf->priv->height;
break;
case ABOVE_BELOW_2_RL:
d_height *= 2;
case ABOVE_BELOW_RL:
vf->priv->height = height / 2;
vf->priv->in.off_left = vf->priv->width * vf->priv->height * 3;
vf->priv->in.row_left = vf->priv->height;
break;
default:
mp_msg(MSGT_VFILTER, MSGL_WARN,
@ -177,7 +177,8 @@ static int config(struct vf_instance *vf, int width, int height, int d_width,
vf->priv->out.height = vf->priv->height;
vf->priv->out.off_left = 0;
vf->priv->out.off_right = 0;
vf->priv->out.stride = vf->priv->width * 3;
vf->priv->out.row_left = 0;
vf->priv->out.row_right = 0;
//check output format
switch (vf->priv->out.fmt) {
@ -197,28 +198,27 @@ static int config(struct vf_instance *vf, int width, int height, int d_width,
case SIDE_BY_SIDE_LR:
vf->priv->out.width = vf->priv->width * 2;
vf->priv->out.off_right = vf->priv->width * 3;
vf->priv->out.stride = vf->priv->width * 6;
break;
case SIDE_BY_SIDE_RL:
vf->priv->out.width = vf->priv->width * 2;
vf->priv->out.off_left = vf->priv->width * 3;
vf->priv->out.stride = vf->priv->width * 6;
break;
case ABOVE_BELOW_2_LR:
d_height /= 2;
case ABOVE_BELOW_LR:
vf->priv->out.height = vf->priv->height * 2;
vf->priv->out.off_right = vf->priv->width * vf->priv->height * 3;
vf->priv->out.row_right = vf->priv->height;
break;
case ABOVE_BELOW_2_RL:
d_height /= 2;
case ABOVE_BELOW_RL:
vf->priv->out.height = vf->priv->height * 2;
vf->priv->out.off_left = vf->priv->width * vf->priv->height * 3;
vf->priv->out.row_left = vf->priv->height;
break;
case MONO_R:
//same as MONO_L only needs switching of input offsets
vf->priv->in.off_left = vf->priv->in.off_right;
vf->priv->in.row_left = vf->priv->in.row_right;
//nobreak;
case MONO_L:
//use default settings
@ -243,10 +243,20 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
if (vf->priv->in.fmt == vf->priv->out.fmt) { //nothing to do
dmpi = mpi;
} else {
dmpi = vf_get_image(vf->next, IMGFMT_RGB24, MP_IMGTYPE_TEMP, 0,
int out_off_left, out_off_right;
int in_off_left = vf->priv->in.row_left * mpi->stride[0] +
vf->priv->in.off_left;
int in_off_right = vf->priv->in.row_right * mpi->stride[0] +
vf->priv->in.off_right;
dmpi = vf_get_image(vf->next, IMGFMT_RGB24, MP_IMGTYPE_TEMP,
MP_IMGFLAG_ACCEPT_STRIDE,
vf->priv->out.width, vf->priv->out.height);
dmpi->h = vf->priv->out.height;
dmpi->width = vf->priv->out.width;
out_off_left = vf->priv->out.row_left * dmpi->stride[0] +
vf->priv->out.off_left;
out_off_right = vf->priv->out.row_right * dmpi->stride[0] +
vf->priv->out.off_right;
switch (vf->priv->out.fmt) {
case SIDE_BY_SIDE_LR:
case SIDE_BY_SIDE_RL:
@ -254,27 +264,27 @@ 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] + vf->priv->out.off_left,
mpi->planes[0] + vf->priv->in.off_left,
memcpy_pic(dmpi->planes[0] + out_off_left,
mpi->planes[0] + in_off_left,
3 * vf->priv->width,
vf->priv->height,
vf->priv->out.stride,
vf->priv->in.stride);
memcpy_pic(dmpi->planes[0] + vf->priv->out.off_right,
mpi->planes[0] + vf->priv->in.off_right,
dmpi->stride[0],
mpi->stride[0]);
memcpy_pic(dmpi->planes[0] + out_off_right,
mpi->planes[0] + in_off_right,
3 * vf->priv->width,
vf->priv->height,
vf->priv->out.stride,
vf->priv->in.stride);
dmpi->stride[0],
mpi->stride[0]);
break;
case MONO_L:
case MONO_R:
memcpy_pic(dmpi->planes[0],
mpi->planes[0] + vf->priv->in.off_left,
mpi->planes[0] + in_off_left,
3 * vf->priv->width,
vf->priv->height,
vf->priv->out.stride,
vf->priv->in.stride);
dmpi->stride[0],
mpi->stride[0]);
break;
case ANAGLYPH_RC_GRAY:
case ANAGLYPH_RC_HALF:
@ -296,11 +306,9 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
ana_matrix[i] = vf->priv->ana_matrix[i];
for (y = 0; y < vf->priv->out.height; y++) {
o = vf->priv->out.stride * y;
il = vf->priv->in.off_left + y *
vf->priv->in.stride;
ir = vf->priv->in.off_right + y *
vf->priv->in.stride;
o = dmpi->stride[0] * y;
il = in_off_left + y * mpi->stride[0];
ir = in_off_right + y * mpi->stride[0];
for (x = 0; x < out_width; x++) {
dest[o ] = ana_convert(
ana_matrix[0], source + il, source + ir); //red out
@ -344,7 +352,6 @@ static int vf_open(vf_instance_t *vf, char *args)
vf->uninit = uninit;
vf->put_image = put_image;
vf->query_format = query_format;
vf->default_reqs = VFCAP_ACCEPT_STRIDE;
return 1;
}