mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 09:55:36 +00:00
smpte: fix stride handling
This commit is contained in:
parent
3f4e4edaa2
commit
15d1d40662
1 changed files with 30 additions and 11 deletions
|
@ -408,8 +408,7 @@ gst_smpte_blend_i420 (guint8 * in1, guint8 * in2, guint8 * out, GstMask * mask,
|
||||||
gint i, j;
|
gint i, j;
|
||||||
gint min, max;
|
gint min, max;
|
||||||
guint8 *in1u, *in1v, *in2u, *in2v, *outu, *outv;
|
guint8 *in1u, *in1v, *in2u, *in2v, *outu, *outv;
|
||||||
gint lumsize = width * height;
|
gint uoffset, voffset, ystr, ustr, vstr;
|
||||||
gint chromsize = lumsize >> 2;
|
|
||||||
|
|
||||||
if (border == 0)
|
if (border == 0)
|
||||||
border++;
|
border++;
|
||||||
|
@ -417,12 +416,19 @@ gst_smpte_blend_i420 (guint8 * in1, guint8 * in2, guint8 * out, GstMask * mask,
|
||||||
min = pos - border;
|
min = pos - border;
|
||||||
max = pos;
|
max = pos;
|
||||||
|
|
||||||
in1u = in1 + lumsize;
|
uoffset = I420_U_OFFSET (width, height);
|
||||||
in1v = in1u + chromsize;
|
voffset = I420_V_OFFSET (width, height);
|
||||||
in2u = in2 + lumsize;
|
|
||||||
in2v = in2u + chromsize;
|
ystr = I420_Y_ROWSTRIDE (width);
|
||||||
outu = out + lumsize;
|
ustr = I420_U_ROWSTRIDE (width);
|
||||||
outv = outu + chromsize;
|
vstr = I420_V_ROWSTRIDE (width);
|
||||||
|
|
||||||
|
in1u = in1 + uoffset;
|
||||||
|
in1v = in1 + voffset;
|
||||||
|
in2u = in2 + uoffset;
|
||||||
|
in2v = in2 + voffset;
|
||||||
|
outu = out + uoffset;
|
||||||
|
outv = out + voffset;
|
||||||
|
|
||||||
maskp = mask->data;
|
maskp = mask->data;
|
||||||
|
|
||||||
|
@ -431,12 +437,25 @@ gst_smpte_blend_i420 (guint8 * in1, guint8 * in2, guint8 * out, GstMask * mask,
|
||||||
value = *maskp++;
|
value = *maskp++;
|
||||||
value = ((CLAMP (value, min, max) - min) << 8) / border;
|
value = ((CLAMP (value, min, max) - min) << 8) / border;
|
||||||
|
|
||||||
*out++ = ((*in1++ * value) + (*in2++ * (256 - value))) >> 8;
|
out[j] = ((in1[j] * value) + (in2[j] * (256 - value))) >> 8;
|
||||||
if (!(i & 1) && !(j & 1)) {
|
if (!(i & 1) && !(j & 1)) {
|
||||||
*outu++ = ((*in1u++ * value) + (*in2u++ * (256 - value))) >> 8;
|
outu[j / 2] =
|
||||||
*outv++ = ((*in1v++ * value) + (*in2v++ * (256 - value))) >> 8;
|
((in1u[j / 2] * value) + (in2u[j / 2] * (256 - value))) >> 8;
|
||||||
|
outv[j / 2] =
|
||||||
|
((in1v[j / 2] * value) + (in2v[j / 2] * (256 - value))) >> 8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
out += ystr;
|
||||||
|
in1 += ystr;
|
||||||
|
in2 += ystr;
|
||||||
|
if (!(i & 1)) {
|
||||||
|
outu += ustr;
|
||||||
|
in1u += ustr;
|
||||||
|
in2u += ustr;
|
||||||
|
outv += vstr;
|
||||||
|
in1v += vstr;
|
||||||
|
in2v += vstr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue