home *** CD-ROM | disk | FTP | other *** search
/ Media Share 13 / mediashare_13.zip / mediashare_13 / ZIPPED / PROGRAM / APR94_4.ZIP / WPKTDEMO.DOC < prev    next >
Text File  |  1994-03-07  |  19KB  |  372 lines

  1.                           Documentation for WPKTDEMO.EXE
  2.                   (Wavelet Packet Transform Demonstration Program)
  3.  
  4.                                        by
  5.  
  6.                                    Mac A. Cody
  7.  
  8. INTRODUCTION
  9.  
  10.   The program WPKTDEMO.EXE is a demonstration of the wavelet packet transform as 
  11. described in my article "The Wavelet Packet Transform" which appeared in the
  12. April, 1994 issue of Dr. Dobb's Journal.  The following files are included:
  13.  
  14. WPKTDEMO.EXE - The wavelet packet transform demonstration program.
  15. WPKTDEMO.DOC - The file you are reading.
  16. CHIRP.DAT - Signal data file of a sine chirp function.
  17. CHIRP1.COF - Wavelet packet transform coefficient file for the chirp function.
  18.              Subband basis of the entire binary tree.
  19. CHIRP2.COF - Wavelet packet transform coefficient file for the chirp function.
  20.              Wavelet basis of the entire binary tree.
  21. CHIRP2.COF - Wavelet packet transform coefficient file for the chirp function.
  22.              An arbitrary basis which localizes on higher frequency subbands.
  23. CVESA41.ZIP - Archive of Kendall Bennett's Universal VESA VBE driver TSR,
  24.               Version 4.1 (requires PKUNZIP 2.0 or greater to unzip).
  25.  
  26.   The program will run on any IBM PC-compatible computer with an 80286 (or
  27. greater) processor. A Super VGA graphics card and monitor are also required.  
  28. The graphics card must be capable of supporting VESA* Video BIOS Extension
  29. (VBE*) 1.0 (or greater) and VBE mode 0x104 (1024 x 768, 16 colors).
  30.  
  31.   Most Super VGA graphics cards already have support for VESA VBE, either
  32. through the ROM BIOS on the graphics card or via a driver TSR.  To determine if
  33. your graphics card supports VESA VBE, run WPKTDEMO at the DOS prompt.  If your
  34. graphics card does not have support for VESA VBE, the following message will be
  35. displayed:
  36.  
  37.                     "No VESA support with this display card".
  38.  
  39. Check the documentation which comes with your graphics card to see if a TSR
  40. driver is available.  Also, contact the manufacturer of the graphics card.
  41.  
  42.   Even if there is a VESA VBE driver with your graphics card, WPKTDEMO may still
  43. not run.  If there is insufficient memory available for mode 0x104 (or if the
  44. mode is not supported by the driver the following message will be displayed:
  45.  
  46.                     "Requested VESA mode is not available".
  47.  
  48. Check your documentation to see if you can install additional video memory (512
  49. kbytes are required, usually, to support mode 0x104) or contact the manufacturer
  50. for an updated VESA BIOS or driver.
  51.  
  52.   As an immediate (if temporary) solution, I have enclosed a copy of Kendall
  53. Bennett's Universal VESA VBE driver TSR, Version 4.1 to allow you to get up and
  54. running.  I MAKE NO GUARANTEE OF THE SUITABILITY OF THIS DRIVER WITH YOUR
  55. GRAPHICS CARD AND I WILL NOT BE HELD RESPONSIBLE FOR ANY DAMAGES RESULTING FROM
  56. THE USE OF HIS DRIVER (or my program for that matter).  Installation
  57. instructions for the driver are included with the driver in archive.
  58.  
  59.  
  60. USING WPKTDEMO
  61.  
  62.   Once WPKTDEMO is loaded correctly, the screen should display a signal in the
  63. brown region.  The signal is a "chirp", i.e., a sinewave with increasing
  64. frequency over time.  The signal is generated within the program itself.  Below
  65. the signal is four rows of alternating dark and light gray bands.  These rows
  66. represent redundant approximation (dark gray) and detail (light gray) data.  The 
  67. data display in these bands are intermediate results in the calculation of the
  68. wavelet packet basis.  Below the redundant data levels is a single row of
  69. alternating green and cyan bands.  These rows represent the approximation
  70. (green) and detail (cyan) coefficients of the wavelet packet basis.  The initial
  71. disjoint cover represented is a fifth-level subband basis.  The full binary tree
  72. is displayed.  No transform has been calculated, so all values are zeroed.
  73.  
  74.   Along the left-hand side of the wavelet packet display are labels indicating
  75. the levels of the wavelet packet transform (4 through 0).  Each level represents
  76. a different level of scale.  Each level is one half the resolution of the level
  77. above and twice the resolution of the level below.  The numbers between each
  78. pair of dark gray/light gray and green/cyan bands indicate the basis function
  79. pairs (or subband pairs) in the binary tree.
  80.  
  81.   Below the signal and wavelet packet displays is the menu entry field used to
  82. control the program.  Starting on the left-hand side of the menu and working
  83. down and to the right is displayed the following items:
  84.  
  85. Signal File - Name of the signal file to load or save.  The string entered in the field should follow standard DOS file path and file name conventions.  The entry is not case sensitive.  The format for the file is as follows:
  86.  
  87. 1024                  (Integer value indicating number of samples in file.)
  88.  0.0000000000000e+00
  89.  1.5707632441631e-04
  90.  6.2830514264364e-04  (Sample values in floating point format.)
  91.  1.4136850594884e-03
  92.  2.5132106492058e-03
  93.          .
  94.          .
  95.          .
  96.          .
  97.  
  98. Transform File - Name of the wavelet packet transform coefficient file to load
  99. or save.  The string entered in the field should follow standard DOS file path
  100. and file name conventions.  The entry is not case sensitive.  The format for the
  101. file is as follows:
  102.  
  103.             (Integer values indicating number of samples in original signal
  104. 1024   5     and the number of levels in the transform [always 5].)
  105.  0.0000000000000e+00    0.0000000000000e+00    (Values of alpha and beta.)
  106. T
  107. T         (Thirty-one text characters indicating the states of thirty-one
  108. T          nodes representing the subband pairs of the wavelet packet
  109. .          transform binary tree.  'T' indicates an active subband pair,
  110. .          while 'F' indicates an inactive subband pair.  Active subband pairs
  111. .          are used in calculating the wavelet packet basis represented by the
  112. F          disjoint cover.)
  113. F
  114. T
  115. -0.0000000000000e+00
  116.  5.3722339838268e-06  (Coefficients of the wavelet packet transform for the
  117. -1.9663178747461e-06   given basis including the undisplayed terminating
  118. -5.8379489037445e-05   coefficients of the convolutions at the end of each
  119.  2.1475008461388e-04   subband.  No redundant data is stored in the file.)
  120.          .
  121.          .
  122.          .
  123.          .
  124.  
  125. Pollen Parameterization - This method for generating orthogonal wavelet filter
  126. coefficients was presented in my first article (see bibliography in the wavelet
  127. packet article).  The parameterization values are entered in the fields below:
  128.   Alpha - The current value of alpha  (-pi <= alpha < pi).
  129.   Beta - The current value of beta  (-pi <= alpha < pi).
  130.  
  131. Coefficients - The wavelet filter coefficients generated from the values of
  132. alpha and beta.  Two, four, or six coefficients will be generated depending upon
  133. the values of alpha and beta.
  134.  
  135. Basis Function Pair - The quadriture mirror filter (QMF) pairs of the transform
  136. generate adjacent frequency subbands at each level in the binary tree.  Each QMF
  137. pair also represents a basis function pair for each level at each 'node' in the
  138. binary tree.  These functions are recursively defined according to the
  139. application of the scaling and wavelet functions while working from the top of
  140. the tree down through the particular QMF pair.  The values are entered in the
  141. fields below:
  142.   Level - The level of the basis function pair in the binary tree.
  143.   Subband - The selected subband pair at the given level in the binary tree.
  144.   Active - A value of 'T' indicates an active subband pair, while 'F' indicates
  145.            an inactive subband pair.  Active subband pairs are used in
  146.            calculating the wavelet packet basis represented by the disjoint
  147.            cover.  An inactive pairs is set to black and are not in use.  Active
  148.            pairs are displayed and are set to a color according to whether they
  149.            are part of the disjoint cover (green or cyan) or redundant data
  150.            (dark orlight gray) used in the calculation of the wavelet packet
  151.            coefficients in the disjoint cover
  152.  
  153.   The two function displays on the right-hand side of the menu field represent
  154. the recursively defined basis functions for the selected subband pair.  For
  155. example, if level 0 and subband 0 were selected, the functions would represent
  156. the scaling function (green) and wavelet function (cyan) used in the fast
  157. wavelet transform.  
  158.  
  159.   The blue help screen displayed in the middle of the screen lists the available
  160. operations in the program.  Note that the caret (^) represents holding down the
  161. control key on the keyboard while pressing the appropriate function key.
  162.  
  163. F1: Display Help List - Displays the list of available functions.
  164.  
  165. F2: Load signal data file - Loads the file listed in the Signal File field.  If
  166. the file is not found or cannot be opened a beep will sound. 
  167.  
  168. ^F2: Save signal data file - Saves the file listed in the Signal File field.  If
  169. the cannot be opened a beep will sound.  No warning is given if the file already
  170. exists.
  171.  
  172. F3: Load transform coefficient file - Loads the file listed in the Transform
  173. File field.  If the file is not found or cannot be opened a beep will sound.
  174.  
  175. ^F3: Save transform coefficient file - Saves the file listed in the Transform
  176. File field.  If the file cannot be opened a beep will sound.  No warning is
  177. given if the file already exists.
  178.  
  179. F4: Decompose signal - Generate the wavelet packet transform coefficients in the
  180. disjoint cover from the signal and the decomposition wavelet filters.
  181.  
  182. ^F4: Reconstruct signal - Reconstruct the signal from the wavelet packet
  183. transform coefficients in the disjoint cover and the reconstruction wavelet
  184. filters.
  185.  
  186. F5: Zero approximation coefficients selected - Sets the data values in the
  187. approximation half of the selected subband pair to zero.  Useful when analyzing
  188. which coefficients are significant to the perfect reconstruction of the original
  189. signal.
  190.  
  191. ^F5: Zero detail coefficients selected - As above but for the detail half of the
  192. selected subband pair.
  193.  
  194. F6: Zero all redundant coefficients - Used to show that only the wavelet packet
  195. transform coefficients in the disjoint cover are needed to reconstruct the
  196. original signal.
  197.  
  198. F7: Restore binary tree structure - Makes all basis function (subband) pairs
  199. active.  This is faster than manually activating them.
  200.  
  201. F10: Program exit - Return to the DOS prompt.  No prompt is made for saving any
  202. data generated.
  203.  
  204.  
  205.   Feel free to experiment with the program!  The disjoint cover can be free
  206. modified to create alternate wavelet packet bases.  Try different wavelet
  207. filters to correlate with the signal or concentrate the signal energy at lower
  208. frequency bands.  The following table presents a list of Pollen parameters for
  209. 'interesting' wavelets:
  210.  
  211.     |---------------------------------------------------------------|
  212.     |       Wavelet            |      Alpha      |       Beta       |
  213.     |--------------------------+-----------------+------------------|
  214.     |         Harr             |       0.0*      |        0.0*      |
  215.     | Daubechies 4-coefficient |   1.047179551   |        0.0       |
  216.     | Daubechies 6-coefficient |   1.359803732   |   -0.782106385   |
  217.     |         Hat              |   1.125930376   |    0.375465743   |
  218.     |         City             |   2.713208667   |   -1.992853802   |
  219.     |         Wall             |   1.952966255   |   -1.443386598   |
  220.     |       Car Alarm          |       0.0       |   -3.141592654   |
  221.     |---------------------------------------------------------------|
  222.      *Any value is acceptable as long as Alpha = Beta.
  223.  
  224.  
  225. WHERE'S THE SOURCE CODE!? (or the shameless plug!)
  226.  
  227.   Unlike my previous articles, I have not provided source code listings to the
  228. demo program beyond the wavelet packet transform routines themselves.  This is 
  229. ecause the demo program is written using a wavelet software library I am
  230. developing.  The library is called Tsunami Plus.  This name was chosen because
  231. "tsunami" means, in Japanese, a tidal wave usually caused by an earthquake.  The
  232. wavelet transform "surged" onto the scene in the last six years and has
  233. generated a great deal of interest in the mathematics and engineering
  234. communities.  The "plus" indicates that the library is more than just a
  235. collection of wavelet transform routines.
  236.  
  237.   The library contains routines which implement various forward and inverse
  238. wavelet transforms, such as block-mode transforms, recursive transforms
  239. (oriented towards real time processing), and two-dimensional fast wavelet
  240. transforms for image processing applications.  Support routines are provided to
  241. allow the programmer to quickly develop DOS applications with the VESA* VBE*
  242. graphics standard (Tsunami Plus is VESA VBE 1.0, 1.1, and 1.2 compatible) and
  243. XMS support.  Not only can wavelet transforms be executed; their input
  244. parameters can be modified and displayed with a menuing system and the data can
  245. be displayed in various formats.  The library also contains support routines for
  246. the management and display of transform data and the design and verification of
  247. orthonormal wavelet coefficients.  The library is written in Standard 'C' and
  248. 80X86-specific code (80286 and greater) is confined to the display functions.
  249.  
  250.   Tsunanami Plus will be shipped as source code only, except for 80X86 DOS
  251. executables of the demo programs.  Instructions will be provided for compiling
  252. the code with various compilers.  Documentation for the various routines in the
  253. library, the demo programs, and tutorial materials will also be provided.
  254. Availability and price will be announced at a later date in 1994.
  255.  
  256.   Below is a partial list of the routines that will be in Tsunami Plus (note
  257. that this is a preliminary list and its content may change):
  258.  
  259. FAST WAVELET TRANSFORM ROUTINES
  260.  
  261. MakeFWTstruct - Create a FWT data structure on the heap.
  262. DestroyFWTstruct - Remove a FWT data structure from the heap.
  263. PFWT - Periodic Fast Wavelet Transform routine.
  264. IPFWT - Inverse periodic Fast Wavelet Transform routine.
  265. AFWT - Aperiodic Fast Wavelet Transform routine.
  266. IAFWT - Inverse aperiodic Fast Wavelet Transform routine.
  267. RecursiveFWT - Recursive Fast Wavelet Transform routine.
  268.  
  269.  
  270. WAVELET PACKET TRANSFORM ROUTINES
  271.  
  272. MakeWPTstruct - Create a WPT data structure on the heap.
  273. DestroyWPTstruct - Remove a WPT data structure from the heap.
  274. MakeCoverStruct - Create a disjoint cover management structure on the heap.
  275. DestroyCoverStruct - Remove a disjoint cover management structure from the heap.
  276. SetCoverNode - Set/clear a node on the disjoint cover management structure.
  277. PWPT - Periodic Wavelet Packet Transform routine.
  278. IPWPT - Inverse periodic Wavelet Packet Transform routine.
  279. AWPT - Aperiodic Wavelet Packet Transform routine.
  280. IAWPT - Inverse aperiodic Wavelet Packet Transform routine.
  281. RecursiveWPT - Recursive Wavelet Packet Transform routine.
  282.  
  283.  
  284. TWO-DIMENSIONAL FAST WAVELET TRANSFORM ROUTINES
  285.  
  286. Make2DFWTstruct - Create a two-dimensional FWT data structure on the heap.
  287. Destroy2DFWTstruct - Remove a two-dimensional FWT data structure from the heap.
  288. 2D_FWT - Two-dimensional Fast Wavelet Transform routine.
  289. I2D_FWT - Inverse Two-dimensional Fast Wavelet Transform routine.
  290.  
  291.  
  292. WAVELET FILTER CREATION, CONVERSION, AND SUPPORT ROUTINES
  293.  
  294. DilationCoeffs - Generate orthogonal wavelet filter coefficients from the
  295.                  TeKolste parameterization angles.
  296. AngularCoeffs - Generate TeKolste parameterization angles from the orthogonal
  297.                 wavelet filter coefficients.
  298. PollenToTeKolste - Convert Pollen parameterization angles to TeKolste
  299.                    parmeterization angles.
  300. TeKolsteToPollen - Convert TeKolste parameterization angles to Pollen
  301.                    parmeterization angles.
  302. CheckAngles - Validate TeKolste parmeterization angles.
  303. CheckCoeffs - Validate orthogonal wavelet filter coefficients.
  304. MakeWaveletFilters - Generate wavelet quadriture mirror filter (QMF) pairs.
  305.                      from wavelet filter coefficients.
  306. CascadePhiAndPsi - Generate recursively-defined scaling and wavelet functions. 
  307.  
  308.  
  309. EXTENDED MEMORY MANAGEMENT ROUTINES (support for the 2D FWT routines)
  310.  
  311. InitXMS - Initialize access to the XMS driver.
  312. XMSversion - Retrieve the XMS driver version number.
  313. QueryFreeXMSmem - Determine amount of free XMS memory.
  314. AllocateXMSblock - Allocate an XMS block.
  315. FreeXMSblock - Free an XMS block.
  316. MoveXMSblock - Move an XMS block.
  317. LockXMSblock - Lock an XMS block.
  318. UnlockXMSblock - Unlock an XMS block.
  319. GetXMShandleInfo - Get information on a handle to an XMS block.
  320. ReallocateXMSblock - Reallocate an XMS block.
  321. RequestUMBblock - Request an upper memory block.
  322. ReleaseUMBblock - Release an upper memory block.
  323. ReallocateUMBblock - Reallocate an upper memory block.
  324.  
  325.  
  326. VESA VBE GRAPHICS SUPPORT ROUTINES
  327.  
  328. InitVESAgraphMode - Initializes selected VESA VBE graphics mode.
  329. InitCharSets - Initializes text characters display capability.
  330. SelectCharSet - Select character set for future text output to display.
  331. GetCharSet - Get current character set in use.
  332. ReadDACregs - Get current VGA DAC register values.
  333. WriteDACregs - Set new VGA DAC register values.
  334. SetDrawColor - Set new color for future drawing.
  335. SetCharColor - Set new color for future character output.
  336. SetDACwidth - Set new effective width of DAC registers (requires VESA VBE 1.2
  337.               compatible BIOS which supports change of DAC width).
  338. GetDrawColor - Get current drawing color in use.
  339. GetCharColor - Get current character color in use.
  340. GetDACwidth - Get current effective width of DAC registers (requires VESA VBE
  341.               1.2 compatible BIOS which supports change of DAC width).
  342. DrawChar - Draw a character on the display.
  343. DrawStr - Draw a string of characters on the display.
  344. BlockToScreen - Place image block on the display.
  345. RowToScreen - Place array of image data on the display.
  346. DrawRectangle - Draw rectangle on the display.
  347. DrawWaveform - Draw waveform on the display.
  348.  
  349.  
  350. OFF-SCREEN IMAGE GENERATION ROUTINES
  351.  
  352. ShiftImageBlock - Shift image in data block.
  353. CopyImageBlock - Copy image in data block to another data block.
  354. WaveformImageBlock - Draw waveform image in a data block.
  355. ScaleogramImageBlock - Draw wavelet scaleogram image in a data block.
  356. GrayscaleImageBlock - Draw gray scale data in a data block.
  357. DataSetMagnitude - Calculate maximum magnitude of data in an array.
  358.  
  359.  
  360. BASIC MENUING SYSTEM ROUTINES FOR VESA VBE GRAPHICS MODES
  361.  
  362. DrawMenuField - Place new character data in menu field.
  363. DrawGenericMenu - Draw user-defined menu on the display.
  364. ProcessGenericMenu - Process context-sensitive character entry in menu.
  365. IntEntryProc - Process integer-valued data entry in menu field.
  366. RealEntryProc - Process real-valued data entry in menu field.
  367. CharEntryProc - Process character string entry in menu field.
  368.  
  369.  
  370. *VESA is a registered trademark of the Video Electronics Standards Association.  
  371. VBE is a trademark of the Video Electronics Standards Association.
  372.