sane-project-website/old-archive/1999-08/0230.html

98 wiersze
3.9 KiB
HTML

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

<!-- received="Wed Aug 18 11:45:38 1999 PDT" -->
<!-- sent="Wed, 18 Aug 1999 20:04:56 +0200" -->
<!-- name="Andreas Beck" -->
<!-- email="becka@rz.uni-duesseldorf.de" -->
<!-- subject="Re: Mustek Paragon 1200SP" -->
<!-- id="" -->
<!-- inreplyto="Pine.LNX.4.05.9908181315260.31167-100000@obastrlx.combox.de" -->
<title>sane-devel: Re: Mustek Paragon 1200SP</title>
<h1>Re: Mustek Paragon 1200SP</h1>
<b>Andreas Beck</b> (<a href="mailto:becka@rz.uni-duesseldorf.de"><i>becka@rz.uni-duesseldorf.de</i></a>)<br>
<i>Wed, 18 Aug 1999 20:04:56 +0200</i>
<p>
<ul>
<li> <b>Messages sorted by:</b> <a href="date.html#230">[ date ]</a><a href="index.html#230">[ thread ]</a><a href="subject.html#230">[ subject ]</a><a href="author.html#230">[ author ]</a>
<!-- next="start" -->
<li> <b>Next message:</b> <a href="0231.html">Nick Lamb: "Re: SANE V2"</a>
<li> <b>Previous message:</b> <a href="0229.html">Nick Lamb: "Re: SANE V2"</a>
<!-- nextthread="start" -->
<!-- reply="end" -->
</ul>
<!-- body="start" -->
<i>&gt; &gt; In case that does not fit your problem, please have a look at sane-mustek(1),</i><br>
<i>&gt; &gt; which discribes two options for mustek.conf that might help you. Well actually</i><br>
<i>&gt; &gt; one of them might help. The lineart fix isn't really helpful for you.</i><br>
<i>&gt; If you could send me the fix, I would test it tonight....</i><br>
<p>
O.K. - here you go:<br>
<p>
--- mustek.c.orig Fri Oct 30 07:56:12 1998<br>
+++ mustek.c Tue Aug 3 21:27:28 1999<br>
@@ -1767,6 +1767,9 @@<br>
the green buffer must be able to hold up to 1*dy lines. */<br>
s-&gt;ld.buf[RED] = malloc (3 * dy * (long) bpc);<br>
s-&gt;ld.buf[GRN] = s-&gt;ld.buf[RED] + 2 * dy * bpc;<br>
+ memset(s-&gt;ld.buf[RED], 0, 3 * dy * (long) bpc);<br>
+<br>
+ DBG(2, "fix_line_distance_mfs: malloc and clear. \n");<br>
}<br>
<br>
/* restore the red and green lines from the previous buffer: */<br>
@@ -1833,19 +1836,19 @@<br>
/* save red and green lines: */<br>
for (y = 0; y &lt; 2*dy; ++y)<br>
{<br>
- if (num_lines - 2*dy + y &gt;= 0)<br>
+ if (num_lines + y &gt;= 2*dy)<br>
src = raw + (num_lines - 2*dy + y)*bpl;<br>
- else<br>
+ else <br>
src = s-&gt;ld.buf[RED] + (y + num_lines)*bpc;<br>
- memcpy (s-&gt;ld.buf[RED] + y*bpc, src, bpc);<br>
+ memmove (s-&gt;ld.buf[RED] + y*bpc, src, bpc);<br>
}<br>
for (y = 0; y &lt; 1*dy; ++y)<br>
{<br>
- if (num_lines - 1*dy + y &gt;= 0)<br>
+ if (num_lines + y &gt;= 1*dy)<br>
src = raw + (num_lines - 1*dy + y)*bpl + bpc;<br>
else<br>
src = s-&gt;ld.buf[GRN] + (y + num_lines)*bpc;<br>
- memcpy (s-&gt;ld.buf[GRN] + y*bpc, src, bpc);<br>
+ memmove (s-&gt;ld.buf[GRN] + y*bpc, src, bpc);<br>
}<br>
}<br>
<br>
And NO: The patch is not a NOP. <br>
<p>
The memset is just more clean and doesn't leave you with garbage in the <br>
top few lines (which are wrong anyway due to the lack of correction data). <br>
<p>
The memcpy-&gt;memmove is not required and should probably not be applied for <br>
the final version. It's a relic from testing.<br>
<p>
The important one is the rephrasing of the arithmetics. Though both<br>
expressions are mathematically equivalent, they are not in C, as there is a<br>
subtle problem with automatic type promotion.<br>
<p>
CU, ANdy<br>
<p>
<pre>
--
= Andreas Beck | Email : &lt;<a href="mailto:andreas.beck@ggi-project.org">andreas.beck@ggi-project.org</a>&gt; =
<p>
<pre>
--
Source code, list archive, and docs: <a href="http://www.mostang.com/sane/">http://www.mostang.com/sane/</a>
To unsubscribe: echo unsubscribe sane-devel | mail <a href="mailto:majordomo@mostang.com">majordomo@mostang.com</a>
</pre>
<!-- body="end" -->
<p>
<ul>
<!-- next="start" -->
<li> <b>Next message:</b> <a href="0231.html">Nick Lamb: "Re: SANE V2"</a>
<li> <b>Previous message:</b> <a href="0229.html">Nick Lamb: "Re: SANE V2"</a>
<!-- nextthread="start" -->
<!-- reply="end" -->
</ul>