home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / sys / amiga / programm / 18085 < prev    next >
Encoding:
Internet Message Format  |  1993-01-03  |  5.4 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.0kmz@starpt.UUCP>
  6. Date: 4 Jan 93 00:23:15 GMT
  7. References: <Karsten_Weiss.0n2o@ibase.stgt.sub.org> <1hbngoINNglt@uwm.edu>              <1993Jan3.204843.15155@mpifr-bonn.mpg.de>
  8. Organization: 68K Software Development
  9. Lines: 120
  10. X-NewsSoftware: GRn 1.16f (10.17.92) by Mike Schwartz & Michael B. Smith
  11.  
  12. In article <1993Jan3.204843.15155@mpifr-bonn.mpg.de> mlelstv@specklec.mpifr-bonn.mpg.de (Michael van Elst) writes:
  13. > In <doiron.0kl6@starpt.UUCP> doiron@starpt.UUCP (Glenn Doiron) writes:
  14. > >Yes, but you could use 256-color chunky pixels instead of 1024 color planar
  15. > >pixels and chunky would be faster.
  16. > Simply to get more colors when needed.
  17.  
  18. However, that is entirely besides the point.  I will say that planar is
  19. more versatile than chunky wrt scaling back colors, however, the point is
  20. moot on everything except the Amiga's chip set.
  21.  
  22. > >I still, however, don't understand why
  23. > >you are using scaling like it's the next best thing since the Amiga, you
  24. > >are operating under reduced capacity.
  25. > Because often you don't need full capacity. Using screens with different
  26. > resolutions is one solution to the problem. Having layers that simply
  27. > leave bitplanes untouched is another solution.
  28. > A very popular example for this is a text window on top of a coloured
  29. > background.
  30. > >(inner loop)
  31. > > x'=x * (1/xscale)
  32. > > y'=y * (1/yscale)    ;which does scaling
  33. > > getpixel(x',y'): putpixel(x,y)
  34. > Well, this isn't really scaling (which would need to calculate new
  35. > pixel values, f.e. with a linear filter).
  36.  
  37. It sure acts like scaling.
  38.  
  39. > However, you wouldn't use
  40. > this algorithm in the form given as you want to avoid multiplications
  41. > and divisions.
  42.  
  43. This is a *general purpose* scaling algorithm.  It uses no predefined
  44. tables.  All the multiplication is done within the central loop (instead of
  45. beforehand to set up the tables).  Either of these cases require a
  46. double-multiplication for each pixel in the destination image.  You can
  47. scale independently in the X and Y directions, say, in our example we would
  48. have xscale=2 and yscale=2.
  49.  
  50. > > xrot=cos(theta)/xscale
  51. > > yrot=sin(theta)/yscale
  52. > >(inner loop)
  53. > > x'=x * xrot
  54. > > y'=y * yrot    ;which will do your scaling and rotation in one fell swoop. 
  55. > > getpixel(x',y'): putpixel(x,y)
  56. > >The key to why chunky is so much faster lies in the last getpixel/putpixel
  57. > >pair.
  58. > Both examples use very expensive operations for each pixel. The rendering
  59. > is only a small fraction and splitting a pixel value into bits is only
  60. > a small part of the rendering operation.
  61.  
  62. The rendering is a small fraction on the chunky system, however getpixel()
  63. and putpixel() on a planar system may even take *more* time than the
  64. multiplications due to the time needed to ([shift/mask/extract]x8) then
  65. ([shift/mask/insert]x8) do those operations in planar.
  66.  
  67. > >I've put up an algorithm that clearly shows why chunky is ridiculously
  68. > >faster, using a general purpose algorithm that can scale/magnify/rotate any
  69. > >image to any degree (no sanity checks :).  You're welcome to continue to
  70. > >argue, but I really think that for all intents and purposes I've proven my
  71. > >point.
  72. > Can't see that. You get to the point where you use single writepixel
  73. > and readpixel operations where you don't need that just because this
  74. > is the optimal case of chunky and the worst case of bitplanes.
  75.  
  76. It's a general purpose algorithm that will scale/rotate bitmapped images.
  77. It suffers no limitations unlike your precalculated table.
  78.  
  79. > And you
  80. > simply 'forget' that your calculations take more time than the pixel
  81. > operations.
  82.  
  83. I can assure you that on a chunky display, that will be the case.  On a
  84. planar display, that is a different story entirely.
  85.  
  86. > >OK, ok, take your depth scaling.  Your welcome.  As I said before, if you
  87. > >want to cut down to 128 colors, why not just go to 16?  Chunky would be
  88. > >faster THEN.
  89. > 16 might be to small, and 16 color chunky is still quite slow as no
  90. > processor used will support nibble operations. Most advantages of chunky
  91. > displays come from the fact that the processor explicitely supports
  92. > operations on a 'chunk' (8 bits in most cases).
  93.  
  94. Notice how **NO** processors support parallel operations on several
  95. arbitrary bits at different memory locations.  Even if there were there
  96. would still be overhead due to the extra data accessed that wasn't even
  97. considered.
  98.  
  99. > >Your correct, the _ratio_ is still the same, but the _amount of time_
  100. > >wasted goes up incrementally, 2x, 4x, 8x etc.
  101. > Can't follow your argument here.
  102.  
  103. Suppose you have a blit that takes 20ms on chunky and 30ms on planar
  104. (planar is accessing 1/3 more data than neccessary) on a 256 color display.
  105. Jump up the pixel depth to true-color (32-bit), and you're suddenly wasting
  106. 4x as much time, since now it's taking 80ms on chunky and 120ms on planar.
  107. Still in a 2:3 ratio, but your time wasted has jumped from 10ms to 40ms.
  108.  
  109. > Regards,
  110. > -- 
  111. > Michael van Elst
  112. > UUCP:     universe!local-cluster!milky-way!sol!earth!uunet!unido!mpirbn!p554mve
  113. > Internet: p554mve@mpirbn.mpifr-bonn.mpg.de
  114. >                                 "A potential Snark may lurk in every tree."
  115.  
  116. Glenn Doiron
  117. -- 
  118. Amiga UUCP+
  119. Origin:  uunet.uu.net!starpt.UUCP!doiron (Organization:68K Software Development)
  120.          BIX: gdoiron
  121. ** Not enough memory to perform requested operation.  Add 4 megs and retry.
  122.