Path: csiph.com!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail From: Jan Burse Newsgroups: comp.lang.java.programmer Subject: Re: Bicubic interpolation suddenly is no better than bilinear. Date: Sat, 19 May 2012 20:48:01 +0200 Organization: albasani.net Lines: 68 Message-ID: References: <9d143d01-dcf4-4343-9477-3ffbcd3027e1@ra8g2000pbc.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.albasani.net nOjwNnlJJXFvz23lqujObC/Lcw9g3BdXuVtsqSnSXdUAliC8l3VtoQaeD+OT5ui89yjjHhaLwrRFjUABFmGG6fZkJQ1QSft6j8ntvvQ8N/qZrbPBT44s3MZlYr3kdQDQ NNTP-Posting-Date: Sat, 19 May 2012 18:48:01 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="zXZyEQmBeFoBN+sKtfeW4bEr3CCAzWXE9dMkG7oa0iJLF3xVGu0aF7rHOxf6V6zry1BtM9V6aYaBhpP5zSo9/DohUQ2lndwGRhvRtSuDv//DP/VNeCcDJDlgqhCfa2Hx"; mail-complaints-to="abuse@albasani.net" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:12.0) Gecko/20120429 Firefox/12.0 SeaMonkey/2.9.1 In-Reply-To: <9d143d01-dcf4-4343-9477-3ffbcd3027e1@ra8g2000pbc.googlegroups.com> Cancel-Lock: sha1:rpR/OMA8+DaDDsAu0qPar2zX6SQ= Xref: csiph.com comp.lang.java.programmer:14649 Dangling Pointer schrieb: > Still, something is wrong. Iterative BILINEAR rescaling is*supposed* > to achieve comparable quality to SCALE_AREA_AVERAGING, and bicubic is Most probably your claim is wrong, even with the best rounding in the world. We have ideally: x1 + .... + x2n x1 + x2 x2n-1 + x2n --------------- = ------- ----------- 2^n 2 2 .... ------------------- 2 Now a rounding function r(x/n) can be viewed as an nummerator correction c(x/n) function: r(x/n) = (x + c(x/n)) / n For /2 the nummerator correction is either -1 or 0 when you round down. So there might be a maximal correction of -1 * 2^(n-1) in the first iteration of bilinear. Then -1 * 2 * 2^(n-2) in the next iteration, and so on: Total maximal correction: -n*2^(n-1) For /2^n the numeration correction is somewhere between -2^n+1 and 0 when you round down. So maximal correction is: -2^n+1 When is the iteration correction by 2^n bigger than the area correction? Lets make a little table: n -n*2^(n-1) -2^n+1 diff 2^n 1 -1 -1 0 2 2 -4 -3 1 4 3 -12 -7 5 8 4 -32 -15 17 16 5 -80 -31 49 32 6 -192 -63 129 64 7 -448 -127 321 128 So I guess for 4 iteration we could eventually construct an example where the error would be at least one color value step, since the maximal numerator correction difference is then greater than the denumerator 2^n. Let's give it a try: Iterative: 3 0 1 0 0 1 0 3 1 0 0 1 0 0 0 Area: 3 0 1 0 0 1 0 3 1 Yes we have found an example where iterative is different from area by one color pixel value step. Bye