Path: utzoo!utgpu!water!watmath!clyde!cbosgd!ihnp4!inuxc!iuvax!pur-ee!uiucdcs!uiucdcsp!gillies
From: gillies@uiucdcsp.cs.uiuc.edu
Newsgroups: comp.sys.mac
Subject: Re: image rotation
Message-ID: <76000070@uiucdcsp>
Date: 13 Dec 87 03:05:00 GMT
References: <600@analog.UUCP>
Lines: 24
Nf-ID: #R:analog.UUCP:600:uiucdcsp:76000070:000:1175
Nf-From: uiucdcsp.cs.uiuc.edu!gillies    Dec 12 21:05:00 1987


I think your analysis of the parallel bitblt algorithm is fallacious.
The speed of a BitBLT EVEN IN ASSEMBLY LANGUAGE is approx n*n/16 or
n*n/32, depending upon the word size of your machine.  See [Deutsch84]
to learn how to dynamically "compile" a bitblt request into machine
language, then execute it like a bat out of hell, a type of self
modifying (self-compiling?) algorithm.  For the particular mac rotation
problem, you could hand-code each of the 1..9 bitblt operations.

The recursive Bitblt trick is outlined in the book "Smalltalk-80: The
language and its implementation" pp 408-410.  Using clever boolean ops
and masks, you can do all the recursive BitBLTs in parallel hence you
need only log(n) BITBLTs.  Since the Mac screen is approx 512*512
dots, then a full screen BITBLT rotation should take:

(n*n/16)*log(2,512) == (n*n/2) time.

Thus the blitter algorithm should *always* outperform the
simple-minded bit-by-bit transfer algorithm on the macintosh.

[Deustch84] (E-mail me for the ref -- it's not here, or check ACM Guide)

Don Gillies {ihnp4!uiucdcs!gillies} U of Illinois
            {gillies@p.cs.uiuc.edu}/* End of text from uiucdcsp:comp.sys.mac */