home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / sys / amiga / programm / 18075 < prev    next >
Encoding:
Internet Message Format  |  1993-01-03  |  6.8 KB

  1. Path: sparky!uunet!spool.mu.edu!olivea!bunker!nuconvex!starpt!doiron
  2. From: doiron@starpt.UUCP (Glenn Doiron)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: Chunky Pixels vs. Bitplanes (was: Chunky Chip Set...)
  5. Message-ID: <doiron.0kl6@starpt.UUCP>
  6. Date: 3 Jan 93 14:59:34 GMT
  7. References: <Karsten_Weiss.0n2o@ibase.stgt.sub.org> <1hbngoINNglt@uwm.edu>             <1993Jan3.035112.5898@mpifr-bonn.mpg.de>
  8. Organization: 68K Software Development
  9. Lines: 153
  10. X-NewsSoftware: GRn 1.16f (10.17.92) by Mike Schwartz & Michael B. Smith
  11.  
  12. In article <1993Jan3.035112.5898@mpifr-bonn.mpg.de> mlelstv@speckled.mpifr-bonn.mpg.de (Michael van Elst) writes:
  13. > In <doiron.0kil@starpt.UUCP> doiron@starpt.UUCP (Glenn Doiron) writes:
  14. > >... and you still haven't convinced me that chunky isn't faster.  As was
  15. > >said before, the best you can hope for is break-even, and far more often
  16. > >chunky will be faster - the bigger the blit, the smaller the difference.
  17. > The difference vanishes if the bitplanes are well aligned. Otherwise, except
  18. > for tiny bitmaps such as single pixels, the difference is neglible.
  19. > Remember, it is a tiny difference since only borders are affected in most
  20. > operations. Bitplanes will win if you can strip whole bits from all pixels
  21. > (i.e. cut down on pixel depth).
  22.  
  23. I rest my case.
  24.  
  25. > >As I said, you lose all the performance gains VRAMS were supposed to give
  26. > >you in the first place, since you can't use the serial registers for video
  27. > >fetch in planar setups.
  28. > I wouldn't be so sure :)
  29.  
  30. This was suggested to Commodore over 2.5 years ago.  However, it never made
  31. it into AGA.  It probably has something to do with the planar architecture
  32. of the Amiga :)
  33.  
  34. > >Chunky has this property too, although only to a power of two.  This
  35. > >however, is not nearly good enough justification for all the penalties you
  36. > >get in planar doing everyday operations.  Why use a lesser number of colors
  37. > >when you can use more for the same, if not better, performance?
  38. > > 
  39. > Using more colors (more bits per pixel) will always degrade performance.
  40. > But in bitplanes you could f.e. use 1024 colors instead of either 256 or
  41. > 65536.
  42.  
  43. Yes, but you could use 256-color chunky pixels instead of 1024 color planar
  44. pixels and chunky would be faster.  I still, however, don't understand why
  45. you are using scaling like it's the next best thing since the Amiga, you
  46. are operating under reduced capacity.
  47.  
  48. > >No.  It is not.  You are doing N time the amount of work in planar, where N
  49. > >is the number of planes.
  50. > Sorry, not at all.
  51.  
  52. Well... not in my line of work.
  53.  
  54. > >Best of luck to you.  You are talking really expensive hardware now.  Not
  55. > >something you'd tack onto an Amiga, or anything, since chunky is here now,
  56. > >costs less, and doesn't have any of these deficiencies to which your
  57. > >special-purpose hardware would address.
  58. > >Nope.  "Special case".  You can't use the same algorithm to stretch that
  59. > >32x32 image into, say, 64x57 or shrink it to 17x13.  You might be able to
  60. > >do 64x32 or 32x64.  But that's still a special case optimization.
  61. > Well, it is a bitmap scaling by an integer factor. Anything else needs
  62. > filter operations.
  63. > >Shifting is too slow on almost any general purpose processor, not just the
  64. > >68000.  Irregardless, you need to do a lot of shifting/masking, which isn't
  65. > >going to be free on --any-- processor, although custom chips can go a long
  66. > >way towards hiding this via pipelining/superpipelining.
  67. > It isn't a long way. There's really no problem to hide shifts behind
  68. > memory accesses if you stay with reasonable word lengths. Maybe a 128bit
  69. > barrel shifter would be too slow.
  70. > >Can you use that table to do another transformation, as noted above?  No.
  71. > >It's a special case optimization.
  72. > Can you use your chunky bitmap scaling routine for another transformation ? 
  73.  
  74. You can use the same algorithm to scale an (x1 by y1) area to an (x2 by y2)
  75. area.  And adding rotation means a few boundary checks, as well as the
  76. difference between
  77.  
  78. (inner loop)
  79.  x'=x * (1/xscale)
  80.  y'=y * (1/yscale)    ;which does scaling
  81.  getpixel(x',y'): putpixel(x,y)
  82.  
  83.  xrot=cos(theta)/xscale
  84.  yrot=sin(theta)/yscale
  85. (inner loop)
  86.  x'=x * xrot
  87.  y'=y * yrot    ;which will do your scaling and rotation in one fell swoop. 
  88.  getpixel(x',y'): putpixel(x,y)
  89.  
  90. The key to why chunky is so much faster lies in the last getpixel/putpixel
  91. pair.
  92.  
  93. > >few break-even cases.  Sometimes it will even be faster on chunky *even
  94. > >with a reduced scale for planar*, since chunky doesn't need 'bit
  95. > >thrashing'.
  96. > "Doesn't need" is wrong unless you operate on a memory that is one
  97. > pixel 'wide'. You hardly do.
  98.  
  99. I've put up an algorithm that clearly shows why chunky is ridiculously
  100. faster, using a general purpose algorithm that can scale/magnify/rotate any
  101. image to any degree (no sanity checks :).  You're welcome to continue to
  102. argue, but I really think that for all intents and purposes I've proven my
  103. point.
  104.  
  105. > >In all cases, you've admitted that chunky is faster than planar (w/
  106. > >exception of you special case optimization where it breaks even).  I rest
  107. > >my case.
  108. > ...and silently forget depth scaling.
  109.  
  110. OK, ok, take your depth scaling.  Your welcome.  As I said before, if you
  111. want to cut down to 128 colors, why not just go to 16?  Chunky would be
  112. faster THEN.
  113.  
  114. > >Would help if you didn't delete too much from the above references.
  115. > >Plotting an alternating color horizontal line will still be (w/ 8-bit
  116. > >color) 8x faster on chunky than planar.  Plotting every other pixel a
  117. > >different color isn't going to make planar faster.
  118. > Plotting an alternate color horizontal line is same speed. You simply
  119. > determine the pattern you have to mask through.
  120.  
  121. Bingo.  Chunky is still faster.
  122.  
  123. > >:)  Look, if you want a 128-color display, I won't forbid you from using a
  124. > >planar architecture.  However, drawing a line will be far faster on a
  125. > >256-color chunky than a 128-color planar display.  If you need a
  126. > >4,16,256,65536, or true-color display, however, your losses using planar
  127. > >will be even more dramatic as the number of colors goes up, since you are
  128. > >wasting 2x, 4x, 8x, 16x, or 32x the amount of time accessing irrelevant
  129. > >data (still not counting shifting/masking).
  130. > No. With single pixel lines the losses are determined by the word length,
  131. > not the number of planes. Wether you write 8bits per pixel or 24bit per
  132. > pixel. The _ratio_ is still the same.
  133.  
  134. Your correct, the _ratio_ is still the same, but the _amount of time_
  135. wasted goes up incrementally, 2x, 4x, 8x etc.
  136.  
  137. > Regards,
  138. > -- 
  139. > Michael van Elst
  140. > UUCP:     universe!local-cluster!milky-way!sol!earth!uunet!unido!mpirbn!p554mve
  141. > Internet: p554mve@mpirbn.mpifr-bonn.mpg.de
  142. >                                 "A potential Snark may lurk in every tree."
  143.  
  144. Glenn Doiron
  145. --
  146. Amiga UUCP+
  147. Origin:  uunet.uu.net!starpt.UUCP!doiron (Organization:68K Software Development)
  148.          BIX: gdoiron
  149. ** Not enough memory to perform requested operation.  Add 4 megs and retry.
  150.