1 /*
2  * Image assembling routines
3  * Shared functions between libfprint Authentec drivers
4  * Copyright (C) 2007 Daniel Drake <dsd@gentoo.org>
5  * Copyright (C) 2015 Vasily Khoruzhick <anarsoul@gmail.com>
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #ifndef __ASSEMBLING_H__
23 #define __ASSEMBLING_H__
24 
25 #include <fp_internal.h>
26 
27 struct fpi_frame {
28 	int delta_x;
29 	int delta_y;
30 	unsigned char data[0];
31 };
32 
33 struct fpi_frame_asmbl_ctx {
34 	unsigned frame_width;
35 	unsigned frame_height;
36 	unsigned image_width;
37 	unsigned char (*get_pixel)(struct fpi_frame_asmbl_ctx *ctx,
38 				   struct fpi_frame *frame,
39 				   unsigned x,
40 				   unsigned y);
41 };
42 
43 void fpi_do_movement_estimation(struct fpi_frame_asmbl_ctx *ctx,
44 			    GSList *stripes, size_t stripes_len);
45 
46 struct fp_img *fpi_assemble_frames(struct fpi_frame_asmbl_ctx *ctx,
47 			    GSList *stripes, size_t stripes_len);
48 
49 struct fpi_line_asmbl_ctx {
50 	unsigned line_width;
51 	unsigned max_height;
52 	unsigned resolution;
53 	unsigned median_filter_size;
54 	unsigned max_search_offset;
55 	int (*get_deviation)(struct fpi_line_asmbl_ctx *ctx,
56 			     GSList *line1, GSList *line2);
57 	unsigned char (*get_pixel)(struct fpi_line_asmbl_ctx *ctx,
58 				   GSList *line,
59 				   unsigned x);
60 };
61 
62 struct fp_img *fpi_assemble_lines(struct fpi_line_asmbl_ctx *ctx,
63 				  GSList *lines, size_t lines_len);
64 
65 #endif
66