Ver código fonte

换回5.0版本

张洋 6 anos atrás
pai
commit
b3df25eca7
57 arquivos alterados com 3034 adições e 1553 exclusões
  1. BIN
      bin/Win32/Debug/zhipuzi_pay_plugin/pvt.cppan.demo.danbloomberg.leptonica-1.76.0.dll
  2. BIN
      bin/Win32/Debug/zhipuzi_pay_plugin/pvt.cppan.demo.jpeg-9.2.0.dll
  3. BIN
      bin/Win32/Debug/zhipuzi_pay_plugin/pvt.cppan.demo.madler.zlib-1.2.11.dll
  4. BIN
      bin/Win32/Debug/zhipuzi_pay_plugin/pvt.cppan.demo.openjpeg.openjp2-2.3.0.dll
  5. BIN
      bin/Win32/Debug/zhipuzi_pay_plugin/pvt.cppan.demo.png-1.6.35.dll
  6. BIN
      bin/Win32/Debug/zhipuzi_pay_plugin/pvt.cppan.demo.tiff-4.0.9.dll
  7. BIN
      bin/Win32/Debug/zhipuzi_pay_plugin/pvt.cppan.demo.webp-0.6.1.dll
  8. BIN
      bin/Win32/Debug/zhipuzi_pay_plugin/pvt.cppan.demo.xz_utils.lzma-5.2.4.dll
  9. BIN
      bin/Win32/Debug/zhipuzi_pay_plugin/tessdata/eng.traineddata
  10. BIN
      bin/Win32/Debug/zhipuzi_pay_plugin/tesseract50.dll
  11. BIN
      bin/Win32/Debug/zhipuzi_pay_plugin/zhipuzi_pay_plugin.exe
  12. BIN
      dll/debug/liblept171.dll
  13. BIN
      dll/debug/libtesseract304.dll
  14. BIN
      dll/debug/pvt.cppan.demo.danbloomberg.leptonica-1.76.0.dll
  15. BIN
      dll/debug/pvt.cppan.demo.jpeg-9.2.0.dll
  16. BIN
      dll/debug/pvt.cppan.demo.madler.zlib-1.2.11.dll
  17. BIN
      dll/debug/pvt.cppan.demo.openjpeg.openjp2-2.3.0.dll
  18. BIN
      dll/debug/pvt.cppan.demo.png-1.6.35.dll
  19. BIN
      dll/debug/pvt.cppan.demo.tiff-4.0.9.dll
  20. BIN
      dll/debug/pvt.cppan.demo.webp-0.6.1.dll
  21. BIN
      dll/debug/pvt.cppan.demo.xz_utils.lzma-5.2.4.dll
  22. BIN
      dll/debug/tesseract50.dll
  23. 500 274
      include/leptonica/allheaders.h
  24. 4 1
      include/leptonica/alltypes.h
  25. 62 73
      include/leptonica/array.h
  26. 99 40
      include/leptonica/arrayaccess.h
  27. 12 9
      include/leptonica/bbuffer.h
  28. 22 16
      include/leptonica/bilateral.h
  29. 21 20
      include/leptonica/bmf.h
  30. 636 0
      include/leptonica/bmfdata.h
  31. 35 25
      include/leptonica/bmp.h
  32. 27 22
      include/leptonica/ccbord.h
  33. 93 67
      include/leptonica/dewarp.h
  34. 1 1
      include/leptonica/endianness.h
  35. 133 52
      include/leptonica/environ.h
  36. 32 25
      include/leptonica/gplot.h
  37. 12 9
      include/leptonica/heap.h
  38. 90 58
      include/leptonica/imageio.h
  39. 67 59
      include/leptonica/jbclass.h
  40. 9 6
      include/leptonica/list.h
  41. 57 38
      include/leptonica/morph.h
  42. 663 448
      include/leptonica/pix.h
  43. 26 22
      include/leptonica/ptra.h
  44. 13 10
      include/leptonica/queue.h
  45. 90 0
      include/leptonica/rbtree.h
  46. 23 15
      include/leptonica/readbarcode.h
  47. 189 184
      include/leptonica/recog.h
  48. 27 22
      include/leptonica/regutils.h
  49. 13 9
      include/leptonica/stack.h
  50. 31 5
      include/leptonica/freetype.h
  51. 20 17
      include/leptonica/sudoku.h
  52. 26 25
      include/leptonica/watershed.h
  53. BIN
      lib/debug/liblept171.lib
  54. BIN
      lib/debug/libtesseract304.lib
  55. BIN
      lib/debug/pvt.cppan.demo.danbloomberg.leptonica-1.76.0.lib
  56. BIN
      lib/debug/tesseract50.lib
  57. 1 1
      zhipuzi_pay_plugin/zhipuzi_pay_plugin.vcxproj

BIN
bin/Win32/Debug/zhipuzi_pay_plugin/pvt.cppan.demo.danbloomberg.leptonica-1.76.0.dll


BIN
bin/Win32/Debug/zhipuzi_pay_plugin/pvt.cppan.demo.jpeg-9.2.0.dll


BIN
bin/Win32/Debug/zhipuzi_pay_plugin/pvt.cppan.demo.madler.zlib-1.2.11.dll


BIN
bin/Win32/Debug/zhipuzi_pay_plugin/pvt.cppan.demo.openjpeg.openjp2-2.3.0.dll


BIN
bin/Win32/Debug/zhipuzi_pay_plugin/pvt.cppan.demo.png-1.6.35.dll


BIN
bin/Win32/Debug/zhipuzi_pay_plugin/pvt.cppan.demo.tiff-4.0.9.dll


BIN
bin/Win32/Debug/zhipuzi_pay_plugin/pvt.cppan.demo.webp-0.6.1.dll


BIN
bin/Win32/Debug/zhipuzi_pay_plugin/pvt.cppan.demo.xz_utils.lzma-5.2.4.dll


BIN
bin/Win32/Debug/zhipuzi_pay_plugin/tessdata/eng.traineddata


BIN
bin/Win32/Debug/zhipuzi_pay_plugin/tesseract50.dll


BIN
bin/Win32/Debug/zhipuzi_pay_plugin/zhipuzi_pay_plugin.exe


BIN
dll/debug/liblept171.dll


BIN
dll/debug/libtesseract304.dll


BIN
dll/debug/pvt.cppan.demo.danbloomberg.leptonica-1.76.0.dll


BIN
dll/debug/pvt.cppan.demo.jpeg-9.2.0.dll


BIN
dll/debug/pvt.cppan.demo.madler.zlib-1.2.11.dll


BIN
dll/debug/pvt.cppan.demo.openjpeg.openjp2-2.3.0.dll


BIN
dll/debug/pvt.cppan.demo.png-1.6.35.dll


BIN
dll/debug/pvt.cppan.demo.tiff-4.0.9.dll


BIN
dll/debug/pvt.cppan.demo.webp-0.6.1.dll


BIN
dll/debug/pvt.cppan.demo.xz_utils.lzma-5.2.4.dll


BIN
dll/debug/tesseract50.dll


Diferenças do arquivo suprimidas por serem muito extensas
+ 500 - 274
include/leptonica/allheaders.h


+ 4 - 1
include/leptonica/alltypes.h

@@ -10,7 +10,7 @@
  -     copyright notice, this list of conditions and the following
  -     disclaimer in the documentation and/or other materials
  -     provided with the distribution.
- - 
+ -
  -  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  -  ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  -  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -33,6 +33,7 @@
 #include <stdarg.h>
 
     /* General and configuration defs */
+#include "endianness.h"
 #include "environ.h"
 
     /* Generic and non-image-specific containers */
@@ -42,6 +43,7 @@
 #include "list.h"
 #include "ptra.h"
 #include "queue.h"
+#include "rbtree.h"
 #include "stack.h"
 
     /* Imaging */
@@ -56,6 +58,7 @@
 #include "pix.h"
 #include "recog.h"
 #include "regutils.h"
+#include "stringcode.h"
 #include "sudoku.h"
 #include "watershed.h"
 

+ 62 - 73
include/leptonica/array.h

@@ -10,7 +10,7 @@
  -     copyright notice, this list of conditions and the following
  -     disclaimer in the documentation and/or other materials
  -     provided with the distribution.
- - 
+ -
  -  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  -  ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  -  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -27,14 +27,16 @@
 #ifndef  LEPTONICA_ARRAY_H
 #define  LEPTONICA_ARRAY_H
 
-/*
+/*!
+ * \file array.h
+ *
+ * <pre>
  *  Contains the following structs:
  *      struct Numa
  *      struct Numaa
- *      struct Numa2d
- *      struct NumaHash
  *      struct L_Dna
  *      struct L_Dnaa
+ *      struct L_DnaHash
  *      struct Sarray
  *      struct L_Bytea
  *
@@ -42,128 +44,115 @@
  *      Numa interpolation flags
  *      Numa and FPix border flags
  *      Numa data type conversion to string
+ * </pre>
  */
 
 
-/*------------------------------------------------------------------------* 
+/*------------------------------------------------------------------------*
  *                             Array Structs                              *
  *------------------------------------------------------------------------*/
 
+/*! Numa version for serialization */
 #define  NUMA_VERSION_NUMBER     1
 
-    /* Number array: an array of floats */
+    /*! Number array: an array of floats */
 struct Numa
 {
-    l_int32          nalloc;    /* size of allocated number array      */
-    l_int32          n;         /* number of numbers saved             */
-    l_int32          refcount;  /* reference count (1 if no clones)    */
-    l_float32        startx;    /* x value assigned to array[0]        */
-    l_float32        delx;      /* change in x value as i --> i + 1    */
-    l_float32       *array;     /* number array                        */
+    l_int32          nalloc;    /*!< size of allocated number array      */
+    l_int32          n;         /*!< number of numbers saved             */
+    l_int32          refcount;  /*!< reference count (1 if no clones)    */
+    l_float32        startx;    /*!< x value assigned to array[0]        */
+    l_float32        delx;      /*!< change in x value as i --> i + 1    */
+    l_float32       *array;     /*!< number array                        */
 };
 typedef struct Numa  NUMA;
 
-
-    /* Array of number arrays */
+    /*! Array of number arrays */
 struct Numaa
 {
-    l_int32          nalloc;    /* size of allocated ptr array          */
-    l_int32          n;         /* number of Numa saved                 */
-    struct Numa    **numa;      /* array of Numa                        */
+    l_int32          nalloc;    /*!< size of allocated ptr array          */
+    l_int32          n;         /*!< number of Numa saved                 */
+    struct Numa    **numa;      /*!< array of Numa                        */
 };
 typedef struct Numaa  NUMAA;
 
-
-    /* Sparse 2-dimensional array of number arrays */
-struct Numa2d
-{
-    l_int32          nrows;      /* number of rows allocated for ptr array  */
-    l_int32          ncols;      /* number of cols allocated for ptr array  */
-    l_int32          initsize;   /* initial size of each numa that is made  */
-    struct Numa   ***numa;       /* 2D array of Numa                        */
-};
-typedef struct Numa2d  NUMA2D;
-
-
-    /* A hash table of Numas */
-struct NumaHash
-{
-    l_int32          nbuckets;
-    l_int32          initsize;   /* initial size of each numa that is made  */
-    struct Numa    **numa;
-};
-typedef struct NumaHash NUMAHASH;
-
-
+/*! Dna version for serialization */
 #define  DNA_VERSION_NUMBER     1
 
-    /* Double number array: an array of doubles */
+    /*! Double number array: an array of doubles */
 struct L_Dna
 {
-    l_int32          nalloc;    /* size of allocated number array      */
-    l_int32          n;         /* number of numbers saved             */
-    l_int32          refcount;  /* reference count (1 if no clones)    */
-    l_float64        startx;    /* x value assigned to array[0]        */
-    l_float64        delx;      /* change in x value as i --> i + 1    */
-    l_float64       *array;     /* number array                        */
+    l_int32          nalloc;    /*!< size of allocated number array      */
+    l_int32          n;         /*!< number of numbers saved             */
+    l_int32          refcount;  /*!< reference count (1 if no clones)    */
+    l_float64        startx;    /*!< x value assigned to array[0]        */
+    l_float64        delx;      /*!< change in x value as i --> i + 1    */
+    l_float64       *array;     /*!< number array                        */
 };
 typedef struct L_Dna  L_DNA;
 
-
-    /* Array of double number arrays */
+    /*! Array of double number arrays */
 struct L_Dnaa
 {
-    l_int32          nalloc;    /* size of allocated ptr array          */
-    l_int32          n;         /* number of L_Dna saved                */
-    struct L_Dna   **dna;       /* array of L_Dna                       */
+    l_int32          nalloc;    /*!< size of allocated ptr array          */
+    l_int32          n;         /*!< number of L_Dna saved                */
+    struct L_Dna   **dna;       /*!< array of L_Dna                       */
 };
 typedef struct L_Dnaa  L_DNAA;
 
+    /*! A hash table of Dnas */
+struct L_DnaHash
+{
+    l_int32          nbuckets;
+    l_int32          initsize;   /*!< initial size of each dna that is made  */
+    struct L_Dna   **dna;        /*!< array of L_Dna                       */
+};
+typedef struct L_DnaHash L_DNAHASH;
 
+/*! Sarray version for serialization */
 #define  SARRAY_VERSION_NUMBER     1
 
-    /* String array: an array of C strings */
+    /*! String array: an array of C strings */
 struct Sarray
 {
-    l_int32          nalloc;    /* size of allocated ptr array         */
-    l_int32          n;         /* number of strings allocated         */
-    l_int32          refcount;  /* reference count (1 if no clones)    */
-    char           **array;     /* string array                        */
+    l_int32          nalloc;    /*!< size of allocated ptr array         */
+    l_int32          n;         /*!< number of strings allocated         */
+    l_int32          refcount;  /*!< reference count (1 if no clones)    */
+    char           **array;     /*!< string array                        */
 };
 typedef struct Sarray SARRAY;
 
-
-    /* Byte array (analogous to C++ "string") */
+    /*! Byte array (analogous to C++ "string") */
 struct L_Bytea
 {
-    size_t           nalloc;    /* number of bytes allocated in data array  */
-    size_t           size;      /* number of bytes presently used           */
-    l_int32          refcount;  /* reference count (1 if no clones)         */
-    l_uint8         *data;      /* data array                               */
+    size_t           nalloc;    /*!< number of bytes allocated in data array  */
+    size_t           size;      /*!< number of bytes presently used           */
+    l_int32          refcount;  /*!< reference count (1 if no clones)         */
+    l_uint8         *data;      /*!< data array                               */
 };
 typedef struct L_Bytea L_BYTEA;
 
 
-/*------------------------------------------------------------------------* 
+/*------------------------------------------------------------------------*
  *                              Array flags                               *
  *------------------------------------------------------------------------*/
-    /* Flags for interpolation in Numa */
+    /*! Flags for interpolation in Numa */
 enum {
-    L_LINEAR_INTERP = 1,        /* linear     */
-    L_QUADRATIC_INTERP = 2      /* quadratic  */
+    L_LINEAR_INTERP = 1,        /*!< linear     */
+    L_QUADRATIC_INTERP = 2      /*!< quadratic  */
 };
 
-    /* Flags for added borders in Numa and Fpix */
+    /*! Flags for added borders in Numa and Fpix */
 enum {
-    L_CONTINUED_BORDER = 1,     /* extended with same value                  */
-    L_SLOPE_BORDER = 2,         /* extended with constant normal derivative  */
-    L_MIRRORED_BORDER = 3       /* mirrored                                  */
+    L_CONTINUED_BORDER = 1,    /*!< extended with same value                  */
+    L_SLOPE_BORDER = 2,        /*!< extended with constant normal derivative  */
+    L_MIRRORED_BORDER = 3      /*!< mirrored                                  */
 };
 
-    /* Flags for data type converted from Numa */
+    /*! Flags for data type converted from Numa */
 enum {
-    L_INTEGER_VALUE = 1,        /* convert to integer  */
-    L_FLOAT_VALUE = 2           /* convert to float    */
+    L_INTEGER_VALUE = 1,        /*!< convert to integer  */
+    L_FLOAT_VALUE = 2           /*!< convert to float    */
 };
 
 

+ 99 - 40
include/leptonica/arrayaccess.h

@@ -10,7 +10,7 @@
  -     copyright notice, this list of conditions and the following
  -     disclaimer in the documentation and/or other materials
  -     provided with the distribution.
- - 
+ -
  -  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  -  ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  -  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -27,9 +27,10 @@
 #ifndef  LEPTONICA_ARRAY_ACCESS_H
 #define  LEPTONICA_ARRAY_ACCESS_H
 
-/*
- *  arrayaccess.h
+/*!
+ * \file arrayaccess.h
  *
+ * <pre>
  *  1, 2, 4, 8, 16 and 32 bit data access within an array of 32-bit words
  *
  *  This is used primarily to access 1, 2, 4, 8, 16 and 32 bit pixels
@@ -55,87 +56,141 @@
  *          CLEAR_DATA_BIT(pdata, n);
  *      else
  *          SET_DATA_BIT(pdata, n);
+ *
+ *  Some compilers complain when the SET macros are surrounded by
+ *  parentheses, because parens require an evaluation and it is not
+ *  defined for SET macros.  If SET_DATA_QBIT were defined as a
+ *  compound macro, in analogy to l_setDataQbit(), it requires
+ *  surrounding braces:
+ *     #define  SET_DATA_QBIT(pdata, n, val) \
+ *        {l_uint32 *_TEMP_WORD_PTR_; \
+ *         _TEMP_WORD_PTR_ = (l_uint32 *)(pdata) + ((n) >> 3); \
+ *         *_TEMP_WORD_PTR_ &= ~(0xf0000000 >> (4 * ((n) & 7))); \
+ *         *_TEMP_WORD_PTR_ |= (((val) & 15) << (28 - 4 * ((n) & 7)));}
+ *  but if used in an if/else
+ *      if (x)
+ *         SET_DATA_QBIT(...);
+ *      else
+ *         ...
+ *  the compiler sees
+ *      if (x)
+ *         {......};
+ *      else
+ *         ...
+ *  The semicolon comes after the brace and will not compile.
+ *  This can be fixed in the call by either omitting the semicolon
+ *  or requiring another set of braces around SET_DATA_QBIT(), but
+ *  both these options break compatibility with current code, and
+ *  require special attention by anyone using the macros.
+ *
+ *  There are (at least) two ways to fix this in the macro definitions,
+ *  suggested by Dave Bryan.
+ *  (1) Surround the braces in the macro above with
+ *         do {....} while(0)
+ *      Then the semicolon just terminates the expression.
+ *  (2) Reduce the blocks to a single expression; e.g,
+ *         *((l_uint32 *)(pdata) + ((n) >> 3)) = \
+ *           *((l_uint32 *)(pdata) + ((n) >> 3)) \
+ *           & ~(0xf0000000 >> (4 * ((n) & 7))) \
+ *           | (((val) & 15) << (28 - 4 * ((n) & 7)))
+ *      This appears to cause redundant computation, but the compiler
+ *      should evaluate the common subexpression only once.
+ *  All these methods have the same performance, giving about 300M
+ *  SET_DATA_QBIT operations per second on a fast 64 bit system.
+ *  Using the function calls instead of the macros results in about 250M
+ *  SET_DATA_QBIT operations per second, a performance hit of nearly 20%.
+ * </pre>
  */
 
-
-    /* Use the inline accessors (except with _MSC_VER), because they
-     * are faster.  */
 #define  USE_INLINE_ACCESSORS    1
 
 #if USE_INLINE_ACCESSORS
-#ifndef _MSC_VER
+
+    /*=============================================================*/
+    /*                Faster: use in line accessors                */
+    /*=============================================================*/
 
     /*--------------------------------------------------*
      *                     1 bit access                 *
      *--------------------------------------------------*/
+/*! 1 bit access - get */
 #define  GET_DATA_BIT(pdata, n) \
     ((*((l_uint32 *)(pdata) + ((n) >> 5)) >> (31 - ((n) & 31))) & 1)
 
+/*! 1 bit access - set */
 #define  SET_DATA_BIT(pdata, n) \
-    (*((l_uint32 *)(pdata) + ((n) >> 5)) |= (0x80000000 >> ((n) & 31)))
+    *((l_uint32 *)(pdata) + ((n) >> 5)) |= (0x80000000 >> ((n) & 31))
 
+/*! 1 bit access - clear */
 #define  CLEAR_DATA_BIT(pdata, n) \
-    (*((l_uint32 *)(pdata) + ((n) >> 5)) &= ~(0x80000000 >> ((n) & 31)))
+    *((l_uint32 *)(pdata) + ((n) >> 5)) &= ~(0x80000000 >> ((n) & 31))
 
+/*! 1 bit access - set value (0 or 1) */
 #define  SET_DATA_BIT_VAL(pdata, n, val) \
-    ({l_uint32 *_TEMP_WORD_PTR_; \
-     _TEMP_WORD_PTR_ = (l_uint32 *)(pdata) + ((n) >> 5); \
-     *_TEMP_WORD_PTR_ &= ~(0x80000000 >> ((n) & 31)); \
-     *_TEMP_WORD_PTR_ |= ((val) << (31 - ((n) & 31))); \
-    })
-
+     *((l_uint32 *)(pdata) + ((n) >> 5)) = \
+        ((*((l_uint32 *)(pdata) + ((n) >> 5)) \
+        & (~(0x80000000 >> ((n) & 31)))) \
+        | ((val) << (31 - ((n) & 31))))
 
     /*--------------------------------------------------*
      *                     2 bit access                 *
      *--------------------------------------------------*/
+/*! 2 bit access - get */
 #define  GET_DATA_DIBIT(pdata, n) \
     ((*((l_uint32 *)(pdata) + ((n) >> 4)) >> (2 * (15 - ((n) & 15)))) & 3)
 
+/*! 2 bit access - set value (0 ... 3) */
 #define  SET_DATA_DIBIT(pdata, n, val) \
-    ({l_uint32 *_TEMP_WORD_PTR_; \
-     _TEMP_WORD_PTR_ = (l_uint32 *)(pdata) + ((n) >> 4); \
-     *_TEMP_WORD_PTR_ &= ~(0xc0000000 >> (2 * ((n) & 15))); \
-     *_TEMP_WORD_PTR_ |= (((val) & 3) << (30 - 2 * ((n) & 15))); \
-    })
+     *((l_uint32 *)(pdata) + ((n) >> 4)) = \
+        ((*((l_uint32 *)(pdata) + ((n) >> 4)) \
+        & (~(0xc0000000 >> (2 * ((n) & 15))))) \
+        | (((val) & 3) << (30 - 2 * ((n) & 15))))
 
+/*! 2 bit access - clear */
 #define  CLEAR_DATA_DIBIT(pdata, n) \
-    (*((l_uint32 *)(pdata) + ((n) >> 4)) &= ~(0xc0000000 >> (2 * ((n) & 15))))
+    *((l_uint32 *)(pdata) + ((n) >> 4)) &= ~(0xc0000000 >> (2 * ((n) & 15)))
 
 
     /*--------------------------------------------------*
      *                     4 bit access                 *
      *--------------------------------------------------*/
+/*! 4 bit access - get */
 #define  GET_DATA_QBIT(pdata, n) \
      ((*((l_uint32 *)(pdata) + ((n) >> 3)) >> (4 * (7 - ((n) & 7)))) & 0xf)
 
+/*! 4 bit access - set value (0 ... 15) */
 #define  SET_DATA_QBIT(pdata, n, val) \
-    ({l_uint32 *_TEMP_WORD_PTR_; \
-     _TEMP_WORD_PTR_ = (l_uint32 *)(pdata) + ((n) >> 3); \
-     *_TEMP_WORD_PTR_ &= ~(0xf0000000 >> (4 * ((n) & 7))); \
-     *_TEMP_WORD_PTR_ |= (((val) & 15) << (28 - 4 * ((n) & 7))); \
-    })
+     *((l_uint32 *)(pdata) + ((n) >> 3)) = \
+        ((*((l_uint32 *)(pdata) + ((n) >> 3)) \
+        & (~(0xf0000000 >> (4 * ((n) & 7))))) \
+        | (((val) & 15) << (28 - 4 * ((n) & 7))))
 
+/*! 4 bit access - clear */
 #define  CLEAR_DATA_QBIT(pdata, n) \
-    (*((l_uint32 *)(pdata) + ((n) >> 3)) &= ~(0xf0000000 >> (4 * ((n) & 7))))
+    *((l_uint32 *)(pdata) + ((n) >> 3)) &= ~(0xf0000000 >> (4 * ((n) & 7)))
 
 
     /*--------------------------------------------------*
      *                     8 bit access                 *
      *--------------------------------------------------*/
 #ifdef  L_BIG_ENDIAN
+/*! 8 bit access - get */
 #define  GET_DATA_BYTE(pdata, n) \
              (*((l_uint8 *)(pdata) + (n)))
 #else  /* L_LITTLE_ENDIAN */
+/*! 8 bit access - get */
 #define  GET_DATA_BYTE(pdata, n) \
              (*(l_uint8 *)((l_uintptr_t)((l_uint8 *)(pdata) + (n)) ^ 3))
 #endif  /* L_BIG_ENDIAN */
 
 #ifdef  L_BIG_ENDIAN
+/*! 8 bit access - set value (0 ... 255) */
 #define  SET_DATA_BYTE(pdata, n, val) \
-             (*((l_uint8 *)(pdata) + (n)) = (val))
+             *((l_uint8 *)(pdata) + (n)) = (val)
 #else  /* L_LITTLE_ENDIAN */
+/*! 8 bit access - set value (0 ... 255) */
 #define  SET_DATA_BYTE(pdata, n, val) \
-             (*(l_uint8 *)((l_uintptr_t)((l_uint8 *)(pdata) + (n)) ^ 3) = (val))
+             *(l_uint8 *)((l_uintptr_t)((l_uint8 *)(pdata) + (n)) ^ 3) = (val)
 #endif  /* L_BIG_ENDIAN */
 
 
@@ -143,41 +198,44 @@
      *                    16 bit access                 *
      *--------------------------------------------------*/
 #ifdef  L_BIG_ENDIAN
+/*! 16 bit access - get */
 #define  GET_DATA_TWO_BYTES(pdata, n) \
              (*((l_uint16 *)(pdata) + (n)))
 #else  /* L_LITTLE_ENDIAN */
+/*! 16 bit access - get */
 #define  GET_DATA_TWO_BYTES(pdata, n) \
              (*(l_uint16 *)((l_uintptr_t)((l_uint16 *)(pdata) + (n)) ^ 2))
 #endif  /* L_BIG_ENDIAN */
 
 #ifdef  L_BIG_ENDIAN
+/*! 16 bit access - set value (0 ... 65535) */
 #define  SET_DATA_TWO_BYTES(pdata, n, val) \
-             (*((l_uint16 *)(pdata) + (n)) = (val))
+             *((l_uint16 *)(pdata) + (n)) = (val)
 #else  /* L_LITTLE_ENDIAN */
+/*! 16 bit access - set value (0 ... 65535) */
 #define  SET_DATA_TWO_BYTES(pdata, n, val) \
-             (*(l_uint16 *)((l_uintptr_t)((l_uint16 *)(pdata) + (n)) ^ 2) = (val))
+             *(l_uint16 *)((l_uintptr_t)((l_uint16 *)(pdata) + (n)) ^ 2) = (val)
 #endif  /* L_BIG_ENDIAN */
 
 
     /*--------------------------------------------------*
      *                    32 bit access                 *
      *--------------------------------------------------*/
+/*! 32 bit access - get */
 #define  GET_DATA_FOUR_BYTES(pdata, n) \
              (*((l_uint32 *)(pdata) + (n)))
 
+/*! 32 bit access - set (0 ... 4294967295) */
 #define  SET_DATA_FOUR_BYTES(pdata, n, val) \
-             (*((l_uint32 *)(pdata) + (n)) = (val))
-
+             *((l_uint32 *)(pdata) + (n)) = (val)
 
-#endif  /* ! _MSC_VER */
-#endif  /* USE_INLINE_ACCESSORS */
 
+#else
 
+    /*=============================================================*/
+    /*         Slower: use function calls for all accessors        */
+    /*=============================================================*/
 
-    /*--------------------------------------------------*
-     *  Slower, using function calls for all accessors  *
-     *--------------------------------------------------*/
-#if !USE_INLINE_ACCESSORS || defined(_MSC_VER)
 #define  GET_DATA_BIT(pdata, n)               l_getDataBit(pdata, n)
 #define  SET_DATA_BIT(pdata, n)               l_setDataBit(pdata, n)
 #define  CLEAR_DATA_BIT(pdata, n)             l_clearDataBit(pdata, n)
