home *** CD-ROM | disk | FTP | other *** search
/ Really Useful CD 1 / ReallyUsefulCD1.iso / extras / graphics / _greyedit / docs / swis < prev    next >
Encoding:
Text File  |  1991-04-22  |  8.2 KB  |  212 lines

  1. >SWIs
  2.  
  3. ----------------------
  4. - The GreyEdit SWI's -
  5. ----------------------
  6. The GreyEdit module contains several SWI's, which are used by the main
  7. program, !RunImage.
  8.  
  9. Because they may be useful in other programs, all the SWI's contained in
  10. this module are discussed in detail below. They are divided into two groups.
  11.  
  12. The image processing SWI's may be useful to any kind of user.
  13.  
  14. The digitiser SWI's may be useful to users that wish to make their own
  15. digitizing applications using the Zeridajh Video Digitiser.
  16.  
  17.  
  18. - The image processing SWI's
  19.  
  20. These SWI's all process or perform computations on an entire image.
  21.  
  22. Images consist of byte-values, i.e. 0(black)-255(white), that represent the
  23. pixels' greyvalues.
  24.  
  25. All image-processing SWI's expect a pointer to an image info block in r0.
  26. This block contains information about the image to be acted upon :
  27.  
  28. Offset Name  Meaning
  29. ------ ----  -------------------------------
  30.      0 start pointer to start of image data
  31.      4 xpix  horizontal resolution in pixels
  32.      8 ypix  vertical resolution in pixels
  33.     12 xskip pixels to skip at end of rows
  34.  
  35. The xskip value enables the image to be actually stored as a sprite. For
  36. example, if start=&20000, xpix=637, ypix=512, and xskip=3, then the image
  37. has the following structure :
  38.  
  39. &20000 : <637 bytes of image data> <3 bytes alignment, ignored>, i.e. row 1
  40. &20280 :  ""                        ""                         , i.e. row 2
  41. &20500 :  ""                        ""                         , i.e. row 3
  42.  .....
  43. &6FD80 :  ""                        ""                         , i.e. row 512
  44.  
  45. Thus, dis-alignment within the sprite presents no problems, as long as start
  46. points to the first valid pixel, and xskip is set to the total row-wastage.
  47.  
  48. SWI GreyEdit_Map
  49. ----------------
  50. Maps the image's pixel values.
  51.  
  52. On entry - r0 points to image info block (start/xpix/ypix/xskip)
  53.          - r1 points to 256-entry pixel value map
  54.  
  55. I.e. for all pixels, new_pixel_value = r1?old_pixel_value
  56.  
  57. SWI GreyEdit_Cut
  58. ----------------
  59. Cuts down an image.
  60.  
  61. On entry - r0 points to image info block (start/xpix/ypix/xskip)
  62.          - r1 points to cut info block (start/left/top/right/bottom/xskip)
  63.  
  64. The word-values in the cut info block determine the new (smaller) size and
  65. structure of the image. The new image is a sub-image of the old image, and
  66. is defined by the coordinates of its top left corner and its bottom right
  67. corner within the old image. It is stored at the address contained in the
  68. start value of the cut info block.
  69.  
  70. The xskip given in the cut info block is the xskip value of the new image.
  71. The skipped pixels in the new image are all set to 0. The left value may range
  72. from 0 to xpix-1, the right value from left to xpix-1, the top value from 0
  73. to ypix-1, and the bottom value from top to ypix-1.
  74.  
  75. The cut info is not checked in any way, so it is your responsibility to
  76. supply sensible values.
  77.  
  78. The x/y size of the new image will obviously be right-left-1/bottom-top-1.
  79.  
  80. SWI GreyEdit_Filter
  81. -------------------
  82. Applies a filter algorithm to an image. For details on the algorithms refer
  83. to 'Technical details' in Docs.Guide.
  84.  
  85. On entry - r0 points to image info block (start/xpix/ypix/xskip)
  86.          - r1 indicates the filter to be applied
  87.             1 - Noise (weak)
  88.             2 - Noise (strong)
  89.             3 - Gauss
  90.             4 - Average
  91.             5 - Laplace
  92.             6 - X-gradient Sobel
  93.             7 - Y-gradient Sobel
  94.             8 - Maximum
  95.             9 - Minimum
  96.  
  97. SWI GreyEdit_Frequency
  98. ----------------------
  99. Calculates the frequencies of greyvalues in an image.
  100.  
  101. On entry - r0 points to image info block (start/xpix/ypix/xskip)
  102. On exit  - r0 points to frequency table (4-byte counters)
  103.  
  104. I.e. the number of occurences of greyvalue g is r0!(g<<2).
  105.  
  106. SWI GreyEdit_Equalize
  107. ---------------------
  108. Applies the histogram equalization algorithm to an image.
  109.  
  110. On entry - r0 points to image info block (start/xpix/ypix/xskip)
  111. On exit  - r0 points to cumulative histogram table (4-byte counters)
  112.          - r1 points to equalization greyvalue map
  113.  
  114. To equalize the image, this SWI should be followed by GreyEdit_Map, using
  115. the map returned at r1. The g'th entry in the cumulative histogram table
  116. represents the added frequencies of the greyvales from 0-g, i.e. the 255th
  117. entry is always equal to the total number of pixels in the image, xpix*ypix.
  118.  
  119.  
  120. - The digitiser SWI's
  121.  
  122. These SWI's all drive the Zeridajh Video Digitiser podule. When it is not
  123. present (see GreyEdit_CheckDigi), they should not be called.
  124.  
  125. SWI GreyEdit_CheckDigi
  126. ----------------------
  127. Checks presence of the Zeridajh Video Digitiser podule, and initialises usage
  128. of the other digitiser SWI's if it is. Thus, it should always be the first SWI
  129. called.
  130.  
  131. On entry - r0 contains podule's ID code
  132. On exit  - r0 contains podule's base address if it is present, else 0
  133.  
  134. SWI GreyEdit_Grab
  135. -----------------
  136. Digitises a video image.
  137.  
  138. On entry - r0 points to image data buffer
  139.          - r1 contains size of image data buffer
  140.          - r2 contains required horizontal resolution in pixels
  141.          - r3 contains required vertical resolution in pixels
  142.          - r4<>0 gives 'line skip' (scanlines skipped at top of video image),
  143.            else default of 20 is taken (approx. center of video image)
  144.          - r5<>0 gives lowest delay factor, else default of 200 is taken.
  145.            DO NOT CHANGE, I.E. USE 0.
  146.          - r6 contains flags
  147.               bit 0 - when set (1) prevents video DMA disable when grabbing
  148.               bit 1 - when set (1) prevents re-enable of video DMA on ok exit
  149. On exit  - r0 points to error block (V set) if error occured
  150.  
  151. This SWI digitizes a video image, storing it in the supplied image data buffer.
  152. The range of available resolutions is restricted to 5*xfac/1*yfac for x/y
  153. respectively, where xfac/yfac is a power of 2, up to 640x512. When r2/r3 lies
  154. outside this range, the value is rounded up to the nearest available value.
  155. I.e. 160x128 is a valid resolution, but 161x128 would be rounded up to 320x128.
  156.  
  157. When the image buffer is too small to contain the image, an error is returned.
  158.  
  159. The value of r4 determines the number of scanlines that are skipped at the
  160. top of the video image. When a value of 0 is given, the default of 20 is taken,
  161. which skips approximately the same number of lines at the top and bottom of
  162. the video image (i.e. the 'center' is taken).
  163.  
  164. The value of r5 should always be 0. The delay factor plays an important role
  165. in the digitizing process, so it should not be tampered with. It is only
  166. present for (future) development purposes.
  167.  
  168. Video DMA is usually disabled when grabbing, and re-enabled on exit. Both
  169. of these 'effects' can be switched off by setting the appropiate bits in r6.
  170. Setting bit 0 may cause the image to be distorted, when the processing delays
  171. introduced by video DMA prevents the software to keep its synchronization
  172. with the video image.
  173.  
  174. SWI GreyEdit_VideoDMA
  175. ---------------------
  176. Turns video DMA on/off.
  177.  
  178. On entry - r0 contains 0 to turn video DMA off, or 1 to turn it on.
  179.  
  180. SWI GreyEdit_VideoTiming
  181. ------------------------
  182. Returns a number of values representing the vsync and hsync signals present
  183. in the video image. Also returns a rough classification of the video signal
  184. based on the vsync and hsync signals.
  185.  
  186. The values are returned in a signal buffer. They are bit values (0/1), which
  187. represent the exclusive OR of (NOT Burst,Vsync) from the LM1881 on the podule.
  188. The bit-values are packed 8 at a time in bytes (bit 0 first). The entire buffer
  189. is filled. Video DMA is disabled temporarily.
  190.  
  191. On entry - r0 points to signal buffer
  192.          - r1 contains length of signal buffer in bytes
  193. On exit  - r2 gives a video signal type code
  194.            -1 = no video signal detected
  195.             0 = normal video signal
  196.             1 = MacroVision protected video tape signal
  197.  
  198. SWI GreyEdit_Sensitivity
  199. ------------------------
  200. Sets the podule's video signal sensitivity. This only works if the PCF8591
  201. chip is present on the podule.
  202.  
  203. On entry - r0 contains sensitivity value and flags
  204.               bit 0-7 : sensitivity value
  205.               bit 8 : if set (1) value is percentage (0(low)-100(high))
  206.                       if clear (0) value is 0(high)-255(low)
  207. On exit  - r0 contains -1 if the PCF8591 is not present, else 0
  208.  
  209. Where 'low' is lowest sensitivity ('dark' images), and 'high' highest
  210. sensitivity ('light' images).
  211.  
  212.