Enable unpacking of .pictures files of size > 2^32
[phoros.git] / imread.h
blob015a721f07ef30dae1a110a418a2b9a32b301cbc
1 /* PHOROS -- Photogrammetric Road Survey */
2 /* Copyright (C) 2017 Bert Burgemeister */
4 /* This program is free software; you can redistribute it and/or modify */
5 /* it under the terms of the GNU General Public License as published by */
6 /* the Free Software Foundation; either version 2 of the License, or */
7 /* (at your option) any later version. */
9 /* This program is distributed in the hope that it will be useful, */
10 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
11 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
12 /* GNU General Public License for more details. */
14 /* You should have received a copy of the GNU General Public License along */
15 /* with this program; if not, write to the Free Software Foundation, Inc., */
16 /* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
18 #ifndef IMREAD_H
19 #define IMREAD_H
22 #include <malloc.h>
23 #include <math.h>
24 #include <stdbool.h>
25 #include <stdint.h>
26 #include <stdio.h>
27 #include <stdlib.h>
29 #include <png.h>
30 #include <jpeglib.h>
32 /* Storage for the in-memory PNG */
33 struct png_store
35 char *buffer;
36 size_t size;
39 /*
40 Put a width x height image from the .pictures file at pictures_path into png.
41 The data_size bytes (value of "dataSize=") of the original blob are read beginning at file position start (after PICTUREDATA_BEGIN).
44 int
45 png2mem(char *pictures_path, /* path to a *.pictures file */
46 long long int start, /* file position after "PICTUREDATA_BEGIN" */
47 int data_size, /* value of "dataSize=" */
48 unsigned int width, /* value of "width=" */
49 unsigned int height, /* value of "height=" */
50 unsigned int channels, /* value of "channels=" */
51 int *bayer_pattern,
52 bool demosaic_fast,
53 int compression_mode, /* value of "compressed=" */
54 struct png_store *png, /* result */
55 bool reversep,
56 bool brightenp,
57 double *color_raiser);
59 /*
60 Confirm presence of this library by returning n.
62 int
63 ping(int n);
66 #endif /* IMREAD_H */