@@ -199,7 +257,8 @@
 
 #define  GET_DATA_FOUR_BYTES(pdata, n)         l_getDataFourBytes(pdata, n)
 #define  SET_DATA_FOUR_BYTES(pdata, n, val)    l_setDataFourBytes(pdata, n, val)
-#endif  /* !USE_INLINE_ACCESSORS || _MSC_VER */
+
+#endif  /* USE_INLINE_ACCESSORS */
 
 
 #endif /* LEPTONICA_ARRAY_ACCESS_H */

+ 12 - 9
include/leptonica/bbuffer.h

@@ -10,7 +10,7 @@
  -     copyright notice, this list of conditions and the following
  -     disclaimer in the documentation and/or other materials
  -     provided with the distribution.
- - 
+ -
  -  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  -  ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  -  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -27,9 +27,10 @@
 #ifndef  LEPTONICA_BBUFFER_H
 #define  LEPTONICA_BBUFFER_H
 
-/*
- *  bbuffer.h
+/*!
+ * \file bbuffer.h
  *
+ * <pre>
  *      Expandable byte buffer for reading data in from memory and
  *      writing data out to other memory.
  *
@@ -42,16 +43,18 @@
  *      number of bytes that have been read into the array.
  *
  *      For implementation details, see bbuffer.c.
+ * </pre>
  */
 
-struct ByteBuffer
+/*! Expandable byte buffer for memory read/write operations */
+struct L_ByteBuffer
 {
-    l_int32      nalloc;       /* size of allocated byte array            */
-    l_int32      n;            /* number of bytes read into to the array  */
-    l_int32      nwritten;     /* number of bytes written from the array  */
-    l_uint8     *array;        /* byte array                              */
+    l_int32      nalloc;       /*!< size of allocated byte array            */
+    l_int32      n;            /*!< number of bytes read into to the array  */
+    l_int32      nwritten;     /*!< number of bytes written from the array  */
+    l_uint8     *array;        /*!< byte array                              */
 };
-typedef struct ByteBuffer BBUFFER;
+typedef struct L_ByteBuffer L_BBUFFER;
 
 
 #endif  /* LEPTONICA_BBUFFER_H */

+ 22 - 16
include/leptonica/bilateral.h

@@ -27,7 +27,10 @@
 #ifndef  LEPTONICA_BILATERAL_H
 #define  LEPTONICA_BILATERAL_H
 
-/*
+/*!
+ * \file bilateral.h
+ *
+ * <pre>
  *  Contains the following struct
  *      struct L_Bilateral
  *
@@ -100,29 +103,32 @@
  *  The 'spatial_stdev' is also downscaled by 'reduction'.  The size
  *  of the 'spatial' array is 4 * (reduced 'spatial_stdev') + 1.
  *  The size of the 'range' array is 256.
+ * </pre>
  */
 
 
 /*------------------------------------------------------------------------*
  *                          Bilateral filter                              *
  *------------------------------------------------------------------------*/
+
+/*! Bilateral filter */
 struct L_Bilateral
 {
-    struct Pix      *pixs;           /* clone of source pix                  */
-    struct Pix      *pixsc;          /* downscaled pix with mirrored border  */
-    l_int32          reduction;      /* 1, 2 or 4x for intermediates         */
-    l_float32        spatial_stdev;  /* stdev of spatial gaussian            */
-    l_float32        range_stdev;    /* stdev of range gaussian              */
-    l_float32       *spatial;        /* 1D gaussian spatial kernel           */
-    l_float32       *range;          /* one-sided gaussian range kernel      */
-    l_int32          minval;         /* min value in 8 bpp pix               */
-    l_int32          maxval;         /* max value in 8 bpp pix               */
-    l_int32          ncomps;         /* number of intermediate results       */
-    l_int32         *nc;             /* set of k values (size ncomps)        */
-    l_int32         *kindex;         /* mapping from intensity to lower k    */
-    l_float32       *kfract;         /* mapping from intensity to fract k    */
-    struct Pixa     *pixac;          /* intermediate result images (PBC)     */
-    l_uint32      ***lineset;        /* lineptrs for pixac                   */
+    struct Pix     *pixs;           /*!< clone of source pix                 */
+    struct Pix     *pixsc;          /*!< downscaled pix with mirrored border */
+    l_int32         reduction;      /*!< 1, 2 or 4x for intermediates        */
+    l_float32       spatial_stdev;  /*!< stdev of spatial gaussian           */
+    l_float32       range_stdev;    /*!< stdev of range gaussian             */
+    l_float32      *spatial;        /*!< 1D gaussian spatial kernel          */
+    l_float32      *range;          /*!< one-sided gaussian range kernel     */
+    l_int32         minval;         /*!< min value in 8 bpp pix              */
+    l_int32         maxval;         /*!< max value in 8 bpp pix              */
+    l_int32         ncomps;         /*!< number of intermediate results      */
+    l_int32        *nc;             /*!< set of k values (size ncomps)       */
+    l_int32        *kindex;         /*!< mapping from intensity to lower k   */
+    l_float32      *kfract;         /*!< mapping from intensity to fract k   */
+    struct Pixa    *pixac;          /*!< intermediate result images (PBC)    */
+    l_uint32     ***lineset;        /*!< lineptrs for pixac                  */
 };
 typedef struct L_Bilateral  L_BILATERAL;
 

+ 21 - 20
include/leptonica/bmf.h

@@ -10,7 +10,7 @@
  -     copyright notice, this list of conditions and the following
  -     disclaimer in the documentation and/or other materials
  -     provided with the distribution.
- - 
+ -
  -  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  -  ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  -  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -27,35 +27,36 @@
 #ifndef  LEPTONICA_BMF_H
 #define  LEPTONICA_BMF_H
 
-/* 
- *  bmf.h
+/*!
+ * \file bmf.h
  *
  *     Simple data structure to hold bitmap fonts and related data
  */
 
-    /* Constants for deciding when text block is divided into paragraphs */
+    /*! Constants for deciding when text block is divided into paragraphs */
 enum {
-    SPLIT_ON_LEADING_WHITE = 1,    /* tab or space at beginning of line   */
-    SPLIT_ON_BLANK_LINE    = 2,    /* newline with optional white space   */
-    SPLIT_ON_BOTH          = 3     /* leading white space or newline      */
+    SPLIT_ON_LEADING_WHITE = 1,    /*!< tab or space at beginning of line   */
+    SPLIT_ON_BLANK_LINE    = 2,    /*!< newline with optional white space   */
+    SPLIT_ON_BOTH          = 3     /*!< leading white space or newline      */
 };
 
 
+/*! Data structure to hold bitmap fonts and related data */
 struct L_Bmf
 {
-    struct Pixa  *pixa;        /* pixa of bitmaps for 93 characters        */
-    l_int32       size;        /* font size (in points at 300 ppi)         */
-    char         *directory;   /* directory containing font bitmaps        */
-    l_int32       baseline1;   /* baseline offset for ascii 33 - 57        */
-    l_int32       baseline2;   /* baseline offset for ascii 58 - 91        */
-    l_int32       baseline3;   /* baseline offset for ascii 93 - 126       */
-    l_int32       lineheight;  /* max height of line of chars              */
-    l_int32       kernwidth;   /* pixel dist between char bitmaps          */
-    l_int32       spacewidth;  /* pixel dist between word bitmaps          */
-    l_int32       vertlinesep; /* extra vertical space between text lines  */
-    l_int32      *fonttab;     /* table mapping ascii --> font index       */
-    l_int32      *baselinetab; /* table mapping ascii --> baseline offset  */
-    l_int32      *widthtab;    /* table mapping ascii --> char width       */
+    struct Pixa  *pixa;        /*!< pixa of bitmaps for 93 characters        */
+    l_int32       size;        /*!< font size (in points at 300 ppi)         */
+    char         *directory;   /*!< directory containing font bitmaps        */
+    l_int32       baseline1;   /*!< baseline offset for ascii 33 - 57        */
+    l_int32       baseline2;   /*!< baseline offset for ascii 58 - 91        */
+    l_int32       baseline3;   /*!< baseline offset for ascii 93 - 126       */
+    l_int32       lineheight;  /*!< max height of line of chars              */
+    l_int32       kernwidth;   /*!< pixel dist between char bitmaps          */
+    l_int32       spacewidth;  /*!< pixel dist between word bitmaps          */
+    l_int32       vertlinesep; /*!< extra vertical space between text lines  */
+    l_int32      *fonttab;     /*!< table mapping ascii --> font index       */
+    l_int32      *baselinetab; /*!< table mapping ascii --> baseline offset  */
+    l_int32      *widthtab;    /*!< table mapping ascii --> char width       */
 };
 typedef struct L_Bmf L_BMF;
 

+ 636 - 0
include/leptonica/bmfdata.h

