00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00043 #ifndef __GAU_FILE_H__
00044 #define __GAU_FILE_H__
00045
00046 #include <prim_type.h>
00047 #include <cmd_ln.h>
00048 #include <mmio.h>
00049
00050 #ifdef __cplusplus
00051 extern "C" {
00052 #endif
00053 #if 0
00054
00055 }
00056 #endif
00057
00058
00059 typedef struct gau_file_s gau_file_t;
00060 struct gau_file_s {
00061 uint8 format;
00062 uint8 width;
00063 uint16 flags;
00064 float32 bias;
00065 float32 scale;
00066 float32 logbase;
00067 uint32 chksum;
00068 int32 n_mgau, n_feat, n_density;
00069 int32 *veclen;
00070 mmio_file_t *filemap;
00071 void *data;
00072 };
00073
00077 enum gau_fmt_e {
00078 GAU_FLOAT32 = 0,
00079 GAU_FLOAT64 = 1,
00080 GAU_INT16 = 2,
00081 GAU_INT32 = 3,
00082 GAU_UINT8 = 4,
00083 GAU_UINT16 = 5,
00084 GAU_UINT32 = 6
00085 };
00086
00090 enum gau_file_flags_e {
00091 GAU_FILE_MMAP = (1<<0),
00092 GAU_FILE_PRECOMP = (1<<1),
00097 GAU_FILE_TRANSPOSED = (1<<2),
00098 GAU_FILE_NEGATIVE = (1<<3),
00099 };
00100 #define gau_file_set_flag(g,f) ((g)->flags |= (f))
00101 #define gau_file_clear_flag(g,f) ((g)->flags &= ~(f))
00102 #define gau_file_get_flag(g,f) ((g)->flags & (f))
00103
00107 enum gau_file_dimension_e {
00108 GAU_FILE_MEAN = 4,
00109 GAU_FILE_VAR = 4,
00110 GAU_FILE_NORM = 3,
00111 GAU_FILE_MIXW = 3
00112 };
00113
00117 gau_file_t *gau_file_read(cmd_ln_t *config, const char *file_name, int ndim);
00118
00122 int gau_file_write(gau_file_t *gau, const char *file_name, int byteswap);
00123
00124
00128 void gau_file_free(gau_file_t *gau);
00129
00133 size_t gau_file_get_shape(gau_file_t *gau, int *out_n_gau, int *out_n_feat,
00134 int *out_n_density, const int **out_veclen);
00135
00139 void gau_file_get_size(gau_file_t *gau, size_t *out_nelem, size_t *out_width);
00140
00144 int gau_file_compatible(gau_file_t *a, gau_file_t *b);
00145
00151 void *gau_file_get_data(gau_file_t *gau);
00152
00156 void gau_file_dequantize_float32(gau_file_t *file, float32 *outmem, float32 outscale);
00157
00161 void gau_file_dequantize_int32(gau_file_t *file, int32 *outmem, float32 outscale);
00162
00166 void gau_file_dequantize_log(gau_file_t *file, int32 *outptr,
00167 float32 outscale, float32 logbase);
00168
00169 #ifdef __cplusplus
00170 }
00171 #endif
00172
00173
00174 #endif