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 SRAWQuality;
223 		uint wbi;
224 		short ColorSpace;
225 	}
226 
227 	struct libraw_hasselblad_makernotes_t {
228 		int    BaseISO;
229 		double Gain;
230 		char[8]   Sensor;
231 		char[64]   SensorUnit; // SU
232 		char[64]   HostBody;   // HB
233 		int    SensorCode;
234 		int    SensorSubCode;
235 		int    CoatingCode;
236 		int    uncropped;
237 
238 /* CaptureSequenceInitiator is based on the content of the 'model' tag
239 	- values like 'Pinhole', 'Flash Sync', '500 Mech.' etc in .3FR 'model' tag
240 		come from MAIN MENU > SETTINGS > Camera;
241 	- otherwise 'model' contains:
242 		1. if CF/CFV/CFH, SU enclosure, can be with SU type if '-' is present
243 		2. else if '-' is present, HB + SU type;
244 		3. HB;
245 */
246 		char[32] CaptureSequenceInitiator;
247 
248 /* SensorUnitConnector, makernotes 0x0015 tag:
249  - in .3FR - SU side
250  - in .FFF - HB side
251 */
252 		char[64] SensorUnitConnector;
253 
254 		int format; // 3FR, FFF, Imacon (H3D-39 and maybe others), Hasselblad/Phocus DNG, Adobe DNG
255 		int[2] nIFD_CM; // number of IFD containing CM
256 		int[2] RecommendedCrop;
257 
258 /* mnColorMatrix is in makernotes tag 0x002a;
259 	not present in .3FR files and Imacon/H3D-39 .FFF files;
260 	when present in .FFF and Phocus .DNG files, it is a copy of CM1 from .3FR;
261 	available samples contain all '1's in the first 3 elements
262 */
263 		double[3][4] mnColorMatrix;
264 
265 	}
266 
267 	struct libraw_fuji_info_t {
268 		float  ExpoMidPointShift;
269 		ushort DynamicRange;
270 		ushort FilmMode;
271 		ushort DynamicRangeSetting;
272 		ushort DevelopmentDynamicRange;
273 		ushort AutoDynamicRange;
274 
275 		/*
276 		tag 0x9200, converted to BrightnessCompensation
277 		F700, S3Pro, S5Pro, S20Pro, S200EXR
278 		E550, E900, F810, S5600, S6500fd, S9000, S9500, S100FS
279 		*/
280 		float BrightnessCompensation; /* in EV, if =4, raw data * 2^4 */
281 
282 		ushort FocusMode;
283 		ushort AFMode;
284 		ushort[2] FocusPixel;
285 		ushort[3] ImageStabilization;
286 		ushort FlashMode;
287 		ushort WB_Preset;
288 
289 		/* ShutterType:
290 			 0 - mechanical
291 			 1 = electronic
292 			 2 = electronic, long shutter speed
293 			 3 = electronic, front curtain
294 		*/
295 		ushort ShutterType;
296 		ushort ExrMode;
297 		ushort Macro;
298 		uint Rating;
299 
300 		/* CropMode:
301 			 1 - FF on GFX,
302 			 2 - sports finder (mechanical shutter),
303 			 4 - 1.25x crop (electronic shutter, continuous high)
304 		*/
305 		ushort CropMode;
306 		ushort FrameRate;
307 		ushort FrameWidth;
308 		ushort FrameHeight;
309 		char[0x0c + 1]   SerialSignature;
310 		char[4 + 1]   RAFVersion;
311 		ushort RAFDataVersion;
312 		int    isTSNERDTS;
313 
314 		/* DriveMode:
315 			 0 - single frame
316 			 1 - continuous low
317 			 2 - continuous high
318 		*/
319 		short DriveMode;
320 	}
321 
322 	struct libraw_sensor_highspeed_crop_t {
323 		ushort cleft, ctop, cwidth, cheight;
324 	}
325 
326 	struct libraw_nikon_makernotes_t {
327 		double ExposureBracketValue;
328 		ushort ActiveDLighting;
329 		ushort ShootingMode;
330 		/* stabilization */
331 		ubyte[7] ImageStabilization;
332 		ubyte VibrationReduction;
333 		ubyte VRMode;
334 		/* focus */
335 		char[7] FocusMode;
336 		ubyte AFPoint;
337 		ushort AFPointsInFocus;
338 		ubyte ContrastDetectAF;
339 		ubyte AFAreaMode;
340 		ubyte PhaseDetectAF;
341 		ubyte PrimaryAFPoint;
342 		ubyte[29] AFPointsUsed;
343 		ushort AFImageWidth;
344 		ushort AFImageHeight;
345 		ushort AFAreaXPposition;
346 		ushort AFAreaYPosition;
347 		ushort AFAreaWidth;
348 		ushort AFAreaHeight;
349 		ubyte ContrastDetectAFInFocus;
350 		/* flash */
351 		char[13] FlashSetting;
352 		char[20] FlashType;
353 		ubyte[4] FlashExposureCompensation;
354 		ubyte[4] ExternalFlashExposureComp;
355 		ubyte[4] FlashExposureBracketValue;
356 		ubyte FlashMode;
357 		byte FlashExposureCompensation2;
358 		byte FlashExposureCompensation3;
359 		byte FlashExposureCompensation4;
360 		ubyte FlashSource;
361 		ubyte[2] FlashFirmware;
362 		ubyte ExternalFlashFlags;
363 		ubyte FlashControlCommanderMode;
364 		ubyte FlashOutputAndCompensation;
365 		ubyte FlashFocalLength;
366 		ubyte FlashGNDistance;
367 		ubyte[4] FlashGroupControlMode;
368 		ubyte[4] FlashGroupOutputAndCompensation;
369 		ubyte FlashColorFilter;
370 		ushort NEFCompression;
371 		int    ExposureMode;
372 		int    ExposureProgram;
373 		int    nMEshots;
374 		int    MEgainOn;
375 		double[4] ME_WB;
376 		ubyte AFFineTune;
377 		ubyte AFFineTuneIndex;
378 		int8_t AFFineTuneAdj;
379 		uint LensDataVersion;
380 		uint FlashInfoVersion;
381 		uint ColorBalanceVersion;
382 		ubyte key;
383 		ushort[4] NEFBitDepth;
384 		ushort HighSpeedCropFormat; /* 1 -> 1.3x; 2 -> DX; 3 -> 5:4; 4 -> 3:2; 6 ->
385 																	 16:9; 11 -> FX uncropped; 12 -> DX uncropped;
386 																	 17 -> 1:1 */
387 		libraw_sensor_highspeed_crop_t SensorHighSpeedCrop;
388 		ushort SensorWidth;
389 		ushort SensorHeight;
390 	}
391 
392 	struct libraw_olympus_makernotes_t {
393 		int[2]   SensorCalibration;
394 		ushort[2] FocusMode;
395 		ushort   AutoFocus;
396 		ushort   AFPoint;
397 		uint[64] AFAreas;
398 		double[5] AFPointSelected;
399 		ushort   AFResult;
400 		ushort[5] DriveMode;
401 		ushort   ColorSpace;
402 		ubyte    AFFineTune;
403 		short[3] AFFineTuneAdj;
404 		char[6]  CameraType2;
405 	}
406 
407 	struct libraw_panasonic_makernotes_t {
408 		/* Compression:
409 		 34826 (Panasonic RAW 2): LEICA DIGILUX 2;
410 		 34828 (Panasonic RAW 3): LEICA D-LUX 3; LEICA V-LUX 1; Panasonic DMC-LX1;
411 		 Panasonic DMC-LX2; Panasonic DMC-FZ30; Panasonic DMC-FZ50; 34830 (not in
412 		 exiftool): LEICA DIGILUX 3; Panasonic DMC-L1; 34316 (Panasonic RAW 1):
413 		 others (LEICA, Panasonic, YUNEEC);
414 		*/
415 		ushort   Compression;
416 		ushort   BlackLevelDim;
417 		float[8] BlackLevel;
418 		uint     Multishot; /* 0 is Off, 65536 is Pixel Shift */
419 		float    gamma;
420 		int[3]   HighISOMultiplier; /* 0->R, 1->G, 2->B */
421 	}
422 
423 	struct libraw_pentax_makernotes_t {
424 		ushort   FocusMode;
425 		ushort   AFPointSelected;
426 		uint     AFPointsInFocus;
427 		ushort   FocusPosition;
428 		ubyte[4] DriveMode;
429 		short    AFAdjustment;
430 		ubyte    MultiExposure; /* last bit is not "1" if ME is not used */
431 		ushort   Quality; /* 4 is raw, 7 is raw w/ pixel shift, 8 is raw w/ dynamic
432 											 pixel shift */
433 		/*    uchar AFPointMode;     */
434 		/*    uchar SRResult;        */
435 		/*    uchar ShakeReduction;  */
436 	}
437 
438 	struct libraw_samsung_makernotes_t {
439 		uint[4]  ImageSizeFull;
440 		uint[4]  ImageSizeCrop;
441 		int[2]   ColorSpace;
442 		uint[11] key;
443 		double   DigitalGain; /* PostAEGain, digital stretch */
444 		int      DeviceType;
445 		char[32] LensFirmware;
446 	}
447 
448 	struct libraw_kodak_makernotes_t {
449 		ushort BlackLevelTop;
450 		ushort BlackLevelBottom;
451 		short offset_left, offset_top; /* KDC files, negative values or zeros */
452 		ushort clipBlack, clipWhite;   /* valid for P712, P850, P880 */
453 		float[3][3] romm_camDaylight;
454 		float[3][3] romm_camTungsten;
455 		float[3][3] romm_camFluorescent;
456 		float[3][3] romm_camFlash;
457 		float[3][3] romm_camCustom;
458 		float[3][3] romm_camAuto;
459 		ushort val018percent, val100percent, val170percent;
460 		short MakerNoteKodak8a;
461 		float ISOCalibrationGain;
462 		float AnalogISO;
463 	}
464 
465 	struct libraw_p1_makernotes_t {
466 		char[64] Software;        // tag 0x0203
467 		char[64] SystemType;      // tag 0x0204
468 		char[256] FirmwareString; // tag 0x0301
469 		char[64] SystemModel;
470 	}
471 
472 	struct libraw_sony_info_t {
473 		ushort   CameraType;
474 		ubyte    Sony0x9400_version; /* 0 if not found/deciphered, 0xa, 0xb, 0xc
475 																 following exiftool convention */
476 		ubyte    Sony0x9400_ReleaseMode2;
477 		uint     Sony0x9400_SequenceImageNumber;
478 		ubyte    Sony0x9400_SequenceLength1;
479 		uint     Sony0x9400_SequenceFileNumber;
480 		ubyte    Sony0x9400_SequenceLength2;
481 		uint8_t  AFAreaModeSetting;
482 		ushort[2] FlexibleSpotPosition;
483 		uint8_t  AFPointSelected;
484 		uint8_t[10] AFPointsUsed;
485 		uint8_t  AFTracking;
486 		uint8_t  AFType;
487 		ushort[4] FocusLocation;
488 		int8_t   AFMicroAdjValue;
489 		int8_t   AFMicroAdjOn;
490 		ubyte    AFMicroAdjRegisteredLenses;
491 		ushort   VariableLowPassFilter;
492 		uint      LongExposureNoiseReduction;
493 		ushort   HighISONoiseReduction;
494 		ushort[2] HDR;
495 		ushort   group2010;
496 		ushort   real_iso_offset;
497 		ushort   MeteringMode_offset;
498 		ushort   ExposureProgram_offset;
499 		ushort   ReleaseMode2_offset;
500 		uint     MinoltaCamID;
501 		float    firmware;
502 		ushort   ImageCount3_offset;
503 		uint     ImageCount3;
504 		uint     ElectronicFrontCurtainShutter;
505 		ushort   MeteringMode2;
506 		char[20] SonyDateTime;
507 		uint     ShotNumberSincePowerUp;
508 		ushort   PixelShiftGroupPrefix;
509 		uint     PixelShiftGroupID;
510 		char     nShotsInPixelShiftGroup;
511 		char     numInPixelShiftGroup; /* '0' if ARQ, first shot in the group has '1'
512 																	here */
513 		ushort   prd_ImageHeight, prd_ImageWidth;
514 		ushort   prd_RawBitDepth;
515 		ushort   prd_StorageMethod; /* 82 -> Padded; 89 -> Linear */
516 		ushort   prd_BayerPattern;  /* 0 -> not valid; 1 -> RGGB; 4 -> GBRG */
517 
518 		ushort   SonyRawFileType; /* takes precedence over RAWFileType and Quality:
519 															 0  for uncompressed 14-bit raw
520 															 1  for uncompressed 12-bit raw
521 															 2  for compressed raw
522 															 3  for lossless compressed raw
523 														*/
524 		ushort RAWFileType;     /* takes precedence over Quality
525 															 0 for compressed raw, 1 for uncompressed;
526 														*/
527 		uint   Quality;       /* 0 or 6 for raw, 7 or 8 for compressed raw */
528 		ushort FileFormat;      /*  1000 SR2
529 																2000 ARW 1.0
530 																3000 ARW 2.0
531 																3100 ARW 2.1
532 																3200 ARW 2.2
533 																3300 ARW 2.3
534 																3310 ARW 2.3.1
535 																3320 ARW 2.3.2
536 																3330 ARW 2.3.3
537 																3350 ARW 2.3.5
538 														 */
539 	}
540 
541 	struct libraw_colordata_t {
542 		ushort[0x10000] curve;
543 		uint[LIBRAW_CBLACK_SIZE] cblack;
544 		uint black;
545 		uint data_maximum;
546 		uint maximum;
547 		c_long[4] linear_max;
548 		float fmaximum;
549 		float fnorm;
550 		ushort[8][8] white;
551 		float[4] cam_mul;
552 		float[4] pre_mul;
553 		float[4][3] cmatrix;
554 		float[4][3] ccm;
555 		float[4][3] rgb_cam;
556 		float[3][4] cam_xyz;
557 		ph1_t phase_one_data;
558 		float flash_used;
559 		float canon_ev;
560 		char[64] model2;
561 		char[64] UniqueCameraModel;
562 		char[64] LocalizedCameraModel;
563 		char[64] ImageUniqueID;
564 		char[17] RawDataUniqueID;
565 		char[64] OriginalRawFileName;
566 		void *profile;
567 		uint profile_length;
568 		uint[8] black_stat;
569 		libraw_dng_color_t[2] dng_color;
570 		libraw_dng_levels_t dng_levels;
571 		int[4][256] WB_Coeffs;    /* R, G1, B, G2 coeffs */
572 		float[5][64] WBCT_Coeffs; /* CCT, than R, G1, B, G2 coeffs */
573 		int as_shot_wb_applied;
574 		libraw_P1_color_t[2] P1_color;
575 		uint raw_bps; /* for Phase One, raw format */
576 											/* Phase One raw format values, makernotes tag 0x010e:
577 											0    Name unknown
578 											1    "RAW 1"
579 											2    "RAW 2"
580 											3    "IIQ L"
581 											4    Never seen
582 											5    "IIQ S"
583 											6    "IIQ S v.2"
584 											7    Never seen
585 											8    Name unknown
586 											*/
587 	}
588 
589 	struct libraw_thumbnail_t {
590 		LibRaw_thumbnail_formats tformat;
591 		ushort twidth, theight;
592 		uint tlength;
593 		int tcolors;
594 		char *thumb;
595 	}
596 
597 	struct libraw_gps_info_t {
598 		float[3] latitude;     /* Deg,min,sec */
599 		float[3] longtitude;   /* Deg,min,sec */
600 		float[3] gpstimestamp; /* Deg,min,sec */
601 		float altitude;
602 		char altref, latref, longref, gpsstatus;
603 		char gpsparsed;
604 	}
605 
606 	struct libraw_imgother_t {
607 		float iso_speed;
608 		float shutter;
609 		float aperture;
610 		float focal_len;
611 		time_t timestamp;
612 		uint shot_order;
613 		uint[32] gpsdata;
614 		libraw_gps_info_t parsed_gps;
615 		char[512] desc;
616 		char[64] artist;
617 		float[4] analogbalance;
618 	}
619 
620 	struct libraw_metadata_common_t {
621 		float FlashEC;
622 		float FlashGN;
623 		float CameraTemperature;
624 		float SensorTemperature;
625 		float SensorTemperature2;
626 		float LensTemperature;
627 		float AmbientTemperature;
628 		float BatteryTemperature;
629 		float exifAmbientTemperature;
630 		float exifHumidity;
631 		float exifPressure;
632 		float exifWaterDepth;
633 		float exifAcceleration;
634 		float exifCameraElevationAngle;
635 		float real_ISO;
636 		float exifExposureIndex;
637 	}
638 
639 	struct libraw_output_params_t {
640 		uint[4] greybox;       /* -A  x1 y1 x2 y2 */
641 		uint[4] cropbox;       /* -B x1 y1 x2 y2 */
642 		double[4] aber;        /* -C */
643 		double[6] gamm;        /* -g */
644 		float[4] user_mul;     /* -r mul0 mul1 mul2 mul3 */
645 		uint shot_select;  /* -s */
646 		float bright;          /* -b */
647 		float threshold;       /* -n */
648 		int half_size;         /* -h */
649 		int four_color_rgb;    /* -f */
650 		int highlight;         /* -H */
651 		int use_auto_wb;       /* -a */
652 		int use_camera_wb;     /* -w */
653 		int use_camera_matrix; /* +M/-M */
654 		int output_color;      /* -o */
655 		char *output_profile;  /* -o */
656 		char *camera_profile;  /* -p */
657 		char *bad_pixels;      /* -P */
658 		char *dark_frame;      /* -K */
659 		int output_bps;        /* -4 */
660 		int output_tiff;       /* -T */
661 		int user_flip;         /* -t */
662 		int user_qual;         /* -q */
663 		int user_black;        /* -k */
664 		int[4] user_cblack;
665 		int user_sat;          /* -S */
666 		int med_passes;        /* -m */
667 		float auto_bright_thr;
668 		float adjust_maximum_thr;
669 		int no_auto_bright;    /* -W */
670 		int use_fuji_rotate;   /* -j */
671 		int green_matching;
672 		/* DCB parameters */
673 		int dcb_iterations;
674 		int dcb_enhance_fl;
675 		int fbdd_noiserd;
676 		int exp_correc;
677 		float exp_shift;
678 		float exp_preser;
679 		/* Raw speed */
680 		int use_rawspeed;
681 		/* DNG SDK */
682 		int use_dngsdk;
683 		/* Disable Auto-scale */
684 		int no_auto_scale;
685 		/* Disable intepolation */
686 		int no_interpolation;
687 		/*  int x3f_flags; */
688 		/* Sony ARW2 digging mode */
689 		/* int sony_arw2_options; */
690 		uint raw_processing_options;
691 		uint max_raw_memory_mb;
692 		int sony_arw2_posterization_thr;
693 		/* Nikon Coolscan */
694 		float coolscan_nef_gamma;
695 		char[5] p4shot_order;
696 		/* Custom camera list */
697 		char **custom_camera_strings;
698 	}
699 
700 	struct libraw_rawdata_t {
701 		/* really allocated bitmap */
702 		void *raw_alloc;
703 		/* alias to single_channel variant */
704 		ushort *raw_image;
705 		/* alias to 4-channel variant */
706 		ushort[4]* color4_image;
707 		/* alias to 3-color variand decoded by RawSpeed */
708 		ushort[3]* color3_image;
709 		/* float bayer */
710 		float *float_image;
711 		/* float 3-component */
712 		float[3]* float3_image;
713 		/* float 4-component */
714 		float[4]* float4_image;
715 
716 		/* Phase One black level data; */
717 		short[2]* ph1_cblack;
718 		short[2]* ph1_rblack;
719 		/* save color and sizes here, too.... */
720 		libraw_iparams_t iparams;
721 		libraw_image_sizes_t sizes;
722 		libraw_internal_output_params_t ioparams;
723 		libraw_colordata_t color;
724 	}
725 
726 	struct libraw_makernotes_lens_t {
727 		ulong LensID;
728 		char[128] Lens;
729 		ushort LensFormat; /* to characterize the image circle the lens covers */
730 		ushort LensMount;  /* 'male', lens itself */
731 		ulong CamID;
732 		ushort CameraFormat; /* some of the sensor formats */
733 		ushort CameraMount;  /* 'female', body throat */
734 		char[64] body;
735 		short FocalType; /* -1/0 is unknown; 1 is fixed focal; 2 is zoom */
736 		char[16] LensFeatures_pre, LensFeatures_suf;
737 		float MinFocal, MaxFocal;
738 		float MaxAp4MinFocal, MaxAp4MaxFocal, MinAp4MinFocal, MinAp4MaxFocal;
739 		float MaxAp, MinAp;
740 		float CurFocal, CurAp;
741 		float MaxAp4CurFocal, MinAp4CurFocal;
742 		float MinFocusDistance;
743 		float FocusRangeIndex;
744 		float LensFStops;
745 		ulong TeleconverterID;
746 		char[128] Teleconverter;
747 		ulong AdapterID;
748 		char[128] Adapter;
749 		ulong AttachmentID;
750 		char[128] Attachment;
751 		ushort CanonFocalUnits;
752 		float FocalLengthIn35mmFormat;
753 	}
754 
755 	struct libraw_nikonlens_t {
756 		float EffectiveMaxAp;
757 		ubyte LensIDNumber, LensFStops, MCUVersion, LensType;
758 	}
759 
760 	struct libraw_dnglens_t {
761 		float MinFocal, MaxFocal, MaxAp4MinFocal, MaxAp4MaxFocal;
762 	}
763 
764 	struct libraw_lensinfo_t {
765 		float MinFocal, MaxFocal, MaxAp4MinFocal, MaxAp4MaxFocal, EXIF_MaxAp;
766 		char[128] LensMake, Lens, LensSerial, InternalLensSerial;
767 		ushort FocalLengthIn35mmFormat;
768 		libraw_nikonlens_t nikon;
769 		libraw_dnglens_t dng;
770 		libraw_makernotes_lens_t makernotes;
771 	}
772 
773 	struct libraw_makernotes_t {
774 		libraw_canon_makernotes_t canon;
775 		libraw_nikon_makernotes_t nikon;
776 		libraw_hasselblad_makernotes_t hasselblad;
777 		libraw_fuji_info_t fuji;
778 		libraw_olympus_makernotes_t olympus;
779 		libraw_sony_info_t sony;
780 		libraw_kodak_makernotes_t kodak;
781 		libraw_panasonic_makernotes_t panasonic;
782 		libraw_pentax_makernotes_t pentax;
783 		libraw_p1_makernotes_t phaseone;
784 		libraw_samsung_makernotes_t samsung;
785 		libraw_metadata_common_t common;
786 	}
787 
788 	struct libraw_shootinginfo_t {
789 		short DriveMode;
790 		short FocusMode;
791 		short MeteringMode;
792 		short AFPoint;
793 		short ExposureMode;
794 		short ExposureProgram;
795 		short ImageStabilization;
796 		char[64] BodySerial;
797 		char[64] InternalBodySerial; /* this may be PCB or sensor serial, depends on make/model*/
798 	}
799 
800 	struct libraw_custom_camera_t {
801 		uint fsize;
802 		ushort rw, rh;
803 		ubyte lm, tm, rm, bm;
804 		ushort lf;
805 		ubyte cf, max, flags;
806 		char[10] t_make;
807 		char[20] t_model;
808 		ushort offset;
809 	}
810 
811 	struct libraw_data_t {
812 		ushort[4]* image;
813 		libraw_image_sizes_t sizes;
814 		libraw_iparams_t idata;
815 		libraw_lensinfo_t lens;
816 		libraw_makernotes_t makernotes;
817 		libraw_shootinginfo_t shootinginfo;
818 		libraw_output_params_t params;
819 		uint progress_flags;
820 		uint process_warnings;
821 		libraw_colordata_t color;
822 		libraw_imgother_t other;
823 		libraw_thumbnail_t thumbnail;
824 		libraw_rawdata_t rawdata;
825 		void *parent_class;
826 	}
827 
828 	struct fuji_compressed_params {
829 		int8_t *q_table; /* quantization table */
830 		int[5] q_point;  /* quantization points */
831 		int max_bits;
832 		int min_value;
833 		int raw_bits;
834 		int total_values;
835 		int maxDiff;
836 		ushort line_width;
837 	}
838 }
839 
840 static import std.system;
841 enum LibRawBigEndian = std.system.endian == std.system.Endian.bigEndian;