compile
[kdegraphics.git] / libs / libkdcraw / libraw / internal / defines.h
blobd9cb2aede89e75c51dc984901084870af5a29798
1 /*
2 GENERATED FILE, DO NOT EDIT
3 Generated from dcraw/dcraw.c at Sun Mar 15 13:33:55 2009
4 Look into original file (probably http://cybercom.net/~dcoffin/dcraw/dcraw.c)
5 for copyright information.
6 */
8 #line 28 "dcraw/dcraw.c"
9 #define NO_JPEG
10 #line 33 "dcraw/dcraw.c"
11 #define VERSION "8.93"
13 #define _GNU_SOURCE
14 #define _USE_MATH_DEFINES
15 #include <ctype.h>
16 #include <errno.h>
17 #include <fcntl.h>
18 #include <float.h>
19 #include <limits.h>
20 #include <math.h>
21 #include <setjmp.h>
22 #include <stdio.h>
23 #include <stdlib.h>
24 #include <string.h>
25 #include <time.h>
26 #include <sys/types.h>
27 #ifdef _OPENMP
28 #include <omp.h>
29 #endif
31 NO_JPEG disables decoding of compressed Kodak DC120 files.
32 NO_LCMS disables the "-p" option.
34 #ifndef NO_JPEG
35 #include <jpeglib.h>
36 #endif
37 #ifndef NO_LCMS
38 #include <lcms.h>
39 #endif
40 #ifdef LOCALEDIR
41 #include <libintl.h>
42 #define _(String) gettext(String)
43 #else
44 #define _(String) (String)
45 #endif
46 #line 76 "dcraw/dcraw.c"
47 #ifdef __CYGWIN__
48 #include <io.h>
49 #endif
50 #ifdef WIN32
51 #include <sys/utime.h>
52 #include <winsock2.h>
53 #pragma comment(lib, "ws2_32.lib")
54 #define snprintf _snprintf
55 #define strcasecmp _stricmp
56 #define strncasecmp strnicmp
57 typedef __int64 INT64;
58 typedef unsigned __int64 UINT64;
59 #else
60 #include <unistd.h>
61 #include <utime.h>
62 #include <netinet/in.h>
63 typedef long long INT64;
64 typedef unsigned long long UINT64;
65 #endif
67 #ifdef LJPEG_DECODE
68 #error Please compile dcraw.c by itself.
69 #error Do not link it with ljpeg_decode.
70 #endif
72 #ifndef LONG_BIT
73 #define LONG_BIT (8 * sizeof (long))
74 #endif
75 #line 170 "dcraw/dcraw.c"
76 #define FORC(cnt) for (c=0; c < cnt; c++)
77 #define FORC3 FORC(3)
78 #define FORC4 FORC(4)
79 #define FORCC FORC(colors)
81 #define SQR(x) ((x)*(x))
82 #define ABS(x) (((int)(x) ^ ((int)(x) >> 31)) - ((int)(x) >> 31))
83 #define MIN(a,b) ((a) < (b) ? (a) : (b))
84 #define MAX(a,b) ((a) > (b) ? (a) : (b))
85 #define LIM(x,min,max) MAX(min,MIN(x,max))
86 #define ULIM(x,y,z) ((y) < (z) ? LIM(x,y,z) : LIM(x,z,y))
87 #define CLIP(x) LIM(x,0,65535)
88 #define SWAP(a,b) { a ^= b; a ^= (b ^= a); }
91 In order to inline this calculation, I make the risky
92 assumption that all filter patterns can be described
93 by a repeating pattern of eight rows and two columns
95 Do not use the FC or BAYER macros with the Leaf CatchLight,
96 because its pattern is 16x16, not 2x8.
98 Return values are either 0/1/2/3 = G/M/C/Y or 0/1/2/3 = R/G1/B/G2
100 PowerShot 600 PowerShot A50 PowerShot Pro70 Pro90 & G1
101 0xe1e4e1e4: 0x1b4e4b1e: 0x1e4b4e1b: 0xb4b4b4b4:
103 0 1 2 3 4 5 0 1 2 3 4 5 0 1 2 3 4 5 0 1 2 3 4 5
104 0 G M G M G M 0 C Y C Y C Y 0 Y C Y C Y C 0 G M G M G M
105 1 C Y C Y C Y 1 M G M G M G 1 M G M G M G 1 Y C Y C Y C
106 2 M G M G M G 2 Y C Y C Y C 2 C Y C Y C Y
107 3 C Y C Y C Y 3 G M G M G M 3 G M G M G M
108 4 C Y C Y C Y 4 Y C Y C Y C
109 PowerShot A5 5 G M G M G M 5 G M G M G M
110 0x1e4e1e4e: 6 Y C Y C Y C 6 C Y C Y C Y
111 7 M G M G M G 7 M G M G M G
112 0 1 2 3 4 5
113 0 C Y C Y C Y
114 1 G M G M G M
115 2 C Y C Y C Y
116 3 M G M G M G
118 All RGB cameras use one of these Bayer grids:
120 0x16161616: 0x61616161: 0x49494949: 0x94949494:
122 0 1 2 3 4 5 0 1 2 3 4 5 0 1 2 3 4 5 0 1 2 3 4 5
123 0 B G B G B G 0 G R G R G R 0 G B G B G B 0 R G R G R G
124 1 G R G R G R 1 B G B G B G 1 R G R G R G 1 G B G B G B
125 2 B G B G B G 2 G R G R G R 2 G B G B G B 2 R G R G R G
126 3 G R G R G R 3 B G B G B G 3 R G R G R G 3 G B G B G B
129 #line 228 "dcraw/dcraw.c"
130 #define BAYER(row,col) \
131 image[((row) >> shrink)*iwidth + ((col) >> shrink)][FC(row,col)]
133 #define BAYER2(row,col) \
134 image[((row) >> shrink)*iwidth + ((col) >> shrink)][fc(row,col)]