1/* -*- C++ -*-
2 * File: libraw_types.h
3 * Copyright 2008-2013 LibRaw LLC (info@libraw.org)
4 * Created: Sat Mar 8 , 2008
5 *
6 * LibRaw C data structures
7 *
8
9LibRaw is free software; you can redistribute it and/or modify
10it under the terms of the one of three licenses as you choose:
11
121. GNU LESSER GENERAL PUBLIC LICENSE version 2.1
13 (See file LICENSE.LGPL provided in LibRaw distribution archive for details).
14
152. COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
16 (See file LICENSE.CDDL provided in LibRaw distribution archive for details).
17
183. LibRaw Software License 27032010
19 (See file LICENSE.LibRaw.pdf provided in LibRaw distribution archive for details).
20
21 */
22
23#ifndef _LIBRAW_TYPES_H
24#define _LIBRAW_TYPES_H
25
26#include <sys/types.h>
27#ifndef WIN32
28#include <sys/time.h>
29#endif
30#include <stdio.h>
31
32#if defined (_OPENMP)
33
34#if defined(WIN32)
35# if defined (_MSC_VER) && (_MSC_VER >= 1600 || (_MSC_VER == 1500 && _MSC_FULL_VER >= 150030729) )
36/* VS2010+ : OpenMP works OK, VS2008: have tested by cgilles */
37# define LIBRAW_USE_OPENMP
38#elif defined (__INTEL_COMPILER) && (__INTEL_COMPILER >=910)
39/* Have not tested on 9.x and 10.x, but Intel documentation claims OpenMP 2.5 support in 9.1 */
40# define LIBRAW_USE_OPENMP
41#else
42# undef LIBRAW_USE_OPENMP
43#endif
44/* Not Win32 */
45# elif (defined(__APPLE__) || defined(__MACOSX__)) && defined(_REENTRANT)
46# undef LIBRAW_USE_OPENMP
47# else
48# define LIBRAW_USE_OPENMP
49# endif
50#endif
51
52#ifdef LIBRAW_USE_OPENMP
53#include <omp.h>
54#endif
55
56
57#ifdef __cplusplus
58extern "C" {
59#endif
60
61#if defined(USE_LCMS)
62#include <lcms.h>
63#elif defined(USE_LCMS2)
64#include <lcms2.h>
65#else
66#define NO_LCMS
67#endif
68
69#include "libraw_const.h"
70#include "libraw_version.h"
71
72#ifdef WIN32
73typedef __int64 INT64;
74typedef unsigned __int64 UINT64;
75#else
76typedef long long INT64;
77typedef unsigned long long UINT64;
78#endif
79
80typedef unsigned char uchar;
81typedef unsigned short ushort;
82
83#ifdef WIN32
84#ifdef LIBRAW_NODLL
85# define DllDef
86#else
87# ifdef LIBRAW_BUILDLIB
88# define DllDef __declspec( dllexport )
89# else
90# define DllDef __declspec( dllimport )
91# endif
92#endif
93#else
94# define DllDef
95#endif
96
97typedef struct
98{
99 const char *decoder_name;
100 unsigned decoder_flags;
101}libraw_decoder_info_t;
102
103typedef struct
104{
105 unsigned mix_green;
106 unsigned raw_color;
107 unsigned zero_is_bad;
108 ushort shrink;
109 ushort fuji_width;
110} libraw_internal_output_params_t;
111
112
113typedef void (* memory_callback)(void * data, const char *file, const char *where);
114
115DllDef void default_memory_callback(void *data,const char *file, const char *where);
116
117typedef void (*data_callback)(void *data,const char *file, const int offset);
118
119DllDef void default_data_callback(void *data,const char *file, const int offset);
120
121typedef int (* progress_callback) (void *data,enum LibRaw_progress stage, int iteration,int expected);
122
123typedef struct
124{
125 memory_callback mem_cb;
126 void* memcb_data;
127
128 data_callback data_cb;
129 void* datacb_data;
130
131 progress_callback progress_cb;
132 void *progresscb_data;
133} libraw_callbacks_t;
134
135
136typedef struct
137{
138 enum LibRaw_image_formats type;
139 ushort height,
140 width,
141 colors,
142 bits;
143 unsigned int data_size;
144 unsigned char data[1];
145}libraw_processed_image_t;
146
147
148typedef struct
149{
150 char make[64];
151 char model[64];
152
153 unsigned raw_count;
154 unsigned dng_version;
155 unsigned is_foveon;
156 int colors;
157
158 unsigned filters;
159 char xtrans[6][6];
160 char cdesc[5];
161
162}libraw_iparams_t;
163
164typedef struct
165{
166 ushort raw_height,
167 raw_width,
168 height,
169 width,
170 top_margin,
171 left_margin;
172 ushort iheight,
173 iwidth;
174 unsigned raw_pitch;
175 double pixel_aspect;
176 int flip;
177 int mask[8][4];
178
179} libraw_image_sizes_t;
180
181struct ph1_t
182{
183 int format, key_off, t_black, black_off, split_col, tag_21a;
184 float tag_210;
185};
186
187typedef struct
188{
189 ushort curve[0x10000];
190 unsigned cblack[4];
191 unsigned black;
192 unsigned data_maximum;
193 unsigned maximum;
194 ushort white[8][8];
195 float cam_mul[4];
196 float pre_mul[4];
197 float cmatrix[3][4];
198 float rgb_cam[3][4];
199 float cam_xyz[4][3];
200 struct ph1_t phase_one_data;
201 float flash_used;
202 float canon_ev;
203 char model2[64];
204 void *profile;
205 unsigned profile_length;
206 unsigned black_stat[8];
207}libraw_colordata_t;
208
209typedef struct
210{
211 enum LibRaw_thumbnail_formats tformat;
212 ushort twidth,
213 theight;
214 unsigned tlength;
215 int tcolors;
216
217 char *thumb;
218}libraw_thumbnail_t;
219
220typedef struct
221{
222 float iso_speed;
223 float shutter;
224 float aperture;
225 float focal_len;
226 time_t timestamp;
227 unsigned shot_order;
228 unsigned gpsdata[32];
229 char desc[512],
230 artist[64];
231} libraw_imgother_t;
232
233typedef struct
234{
235 unsigned greybox[4]; /* -A x1 y1 x2 y2 */
236 unsigned cropbox[4]; /* -B x1 y1 x2 y2 */
237 double aber[4]; /* -C */
238 double gamm[6]; /* -g */
239 float user_mul[4]; /* -r mul0 mul1 mul2 mul3 */
240 unsigned shot_select; /* -s */
241 float bright; /* -b */
242 float threshold; /* -n */
243 int half_size; /* -h */
244 int four_color_rgb; /* -f */
245 int highlight; /* -H */
246 int use_auto_wb; /* -a */
247 int use_camera_wb; /* -w */
248 int use_camera_matrix; /* +M/-M */
249 int output_color; /* -o */
250 char *output_profile; /* -o */
251 char *camera_profile; /* -p */
252 char *bad_pixels; /* -P */
253 char *dark_frame; /* -K */
254 int output_bps; /* -4 */
255 int output_tiff; /* -T */
256 int user_flip; /* -t */
257 int user_qual; /* -q */
258 int user_black; /* -k */
259 int user_cblack[4];
260 int sony_arw2_hack;
261 int user_sat; /* -S */
262
263 int med_passes; /* -m */
264 float auto_bright_thr;
265 float adjust_maximum_thr;
266 int no_auto_bright; /* -W */
267 int use_fuji_rotate;/* -j */
268 int green_matching;
269#if 0
270 /* AFD noise suppression parameters, disabled for now */
271 int afd_noise_att;
272 int afd_noise_thres;
273 int afd_luminance_passes;
274 int afd_chrominance_method;
275 int afd_luminance_only;
276#endif
277 /* DCB parameters */
278 int dcb_iterations;
279 int dcb_enhance_fl;
280 int fbdd_noiserd;
281 /* VCD parameters */
282 int eeci_refine;
283 int es_med_passes;
284 /* AMaZE*/
285 int ca_correc;
286 float cared;
287 float cablue;
288 int cfaline;
289 float linenoise;
290 int cfa_clean;
291 float lclean;
292 float cclean;
293 int cfa_green;
294 float green_thresh;
295 int exp_correc;
296 float exp_shift;
297 float exp_preser;
298 /* WF debanding */
299 int wf_debanding;
300 float wf_deband_treshold[4];
301 /* Raw speed */
302 int use_rawspeed;
303 /* Disable Auto-scale */
304 int no_auto_scale;
305 /* Disable intepolation */
306 int no_interpolation;
307 /* Disable sRAW YCC to RGB conversion */
308 int sraw_ycc;
309 /* Force use x3f data decoding either if demosaic pack GPL2 enabled */
310 int force_foveon_x3f;
311}libraw_output_params_t;
312
313typedef struct
314{
315 /* really allocated bitmap */
316 void *raw_alloc;
317 /* alias to single_channel variant */
318 ushort *raw_image;
319 /* alias to 4-channel variant */
320 ushort (*color4_image)[4] ;
321 /* alias to 3-color variand decoded by RawSpeed */
322 ushort (*color3_image)[3];
323
324 /* Phase One black level data; */
325 short (*ph1_black)[2];
326 /* save color and sizes here, too.... */
327 libraw_iparams_t iparams;
328 libraw_image_sizes_t sizes;
329 libraw_internal_output_params_t ioparams;
330 libraw_colordata_t color;
331} libraw_rawdata_t;
332
333
334typedef struct
335{
336 ushort (*image)[4] ;
337 libraw_image_sizes_t sizes;
338 libraw_iparams_t idata;
339 libraw_output_params_t params;
340 unsigned int progress_flags;
341 unsigned int process_warnings;
342 libraw_colordata_t color;
343 libraw_imgother_t other;
344 libraw_thumbnail_t thumbnail;
345 libraw_rawdata_t rawdata;
346 void *parent_class;
347} libraw_data_t;
348
349
350#ifdef __cplusplus
351}
352#endif
353
354#endif
355