/src/LibRaw/src/tables/wblists.cpp
Line | Count | Source |
1 | | /* -*- C++ -*- |
2 | | * Copyright 2019-2025 LibRaw LLC (info@libraw.org) |
3 | | * |
4 | | LibRaw is free software; you can redistribute it and/or modify |
5 | | it under the terms of the one of two licenses as you choose: |
6 | | |
7 | | 1. GNU LESSER GENERAL PUBLIC LICENSE version 2.1 |
8 | | (See file LICENSE.LGPL provided in LibRaw distribution archive for details). |
9 | | |
10 | | 2. COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 |
11 | | (See file LICENSE.CDDL provided in LibRaw distribution archive for details). |
12 | | |
13 | | */ |
14 | | |
15 | | #include "../../internal/dcraw_defs.h" |
16 | | |
17 | | |
18 | 17.8k | #define _ARR_SZ(a) (sizeof(a)/sizeof(a[0])) |
19 | | |
20 | | static const int _tagtype_dataunit_bytes [20] = { |
21 | | 1, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8, 4, 2, 8, 8, 8, 8, 8 |
22 | | }; |
23 | | |
24 | | libraw_static_table_t LibRaw::tagtype_dataunit_bytes(_tagtype_dataunit_bytes, _ARR_SZ(_tagtype_dataunit_bytes)); |
25 | | |
26 | | int libraw_tagtype_dataunit_bytes(int tagtype) |
27 | 17.8k | { |
28 | 17.8k | return _tagtype_dataunit_bytes[((unsigned)tagtype < _ARR_SZ(_tagtype_dataunit_bytes)) ? tagtype : 0]; |
29 | 17.8k | } |
30 | | |
31 | | |
32 | | static const int _Canon_wbi2std[] = { // Canon WB index to standard indexes |
33 | | // std. number wbi - Canon number |
34 | | LIBRAW_WBI_Auto, // 0 |
35 | | LIBRAW_WBI_Daylight, // 1 |
36 | | LIBRAW_WBI_Cloudy, // 2 |
37 | | LIBRAW_WBI_Tungsten, // 3 |
38 | | LIBRAW_WBI_Fluorescent, // 4 |
39 | | LIBRAW_WBI_Flash, // 5 |
40 | | LIBRAW_WBI_Custom, // 6 |
41 | | LIBRAW_WBI_BW, // 7 |
42 | | LIBRAW_WBI_Shade, // 8 |
43 | | LIBRAW_WBI_Kelvin, // 9 |
44 | | LIBRAW_WBI_PC_Set1, // 10 |
45 | | LIBRAW_WBI_PC_Set2, // 11 |
46 | | LIBRAW_WBI_PC_Set3, // 12 |
47 | | LIBRAW_WBI_Unknown, // 13, unlucky number "13", not used |
48 | | LIBRAW_WBI_FluorescentHigh, // 14 |
49 | | LIBRAW_WBI_Custom1, // 15 |
50 | | LIBRAW_WBI_Custom2, // 16 |
51 | | LIBRAW_WBI_Underwater, // 17, last one for older PowerShot models |
52 | | LIBRAW_WBI_Custom3, // 18 |
53 | | LIBRAW_WBI_Custom4, // 19 |
54 | | LIBRAW_WBI_PC_Set4, // 20 |
55 | | LIBRAW_WBI_PC_Set5, // 21 |
56 | | LIBRAW_WBI_Unknown, // 22 |
57 | | LIBRAW_WBI_Auto1 // 23 |
58 | | }; |
59 | | |
60 | | libraw_static_table_t LibRaw::Canon_wbi2std(_Canon_wbi2std, _ARR_SZ(_Canon_wbi2std)); |
61 | | |
62 | | static const int _Canon_KeyIsZero_Len2048_linenums_2_StdWBi[] = { // Appendix A: G2, S30, S40; G3, G5, S45, S50 |
63 | | LIBRAW_WBI_Custom1, |
64 | | LIBRAW_WBI_Custom2, |
65 | | LIBRAW_WBI_Daylight, |
66 | | LIBRAW_WBI_Cloudy, |
67 | | LIBRAW_WBI_Tungsten, |
68 | | LIBRAW_WBI_Fluorescent, |
69 | | LIBRAW_WBI_Unknown, // ? FluorescentHigh, Shade, Custom, Kelvin |
70 | | LIBRAW_WBI_Flash |
71 | | }; |
72 | | |
73 | | libraw_static_table_t LibRaw::Canon_KeyIsZero_Len2048_linenums_2_StdWBi(_Canon_KeyIsZero_Len2048_linenums_2_StdWBi, |
74 | | _ARR_SZ(_Canon_KeyIsZero_Len2048_linenums_2_StdWBi)); |
75 | | |
76 | | static const int _Canon_KeyIs0x0410_Len3072_linenums_2_StdWBi[] = { // G6, S60, S70; offset +16 |
77 | | LIBRAW_WBI_Custom1, |
78 | | LIBRAW_WBI_Custom2, |
79 | | LIBRAW_WBI_Daylight, |
80 | | LIBRAW_WBI_Cloudy, |
81 | | LIBRAW_WBI_Tungsten, |
82 | | LIBRAW_WBI_Fluorescent, |
83 | | LIBRAW_WBI_FluorescentHigh, // LIBRAW_WBI_Unknown, // ? FluorescentHigh, Shade, Custom, Kelvin |
84 | | LIBRAW_WBI_Unknown, |
85 | | LIBRAW_WBI_Underwater, // LIBRAW_WBI_Unknown, |
86 | | LIBRAW_WBI_Unknown, |
87 | | LIBRAW_WBI_Flash |
88 | | }; |
89 | | |
90 | | libraw_static_table_t LibRaw::Canon_KeyIs0x0410_Len3072_linenums_2_StdWBi(_Canon_KeyIs0x0410_Len3072_linenums_2_StdWBi, |
91 | | _ARR_SZ(_Canon_KeyIs0x0410_Len3072_linenums_2_StdWBi)); |
92 | | |
93 | | static const int _Canon_KeyIs0x0410_Len2048_linenums_2_StdWBi[] = { // Pro1; offset +8 |
94 | | LIBRAW_WBI_Custom1, |
95 | | LIBRAW_WBI_Custom2, |
96 | | LIBRAW_WBI_Daylight, |
97 | | LIBRAW_WBI_Cloudy, |
98 | | LIBRAW_WBI_Tungsten, |
99 | | LIBRAW_WBI_Fluorescent, |
100 | | LIBRAW_WBI_Unknown, |
101 | | LIBRAW_WBI_Flash, // LIBRAW_WBI_Unknown, |
102 | | LIBRAW_WBI_Unknown, |
103 | | LIBRAW_WBI_Unknown, |
104 | | LIBRAW_WBI_Unknown // LIBRAW_WBI_Flash |
105 | | }; |
106 | | |
107 | | libraw_static_table_t LibRaw::Canon_KeyIs0x0410_Len2048_linenums_2_StdWBi(_Canon_KeyIs0x0410_Len2048_linenums_2_StdWBi, |
108 | | _ARR_SZ(_Canon_KeyIs0x0410_Len2048_linenums_2_StdWBi)); |
109 | | |
110 | | static const int _Canon_G9_linenums_2_StdWBi[] = { |
111 | | LIBRAW_WBI_Auto, |
112 | | LIBRAW_WBI_Daylight, |
113 | | LIBRAW_WBI_Cloudy, |
114 | | LIBRAW_WBI_Tungsten, |
115 | | LIBRAW_WBI_Fluorescent, |
116 | | LIBRAW_WBI_FluorescentHigh, |
117 | | LIBRAW_WBI_Flash, |
118 | | LIBRAW_WBI_Underwater, |
119 | | LIBRAW_WBI_Custom1, |
120 | | LIBRAW_WBI_Custom2 |
121 | | }; |
122 | | libraw_static_table_t LibRaw::Canon_G9_linenums_2_StdWBi(_Canon_G9_linenums_2_StdWBi, _ARR_SZ(_Canon_G9_linenums_2_StdWBi)); |
123 | | |
124 | | static const int _Canon_D30_linenums_2_StdWBi[] = { |
125 | | LIBRAW_WBI_Daylight, |
126 | | LIBRAW_WBI_Cloudy, |
127 | | LIBRAW_WBI_Tungsten, |
128 | | LIBRAW_WBI_Fluorescent, |
129 | | LIBRAW_WBI_Flash, |
130 | | LIBRAW_WBI_Custom |
131 | | }; |
132 | | libraw_static_table_t LibRaw::Canon_D30_linenums_2_StdWBi(_Canon_D30_linenums_2_StdWBi, _ARR_SZ(_Canon_D30_linenums_2_StdWBi)); |
133 | | |
134 | | static const int _Fuji_wb_list1[] = { |
135 | | LIBRAW_WBI_FineWeather, LIBRAW_WBI_Shade, LIBRAW_WBI_FL_D, |
136 | | LIBRAW_WBI_FL_N, LIBRAW_WBI_FL_W, LIBRAW_WBI_Tungsten |
137 | | |
138 | | }; |
139 | | libraw_static_table_t LibRaw::Fuji_wb_list1(_Fuji_wb_list1, _ARR_SZ(_Fuji_wb_list1)); |
140 | | |
141 | | static const int _FujiCCT_K[31] = { |
142 | | 2500, 2550, 2650, 2700, 2800, 2850, 2950, 3000, 3100, 3200, 3300, |
143 | | 3400, 3600, 3700, 3800, 4000, 4200, 4300, 4500, 4800, 5000, 5300, |
144 | | 5600, 5900, 6300, 6700, 7100, 7700, 8300, 9100, 10000 |
145 | | }; |
146 | | libraw_static_table_t LibRaw::FujiCCT_K(_FujiCCT_K, _ARR_SZ(_FujiCCT_K)); |
147 | | |
148 | | static const int _Fuji_wb_list2[] = { |
149 | | LIBRAW_WBI_Auto, 0, LIBRAW_WBI_Custom, 6, LIBRAW_WBI_FineWeather, 1, |
150 | | LIBRAW_WBI_Shade, 8, LIBRAW_WBI_FL_D, 10, LIBRAW_WBI_FL_N, 11, |
151 | | LIBRAW_WBI_FL_W, 12, LIBRAW_WBI_Tungsten, 2, LIBRAW_WBI_Underwater, 35, |
152 | | LIBRAW_WBI_Ill_A, 82, LIBRAW_WBI_D65, 83 |
153 | | }; |
154 | | libraw_static_table_t LibRaw::Fuji_wb_list2(_Fuji_wb_list2, _ARR_SZ(_Fuji_wb_list2)); |
155 | | |
156 | | static const int _Pentax_wb_list1[] = { |
157 | | LIBRAW_WBI_Daylight, LIBRAW_WBI_Shade, |
158 | | LIBRAW_WBI_Cloudy, LIBRAW_WBI_Tungsten, |
159 | | LIBRAW_WBI_FL_D, LIBRAW_WBI_FL_N, |
160 | | LIBRAW_WBI_FL_W, LIBRAW_WBI_Flash |
161 | | }; |
162 | | libraw_static_table_t LibRaw::Pentax_wb_list1(_Pentax_wb_list1, _ARR_SZ(_Pentax_wb_list1)); |
163 | | |
164 | | static const int _Pentax_wb_list2[] = { |
165 | | LIBRAW_WBI_Daylight, LIBRAW_WBI_Shade, LIBRAW_WBI_Cloudy, |
166 | | LIBRAW_WBI_Tungsten, LIBRAW_WBI_FL_D, LIBRAW_WBI_FL_N, |
167 | | LIBRAW_WBI_FL_W, LIBRAW_WBI_Flash, LIBRAW_WBI_FL_L |
168 | | }; |
169 | | libraw_static_table_t LibRaw::Pentax_wb_list2(_Pentax_wb_list2, _ARR_SZ(_Pentax_wb_list2)); |
170 | | |
171 | | |
172 | | static const int _Oly_wb_list1[] = { |
173 | | LIBRAW_WBI_Shade, LIBRAW_WBI_Cloudy, LIBRAW_WBI_FineWeather, |
174 | | LIBRAW_WBI_Tungsten, LIBRAW_WBI_Sunset, LIBRAW_WBI_FL_D, |
175 | | LIBRAW_WBI_FL_N, LIBRAW_WBI_FL_W, LIBRAW_WBI_FL_WW |
176 | | }; |
177 | | libraw_static_table_t LibRaw::Oly_wb_list1(_Oly_wb_list1, _ARR_SZ(_Oly_wb_list1)); |
178 | | |
179 | | static const int _Oly_wb_list2[] = { |
180 | | LIBRAW_WBI_Auto, 0, |
181 | | LIBRAW_WBI_Tungsten, 3000, |
182 | | 0x100, 3300, |
183 | | 0x100, 3600, |
184 | | 0x100, 3900, |
185 | | LIBRAW_WBI_FL_W, 4000, |
186 | | 0x100, 4300, |
187 | | LIBRAW_WBI_FL_D, 4500, |
188 | | 0x100, 4800, |
189 | | LIBRAW_WBI_FineWeather, 5300, |
190 | | LIBRAW_WBI_Cloudy, 6000, |
191 | | LIBRAW_WBI_FL_N, 6600, |
192 | | LIBRAW_WBI_Shade, 7500, |
193 | | LIBRAW_WBI_Custom1, 0, |
194 | | LIBRAW_WBI_Custom2, 0, |
195 | | LIBRAW_WBI_Custom3, 0, |
196 | | LIBRAW_WBI_Custom4, 0 |
197 | | }; |
198 | | libraw_static_table_t LibRaw::Oly_wb_list2(_Oly_wb_list2, _ARR_SZ(_Oly_wb_list2)); |
199 | | |
200 | | static const int _Sony_SRF_wb_list[] = { |
201 | | LIBRAW_WBI_Daylight, LIBRAW_WBI_Cloudy, LIBRAW_WBI_Fluorescent, |
202 | | LIBRAW_WBI_Tungsten, LIBRAW_WBI_Flash |
203 | | }; |
204 | | libraw_static_table_t LibRaw::Sony_SRF_wb_list(_Sony_SRF_wb_list, _ARR_SZ(_Sony_SRF_wb_list)); |
205 | | |
206 | | static const int _Sony_SR2_wb_list[] = { |
207 | | LIBRAW_WBI_Daylight, LIBRAW_WBI_Cloudy, LIBRAW_WBI_Tungsten, LIBRAW_WBI_Flash, |
208 | | 4500, LIBRAW_WBI_Unknown, LIBRAW_WBI_Fluorescent |
209 | | }; |
210 | | libraw_static_table_t LibRaw::Sony_SR2_wb_list(_Sony_SR2_wb_list, _ARR_SZ(_Sony_SR2_wb_list)); |
211 | | |
212 | | static const int _Sony_SR2_wb_list1[] = { |
213 | | LIBRAW_WBI_Daylight, LIBRAW_WBI_Cloudy, LIBRAW_WBI_Tungsten, LIBRAW_WBI_Flash, |
214 | | 4500, LIBRAW_WBI_Shade, LIBRAW_WBI_FL_W, LIBRAW_WBI_FL_N, LIBRAW_WBI_FL_D, |
215 | | LIBRAW_WBI_FL_L, 8500, 6000, 3200, 2500 |
216 | | }; |
217 | | libraw_static_table_t LibRaw::Sony_SR2_wb_list1(_Sony_SR2_wb_list1, _ARR_SZ(_Sony_SR2_wb_list1)); |