@@ -0,0 +1,636 @@
+/*====================================================================*
+ -  Copyright (C) 2001 Leptonica.  All rights reserved.
+ -
+ -  Redistribution and use in source and binary forms, with or without
+ -  modification, are permitted provided that the following conditions
+ -  are met:
+ -  1. Redistributions of source code must retain the above copyright
+ -     notice, this list of conditions and the following disclaimer.
+ -  2. Redistributions in binary form must reproduce the above
+ -     copyright notice, this list of conditions and the following
+ -     disclaimer in the documentation and/or other materials
+ -     provided with the distribution.
+ -
+ -  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ -  ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ -  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ -  A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL ANY
+ -  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ -  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ -  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ -  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ -  OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ -  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ -  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *====================================================================*/
+
+/*!
+ * \file bmfdata.h
+ *
+ * <pre>
+ *  This file contains data for constructing the bitmap fonts.
+ *
+ *  The fontdata string holds all 9 sets of bitmap fonts in a base64
+ *  encoding of a pixacomp representation of the tiff compressed images.
+ *  It was generated by prog/genfonts and pasted in.  This allows
+ *  the use of the bitmap fonts for image labelling without accessing
+ *  stored versions of either the tiff images for each set, or the pixa
+ *  of the 95 printable character images that was derived from the tiff image.
+ *
+ *  In use, to get the bmf for a specific font size, from the encoded
+ *  string in this file, call
+ *      bmfCreate(NULL, fontsize);
+ * </pre>
+ */
+
+#ifndef  LEPTONICA_BMFDATA_H
+#define  LEPTONICA_BMFDATA_H
+
+#define  NUM_FONTS  9
+static const char  *inputfonts[] = {"chars-4.tif", "chars-6.tif",
+                                    "chars-8.tif", "chars-10.tif",
+                                    "chars-12.tif", "chars-14.tif",
+                                    "chars-16.tif", "chars-18.tif",
+                                    "chars-20.tif"};
+static const char  *outputfonts[] = {"chars-4.pa", "chars-6.pa",
+                                     "chars-8.pa", "chars-10.pa",
+                                     "chars-12.pa", "chars-14.pa",
+                                     "chars-16.pa", "chars-18.pa",
+                                     "chars-20.pa"};
+static const l_int32  baselines[NUM_FONTS][3] = {{11, 12, 12}, {18, 18, 18},
+                                                 {24, 24, 24}, {30, 30, 30},
+                                                 {36, 36, 36}, {42, 42, 42},
+                                                 {48, 48, 48}, {54, 54, 54},
+                                                 {60, 60, 60}};
+
+static const char  fontdata_4[] =
+    "SUkqACYFAAAmoHICP///////////////////////kFcchgc45Bgc45AgcgxBY5DY5DY5Agcg"
+    "jkM45A8GocgxBA8M45BfCGgchhzOQxZBiNe/CDQRT6RQ+k4QV6BHcgvBBjCC+KoSjQI7wjj/"
+    "16I+EUPTpV0rI4LilVtAjjyPuR58jg3CRd6dJkcDMCj+v//qlVsMgQPVY6vugih9Lr/8RCF+"
+    "OqUUK6C/fHFV9RStf8MulG10fKcN6X+lXOBg+GexX71wxSPCf4/+kE0uR5zE0rtfCFg3oIp0"
+    "R+GF5DSmQaMS/oG1xen0X2wyh8WXwoI46VPt/kNYcf9J4h/pUHB///2H+t+lkCByDj/r9ZBX"
+    "H1BAtUr7u/IEOQanrS0eByO16tpVaSWtaEVsNiG66WrBgg05wM4bCYNWDCWIiDCER6HGhERE"
+    "RER3ZHBfXjaSQ7iOP/////////////////////////////////////////////////////+Q"
+    "JgK95DIDRZAjCDccgRMhn4g5yC9CD0IL+QxhuIfCCYQTC4IJhBiyLBB7J4QX4gvQgxxBehBi"
+    "yGDkPhdkEw1kPZY5cEHck5BIJOQc9aI+wjE7DL7RdsMu2GXoZehGDYaDCDQaDSCDQdIOGEEX"
+    "bDLzCLthl5ojzkeL0NMJhNNbVoJ6kclXuggyOGfugnw3vugv/0u+9IN7pBvdJ//brT3VtdLy"
+    "B4NxyGsOPRnv9R7xx3/9L+EU/3/f4jj/t+3TdDvkFZyC7hYdKkCCKHQI76SW/pD/6XCKdAin"
+    "29L9L6/9eEUOrD0kv8IIMNKkq/j/zD5h+P4r//99LfBKcDR9utK62NLxEIIhnmGGlpek3Lz/"
+    "jj5cv/ul7f+EvimH///0l6CENpfrHt/y9l7kr/4RT/f7f+PwRTkG7/tpav26XtrxoVI5/vSx"
+    "xsP/7ful7fdd1tv/7FRoj//DLgQZgQCFhlYlfv1kx9//28mPx/7ruu3/t9K3pEh/IKzkF3DL"
+    "g2BENDtBr9Jh4S12H/+3+17GwwltpbZBx0u0unr0v9IMjhrBYYpO0KZmDikMJsYTCDCeE2Gh"
+    "p6DTdiEE2KCdo8GcNj3pJsJofjiIiIiIiIiI4iIiIiIhhCIiIiIiIr1SMwyQbOkEiGQCvd4i"
+    "I//////////////////////////////////////////////////////+QVo7IEDkGwchpOQV"
+    "nIa0ENKCGhyC7kHchocgZschnHIMPtKk7oIP7ulv6f9Yj5DIDaH/3gjjr///+rI4aiIEXngg"
+    "RZBfCBEWQXsofKggu5DD5Y+Qw5UHghiCoIEYQw5VkCMIO5TkF7shhzOQxZ4IJZxy3IO5nIJZ"
+    "4IP//1iiPOGd0R+iPQgR3TQIIXZ3/S7BBnezui87MOiPbKHRHqftNNXvTTUjy/9JkcFjTpOk"
+    "9NsKmFTu+Etppw06VtMjhhO0OLCd3S+rSdIUvyDD+Iha8fQ//+K//3/+D/vbQRT7d9LsjhgI"
+    "7nH8Ivf/lw0bS/4RT////7f//pfq+lhr6/v/Yf/t//3/+D/sO2NNhpfiP66Xat8L/2//3S0r"
+    "XIMD/rvUEd9Isf/4Mp5wCDgYBlOzgO0fB3aem2mmnYTtipwCAZQ6DnAXDgynapwk20h/+IiI"
+    "iIy9ERxEREREZHDLiIiIiIjjj6kNWdP//qP/pMjhq8bSXwojsGkEwmliIiP/////////////"
+    "/////////////////////////wAQAQ4AAAEDAAEAAACSAwAAAQEDAAEAAAA2AgAAAgEDAAEA"
+    "AAABAAAAAwEDAAEAAAAEAAAABgEDAAEAAAABAAAAEQEEAAEAAAAIAAAAEgEDAAEAAAABAAAA"
+    "FQEDAAEAAAABAAAAFgEDAAEAAAA2AgAAFwEEAAEAAAAeBQAAGgEFAAEAAADUBQAAGwEFAAEA"
+    "AADcBQAAHAEDAAEAAAABAAAAKAEDAAEAAAACAAAAAAAAAAAAwBIAAAQAAADAEgAABAA=";
+
+static const char  fontdata_6[] =
+    "SUkqAMoGAAAmoHVf///////////////////////////////IZAUfsgeBdyGdyDjkMgI+QPKC"
+    "GIO5AhzOgyGiCMcgYtUrIKHohowhschs4hnwgXcgRQhsgguQQXwhov6/QYQI7qgRUUk2QIfV"
+    "F5hQmmugqCMTCBHj/9F8j9JuknWm7rSbCBFPLtou2sjhlBSOKkE3Qf3+kv9fpcMQaXY9PTwR"
+    "T6WvpX/0v19aVbeQ0D6X7+v/X//QIQfj6xSS4QLS3xx69IVtL/EQy8CvbSqhq4I7//pJeVnT"
+    "Dr/+Niloufj9fpJLxalYrDtdr2DGk/etf6CDrkduzQkw21/w2prRfYZcNbj1+kQMQuL03hF5"
+    "sQRT+CEMMj7pAjuk/5DVDINfr+k9b06Stj+GXgW6pN9/kNsdL/XQg/+nSx/0v20vxSv0v/S3"
+    "/yDA/19sV/6WkQ0D5DY/6+lkDyf/SX9h65BRBDTdJ/StLILuk2lWkl399U2kw0Thpa0r7S0U"
+    "A7S20rSVtJL/iGrFMSPJv+qYoEaA+KBA4pikmKCWIiDVCINaQ0KiIiIiIoFhoRfSodbS1xbp"
+    "Id0hx8f///////////////////////////////////////////////////IHMFnMgTA0hyGQ"
+    "G45DLcg0jkQfyGQDNxBv5DLcg3QQ2EEHDIEaEHDIaDkMTJzIeZBJkEmTwh5kNmEPhB7ITCGi"
+    "ZDOghsmQ0IIbJhHUEMzPAh8jYOeIuRsEZFHCZEHBDhdoww1DLm0bOGXGwZccGXHCMDgwQMED"
+    "BAwQMEi4ZwQdAg2GEEbYYZc2EbYYZcwwjB5dmDgwQMIMJoNbQNqHuRxF6I7YQIN+6BBrDf+E"
+    "E//pf3oEG9tAg3vC9//126bQWlXh0gyODd+l7fXwv/0u1gio0m90m916x9uu60nXXyB4G7kN"
+    "tx6JwU9oEU/4944qP/pcEU8EU+37f7f4j/q6q2tpDXhYaShBBDer1XfJD5IdL/0vtf9L9L//"
+    "ergin9JukvIHk5BiAggw+kn1fSr///9L3r2/fS30of9r1exWqXp4QQYaWl9XH/a2vH+l9/t/"
+    "6X58mgN//r07dJe04QRDYGGGgvpVeXb/jj5gT8X7r7f+CX6CDD/bp6bXY/xEIIQw16Xq8N/y"
+    "5ZcvT/Lp/de3/j+2QMd/r/p0l6CDdf0h73//ZF7/w37r99/fuD/vVq9SP3S9hpd+lLj/6444"
+    "a/9v7r39L0tt/7Xq9b0vDDIbAwQQu2ElKHq/fr3f/2/dfb39/b/V6jjSb1Io/hhiEFbEECFK"
+    "r/euRR+//28ivxXt913XZBcf/jaevr8geTkCHDDCCIF3bEk9XpN6X7f/7f7+xtpbaW+l2l9K"
+    "3pfpqGGEErBhJfCTBk4wl+wf/7f9fsMJba7cMJbDSa9JvSX2sPCwxCQYQaFBikIQQwQMMYIG"
+    "CBggeCBsNCgg3CBhBuGKBA2KBA24hAgbFdOlYIGh+NCIiIiIiIiI4iIiIhxEGCERERERER9L"
+    "GHfVBF0Tgtg0dSBoDTYk+h40PiP/////////////////////////////////////////////"
+    "//////5A887IHkOQbLIE8EFaCGvBBmsgosgaDcg3HIbHwaIbIvVVIZTkGHVUtv9IOHRHBU+D"
+    "g5DJBx//QRTr69fr/+3X+I+v/pa//v/9N0Q2XnshsshsjIaMyGjMhlOQIHycZAhyDUOQy+IZ"
+    "xzWQUWUOQYc7kGMyGdyTkH41kH4scnZB4JwQxhrIYp/64hF56DCLzBF4aLzQNF8+DyuCguuF"
+    "Kw/ApXIvMFTCI7FhU0XmgYUL/ap0tow3/6TdN2XCTpB0rVJqJHmHD6BYbNhoDEjzSbDDLhJo"
+    "NnHSdQ4cMJoMJQ0DpBphVC//x9v/ScMEkwqf9Lpp6dJum18cQwX3V9XXWv/pN9OkKX/9f6X1"
+    "1/TpdX+6umrDdRSS2yBGFv4iQZu/9D//4r//f/58CP3XI/p7pL9F9peEYv/zAF8NL/hFP///"
+    "/t/utrrutN6SQYr0F//7Ff+3////g3/11dJ+l+I/+ld7ey4KP+3//fpX5DOOD/3sb8j+6X/9"
+    "en1+v/b//dLr//Vuo0rY0ib//aphKGYdtAinbLfROC//Yf/8NKGEmwvaUOwvtK3SX/7DPcUG"
+    "NjhsUEHhBwwg8JuEGEGEHDCDhhiopiCKcIOKeJHTd8JNuh/+IiIiIsubERxEREREZcNKIiIi"
+    "IiNDj+En/X/IbQdf/+Cj/9Npd6SXq3WLDSrwSEdigkEGCDrEREf/////////////////////"
+    "///////4AIAIAA4AAAEDAAEAAABBBAAAAQEDAAEAAAA6AgAAAgEDAAEAAAABAAAAAwEDAAEA"
+    "AAAEAAAABgEDAAEAAAABAAAAEQEEAAEAAAAIAAAAEgEDAAEAAAABAAAAFQEDAAEAAAABAAAA"
+    "FgEDAAEAAAA6AgAAFwEEAAEAAADBBgAAGgEFAAEAAAB4BwAAGwEFAAEAAACABwAAHAEDAAEA"
+    "AAABAAAAKAEDAAEAAAACAAAAAAAAAAAAwBIAAAQAAADAEgAABAA=";
+
+static const char  fontdata_8[] =
+    "SUkqALIIAAAmoHcGf/////////////////////////////////kMgMsfUgeDaOQLjkHHIZAN"
+    "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"
+    "jAbFVthw+gsG4qwbbSsGKDYQQcMSPJRSBwd6dPbSfpL/6f6tdXqx1YVf6XTCevem168GYDR9"
+    "fSutLS/9WxeuqrV/9/wl/7pXXXQ/91p7pXjSW5DRhFH+sLuor///6C//33X4P91bl1pjdJKt"
+    "hovBr4iQPKn/x/X/F////7NAz/v0tavW9aYaXhG3/+YDM2l/zCf///+3+9e3TvSTeglDFegv"
+    "//bS/9v//+vw3/q3Wt6pf0PpfV3+xX/t//3635DNv9utb0R9t1X4/+vreyOGZ/2//+uvyGx3"
+    "/16elvVIjH//Xp3/X/2//3X3//WKjjSeNb/+10rtWyMfX/2//7q0rX6u1d2kraSr/3RdYaTD"
+    "LdsIv2GvJAZ/+w//2GErCCbCLr2EoNiR161b0l/9g0HI6FBimKg2KCB2CBwwQPBA2wQMEDBA"
+    "4MEDhhiFFBisETgwITTCg2vCTDaQ//ERERERZg2IjiIiIiIzAa8REREREccfwgg/9f6X+v+Q"
+    "ZK///0x/+m0sF0q9W0sW6XyGSGkOkI7YSr4rYhAkEGCDrFhCI4//////////////////////"
+    "///////////8AEAEDgAAAQMAAQAAAP8EAAABAQMAAQAAAFUCAAACAQMAAQAAAAEAAAADAQMA"
+    "AQAAAAQAAAAGAQMAAQAAAAEAAAARAQQAAQAAAAgAAAASAQMAAQAAAAEAAAAVAQMAAQAAAAEA"
+    "AAAWAQMAAQAAAFUCAAAXAQQAAQAAAKoIAAAaAQUAAQAAAGAJAAAbAQUAAQAAAGgJAAAcAQMA"
+    "AQAAAAEAAAAoAQMAAQAAAAIAAAAAAAAAAADAEgAABAAAAMASAAAEAA==";
+
+static const char  fontdata_10[] =
+    "SUkqAGwKAAAmoFQGz///////////////////////////5DIBocgZg0PkDwy3JvkFdyB4Qchl"
+    "DkGB7yB5OnZBQ5J8hmckQ0rBNUyDSOkQWnIZXkMqZBrghs0INDkM/kdkDfsLqqhGYKDEHp0k"
+    "G0HkFEwoQaaqCcWQzzCMMPXfwg0m0gi89KyCgekkYmCpppYQKgjc0m//0Yy8/16VtP0EGwqN"
+    "to22ugtBBtJv2vpLdJtJJ1SbTpJKwjnoOgg2swGmFLgiStb3+lXf/69v1bYLpuuR1pLVX//X"
+    "r/S60mwYorKXH/dfS69J/2vX/9UvYyGU699PXXpa/3//4+l1S2EcXqvXHX1qr/8RIMCP17SS"
+    "pwggnqvj1XpClpf1+3SWlS2l/v6S+btbr/IKbknv62KH2Fel/VJeEGlTDS/1W9tJKiGL8f/1"
+    "Sri83qxVr/sQ2K1JBpXel/RAuOFXm29On//YMUk/dhf+qEOuEHQtWG2v+w9GEwZuXj1/Uuw1"
+    "6bnzaSDtF1/wbSI+Sdx/X9IQ6WPCb0YbYr38MvvCMTVv8gqlyGsR/pX/ukkHaS8gqiMOkk2l"
+    "f/pfpOlvXSTYa/9/b2/yBO9f9cTQMzuu4/RBSgnHpJe2l+KX6Wv6ST1j//7f/2lpdf/pfkM8"
+    "el+xVr0/pEMofIZV16+v//9tda/pdZAh1vS+sge4/0kv3fyGbBBVeutK126dLtJLuq+ttJuH"
+    "+FTV/SOR19dJPSWqr6SX2gyx+ur7S0LbS20n/oJf8PS20mwjeNtf0noINYMJBBwwk2kk2kEF"
+    "texFJBiExCYXXTWwwkCBrEIEDimGEErDCQILERBgsQwgafFRSDEIRDCEMIMUIYhQWQyAaHER"
+    "bSrERER/0q90tfukqxbWh3odtLbSxH//////////////////////////////////////////"
+    "////yBTDMpkFsFhyB4YOQyAboILYFByB4hyB4vkMgCIK4iOQsFWQ07IZxyBEeQyQ1PINNLIZ"
+    "icEDIMeWcgoBkFy4IGQIIIoZByCDhkHIInkMEEDFCGyhBJkFzggyDcYCDINxgQMgwoIIGRDk"
+    "EIIp0O0MhjrIPyZDCj0GCD4aOEHEN3CPDDaDTQaapp6bwjxByc2EeIOTmGEcbw1TTT7ppJ1U"
+    "4B46aPGGmQabJeECIJZDPZEmDNhIM2JQIHBggwQMEDBAwSBAwQNo4DdkCHQIGyCiw2gQNkFF"
+    "htBB5cZwWGCIMOGCBhBglBggdBA6U2Ca5c2EbDvwbSayCZh8Ogg+/6C329JvbSb3SD777/q3"
+    "TdQq9INoIN/oL2/9J//S7W9IN9pBvv//tJ720m0tL/SbT3X2/9L/9L+XXSvdK90v//1p0nrS"
+    "+npuXX0vb66X/9Ll0176b/b///eu++1/yGQxyBwOOk63+++ONV/6X8uu3r+l/iOP2t6uk9Cl"
+    "4WHqR8e7r6SH/Uf/S+19v3/f/96dGF7q0kvCw0qCBAn6vpff//pe9e39/3pX/a9XTaTql5A9"
+    "wQ2QEmHWgmKer6X8iPkR1/9L7X30vSS///991bpL1TCCDBpKv76Vb/9f+l719+/W+lD/erXW"
+    "K0v7wggw0qS9K4YIL////QX3+3/pfpMoBq/a9XTTapfWCCIFy4MNL694g/44+P9fdL2/8Jfn"
+    "mzoGZ96dX+6S92ggsMNLS9bmyD///i/v9v/P/6BMP+/r22KS8RCBCGGl+teDf84POD82DH79"
+    "1//5HDL+Gw3+6/a/XhBBhpddK+/9PT//N7/r2/8b9yGpT/q1ek2l9BBuvS6vu9f+yDuRj/+3"
+    "9r7ff/2D/2r16MLpfT9+kh7/X/xf/t+9e39fW2/71q2qV6XsML+qV//jjkCM/9h/a+36+u2/"
+    "/9dU3peGDCCbdtalw/2/93/9v3r/f2/b/20r71frwwyGWXBBVbaL8JK/+l9//t/a+33X1//7"
+    "G+levhh4QIXYqKNFX7fWQR9v/9vIO+9e3uu2ltkND/rHUaTekQw/hhiEE2IpK+l6///7elx+"
+    "33X+313TXX6X5A9uQUQGGEEQa4tKr9vS/b//b/a9jbS20tvX16dJvS/TChgwgk2Gkr6TDILj"
+    "4S/Yf/7f/+2ltpfdbaX6Tfr90GwgtsJd4JNhcEtLb//b/r3YaWw0tu0uDBJp9fSX/B4WGeNB"
+    "NNCEGZkghCCGEGGZlCDCDCDwg2GhhN0GE3YYJBBsMEEEGw4YJBBsV00kw0Gh+1QeE0xCCDBB"
+    "hBMQkCChBsQggwQYQeEG2FBA8IGCBuGIQQYYoINuIQINr8JWCBr4qIiDCERBhCIgygDw1IiI"
+    "tCLhghBghEGEIMJrxER+hEaERDiIiPpaB/0g/SIGwCcdJFzOgGgr6jEGvGgamgH2EL4j////"
+    "//////////////////////////////////////////+QP6EDob+QPBoHIElkDw9kCyyBJBA8"
+    "F7INVkDYDEZDLjyGVCZBXmCqQZPIaUENEAoKlt5A8sTSfV00/S2/6BwdF3D+Dg//pr6Q/+QW"
+    "wbj//MKvrtNeC/9JN1/iP//+vr//+k3////9r///+k9ZeECzPy+IZY5BuP5AuOXhHhDKHL4g"
+    "tOXxBowscg3HLjIGByHHIG9CMci+Qzv/+3BEMyeEGQMUCGQLzyBimgwUgRmRewVNBgqDIZXg"
+    "qYQsFTIEUyGzAUgucuippgmRLIOcuhDFX/pYhPTChGHCNzROBBuKAXpgoLoLBU0wVMIwwwVN"
+    "Fzgqow2icEgoYIGCDBYMK0EGEDClxP/7YRtvl20YOgg6CDYVBNaMXfQXovNGK6MUIJt0XbCT"
+    "WqCDhX336B6apJL/0ug3bpB0nSsGbDZZsNghBsHB9BYNhiE2GIQbSbBsNoJwYkergzYN4P1p"
+    "9pXXX/q3vTaWrr6V1/pf9at02vTX/t7fTaT+l/9Y/rr0370/6XTT0/fr44/6WnuukKpdkFFk"
+    "K/pN+9DWv//6C//S/rq/7+XVJum9Kt0DXxEF9V///9f/991+ZgY+6Tf8VrQSww0YwaXkDwOE"
+    "f/H3X/H////sH/+k2k1dJN6SQYrwjj//Ng1dL/m0////9h/t1/tvpN6SQa9Av//ev/b////w"
+    "3/rpN6ekrelQ+v//sMJf+3///X4N/3t+lt6X4+l6V33hiF/7f/9+t+D/ulr6L70q////+XBp"
+    "/7f//XX5BQO/9/TdJNvpER//16d1fS/9v/919//1emONK71r//0rtb1/9h//3Wla/XrHWrxS"
+    "S//YRdbpsijtourZFfT/9v/9+0E2vrZ3hourW0k26X/7aWgwgmGFYaVsMJJzWBDtPTYaaYTt"
+    "O20oaTYRhUGnUUxV76V0kF/9ioOXQpigxUNiggbYQOGEDwg3CBggwg4MIHDYaCimIWEHDCCa"
+    "ah9OrDeP/2ENBoNMIQwhbERxkcMgYqbQTCxDEJpoX8RocfxEREUYE4jiOIiIj/2En/r/IG5d"
+    "J/1/////H69JtLIH9NJf3S6uq9ISh0CxdL8gt46iO2kl6FbYSCQIMIHWGISCTCbWIiI/////"
+    "/////////////////////////wAQAQ4AAAEDAAEAAACoBQAAAQEDAAEAAABCAgAAAgEDAAEA"
+    "AAABAAAAAwEDAAEAAAAEAAAABgEDAAEAAAABAAAAEQEEAAEAAAAIAAAAEgEDAAEAAAABAAAA"
+    "FQEDAAEAAAABAAAAFgEDAAEAAABCAgAAFwEEAAEAAABkCgAAGgEFAAEAAAAaCwAAGwEFAAEA"
+    "AAAiCwAAHAEDAAEAAAABAAAAKAEDAAEAAAACAAAAAAAAAAAAwBIAAAQAAADAEgAABAA=";
+
+static const char  fontdata_12[] =
+    "SUkqAFAMAAAmoFsNP/////////////////////////////////kMgNpyBoLGQPBocjfIEkED"
+    "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"
+    "8RIHgYPv/DC//+v//7/ygDH/dbprVIJYbRuBhLwRmv/x9pf8X//v/7B/6V17vShh4QVBj8I8"
+    "f/4L6/5tP////Yf7fq2vfTeqQa9Av/5wNS2l/7f///+G/9J66vVK9KgYXpf/+w0v/b///r8G"
+    "/2+9+26Sf8fX6u/2K/9v/+/W/Iav/6WlaSL71S/H69f7wwv/b//66/D///pb0v//16vouGp/"
+    "2//3X/yGU7+rdOrGrd9EKP/+vttr6/+3//daTf/36xVJNukkv/66Xe3pf+3///Wv16sfpXGl"
+    "//aLraTbYRhYZCPp/+3/+2laTYX1u0XWmnV9L/+wl3CbIjsMJbDCXIwG//Yf/7aVoKGEbXus"
+    "zthLfqm2kl/9iFMwXBhJhhJiFMwzjIMEWQYRBkMEZBghhkEIIYIMRMwwDg2GlDCTELIMaQwS"
+    "ioqZgY7glB6H/7XL4pimlYVtp3fbV3dp2xCimF6EJ2uq92v/2hoMIMINCGEIbERxDBCIiIhh"
+    "TeEGsQwmgwhd6EccfsREREIwE4jiOIiIjX+Egf//1f9f8gVq6/6////S1H0vSb8gfo0v90vu"
+    "v0m4WLrXkFsGsdRHtJL7S2GCCr4rDFEDwUYQyQ0yCCqGlhgqXaxERH//////////////////"
+    "/////////////////////4AIAIAOAAABAwABAAAAYwYAAAEBAwABAAAAeAIAAAIBAwABAAAA"
+    "AQAAAAMBAwABAAAABAAAAAYBAwABAAAAAQAAABEBBAABAAAACAAAABIBAwABAAAAAQAAABUB"
+    "AwABAAAAAQAAABYBAwABAAAAeAIAABcBBAABAAAASAwAABoBBQABAAAA/gwAABsBBQABAAAA"
+    "Bg0AABwBAwABAAAAAQAAACgBAwABAAAAAgAAAAAAAAAAAMASAAAEAAAAwBIAAAQA";
+
+static const char  fontdata_14[] =
+    "SUkqAKINAAAmoCAz/////////////////////////yGQBw/kMgGYcgw5DJBpvIHg1wR3kCuC"
+    "B4NFhbrIHiwnZAxZFjIafUQ2+BJJshrRkGnyGtBBqmQ05kNqyBcQQ1YINyZBRMhpfhf1CMwz"
+    "S5hqg9W4aggwoIGCDCWC4QYIPXrwR1BQm6Wkm6pGzYKmn2EFQRsgwjhB/9UjeXg0m1RifVkM"
+    "t1VBNhUGE1pAtBBtBN//hBYdboJOkk2nVJNgj3R4s8b8JUk6TftfpYfdafV09VbQXCDcEHWX"
+    "BWCmAIraTf/9eldL0ld1VcLp6bRddKkqff91Vf9fXbDeqtwum0v9L11v/+v+uqSwxR+rx/3S"
+    "9LS+vfqtf9da7DHr+/pel/79f1/9dKr5Boha9Lr/9L1/a/8fXSqsI/ev/HS9Kkrrv/IZ0n9V"
+    "aSXYIEU467ePX6j2v+I/tqulSulfX+qX0ldf/e9U6Q9wr1X6pfJ+u2l/kFqyO/tJYr2vr/qv"
+    "BA9JhpX/XeG0qqtq9f1SS9NIl3DS1/pg8MQlyJWuP/9JfF4QaTFN//EMaVd36/SIZrhNLnCe"
+    "EGob1/2U4bUJ/cLX/iDXQQb06Ydr0uw6RvZCaePX6V106EwdK2GF38NqQnJOzgE/1/SkcbS2"
+    "nhBtQjc2JfX6kGrSgjDDW3/r+hDfi3CekEG2v62XmoQTdN/kDgCIKtS/pOl+2qQba/IHCTD0"
+    "rat//X6Ta/XSuGEl/htaur/0v9et91SbH/+l1evIH0a/pOhJAaf0t/ogtWRY3Wm9v/GutLX/"
+    "S0sdfpfbS/X9L/0t/r9L9v/pv63r19L8gXH//tL9ddKiDVn9fX19JfbFPXXWkQan+npekv//"
+    "99df0tLIbHW+vXIHjj11S6bf8hrWQJHp/Sb/rVfS01/rddu/BUH2lpaW2k9JNpJa63pJX3D6"
+    "6TX9IoZddrf+gvrvS3psIMk7/9N1odpbpOkraQS/70km0mGEcxWvWrpJqwwknDCCbSStJL+o"
+    "PCW2EmKDXWtUwwkQy06xCINQyKYaWGGEECC2vDEQkgxBMINN/TSsV9bCYhJMUCBYiJBppiGC"
+    "DC0hxoMIRBghYIMIQwULIZAHDiIvpKIiIj91X7qtfdUvuklXtrS4t0o+lC20h263SxH/////"
+    "////////////////////////////////////yBlyPyBmCy5A8NUMhkrQgaA6CB4NKCB4ZhyG"
+    "QBxZCDkHcg8EUcg3cgr35BbB5kGw6kNRQQ1QZAgwQaBogwBkGgGQ0VkPWQxWQxWQxWQShBes"
+    "g0oINBBDCCDcMhmJyGWrIaichmKwQMhoEyD1kEDIPUQQiPjIMTIaOIL0IKMIEDc8B4WCBggd"
+    "sMIMMgYZkOCDDQYQaDCDShoNwg7QQMMGEDYYQeGE0GEGg0mGk1uutMIPBnthGYRAzwIGQaMO"
+    "nIKMPWEZhiQL8DBEMrgYIhldOBlngbcEDZDKgIzEYM8EYRmIyGbhCURwJwZ4C5gFAIGEGCwY"
+    "QNoEHSr7CMxA03ISYQIgxjkGJ5BiMgvCBB6apqkqtK9AgYbg2gQMPBsIINTAU8FT70/T0G1m"
+    "A2L5gbRwF34dBB8N/4QT/+gv70E3toJveuv/XT20m6pfSDhBBhp7aT4b/pBV/6Xa3oIN7oIN"
+    "7aT/+3X7aTpaX02k/ul7f+k//pf+k/aT+v1/+qT1daX/TaML6Xt/6X/6XMJowswnre63vX/7"
+    "ave2rpaXi6Tffpff///hL/9vSb9Jv1//6/0m168hkA3H0np/r3xxS//S9tL2/f9/xHH/tGF2"
+    "6ehXwpA/foh7bW/Ue/Uf/S//b0r9K//20vtK0rSS8LDpIEzZ19Vv9f+l9pf+/7//+9e6vpeF"
+    "hrhHmR/at6r/r/6Xv+3r9L9X+2lq3t1aSXkDyggYgJMHSSCjf+vvIO+Qd//0v0vb6/q9f/79"
+    "LSbSr00wggw10mtJ9Kt/+v/QXt/t/ev6V//pPtpevqmEEGGlr/eEl//X/0v0vb1fpX6Yf7aT"
+    "98baSX3ggQYaSSXpPhAv///9L2/2/9L8JSQCr/+vadJL/CCDDS6r7j//+P9L9L//S/CTNYa/"
+    "3S1dJq+vpoIIg0AQYaWv1yXDZ+OP/0/b/b/wl+ZDIgNP999+6S+00EFhh116vOCB///xf6Xt"
+    "/5Z/4Jh//pe3el4iEFhhpaql3g3//OAX/ft/t/8L9wb/bSferYpLwghBg0F9aT7f84D5wH//"
+    "Ob/S9v/H9shr1f/1arpeEEGGvX97f1///t+3///7kFU/7pWr6MJtV4QINpeqST7////7f6Xt"
+    "9/f2Df9//7r8IPX1xfd6/9kNGn/t+3+39fW2//ulaSTel9+36Xu//7//t/17e/v7b/tpe+k3"
+    "pfDBf1pf+scchld/7ftr7fr2u7//1ev14MMIJvdUpgGH96/b/+3//919d/71a9U3peGGEE7d"
+    "yOqSX79e//7ftpe3v/7f/avuqV6+GDINYEEEO2EnCW39/9//t//t91t1t/09aV6vpeGHhArY"
+    "qKLtL6fSyGd9//28hoftL2/X12yDd69bX/Sb0iGx/DDwQTYaYSW3rel/f/7f7/t7dbdf/f8b"
+    "1V9fhhiEE2IpL9N6/t//hv+K9vbXtdv/V6qNX0vyB5QQy7DDCCINsWtPq3pft//sPXf/tLet"
+    "vS26jd0r1/TBIGGEEm2l3pN6X7f/7f9extpbaW3a9r1Svpfrhgwgk20l9JhkNj4S12H/+3+/"
+    "u2lsNL+uwk19N6S/dBhhBbDCVN4JMMJYIL9h//t6XXuw0ttLbhhLYYS/Svpf8PBYYMIJO0KY"
+    "MFQhIUmwYVNNPTbQ03TTdhhBJsMJJtwwkmxVNOraaH9JB4TTFEFAZDGqCDEIIIg0AZBisMUQ"
+    "z1kPWQxXkNlbBhSC+mQlRDGmGKIZVYZQwiGVWwcQiDTW0/QJQZDKrX2sPCaBgvRTg2BIhA0u"
+    "GS4KP+/te4YLDEL2Fhr+n/xoREGCERIKgYiJBVDERxERxEODBCDBCIMEIMF04iI+oiNCIkDw"
+    "1bEREfrCB/WEH60gf0qMMH6VIIGU4GoKfSIEsGKCDV9UQNA9IeNA1JAHnhD4j///////////"
+    "//////////////////////////////+QPkEDMFW+yGQBPBA8NSAmQZ4IHhqQQ2oIEoDFkGuC"
+    "GlHkDwN4ILMyB4NM1ILMyB4NMyGrNLYeQPF4g14kFC4UgqQQLwFCpbe9pEGbiB4NfIu5As5N"
+    "Mg34hr9X+qu6Qd1t3Xb+0vUf//9G1/S+vIGYZj//tr67TXhf/S6/xH1//bX///9L/X///bX/"
+    "//9Lr///9Jtf/////8l/kNTiHwg2f/+k3LhpGgZclMhqeQaJ5Bp/INU9BkGiCBeMgnZDLgIM"
+    "IMhmwgyDXMg1QSmQ1KE3IF4JYQUHyGbBBdyBGhJBDXchrcQfCC4ZGggwE//xCDwgwQMIYIPJ"
+    "OCD0wUF1yCj00wVMEDBUGEMFCgg8gY8h+8hjRSEQE1//9JsJ6YUKEcMMIYRsjqBFMhsOC6BY"
+    "KmmQ0HTRsgwUINSDB1RgcI6BiCgz4OCBnwSDBBtAgz4OCmARf/thGxvTCOFCODoINhJJrRg3"
+    "+gvRt0YN6MGwgg3phGxVqkGgvvvbh6dqkv/S6D6MDaCDoIHS9J9BByBjCDfNLIGJhtJyBfEE"
+    "HSbIKMRgVoIHIKMVJ1IaMIJnTrTaTpaX/7e8Qm0mknSbIN8VnAMCn/S6YpuKem4hB0uJdpcg"
+    "oz3+9tb//9Lq6DpaTr9XV/hBdV1avTaXQff+61S66pL/9t3r/6b1en/S6aenW/Xof/dW/bSd"
+    "dL8gpD+lj7aTrr//+l//T02vVj/1ownTaV0KSW2QzMv6b/xr///0F//39ff9r1r060luEDXx"
+    "ELuq///+l/+vv/B/vTa3TFeqWw0DS8hkBoI/+Gv1/xf/+/r7JAZn7+n2m6Sr0bMMJeQyAXmb"
+    "P/j7X/v////Z1Av90v19UmHhBJBj8I8P/8iAMXr/nE////9h/3tpN03dJN/QYXoL/+cBs2l/"
+    "7f///+G/3S/W3XfSSBr0vr/2GEv/b///r8H//W6+kr9ofS//9iF/7f///+Q16f39Poum3pfj"
+    "6X93+GC/9v/+61vwf90m10lb1S//9L+9mA1v+3///X7/39N6T3SX//07r6X/t//v+/kMt3/d"
+    "LX0rdVId//11u9vS/9v/+0tK//19jikm+q//16bbX1/9v/9/rX69YqnVtvS//tdL0XWyDj6/"
+    "+3//aVpNr39our/XFJf/6L+GgmGQo7aW2vf/t//t1DSsIwvpWW8NL6pJt0l/9sJcMJMMKwwl"
+    "sMLyXAv/2H/+2lDCCYaX2lFMVbTurdKl/7EKDiExTFScNAogRrDIMazQMHUGJAjVsg+pDGpt"
+    "JOCHUQ0DQGEopiFkCKoYSdqThlfBKD0P/60Y07WGFt/+wuv9iFCDXxCaa3pqnf/8MIWgYQME"
+    "DCEMEIcRHFghEREQwU5BBhYhhNBhDT4jQ4/iIiIhGw7xHEcRERH/0g/9f4Sf//yB+Bf+l/6X"
+    "/9f/+ra+PVfXWCf/q2uC6r9NoLpuq9RHHS/IGeOltpV9rtpJehWwwSIHg08EDCDrDEKECDIM"
+    "tVYYIfaxER/////////////////////////////+ACACAA4AAAEDAAEAAAATBwAAAQEDAAEA"
+    "AABKAgAAAgEDAAEAAAABAAAAAwEDAAEAAAAEAAAABgEDAAEAAAABAAAAEQEEAAEAAAAIAAAA"
+    "EgEDAAEAAAABAAAAFQEDAAEAAAABAAAAFgEDAAEAAABKAgAAFwEEAAEAAACZDQAAGgEFAAEA"
+    "AABQDgAAGwEFAAEAAABYDgAAHAEDAAEAAAABAAAAKAEDAAEAAAACAAAAAAAAAAAAwBIAAAQA"
+    "AADAEgAABAA=";
+
+static const char  fontdata_16[] =
+    "SUkqAHAPAAAmoCQP/////////////////////////////////IZJx0QyQzjkM45DJA3vIHhr"
+    "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"
+    "/0/f+/8JfmIYP96un23SS9poILDDS6rSeeCB///xf6Xt/5ZH8Ew/73XXvS8RCCwYaX6XeDf/"
+    "88GX+H7f7f+wX7hh/69XVsVXgghDDrX0vb/ngfPA//57f6+3/j+2Q2hH717+6+EEGGl0l77f"
+    "++//7ft17f/+2QV9f7W19PS8IEGHX6S3v9b7//t/r//9bkFNH709NqjabSXwg2v/T93///+3"
+    "7de33Xf2G/7/6S9L4Qer1SQvf1/7IN6v/b/X2//9sP+66V9N9fa79V+/X+9/+37de3v7+2//"
+    "Xvrevwwv6pX/+OOQzJ/+3+vt+l6W//e2ukk+l4YMIJ7fVGwz/vX7D/+37df9/f2/7pdXpN6X"
+    "hhhArfRdUqf36///b/X29//b/7/f768MMhqiYIJrbS0Et/f+//7ft17fpb1t/7paWqT6+GHh"
+    "BC22lpU/vpff/7f6+339r/6X33SV6RBRHhh4QVsUxCJ2t9XrkG77f/7eQUPt17e9b1tkC8V/"
+    "exv76VeDB4QThhMJa9W+v//9vX/77S7S2/73Sr0m9L8MMQgmxGlf70tdv/9v+K99v39vS3X9"
+    "ikr6/IHhYINEBhhBEFS7S70m9L9v/9v9/b3S20v/umKrV9fwmChhggSbaVP03hLrv/9v+vY7"
+    "S7S29L136b0v7UMMILYYSW9WGQLvpft//sPS3/bS20tu67S90r0l/oMMIJNtL8JMMJYS1ww/"
+    "/2//3YaW2lt2lthWqpX0v1w2gsMMElbwSYMElIOfW2Gt3fbarbXuGwgrYaCu7CVsGEv0r6C+"
+    "6QPC2DCSpoQgxoQkNWDCqq6txrppuwYSUMMElbgwknFe6tpof1h4TQYhEDGpBisIIMIIIg1C"
+    "hBgQGIRDQIIIIIYEZBuIDBhSC9TRDjCD1OxCIZohiEQzRDBxCINYwNNNUCTBkMsQvtUHhNBh"
+    "eiXBVClWGrwZCAX/7r/4YWGFuGFhhf1/44iIMEIiDOoZIaDUGQEQiIuIhwYISCmGIgwQhgvx"
+    "ER9IRHERIHgrwIiI11hGgGwCzroO+qCB+loP9JGCNQGwGXpECYGYPSCBkuBsBt9Q0qBr0ooS"
+    "GciHjQMJHQDx6IGobv8IRx///////////////////////////////////////yB49PIZIsED"
+    "wZIIHgxxA8rIHgqWQVrIEsM2yGnZDUvyGQoIM8yB4KnhSB/MgeDZMhtTCWw8geCTIamBIFIH"
+    "g2IUgzEEFeCGXAKC1t7rXrpp+v9WpA+4geCryMHIHvk0yBfiCp1b7ql6Q/+vf2vr///o4tel"
+    "015AzBmj/6tf9prwv/q/64j4X/0rS//r/vf9f//0rX///+m////9df///6b////1dL///+rg"
+    "iGpTIvkG2ZDS/IaX5DUpkpkNOCGXGQf8hmOR+QTyGnBKZDXoQ04I5kNqhJyGVBLiBc+QanIZ"
+    "4IZ4ISCOCOCDa5BUwgvxBeCJBFciuQz8Qxf/q4gg8EDBAwgeCB4IPCBgoLrkC/BBhBgoQMED"
+    "BQgYIGFBQoI1gokMzgWOMg9VkKGQwdY44//qwnphQhhHDDR1BQbJnnpkFCCGdGlkM6EGgyDc"
+    "hMI4QZBuhNDIEIVGx0ageQqAZoGAQMEoMJuCDBBhL/6unphHChGxwgg2FCCY9P9AvCp6aCDe"
+    "gwjg1qEg0F9pphbCB0mg1MBhf/Vo2K9GyYQQcIIHScKrWjZMgY8go/QWQUejhsI4bIGPRsmk"
+    "2QL+jZNAg5BR/ThSBHkMe9PbtpPX/+r0H0EG0g6TpXLx4MtPEJ3fS2IJiE7EJ0m3QINhIO6p"
+    "Pu/6039aX/pXvEJtLSDpNj8+GWn/S6aenVuKDpcS5pXIF+9tJu1dJ1pL/6em6etf9J6b/QXT"
+    "TdNpPTa9P//61aXWl/63/q6Wl/1/pdV19/XQ//dft039Vv9Nj03/7evv+l7vuk9Nr9j+6ujC"
+    "aTpaQqvZBp4gQ/q/6Qpa///hL///S6v/q/7SvSrcINP6t9////9Bf/97/3+2vTdN06SSWw0D"
+    "S8RIHgrU9f///0v/1//ZQDX/3XVj9IILDDQa+QyAatP15OJ+v+L//39fmoMz91dfTdbegpsg"
+    "0vIZAZlDd/8ff/3////sH+66tpPqkw8JJBivCPj//KgDF0v+eT////2/+nr3fSb0kga8IF//"
+    "PBt7S/9v//+vwb/bW1bq7SSfqg16X1/7df+3////hv/r9b9K/wwvS//9hhL/2////8g2Eft+"
+    "l0rdfq0P/93+GIX/t//39X5BUn/pN7ejG9Uvx9L0v/Bgv/b//61/D/39apNvSX//7v3y4bf/"
+    "b//f6/IZkP+6Wr0t2qX//1d74S/9v//X2//19+1Sf0iGH//XX1vS/9v/+60v//bWK6Stuv//"
+    "+m219f/b//f1tfrtetjpvVJf/sLpdq3r/7f/9pXTa/+sbWk2xSX/9owtoJttGFhkHfT/9v/9"
+    "urQTa9pWSHbRftbS+lX/thBcNJhkOOwwlsMJcqwyv+w//20rCUMI2v9pwwl9aTbS//xXDCCb"
+    "CsQrY1hra6sGtrrbaUNBMQtbSYpit/VvSBf/ak4ZzCFMbUkBsRDPU2QYrlAOawzyBFbkHrIP"
+    "WauUA5rCFAbGlEINZAhPDCCpqUBmp2gSg9D/9hdNNBrDC2//YXX+xCnkmF8U01vXTtf/hoaB"
+    "hAwQaEMEIOIjiyOGQCwCwwgYWIMEGgwh/EccfoREREI2CPEcRxEREa/wgg///hJ/6/0n/X/I"
+    "HiiX///pdfT+n/+tpePX9fhfX1bSyB49NKvptL7/1IHg1wEYA1CxdKvSEdtJLyBmDU/2l/YS"
+    "2wkl8eGGEEQPDXcJBBhBpYYhMQgQMgUVwsGaAeCsF7WIiI//////////////////////////"
+    "////////wAQAQA4AAAEDAAEAAADOBwAAAQEDAAEAAAB3AgAAAgEDAAEAAAABAAAAAwEDAAEA"
+    "AAAEAAAABgEDAAEAAAABAAAAEQEEAAEAAAAIAAAAEgEDAAEAAAABAAAAFQEDAAEAAAABAAAA"
+    "FgEDAAEAAAB3AgAAFwEEAAEAAABoDwAAGgEFAAEAAAAeEAAAGwEFAAEAAAAmEAAAHAEDAAEA"
+    "AAABAAAAKAEDAAEAAAACAAAAAAAAAAAAwBIAAAQAAADAEgAABAA=";
+
+static const char  fontdata_18[] =
+    "SUkqAEARAAAmoCq/////////////////////////////////+QyXe5DJDVchncgthMyB4NFk"
+    "TMgeJBA8FKE06yB9ad5DbxIgScCpNkFYdSGnQgrOQbKENqhA3ghmWQz2QVRyBxZDMoQbJ4XU"
+    "g0YQl4IHhBhUm4OggwoIGCBhYwQZBuJggYIHhf1CJwazjaSdJNpqEGFQaYWgSwmg9d6yGanQ"
+    "Qb10m+gjxMKEGEGlhAtHhhhHyf/4QaVpIw3rZBpelQQbCpp+EFSCDaCDe/XSOMwbSfSDpJN3"
+    "1TYKqMyraC0nQTfT/pYaW0gv06dKk4Iz8+K4Qb9BUk2k/+ugt9+npbTXVtBcINwnWYAnTNg3"
+    "77f1+v1aS+k3dVXC6em0YXSqkrSv99UvX/S8N6q3C6dJ/0tLff/r9/S6pJsN0RB6rH2/S9JL"
+    "XX/r0v//WwxRfqt6XvXpaX1fv9f+lqlThjrf+tfS//////6pbdf910vrS9X+tdf9LSWsKQ1L"
+    "pfr/9fuv/f/H+1rcIzH+v8aS9LS17/yGwU96S0klsEf2OvePpfj3X+I/2v0l4Svr/S/SStf3"
+    "/9JwkwqevXf9L+m6/rvdLihW6vpfpL8jmktpf5A8WyEu+6She16/rSXggekwwgr/XvbXr2E3"
+    "1/SSXgmpHPYaWv+3tpJNEGt/H1/0viHhBpMU3/SyGoYhaZCg/v/0gSS7oINWtf9ifDVCSC6T"
+    "/X+Qa9Pnx1Tph3/0yEAkpr3Ba/pQaXBBvTUMNtf9hpI4mD+PX9JpdBvRwnV2F/2HhBOQxhFj"
+    "9f1mBh/TxBB0gjiDYYRxL1wbSIP6Tdj/X9QgbSxdJtQgg2xX/kNVPhA6t/1/SF/unpINwvel"
+    "DMbSCOG1b/IM4vX6TaW9OqQOGvogzCmD6TaT/5BSEL+k6X7aSTbSX+G0km+/9f+r/r0nDBf+"
+    "/TpN/9V1paWRjv6VNj/+kt7deQPBe9f0nQj99XS8geWEJe/6t/61fpf+lv8Kv0qb7S/FX9LX"
+    "9a6x1/X2/+v0v/pXX/0v20v110t69fr6IZcf/vv9daVENXt+vX/9L7bS6/9SGo//S9Ja/1/s"
+    "Va6t+ldZAu6V6X1/+l9tf11069//pZA9RX6/T/5BWhddK63p0krSSwnr9JOtsP8hteQLMpv0"
+    "tLtL1fS7/177Yb1qmvWk3X7aXaSWv/SXTcHr0nTa6IGBDXbSvSeku+r0ttJhhFIBO/XXS1tL"
+    "tJ0u1CXroPSSdWwj3f/ptJNbQSbaTaSTaQQXXw8JbDCCiE1117DSIZsBBlusMJENSAg4YQTD"
+    "CSsMIIILetkNQgkmKDQYVr00rFRGrEKJrDOKYqmKCC2FqDEVgwmEGnodqmvhbCYShhAgsREh"
+    "phpCDBBr0hUMIRBhCGCDCEMKCyGScCItpdCIiI/6S+9VX2uvvSX9qlXvWuraSVYtpUO9Jdqw"
+    "ttIdtLbS2mFiP///////////////////////////////////+QEwate8gaApwQPArqIZINtZ"
+    "A1DU1IHgpaEDwZCCC3wQPA4jyC2DJMgpIyG0BkFdQQUCZDUKSBAuQ1CZAuDIYBkFwZDAMguD"
+    "IYDIMAyGpqQ19CGNCGYnINYMg1DRBUBkGsbBEYDchgQQwwQYLlOGCIBc1A5GAxIEVENnkMqZ"
+    "BihBp4hoK5OB4KJBbBU1IbYxODBEaDORcGpYIH//63hA4MIHBhBxX/+QXDUJrwsIMIPDYRoC"
+    "MMGHDhGgOGGCDBBggYQYLDBBuEHDCCMw4YYYRmHYYaPBA3DBBhMEGEwSYYV9112EGpBXoQiA"
+    "gQNEDFCD6EGs5B6EDByCUCBA5AxQhmUIZtCGbQhmUR8Gg0BSonDMZBrwIEDZBqOQiAgQMMg1"
+    "nIQgIINZBvQg0YDNAzQgYLIKMdHAb0p8C69MIoCB3QdBB6IaEMIhsthEM9oIGmmmmmqaurpB"
+    "NsIG0E2wgbSDzAOZg9qnp9yGUdIN1BV84NozBh7hsJB3BvfdBP/6W6tukGHhtIMPDaT/7v6a"
+    "Qbw2lST8INhAgbT3QT7f+En/9LvvSb2wk3vXX/dfuk/pekHSb+0vDf+k//pevpP9P6T9P/uv"
+    "aVpf/aCDae6Xt/6X/4QX96Te2k3t//7pd09OlpfTpN/r7f/X/6XazCek36Tfpf/3+rat1per"
+    "03ML9Vv/r/+lzCza7et7re//+62vaTrpeOk636X3/pf/pfaXt9P9P///dPe9XX/pXT+vt44/"
+    "/6Xv/et+t+uOP/zCpNpNpCl5DIBocgeDj9Ot/Q/6Q/+l917+/7/j+6Wt+rpJeFh6RDH3T9Lt"
+    "+v/pe6+3pfpf/9/vt1el4WDrCDNzrev/1/6X3Xt/f99f7q2l1pOlXhYapBH2//qv//9L3X2/"
+    "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"
+    "3rmI8DTd/Wm60qS/9Lp4p10nSfVngzQg/6XCYTwg6txTpcQnVx/6e90m66//b7ptL3W+rq/0"
+    "F003V03Ta9Nf+2utWlrpf+l709Ol/77/hL/3Xp66f/+r1bS61//bHq1/SfXr/S6p69utfHH9"
+    "906em8UktshpYQ2P6X7+v/+/6Xv7pe2vV/2lzH7S1S/CBw/2/0hr7//9Bf/7/X3/9+k2r1SW"
+    "2g0vS//1///CX//e/8H+2lpXvVqkltoNLxEgeBORvr/9f+v/6//shhp/991iulBAsGDRww18"
+    "hkArV+vx9//F//7+vynBo+3WldNN6QMPBAkgwYS8ETv/9el/3////sP/W999JJh6SQYrwjMX"
+    "/8pAy7f/zyf///+w//dLSt+m9Kg16Bf/z4K+0v/b////w3+3X3vapfpA16X1/7aX/t///1+D"
+    "f+tq9JvSvpYYXpf/+wwgv/b////wb/bp6tbvSv2h9L+7/Yr/2//7/vyCuR/r/oxvSS/H/1/8"
+    "ML/2//+tL8H/erSel36/9L6/vBgv/b//f/8P/a/apN2kl//+22r6MArf9v//+n8g1O//TpPS"
+    "Tb6//+l/4S/9v/+0tb//Vtb7VK70iC8f/r1drel/7f//9f/69R/vpJf//q2+3pf+3/+3Wtr9"
+    "er7T0k231//YXS7X1/9v//StJtf+1j40rikq//RhbQTDbRhWyBA+n/7f/7faCte0rtG1qnSb"
+    "df/20uGk3YS4YXv/2//20oaTYRtf7Juwwgt3pXpJf/sILgwgmGQsMMILYYXlIGZ/2H/+2lDB"
+    "BMMJfDSjiuvSt0l/9irMPFMUxVsUnDTtPTYaaYTtO2GEopiFoM0WEmqTenVukP/6jmEnakgC"
+    "6IaE7DIMDJIDBThokNCdyC6cgunLGSGCEYHJANxChMLIaBEQqakMGn0CTB6/+wtIMINBrYLf"
+    "/2F/+wp5INegmmFtNPW//4NDQMIMEDQgwhBsRHEMjhkhAsGEDCxBhBoGEP4jQ4/iIiIhHATi"
+    "OI4iIiP/hBA3/X+Eg///pf9f6T/r/ZA8OLf//+l16T1///a6/S+k9aj//a5Arq0q9JtL//wY"
+    "YQLdtKvSEcdV8gaIddtKvTS20kvj2GEkvrYYIIgeCsOEggyB6sIOtiFFEFsGRPE6AZgsLDCY"
+    "XsFkDYDScREcf////////////////////////////////////4AIAIAADgAAAQMAAQAAAIEI"
+    "AAABAQMAAQAAAIsCAAACAQMAAQAAAAEAAAADAQMAAQAAAAQAAAAGAQMAAQAAAAEAAAARAQQA"
+    "AQAAAAgAAAASAQMAAQAAAAEAAAAVAQMAAQAAAAEAAAAWAQMAAQAAAIsCAAAXAQQAAQAAADcR"
+    "AAAaAQUAAQAAAO4RAAAbAQUAAQAAAPYRAAAcAQMAAQAAAAEAAAAoAQMAAQAAAAIAAAAAAAAA"
+    "AADAEgAABAAAAMASAAAEAA==";
+
+static const char  fontdata_20[] =
+    "SUkqABATAAAmoDgf////////////////////////////+QyQy7IGwGXPIZILLkNA/kDwVrIW"
+    "3IHgvBA8FqE00sgeC9pp5BWhIFSvIHhpOQPDToQK3ILYb01TTINOELmCJwypBY8FVsgy2kQ1"
+    "6BSCocEDBSDQBEFfCBcWINJwQeF/qDCDSCD0m4eCBhSDZWEGFwTwQMIPC1VKQa6keMPTpJu8"
+    "IMKEGmuECwg0fIP3dcIGgg2kE9JukkeGwqDQaWECwj42EEG//wiRhpN6ON0lZDSetBBsFTXw"
+    "gqQQNoJv/9HnJetpIJ1201SSbCpo0JroLQTdP/+EFh6b1ekm060mwRp5mNwQb8JUrat//1uu"
+    "kk+laeklhBaBA6QdZsCsKcAwqdK/qukv3/pXuvbgum4TaMLpUq3T7u9KltVaS61bfpcLp6/p"
+    "Kqp1vr1/1/qlcNpJK2wvfdL0tf3//X/S+qsGMjvrHpuuvS6XS//6//SVWw0c6X/q6+lr/f//"
+    "/pfXhj1b/9L0uv3+mvX/9JJLyGtiX9PX+uvr+/VePpf7YR9f/XGkvqquv/1X+u0klwUi3pL/"
+    "/66Wvf+Qbi/uqWklVhGaY/Xj6XpD3X+I/37pVuCT/36SX6Vpf1/0lpQl6vS/qv0lbr/720u0"
+    "h7hX+/6XkWfVpfv+6pRVbXpL+kvggaqw0r/IHgmELd7aWwldq//SSrwg6qGEtfpW9hoJKu2v"
+    "S/0kvCakWisNL/Xg8MV5DNp43/9IL4h4QaTEJv/4wwSSkEUf6X6gklrhB0+v+yXBmprW//0Q"
+    "06l5mK0k1DDv/5JgUIJrvBf+lB1wgbwnTDbX/Yejyh1sdL/tLhPo8TW9fqgw0kmyC/Eu//0k"
+    "cGH9NxBA2kEGwwjaX6hvIYmleP6X6UEG0tp0n0cbYYS+lyGqESCDSd//+hbXF4TaQSBuK/8h"
+    "tJ8I8w0m/9L9J673VINsL3+YbSQQbSv8gflZA4Cf6TaW9dJBsNJeQPyjD6Te3//+k/+2lTtf"
+    "+G0ltW/+kv0rS+vScGC/9+nr/1+utcijv6STY1/6S3t1/SX6vEfuu6/7/q3+QPDZi7fpa/0r"
+    "/RA8PhC56VN7a/il+lr+tdY/+vt1//pf+krr/6X9/6WulvX/1//+2k9f1pUQ1/30vS6ohmv6"
+    "X22tr/6RBsH//9dV+v9uv0m/SC110vVf/pfsV/9aTrkDELel6X//9tfpfpXX06/pZA8Hj/SS"
+    "6d+sgy3uul+39JWklhB//utsN/BSB4b4lddNpeler6X1rpJX3DtcKn/pdbaTpVpJaa1f/TcP"
+    "+k0m0tItXaX16t0l+vpJOkw0GQg71r7+h2l2k2lVqEv+Hpba2EeRrn/S9patpJthJulbSQX/"
+    "D0km0mdWmKtfdJtJNYYSuGEmwkraQS/4eEttBMQg09de2kQaUiygwiGuTk5ptKmGEEEFtexE"
+    "JJimgwv+kmDBLWK2ITBgkrBgkCC2qwYWDBBhBp0hSDWGIXwuExCoMQgQLERIauiQhggwr8Ug"
+    "whEGCEMEGEIYUFkMkMyMgeC/EMu+qwZwMgMo4B4axwDg8B4axwG0LxEW1SxEREfetL9Uv26p"
+    "L9JfVvpL20kv+qSxbSUd1S26YW2kO2ltpb1tNYj/////////////////////////////////"
+    "5AWBqr/IGoNMEMgk5DJBaGEDYGKyB4FlZA8CjQgtgYghkJ/IGYMUIHCLIKgkCKsC5QCHQNcl"
+    "oaCWBqlIGYVAMFWGCoBcqwXKgCDoDBUBrmoFQ1Bg6g1EQGmVYaREwZCrDSIoCqDIGKEDGhDC"
+    "ghnGEMAyBCchgvZDRWQUYQzaENEyGlMhsBfBAyCuMWRYFYjYaBKcNPQIiYF//9reEHIuG0HB"
+    "hA4r//IMEZBcOuaAeGnCDBA+wg4Pwgf//94QcMIOGEH/+uE1tetMIOyDIKBFAPIKCwhpi5DK"
+    "FQigGEQzCCGaQQzCCGaQQzCEaBmkgFNokBlshpzCJwcMhpaEQgInBwyGloRA0fD8g3IINPkD"
+    "CCDTMgoRkDE7R8NDqvTCJAQNQzMEYQIhsoGZgQ2aBns0BiEaAXtNNNNIJp6baQIG2aAu0CBt"
+    "mgLsIIPtNO01YaIGEUQMISnwy9do0Ah3g6CD5BQG5BRbkG9oIO00000gmm0naCCDDcNhBBhu"
+    "G6DzYYNAxap91oNpN1BV84Kwggw120EHwb38JB//S/vSb20m90nrf+vVtJtKkvQQbQQbvcJN"
+    "Yb/0E//pdrekG9tIN7aT7/v970/pfToIN+2gvb/pL/9L+9Jv0m/S//tLWm1bS/90m19L2/9J"
+    "//S770n3Sb2+v/fb/SetL0m0E97r7f+l/+l6za9X3X6//3Xat02lpf6TaNr9e3/1/+lzac2u"
+    "3pN7pN71//rrTaT1pfT0336Xv/r/+l+v3q/q///71362vXjq6T+vt44pf/pe3Xt9X9X6v/9q"
+    "2u3Tpa/pX39ff//6C/X29X9X/Ecff5tV0m6FLyGQCm5A8ND9Pv0kO/pD/6XvXv9/3//1902l"
+    "apeFg9SGKE/tL////0vtfb0n9J//7XSfb3pLwsOqCe+3qvfr/6XvXt/fXfX+9P/pWlXhYapB"
+    "GZv0vqt/r/0vtfv//1v+1vbSbSdV8Fh1oJtb76X///S969vV9Vfr/f0v6bpLyB4eyDVYSDDS"
+    "0unSfS/yGeMhnhf/S+19+vqvW/+v9tdJL0GEwggw9JJ//S+///9L3r2/v++r/tdJtXSbWvWw"
+    "gQYaWsfTelW//X/pfa+3/pfpMP96b+rrpL7TCCDBpaXr4QS////oL+vvV/V9KH/f/sU2kv+E"
+    "EGGlpV7eCC//1/9L2/2/9L9JmoFn7paTf6pf4QQYaSX6XEwGn//4/0v0vf/S/CCkICn//0mm"
+    "6S/wQRDTKwYaWl/cgQZn8Lhf/X2/2/8JfkKdlICt+1dJvabSr6aCCww6+tJ4P+OP/0/0vb/y"
+    "xwQX5tWD/er/v196CCww0tf+Zh3///F+3/f+1/BMP+//bbSS9hBoILDDS6VJJvBh//zMGv9/"
+    "pe3/wX7Qb/dLSbS40vEQgWGDS//w3///37f7/8F+2Df/v/bVeEEIYaWte3hv6mYEZmBH/5nv"
+    "9fb/x/bIKYT9tbX09Lwggw0v0kvf/ff/9v3r2//9yCwn/66bSV18EEDDrpf+////9v7X77ru"
+    "tsgtB///zadJfCDaX9JN73r/3/7fvXt//9h/20tL0ndL4Qer0lj7fr/yGZZBI/9v7X3//22/"
+    "/fb1vr4Qff6T3//3i//b969vf39sP+2trpJN6XwwX/X/////2/tfb9L0t//rp+vX4YX3SSv7"
+    "6xxshpI/9h+9e339/b//96t6XhhhBPeqSNgY++v4f/2/v+//9v/bSdLpJvrwwYQVu3LrX/fX"
+    "u//t+6XvvW9bb//e2qXpeGGEE3elqrf+v3/+39/t9r37/7df+3peGGQ2ysIJp20sIKv2+v//"
+    "2/0vb+vS7/9dL0vXww8ECG2wk4SW+vX2//w37f7e37+3Xpe+2kk3peGHhBOGKiieU/t9ZDLj"
+    "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"
+    "v/b//f1v/7V6er0r9L//XSttb1/9v//rptfr+1jY0ntUq/+197X1/9v/+0rS1/9XqqVtiqX/"
+    "9bQVtowrZDYPr/7D//b7SYa9pW2jCxu6V6//thG/aTdhLbC9/+3/+6VoK1/yKPYS3rSbaS//"
+    "hhLhhJhkMOwwlw15AgaP+3//aVpMMEc/aVhOGEuulfS//iFoMIJhhWKthhJYd2urBra922lB"
+    "ggmK1tJimK/eraSBf/asqIpgwVqGwYJBA2GCDhhA8IG2EDBAwQODBBw2GlFMLCKcDDCVVBu1"
+    "hJh6H/7Cjm0ExQanQMoUQ2F7IEF50DBLhokNghyGC5DBcEDnQHIgEOgFwYIKE1kNgOUGE0wo"
+    "OtoKw9f/a6DQaDC2Cw//sF/+xCn0gwvimg1vXW0//hhDQMIMEDQgwhDYiOLLhkhlBYMEDCxD"
+    "BBoMEO+I44/iIkCThILGBHgTiQyQaOxHIHh+EREa/xFBEM58fH/sIJ/6/wk///pP+l/kDwIK"
+    "////X/3r+uvStf///8ev0nrC+v9pZA8WvSr0g2l//7aXtpfqJTgi4GwGeP16QjtpJeQNAanX"
+    "tL+0tsJJehWwwgklX2GEgkmg6wxCBIgZiCCB+DrDChfCyBtDOdkcDMMcMLEREf//////////"
+    "////////////////////4AIAIAAOAAABAwABAAAATAkAAAEBAwABAAAAcwIAAAIBAwABAAAA"
+    "AQAAAAMBAwABAAAABAAAAAYBAwABAAAAAQAAABEBBAABAAAACAAAABIBAwABAAAAAQAAABUB"
+    "AwABAAAAAQAAABYBAwABAAAAcwIAABcBBAABAAAABxMAABoBBQABAAAAvhMAABsBBQABAAAA"
+    "xhMAABwBAwABAAAAAQAAACgBAwABAAAAAgAAAAAAAAAAAMASAAAEAAAAwBIAAAQA";
+
+#endif  /* LEPTONICA_BMFDATA_H */
+
+

