/ocr/ocrservice/jni/hydrogen/include/leptonica/array.h

http://eyes-free.googlecode.com/ · C Header · 107 lines · 49 code · 21 blank · 37 comment · 0 complexity · cca3e2d2688b625776828e6956ed6733 MD5 · raw file

  1. /*====================================================================*
  2. - Copyright (C) 2001 Leptonica. All rights reserved.
  3. - This software is distributed in the hope that it will be
  4. - useful, but with NO WARRANTY OF ANY KIND.
  5. - No author or distributor accepts responsibility to anyone for the
  6. - consequences of using this software, or for whether it serves any
  7. - particular purpose or works at all, unless he or she says so in
  8. - writing. Everyone is granted permission to copy, modify and
  9. - redistribute this source code, for commercial or non-commercial
  10. - purposes, with the following restrictions: (1) the origin of this
  11. - source code must not be misrepresented; (2) modified versions must
  12. - be plainly marked as such; and (3) this notice may not be removed
  13. - or altered from any source or modified source distribution.
  14. *====================================================================*/
  15. #ifndef LEPTONICA_ARRAY_H
  16. #define LEPTONICA_ARRAY_H
  17. /*
  18. * Contains the following structs:
  19. * struct Numa
  20. * struct Numaa
  21. * struct Numa2d
  22. * struct NumaHash
  23. * struct Sarray
  24. *
  25. * Contains definitions for:
  26. * Numa interpolation flags
  27. */
  28. /*------------------------------------------------------------------------*
  29. * Array Structs *
  30. *------------------------------------------------------------------------*/
  31. #define NUMA_VERSION_NUMBER 1
  32. /* Number array: an array of floats */
  33. struct Numa
  34. {
  35. l_int32 nalloc; /* size of allocated number array */
  36. l_int32 n; /* number of numbers saved */
  37. l_int32 refcount; /* reference count (1 if no clones) */
  38. l_float32 startx; /* x value assigned to array[0] */
  39. l_float32 delx; /* change in x value as i --> i + 1 */
  40. l_float32 *array; /* number array */
  41. };
  42. typedef struct Numa NUMA;
  43. /* Array of number arrays */
  44. struct Numaa
  45. {
  46. l_int32 nalloc; /* size of allocated ptr array */
  47. l_int32 n; /* number of Numa saved */
  48. struct Numa **numa; /* array of Numa */
  49. };
  50. typedef struct Numaa NUMAA;
  51. /* Sparse 2-dimensional array of number arrays */
  52. struct Numa2d
  53. {
  54. l_int32 nrows; /* number of rows allocated for ptr array */
  55. l_int32 ncols; /* number of cols allocated for ptr array */
  56. l_int32 initsize; /* initial size of each numa that is made */
  57. struct Numa ***numa; /* 2D array of Numa */
  58. };
  59. typedef struct Numa2d NUMA2D;
  60. /* A hash table of Numas */
  61. struct NumaHash
  62. {
  63. l_int32 nbuckets;
  64. l_int32 initsize; /* initial size of each numa that is made */
  65. struct Numa **numa;
  66. };
  67. typedef struct NumaHash NUMAHASH;
  68. #define SARRAY_VERSION_NUMBER 1
  69. /* String array: an array of C strings */
  70. struct Sarray
  71. {
  72. l_int32 nalloc; /* size of allocated ptr array */
  73. l_int32 n; /* number of strings allocated */
  74. l_int32 refcount; /* reference count (1 if no clones) */
  75. char **array; /* string array */
  76. };
  77. typedef struct Sarray SARRAY;
  78. /*------------------------------------------------------------------------*
  79. * Array flags *
  80. *------------------------------------------------------------------------*/
  81. /* Flags for interpolation in Numa */
  82. enum {
  83. L_LINEAR_INTERP = 1, /* linear */
  84. L_QUADRATIC_INTERP = 2 /* quadratic */
  85. };
  86. #endif /* LEPTONICA_ARRAY_H */