Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!pacbell.com!tandem!zorch!amiga0!mykes From: mykes@amiga0.SF-Bay.ORG (Mike Schwartz) Newsgroups: comp.sys.amiga.programmer Subject: Re: best way to reverse a bitplane? Message-ID: Date: 1 May 91 09:32:44 GMT References: <1991Apr29.101302.1@atmo2.atmo.arizona.edu> <1991Apr29.155129.30171@kuhub.cc.ukans.edu> Organization: Amiga makes it possible Lines: 31 In article <1991Apr29.155129.30171@kuhub.cc.ukans.edu> markv@kuhub.cc.ukans.edu writes: >In article <1991Apr29.101302.1@atmo2.atmo.arizona.edu>, leuthold@atmo2.atmo.arizona.edu writes: >> What is the best way to reverse a bitplane? A brute force method would be >> to reverse the bytes and then reverse the bits in each byte. The only way I >> can think of to reverse the bits in each byte is to mask each bit off then >> shift it to its new place and add it to the new byte. Is there a better way? > >Well, for a 68000, you have to do it bit by bit. However, your basic >loop is going to have an AND, an OR, a LSR/LSL. With the 68000, you >would get about 33% better speed with a BTST followed by a BSET. Note >this assumes you optimize things for operand size, etc. In general >you will gain a lot of speed by unrolling your loop for each bit, >since you wont have to caclulate the Mask with for each bit. > >The 68020 and later have some bit range instructions that may help, >but I dont have a reference handy. > >Also, I assume you mean reverse right/left, since a top bottom reverse >can be done by just swapping bytes. Note the blitter doesn't help >since all its DMA must progress in the same "direction". > You can use a 256-byte lookup table to get your reversed bits and do it a lot faster than any of the methods mentioned above. -- **************************************************** * I want games that look like Shadow of the Beast * * but play like Leisure Suit Larry. * ****************************************************