+ 35 - 25
include/leptonica/bmp.h

@@ -10,7 +10,7 @@
  -     copyright notice, this list of conditions and the following
  -     disclaimer in the documentation and/or other materials
  -     provided with the distribution.
- - 
+ -
  -  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  -  ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  -  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -27,7 +27,10 @@
 #ifndef  LEPTONICA_BMP_H
 #define  LEPTONICA_BMP_H
 
-/*
+/*!
+ * \file bmp.h
+ *
+ * <pre>
  * This file is here to describe the fields in the header of
  * the BMP file.  These fields are not used directly in Leptonica.
  * The only thing we use are the sizes of these two headers.
@@ -36,50 +39,57 @@
  * to protect anyone who may also need to use the original definitions.
  * Thanks to J. D. Bryan for pointing out the potential problems when
  * developing on Win32 compatible systems.
+ * </pre>
  */
 
 /*-------------------------------------------------------------*
  *                       BMP file header                       *
  *-------------------------------------------------------------*/
+
+/*! BMP file header */
 struct BMP_FileHeader
 {
-    l_int16        bfType;                /* file type; must be "BM" */
-    l_int16        bfSize;                /* length of the file;
-                                   sizeof(BMP_FileHeader) +
-                                   sizeof(BMP_InfoHeader) +
-                                   size of color table +
-                                   size of DIB bits */
-    l_int16        bfFill1;        /* remainder of the bfSize field */
-    l_int16        bfReserved1;        /* don't care (set to 0)*/
-    l_int16        bfReserved2;        /* don't care (set to 0)*/
-    l_int16        bfOffBits;        /* offset from beginning of file */
-    l_int16        bfFill2;        /* remainder of the bfOffBits field */
+    l_int16        bfType;         /*!< file type; must be "BM"            */
+    l_int16        bfSize;         /*!< length of the file;
+                                       sizeof(BMP_FileHeader) +
+                                       sizeof(BMP_InfoHeader) +
+                                       size of color table +
+                                       size of DIB bits                    */
+    l_int16        bfFill1;        /*!< remainder of the bfSize field      */
+    l_int16        bfReserved1;    /*!< don't care (set to 0)              */
+    l_int16        bfReserved2;    /*!< don't care (set to 0)              */
+    l_int16        bfOffBits;      /*!< offset from beginning of file      */
+    l_int16        bfFill2;        /*!< remainder of the bfOffBits field   */
 };
 typedef struct BMP_FileHeader  BMP_FH;
 
+/*! Number of bytes in a BMP file header */
 #define BMP_FHBYTES  sizeof(BMP_FH)
 
 
 /*-------------------------------------------------------------*
  *                       BMP info header                       *
  *-------------------------------------------------------------*/
+
+/*! BMP info header */
 struct BMP_InfoHeader
 {
-    l_int32        biSize;                  /* size of the BMP_InfoHeader struct */
-    l_int32        biWidth;         /* bitmap width in pixels */
-    l_int32        biHeight;         /* bitmap height in pixels */
-    l_int16        biPlanes;         /* number of bitmap planes */
-    l_int16        biBitCount;         /* number of bits per pixel */
-    l_int32        biCompression;         /* compression format (0 == uncompressed) */
-    l_int32        biSizeImage;         /* size of image in bytes */
-    l_int32        biXPelsPerMeter; /* pixels per meter in x direction */
-    l_int32        biYPelsPerMeter; /* pixels per meter in y direction */
-    l_int32        biClrUsed;          /* number of colors used */
-    l_int32        biClrImportant;         /* number of important colors used */
+    l_int32        biSize;          /*!< size of the BMP_InfoHeader struct   */
+    l_int32        biWidth;         /*!< bitmap width in pixels              */
+    l_int32        biHeight;        /*!< bitmap height in pixels             */
+    l_int16        biPlanes;        /*!< number of bitmap planes             */
+    l_int16        biBitCount;      /*!< number of bits per pixel            */
+    l_int32        biCompression;   /*!< compress format (0 == uncompressed) */
+    l_int32        biSizeImage;     /*!< size of image in bytes              */
+    l_int32        biXPelsPerMeter; /*!< pixels per meter in x direction     */
+    l_int32        biYPelsPerMeter; /*!< pixels per meter in y direction     */
+    l_int32        biClrUsed;       /*!< number of colors used               */
+    l_int32        biClrImportant;  /*!< number of important colors used     */
 };
 typedef struct BMP_InfoHeader  BMP_IH;
 
+/*! Number of bytes in a BMP info header */
 #define BMP_IHBYTES  sizeof(BMP_IH)
 
- 
+
 #endif  /* LEPTONICA_BMP_H */

+ 27 - 22
include/leptonica/ccbord.h

@@ -10,7 +10,7 @@
  -     copyright notice, this list of conditions and the following
  -     disclaimer in the documentation and/or other materials
  -     provided with the distribution.
- - 
+ -
  -  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  -  ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  -  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -27,27 +27,31 @@
 #ifndef  LEPTONICA_CCBORD_H
 #define  LEPTONICA_CCBORD_H
 
-/*
- *  ccbord.h
+/*!
+ * \file ccbord.h
  *
+ * <pre>
  *           CCBord:   represents a single connected component
  *           CCBorda:  an array of CCBord
+ * </pre>
  */
 
-    /* Use in ccbaStepChainsToPixCoords() */
+    /*! Use in ccbaStepChainsToPixCoords() */
 enum {
       CCB_LOCAL_COORDS = 1,
       CCB_GLOBAL_COORDS = 2
 };
 
-    /* Use in ccbaGenerateSPGlobalLocs() */
+    /*! Use in ccbaGenerateSPGlobalLocs() */
 enum {
       CCB_SAVE_ALL_PTS = 1,
       CCB_SAVE_TURNING_PTS = 2
 };
 
 
-    /* CCBord contains:
+    /*!
+     * <pre>
+     * CCBord contains:
      *
      *    (1) a minimally-clipped bitmap of the component (pix),
      *    (2) a boxa consisting of:
@@ -82,30 +86,31 @@ enum {
      *    (9) a pta for a single chain for each c.c., comprised of outer
      *        and hole borders, plus cut paths between them, all in
      *        global coords.
+     * </pre>
      */
 struct CCBord
 {
-    struct Pix          *pix;            /* component bitmap (min size)      */
-    struct Boxa         *boxa;           /* regions of each closed curve     */
-    struct Pta          *start;          /* initial border pixel locations   */
-    l_int32              refcount;       /* number of handles; start at 1    */
-    struct Ptaa         *local;          /* ptaa of chain pixels (local)     */
-    struct Ptaa         *global;         /* ptaa of chain pixels (global)    */
-    struct Numaa        *step;           /* numaa of chain code (step dir)   */
-    struct Pta          *splocal;        /* pta of single chain (local)      */
-    struct Pta          *spglobal;       /* pta of single chain (global)     */
+    struct Pix          *pix;          /*!< component bitmap (min size)      */
+    struct Boxa         *boxa;         /*!< regions of each closed curve     */
+    struct Pta          *start;        /*!< initial border pixel locations   */
+    l_int32              refcount;     /*!< number of handles; start at 1    */
+    struct Ptaa         *local;        /*!< ptaa of chain pixels (local)     */
+    struct Ptaa         *global;       /*!< ptaa of chain pixels (global)    */
+    struct Numaa        *step;         /*!< numaa of chain code (step dir)   */
+    struct Pta          *splocal;      /*!< pta of single chain (local)      */
+    struct Pta          *spglobal;     /*!< pta of single chain (global)     */
 };
 typedef struct CCBord CCBORD;
 
-
+/*! Array of CCBord */
 struct CCBorda
 {
-    struct Pix          *pix;            /* input pix (may be null)          */
-    l_int32              w;              /* width of pix                     */
-    l_int32              h;              /* height of pix                    */
-    l_int32              n;              /* number of ccbord in ptr array    */
-    l_int32              nalloc;         /* number of ccbord ptrs allocated  */
-    struct CCBord      **ccb;            /* ccb ptr array                    */
+    struct Pix          *pix;          /*!< input pix (may be null)          */
+    l_int32              w;            /*!< width of pix                     */
+    l_int32              h;            /*!< height of pix                    */
+    l_int32              n;            /*!< number of ccbord in ptr array    */
+    l_int32              nalloc;       /*!< number of ccbord ptrs allocated  */
+    struct CCBord      **ccb;          /*!< ccb ptr array                    */
 };
 typedef struct CCBorda CCBORDA;
 

+ 93 - 67
include/leptonica/dewarp.h

@@ -27,9 +27,10 @@
 #ifndef  LEPTONICA_DEWARP_H
 #define  LEPTONICA_DEWARP_H
 
-/*
- *  dewarp.h
+/*!
+ * \file dewarp.h
  *
+ * <pre>
  *     Data structure to hold arrays and results for generating
  *     horizontal and vertical disparity arrays based on textlines.
  *     Each disparity array is two-dimensional.  The vertical disparity
@@ -58,14 +59,24 @@
  *         parity (even/odd page) that it can use.  The range in pages
  *         to search for a valid model is given by the 'maxdist' field.
  *
- *     If a valid vertical disparity model (VDM) is not available,
- *     just use the input image.  Otherwise, assuming the VDM is available:
- *       (a) with useboth == 0, we use only the VDM.
- *       (b) with useboth == 1, we require using the VDM and, if a valid
+ *     At the rendering stage, vertical and horizontal disparities are
+ *     treated differently.  It is somewhat more robust to generate
+ *     vertical disparity models (VDM) than horizontal disparity
+ *     models (HDM). A valid VDM is required for any correction to
+ *     be made; if a valid VDM is not available, just use the input
+ *     image.  Otherwise, assuming it is available, the use of the
+ *     HDM is controlled by two fields: 'useboth' and 'check_columns'.
+ *       (a) With useboth == 0, we use only the VDM.
+ *       (b) With useboth == 1, we require using the VDM and, if a valid
  *           horizontal disparity model (HDM) is available, we also use it.
+ *       (c) With check_columns == 1, check for multiple columns and if
+ *           true, only use the VDM, even if a valid HDM is available.
+ *           Note that 'check_columns' takes precedence over 'useboth'
+ *           when there is more than 1 column of text.  By default,
+ *           check_columns == 0.
  *
  *     The 'maxdist' parameter is input when the dewarpa is created.
- *     The other rendering parameters have default values given in dewarp.c.
+ *     The other rendering parameters have default values given in dewarp1.c.
  *     All parameters used by rendering can be set (or reset) using accessors.
  *
  *     After dewarping, use of the VDM will cause all points on each
@@ -84,81 +95,96 @@
  *
  *     The most accurate results are produced at full resolution, and
  *     this is generally recommended.
+ * </pre>
  */
 
