GCC Code Coverage Report


Directory: ./
File: libfprint/nbis/bozorth3/bz_io.c
Date: 2024-09-16 14:36:32
Exec Total Coverage
Lines: 0 6 0.0%
Functions: 0 3 0.0%
Branches: 0 0 -%

Line Branch Exec Source
1 /*******************************************************************************
2
3 License:
4 This software and/or related materials was developed at the National Institute
5 of Standards and Technology (NIST) by employees of the Federal Government
6 in the course of their official duties. Pursuant to title 17 Section 105
7 of the United States Code, this software is not subject to copyright
8 protection and is in the public domain.
9
10 This software and/or related materials have been determined to be not subject
11 to the EAR (see Part 734.3 of the EAR for exact details) because it is
12 a publicly available technology and software, and is freely distributed
13 to any interested party with no licensing requirements. Therefore, it is
14 permissible to distribute this software as a free download from the internet.
15
16 Disclaimer:
17 This software and/or related materials was developed to promote biometric
18 standards and biometric technology testing for the Federal Government
19 in accordance with the USA PATRIOT Act and the Enhanced Border Security
20 and Visa Entry Reform Act. Specific hardware and software products identified
21 in this software were used in order to perform the software development.
22 In no case does such identification imply recommendation or endorsement
23 by the National Institute of Standards and Technology, nor does it imply that
24 the products and equipment identified are necessarily the best available
25 for the purpose.
26
27 This software and/or related materials are provided "AS-IS" without warranty
28 of any kind including NO WARRANTY OF PERFORMANCE, MERCHANTABILITY,
29 NO WARRANTY OF NON-INFRINGEMENT OF ANY 3RD PARTY INTELLECTUAL PROPERTY
30 or FITNESS FOR A PARTICULAR PURPOSE or for any purpose whatsoever, for the
31 licensed product, however used. In no event shall NIST be liable for any
32 damages and/or costs, including but not limited to incidental or consequential
33 damages of any kind, including economic damage or injury to property and lost
34 profits, regardless of whether NIST shall be advised, have reason to know,
35 or in fact shall know of the possibility.
36
37 By using this software, you agree to bear all risk relating to quality,
38 use and performance of the software and/or related materials. You agree
39 to hold the Government harmless from any claim arising from your use
40 of the software.
41
42 *******************************************************************************/
43
44 /***********************************************************************
45 LIBRARY: FING - NIST Fingerprint Systems Utilities
46
47 FILE: BZ_IO.C
48 ALGORITHM: Allan S. Bozorth (FBI)
49 MODIFICATIONS: Michael D. Garris (NIST)
50 Stan Janet (NIST)
51 DATE: 09/21/2004
52 UPDATED: 01/11/2012 by Kenneth Ko
53 UPDATED: 03/08/2012 by Kenneth Ko
54 UPDATED: 07/10/2014 by Kenneth Ko
55
56 Contains routines responsible for supporting command line
57 processing, file and data input to, and output from the
58 Bozorth3 fingerprint matching algorithm.
59
60 ***********************************************************************
61
62 ROUTINES:
63 #cat: parse_line_range - parses strings of the form #-# into the upper
64 #cat: and lower bounds of a range corresponding to lines in
65 #cat: an input file list
66 #cat: set_progname - stores the program name for the current invocation
67 #cat: set_probe_filename - stores the name of the current probe file
68 #cat: being processed
69 #cat: set_gallery_filename - stores the name of the current gallery file
70 #cat: being processed
71 #cat: get_progname - retrieves the program name for the current invocation
72 #cat: get_probe_filename - retrieves the name of the current probe file
73 #cat: being processed
74 #cat: get_gallery_filename - retrieves the name of the current gallery
75 #cat: file being processed
76 #cat: get_next_file - gets the next probe (or gallery) filename to be
77 #cat: processed, either from the command line or from a
78 #cat: file list
79 #cat: get_score_filename - returns the filename to which the output line
80 #cat: should be written
81 #cat: get_score_line - formats output lines based on command line options
82 #cat: specified
83 #cat: bz_load - loads the contents of the specified XYT file into
84 #cat: structured memory
85 #cat: fd_readable - when multiple bozorth processes are being run
86 #cat: concurrently and one of the processes determines a
87 #cat: has been found, the other processes poll a file
88 #cat: descriptor using this function to see if they
89 #cat: should exit as well
90
91 ***********************************************************************/
92
93 #include <string.h>
94 #include <ctype.h>
95 #include <sys/time.h>
96 #include <bozorth.h>
97
98 /***********************************************************************/
99
100 /***********************************************************************/
101
102 /* Used by the following set* and get* routines */
103 static char program_buffer[ 1024 ];
104 static char * pfile;
105 static char * gfile;
106
107 /***********************************************************************/
108
109 /***********************************************************************/
110
111 /***********************************************************************/
112
113 /***********************************************************************/
114 char * get_progname( void )
115 {
116 return program_buffer;
117 }
118
119 /***********************************************************************/
120 char * get_probe_filename( void )
121 {
122 return pfile;
123 }
124
125 /***********************************************************************/
126 char * get_gallery_filename( void )
127 {
128 return gfile;
129 }
130
131 /***********************************************************************/
132
133 /***********************************************************************/
134 /* returns CNULL on error */
135
136 /***********************************************************************/
137
138 /************************************************************************
139 Load a 3-4 column (X,Y,T[,Q]) set of minutiae from the specified file
140 and return a XYT sturcture.
141 Row 3's value is an angle which is normalized to the interval (-180,180].
142 A maximum of MAX_BOZORTH_MINUTIAE minutiae can be returned -- fewer if
143 "DEFAULT_BOZORTH_MINUTIAE" is smaller. If the file contains more minutiae than are
144 to be returned, the highest-quality minutiae are returned.
145 *************************************************************************/
146
147 /***********************************************************************/
148
149 /************************************************************************
150 Load a XYTQ structure and return a XYT struct.
151 Row 3's value is an angle which is normalized to the interval (-180,180].
152 A maximum of MAX_BOZORTH_MINUTIAE minutiae can be returned -- fewer if
153 "DEFAULT_BOZORTH_MINUTIAE" is smaller. If the file contains more minutiae than are
154 to be returned, the highest-quality minutiae are returned.
155 *************************************************************************/
156
157 /***********************************************************************/
158 #ifdef PARALLEL_SEARCH
159 int fd_readable( int fd )
160 {
161 int retval;
162 fd_set rfds;
163 struct timeval tv;
164
165
166 FD_ZERO( &rfds );
167 FD_SET( fd, &rfds );
168 tv.tv_sec = 0;
169 tv.tv_usec = 0;
170
171 retval = select( fd+1, &rfds, NULL, NULL, &tv );
172
173 if ( retval < 0 ) {
174 perror( "select() failed" );
175 return 0;
176 }
177
178 if ( FD_ISSET( fd, &rfds ) ) {
179 /*fprintf( stderr, "data is available now.\n" );*/
180 return 1;
181 }
182
183 /* fprintf( stderr, "no data is available\n" ); */
184 return 0;
185 }
186 #endif
187