mirror of https://github.com/mpv-player/mpv
vf_stereo3d: Adjust d_height instead of bad ad-hoc scaling
Patch by Endre Kollár [taxy443 gmail com] git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32625 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
387326e54b
commit
0569269887
|
@ -66,7 +66,6 @@ typedef struct component {
|
||||||
unsigned int off_left;
|
unsigned int off_left;
|
||||||
unsigned int off_right;
|
unsigned int off_right;
|
||||||
unsigned int stride;
|
unsigned int stride;
|
||||||
unsigned int hres;
|
|
||||||
} component;
|
} component;
|
||||||
|
|
||||||
//==global variables==//
|
//==global variables==//
|
||||||
|
@ -139,7 +138,6 @@ static int config(struct vf_instance *vf, int width, int height, int d_width,
|
||||||
vf->priv->height = height;
|
vf->priv->height = height;
|
||||||
vf->priv->in.width = width;
|
vf->priv->in.width = width;
|
||||||
vf->priv->in.height = height;
|
vf->priv->in.height = height;
|
||||||
vf->priv->in.hres = 1;
|
|
||||||
vf->priv->in.off_left = 0;
|
vf->priv->in.off_left = 0;
|
||||||
vf->priv->in.off_right = 0;
|
vf->priv->in.off_right = 0;
|
||||||
vf->priv->in.stride = vf->priv->width * 3;
|
vf->priv->in.stride = vf->priv->width * 3;
|
||||||
|
@ -156,22 +154,18 @@ static int config(struct vf_instance *vf, int width, int height, int d_width,
|
||||||
vf->priv->in.off_left = vf->priv->width * 3;
|
vf->priv->in.off_left = vf->priv->width * 3;
|
||||||
vf->priv->in.stride = vf->priv->width * 6;
|
vf->priv->in.stride = vf->priv->width * 6;
|
||||||
break;
|
break;
|
||||||
|
case ABOVE_BELOW_2_LR:
|
||||||
|
d_height *= 2;
|
||||||
case ABOVE_BELOW_LR:
|
case ABOVE_BELOW_LR:
|
||||||
vf->priv->height = height / 2;
|
vf->priv->height = height / 2;
|
||||||
vf->priv->in.off_right = vf->priv->width * vf->priv->height * 3;
|
vf->priv->in.off_right = vf->priv->width * vf->priv->height * 3;
|
||||||
break;
|
break;
|
||||||
|
case ABOVE_BELOW_2_RL:
|
||||||
|
d_height *= 2;
|
||||||
case ABOVE_BELOW_RL:
|
case ABOVE_BELOW_RL:
|
||||||
vf->priv->height = height / 2;
|
vf->priv->height = height / 2;
|
||||||
vf->priv->in.off_left = vf->priv->width * vf->priv->height * 3;
|
vf->priv->in.off_left = vf->priv->width * vf->priv->height * 3;
|
||||||
break;
|
break;
|
||||||
case ABOVE_BELOW_2_LR:
|
|
||||||
vf->priv->in.hres = 2;
|
|
||||||
vf->priv->in.off_right = vf->priv->width * vf->priv->height / 2 * 3;
|
|
||||||
break;
|
|
||||||
case ABOVE_BELOW_2_RL:
|
|
||||||
vf->priv->in.hres = 2;
|
|
||||||
vf->priv->in.off_left = vf->priv->width * vf->priv->height / 2 * 3;
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
mp_msg(MSGT_VFILTER, MSGL_WARN,
|
mp_msg(MSGT_VFILTER, MSGL_WARN,
|
||||||
"[stereo3d] stereo format of input is not supported\n");
|
"[stereo3d] stereo format of input is not supported\n");
|
||||||
|
@ -181,7 +175,6 @@ static int config(struct vf_instance *vf, int width, int height, int d_width,
|
||||||
//default output values
|
//default output values
|
||||||
vf->priv->out.width = vf->priv->width;
|
vf->priv->out.width = vf->priv->width;
|
||||||
vf->priv->out.height = vf->priv->height;
|
vf->priv->out.height = vf->priv->height;
|
||||||
vf->priv->out.hres = 1;
|
|
||||||
vf->priv->out.off_left = 0;
|
vf->priv->out.off_left = 0;
|
||||||
vf->priv->out.off_right = 0;
|
vf->priv->out.off_right = 0;
|
||||||
vf->priv->out.stride = vf->priv->width * 3;
|
vf->priv->out.stride = vf->priv->width * 3;
|
||||||
|
@ -211,22 +204,18 @@ static int config(struct vf_instance *vf, int width, int height, int d_width,
|
||||||
vf->priv->out.off_left = vf->priv->width * 3;
|
vf->priv->out.off_left = vf->priv->width * 3;
|
||||||
vf->priv->out.stride = vf->priv->width * 6;
|
vf->priv->out.stride = vf->priv->width * 6;
|
||||||
break;
|
break;
|
||||||
|
case ABOVE_BELOW_2_LR:
|
||||||
|
d_height /= 2;
|
||||||
case ABOVE_BELOW_LR:
|
case ABOVE_BELOW_LR:
|
||||||
vf->priv->out.height = vf->priv->height * 2;
|
vf->priv->out.height = vf->priv->height * 2;
|
||||||
vf->priv->out.off_right = vf->priv->width * vf->priv->height * 3;
|
vf->priv->out.off_right = vf->priv->width * vf->priv->height * 3;
|
||||||
break;
|
break;
|
||||||
|
case ABOVE_BELOW_2_RL:
|
||||||
|
d_height /= 2;
|
||||||
case ABOVE_BELOW_RL:
|
case ABOVE_BELOW_RL:
|
||||||
vf->priv->out.height = vf->priv->height * 2;
|
vf->priv->out.height = vf->priv->height * 2;
|
||||||
vf->priv->out.off_left = vf->priv->width * vf->priv->height * 3;
|
vf->priv->out.off_left = vf->priv->width * vf->priv->height * 3;
|
||||||
break;
|
break;
|
||||||
case ABOVE_BELOW_2_LR:
|
|
||||||
vf->priv->out.hres = 2;
|
|
||||||
vf->priv->out.off_right = vf->priv->width * vf->priv->height / 2 * 3;
|
|
||||||
break;
|
|
||||||
case ABOVE_BELOW_2_RL:
|
|
||||||
vf->priv->out.hres = 2;
|
|
||||||
vf->priv->out.off_left = vf->priv->width * vf->priv->height / 2 * 3;
|
|
||||||
break;
|
|
||||||
case MONO_R:
|
case MONO_R:
|
||||||
//same as MONO_L only needs switching of input offsets
|
//same as MONO_L only needs switching of input offsets
|
||||||
vf->priv->in.off_left = vf->priv->in.off_right;
|
vf->priv->in.off_left = vf->priv->in.off_right;
|
||||||
|
@ -265,32 +254,27 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
|
||||||
case ABOVE_BELOW_RL:
|
case ABOVE_BELOW_RL:
|
||||||
case ABOVE_BELOW_2_LR:
|
case ABOVE_BELOW_2_LR:
|
||||||
case ABOVE_BELOW_2_RL:
|
case ABOVE_BELOW_2_RL:
|
||||||
for (int i = 0; i < vf->priv->in.hres; i++) {
|
memcpy_pic(dmpi->planes[0] + vf->priv->out.off_left,
|
||||||
memcpy_pic(dmpi->planes[0] + vf->priv->out.off_left +
|
mpi->planes[0] + vf->priv->in.off_left,
|
||||||
(i * vf->priv->out.stride), mpi->planes[0] +
|
3 * vf->priv->width,
|
||||||
vf->priv->in.off_left, 3 * vf->priv->width,
|
vf->priv->height,
|
||||||
vf->priv->height / (vf->priv->in.hres *
|
vf->priv->out.stride,
|
||||||
vf->priv->out.hres), vf->priv->out.stride *
|
vf->priv->in.stride);
|
||||||
vf->priv->in.hres, vf->priv->in.stride *
|
memcpy_pic(dmpi->planes[0] + vf->priv->out.off_right,
|
||||||
vf->priv->out.hres);
|
mpi->planes[0] + vf->priv->in.off_right,
|
||||||
memcpy_pic(dmpi->planes[0] + vf->priv->out.off_right +
|
3 * vf->priv->width,
|
||||||
(i * vf->priv->out.stride), mpi->planes[0] +
|
vf->priv->height,
|
||||||
vf->priv->in.off_right, 3 * vf->priv->width,
|
vf->priv->out.stride,
|
||||||
vf->priv->height / (vf->priv->in.hres *
|
vf->priv->in.stride);
|
||||||
vf->priv->out.hres), vf->priv->out.stride *
|
|
||||||
vf->priv->in.hres, vf->priv->in.stride *
|
|
||||||
vf->priv->out.hres);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case MONO_L:
|
case MONO_L:
|
||||||
case MONO_R:
|
case MONO_R:
|
||||||
for (int i = 0; i < vf->priv->in.hres; i++) {
|
memcpy_pic(dmpi->planes[0],
|
||||||
memcpy_pic(dmpi->planes[0] + (i * vf->priv->out.stride),
|
mpi->planes[0] + vf->priv->in.off_left,
|
||||||
mpi->planes[0] + vf->priv->in.off_left, 3 *
|
3 * vf->priv->width,
|
||||||
vf->priv->width, vf->priv->height /
|
vf->priv->height,
|
||||||
vf->priv->in.hres, vf->priv->out.stride *
|
vf->priv->out.stride,
|
||||||
vf->priv->in.hres, vf->priv->in.stride);
|
vf->priv->in.stride);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case ANAGLYPH_RC_GRAY:
|
case ANAGLYPH_RC_GRAY:
|
||||||
case ANAGLYPH_RC_HALF:
|
case ANAGLYPH_RC_HALF:
|
||||||
|
@ -313,9 +297,9 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
|
||||||
|
|
||||||
for (y = 0; y < vf->priv->out.height; y++) {
|
for (y = 0; y < vf->priv->out.height; y++) {
|
||||||
o = vf->priv->out.stride * y;
|
o = vf->priv->out.stride * y;
|
||||||
il = vf->priv->in.off_left + (y / vf->priv->in.hres) *
|
il = vf->priv->in.off_left + y *
|
||||||
vf->priv->in.stride;
|
vf->priv->in.stride;
|
||||||
ir = vf->priv->in.off_right + (y / vf->priv->in.hres) *
|
ir = vf->priv->in.off_right + y *
|
||||||
vf->priv->in.stride;
|
vf->priv->in.stride;
|
||||||
for (x = 0; x < out_width; x++) {
|
for (x = 0; x < out_width; x++) {
|
||||||
dest[o ] = ana_convert(
|
dest[o ] = ana_convert(
|
||||||
|
|
Loading…
Reference in New Issue