-    /* Note on versioning of the serialization of this data structure:
+    /*! Dewarp version for serialization
+     * <pre>
+     * Note on versioning of the serialization of this data structure:
      * The dewarping utility and the stored data can be expected to change.
      * In most situations, the serialized version is ephemeral -- it is
      * not needed after being used.  No functions will be provided to
-     * convert between different versions. */
+     * convert between different versions.
+     * </pre>
+     */
 #define  DEWARP_VERSION_NUMBER      4
 
+/*! Data structure to hold a number of Dewarp */
 struct L_Dewarpa
 {
-    l_int32            nalloc;        /* size of dewarp ptr array            */
-    l_int32            maxpage;       /* maximum page number in array        */
-    struct L_Dewarp  **dewarp;        /* array of ptrs to page dewarp        */
-    struct L_Dewarp  **dewarpcache;   /* array of ptrs to cached dewarps     */
-    struct Numa       *namodels;      /* list of page numbers for pages      */
-                                      /* with page models                    */
-    struct Numa       *napages;       /* list of page numbers with either    */
-                                      /* page models or ref page models      */
-    l_int32            redfactor;     /* reduction factor of input: 1 or 2   */
-    l_int32            sampling;      /* disparity arrays sampling factor    */
-    l_int32            minlines;      /* min number of long lines required   */
-    l_int32            maxdist;       /* max distance for getting ref pages  */
-    l_int32            max_linecurv;  /* maximum abs line curvature,         */
-                                      /* in micro-units                      */
-    l_int32            min_diff_linecurv; /* minimum abs diff line curvature */
-                                      /* in micro-units                      */
-    l_int32            max_diff_linecurv; /* maximum abs diff line curvature */
-                                      /* in micro-units                      */
-    l_int32            max_edgeslope; /* maximum abs left or right edge      */
-                                      /* slope, in milli-units               */
-    l_int32            max_edgecurv;  /* maximum abs left or right edge      */
-                                      /* curvature, in micro-units           */
-    l_int32            max_diff_edgecurv; /* maximum abs diff left-right     */
-                                      /* edge curvature, in micro-units      */
-    l_int32            useboth;       /* use both disparity arrays if        */
-                                      /* available; just vertical otherwise  */
-    l_int32            modelsready;   /* invalid models have been removed    */
-                                      /* and refs built against valid set    */
+    l_int32            nalloc;        /*!< size of dewarp ptr array          */
+    l_int32            maxpage;       /*!< maximum page number in array      */
+    struct L_Dewarp  **dewarp;        /*!< array of ptrs to page dewarp      */
+    struct L_Dewarp  **dewarpcache;   /*!< array of ptrs to cached dewarps   */
+    struct Numa       *namodels;      /*!< list of page numbers for pages    */
+                                      /*!< with page models                  */
+    struct Numa       *napages;       /*!< list of page numbers with either  */
+                                      /*!< page models or ref page models    */
+    l_int32            redfactor;     /*!< reduction factor of input: 1 or 2 */
+    l_int32            sampling;      /*!< disparity arrays sampling factor  */
+    l_int32            minlines;      /*!< min number of long lines required */
+    l_int32            maxdist;       /*!< max distance for getting ref page */
+    l_int32            max_linecurv;  /*!< maximum abs line curvature,       */
+                                      /*!< in micro-units                    */
+    l_int32            min_diff_linecurv; /*!< minimum abs diff line         */
+                                          /*!< curvature in micro-units      */
+    l_int32            max_diff_linecurv; /*!< maximum abs diff line         */
+                                          /*!< curvature in micro-units      */
+    l_int32            max_edgeslope; /*!< maximum abs left or right edge    */
+                                      /*!< slope, in milli-units             */
+    l_int32            max_edgecurv;  /*!< maximum abs left or right edge    */
+                                      /*!< curvature, in micro-units         */
+    l_int32            max_diff_edgecurv; /*!< maximum abs diff left-right   */
+                                      /*!< edge curvature, in micro-units    */
+    l_int32            useboth;       /*!< use both disparity arrays if      */
+                                      /*!< available; only vertical otherwise */
+    l_int32            check_columns; /*!< if there are multiple columns,    */
+                                      /*!< only use the vertical disparity   */
+                                      /*!< array                             */
+    l_int32            modelsready;   /*!< invalid models have been removed  */
+                                      /*!< and refs built against valid set  */
 };
 typedef struct L_Dewarpa L_DEWARPA;
 
 
+/*! Data structure for a single dewarp */
 struct L_Dewarp
 {
-    struct L_Dewarpa  *dewa;         /* ptr to parent (not owned)            */
-    struct Pix        *pixs;         /* source pix, 1 bpp                    */
-    struct FPix       *sampvdispar;  /* sampled vert disparity array         */
-    struct FPix       *samphdispar;  /* sampled horiz disparity array        */
-    struct FPix       *fullvdispar;  /* full vert disparity array            */
-    struct FPix       *fullhdispar;  /* full horiz disparity array           */
-    struct Numa       *namidys;      /* sorted y val of midpoint each line   */
-    struct Numa       *nacurves;     /* sorted curvature of each line        */
-    l_int32            w;            /* width of source image                */
-    l_int32            h;            /* height of source image               */
-    l_int32            pageno;       /* page number; important for reuse     */
-    l_int32            sampling;     /* sampling factor of disparity arrays  */
-    l_int32            redfactor;    /* reduction factor of pixs: 1 or 2     */
-    l_int32            minlines;     /* min number of long lines required    */
-    l_int32            nlines;       /* number of long lines found           */
-    l_int32            mincurv;      /* min line curvature in micro-units    */
-    l_int32            maxcurv;      /* max line curvature in micro-units    */
-    l_int32            leftslope;    /* left edge slope in milli-units       */
-    l_int32            rightslope;   /* right edge slope in milli-units      */
-    l_int32            leftcurv;     /* left edge curvature in micro-units   */
-    l_int32            rightcurv;    /* right edge curvature in micro-units  */
-    l_int32            nx;           /* number of sampling pts in x-dir      */
-    l_int32            ny;           /* number of sampling pts in y-dir      */
-    l_int32            hasref;       /* 0 if normal; 1 if has a refpage      */
-    l_int32            refpage;      /* page with disparity model to use     */
-    l_int32            vsuccess;     /* sets to 1 if vert disparity builds   */
-    l_int32            hsuccess;     /* sets to 1 if horiz disparity builds  */
-    l_int32            vvalid;       /* sets to 1 if valid vert disparity    */
-    l_int32            hvalid;       /* sets to 1 if valid horiz disparity   */
-    l_int32            debug;        /* sets to 1 if debug output requested  */
+    struct L_Dewarpa  *dewa;         /*!< ptr to parent (not owned)          */
+    struct Pix        *pixs;         /*!< source pix, 1 bpp                  */
+    struct FPix       *sampvdispar;  /*!< sampled vert disparity array       */
+    struct FPix       *samphdispar;  /*!< sampled horiz disparity array      */
+    struct FPix       *sampydispar;  /*!< sampled slope h-disparity array    */
+    struct FPix       *fullvdispar;  /*!< full vert disparity array          */
+    struct FPix       *fullhdispar;  /*!< full horiz disparity array         */
+    struct FPix       *fullydispar;  /*!< full slope h-disparity array       */
+    struct Numa       *namidys;      /*!< sorted y val of midpoint each line */
+    struct Numa       *nacurves;     /*!< sorted curvature of each line      */
+    l_int32            w;            /*!< width of source image              */
+    l_int32            h;            /*!< height of source image             */
+    l_int32            pageno;       /*!< page number; important for reuse   */
+    l_int32            sampling;     /*!< sampling factor of disparity arrays */
+    l_int32            redfactor;    /*!< reduction factor of pixs: 1 or 2   */
+    l_int32            minlines;     /*!< min number of long lines required  */
+    l_int32            nlines;       /*!< number of long lines found         */
+    l_int32            mincurv;      /*!< min line curvature in micro-units  */
+    l_int32            maxcurv;      /*!< max line curvature in micro-units  */
+    l_int32            leftslope;    /*!< left edge slope in milli-units     */
+    l_int32            rightslope;   /*!< right edge slope in milli-units    */
+    l_int32            leftcurv;     /*!< left edge curvature in micro-units */
+    l_int32            rightcurv;    /*!< right edge curvature in micro-units*/
+    l_int32            nx;           /*!< number of sampling pts in x-dir    */
+    l_int32            ny;           /*!< number of sampling pts in y-dir    */
+    l_int32            hasref;       /*!< 0 if normal; 1 if has a refpage    */
+    l_int32            refpage;      /*!< page with disparity model to use   */
+    l_int32            vsuccess;     /*!< sets to 1 if vert disparity builds */
+    l_int32            hsuccess;     /*!< sets to 1 if horiz disparity builds */
+    l_int32            ysuccess;     /*!< sets to 1 if slope disparity builds */
+    l_int32            vvalid;       /*!< sets to 1 if valid vert disparity  */
+    l_int32            hvalid;       /*!< sets to 1 if valid horiz disparity */
+    l_int32            skip_horiz;   /*!< if 1, skip horiz disparity         */
+                                     /*!< correction                         */
+    l_int32            debug;        /*!< set to 1 if debug output requested */
 };
 typedef struct L_Dewarp L_DEWARP;
 

+ 1 - 1
include/leptonica/endianness.h

@@ -1,5 +1,5 @@
 #if !defined (L_BIG_ENDIAN) && !defined (L_LITTLE_ENDIAN)
-# if 0
+# if defined (__APPLE_CC__)
 #  ifdef __BIG_ENDIAN__
 #   define L_BIG_ENDIAN
 #  else

+ 133 - 52
include/leptonica/environ.h

@@ -82,7 +82,6 @@ typedef unsigned int uintptr_t;
 
 typedef intptr_t l_intptr_t;
 typedef uintptr_t l_uintptr_t;
-typedef void *L_TIMER;
 
 
 /*--------------------------------------------------------------------*
@@ -97,30 +96,23 @@ typedef void *L_TIMER;
  *  I/O libraries, plus zlib.  Setting any of these to 0 here causes
  *  non-functioning stubs to be linked.
  */
-#ifndef HAVE_CONFIG_H
-#define  HAVE_LIBJPEG     1
-#define  HAVE_LIBTIFF     1
-#define  HAVE_LIBPNG      1
-#define  HAVE_LIBZ        1
-#define  HAVE_LIBGIF      1
-#define  HAVE_LIBUNGIF    0
-#define  HAVE_LIBWEBP     0
-#define  HAVE_LIBJP2K     0
-#endif  /* ~HAVE_CONFIG_H */
-
-/*
- * On linux systems, you can do I/O between Pix and memory.  Specifically,
- * you can compress (write compressed data to memory from a Pix) and
- * uncompress (read from compressed data in memory to a Pix).
- * For jpeg, png, pnm and bmp, these use the non-posix GNU functions
- * fmemopen() and open_memstream().  These functions are not
- * available on other systems.  To use these functions in linux,
- * you must define HAVE_FMEMOPEN to be 1 here.
- */
-#ifndef HAVE_CONFIG_H
-#define  HAVE_FMEMOPEN    0
-#endif  /* ~HAVE_CONFIG_H */
-
+#if !defined(HAVE_CONFIG_H) && !defined(ANDROID_BUILD) && !defined(OS_IOS)
+#define  HAVE_LIBJPEG       1
+#define  HAVE_LIBTIFF       1
+#define  HAVE_LIBPNG        1
+#define  HAVE_LIBZ          1
+#define  HAVE_LIBGIF        0
+#define  HAVE_LIBUNGIF      0
+#define  HAVE_LIBWEBP       0
+#define  HAVE_LIBJP2K       0
+
+/*-------------------------------------------------------------------------*
+ * Leptonica supports OpenJPEG 2.0+.  If you have a version of openjpeg    *
+ * (HAVE_LIBJP2K == 1) that is >= 2.0, set the path to the openjpeg.h      *
+ * header in angle brackets here.                                          *
+ *-------------------------------------------------------------------------*/
+#define  LIBJP2K_HEADER   <openjpeg-2.3/openjpeg.h>
+#endif  /* ! HAVE_CONFIG_H etc. */
 
 /*--------------------------------------------------------------------*
  * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*
@@ -142,58 +134,114 @@ typedef void *L_TIMER;
 #define  USE_PSIO         1
 
 
+/*-------------------------------------------------------------------------*
+ * On linux systems, you can do I/O between Pix and memory.  Specifically,
+ * you can compress (write compressed data to memory from a Pix) and
+ * uncompress (read from compressed data in memory to a Pix).
+ * For jpeg, png, jp2k, gif, pnm and bmp, these use the non-posix GNU
+ * functions fmemopen() and open_memstream().  These functions are not
+ * available on other systems.
+ * To use these functions in linux, you must define HAVE_FMEMOPEN to 1.
+ * To use them on MacOS, which does not support these functions, set it to 0.
+ *-------------------------------------------------------------------------*/
+#if !defined(HAVE_CONFIG_H) && !defined(ANDROID_BUILD) && !defined(OS_IOS) && \
+    !defined(_WIN32)
+#define  HAVE_FMEMOPEN    1
+#endif  /* ! HAVE_CONFIG_H etc. */
+
+/*-------------------------------------------------------------------------*
+ * fstatat() is defined by POSIX, but some systems do not support it.      *
+ * One example is older macOS systems (pre-10.10).                         *
+ * Play it safe and set the default value to 0.                            *
+ *-------------------------------------------------------------------------*/
+#if !defined(HAVE_CONFIG_H)
+#define  HAVE_FSTATAT     0
+#endif /* ! HAVE_CONFIG_H */
+
+/*--------------------------------------------------------------------*
+ * It is desirable on Windows to have all temp files written to the same
+ * subdirectory of the Windows <Temp> directory, because files under <Temp>
+ * persist after reboot, and the regression tests write a lot of files.
+ * We write all test files to /tmp/lept or subdirectories of /tmp/lept.
+ * Windows temp files are specified as in unix, but have the translation
+ *        /tmp/lept/xxx  -->   <Temp>/lept/xxx
+ *--------------------------------------------------------------------*/
+
+
 /*--------------------------------------------------------------------*
  *                          Built-in types                            *
  *--------------------------------------------------------------------*/
-typedef signed char             l_int8;
-typedef unsigned char           l_uint8;
-typedef short                   l_int16;
-typedef unsigned short          l_uint16;
-typedef int                     l_int32;
-typedef unsigned int            l_uint32;
-typedef float                   l_float32;
-typedef double                  l_float64;
+typedef signed char             l_int8;     /*!< signed 8-bit value */
+typedef unsigned char           l_uint8;    /*!< unsigned 8-bit value */
+typedef short                   l_int16;    /*!< signed 16-bit value */
+typedef unsigned short          l_uint16;   /*!< unsigned 16-bit value */
+typedef int                     l_int32;    /*!< signed 32-bit value */
+typedef unsigned int            l_uint32;   /*!< unsigned 32-bit value */
+typedef float                   l_float32;  /*!< 32-bit floating point value */
+typedef double                  l_float64;  /*!< 64-bit floating point value */
 #ifdef COMPILER_MSVC
-typedef __int64                 l_int64;
-typedef unsigned __int64        l_uint64;
+typedef __int64                 l_int64;    /*!< signed 64-bit value */
+typedef unsigned __int64        l_uint64;   /*!< unsigned 64-bit value */
 #else
-typedef long long               l_int64;
-typedef unsigned long long      l_uint64;
+typedef long long               l_int64;    /*!< signed 64-bit value */
+typedef unsigned long long      l_uint64;   /*!< unsigned 64-bit value */
 #endif  /* COMPILER_MSVC */
 
 
+/*-------------------------------------------------------------------------*
+ * For security, the library is distributed in a configuration that does   *
+ * not permit (1) forking with 'system', which is used for displaying      *
+ * images and generating gnuplots, and (2) writing files with specified    *
+ * compiled-in file names.  All such writes are with functions such as     *
+ * pixWriteDebug() where the "Debug" is appended to the usual name.        *
+ * Whether the "Debug" version defaults to the standard version or is a    *
+ * no-op depends on the value of this global variable.  The default value  *
+ * of LeptDebugOK is 0, and it is set in writefile.c.  This value can be   *
+ * over-ridden, for development and debugging, by setLeptDebugOK().        *
+ *-------------------------------------------------------------------------*/
+LEPT_DLL extern l_int32  LeptDebugOK;  /* default is 0 */
+
+
 /*------------------------------------------------------------------------*
  *                            Standard macros                             *
  *------------------------------------------------------------------------*/
 #ifndef L_MIN
+/*! Minimum of %x and %y */
 #define L_MIN(x,y)   (((x) < (y)) ? (x) : (y))
 #endif
 
 #ifndef L_MAX
+/*! Maximum of %x and %y */
 #define L_MAX(x,y)   (((x) > (y)) ? (x) : (y))
 #endif
 
 #ifndef L_ABS
+/*! Absoulute value of %x */
 #define L_ABS(x)     (((x) < 0) ? (-1 * (x)) : (x))
 #endif
 
 #ifndef L_SIGN
+/*! Sign of %x */
 #define L_SIGN(x)    (((x) < 0) ? -1 : 1)
 #endif
 
 #ifndef UNDEF
+/*! Undefined value */
 #define UNDEF        -1
 #endif
 
 #ifndef NULL
+/*! NULL value */
 #define NULL          0
 #endif
 
 #ifndef TRUE
+/*! True value */
 #define TRUE          1
 #endif
 
 #ifndef FALSE
+/*! False value */
 #define FALSE         0
 #endif
 
@@ -215,6 +263,7 @@ typedef unsigned long long      l_uint64;
 /*------------------------------------------------------------------------*
  *                    Simple search state variables                       *
  *------------------------------------------------------------------------*/
