free.c 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. /*******************************************************************************
  2. License:
  3. This software and/or related materials was developed at the National Institute
  4. of Standards and Technology (NIST) by employees of the Federal Government
  5. in the course of their official duties. Pursuant to title 17 Section 105
  6. of the United States Code, this software is not subject to copyright
  7. protection and is in the public domain.
  8. This software and/or related materials have been determined to be not subject
  9. to the EAR (see Part 734.3 of the EAR for exact details) because it is
  10. a publicly available technology and software, and is freely distributed
  11. to any interested party with no licensing requirements. Therefore, it is
  12. permissible to distribute this software as a free download from the internet.
  13. Disclaimer:
  14. This software and/or related materials was developed to promote biometric
  15. standards and biometric technology testing for the Federal Government
  16. in accordance with the USA PATRIOT Act and the Enhanced Border Security
  17. and Visa Entry Reform Act. Specific hardware and software products identified
  18. in this software were used in order to perform the software development.
  19. In no case does such identification imply recommendation or endorsement
  20. by the National Institute of Standards and Technology, nor does it imply that
  21. the products and equipment identified are necessarily the best available
  22. for the purpose.
  23. This software and/or related materials are provided "AS-IS" without warranty
  24. of any kind including NO WARRANTY OF PERFORMANCE, MERCHANTABILITY,
  25. NO WARRANTY OF NON-INFRINGEMENT OF ANY 3RD PARTY INTELLECTUAL PROPERTY
  26. or FITNESS FOR A PARTICULAR PURPOSE or for any purpose whatsoever, for the
  27. licensed product, however used. In no event shall NIST be liable for any
  28. damages and/or costs, including but not limited to incidental or consequential
  29. damages of any kind, including economic damage or injury to property and lost
  30. profits, regardless of whether NIST shall be advised, have reason to know,
  31. or in fact shall know of the possibility.
  32. By using this software, you agree to bear all risk relating to quality,
  33. use and performance of the software and/or related materials. You agree
  34. to hold the Government harmless from any claim arising from your use
  35. of the software.
  36. *******************************************************************************/
  37. /***********************************************************************
  38. LIBRARY: LFS - NIST Latent Fingerprint System
  39. FILE: FREE.C
  40. AUTHOR: Michael D. Garris
  41. DATE: 03/16/1999
  42. Contains routines responsible for deallocating
  43. memories required by the NIST Latent Fingerprint System (LFS).
  44. ***********************************************************************
  45. ROUTINES:
  46. free_dir2rad()
  47. free_dftwaves()
  48. free_rotgrids()
  49. free_dir_powers()
  50. ***********************************************************************/
  51. #include <stdio.h>
  52. #include <stdlib.h>
  53. #include "lfs.h"
  54. /*************************************************************************
  55. **************************************************************************
  56. #cat: free_dir2rad - Deallocates memory associated with a DIR2RAD structure
  57. Input:
  58. dir2rad - pointer to memory to be freed
  59. *************************************************************************/
  60. void free_dir2rad(DIR2RAD *dir2rad)
  61. {
  62. free(dir2rad->cos);
  63. free(dir2rad->sin);
  64. free(dir2rad);
  65. }
  66. /*************************************************************************
  67. **************************************************************************
  68. #cat: free_dftwaves - Deallocates the memory associated with a DFTWAVES
  69. #cat: structure
  70. Input:
  71. dftwaves - pointer to memory to be freed
  72. **************************************************************************/
  73. void free_dftwaves(DFTWAVES *dftwaves)
  74. {
  75. int i;
  76. for(i = 0; i < dftwaves->nwaves; i++){
  77. free(dftwaves->waves[i]->cos);
  78. free(dftwaves->waves[i]->sin);
  79. free(dftwaves->waves[i]);
  80. }
  81. free(dftwaves->waves);
  82. free(dftwaves);
  83. }
  84. /*************************************************************************
  85. **************************************************************************
  86. #cat: free_rotgrids - Deallocates the memory associated with a ROTGRIDS
  87. #cat: structure
  88. Input:
  89. rotgrids - pointer to memory to be freed
  90. **************************************************************************/
  91. void free_rotgrids(ROTGRIDS *rotgrids)
  92. {
  93. int i;
  94. for(i = 0; i < rotgrids->ngrids; i++)
  95. free(rotgrids->grids[i]);
  96. free(rotgrids->grids);
  97. free(rotgrids);
  98. }
  99. /*************************************************************************
  100. **************************************************************************
  101. #cat: free_dir_powers - Deallocate memory associated with DFT power vectors
  102. Input:
  103. powers - vectors of DFT power values (N Waves X M Directions)
  104. nwaves - number of DFT wave forms used
  105. **************************************************************************/
  106. void free_dir_powers(double **powers, const int nwaves)
  107. {
  108. int w;
  109. for(w = 0; w < nwaves; w++)
  110. free(powers[w]);
  111. free(powers);
  112. }