[MPlayer-dev-eng] [PATCH 2/x] Fix stereo3d stride align
Endre Kollár
taxy443 at gmail.com
Wed Oct 27 01:36:36 CEST 2010
2010/10/24 Endre Kollár <taxy443 at gmail.com>:
> 2010/10/23 Endre Kollár <taxy443 at gmail.com>:
>> 2010/10/19 Reimar Döffinger <Reimar.Doeffinger at gmx.de>:
>>> On Tue, Oct 19, 2010 at 01:12:32PM +0200, Endre Kollár wrote:
>>>> > I am sorry that above patch included my changes. I interpreted too
>>>> > late this message(I do not understand why). But it is not difficult.
>>>> > Starting in function find_best_out, easy to trace changes.
>>>> >
>>>>
>>>> i send as help the patch with only MY changes and mixed with cleanup things.
>>>
>>> I have some doubts this change makes any sense.
>>> It seems likely that it makes the inner loop so much slower that doing
>>> a separate colour-space conversion is actually faster.
>>> _______________________________________________
>>> MPlayer-dev-eng mailing list
>>> MPlayer-dev-eng at mplayerhq.hu
>>> https://lists.mplayerhq.hu/mailman/listinfo/mplayer-dev-eng
>>>
>>
>> If we consider ourselves to the separate scale conversion. This should
>> be enforced to the ABOVE_BELOW_2_ case of parameter. We can leave the
>> horizontal scaling for the next filter/out driver.
>>
>
> Not "horizontal", we can leave the VERTICAL scaling for the next
> filter/out driver. Sorry.
>
This is the part 2 of "[PATCH] stereo3d noscale precept" patch serial.
So whatever may be the video resolution, Taking into account the
current "stride align".
-------------- next part --------------
--- a/libmpcodecs/vf_stereo3d.c 2010-10-23 21:03:42.000000000 +0200
+++ b/libmpcodecs/vf_stereo3d.c 2010-10-27 01:12:33.000000000 +0200
@@ -62,8 +62,10 @@ typedef struct component {
stereo_code fmt;
unsigned int width;
unsigned int height;
- unsigned int off_left;
- unsigned int off_right;
+ unsigned int off_left_x;
+ unsigned int off_right_x;
+ unsigned int off_left_y;
+ unsigned int off_right_y;
unsigned int stride;
} component;
@@ -138,33 +140,35 @@ static int config(struct vf_instance *vf
vf->priv->height = height;
vf->priv->in.width = width;
vf->priv->in.height = height;
- vf->priv->in.off_left = 0;
- vf->priv->in.off_right = 0;
+ vf->priv->in.off_left_x = 0;
+ vf->priv->in.off_right_x = 0;
+ vf->priv->in.off_left_y = 0;
+ vf->priv->in.off_right_y = 0;
vf->priv->in.stride = vf->priv->width * 3;
//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;
+ vf->priv->width = width / 2;
+ vf->priv->in.off_right_x = 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;
+ vf->priv->width = width / 2;
+ vf->priv->in.off_left_x = vf->priv->width * 3;
+ vf->priv->in.stride = vf->priv->width * 6;
break;
case ABOVE_BELOW_2_LR:
- d_height *= 2;
+ 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->height = height / 2;
+ vf->priv->in.off_right_y = vf->priv->height;
break;
case ABOVE_BELOW_2_RL:
- d_height *= 2;
+ 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->height = height / 2;
+ vf->priv->in.off_left_y = vf->priv->height;
break;
default:
mp_msg(MSGT_VFILTER, MSGL_WARN,
@@ -175,8 +179,10 @@ static int config(struct vf_instance *vf
//default output values
vf->priv->out.width = vf->priv->width;
vf->priv->out.height = vf->priv->height;
- vf->priv->out.off_left = 0;
- vf->priv->out.off_right = 0;
+ vf->priv->out.off_left_x = 0;
+ vf->priv->out.off_right_x = 0;
+ vf->priv->out.off_left_y = 0;
+ vf->priv->out.off_right_y = 0;
vf->priv->out.stride = vf->priv->width * 3;
//check output format
@@ -195,30 +201,31 @@ static int config(struct vf_instance *vf
sizeof(vf->priv->ana_matrix));
break;
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;
+ vf->priv->out.width = vf->priv->width * 2;
+ vf->priv->out.off_right_x = 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;
+ vf->priv->out.width = vf->priv->width * 2;
+ vf->priv->out.off_left_x = vf->priv->width * 3;
+ vf->priv->out.stride = vf->priv->width * 6;
break;
case ABOVE_BELOW_2_LR:
- d_height /= 2;
+ 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.height = vf->priv->height * 2;
+ vf->priv->out.off_right_y = vf->priv->height;
break;
case ABOVE_BELOW_2_RL:
- d_height /= 2;
+ 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.height = vf->priv->height * 2;
+ vf->priv->out.off_left_y = 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.off_left_x = vf->priv->in.off_right_x;
+ vf->priv->in.off_left_y = vf->priv->in.off_right_y;
//nobreak;
case MONO_L:
//use default settings
@@ -229,6 +236,7 @@ static int config(struct vf_instance *vf
return 0;
break;
}
+
if (!opt_screen_size_x && !opt_screen_size_y) {
d_width = d_width * vf->priv->out.width / width;
d_height = d_height * vf->priv->out.height / height;
@@ -240,13 +248,23 @@ static int config(struct vf_instance *vf
static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
{
mp_image_t *dmpi;
+ int in_off_left, in_off_right, out_off_left, out_off_right;
+
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,
+ 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;
+ in_off_left = vf->priv->in.off_left_y * mpi->stride[0] +
+ vf->priv->in.off_left_x;
+ in_off_right = vf->priv->in.off_right_y * mpi->stride[0] +
+ vf->priv->in.off_right_x;
+ out_off_left = vf->priv->out.off_left_y * dmpi->stride[0] +
+ vf->priv->out.off_left_x;
+ out_off_right = vf->priv->out.off_right_y * dmpi->stride[0] +
+ vf->priv->out.off_right_x;
+
switch (vf->priv->out.fmt) {
case SIDE_BY_SIDE_LR:
case SIDE_BY_SIDE_RL:
@@ -254,27 +272,27 @@ static int put_image(struct vf_instance
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 +314,9 @@ static int put_image(struct vf_instance
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 +360,6 @@ static int vf_open(vf_instance_t *vf, ch
vf->uninit = uninit;
vf->put_image = put_image;
vf->query_format = query_format;
- vf->default_reqs = VFCAP_ACCEPT_STRIDE;
return 1;
}
More information about the MPlayer-dev-eng
mailing list