+/*! Simple search state variables */
 enum {
     L_NOT_FOUND = 0,
     L_FOUND = 1
@@ -224,6 +273,7 @@ enum {
 /*------------------------------------------------------------------------*
  *                     Path separator conversion                          *
  *------------------------------------------------------------------------*/
+/*! Path separator conversion */
 enum {
     UNIX_PATH_SEPCHAR = 0,
     WIN_PATH_SEPCHAR = 1
@@ -231,16 +281,31 @@ enum {
 
 
 /*------------------------------------------------------------------------*
+ *                          Timing structs                                *
+ *------------------------------------------------------------------------*/
+typedef void *L_TIMER;
+
+/*! Timing struct */
+struct L_WallTimer {
+    l_int32  start_sec;
+    l_int32  start_usec;
+    l_int32  stop_sec;
+    l_int32  stop_usec;
+};
+typedef struct L_WallTimer  L_WALLTIMER;
+
+
+/*------------------------------------------------------------------------*
  *                      Standard memory allocation                        *
  *                                                                        *
  *  These specify the memory management functions that are used           *
  *  on all heap data except for Pix.  Memory management for Pix           *
  *  also defaults to malloc and free.  See pix1.c for details.            *
  *------------------------------------------------------------------------*/
-#define MALLOC(blocksize)           malloc(blocksize)
-#define CALLOC(numelem, elemsize)   calloc(numelem, elemsize)
-#define REALLOC(ptr, blocksize)     realloc(ptr, blocksize)
-#define FREE(ptr)                   free(ptr)
+#define LEPT_MALLOC(blocksize)           malloc(blocksize)
+#define LEPT_CALLOC(numelem, elemsize)   calloc(numelem, elemsize)
+#define LEPT_REALLOC(ptr, blocksize)     realloc(ptr, blocksize)
+#define LEPT_FREE(ptr)                   free(ptr)
 
 
 /*------------------------------------------------------------------------*
@@ -280,6 +345,8 @@ enum {
  *  printed, if desired," whereas the run-time threshold setting says,    *
  *  "Print messages that have an equal or greater severity than this."    *
  *------------------------------------------------------------------------*/
+
+/*! Control printing of error, warning and info messages */
 enum {
     L_SEVERITY_EXTERNAL = 0,   /* Get the severity from the environment   */
     L_SEVERITY_ALL      = 1,   /* Lowest severity: print all messages     */
@@ -305,34 +372,47 @@ enum {
  *  message threshold checking, because code for messages whose severity
  *  is lower than MINIMUM_SEVERITY won't be generated.
  *
- *  A production library might typically permit WARNING and higher
- *  messages to be generated, and a development library might permit
- *  DEBUG and higher.  The actual messages printed (as opposed to
- *  generated) would depend on the current run-time severity threshold.
+ *  A production library might typically permit ERROR messages to be
+ *  generated, and a development library might permit DEBUG and higher.
+ *  The actual messages printed (as opposed to generated) would depend
+ *  on the current run-time severity threshold.
+ *
+ *  This is a complex mechanism and a few examples may help.
+ *  (1) No output permitted under any circumstances.
+ *      Use:  -DNO_CONSOLE_IO  or  -DMINIMUM_SEVERITY=6
+ *  (2) Suppose you want to only allow error messages, and you don't
+ *      want to permit info or warning messages at runtime.
+ *      Use:  -DMINIMUM_SEVERITY=5
+ *  (3) Suppose you want to only allow error messages by default,
+ *      but you will permit this to be over-ridden at runtime.
+ *      Use:  -DDEFAULT_SEVERITY=5
+ *            and to allow info and warning override:
+ *                 setMsgSeverity(L_SEVERITY_INFO);
  */
 
 #ifdef  NO_CONSOLE_IO
   #undef MINIMUM_SEVERITY
   #undef DEFAULT_SEVERITY
 
-  #define MINIMUM_SEVERITY      L_SEVERITY_NONE
-  #define DEFAULT_SEVERITY      L_SEVERITY_NONE
+  #define MINIMUM_SEVERITY      L_SEVERITY_NONE    /*!< Compile-time default */
+  #define DEFAULT_SEVERITY      L_SEVERITY_NONE    /*!< Run-time default */
 
 #else
   #ifndef MINIMUM_SEVERITY
-    #define MINIMUM_SEVERITY    L_SEVERITY_INFO    /* Compile-time default */
+    #define MINIMUM_SEVERITY    L_SEVERITY_INFO    /*!< Compile-time default */
   #endif
 
   #ifndef DEFAULT_SEVERITY
-    #define DEFAULT_SEVERITY    MINIMUM_SEVERITY   /* Run-time default */
+    #define DEFAULT_SEVERITY    MINIMUM_SEVERITY   /*!< Run-time default */
   #endif
 #endif
 
 
-/*  The run-time message severity threshold is defined in utils.c.  */
+/*!  The run-time message severity threshold is defined in utils.c.  */
 LEPT_DLL extern l_int32  LeptMsgSeverity;
 
 /*
+ * <pre>
  *  Usage
  *  =====
  *  Messages are of two types.
@@ -380,6 +460,7 @@ LEPT_DLL extern l_int32  LeptMsgSeverity;
  *  The L_nnn() macros below do not return a value, but because the
  *  conditional operator requires one for the false condition, we
  *  specify a void expression.
+ * </pre>
  */
 
 #ifdef  NO_CONSOLE_IO
@@ -440,9 +521,9 @@ LEPT_DLL extern l_int32  LeptMsgSeverity;
 
 
 /*------------------------------------------------------------------------*
- *                        snprintf() renamed in MSVC                      *
+ *              snprintf() renamed in MSVC (pre-VS2015)                   *
  *------------------------------------------------------------------------*/
-#ifdef _MSC_VER
+#if defined _MSC_VER && _MSC_VER < 1900
 #define snprintf(buf, size, ...)  _snprintf_s(buf, size, _TRUNCATE, __VA_ARGS__)
 #endif
 

+ 32 - 25
include/leptonica/gplot.h

@@ -10,7 +10,7 @@
  -     copyright notice, this list of conditions and the following
  -     disclaimer in the documentation and/or other materials
  -     provided with the distribution.
- - 
+ -
  -  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  -  ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  -  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -27,10 +27,18 @@
 #ifndef  LEPTONICA_GPLOT_H
 #define  LEPTONICA_GPLOT_H
 
-/*
- *   gplot.h
+/*!
+ * \file gplot.h
+ *
+ * <pre>
+ *   Data structures and parameters for generating gnuplot files
  *
- *       Data structures and parameters for generating gnuplot files
+ *   We used to support X11 output, but recent versions of gnuplot do not
+ *   support the X11 terminal.  To get display to your screen, use
+ *   GPLOT_PNG output; e.g.,
+ *       gplotSimple1(na, GPLOT_PNG, "/tmp/someroot", ...);
+ *       l_fileDisplay("/tmp/someroot.png", ...);
+ * </pre>
  */
 
 #define  GPLOT_VERSION_NUMBER    1
@@ -44,43 +52,42 @@ enum GPLOT_STYLE {
     GPLOT_DOTS        = 4
 };
 
-#define  NUM_GPLOT_OUTPUTS     6
+#define  NUM_GPLOT_OUTPUTS     5
 enum GPLOT_OUTPUT {
     GPLOT_NONE  = 0,
     GPLOT_PNG   = 1,
     GPLOT_PS    = 2,
     GPLOT_EPS   = 3,
-    GPLOT_X11   = 4,
-    GPLOT_LATEX = 5
+    GPLOT_LATEX = 4
 };
 
 enum GPLOT_SCALING {
-    GPLOT_LINEAR_SCALE  = 0,   /* default */
+    GPLOT_LINEAR_SCALE  = 0,   /*!< default */
     GPLOT_LOG_SCALE_X   = 1,
     GPLOT_LOG_SCALE_Y   = 2,
     GPLOT_LOG_SCALE_X_Y = 3
 };
 
-extern const char  *gplotstylenames[];  /* used in gnuplot cmd file */
-extern const char  *gplotfilestyles[];  /* used in simple file input */
-extern const char  *gplotfileoutputs[]; /* used in simple file input */
+extern const char  *gplotstylenames[];  /*!< used in gnuplot cmd file */
+extern const char  *gplotfileoutputs[]; /*!< used in simple file input */
 
+/*! Data structure for generating gnuplot files */
 struct GPlot
 {
-    char          *rootname;   /* for cmd, data, output            */
-    char          *cmdname;    /* command file name                */
-    struct Sarray *cmddata;    /* command file contents            */
-    struct Sarray *datanames;  /* data file names                  */
-    struct Sarray *plotdata;   /* plot data (1 string/file)        */
-    struct Sarray *plottitles; /* title for each individual plot   */
-    struct Numa   *plotstyles; /* plot style for individual plots  */
-    l_int32        nplots;     /* current number of plots          */
-    char          *outname;    /* output file name                 */
-    l_int32        outformat;  /* GPLOT_OUTPUT values              */
-    l_int32        scaling;    /* GPLOT_SCALING values             */
-    char          *title;      /* optional                         */
-    char          *xlabel;     /* optional x axis label            */
-    char          *ylabel;     /* optional y axis label            */
+    char          *rootname;   /*!< for cmd, data, output            */
+    char          *cmdname;    /*!< command file name                */
+    struct Sarray *cmddata;    /*!< command file contents            */
+    struct Sarray *datanames;  /*!< data file names                  */
+    struct Sarray *plotdata;   /*!< plot data (1 string/file)        */
+    struct Sarray *plottitles; /*!< title for each individual plot   */
+    struct Numa   *plotstyles; /*!< plot style for individual plots  */
+    l_int32        nplots;     /*!< current number of plots          */
+    char          *outname;    /*!< output file name                 */
+    l_int32        outformat;  /*!< GPLOT_OUTPUT values              */
+    l_int32        scaling;    /*!< GPLOT_SCALING values             */
+    char          *title;      /*!< optional                         */
+    char          *xlabel;     /*!< optional x axis label            */
+    char          *ylabel;     /*!< optional y axis label            */
 };
 typedef struct GPlot  GPLOT;
 

+ 12 - 9
include/leptonica/heap.h

@@ -10,7 +10,7 @@
  -     copyright notice, this list of conditions and the following
  -     disclaimer in the documentation and/or other materials
  -     provided with the distribution.
- - 
+ -
  -  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  -  ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  -  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -27,16 +27,17 @@
 #ifndef  LEPTONICA_HEAP_H
 #define  LEPTONICA_HEAP_H
 
-/*
- *  heap.h
+/*!
+ * \file heap.h
  *
+ * <pre>
  *      Expandable priority queue configured as a heap for arbitrary void* data
  *
  *      The L_Heap is used to implement a priority queue.  The elements
  *      in the heap are ordered in either increasing or decreasing key value.
  *      The key is a float field 'keyval' that is required to be
  *      contained in the elements of the queue.
- * 
+ *
  *      The heap is a simple binary tree with the following constraints:
  *         - the key of each node is >= the keys of the two children
  *         - the tree is complete, meaning that each level (1, 2, 4, ...)
@@ -67,16 +68,18 @@
  *      it goes at the end of the array, and is swapped up to restore
  *      the heap.  If the ptr array is full, adding another item causes
  *      the ptr array size to double.
- *      
+ *
  *      For further implementation details, see heap.c.
+ * </pre>
  */
 
+/*! Heap of arbitrary void* data */
 struct L_Heap
 {
-    l_int32      nalloc;      /* size of allocated ptr array                 */
-    l_int32      n;           /* number of elements stored in the heap       */
-    void       **array;       /* ptr array                                   */
-    l_int32      direction;   /* L_SORT_INCREASING or L_SORT_DECREASING      */
+    l_int32      nalloc;      /*!< size of allocated ptr array               */
+    l_int32      n;           /*!< number of elements stored in the heap     */
+    void       **array;       /*!< ptr array                                 */
+    l_int32      direction;   /*!< L_SORT_INCREASING or L_SORT_DECREASING    */
 };
 typedef struct L_Heap  L_HEAP;
 

+ 90 - 58
include/leptonica/imageio.h

@@ -24,7 +24,10 @@
  -  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *====================================================================*/
 
-/*
+/*!
+ * \file imageio.h
+ *
+ * <pre>
  *  General features of image I/O in leptonica
  *
  *  At present, there are 9 file formats for images that can be read
@@ -61,26 +64,30 @@
  *
  *  The image header (metadata) information can be read from either
  *  the compressed file or a memory buffer, for all 9 formats.
+ * </pre>
  */
 
 #ifndef  LEPTONICA_IMAGEIO_H
 #define  LEPTONICA_IMAGEIO_H
 
-/* ------------------ Image file format types -------------- */
+/* --------------------------------------------------------------- *
+ *                    Image file format types                      *
+ * --------------------------------------------------------------- */
 /*
  *  The IFF_DEFAULT flag is used to write the file out in the
  *  same (input) file format that the pix was read from.  If the pix
  *  was not read from file, the input format field will be
  *  IFF_UNKNOWN and the output file format will be chosen to
  *  be compressed and lossless; namely, IFF_TIFF_G4 for d = 1
- *  and IFF_PNG for everything else.   IFF_JP2 is for jpeg2000, which
- *  is not supported in leptonica.
+ *  and IFF_PNG for everything else.
  *
  *  In the future, new format types that have defined extensions
  *  will be added before IFF_DEFAULT, and will be kept in sync with
  *  the file format extensions in writefile.c.  The positions of
  *  file formats before IFF_DEFAULT will remain invariant.
  */
+
+/*! Image file format types */
 enum {
     IFF_UNKNOWN        = 0,
     IFF_BMP            = 1,
@@ -104,31 +111,46 @@ enum {
 };
 
 
-/* ---------------------- Format header ids --------------------- */
+/* --------------------------------------------------------------- *
+ *                         Format header ids                       *
+ * --------------------------------------------------------------- */
+
+/*! Format header ids */
 enum {
-    BMP_ID             = 0x4d42,
-    TIFF_BIGEND_ID     = 0x4d4d,     /* MM - for 'motorola' */
-    TIFF_LITTLEEND_ID  = 0x4949      /* II - for 'intel'    */
+    BMP_ID             = 0x4d42,     /*!< BM - for bitmaps    */
+    TIFF_BIGEND_ID     = 0x4d4d,     /*!< MM - for 'motorola' */
+    TIFF_LITTLEEND_ID  = 0x4949      /*!< II - for 'intel'    */
 };
 
 
-/* ------------- Hinting bit flags in jpeg reader --------------- */
+/* --------------------------------------------------------------- *
+ *                Hinting bit flags in jpeg reader                 *
+ * --------------------------------------------------------------- */
+
+/*! Hinting bit flags in jpeg reader */
 enum {
-    L_JPEG_READ_LUMINANCE = 1,  /* only want luminance data; no chroma */
-    L_JPEG_FAIL_ON_BAD_DATA = 2  /* don't return possibly damaged pix */
+    L_JPEG_READ_LUMINANCE = 1,   /*!< only want luminance data; no chroma */
+    L_JPEG_FAIL_ON_BAD_DATA = 2  /*!< don't return possibly damaged pix */
 };
 
 
-/* ------------------ Pdf formated encoding types --------------- */
+/* --------------------------------------------------------------- *
+ *                    Pdf formatted encoding types                 *
+ * --------------------------------------------------------------- */
+
+/*! Pdf formatted encoding types */
 enum {
-    L_JPEG_ENCODE   = 1,    /* use dct encoding: 8 and 32 bpp, no cmap     */
-    L_G4_ENCODE     = 2,    /* use ccitt g4 fax encoding: 1 bpp            */
-    L_FLATE_ENCODE  = 3,    /* use flate encoding: any depth, cmap ok      */
-    L_JP2K_ENCODE  = 4      /* use jp2k encoding: 8 and 32 bpp, no cmap    */
+    L_DEFAULT_ENCODE  = 0,  /*!< use default encoding based on image        */
+    L_JPEG_ENCODE     = 1,  /*!< use dct encoding: 8 and 32 bpp, no cmap    */
+    L_G4_ENCODE       = 2,  /*!< use ccitt g4 fax encoding: 1 bpp           */
+    L_FLATE_ENCODE    = 3,  /*!< use flate encoding: any depth, cmap ok     */
+    L_JP2K_ENCODE     = 4   /*!< use jp2k encoding: 8 and 32 bpp, no cmap   */
 };
 
 
-/* ------------------ Compressed image data --------------------- */
+/* --------------------------------------------------------------- *
+ *                    Compressed image data                        *
+ * --------------------------------------------------------------- */
 /*
  *  In use, either datacomp or data85 will be produced, depending
  *  on whether the data needs to be ascii85 encoded.  PostScript
@@ -139,65 +161,75 @@ enum {
  *  hex-encoded rgb triples.  Only tiff g4 (type == L_G4_ENCODE) uses
  *  the minisblack field.
  */
+
+/*! Compressed image data */
 struct L_Compressed_Data
 {
-    l_int32            type;         /* encoding type: L_JPEG_ENCODE, etc  */
-    l_uint8           *datacomp;     /* gzipped raster data                 */
-    size_t             nbytescomp;   /* number of compressed bytes          */
-    char              *data85;       /* ascii85-encoded gzipped raster data */
-    size_t             nbytes85;     /* number of ascii85 encoded bytes     */
-    char              *cmapdata85;   /* ascii85-encoded uncompressed cmap   */
-    char              *cmapdatahex;  /* hex pdf array for the cmap          */
-    l_int32            ncolors;      /* number of colors in cmap            */
-    l_int32            w;            /* image width                         */
-    l_int32            h;            /* image height                        */
-    l_int32            bps;          /* bits/sample; typ. 1, 2, 4 or 8      */
-    l_int32            spp;          /* samples/pixel; typ. 1 or 3          */
-    l_int32            minisblack;   /* tiff g4 photometry                  */
-    l_int32            predictor;    /* flate data has PNG predictors       */
-    size_t             nbytes;       /* number of uncompressed raster bytes */
-    l_int32            res;          /* resolution (ppi)                    */
+    l_int32            type;         /*!< encoding type: L_JPEG_ENCODE, etc   */
+    l_uint8           *datacomp;     /*!< gzipped raster data                 */
+    size_t             nbytescomp;   /*!< number of compressed bytes          */
+    char              *data85;       /*!< ascii85-encoded gzipped raster data */
+    size_t             nbytes85;     /*!< number of ascii85 encoded bytes     */
+    char              *cmapdata85;   /*!< ascii85-encoded uncompressed cmap   */
+    char              *cmapdatahex;  /*!< hex pdf array for the cmap          */
+    l_int32            ncolors;      /*!< number of colors in cmap            */
+    l_int32            w;            /*!< image width                         */
+    l_int32            h;            /*!< image height                        */
+    l_int32            bps;          /*!< bits/sample; typ. 1, 2, 4 or 8      */
+    l_int32            spp;          /*!< samples/pixel; typ. 1 or 3          */
+    l_int32            minisblack;   /*!< tiff g4 photometry                  */
+    l_int32            predictor;    /*!< flate data has PNG predictors       */
+    size_t             nbytes;       /*!< number of uncompressed raster bytes */
+    l_int32            res;          /*!< resolution (ppi)                    */
 };
 typedef struct L_Compressed_Data  L_COMP_DATA;
 
 
-/* ------------------------ Pdf multi-image flags ------------------------ */
+/* ------------------------------------------------------------------------- *
+ *                           Pdf multi image flags                           *
+ * ------------------------------------------------------------------------- */
+
+/*! Pdf multi image flags */
 enum {
-    L_FIRST_IMAGE   = 1,    /* first image to be used                      */
-    L_NEXT_IMAGE    = 2,    /* intermediate image; not first or last       */
-    L_LAST_IMAGE    = 3     /* last image to be used                       */
+    L_FIRST_IMAGE   = 1,    /*!< first image to be used                      */
+    L_NEXT_IMAGE    = 2,    /*!< intermediate image; not first or last       */
+    L_LAST_IMAGE    = 3     /*!< last image to be used                       */
 };
 
 
-/* ------------------ Intermediate pdf generation data -------------------- */
+/* ------------------------------------------------------------------------- *
+ *                     Intermediate pdf generation data                      *
+ * ------------------------------------------------------------------------- */
 /*
  *  This accumulates data for generating a pdf of a single page consisting
  *  of an arbitrary number of images.
  *
  *  None of the strings have a trailing newline.
  */
+
+/*! Intermediate pdf generation data */
 struct L_Pdf_Data
 {
-    char              *title;        /* optional title for pdf              */
-    l_int32            n;            /* number of images                    */
-    l_int32            ncmap;        /* number of colormaps                 */
-    struct L_Ptra     *cida;         /* array of compressed image data      */
-    char              *id;           /* %PDF-1.2 id string                  */
-    char              *obj1;         /* catalog string                      */
-    char              *obj2;         /* metadata string                     */
-    char              *obj3;         /* pages string                        */
-    char              *obj4;         /* page string (variable data)         */
-    char              *obj5;         /* content string (variable data)      */
-    char              *poststream;   /* post-binary-stream string           */
-    char              *trailer;      /* trailer string (variable data)      */
-    struct Pta        *xy;           /* store (xpt, ypt) array              */
-    struct Pta        *wh;           /* store (wpt, hpt) array              */
-    struct Box        *mediabox;     /* bounding region for all images      */
-    struct Sarray     *saprex;       /* pre-binary-stream xobject strings   */
-    struct Sarray     *sacmap;       /* colormap pdf object strings         */
-    struct L_Dna      *objsize;      /* sizes of each pdf string object     */
-    struct L_Dna      *objloc;       /* location of each pdf string object  */
-    l_int32            xrefloc;      /* location of xref                    */
+    char              *title;        /*!< optional title for pdf              */
+    l_int32            n;            /*!< number of images                    */
+    l_int32            ncmap;        /*!< number of colormaps                 */
+    struct L_Ptra     *cida;         /*!< array of compressed image data      */
+    char              *id;           /*!< %PDF-1.2 id string                  */
+    char              *obj1;         /*!< catalog string                      */
+    char              *obj2;         /*!< metadata string                     */
+    char              *obj3;         /*!< pages string                        */
+    char              *obj4;         /*!< page string (variable data)         */
+    char              *obj5;         /*!< content string (variable data)      */
+    char              *poststream;   /*!< post-binary-stream string           */
+    char              *trailer;      /*!< trailer string (variable data)      */
+    struct Pta        *xy;           /*!< store (xpt, ypt) array              */
+    struct Pta        *wh;           /*!< store (wpt, hpt) array              */
+    struct Box        *mediabox;     /*!< bounding region for all images      */
+    struct Sarray     *saprex;       /*!< pre-binary-stream xobject strings   */
+    struct Sarray     *sacmap;       /*!< colormap pdf object strings         */
+    struct L_Dna      *objsize;      /*!< sizes of each pdf string object     */
+    struct L_Dna      *objloc;       /*!< location of each pdf string object  */
+    l_int32            xrefloc;      /*!< location of xref                    */
 };
 typedef struct L_Pdf_Data  L_PDF_DATA;
 

+ 67 - 59
include/leptonica/jbclass.h

@@ -10,7 +10,7 @@
  -     copyright notice, this list of conditions and the following
  -     disclaimer in the documentation and/or other materials
  -     provided with the distribution.
- - 
+ -
  -  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  -  ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  -  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -27,63 +27,69 @@
 #ifndef  LEPTONICA_JBCLASS_H
 #define  LEPTONICA_JBCLASS_H
 
-/*
- * jbclass.h
+/*!
+ * \file jbclass.h
  *
  *       JbClasser
  *       JbData
  */
 
 
-    /* The JbClasser struct holds all the data accumulated during the
+    /*!
+     * <pre>
+     * The JbClasser struct holds all the data accumulated during the
      * classification process that can be used for a compressed
      * jbig2-type representation of a set of images.  This is created
      * in an initialization process and added to as the selected components
-     * on each successive page are analyzed.   */
+     * on each successive page are analyzed.
+     * </pre>
+     */
 struct JbClasser
 {
-    struct Sarray   *safiles;      /* input page image file names            */
-    l_int32          method;       /* JB_RANKHAUS, JB_CORRELATION            */
-    l_int32          components;   /* JB_CONN_COMPS, JB_CHARACTERS or        */
-                                   /* JB_WORDS                               */
-    l_int32          maxwidth;     /* max component width allowed            */
-    l_int32          maxheight;    /* max component height allowed           */
-    l_int32          npages;       /* number of pages already processed      */
-    l_int32          baseindex;    /* number of components already processed */
-                                   /* on fully processed pages               */
-    struct Numa     *nacomps;      /* number of components on each page      */
-    l_int32          sizehaus;     /* size of square struct element for haus */
-    l_float32        rankhaus;     /* rank val of haus match, each way       */
-    l_float32        thresh;       /* thresh value for correlation score     */
-    l_float32        weightfactor; /* corrects thresh value for heaver       */
-                                   /* components; use 0 for no correction    */
-    struct Numa     *naarea;       /* w * h of each template, without extra  */
-                                   /* border pixels                          */
-    l_int32          w;            /* max width of original src images       */
-    l_int32          h;            /* max height of original src images      */
-    l_int32          nclass;       /* current number of classes              */
-    l_int32          keep_pixaa;   /* If zero, pixaa isn't filled            */
-    struct Pixaa    *pixaa;        /* instances for each class; unbordered   */
-    struct Pixa     *pixat;        /* templates for each class; bordered     */
-                                   /* and not dilated                        */
-    struct Pixa     *pixatd;       /* templates for each class; bordered     */
-                                   /* and dilated                            */
-    struct NumaHash *nahash;       /* Hash table to find templates by size   */
-    struct Numa     *nafgt;        /* fg areas of undilated templates;       */
-                                   /* only used for rank < 1.0               */
-    struct Pta      *ptac;         /* centroids of all bordered cc           */
-    struct Pta      *ptact;        /* centroids of all bordered template cc  */
-    struct Numa     *naclass;      /* array of class ids for each component  */
-    struct Numa     *napage;       /* array of page nums for each component  */
-    struct Pta      *ptaul;        /* array of UL corners at which the       */
-                                   /* template is to be placed for each      */
-                                   /* component                              */
-    struct Pta      *ptall;        /* similar to ptaul, but for LL corners   */
+    struct Sarray   *safiles;      /*!< input page image file names          */
+    l_int32          method;       /*!< JB_RANKHAUS, JB_CORRELATION          */
+    l_int32          components;   /*!< JB_CONN_COMPS, JB_CHARACTERS or      */
+                                   /*!< JB_WORDS                             */
+    l_int32          maxwidth;     /*!< max component width allowed          */
+    l_int32          maxheight;    /*!< max component height allowed         */
+    l_int32          npages;       /*!< number of pages already processed    */
+    l_int32          baseindex;    /*!< number components already processed  */
+                                   /*!< on fully processed pages             */
+    struct Numa     *nacomps;      /*!< number of components on each page    */
+    l_int32          sizehaus;     /*!< size of square struct elem for haus  */
+    l_float32        rankhaus;     /*!< rank val of haus match, each way     */
+    l_float32        thresh;       /*!< thresh value for correlation score   */
+    l_float32        weightfactor; /*!< corrects thresh value for heaver     */
+                                   /*!< components; use 0 for no correction  */
+    struct Numa     *naarea;       /*!< w * h of each template, without      */
+                                   /*!< extra border pixels                  */
+    l_int32          w;            /*!< max width of original src images     */
+    l_int32          h;            /*!< max height of original src images    */
+    l_int32          nclass;       /*!< current number of classes            */
+    l_int32          keep_pixaa;   /*!< If zero, pixaa isn't filled          */
+    struct Pixaa    *pixaa;        /*!< instances for each class; unbordered */
+    struct Pixa     *pixat;        /*!< templates for each class; bordered   */
+                                   /*!< and not dilated                      */
+    struct Pixa     *pixatd;       /*!< templates for each class; bordered   */
+                                   /*!< and dilated                          */
+    struct L_DnaHash *dahash;      /*!< Hash table to find templates by size */
+    struct Numa     *nafgt;        /*!< fg areas of undilated templates;     */
+                                   /*!< only used for rank < 1.0             */
+    struct Pta      *ptac;         /*!< centroids of all bordered cc         */
+    struct Pta      *ptact;        /*!< centroids of all bordered template cc */
+    struct Numa     *naclass;      /*!< array of class ids for each component */
+    struct Numa     *napage;       /*!< array of page nums for each component */
+    struct Pta      *ptaul;        /*!< array of UL corners at which the     */
+                                   /*!< template is to be placed for each    */
+                                   /*!< component                            */
+    struct Pta      *ptall;        /*!< similar to ptaul, but for LL corners */
 };
 typedef struct JbClasser  JBCLASSER;
 
 
-    /* The JbData struct holds all the data required for
+    /*!
+     * <pre>
+     * The JbData struct holds all the data required for
      * the compressed jbig-type representation of a set of images.
      * The data can be written to file, read back, and used
      * to regenerate an approximate version of the original,
@@ -92,39 +98,41 @@ typedef struct JbClasser  JBCLASSER;
      *       original instance, for each occurrence on each page.
      *   (2) It discards components with either a height or width larger
      *       than the maximuma, given here by the lattice dimensions
-     *       used for storing the templates.   */
+     *       used for storing the templates.
+     * </pre>
+     */
 struct JbData
 {
-    struct Pix         *pix;        /* template composite for all classes    */
-    l_int32             npages;     /* number of pages                       */
-    l_int32             w;          /* max width of original page images     */
-    l_int32             h;          /* max height of original page images    */
-    l_int32             nclass;     /* number of classes                     */
-    l_int32             latticew;   /* lattice width for template composite  */
-    l_int32             latticeh;   /* lattice height for template composite */
-    struct Numa        *naclass;    /* array of class ids for each component */
-    struct Numa        *napage;     /* array of page nums for each component */
-    struct Pta         *ptaul;      /* array of UL corners at which the      */
-                                    /* template is to be placed for each     */
-                                    /* component                             */
+    struct Pix      *pix;        /*!< template composite for all classes    */
+    l_int32          npages;     /*!< number of pages                       */
+    l_int32          w;          /*!< max width of original page images     */
+    l_int32          h;          /*!< max height of original page images    */
+    l_int32          nclass;     /*!< number of classes                     */
+    l_int32          latticew;   /*!< lattice width for template composite  */
+    l_int32          latticeh;   /*!< lattice height for template composite */
+    struct Numa     *naclass;    /*!< array of class ids for each component */
+    struct Numa     *napage;     /*!< array of page nums for each component */
+    struct Pta      *ptaul;      /*!< array of UL corners at which the      */
+                                 /*!< template is to be placed for each     */
+                                 /*!< component                             */
 };
 typedef struct JbData  JBDATA;
 
 
-    /* Classifier methods */
+    /*! Classifier methods */
 enum {
    JB_RANKHAUS = 0,
    JB_CORRELATION = 1
 };
 
-    /* For jbGetComponents(): type of component to extract from images */
+    /*! For jbGetComponents(): type of component to extract from images */
 enum {
    JB_CONN_COMPS = 0,
    JB_CHARACTERS = 1,
    JB_WORDS = 2
 };
 
-    /* These parameters are used for naming the two files
+    /*! These parameters are used for naming the two files
      * in which the jbig2-like compressed data is stored.  */
 #define   JB_TEMPLATE_EXT      ".templates.png"
 #define   JB_DATA_EXT          ".data"

+ 9 - 6
include/leptonica/list.h

@@ -10,7 +10,7 @@
  -     copyright notice, this list of conditions and the following
  -     disclaimer in the documentation and/or other materials
  -     provided with the distribution.
- - 
+ -
  -  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  -  ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  -  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -28,12 +28,13 @@
 #ifndef  LEPTONICA_LIST_H
 #define  LEPTONICA_LIST_H
 
-/*
- *   list.h
+/*!
+ * \file list.h
  *
+ * <pre>
  *       Cell for double-linked lists
  *
- *       This allows composition of a list of cells with 
+ *       This allows composition of a list of cells with
  *           prev, next and data pointers.  Generic data
  *           structures hang on the list cell data pointers.
  *
@@ -54,7 +55,7 @@
  *             L_BEGIN_LIST_FORWARD(head, elem)
  *                 <do something with elem and/or elem->data >
  *             L_END_LIST
- *
+ * </pre>
  */
 
 struct DoubleLinkedList
@@ -66,7 +67,7 @@ struct DoubleLinkedList
 typedef struct DoubleLinkedList    DLLIST;
 
 
-    /*  Simple list traverse macros */
+    /*!  Simple list traverse macro - forward */
 #define L_BEGIN_LIST_FORWARD(head, element) \
         { \
         DLLIST   *_leptvar_nextelem_; \
@@ -74,6 +75,7 @@ typedef struct DoubleLinkedList    DLLIST;
             _leptvar_nextelem_ = (element)->next;
 
 
+    /*!  Simple list traverse macro - reverse */
 #define L_BEGIN_LIST_REVERSE(tail, element) \
         { \
         DLLIST   *_leptvar_prevelem_; \
@@ -81,6 +83,7 @@ typedef struct DoubleLinkedList    DLLIST;
             _leptvar_prevelem_ = (element)->prev;
 
 
+    /*!  Simple list traverse macro - end of a list traverse */
 #define L_END_LIST    }}
 
 

+ 57 - 38
include/leptonica/morph.h

@@ -10,7 +10,7 @@
  -     copyright notice, this list of conditions and the following
  -     disclaimer in the documentation and/or other materials
  -     provided with the distribution.
- - 
+ -
  -  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  -  ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  -  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -27,9 +27,10 @@
 #ifndef  LEPTONICA_MORPH_H
 #define  LEPTONICA_MORPH_H
 
-/* 
- *  morph.h
+/*!
+ * \file morph.h
  *
+ * <pre>
  *  Contains the following structs:
  *      struct Sel
  *      struct Sela
@@ -49,6 +50,7 @@
  *      distance function b.c. flags
  *      image comparison flags
  *      color content flags
+ * </pre>
  */
 
 /*-------------------------------------------------------------------------*
@@ -56,22 +58,24 @@
  *-------------------------------------------------------------------------*/
 #define  SEL_VERSION_NUMBER    1
 
+/*! Selection */
 struct Sel
 {
-    l_int32       sy;          /* sel height                               */
-    l_int32       sx;          /* sel width                                */
-    l_int32       cy;          /* y location of sel origin                 */
-    l_int32       cx;          /* x location of sel origin                 */
-    l_int32     **data;        /* {0,1,2}; data[i][j] in [row][col] order  */
-    char         *name;        /* used to find sel by name                 */
+    l_int32       sy;        /*!< sel height                               */
+    l_int32       sx;        /*!< sel width                                */
+    l_int32       cy;        /*!< y location of sel origin                 */
+    l_int32       cx;        /*!< x location of sel origin                 */
+    l_int32     **data;      /*!< {0,1,2}; data[i][j] in [row][col] order  */
+    char         *name;      /*!< used to find sel by name                 */
 };
 typedef struct Sel SEL;
 
+/*! Array of Sel */
 struct Sela
 {
-    l_int32          n;         /* number of sel actually stored           */
-    l_int32          nalloc;    /* size of allocated ptr array             */
-    struct Sel     **sel;       /* sel ptr array                           */
+    l_int32          n;       /*!< number of sel actually stored           */
+    l_int32          nalloc;  /*!< size of allocated ptr array             */
+    struct Sel     **sel;     /*!< sel ptr array                           */
 };
 typedef struct Sela SELA;
 
@@ -81,63 +85,70 @@ typedef struct Sela SELA;
  *-------------------------------------------------------------------------*/
 #define  KERNEL_VERSION_NUMBER    2
 
+/*! Kernel */
 struct L_Kernel
 {
-    l_int32       sy;          /* kernel height                            */
-    l_int32       sx;          /* kernel width                             */
-    l_int32       cy;          /* y location of kernel origin              */
-    l_int32       cx;          /* x location of kernel origin              */
-    l_float32   **data;        /* data[i][j] in [row][col] order           */
+    l_int32       sy;        /*!< kernel height                            */
+    l_int32       sx;        /*!< kernel width                             */
+    l_int32       cy;        /*!< y location of kernel origin              */
+    l_int32       cx;        /*!< x location of kernel origin              */
+    l_float32   **data;      /*!< data[i][j] in [row][col] order           */
 };
 typedef struct L_Kernel  L_KERNEL;
 
 
 /*-------------------------------------------------------------------------*
  *                 Morphological boundary condition flags                  *
- *
- *  Two types of boundary condition for erosion.
- *  The global variable MORPH_BC takes on one of these two values.
- *  See notes in morph.c for usage.
+ *                                                                         *
+ *  Two types of boundary condition for erosion.                           *
+ *  The global variable MORPH_BC takes on one of these two values.         *
+ *  See notes in morph.c for usage.                                        *
  *-------------------------------------------------------------------------*/
+
+/*! Morphological boundary condition flags */
 enum {
     SYMMETRIC_MORPH_BC = 0,
     ASYMMETRIC_MORPH_BC = 1
 };
 
-
 /*-------------------------------------------------------------------------*
  *                        Structuring element types                        *
  *-------------------------------------------------------------------------*/
+
+/*! Structuring element types */
 enum {
     SEL_DONT_CARE  = 0,
     SEL_HIT        = 1,
     SEL_MISS       = 2
 };
 
-
 /*-------------------------------------------------------------------------*
  *                  Runlength flags for granulometry                       *
  *-------------------------------------------------------------------------*/
+
+/*! Runlength flags for granulometry */
 enum {
     L_RUN_OFF = 0,
     L_RUN_ON  = 1
 };
 
-
 /*-------------------------------------------------------------------------*
  *         Direction flags for grayscale morphology, granulometry,         *
- *                   composable Sels, and convolution                      *
+ *                 composable Sels, convolution, etc.                      *
  *-------------------------------------------------------------------------*/
+
+/*! Direction flags */
 enum {
     L_HORIZ            = 1,
     L_VERT             = 2,
     L_BOTH_DIRECTIONS  = 3
 };
 
-
 /*-------------------------------------------------------------------------*
  *                   Morphological operation flags                         *
  *-------------------------------------------------------------------------*/
+
+/*! Morphological operation flags */
 enum {
     L_MORPH_DILATE    = 1,
     L_MORPH_ERODE     = 2,
@@ -146,29 +157,32 @@ enum {
     L_MORPH_HMT       = 5
 };
 
-
 /*-------------------------------------------------------------------------*
  *                    Grayscale intensity scaling flags                    *
  *-------------------------------------------------------------------------*/
+
+/*! Grayscale intensity scaling flags */
 enum {
     L_LINEAR_SCALE  = 1,
     L_LOG_SCALE     = 2
 };
 
-
 /*-------------------------------------------------------------------------*
  *                      Morphological tophat flags                         *
  *-------------------------------------------------------------------------*/
+
+/*! Morphological tophat flags */
 enum {
     L_TOPHAT_WHITE = 0,
     L_TOPHAT_BLACK = 1
 };
 
-
 /*-------------------------------------------------------------------------*
  *                Arithmetic and logical operator flags                    *
  *                 (use on grayscale images and Numas)                     *
  *-------------------------------------------------------------------------*/
+
+/*! Arithmetic and logical operator flags */
 enum {
     L_ARITH_ADD       = 1,
     L_ARITH_SUBTRACT  = 2,
@@ -180,50 +194,55 @@ enum {
     L_EXCLUSIVE_OR    = 8    /* on numas only */
 };
 
-
 /*-------------------------------------------------------------------------*
  *                        Min/max selection flags                          *
  *-------------------------------------------------------------------------*/
+
+/*! Min/max selection flags */
 enum {
-    L_CHOOSE_MIN = 1,           /* useful in a downscaling "erosion"  */
-    L_CHOOSE_MAX = 2,           /* useful in a downscaling "dilation" */
-    L_CHOOSE_MAX_MIN_DIFF = 3   /* useful in a downscaling contrast   */
+    L_CHOOSE_MIN = 1,         /* useful in a downscaling "erosion"       */
+    L_CHOOSE_MAX = 2,         /* useful in a downscaling "dilation"      */
+    L_CHOOSE_MAXDIFF = 3,     /* useful in a downscaling contrast        */
+    L_CHOOSE_MIN_BOOST = 4,   /* use a modification of the min value     */
+    L_CHOOSE_MAX_BOOST = 5    /* use a modification of the max value     */
 };
 
-
 /*-------------------------------------------------------------------------*
  *                    Distance function b.c. flags                         *
  *-------------------------------------------------------------------------*/
+
+/*! Distance function b.c. flags */
 enum {
     L_BOUNDARY_BG = 1,  /* assume bg outside image */
     L_BOUNDARY_FG = 2   /* assume fg outside image */
 };
 
-
 /*-------------------------------------------------------------------------*
  *                         Image comparison flags                          *
  *-------------------------------------------------------------------------*/
+
+/*! Image comparison flags */
 enum {
     L_COMPARE_XOR = 1,
     L_COMPARE_SUBTRACT = 2,
     L_COMPARE_ABS_DIFF = 3
 };
 
-
 /*-------------------------------------------------------------------------*
  *                          Color content flags                            *
  *-------------------------------------------------------------------------*/
+
+/*! Color content flags */
 enum {
     L_MAX_DIFF_FROM_AVERAGE_2 = 1,
     L_MAX_MIN_DIFF_FROM_2 = 2,
     L_MAX_DIFF = 3
 };
 
-
 /*-------------------------------------------------------------------------*
  *    Standard size of border added around images for special processing   *
  *-------------------------------------------------------------------------*/
-static const l_int32  ADDED_BORDER = 32;   /* pixels, not bits */
+static const l_int32  ADDED_BORDER = 32;   /*!< pixels, not bits */
 
 
 #endif  /* LEPTONICA_MORPH_H */

Diferenças do arquivo suprimidas por serem muito extensas
+ 663 - 448
include/leptonica/pix.h


+ 26 - 22
include/leptonica/ptra.h

@@ -10,7 +10,7 @@
  -     copyright notice, this list of conditions and the following
  -     disclaimer in the documentation and/or other materials
  -     provided with the distribution.
- - 
+ -
  -  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  -  ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  -  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -27,7 +27,10 @@
 #ifndef  LEPTONICA_PTRA_H
 #define  LEPTONICA_PTRA_H
 
-/*
+/*!
+ * \file ptra.h
+ *
+ * <pre>
  *  Contains the following structs:
  *      struct L_Ptra
  *      struct L_Ptraa
@@ -36,55 +39,56 @@
  *      L_Ptra compaction flags for removal
  *      L_Ptra shifting flags for insert
  *      L_Ptraa accessor flags
+ * </pre>
  */
 
 
-/*------------------------------------------------------------------------* 
+/*------------------------------------------------------------------------*
  *                     Generic Ptr Array Structs                          *
  *------------------------------------------------------------------------*/
 
-    /* Generic pointer array */
+    /*! Generic pointer array */
 struct L_Ptra
 {
-    l_int32          nalloc;    /* size of allocated ptr array         */
-    l_int32          imax;      /* greatest valid index                */
-    l_int32          nactual;   /* actual number of stored elements    */
-    void           **array;     /* ptr array                           */
+    l_int32          nalloc;    /*!< size of allocated ptr array         */
+    l_int32          imax;      /*!< greatest valid index                */
+    l_int32          nactual;   /*!< actual number of stored elements    */
+    void           **array;     /*!< ptr array                           */
 };
 typedef struct L_Ptra  L_PTRA;
 
 
-    /* Array of generic pointer arrays */
+    /*! Array of generic pointer arrays */
 struct L_Ptraa
 {
-    l_int32          nalloc;    /* size of allocated ptr array         */
-    struct L_Ptra  **ptra;      /* array of ptra                       */
+    l_int32          nalloc;    /*!< size of allocated ptr array         */
+    struct L_Ptra  **ptra;      /*!< array of ptra                       */
 };
 typedef struct L_Ptraa  L_PTRAA;
 
 
 
-/*------------------------------------------------------------------------* 
+/*------------------------------------------------------------------------*
  *                              Array flags                               *
  *------------------------------------------------------------------------*/
 
-    /* Flags for removal from L_Ptra */
+    /*! Flags for removal from L_Ptra */
 enum {
-    L_NO_COMPACTION = 1,        /* null the pointer only  */
-    L_COMPACTION = 2            /* compact the array      */
+    L_NO_COMPACTION = 1,        /*!< null the pointer only                */
+    L_COMPACTION = 2            /*!< compact the array                    */
 };
 
-    /* Flags for insertion into L_Ptra */
+    /*! Flags for insertion into L_Ptra */
 enum {
-    L_AUTO_DOWNSHIFT = 0,       /* choose based on number of holes        */
-    L_MIN_DOWNSHIFT = 1,        /* downshifts min # of ptrs below insert  */
-    L_FULL_DOWNSHIFT = 2        /* downshifts all ptrs below insert       */
+    L_AUTO_DOWNSHIFT = 0,     /*!< choose based on number of holes        */
+    L_MIN_DOWNSHIFT = 1,      /*!< downshifts min # of ptrs below insert  */
+    L_FULL_DOWNSHIFT = 2      /*!< downshifts all ptrs below insert       */
 };
 
-    /* Accessor flags for L_Ptraa */
+    /*! Accessor flags for L_Ptraa */
 enum {
-    L_HANDLE_ONLY = 0,          /* ptr to L_Ptra; caller can inspect only    */
-    L_REMOVE = 1                /* caller owns; destroy or save in L_Ptraa   */
+    L_HANDLE_ONLY = 0,     /*!< ptr to L_Ptra; caller can inspect only    */
+    L_REMOVE = 1           /*!< caller owns; destroy or save in L_Ptraa   */
 };
 
 

+ 13 - 10
include/leptonica/queue.h

@@ -10,7 +10,7 @@
  -     copyright notice, this list of conditions and the following
  -     disclaimer in the documentation and/or other materials
  -     provided with the distribution.
- - 
+ -
  -  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  -  ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  -  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -27,9 +27,10 @@
 #ifndef  LEPTONICA_QUEUE_H
 #define  LEPTONICA_QUEUE_H
 
-/*
- *  queue.h
+/*!
+ * \file queue.h
  *
+ * <pre>
  *      Expandable pointer queue for arbitrary void* data.
  *
  *      The L_Queue is a fifo that implements a queue of void* pointers.
@@ -44,7 +45,7 @@
  *      be removed, is array[nhead].  The location at the tail of the
  *      queue to which the next element will be added is
  *      array[nhead + nelem].
- *               
+ *
  *      As items are added to the queue, nelem increases.
  *      As items are removed, nhead increases and nelem decreases.
  *      Any time the tail reaches the end of the allocated array,
@@ -56,16 +57,18 @@
  *      items popped from the queue.  It is not made by default.
  *
  *      For further implementation details, see queue.c.
+ * </pre>
  */
 
+/*! Expandable pointer queue for arbitrary void* data */
 struct L_Queue
 {
-    l_int32          nalloc;     /* size of allocated ptr array            */
-    l_int32          nhead;      /* location of head (in ptrs) from the    */
-                                 /* beginning of the array                 */
-    l_int32          nelem;      /* number of elements stored in the queue */
-    void           **array;      /* ptr array                              */
-    struct L_Stack  *stack;      /* auxiliary stack                        */
+    l_int32          nalloc;   /*!< size of allocated ptr array            */
+    l_int32          nhead;    /*!< location of head (in ptrs) from the    */
+                               /*!< beginning of the array                 */
+    l_int32          nelem;    /*!< number of elements stored in the queue */
+    void           **array;    /*!< ptr array                              */
+    struct L_Stack  *stack;    /*!< auxiliary stack                        */
 
 };
 typedef struct L_Queue L_QUEUE;

+ 90 - 0
include/leptonica/rbtree.h

@@ -0,0 +1,90 @@
+/*====================================================================*
+ -  Copyright (C) 2001 Leptonica.  All rights reserved.
+ -
+ -  Redistribution and use in source and binary forms, with or without
+ -  modification, are permitted provided that the following conditions
+ -  are met:
+ -  1. Redistributions of source code must retain the above copyright
+ -     notice, this list of conditions and the following disclaimer.
+ -  2. Redistributions in binary form must reproduce the above
+ -     copyright notice, this list of conditions and the following
+ -     disclaimer in the documentation and/or other materials
+ -     provided with the distribution.
+ -
+ -  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ -  ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ -  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ -  A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL ANY
+ -  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ -  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ -  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ -  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ -  OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ -  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ -  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *====================================================================*/
+
+/*
+ * Modified from the excellent code here:
+ *     http://en.literateprograms.org/Red-black_tree_(C)?oldid=19567
+ * which has been placed in the public domain under the Creative Commons
+ * CC0 1.0 waiver (http://creativecommons.org/publicdomain/zero/1.0/).
+ *
+ * When the key is generated from a hash (e.g., string --> uint64),
+ * there is always the possibility of having collisions, but to make
+ * the collision probability very low requires using a large hash.
+ * For that reason, the key types are 64 bit quantities, which will result
+ * in a negligible probabililty of collisions for millions of hashed values.
+ * Using 8 byte keys instead of 4 byte keys requires a little more
+ * storage, but the simplification in being able to ignore collisions
+ * with the red-black trees for most applications is worth it.
+ */
+
+#ifndef  LEPTONICA_RBTREE_H
+#define  LEPTONICA_RBTREE_H
+
+    /*! The three valid key types for red-black trees, maps and sets. */
+enum {
+    L_INT_TYPE = 1,
+    L_UINT_TYPE = 2,
+    L_FLOAT_TYPE = 3
+};
+
+    /*!
+     * Storage for keys and values for red-black trees, maps and sets.
+     * <pre>
+     * Note:
+     *   (1) Keys and values of the valid key types are all 64-bit
+     *   (2) (void *) can be used for values but not for keys.
+     * </pre>
+     */
+union Rb_Type {
+    l_int64    itype;
+    l_uint64   utype;
+    l_float64  ftype;
+    void      *ptype;
+};
+typedef union Rb_Type RB_TYPE;
+
+struct L_Rbtree {
+    struct L_Rbtree_Node  *root;
+    l_int32                keytype;
+};
+typedef struct L_Rbtree L_RBTREE;
+typedef struct L_Rbtree L_AMAP;  /* hide underlying implementation for map */
+typedef struct L_Rbtree L_ASET;  /* hide underlying implementation for set */
+
+struct L_Rbtree_Node {
+    union Rb_Type          key;
+    union Rb_Type          value;
+    struct L_Rbtree_Node  *left;
+    struct L_Rbtree_Node  *right;
+    struct L_Rbtree_Node  *parent;
+    l_int32                color;
+};
+typedef struct L_Rbtree_Node L_RBTREE_NODE;
+typedef struct L_Rbtree_Node L_AMAP_NODE;  /* hide tree implementation */
+typedef struct L_Rbtree_Node L_ASET_NODE;  /* hide tree implementation */
+
+
+#endif  /* LEPTONICA_RBTREE_H */

+ 23 - 15
include/leptonica/readbarcode.h

@@ -10,7 +10,7 @@
  -     copyright notice, this list of conditions and the following
  -     disclaimer in the documentation and/or other materials
  -     provided with the distribution.
- - 
+ -
  -  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  -  ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  -  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -30,9 +30,11 @@
     /* ----------------------------------------------------------------- *
      *            Flags for method of extracting barcode widths          *
      * ----------------------------------------------------------------- */
+
+/*! Flags for method of extracting barcode widths */
 enum {
-    L_USE_WIDTHS = 1,           /* use histogram of barcode widths           */
-    L_USE_WINDOWS = 2           /* find best window for decoding transitions */
+    L_USE_WIDTHS = 1,     /*!< use histogram of barcode widths           */
+    L_USE_WINDOWS = 2     /*!< find best window for decoding transitions */
 };
 
     /* ----------------------------------------------------------------- *
@@ -40,24 +42,28 @@ enum {
      * These are used both to identify a barcode format and to identify  *
      * the decoding method to use on a barcode.                          *
      * ----------------------------------------------------------------- */
+
+/*! Flags for barcode formats */
 enum {
-    L_BF_UNKNOWN = 0,           /* unknown format                            */
-    L_BF_ANY = 1,               /* try decoding with all known formats       */
-    L_BF_CODE128 = 2,           /* decode with Code128 format                */
-    L_BF_EAN8 = 3,              /* decode with EAN8 format                   */
-    L_BF_EAN13 = 4,             /* decode with EAN13 format                  */
-    L_BF_CODE2OF5 = 5,          /* decode with Code 2 of 5 format            */
-    L_BF_CODEI2OF5 = 6,         /* decode with Interleaved 2 of 5 format     */
-    L_BF_CODE39 = 7,            /* decode with Code39 format                 */
-    L_BF_CODE93 = 8,            /* decode with Code93 format                 */
-    L_BF_CODABAR = 9,           /* decode with Code93 format                 */
-    L_BF_UPCA = 10              /* decode with UPC A format                  */
+    L_BF_UNKNOWN = 0,     /*!< unknown format                            */
+    L_BF_ANY = 1,         /*!< try decoding with all known formats       */
+    L_BF_CODE128 = 2,     /*!< decode with Code128 format                */
+    L_BF_EAN8 = 3,        /*!< decode with EAN8 format                   */
+    L_BF_EAN13 = 4,       /*!< decode with EAN13 format                  */
+    L_BF_CODE2OF5 = 5,    /*!< decode with Code 2 of 5 format            */
+    L_BF_CODEI2OF5 = 6,   /*!< decode with Interleaved 2 of 5 format     */
+    L_BF_CODE39 = 7,      /*!< decode with Code39 format                 */
+    L_BF_CODE93 = 8,      /*!< decode with Code93 format                 */
+    L_BF_CODABAR = 9,     /*!< decode with Code93 format                 */
+    L_BF_UPCA = 10        /*!< decode with UPC A format                  */
 };
 
     /* ----------------------------------------------------------------- *
      *                  Currently supported formats                      *
      *            Update these arrays as new formats are added.          *
      * ----------------------------------------------------------------- */
+
+/*! Currently supported formats */
 static const l_int32  SupportedBarcodeFormat[] = {
     L_BF_CODE2OF5,
     L_BF_CODEI2OF5,
@@ -67,6 +73,8 @@ static const l_int32  SupportedBarcodeFormat[] = {
     L_BF_UPCA,
     L_BF_EAN13
 };
+
+/*! Currently supported format names */
 static const char  *SupportedBarcodeFormatName[] = {
     "Code2of5",
     "CodeI2of5",
@@ -76,7 +84,7 @@ static const char  *SupportedBarcodeFormatName[] = {
     "Upca",
     "Ean13"
 };
-static const l_int32  NumSupportedBarcodeFormats = 7;
+static const l_int32  NumSupportedBarcodeFormats = 7; /*!< Number of formats */
 
 
     /* ----------------------------------------------------------------- *

+ 189 - 184
include/leptonica/recog.h

@@ -27,232 +27,237 @@
 #ifndef  LEPTONICA_RECOG_H
 #define  LEPTONICA_RECOG_H
 
-/*
- *  recog.h
+/*!
+ * \file recog.h
  *
- *     A simple utility for training and recognizing individual
- *     machine-printed text characters.  In an application, one can
- *     envision using a number of these, one for each trained set.
+ * <pre>
+ *     This is a simple utility for training and recognizing individual
+ *     machine-printed text characters.  It is designed to be adapted
+ *     to a particular set of character images; e.g., from a book.
  *
- *     In training mode, a set of labelled bitmaps is presented, either
- *     one at a time, or in a directory, or in a pixa.  If in a directory,
- *     or a pixa, the labelling text string must be embedded in the
- *     text field of the image file.
+ *     There are two methods of training the recognizer.  In the most
+ *     simple, a set of bitmaps has been labeled by some means, such
+ *     a generic OCR program.  This is input either one template at a time
+ *     or as a pixa of templates, to a function that creates a recog.
+ *     If in a pixa, the text string label must be embedded in the
+ *     text field of each pix.
  *
- *     Any number of recognizers (L_Recog) can be trained and then used
- *     together in an array (L_Recoga).  All these trained structures
- *     can be serialized to file and read back.  The serialized version
- *     holds all the bitmaps used for training, plus, for arbitrary
- *     character sets, the UTF8 representation and the lookup table
- *     mapping from the character representation to index.
+ *     If labeled data is not available, we start with a bootstrap
+ *     recognizer (BSR) that has labeled data from a variety of sources.
+ *     These images are scaled, typically to a fixed height, and then
+ *     fed similarly scaled unlabeled images from the source (e.g., book),
+ *     and the BSR attempts to identify them.  All images that have
+ *     a high enough correlation score with one of the templates in the
+ *     BSR are emitted in a pixa, which now holds unscaled and labeled
+ *     templates from the source.  This is the generator for a book adapted
+ *     recognizer (BAR).
  *
- *     There are three levels of "sets" here:
+ *     The pixa should always be thought of as the primary structure.
+ *     It is the generator for the recog, because a recog is built
+ *     from a pixa of unscaled images.
  *
- *       (1) Example set: the examples representing a character that
- *           were printed in the same way, so that they can be combined
- *           without scaling to form an "average" template for the character.
- *           In the recognition phase, we use either this aligned average,
- *           or the individual bitmaps.  All examples in the set are given
- *           the same character label.   Example: the letter 'a' in the
- *           predominant font in a book.
+ *     New image templates can be added to a recog as long as it is
+ *     in training mode.  Once training is finished, to add templates
+ *     it is necessary to extract the generating pixa, add templates
+ *     to that pixa, and make a new recog.  Similarly, we do not
+ *     join two recog; instead, we simply join their generating pixa,
+ *     and make a recog from that.
  *
- *       (2) Character set (represented by L_Recog, a single recognizer):
- *           The set of different characters, each of which is described
- *           by (1).  Each element of the set has a different character
- *           label.  Example: the digits '0' through '9' that are used for
- *           page numbering in a book.
+ *     To remove outliers from a pixa of labeled pix, make a recog,
+ *     determine the outliers, and generate a new pixa with the
+ *     outliers removed.  The outliers are determined by building
+ *     special templates for each character set that are scaled averages
+ *     of the individual templates.  Then a correlation score is found
+ *     between each template and the averaged templates.  There are
+ *     two implementations; outliers are determined as either:
+ *      (1) a template having a correlation score with its class average
+ *          that is below a threshold, or
+ *      (2) a template having a correlation score with its class average
+ *          that is smaller than the correlation score with the average
+ *          of another class.
+ *     Outliers are removed from the generating pixa.  Scaled averaging
+ *     is only performed for determining outliers and for splitting
+ *     characters; it is never used in a trained recognizer for identifying
+ *     unlabeled samples.
  *
- *       (3) Recognizer set (represented by L_Recoga, an array of recogs):
- *           A set of recognizers, each of which is described by (2).
- *           In general, we do not want to combine the character sets
- *           with the same labels within different recognizer sets,
- *           because the bitmaps can differ in font type, style or size.
- *           Example 1: the letter 'a' can be printed in two very different
- *           ways (either with a large loop or with a smaller loop in
- *           the lower half); both share the same label but need to be
- *           distinguished so that they are not mixed when averaging.
- *           Example 2: a recognizer trained for a book may be missing
- *           some characters, so we need to supplement it with another
- *           "generic" or "bootstrap" recognizer that has the additional
- *           characters from a variety of sources.  Bootstrap recognizers
- *           must be run in a mode where all characters are scaled.
+ *     Two methods using averaged templates are provided for splitting
+ *     touching characters:
+ *      (1) greedy matching
+ *      (2) document image decoding (DID)
+ *     The DID method is the default.  It is about 5x faster and
+ *     possibly more accurate.
  *
- *     In the recognition process, for each component in an input image,
- *     each recognizer (L_Recog) records the best match (highest
- *     correlation score).  If there is more than one recognizer, these
- *     results are aggregated to find the best match for each character
- *     for all the recognizers, and this is stored in L_Recoga.
+ *     Once a BAR has been made, unlabeled sample images are identified
+ *     by finding the individual template in the BAR with highest
+ *     correlation.  The input images and images in the BAR can be
+ *     represented in two ways:
+ *      (1) as scanned, binarized to 1 bpp
+ *      (2) as a width-normalized outline formed by thinning to a
+ *          skeleton and then dilating by a fixed amount.
+ *
+ *     The recog can be serialized to file and read back.  The serialized
+ *     version holds the templates used for correlation (which may have
+ *     been modified by scaling and turning into lines from the unscaled
+ *     templates), plus, for arbitrary character sets, the UTF8
+ *     representation and the lookup table mapping from the character
+ *     representation to index.
+ *
+ *     Why do we not use averaged templates for recognition?
+ *     Letterforms can take on significantly different shapes (eg.,
+ *     the letters 'a' and 'g'), and it makes no sense to average these.
+ *     The previous version of this utility allowed multiple recognizers
+ *     to exist, but this is an unnecessary complication if recognition
+ *     is done on all samples instead of on averages.
+ * </pre>
  */
 
-#define  RECOG_VERSION_NUMBER      1
-
-struct L_Recoga {
-    l_int32              n;      /* number of recogs                         */
-    l_int32              nalloc; /* number of recog ptrs allocated           */
-    struct L_Recog     **recog;  /* recog ptr array                          */
-    struct L_Rcha       *rcha;   /* stores the array of best chars           */
-};
-typedef struct L_Recoga L_RECOGA;
-
+#define  RECOG_VERSION_NUMBER      2
 
 struct L_Recog {
-    l_int32        scalew;       /* scale all examples to this width;        */
-                                 /* use 0 prevent horizontal scaling         */
-    l_int32        scaleh;       /* scale all examples to this height;       */
-                                 /* use 0 prevent vertical scaling           */
-    l_int32        templ_type;   /* template type: either an average of      */
-                                 /* examples (L_USE_AVERAGE) or the set      */
-                                 /* of all examples (L_USE_ALL)              */
-    l_int32        maxarraysize; /* initialize container arrays to this      */
-    l_int32        setsize;      /* size of character set                    */
-    l_int32        threshold;    /* for binarizing if depth > 1              */
-    l_int32        maxyshift;    /* vertical jiggle on nominal centroid      */
-                                 /* alignment; typically 0 or 1              */
-    l_float32      asperity_fr;  /* +- allowed fractional asperity ratio     */
-    l_int32        charset_type; /* one of L_ARABIC_NUMERALS, etc.           */
-    l_int32        charset_size; /* expected number of classes in charset    */
-    char          *bootdir;      /* dir with bootstrap pixa charsets         */
-    char          *bootpattern;  /* file pattern for bootstrap pixa charsets */
-    char          *bootpath;     /* path for single bootstrap pixa charset   */
-    l_int32        min_nopad;    /* min number of samples without padding    */
-    l_int32        max_afterpad; /* max number of samples after padding      */
-    l_int32        samplenum;    /* keep track of number of training samples */
-    l_int32        minwidth_u;   /* min width of averaged unscaled templates */
-    l_int32        maxwidth_u;   /* max width of averaged unscaled templates */
-    l_int32        minheight_u;  /* min height of averaged unscaled templates */
-    l_int32        maxheight_u;  /* max height of averaged unscaled templates */
-    l_int32        minwidth;     /* min width of averaged scaled templates   */
-    l_int32        maxwidth;     /* max width of averaged scaled templates   */
-    l_int32        ave_done;     /* set to 1 when averaged bitmaps are made  */
-    l_int32        train_done;   /* set to 1 when training is complete or    */
-                                 /* identification has started               */
-    l_int32        min_splitw;   /* min component width kept in splitting    */
-    l_int32        min_splith;   /* min component height kept in splitting   */
-    l_int32        max_splith;   /* max component height kept in splitting   */
-    struct Sarray *sa_text;      /* text array for arbitrary char set        */
-    struct L_Dna  *dna_tochar;   /* index-to-char lut for arbitrary char set */
-    l_int32       *centtab;      /* table for finding centroids              */
-    l_int32       *sumtab;       /* table for finding pixel sums             */
-    char          *fname;        /* serialized filename (if read)            */
-    struct Pixaa  *pixaa_u;      /* all unscaled bitmaps for each class      */
-    struct Pixa   *pixa_u;       /* averaged unscaled bitmaps for each class */
-    struct Ptaa   *ptaa_u;       /* centroids of all unscaled bitmaps        */
-    struct Pta    *pta_u;        /* centroids of unscaled averaged bitmaps   */
-    struct Numaa  *naasum_u;     /* area of all unscaled bitmap examples     */
-    struct Numa   *nasum_u;      /* area of unscaled averaged bitmaps        */
-    struct Pixaa  *pixaa;        /* all bitmap examples for each class       */
-    struct Pixa   *pixa;         /* averaged bitmaps for each class          */
-    struct Ptaa   *ptaa;         /* centroids of all bitmap examples         */
-    struct Pta    *pta;          /* centroids of averaged bitmaps            */
-    struct Numaa  *naasum;       /* area of all bitmap examples              */
-    struct Numa   *nasum;        /* area of averaged bitmaps                 */
-    struct Pixa   *pixa_tr;      /* input training images                    */
-    struct Pixa   *pixadb_ave;   /* unscaled and scaled averaged bitmaps     */
-    struct Pixa   *pixa_id;      /* input images for identifying             */
-    struct Pix    *pixdb_ave;    /* debug: best match of input against ave.  */
-    struct Pix    *pixdb_range;  /* debug: best matches within range         */
-    struct Pixa   *pixadb_boot;  /* debug: bootstrap training results        */
-    struct Pixa   *pixadb_split; /* debug: splitting results                 */
-    char          *fontdir;      /* directory for bitmapped fonts            */
-    struct L_Bmf  *bmf;          /* bmf fonts                                */
-    l_int32        bmf_size;     /* font size of bmf; default is 6 pt        */
-    struct L_Rdid  *did;         /* temp data used for image decoding        */
-    struct L_Rch   *rch;         /* temp data used for holding best char     */
-    struct L_Rcha  *rcha;        /* temp data used for array of best chars   */
-    l_int32        bootrecog;    /* 1 if using bootstrap samples; else 0     */
-    l_int32        index;        /* recog index in recoga; -1 if no parent   */
-    struct L_Recoga  *parent;    /* ptr to parent array; can be null         */
-
+    l_int32        scalew;       /*!< scale all examples to this width;      */
+                                 /*!< use 0 prevent horizontal scaling       */
+    l_int32        scaleh;       /*!< scale all examples to this height;     */
+                                 /*!< use 0 prevent vertical scaling         */
+    l_int32        linew;        /*!< use a value > 0 to convert the bitmap  */
+                                 /*!< to lines of fixed width; 0 to skip     */
+    l_int32        templ_use;    /*!< template use: use either the average   */
+                                 /*!< or all temmplates (L_USE_AVERAGE or    */
+                                 /*!< L_USE_ALL)                             */
+    l_int32        maxarraysize; /*!< initialize container arrays to this    */
+    l_int32        setsize;      /*!< size of character set                  */
+    l_int32        threshold;    /*!< for binarizing if depth > 1            */
+    l_int32        maxyshift;    /*!< vertical jiggle on nominal centroid    */
+                                 /*!< alignment; typically 0 or 1            */
+    l_int32        charset_type; /*!< one of L_ARABIC_NUMERALS, etc.         */
+    l_int32        charset_size; /*!< expected number of classes in charset  */
+    l_int32        min_nopad;    /*!< min number of samples without padding  */
+    l_int32        num_samples;  /*!< number of training samples             */
+    l_int32        minwidth_u;   /*!< min width averaged unscaled templates  */
+    l_int32        maxwidth_u;   /*!< max width averaged unscaled templates  */
+    l_int32        minheight_u;  /*!< min height averaged unscaled templates */
+    l_int32        maxheight_u;  /*!< max height averaged unscaled templates */
+    l_int32        minwidth;     /*!< min width averaged scaled templates    */
+    l_int32        maxwidth;     /*!< max width averaged scaled templates    */
+    l_int32        ave_done;     /*!< set to 1 when averaged bitmaps are made */
+    l_int32        train_done;   /*!< set to 1 when training is complete or  */
+                                 /*!< identification has started             */
+    l_float32      max_wh_ratio; /*!< max width/height ratio to split        */
+    l_float32      max_ht_ratio; /*!< max of max/min template height ratio   */
+    l_int32        min_splitw;   /*!< min component width kept in splitting  */
+    l_int32        max_splith;   /*!< max component height kept in splitting */
+    struct Sarray *sa_text;      /*!< text array for arbitrary char set      */
+    struct L_Dna  *dna_tochar;   /*!< index-to-char lut for arbitrary charset */
+    l_int32       *centtab;      /*!< table for finding centroids            */
+    l_int32       *sumtab;       /*!< table for finding pixel sums           */
+    struct Pixaa  *pixaa_u;      /*!< all unscaled templates for each class  */
+    struct Ptaa   *ptaa_u;       /*!< centroids of all unscaled templates    */
+    struct Numaa  *naasum_u;     /*!< area of all unscaled templates         */
+    struct Pixaa  *pixaa;        /*!< all (scaled) templates for each class  */
+    struct Ptaa   *ptaa;         /*!< centroids of all (scaledl) templates   */
+    struct Numaa  *naasum;       /*!< area of all (scaled) templates         */
+    struct Pixa   *pixa_u;       /*!< averaged unscaled templates per class  */
+    struct Pta    *pta_u;        /*!< centroids of unscaled ave. templates   */
+    struct Numa   *nasum_u;      /*!< area of unscaled averaged templates    */
+    struct Pixa   *pixa;         /*!< averaged (scaled) templates per class  */
+    struct Pta    *pta;          /*!< centroids of (scaled) ave. templates   */
+    struct Numa   *nasum;        /*!< area of (scaled) averaged templates    */
+    struct Pixa   *pixa_tr;      /*!< all input training images              */
+    struct Pixa   *pixadb_ave;   /*!< unscaled and scaled averaged bitmaps   */
+    struct Pixa   *pixa_id;      /*!< input images for identifying           */
+    struct Pix    *pixdb_ave;    /*!< debug: best match of input against ave. */
+    struct Pix    *pixdb_range;  /*!< debug: best matches within range       */
+    struct Pixa   *pixadb_boot;  /*!< debug: bootstrap training results      */
+    struct Pixa   *pixadb_split; /*!< debug: splitting results               */
+    struct L_Bmf  *bmf;          /*!< bmf fonts                              */
+    l_int32        bmf_size;     /*!< font size of bmf; default is 6 pt      */
+    struct L_Rdid *did;          /*!< temp data used for image decoding      */
+    struct L_Rch  *rch;          /*!< temp data used for holding best char   */
+    struct L_Rcha *rcha;         /*!< temp data used for array of best chars */
 };
 typedef struct L_Recog L_RECOG;
 
-/*
+/*!
  *  Data returned from correlation matching on a single character
  */
 struct L_Rch {
-    l_int32        index;        /* index of best template                   */
-    l_float32      score;        /* correlation score of best template       */
-    char          *text;         /* character string of best template        */
-    l_int32        sample;       /* index of best sample (within the best    */
-                                 /* template class, if all samples are used) */
-    l_int32        xloc;         /* x-location of template (delx + shiftx)   */
-    l_int32        yloc;         /* y-location of template (dely + shifty)   */
-    l_int32        width;        /* width of best template                   */
+    l_int32        index;      /*!< index of best template                   */
+    l_float32      score;      /*!< correlation score of best template       */
+    char          *text;       /*!< character string of best template        */
+    l_int32        sample;     /*!< index of best sample (within the best    */
+                               /*!< template class, if all samples are used) */
+    l_int32        xloc;       /*!< x-location of template (delx + shiftx)   */
+    l_int32        yloc;       /*!< y-location of template (dely + shifty)   */
+    l_int32        width;      /*!< width of best template                   */
 };
 typedef struct L_Rch L_RCH;
 
-/*
+/*!
  *  Data returned from correlation matching on an array of characters
  */
 struct L_Rcha {
-    struct Numa   *naindex;      /* indices of best templates                */
-    struct Numa   *nascore;      /* correlation scores of best templates     */
-    struct Sarray *satext;       /* character strings of best templates      */
-    struct Numa   *nasample;     /* indices of best samples                  */
-    struct Numa   *naxloc;       /* x-locations of templates (delx + shiftx) */
-    struct Numa   *nayloc;       /* y-locations of templates (dely + shifty) */
-    struct Numa   *nawidth;      /* widths of best templates                 */
+    struct Numa   *naindex;    /*!< indices of best templates                */
+    struct Numa   *nascore;    /*!< correlation scores of best templates     */
+    struct Sarray *satext;     /*!< character strings of best templates      */
+    struct Numa   *nasample;   /*!< indices of best samples                  */
+    struct Numa   *naxloc;     /*!< x-locations of templates (delx + shiftx) */
+    struct Numa   *nayloc;     /*!< y-locations of templates (dely + shifty) */
+    struct Numa   *nawidth;    /*!< widths of best templates                 */
 };
 typedef struct L_Rcha L_RCHA;
 
-/*
+/*!
  *  Data used for decoding a line of characters.
  */
 struct L_Rdid {
-    struct Pix    *pixs;         /* clone of pix to be decoded               */
-    l_int32      **counta;       /* count array for each averaged template   */
-    l_int32      **delya;        /* best y-shift array per averaged template */
-    l_int32        narray;       /* number of averaged templates             */
-    l_int32        size;         /* size of count array (width of pixs)      */
-    l_int32       *setwidth;     /* setwidths for each template              */
-    struct Numa   *nasum;        /* pixel count in pixs by column            */
-    struct Numa   *namoment;     /* first moment of pixels in pixs by column */
-    l_int32        fullarrays;   /* 1 if full arrays are made; 0 otherwise   */
-    l_float32     *beta;         /* channel coeffs for template fg term      */
-    l_float32     *gamma;        /* channel coeffs for bit-and term          */
-    l_float32     *trellisscore; /* score on trellis                         */
-    l_int32       *trellistempl; /* template on trellis (for backtrack)      */
-    struct Numa   *natempl;      /* indices of best path templates           */
-    struct Numa   *naxloc;       /* x locations of best path templates       */
-    struct Numa   *nadely;       /* y locations of best path templates       */
-    struct Numa   *nawidth;      /* widths of best path templates            */
-    struct Numa   *nascore;      /* correlation scores: best path templates  */
-    struct Numa   *natempl_r;    /* indices of best rescored templates       */
-    struct Numa   *naxloc_r;     /* x locations of best rescoredtemplates    */
-    struct Numa   *nadely_r;     /* y locations of best rescoredtemplates    */
-    struct Numa   *nawidth_r;    /* widths of best rescoredtemplates         */
-    struct Numa   *nascore_r;    /* correlation scores: rescored templates   */
+    struct Pix    *pixs;         /*!< clone of pix to be decoded             */
+    l_int32      **counta;       /*!< count array for each averaged template */
+    l_int32      **delya;        /*!< best y-shift array per average template */
+    l_int32        narray;       /*!< number of averaged templates           */
+    l_int32        size;         /*!< size of count array (width of pixs)    */
+    l_int32       *setwidth;     /*!< setwidths for each template            */
+    struct Numa   *nasum;        /*!< pixel count in pixs by column          */
+    struct Numa   *namoment;     /*!< first moment of pixels in pixs by cols */
+    l_int32        fullarrays;   /*!< 1 if full arrays are made; 0 otherwise */
+    l_float32     *beta;         /*!< channel coeffs for template fg term    */
+    l_float32     *gamma;        /*!< channel coeffs for bit-and term        */
+    l_float32     *trellisscore; /*!< score on trellis                       */
+    l_int32       *trellistempl; /*!< template on trellis (for backtrack)    */
+    struct Numa   *natempl;      /*!< indices of best path templates         */
+    struct Numa   *naxloc;       /*!< x locations of best path templates     */
+    struct Numa   *nadely;       /*!< y locations of best path templates     */
+    struct Numa   *nawidth;      /*!< widths of best path templates          */
+    struct Boxa   *boxa;         /*!< Viterbi result for splitting input pixs */
+    struct Numa   *nascore;      /*!< correlation scores: best path templates */
+    struct Numa   *natempl_r;    /*!< indices of best rescored templates     */
+    struct Numa   *nasample_r;   /*!< samples of best scored templates       */
+    struct Numa   *naxloc_r;     /*!< x locations of best rescoredtemplates  */
+    struct Numa   *nadely_r;     /*!< y locations of best rescoredtemplates  */
+    struct Numa   *nawidth_r;    /*!< widths of best rescoredtemplates       */
+    struct Numa   *nascore_r;    /*!< correlation scores: rescored templates */
 };
 typedef struct L_Rdid L_RDID;
 
 
 /*-------------------------------------------------------------------------*
- *                    Flags for selecting processing                       *
- *-------------------------------------------------------------------------*/
-enum {
-    L_SELECT_UNSCALED = 0,       /* select the unscaled bitmaps            */
-    L_SELECT_SCALED = 1,         /* select the scaled bitmaps              */
-    L_SELECT_BOTH = 2            /* select both unscaled and scaled        */
-};
-
-/*-------------------------------------------------------------------------*
- *                Flags for determining what to test against               *
+ *             Flags for describing limited character sets                 *
  *-------------------------------------------------------------------------*/
+/*! Flags for describing limited character sets */
 enum {
-    L_USE_AVERAGE = 0,         /* form template from class average         */
-    L_USE_ALL = 1              /* match against all elements of each class */
+    L_UNKNOWN = 0,           /*!< character set type is not specified      */
+    L_ARABIC_NUMERALS = 1,   /*!< 10 digits                                */
+    L_LC_ROMAN_NUMERALS = 2, /*!< 7 lower-case letters (i,v,x,l,c,d,m)     */
+    L_UC_ROMAN_NUMERALS = 3, /*!< 7 upper-case letters (I,V,X,L,C,D,M)     */
+    L_LC_ALPHA = 4,          /*!< 26 lower-case letters                    */
+    L_UC_ALPHA = 5           /*!< 26 upper-case letters                    */
 };
 
 /*-------------------------------------------------------------------------*
- *             Flags for describing limited character sets                 *
+ *      Flags for selecting between using average and all templates        *
  *-------------------------------------------------------------------------*/
+/*! Flags for selecting average or all templates: recog->templ_use */
 enum {
-    L_UNKNOWN = 0,             /* character set type is not specified      */
-    L_ARABIC_NUMERALS = 1,     /* 10 digits                                */
-    L_LC_ROMAN_NUMERALS = 2,   /* 7 lower-case letters (i,v,x,l,c,d,m)     */
-    L_UC_ROMAN_NUMERALS = 3,   /* 7 upper-case letters (I,V,X,L,C,D,M)     */
-    L_LC_ALPHA = 4,            /* 26 lower-case letters                    */
-    L_UC_ALPHA = 5             /* 26 upper-case letters                    */
+    L_USE_ALL_TEMPLATES = 0,     /*!< use all templates; default            */
+    L_USE_AVERAGE_TEMPLATES = 1  /*!< use average templates; special cases  */
 };
 
 #endif  /* LEPTONICA_RECOG_H */

+ 27 - 22
include/leptonica/regutils.h

@@ -10,7 +10,7 @@
  -     copyright notice, this list of conditions and the following
  -     disclaimer in the documentation and/or other materials
  -     provided with the distribution.
- - 
+ -
  -  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  -  ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  -  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -27,9 +27,10 @@
 #ifndef  LEPTONICA_REGUTILS_H
 #define  LEPTONICA_REGUTILS_H
 
-/*
- *   regutils.h
+/*!
+ * \file regutils.h
  *
+ * <pre>
  *   Contains this regression test parameter packaging struct
  *       struct L_RegParams
  *
@@ -40,21 +41,22 @@
  *   Regression tests can be called in three ways.
  *   For example, for distance_reg:
  *
- *       Case 1: distance_reg [generate]
- *           This generates golden files in /tmp for the reg test.
- *
- *       Case 2: distance_reg compare
+ *       Case 1: distance_reg [compare]
  *           This runs the test against the set of golden files.  It
  *           appends to 'outfile.txt' either "SUCCESS" or "FAILURE",
  *           as well as the details of any parts of the test that failed.
- *           It writes to a temporary file stream (fp)
+ *           It writes to a temporary file stream (fp).
+ *           Using 'compare' on the command line is optional.
+ *
+ *       Case 2: distance_reg generate
+ *           This generates golden files in /tmp for the reg test.
  *
  *       Case 3: distance_reg display
  *           This runs the test but makes no comparison of the output
  *           against the set of golden files.  In addition, this displays
  *           images and plots that are specified in the test under
  *           control of the display variable.  Display is enabled only
- *           for this case.  Using 'display' on the command line is optional.
+ *           for this case.
  *
  *   Regression tests follow the pattern given below.  Tests are
  *   automatically numbered sequentially, and it is convenient to
@@ -93,7 +95,7 @@
  *       //     case 2: compares the local file with a golden file
  *       //     case 3: generates local files and displays
  *       // Here we write the pix compressed with png and jpeg, respectively;
- *       // Then check against the golden file.  The internal @index
+ *       // Then check against the golden file.  The internal %index
  *       // is incremented; it is embedded in the local filename and,
  *       // if generating, in the golden file as well.
  *       regTestWritePixAndCheck(rp, pix1, IFF_PNG);  // 5
@@ -104,26 +106,29 @@
  *
  *       // Clean up and output result
  *       regTestCleanup(rp);
+ * </pre>
  */
 
-/*-------------------------------------------------------------------------*
- *                     Regression test parameter packer                    *
- *-------------------------------------------------------------------------*/
+/*----------------------------------------------------------------------------*
+ *                      Regression test parameter packer                      *
+ *----------------------------------------------------------------------------*/
+
+/*! Regression test parameter packer */
 struct L_RegParams
 {
-    FILE    *fp;        /* stream to temporary output file for compare mode */
-    char    *testname;  /* name of test, without '_reg'                     */
-    char    *tempfile;  /* name of temp file for compare mode output        */
-    l_int32  mode;      /* generate, compare or display                     */
-    l_int32  index;     /* index into saved files for this test; 0-based    */
-    l_int32  success;   /* overall result of the test                       */
-    l_int32  display;   /* 1 if in display mode; 0 otherwise                */
-    L_TIMER  tstart;    /* marks beginning of the reg test                  */
+    FILE    *fp;        /*!< stream to temporary output file for compare mode */
+    char    *testname;  /*!< name of test, without '_reg'                     */
+    char    *tempfile;  /*!< name of temp file for compare mode output        */
+    l_int32  mode;      /*!< generate, compare or display                     */
+    l_int32  index;     /*!< index into saved files for this test; 0-based    */
+    l_int32  success;   /*!< overall result of the test                       */
+    l_int32  display;   /*!< 1 if in display mode; 0 otherwise                */
+    L_TIMER  tstart;    /*!< marks beginning of the reg test                  */
 };
 typedef struct L_RegParams  L_REGPARAMS;
 
 
-    /* Running modes for the test */
+    /*! Running modes for the test */
 enum {
     L_REG_GENERATE = 0,
     L_REG_COMPARE = 1,

+ 13 - 9
include/leptonica/stack.h

@@ -10,7 +10,7 @@
  -     copyright notice, this list of conditions and the following
  -     disclaimer in the documentation and/or other materials
  -     provided with the distribution.
- - 
+ -
  -  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  -  ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  -  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -27,9 +27,10 @@
 #ifndef  LEPTONICA_STACK_H
 #define  LEPTONICA_STACK_H
 
-/*
- *  stack.h
+/*!
+ * \file stack.h
  *
+ * <pre>
  *       Expandable pointer stack for arbitrary void* data.
  *
  *       The L_Stack is an array of void * ptrs, onto which arbitrary
@@ -46,18 +47,21 @@
  *       The auxiliary stack can be used to store and remove
  *       objects for re-use.  It must be created by a separate
  *       call to pstackCreate().  [Just imagine the chaos if
- *       pstackCreate() created the auxiliary stack!]   
+ *       pstackCreate() created the auxiliary stack!]
  *       pstackDestroy() checks for the auxiliary stack and removes it.
+ * </pre>
  */
 
 
-    /* Note that array[n] is the first null ptr in the array */
+    /*! Expandable pointer stack for arbitrary void* data.
+     * Note that array[n] is the first null ptr in the array
+     */
 struct L_Stack
 {
-    l_int32          nalloc;       /* size of ptr array              */
-    l_int32          n;            /* number of stored elements      */
-    void           **array;        /* ptr array                      */
-    struct L_Stack  *auxstack;     /* auxiliary stack                */
+    l_int32          nalloc;     /*!< size of ptr array              */
+    l_int32          n;          /*!< number of stored elements      */
+    void           **array;      /*!< ptr array                      */
+    struct L_Stack  *auxstack;   /*!< auxiliary stack                */
 };
 typedef struct L_Stack  L_STACK;
 

+ 31 - 5
include/leptonica/freetype.h

@@ -24,11 +24,37 @@
  -  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *====================================================================*/
 
-#ifndef  LEPTONICA_FREETYPE_H
-#define  LEPTONICA_FREETYPE_H
+#ifndef  LEPTONICA_STRINGCODE_H
+#define  LEPTONICA_STRINGCODE_H
 
-#define  LEPTONICA_FT_RESOLUTION 96
+/*!
+ * \file stringcode.h
+ *
+ *     Data structure to hold accumulating generated code for storing
+ *     and extracing serializable leptonica objects (e.g., pixa, recog).
+ *
+ *     Also a flag for selecting a string from the L_GenAssoc struct
+ *     in stringcode.
+ */
 
-typedef struct ft_library_st FT_LIBRARY;
+struct L_StrCode
+{
+    l_int32       fileno;    /*!< index for function and output file names   */
+    l_int32       ifunc;     /*!< index into struct currently being stored   */
+    SARRAY       *function;  /*!< store case code for extraction             */
+    SARRAY       *data;      /*!< store base64 encoded data as strings       */
+    SARRAY       *descr;     /*!< store line in description table            */
+    l_int32       n;         /*!< number of data strings                     */
+};
+typedef struct L_StrCode  L_STRCODE;
 
-#endif  /* LEPTONICA_FREETYPE_H */
+
+/*! Select string in stringcode for a specific serializable data type */
+enum {
+    L_STR_TYPE = 0,      /*!< typedef for the data type                      */
+    L_STR_NAME = 1,      /*!< name of the data type                          */
+    L_STR_READER = 2,    /*!< reader to get the data type from file          */
+    L_STR_MEMREADER = 3  /*!< reader to get the compressed string in memory  */
+};
+
+#endif  /* LEPTONICA_STRINGCODE_H */

+ 20 - 17
include/leptonica/sudoku.h

@@ -10,7 +10,7 @@
  -     copyright notice, this list of conditions and the following
  -     disclaimer in the documentation and/or other materials
  -     provided with the distribution.
- - 
+ -
  -  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  -  ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  -  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -27,9 +27,10 @@
 #ifndef SUDOKU_H_INCLUDED
 #define SUDOKU_H_INCLUDED
 
-/*
- *  sudoku.h
+/*!
+ * \file sudoku.h
  *
+ * <pre>
  *    The L_Sudoku holds all the information of the current state.
  *
  *    The input to sudokuCreate() is a file with any number of lines
@@ -37,32 +38,34 @@
  *    in each line.  These have the known values and use 0 for the unknowns.
  *    Blank lines are ignored.
  *
- *    The @locs array holds the indices of the unknowns, numbered
+ *    The %locs array holds the indices of the unknowns, numbered
  *    left-to-right and top-to-bottom from 0 to 80.  The array size
- *    is initialized to @num.  @current is the index into the @locs
+ *    is initialized to %num.  %current is the index into the %locs
  *    array of the current guess: locs[current].
  *
- *    The @state array is used to determine the validity of each guess.
+ *    The %state array is used to determine the validity of each guess.
  *    It is of size 81, and is initialized by setting the unknowns to 0
  *    and the knowns to their input values.
+ * </pre>
  */
+
 struct L_Sudoku
 {
-    l_int32        num;         /* number of unknowns                     */
-    l_int32       *locs;        /* location of unknowns                   */
-    l_int32        current;     /* index into @locs of current location   */
-    l_int32       *init;        /* initial state, with 0 representing     */
-                                /* the unknowns                           */
-    l_int32       *state;       /* present state, including inits and     */
-                                /* guesses of unknowns up to @current     */
-    l_int32        nguess;      /* shows current number of guesses        */
-    l_int32        finished;    /* set to 1 when solved                   */
-    l_int32        failure;     /* set to 1 if no solution is possible    */
+    l_int32        num;       /*!< number of unknowns                     */
+    l_int32       *locs;      /*!< location of unknowns                   */
+    l_int32        current;   /*!< index into %locs of current location   */
+    l_int32       *init;      /*!< initial state, with 0 representing     */
+                              /*!< the unknowns                           */
+    l_int32       *state;     /*!< present state, including inits and     */
+                              /*!< guesses of unknowns up to %current     */
+    l_int32        nguess;    /*!< shows current number of guesses        */
+    l_int32        finished;  /*!< set to 1 when solved                   */
+    l_int32        failure;   /*!< set to 1 if no solution is possible    */
 };
 typedef struct L_Sudoku  L_SUDOKU;
 
 
-    /* For printing out array data */
+    /*! For printing out array data */
 enum {
     L_SUDOKU_INIT = 0,
     L_SUDOKU_STATE = 1

+ 26 - 25
include/leptonica/watershed.h

@@ -10,7 +10,7 @@
  -     copyright notice, this list of conditions and the following
  -     disclaimer in the documentation and/or other materials
  -     provided with the distribution.
- - 
+ -
  -  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  -  ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  -  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -27,36 +27,37 @@
 #ifndef  LEPTONICA_WATERSHED_H
 #define  LEPTONICA_WATERSHED_H
 
-/* 
- *  watershed.h
+/*!
+ * \file watershed.h
  *
  *     Simple data structure to hold watershed data.
  *     All data here is owned by the L_WShed and must be freed.
  */
 
-struct L_WShed 
+/*! Simple data structure to hold watershed data. */
+struct L_WShed
 {
-    struct Pix    *pixs;        /* clone of input 8 bpp pixs                */
-    struct Pix    *pixm;        /* clone of input 1 bpp seed (marker) pixm  */
-    l_int32        mindepth;    /* minimum depth allowed for a watershed    */
-    struct Pix    *pixlab;      /* 16 bpp label pix                         */
-    struct Pix    *pixt;        /* scratch pix for computing wshed regions  */
-    void         **lines8;      /* line ptrs for pixs                       */
-    void         **linem1;      /* line ptrs for pixm                       */
-    void         **linelab32;   /* line ptrs for pixlab                     */
-    void         **linet1;      /* line ptrs for pixt                       */
-    struct Pixa   *pixad;       /* result: 1 bpp pixa of watersheds         */
-    struct Pta    *ptas;        /* pta of initial seed pixels               */
-    struct Numa   *nasi;        /* numa of seed indicators; 0 if completed  */
-    struct Numa   *nash;        /* numa of initial seed heights             */
-    struct Numa   *namh;        /* numa of initial minima heights           */
-    struct Numa   *nalevels;    /* result: numa of watershed levels         */
-    l_int32        nseeds;      /* number of seeds (markers)                */
-    l_int32        nother;      /* number of minima different from seeds    */
-    l_int32       *lut;         /* lut for pixel indices                    */
-    struct Numa  **links;       /* back-links into lut, for updates         */
-    l_int32        arraysize;   /* size of links array                      */
-    l_int32        debug;       /* set to 1 for debug output                */
+    struct Pix    *pixs;      /*!< clone of input 8 bpp pixs                */
+    struct Pix    *pixm;      /*!< clone of input 1 bpp seed (marker) pixm  */
+    l_int32        mindepth;  /*!< minimum depth allowed for a watershed    */
+    struct Pix    *pixlab;    /*!< 16 bpp label pix                         */
+    struct Pix    *pixt;      /*!< scratch pix for computing wshed regions  */
+    void         **lines8;    /*!< line ptrs for pixs                       */
+    void         **linem1;    /*!< line ptrs for pixm                       */
+    void         **linelab32; /*!< line ptrs for pixlab                     */
+    void         **linet1;    /*!< line ptrs for pixt                       */
+    struct Pixa   *pixad;     /*!< result: 1 bpp pixa of watersheds         */
+    struct Pta    *ptas;      /*!< pta of initial seed pixels               */
+    struct Numa   *nasi;      /*!< numa of seed indicators; 0 if completed  */
+    struct Numa   *nash;      /*!< numa of initial seed heights             */
+    struct Numa   *namh;      /*!< numa of initial minima heights           */
+    struct Numa   *nalevels;  /*!< result: numa of watershed levels         */
+    l_int32        nseeds;    /*!< number of seeds (markers)                */
+    l_int32        nother;    /*!< number of minima different from seeds    */
+    l_int32       *lut;       /*!< lut for pixel indices                    */
+    struct Numa  **links;     /*!< back-links into lut, for updates         */
+    l_int32        arraysize; /*!< size of links array                      */
+    l_int32        debug;     /*!< set to 1 for debug output                */
 };
 typedef struct L_WShed L_WSHED;
 

BIN
lib/debug/liblept171.lib


BIN
lib/debug/libtesseract304.lib


BIN
lib/debug/pvt.cppan.demo.danbloomberg.leptonica-1.76.0.lib


BIN
lib/debug/tesseract50.lib


+ 1 - 1
zhipuzi_pay_plugin/zhipuzi_pay_plugin.vcxproj

@@ -136,7 +136,7 @@ copy $(ProjectDir)conf\ $(SolutionDir)bin\$(Platform)\$(Configuration)\conf\</Co
       <SubSystem>Windows</SubSystem>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <AdditionalLibraryDirectories>$(SolutionDir)lib\debug</AdditionalLibraryDirectories>
-      <AdditionalDependencies>dbghelp.lib;winmm.lib;version.lib;ws2_32.lib;setupapi.lib;AdvAPI32.lib;wldap32.lib;crypt32.lib;sapi.lib;Shell32.lib;user32.lib;kernel32.lib;Gdi32.lib;libboost_date_time-vc141-mt-sgd-x32-1_70.lib;libboost_regex-vc141-mt-sgd-x32-1_70.lib;sqlite3.lib;DuiLib_ud.lib;log4cplusUD.lib;zpzDll.lib;libcurl.lib;liblept171.lib;libtesseract304.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>dbghelp.lib;winmm.lib;version.lib;ws2_32.lib;setupapi.lib;AdvAPI32.lib;wldap32.lib;crypt32.lib;sapi.lib;Shell32.lib;user32.lib;kernel32.lib;Gdi32.lib;libboost_date_time-vc141-mt-sgd-x32-1_70.lib;libboost_regex-vc141-mt-sgd-x32-1_70.lib;sqlite3.lib;DuiLib_ud.lib;log4cplusUD.lib;zpzDll.lib;libcurl.lib;pvt.cppan.demo.danbloomberg.leptonica-1.76.0.lib;tesseract50.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <IgnoreSpecificDefaultLibraries>
       </IgnoreSpecificDefaultLibraries>
       <Version>