00001 #ifndef IMGDECODE_INCL
00002 #define IMGDECODE_INCL 1
00003
00004 #ifndef PACKETHEADERWORDS
00005 #define PACKETHEADERWORDS 19
00006 #endif
00007 #ifndef PACKETDATAWORDS
00008 #define PACKETDATAWORDS 869
00009 #endif
00010 #ifndef PACKETWORDS
00011 #define PACKETWORDS 888
00012 #endif
00013
00014 #define MAXPIXELS 16777216 // 4096*4096
00015 #define MAXHIST 32768
00016
00017 #ifndef TABLE_DIR
00018
00019 #define TABLE_DIR "/home/prodtest/cvs/TBL_JSOC/lev0"
00020 #endif
00021
00022 #define APID_HMI_SCIENCE_1 400
00023 #define APID_HMI_SCIENCE_2 410
00024 #define APID_AIA_SCIENCE_1 500
00025 #define APID_AIA_SCIENCE_2 510
00026
00027 #define isAIA(x) ((x) == APID_AIA_SCIENCE_1 || (x) == APID_AIA_SCIENCE_2)
00028 #define isHMI(x) ((x) == APID_HMI_SCIENCE_1 || (x) == APID_HMI_SCIENCE_2)
00029
00030 #define IMGDECODE_DECOMPRESS_ERROR (-1)
00031 #define IMGDECODE_TOO_MANY_PIXELS (-2)
00032
00033 #define IMGDECODE_BAD_N (-101)
00034 #define IMGDECODE_BAD_APID (-102)
00035 #define IMGDECODE_NO_LOOKUP_TABLE (-103)
00036 #define IMGDECODE_LOOKUP_ID_MISMATCH (-104)
00037 #define IMGDECODE_BAD_LOOKUP_TABLE (-105)
00038 #define IMGDECODE_NO_CROP_TABLE (-106)
00039 #define IMGDECODE_CROP_ID_MISMATCH (-107)
00040 #define IMGDECODE_BAD_CROP_GEOMETRY (-108)
00041 #define IMGDECODE_BAD_CROP_TABLE (-109)
00042 #define IMGDECODE_BAD_CROP_SKIP_TAKE (-110)
00043 #define IMGDECODE_BAD_OFFSET (-111)
00044
00045 #define IMGDECODE_OUT_OF_MEMORY (-201)
00046
00047 #define BLANK (-32768)
00048
00049 typedef struct {
00050 unsigned short width, height;
00051 unsigned totalpix;
00052 unsigned short *skip;
00053 unsigned short *take;
00054 unsigned *offset;
00055 } CROPTABLE;
00056
00057 typedef struct {
00058 int initialized;
00059 int reopened;
00060 unsigned telnum;
00061 unsigned fsn;
00062 unsigned fid;
00063 unsigned apid;
00064 unsigned cropid;
00065 unsigned luid;
00066 unsigned tap;
00067 unsigned N, K, R;
00068 unsigned totalvals;
00069 unsigned datavals;
00070 unsigned npackets;
00071 unsigned nerrors;
00072 int last_pix_err;
00073 int overflow;
00074 int headerr;
00075 uint64_t first_packet_time;
00076 short dat[MAXPIXELS];
00077 unsigned hist[MAXHIST];
00078 } IMG;
00079
00080 typedef struct {
00081 short min;
00082 short max;
00083 short median;
00084 double mean;
00085 double rms;
00086 double skew;
00087 double kurt;
00088 } STAT;
00089
00090 int imgdecode(unsigned short *impdu, IMG *img);
00091 int imgdecode_init_hack(IMG *img);
00092 int imgstat(IMG *img, STAT *stat);
00093
00094
00095
00096 #define NEED_PATCH1(fsn) (!(fsn%2) && (fsn<=33190636) && (fsn>=32249884))
00097
00098 #endif