comment algorithm
Original commit message from CVS: comment algorithm
This commit is contained in:
parent
e4916f9cbb
commit
e9bc7e575b
@ -1,3 +1,9 @@
|
|||||||
|
2004-07-22 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||||
|
|
||||||
|
* gst/videoscale/videoscale.c: (gst_videoscale_planar411),
|
||||||
|
(gst_videoscale_scale_nearest_16bit):
|
||||||
|
comment algorithm
|
||||||
|
|
||||||
2004-07-22 Thomas Vander Stichele <thomas at apestaart dot org>
|
2004-07-22 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||||
|
|
||||||
* gst/videotestsrc/gstvideotestsrc.c:
|
* gst/videotestsrc/gstvideotestsrc.c:
|
||||||
|
@ -778,18 +778,20 @@ gst_videoscale_scale_nearest_16bit (GstVideoscale * scale,
|
|||||||
guchar *destp;
|
guchar *destp;
|
||||||
guchar *srcp;
|
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;
|
ypos = 0;
|
||||||
yinc = (sh << 16) / dh;
|
yinc = (sh << 16) / dh; /* 16 bit fixed point arithmetic */
|
||||||
xinc = (sw << 16) / dw;
|
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) {
|
if (ypos >= 0x10000) { /* ypos >= 1 ? */
|
||||||
src += (ypos >> 16) * sw * 2;
|
src += (ypos >> 16) * sw * 2; /* go down round(ypos) src lines */
|
||||||
ypos &= 0xffff;
|
ypos &= 0xffff; /* ypos %= 1 */
|
||||||
}
|
}
|
||||||
|
|
||||||
xpos = 0;
|
xpos = 0;
|
||||||
@ -797,17 +799,18 @@ gst_videoscale_scale_nearest_16bit (GstVideoscale * scale,
|
|||||||
srcp = src;
|
srcp = src;
|
||||||
destp = dest;
|
destp = dest;
|
||||||
|
|
||||||
|
/* go over all destination pixels for each line */
|
||||||
for (x = dw; x; x--) {
|
for (x = dw; x; x--) {
|
||||||
if (xpos >= 0x10000) {
|
if (xpos >= 0x10000) { /* xpos >= 1 ? */
|
||||||
srcp += (xpos >> 16) * 2;
|
srcp += (xpos >> 16) * 2; /* go right round(xpos) src pixels */
|
||||||
xpos &= 0xffff;
|
xpos &= 0xffff; /* xpos %= 1 */
|
||||||
}
|
}
|
||||||
destp[0] = srcp[0];
|
destp[0] = srcp[0];
|
||||||
destp[1] = srcp[1];
|
destp[1] = srcp[1];
|
||||||
destp += 2;
|
destp += 2; /* go right one destination pixel */
|
||||||
xpos += xinc;
|
xpos += xinc;
|
||||||
}
|
}
|
||||||
dest += dw * 2;
|
dest += dw * 2; /* go down one destination line */
|
||||||
|
|
||||||
ypos += yinc;
|
ypos += yinc;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user