File indexing completed on 2024-12-29 04:11:47

0001 /***************************************************************************
0002  *                                                                         *
0003  *   copyright : (C) 2015 C. Barth Netterfield                             *
0004  *                   netterfield@astro.utoronto.ca                         *
0005  *                                                                         *
0006  *   This program is free software; you can redistribute it and/or modify  *
0007  *   it under the terms of the GNU General Public License as published by  *
0008  *   the Free Software Foundation; either version 2 of the License, or     *
0009  *   (at your option) any later version.                                   *
0010  *                                                                         *
0011  ***************************************************************************/
0012 
0013 /* ITS IMAGE HEADER FORMAT
0014  * ------------------------
0015  * [0-3]   = syncword (0xeb, 0x90, 0x14, 0x64)
0016  * [4]     = version
0017  * [5-8]   = fast frame counter (100 Hz counter from pcm)
0018  * [9-1]   = width [px]
0019  * [11-12] = height [px]
0020  * [13]    = number of images
0021  * [14]    = checksum (bitwise XOR (^) of bytes 0-13)
0022  * [15-]   = image data
0023  *
0024  * An individual image is formatted as:
0025  * Offset +
0026  * [0-1]   = X coordinate
0027  * [2-3]   = Y coordinate
0028  * [4-]    = raw pixel data
0029 */
0030 
0031 
0032 #ifndef ITS_H
0033 #define ITS_H
0034 
0035 #ifdef __cplusplus
0036     extern "C" {
0037 #endif
0038 
0039 #define ITS_OK 0
0040 #define ITS_NOOPEN 1
0041 #define ITS_UNKNOWN 2
0042 
0043 #define INDEX_WORD_SIZE 8
0044 
0045 extern char *ITS_ERRORSTR[];
0046 
0047 typedef struct {
0048   int fp_index;
0049   int fp_data;
0050   char *fileName;
0051   int status;
0052   int formatType;
0053 } ITSfile;
0054 
0055 
0056 typedef struct {
0057   unsigned short w;
0058   unsigned short h;
0059   unsigned short x;
0060   unsigned short y;
0061   int allocated;
0062   unsigned char *img;
0063 } ITSimage;
0064 
0065 ITSfile *ITSopen(char *filename);
0066 void ITSclose(ITSfile *its);
0067 
0068 int isITSfile(char *filename);
0069 
0070 int ITSnframes(ITSfile *its);
0071 
0072 int ITSreadimage(ITSfile *its, int frame, int i_img, ITSimage *I);
0073 
0074 void ITSInitImage(ITSimage *image);
0075 void ITSFreeImage(ITSimage *image);
0076 
0077 
0078 #ifdef __cplusplus
0079 }
0080 #endif
0081 
0082 #endif