1 module libraw.types;
2 
3 import libraw.const_;
4 import libraw.version_;
5 
6 import core.sys.posix.sys.types;
7 import core.sys.posix.sys.time;
8 import core.stdc.stdio;
9 import core.stdc.stdint;
10 import core.stdc.config;
11 
12 /*#if defined(USE_LCMS)
13 #include <lcms.h>
14 #elif defined(USE_LCMS2)
15 #include <lcms2.h>
16 #else
17 #define NO_LCMS
18 #endif*/
19 version = NO_LCMS;
20 
21 extern (C)
22 {
23 	struct libraw_decoder_info_t {
24 		const char *decoder_name;
25 		uint decoder_flags;
26 	}
27 
28 	struct libraw_internal_output_params_t {
29 		uint mix_green;
30 		uint raw_color;
31 		uint zero_is_bad;
32 		ushort shrink;
33 		ushort fuji_width;
34 	}
35 
36 	alias memory_callback = void function(void *data, const char *file, const char *where);
37 	alias exif_parser_callback = void function(void *context, int tag, int type, int len, uint ord, void *ifp, long base);
38 
39 	void default_memory_callback(void *data, const char *file, const char *where);
40 
41 	alias data_callback = void function(void *data, const char *file, const int offset);
42 
43 	void default_data_callback(void *data, const char *file, const int offset);
44 
45 	alias progress_callback = int function(void *data, LibRaw_progress stage, int iteration, int expected);
46 	alias pre_identify_callback = int function(void *ctx);
47 	alias post_identify_callback = void function(void *ctx);
48 	alias process_step_callback = void function(void *ctx);
49 
50 	struct libraw_callbacks_t {
51 		memory_callback mem_cb;
52 		void *memcb_data;
53 
54 		data_callback data_cb;
55 		void *datacb_data;
56 
57 		progress_callback progress_cb;
58 		void *progresscb_data;
59 
60 		exif_parser_callback exif_cb;
61 		void *exifparser_data;
62 		pre_identify_callback pre_identify_cb;
63 		post_identify_callback post_identify_cb;
64 		process_step_callback pre_subtractblack_cb, pre_scalecolors_cb, pre_preinterpolate_cb, pre_interpolate_cb,
65 				interpolate_bayer_cb, interpolate_xtrans_cb,
66 					post_interpolate_cb, pre_converttorgb_cb, post_converttorgb_cb;
67 	}
68 
69 	struct libraw_abstract_datastream_t {
70 		int function(void *userptr) valid;
71 		int function(void *, size_t, size_t, void *userptr) read;
72 		int function(long, int, void *userptr) seek;
73 		long function(void *userptr) tell;
74 		long function(void *userptr) size;
75 		int function(void *userptr) get_char;
76 		char *function(char *, int, void *userptr) gets;
77 		int function(const(char)*, void*, void *userptr) scanf_one;
78 		int function(void *userptr) eof;
79 		void *function(void *userptr) make_jas_stream;
80 
81 		void* userptr;
82 	}
83 
84 	struct libraw_processed_image_t {
85 		LibRaw_image_formats type;
86 		ushort height, width, colors, bits;
87 		uint data_size;
88 		ubyte[1] data;
89 	}
90 
91 	struct libraw_iparams_t {
92 		char[4] guard;
93 		char[64] make;
94 		char[64] model;
95 		char[64] software;
96 		char[64] normalized_make;
97 		char[64] normalized_model;
98 		uint maker_index;
99 		uint raw_count;
100 		uint dng_version;
101 		uint is_foveon;
102 		int colors;
103 		uint filters;
104 		char[6][6] xtrans;
105 		char[6][6] xtrans_abs;
106 		char[5] cdesc;
107 		uint xmplen;
108 		char *xmpdata;
109 
110 	}
111 
112 	struct libraw_raw_inset_crop_t {
113 		ushort cleft, ctop, cwidth, cheight, aspect;
114 	}
115 
116 	struct libraw_image_sizes_t {
117 		ushort raw_height, raw_width, height, width, top_margin, left_margin;
118 		ushort iheight, iwidth;
119 		uint raw_pitch;
120 		double pixel_aspect;
121 		int flip;
122 		int[4][8] mask;
123 		libraw_raw_inset_crop_t raw_inset_crop;
124 	}
125 
126 	struct ph1_t
127 	{
128 		int format, key_off, tag_21a;
129 		int t_black, split_col, black_col, split_row, black_row;
130 		float tag_210;
131 	}
132 
133 	struct libraw_dng_color_t {
134 		uint parsedfields;
135 		ushort illuminant;
136 		float[4][4] calibration;
137 		float[3][4] colormatrix;
138 		float[4][3] forwardmatrix;
139 	}
140 
141 	struct libraw_dng_levels_t {
142 		uint parsedfields;
143 		uint[LIBRAW_CBLACK_SIZE] dng_cblack;
144 		uint dng_black;
145 		float[LIBRAW_CBLACK_SIZE] dng_fcblack;
146 		float dng_fblack;
147 		uint[4] dng_whitelevel;
148 		uint[4] default_crop; /* Origin and size */
149 		uint preview_colorspace;
150 		float[4] analogbalance;
151 		float[4] asshotneutral;
152 		float baseline_exposure;
153 		float LinearResponseLimit;
154 	}
155 
156 	struct libraw_P1_color_t {
157 		float[9] romm_cam;
158 	}
159 
160 	struct libraw_canon_makernotes_t {
161 		int ColorDataVer;
162 		int ColorDataSubVer;
163 		int SpecularWhiteLevel;
164 		int NormalWhiteLevel;
165 		int[4] ChannelBlackLevel;
166 		int AverageBlackLevel;
167 		/* multishot */
168 		uint[4] multishot;
169 		/* metering */
170 		short MeteringMode;
171 		short SpotMeteringMode;
172 		ubyte FlashMeteringMode;
173 		short FlashExposureLock;
174 		short ExposureMode;
175 		short AESetting;
176 		ubyte HighlightTonePriority;
177 		/* stabilization */
178 		short ImageStabilization;
179 		/* focus */
180 		short FocusMode;
181 		short AFPoint;
182 		short FocusContinuous;
183 		short AFPointsInFocus30D;
184 		ubyte[8] AFPointsInFocus1D;
185 		ushort AFPointsInFocus5D; /* bytes in reverse*/
186 															/* AFInfo */
187 		ushort AFAreaMode;
188 		ushort NumAFPoints;
189 		ushort ValidAFPoints;
190 		ushort AFImageWidth;
191 		ushort AFImageHeight;
192 		short[61] AFAreaWidths;     /* cycle to NumAFPoints */
193 		short[61] AFAreaHeights;    /* --''--               */
194 		short[61] AFAreaXPositions; /* --''--               */
195 		short[61] AFAreaYPositions; /* --''--               */
196 		short[4] AFPointsInFocus;   /* cycle to floor((NumAFPoints+15)/16) */
197 		short[4] AFPointsSelected;  /* --''--               */
198 		ushort PrimaryAFPoint;
199 		/* flash */
200 		short FlashMode;
201 		short FlashActivity;
202 		short FlashBits;
203 		short ManualFlashOutput;
204 		short FlashOutput;
205 		short FlashGuideNumber;
206 		/* drive */
207 		short ContinuousDrive;
208 		/* sensor */
209 		short SensorWidth;
210 		short SensorHeight;
211 		short SensorLeftBorder;
212 		short SensorTopBorder;
213 		short SensorRightBorder;
214 		short SensorBottomBorder;
215 		short BlackMaskLeftBorder;
216 		short BlackMaskTopBorder;
217 		short BlackMaskRightBorder;
218 		short BlackMaskBottomBorder;
219 		int   AFMicroAdjMode;
220 		float AFMicroAdjValue;
221 		short MakernotesFlip;
222 		short RecordMode;
223 		short SRAWQuality;
224 		uint wbi;
225 		float firmware;
226 		short RF_lensID;
227 	}
228 
229 	struct libraw_hasselblad_makernotes_t {
230 		int    BaseISO;
231 		double Gain;
232 		char[8]   Sensor;
233 		char[64]   SensorUnit; // SU
234 		char[64]   HostBody;   // HB
235 		int    SensorCode;
236 		int    SensorSubCode;
237 		int    CoatingCode;
238 		int    uncropped;
239 
240 /* CaptureSequenceInitiator is based on the content of the 'model' tag
241 	- values like 'Pinhole', 'Flash Sync', '500 Mech.' etc in .3FR 'model' tag
242 		come from MAIN MENU > SETTINGS > Camera;
243 	- otherwise 'model' contains:
244 		1. if CF/CFV/CFH, SU enclosure, can be with SU type if '-' is present
245 		2. else if '-' is present, HB + SU type;
246 		3. HB;
247 */
248 		char[32] CaptureSequenceInitiator;
249 
250 /* SensorUnitConnector, makernotes 0x0015 tag:
251  - in .3FR - SU side
252  - in .FFF - HB side
253 */
254 		char[64] SensorUnitConnector;
255 
256 		int format; // 3FR, FFF, Imacon (H3D-39 and maybe others), Hasselblad/Phocus DNG, Adobe DNG
257 		int[2] nIFD_CM; // number of IFD containing CM
258 		int[2] RecommendedCrop;
259 
260 /* mnColorMatrix is in makernotes tag 0x002a;
261 	not present in .3FR files and Imacon/H3D-39 .FFF files;
262 	when present in .FFF and Phocus .DNG files, it is a copy of CM1 from .3FR;
263 	available samples contain all '1's in the first 3 elements
264 */
265 		double[3][4] mnColorMatrix;
266 
267 	}
268 
269 	struct libraw_fuji_info_t {
270 		float  ExpoMidPointShift;
271 		ushort DynamicRange;
272 		ushort FilmMode;
273 		ushort DynamicRangeSetting;
274 		ushort DevelopmentDynamicRange;
275 		ushort AutoDynamicRange;
276 		ushort DRangePriority;
277 		ushort DRangePriorityAuto;
278 		ushort DRangePriorityFixed;
279 
280 		/*
281 		tag 0x9200, converted to BrightnessCompensation
282 		F700, S3Pro, S5Pro, S20Pro, S200EXR
283 		E550, E900, F810, S5600, S6500fd, S9000, S9500, S100FS
284 		*/
285 		float BrightnessCompensation; /* in EV, if =4, raw data * 2^4 */
286 
287 		ushort FocusMode;
288 		ushort AFMode;
289 		ushort[2] FocusPixel;
290 		ushort[3] ImageStabilization;
291 		ushort FlashMode;
292 		ushort WB_Preset;
293 
294 		/* ShutterType:
295 			 0 - mechanical
296 			 1 = electronic
297 			 2 = electronic, long shutter speed
298 			 3 = electronic, front curtain
299 		*/
300 		ushort ShutterType;
301 		ushort ExrMode;
302 		ushort Macro;
303 		uint Rating;
304 
305 		/* CropMode:
306 			 1 - FF on GFX,
307 			 2 - sports finder (mechanical shutter),
308 			 4 - 1.25x crop (electronic shutter, continuous high)
309 		*/
310 		ushort CropMode;
311 		ushort FrameRate;
312 		ushort FrameWidth;
313 		ushort FrameHeight;
314 		char[0x0c + 1]   SerialSignature;
315 		char[4 + 1]   RAFVersion;
316 		ushort RAFDataVersion;
317 		int    isTSNERDTS;
318 
319 		/* DriveMode:
320 			 0 - single frame
321 			 1 - continuous low
322 			 2 - continuous high
323 		*/
324 		short DriveMode;
325 	}
326 
327 	struct libraw_sensor_highspeed_crop_t {
328 		ushort cleft, ctop, cwidth, cheight;
329 	}
330 
331 	struct libraw_nikon_makernotes_t {
332 		double ExposureBracketValue;
333 		ushort ActiveDLighting;
334 		ushort ShootingMode;
335 		/* stabilization */
336 		ubyte[7] ImageStabilization;
337 		ubyte VibrationReduction;
338 		ubyte VRMode;
339 		/* focus */
340 		char[7] FocusMode;
341 		ubyte AFPoint;
342 		ushort AFPointsInFocus;
343 		ubyte ContrastDetectAF;
344 		ubyte AFAreaMode;
345 		ubyte PhaseDetectAF;
346 		ubyte PrimaryAFPoint;
347 		ubyte[29] AFPointsUsed;
348 		ushort AFImageWidth;
349 		ushort AFImageHeight;
350 		ushort AFAreaXPposition;
351 		ushort AFAreaYPosition;
352 		ushort AFAreaWidth;
353 		ushort AFAreaHeight;
354 		ubyte ContrastDetectAFInFocus;
355 		/* flash */
356 		char[13] FlashSetting;
357 		char[20] FlashType;
358 		ubyte[4] FlashExposureCompensation;
359 		ubyte[4] ExternalFlashExposureComp;
360 		ubyte[4] FlashExposureBracketValue;
361 		ubyte FlashMode;
362 		byte FlashExposureCompensation2;
363 		byte FlashExposureCompensation3;
364 		byte FlashExposureCompensation4;
365 		ubyte FlashSource;
366 		ubyte[2] FlashFirmware;
367 		ubyte ExternalFlashFlags;
368 		ubyte FlashControlCommanderMode;
369 		ubyte FlashOutputAndCompensation;
370 		ubyte FlashFocalLength;
371 		ubyte FlashGNDistance;
372 		ubyte[4] FlashGroupControlMode;
373 		ubyte[4] FlashGroupOutputAndCompensation;
374 		ubyte FlashColorFilter;
375 		ushort NEFCompression;
376 		int    ExposureMode;
377 		int    ExposureProgram;
378 		int    nMEshots;
379 		int    MEgainOn;
380 		double[4] ME_WB;
381 		ubyte AFFineTune;
382 		ubyte AFFineTuneIndex;
383 		int8_t AFFineTuneAdj;
384 		uint LensDataVersion;
385 		uint FlashInfoVersion;
386 		uint ColorBalanceVersion;
387 		ubyte key;
388 		ushort[4] NEFBitDepth;
389 		ushort HighSpeedCropFormat; /* 1 -> 1.3x; 2 -> DX; 3 -> 5:4; 4 -> 3:2; 6 ->
390 																	 16:9; 11 -> FX uncropped; 12 -> DX uncropped;
391 																	 17 -> 1:1 */
392 		libraw_sensor_highspeed_crop_t SensorHighSpeedCrop;
393 		ushort SensorWidth;
394 		ushort SensorHeight;
395 	}
396 
397 	struct libraw_olympus_makernotes_t {
398 		int[2]   SensorCalibration;
399 		ushort[2] FocusMode;
400 		ushort   AutoFocus;
401 		ushort   AFPoint;
402 		uint[64] AFAreas;
403 		double[5] AFPointSelected;
404 		ushort   AFResult;
405 		ushort[5] DriveMode;
406 		ushort   ColorSpace;
407 		ubyte    AFFineTune;
408 		short[3] AFFineTuneAdj;
409 		char[6]  CameraType2;
410 	}
411 
412 	struct libraw_panasonic_makernotes_t {
413 		/* Compression:
414 		 34826 (Panasonic RAW 2): LEICA DIGILUX 2;
415 		 34828 (Panasonic RAW 3): LEICA D-LUX 3; LEICA V-LUX 1; Panasonic DMC-LX1;
416 		 Panasonic DMC-LX2; Panasonic DMC-FZ30; Panasonic DMC-FZ50; 34830 (not in
417 		 exiftool): LEICA DIGILUX 3; Panasonic DMC-L1; 34316 (Panasonic RAW 1):
418 		 others (LEICA, Panasonic, YUNEEC);
419 		*/
420 		ushort   Compression;
421 		ushort   BlackLevelDim;
422 		float[8] BlackLevel;
423 		uint     Multishot; /* 0 is Off, 65536 is Pixel Shift */
424 		float    gamma;
425 		int[3]   HighISOMultiplier; /* 0->R, 1->G, 2->B */
426 	}
427 
428 	struct libraw_pentax_makernotes_t {
429 		ushort   FocusMode;
430 		ushort   AFPointSelected;
431 		uint     AFPointsInFocus;
432 		ushort   FocusPosition;
433 		ubyte[4] DriveMode;
434 		short    AFAdjustment;
435 		ubyte    MultiExposure; /* last bit is not "1" if ME is not used */
436 		ushort   Quality; /* 4 is raw, 7 is raw w/ pixel shift, 8 is raw w/ dynamic
437 											 pixel shift */
438 		/*    uchar AFPointMode;     */
439 		/*    uchar SRResult;        */
440 		/*    uchar ShakeReduction;  */
441 	}
442 
443 	struct libraw_samsung_makernotes_t {
444 		uint[4]  ImageSizeFull;
445 		uint[4]  ImageSizeCrop;
446 		int[2]   ColorSpace;
447 		uint[11] key;
448 		double   DigitalGain; /* PostAEGain, digital stretch */
449 		int      DeviceType;
450 		char[32] LensFirmware;
451 	}
452 
453 	struct libraw_kodak_makernotes_t {
454 		ushort BlackLevelTop;
455 		ushort BlackLevelBottom;
456 		short offset_left, offset_top; /* KDC files, negative values or zeros */
457 		ushort clipBlack, clipWhite;   /* valid for P712, P850, P880 */
458 		float[3][3] romm_camDaylight;
459 		float[3][3] romm_camTungsten;
460 		float[3][3] romm_camFluorescent;
461 		float[3][3] romm_camFlash;
462 		float[3][3] romm_camCustom;
463 		float[3][3] romm_camAuto;
464 		ushort val018percent, val100percent, val170percent;
465 		short MakerNoteKodak8a;
466 		float ISOCalibrationGain;
467 		float AnalogISO;
468 	}
469 
470 	struct libraw_p1_makernotes_t {
471 		char[64] Software;        // tag 0x0203
472 		char[64] SystemType;      // tag 0x0204
473 		char[256] FirmwareString; // tag 0x0301
474 		char[64] SystemModel;
475 	}
476 
477 	struct libraw_sony_info_t {
478 		ushort   CameraType;
479 		ubyte    Sony0x9400_version; /* 0 if not found/deciphered, 0xa, 0xb, 0xc
480 																 following exiftool convention */
481 		ubyte    Sony0x9400_ReleaseMode2;
482 		uint     Sony0x9400_SequenceImageNumber;
483 		ubyte    Sony0x9400_SequenceLength1;
484 		uint     Sony0x9400_SequenceFileNumber;
485 		ubyte    Sony0x9400_SequenceLength2;
486 		uint8_t  AFAreaModeSetting;
487 		ushort[2] FlexibleSpotPosition;
488 		uint8_t  AFPointSelected;
489 		uint8_t[10] AFPointsUsed;
490 		uint8_t  AFTracking;
491 		uint8_t  AFType;
492 		ushort[4] FocusLocation;
493 		int8_t   AFMicroAdjValue;
494 		int8_t   AFMicroAdjOn;
495 		ubyte    AFMicroAdjRegisteredLenses;
496 		ushort   VariableLowPassFilter;
497 		uint      LongExposureNoiseReduction;
498 		ushort   HighISONoiseReduction;
499 		ushort[2] HDR;
500 		ushort   group2010;
501 		ushort   real_iso_offset;
502 		ushort   MeteringMode_offset;
503 		ushort   ExposureProgram_offset;
504 		ushort   ReleaseMode2_offset;
505 		uint     MinoltaCamID;
506 		float    firmware;
507 		ushort   ImageCount3_offset;
508 		uint     ImageCount3;
509 		uint     ElectronicFrontCurtainShutter;
510 		ushort   MeteringMode2;
511 		char[20] SonyDateTime;
512 		uint     ShotNumberSincePowerUp;
513 		ushort   PixelShiftGroupPrefix;
514 		uint     PixelShiftGroupID;
515 		char     nShotsInPixelShiftGroup;
516 		char     numInPixelShiftGroup; /* '0' if ARQ, first shot in the group has '1'
517 																	here */
518 		ushort   prd_ImageHeight, prd_ImageWidth;
519 		ushort   prd_RawBitDepth;
520 		ushort   prd_StorageMethod; /* 82 -> Padded; 89 -> Linear */
521 		ushort   prd_BayerPattern;  /* 0 -> not valid; 1 -> RGGB; 4 -> GBRG */
522 
523 		ushort   SonyRawFileType; /* takes precedence over RAWFileType and Quality:
524 															 0  for uncompressed 14-bit raw
525 															 1  for uncompressed 12-bit raw
526 															 2  for compressed raw
527 															 3  for lossless compressed raw
528 														*/
529 		ushort RAWFileType;     /* takes precedence over Quality
530 															 0 for compressed raw, 1 for uncompressed;
531 														*/
532 		uint   Quality;       /* 0 or 6 for raw, 7 or 8 for compressed raw */
533 		ushort FileFormat;      /*  1000 SR2
534 																2000 ARW 1.0
535 																3000 ARW 2.0
536 																3100 ARW 2.1
537 																3200 ARW 2.2
538 																3300 ARW 2.3
539 																3310 ARW 2.3.1
540 																3320 ARW 2.3.2
541 																3330 ARW 2.3.3
542 																3350 ARW 2.3.5
543 														 */
544 	}
545 
546 	struct libraw_colordata_t {
547 		ushort[0x10000] curve;
548 		uint[LIBRAW_CBLACK_SIZE] cblack;
549 		uint black;
550 		uint data_maximum;
551 		uint maximum;
552 		c_long[4] linear_max;
553 		float fmaximum;
554 		float fnorm;
555 		ushort[8][8] white;
556 		float[4] cam_mul;
557 		float[4] pre_mul;
558 		float[4][3] cmatrix;
559 		float[4][3] ccm;
560 		float[4][3] rgb_cam;
561 		float[3][4] cam_xyz;
562 		ph1_t phase_one_data;
563 		float flash_used;
564 		float canon_ev;
565 		char[64] model2;
566 		char[64] UniqueCameraModel;
567 		char[64] LocalizedCameraModel;
568 		char[64] ImageUniqueID;
569 		char[17] RawDataUniqueID;
570 		char[64] OriginalRawFileName;
571 		void *profile;
572 		uint profile_length;
573 		uint[8] black_stat;
574 		libraw_dng_color_t[2] dng_color;
575 		libraw_dng_levels_t dng_levels;
576 		int[4][256] WB_Coeffs;    /* R, G1, B, G2 coeffs */
577 		float[5][64] WBCT_Coeffs; /* CCT, than R, G1, B, G2 coeffs */
578 		int as_shot_wb_applied;
579 		libraw_P1_color_t[2] P1_color;
580 		uint raw_bps; /* for Phase One, raw format */
581 											/* Phase One raw format values, makernotes tag 0x010e:
582 											0    Name unknown
583 											1    "RAW 1"
584 											2    "RAW 2"
585 											3    "IIQ L"
586 											4    Never seen
587 											5    "IIQ S"
588 											6    "IIQ S v.2"
589 											7    Never seen
590 											8    Name unknown
591 											*/
592 		int ExifColorSpace;
593 	}
594 
595 	struct libraw_thumbnail_t {
596 		LibRaw_thumbnail_formats tformat;
597 		ushort twidth, theight;
598 		uint tlength;
599 		int tcolors;
600 		char *thumb;
601 	}
602 
603 	struct libraw_gps_info_t {
604 		float[3] latitude;     /* Deg,min,sec */
605 		float[3] longitude;    /* Deg,min,sec */
606 		float[3] gpstimestamp; /* Deg,min,sec */
607 		float altitude;
608 		char altref, latref, longref, gpsstatus;
609 		char gpsparsed;
610 	}
611 
612 	struct libraw_imgother_t {
613 		float iso_speed;
614 		float shutter;
615 		float aperture;
616 		float focal_len;
617 		time_t timestamp;
618 		uint shot_order;
619 		uint[32] gpsdata;
620 		libraw_gps_info_t parsed_gps;
621 		char[512] desc;
622 		char[64] artist;
623 		float[4] analogbalance;
624 	}
625 
626 	struct libraw_metadata_common_t {
627 		float FlashEC;
628 		float FlashGN;
629 		float CameraTemperature;
630 		float SensorTemperature;
631 		float SensorTemperature2;
632 		float LensTemperature;
633 		float AmbientTemperature;
634 		float BatteryTemperature;
635 		float exifAmbientTemperature;
636 		float exifHumidity;
637 		float exifPressure;
638 		float exifWaterDepth;
639 		float exifAcceleration;
640 		float exifCameraElevationAngle;
641 		float real_ISO;
642 		float exifExposureIndex;
643 		ushort ColorSpace;
644 		char[128] firmware;
645 	}
646 
647 	struct libraw_output_params_t {
648 		uint[4] greybox;       /* -A  x1 y1 x2 y2 */
649 		uint[4] cropbox;       /* -B x1 y1 x2 y2 */
650 		double[4] aber;        /* -C */
651 		double[6] gamm;        /* -g */
652 		float[4] user_mul;     /* -r mul0 mul1 mul2 mul3 */
653 		uint shot_select;  /* -s */
654 		float bright;          /* -b */
655 		float threshold;       /* -n */
656 		int half_size;         /* -h */
657 		int four_color_rgb;    /* -f */
658 		int highlight;         /* -H */
659 		int use_auto_wb;       /* -a */
660 		int use_camera_wb;     /* -w */
661 		int use_camera_matrix; /* +M/-M */
662 		int output_color;      /* -o */
663 		char *output_profile;  /* -o */
664 		char *camera_profile;  /* -p */
665 		char *bad_pixels;      /* -P */
666 		char *dark_frame;      /* -K */
667 		int output_bps;        /* -4 */
668 		int output_tiff;       /* -T */
669 		int user_flip;         /* -t */
670 		int user_qual;         /* -q */
671 		int user_black;        /* -k */
672 		int[4] user_cblack;
673 		int user_sat;          /* -S */
674 		int med_passes;        /* -m */
675 		float auto_bright_thr;
676 		float adjust_maximum_thr;
677 		int no_auto_bright;    /* -W */
678 		int use_fuji_rotate;   /* -j */
679 		int green_matching;
680 		/* DCB parameters */
681 		int dcb_iterations;
682 		int dcb_enhance_fl;
683 		int fbdd_noiserd;
684 		int exp_correc;
685 		float exp_shift;
686 		float exp_preser;
687 		/* Raw speed */
688 		int use_rawspeed;
689 		/* DNG SDK */
690 		int use_dngsdk;
691 		/* Disable Auto-scale */
692 		int no_auto_scale;
693 		/* Disable intepolation */
694 		int no_interpolation;
695 		/*  int x3f_flags; */
696 		/* Sony ARW2 digging mode */
697 		/* int sony_arw2_options; */
698 		uint raw_processing_options;
699 		uint max_raw_memory_mb;
700 		int sony_arw2_posterization_thr;
701 		/* Nikon Coolscan */
702 		float coolscan_nef_gamma;
703 		char[5] p4shot_order;
704 		/* Custom camera list */
705 		char **custom_camera_strings;
706 	}
707 
708 	struct libraw_rawdata_t {
709 		/* really allocated bitmap */
710 		void *raw_alloc;
711 		/* alias to single_channel variant */
712 		ushort *raw_image;
713 		/* alias to 4-channel variant */
714 		ushort[4]* color4_image;
715 		/* alias to 3-color variand decoded by RawSpeed */
716 		ushort[3]* color3_image;
717 		/* float bayer */
718 		float *float_image;
719 		/* float 3-component */
720 		float[3]* float3_image;
721 		/* float 4-component */
722 		float[4]* float4_image;
723 
724 		/* Phase One black level data; */
725 		short[2]* ph1_cblack;
726 		short[2]* ph1_rblack;
727 		/* save color and sizes here, too.... */
728 		libraw_iparams_t iparams;
729 		libraw_image_sizes_t sizes;
730 		libraw_internal_output_params_t ioparams;
731 		libraw_colordata_t color;
732 	}
733 
734 	struct libraw_makernotes_lens_t {
735 		ulong LensID;
736 		char[128] Lens;
737 		ushort LensFormat; /* to characterize the image circle the lens covers */
738 		ushort LensMount;  /* 'male', lens itself */
739 		ulong CamID;
740 		ushort CameraFormat; /* some of the sensor formats */
741 		ushort CameraMount;  /* 'female', body throat */
742 		char[64] body;
743 		short FocalType; /* -1/0 is unknown; 1 is fixed focal; 2 is zoom */
744 		char[16] LensFeatures_pre, LensFeatures_suf;
745 		float MinFocal, MaxFocal;
746 		float MaxAp4MinFocal, MaxAp4MaxFocal, MinAp4MinFocal, MinAp4MaxFocal;
747 		float MaxAp, MinAp;
748 		float CurFocal, CurAp;
749 		float MaxAp4CurFocal, MinAp4CurFocal;
750 		float MinFocusDistance;
751 		float FocusRangeIndex;
752 		float LensFStops;
753 		ulong TeleconverterID;
754 		char[128] Teleconverter;
755 		ulong AdapterID;
756 		char[128] Adapter;
757 		ulong AttachmentID;
758 		char[128] Attachment;
759 		ushort CanonFocalUnits;
760 		float FocalLengthIn35mmFormat;
761 	}
762 
763 	struct libraw_nikonlens_t {
764 		float EffectiveMaxAp;
765 		ubyte LensIDNumber, LensFStops, MCUVersion, LensType;
766 	}
767 
768 	struct libraw_dnglens_t {
769 		float MinFocal, MaxFocal, MaxAp4MinFocal, MaxAp4MaxFocal;
770 	}
771 
772 	struct libraw_lensinfo_t {
773 		float MinFocal, MaxFocal, MaxAp4MinFocal, MaxAp4MaxFocal, EXIF_MaxAp;
774 		char[128] LensMake, Lens, LensSerial, InternalLensSerial;
775 		ushort FocalLengthIn35mmFormat;
776 		libraw_nikonlens_t nikon;
777 		libraw_dnglens_t dng;
778 		libraw_makernotes_lens_t makernotes;
779 	}
780 
781 	struct libraw_makernotes_t {
782 		libraw_canon_makernotes_t canon;
783 		libraw_nikon_makernotes_t nikon;
784 		libraw_hasselblad_makernotes_t hasselblad;
785 		libraw_fuji_info_t fuji;
786 		libraw_olympus_makernotes_t olympus;
787 		libraw_sony_info_t sony;
788 		libraw_kodak_makernotes_t kodak;
789 		libraw_panasonic_makernotes_t panasonic;
790 		libraw_pentax_makernotes_t pentax;
791 		libraw_p1_makernotes_t phaseone;
792 		libraw_samsung_makernotes_t samsung;
793 		libraw_metadata_common_t common;
794 	}
795 
796 	struct libraw_shootinginfo_t {
797 		short DriveMode;
798 		short FocusMode;
799 		short MeteringMode;
800 		short AFPoint;
801 		short ExposureMode;
802 		short ExposureProgram;
803 		short ImageStabilization;
804 		char[64] BodySerial;
805 		char[64] InternalBodySerial; /* this may be PCB or sensor serial, depends on make/model*/
806 	}
807 
808 	struct libraw_custom_camera_t {
809 		uint fsize;
810 		ushort rw, rh;
811 		ubyte lm, tm, rm, bm;
812 		ushort lf;
813 		ubyte cf, max, flags;
814 		char[10] t_make;
815 		char[20] t_model;
816 		ushort offset;
817 	}
818 
819 	struct libraw_data_t {
820 		ushort[4]* image;
821 		libraw_image_sizes_t sizes;
822 		libraw_iparams_t idata;
823 		libraw_lensinfo_t lens;
824 		libraw_makernotes_t makernotes;
825 		libraw_shootinginfo_t shootinginfo;
826 		libraw_output_params_t params;
827 		uint progress_flags;
828 		uint process_warnings;
829 		libraw_colordata_t color;
830 		libraw_imgother_t other;
831 		libraw_thumbnail_t thumbnail;
832 		libraw_rawdata_t rawdata;
833 		void *parent_class;
834 	}
835 
836 	struct fuji_compressed_params {
837 		int8_t *q_table; /* quantization table */
838 		int[5] q_point;  /* quantization points */
839 		int max_bits;
840 		int min_value;
841 		int raw_bits;
842 		int total_values;
843 		int maxDiff;
844 		ushort line_width;
845 	}
846 
847 	struct libraw_static_table_t
848 	{
849 		this(const(int)* a, const(uint) s) {
850 			data = a;
851 			_size = s;
852 		}
853 		this(ref const(libraw_static_table_t) s) {
854 			data = s.data;
855 			_size = s._size;
856 		}
857 		uint size() const { return _size; }
858 		int opIndex(uint idx) const
859 		{
860 			if (idx < _size) return data[idx];
861 			if(_size>0 && data) return data[0];
862 			return 0;
863 		}
864 	private:
865 		const(int)* data;
866 		uint _size;
867 	}
868 }
869 
870 static import std.system;
871 enum LibRawBigEndian = std.system.endian == std.system.Endian.bigEndian;