diff --git a/ChangeLog b/ChangeLog index 173e4d02dc..684ab438ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2004-07-22 Thomas Vander Stichele + + * gst/videoscale/videoscale.c: (gst_videoscale_planar411), + (gst_videoscale_scale_nearest_16bit): + comment algorithm + 2004-07-22 Thomas Vander Stichele * gst/videotestsrc/gstvideotestsrc.c: diff --git a/gst/videoscale/videoscale.c b/gst/videoscale/videoscale.c index 886ce2bc31..72fe610985 100644 --- a/gst/videoscale/videoscale.c +++ b/gst/videoscale/videoscale.c @@ -778,18 +778,20 @@ gst_videoscale_scale_nearest_16bit (GstVideoscale * scale, guchar *destp; guchar *srcp; - GST_LOG_OBJECT (scale, "scaling nearest %p %p %d", src, dest, dw); + GST_LOG_OBJECT (scale, "scaling nearest from %p to %p, destination width %d", + src, dest, dw); ypos = 0; - yinc = (sh << 16) / dh; + yinc = (sh << 16) / dh; /* 16 bit fixed point arithmetic */ xinc = (sw << 16) / dw; - for (y = dh; y; y--) { + /* go over all destination lines */ + for (y = dh; y; y--) { /* faster than 0 .. dh */ - if (ypos >= 0x10000) { - src += (ypos >> 16) * sw * 2; - ypos &= 0xffff; + if (ypos >= 0x10000) { /* ypos >= 1 ? */ + src += (ypos >> 16) * sw * 2; /* go down round(ypos) src lines */ + ypos &= 0xffff; /* ypos %= 1 */ } xpos = 0; @@ -797,17 +799,18 @@ gst_videoscale_scale_nearest_16bit (GstVideoscale * scale, srcp = src; destp = dest; + /* go over all destination pixels for each line */ for (x = dw; x; x--) { - if (xpos >= 0x10000) { - srcp += (xpos >> 16) * 2; - xpos &= 0xffff; + if (xpos >= 0x10000) { /* xpos >= 1 ? */ + srcp += (xpos >> 16) * 2; /* go right round(xpos) src pixels */ + xpos &= 0xffff; /* xpos %= 1 */ } destp[0] = srcp[0]; destp[1] = srcp[1]; - destp += 2; + destp += 2; /* go right one destination pixel */ xpos += xinc; } - dest += dw * 2; + dest += dw * 2; /* go down one destination line */ ypos += yinc; }