summaryrefslogtreecommitdiff
path: root/ext/jpeg
diff options
context:
space:
mode:
authorMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>2010-04-29 15:38:49 +0200
committerMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>2010-04-30 17:49:15 +0200
commit761b883f2c8ccddc3e1f768259a7afe0c218e918 (patch)
treed47902ece1714e5308903ebdd909ba91a3eae795 /ext/jpeg
parent78a2b22ed5f5ffeaf6ef18dae617ca178f492407 (diff)
jpegdec: disregard superfluous lines when indirect decoding
Diffstat (limited to 'ext/jpeg')
-rw-r--r--ext/jpeg/gstjpegdec.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/ext/jpeg/gstjpegdec.c b/ext/jpeg/gstjpegdec.c
index b4b2979c2..606f9a295 100644
--- a/ext/jpeg/gstjpegdec.c
+++ b/ext/jpeg/gstjpegdec.c
@@ -793,29 +793,31 @@ gst_jpeg_dec_decode_indirect (GstJpegDec * dec, guchar * base[3],
lines = jpeg_read_raw_data (&dec->cinfo, scanarray, r_v * DCTSIZE);
if (G_LIKELY (lines > 0)) {
for (j = 0, k = 0; j < (r_v * DCTSIZE); j += r_v, k++) {
- memcpy (base[0], y_rows[j], I420_Y_ROWSTRIDE (width));
- if (G_LIKELY (base[0] < last[0]))
+ if (G_LIKELY (base[0] <= last[0])) {
+ memcpy (base[0], y_rows[j], I420_Y_ROWSTRIDE (width));
base[0] += I420_Y_ROWSTRIDE (width);
+ }
if (r_v == 2) {
- memcpy (base[0], y_rows[j + 1], I420_Y_ROWSTRIDE (width));
- if (G_LIKELY (base[0] < last[0]))
+ if (G_LIKELY (base[0] <= last[0])) {
+ memcpy (base[0], y_rows[j + 1], I420_Y_ROWSTRIDE (width));
base[0] += I420_Y_ROWSTRIDE (width);
+ }
}
- if (r_h == 2) {
- memcpy (base[1], u_rows[k], I420_U_ROWSTRIDE (width));
- memcpy (base[2], v_rows[k], I420_V_ROWSTRIDE (width));
- } else if (r_h == 1) {
- hresamplecpy1 (base[1], u_rows[k], I420_U_ROWSTRIDE (width));
- hresamplecpy1 (base[2], v_rows[k], I420_V_ROWSTRIDE (width));
- } else {
- /* FIXME: implement (at least we avoid crashing by doing nothing) */
+ if (G_LIKELY (base[1] <= last[1] && base[2] <= last[2])) {
+ if (r_h == 2) {
+ memcpy (base[1], u_rows[k], I420_U_ROWSTRIDE (width));
+ memcpy (base[2], v_rows[k], I420_V_ROWSTRIDE (width));
+ } else if (r_h == 1) {
+ hresamplecpy1 (base[1], u_rows[k], I420_U_ROWSTRIDE (width));
+ hresamplecpy1 (base[2], v_rows[k], I420_V_ROWSTRIDE (width));
+ } else {
+ /* FIXME: implement (at least we avoid crashing by doing nothing) */
+ }
}
if (r_v == 2 || (k & 1) != 0) {
- if (G_LIKELY (base[1] < last[1] && base[2] < last[2])) {
- base[1] += I420_U_ROWSTRIDE (width);
- base[2] += I420_V_ROWSTRIDE (width);
- }
+ base[1] += I420_U_ROWSTRIDE (width);
+ base[2] += I420_V_ROWSTRIDE (width);
}
}
} else {