1 /***************************************************************************
2  *                                                                         *
3  *   copyright : (C) 2015 C. Barth Netterfield                             *
4  *                   netterfield@astro.utoronto.ca                         *
5  *                                                                         *
6  *   This program is free software; you can redistribute it and/or modify  *
7  *   it under the terms of the GNU General Public License as published by  *
8  *   the Free Software Foundation; either version 2 of the License, or     *
9  *   (at your option) any later version.                                   *
10  *                                                                         *
11  ***************************************************************************/
12 
13 /* ITS IMAGE HEADER FORMAT
14  * ------------------------
15  * [0-3]   = syncword (0xeb, 0x90, 0x14, 0x64)
16  * [4]     = version
17  * [5-8]   = fast frame counter (100 Hz counter from pcm)
18  * [9-1]   = width [px]
19  * [11-12] = height [px]
20  * [13]    = number of images
21  * [14]    = checksum (bitwise XOR (^) of bytes 0-13)
22  * [15-]   = image data
23  *
24  * An individual image is formatted as:
25  * Offset +
26  * [0-1]   = X coordinate
27  * [2-3]   = Y coordinate
28  * [4-]    = raw pixel data
29 */
30 
31 
32 #ifndef ITS_H
33 #define ITS_H
34 
35 #ifdef __cplusplus
36     extern "C" {
37 #endif
38 
39 #define ITS_OK 0
40 #define ITS_NOOPEN 1
41 #define ITS_UNKNOWN 2
42 
43 #define INDEX_WORD_SIZE 8
44 
45 extern char *ITS_ERRORSTR[];
46 
47 typedef struct {
48   int fp_index;
49   int fp_data;
50   char *fileName;
51   int status;
52   int formatType;
53 } ITSfile;
54 
55 
56 typedef struct {
57   unsigned short w;
58   unsigned short h;
59   unsigned short x;
60   unsigned short y;
61   int allocated;
62   unsigned char *img;
63 } ITSimage;
64 
65 ITSfile *ITSopen(char *filename);
66 void ITSclose(ITSfile *its);
67 
68 int isITSfile(char *filename);
69 
70 int ITSnframes(ITSfile *its);
71 
72 int ITSreadimage(ITSfile *its, int frame, int i_img, ITSimage *I);
73 
74 void ITSInitImage(ITSimage *image);
75 void ITSFreeImage(ITSimage *image);
76 
77 
78 #ifdef __cplusplus
79 }
80 #endif
81 
82 #endif
83