Coverage Report

Created: 2025-06-16 07:00

/src/libraw/src/utils/decoder_info.cpp
Line
Count
Source (jump to first uncovered line)
1
/* -*- C++ -*-
2
 * Copyright 2019-2024 LibRaw LLC (info@libraw.org)
3
 *
4
5
 LibRaw is free software; you can redistribute it and/or modify
6
 it under the terms of the one of two licenses as you choose:
7
8
1. GNU LESSER GENERAL PUBLIC LICENSE version 2.1
9
   (See file LICENSE.LGPL provided in LibRaw distribution archive for details).
10
11
2. COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
12
   (See file LICENSE.CDDL provided in LibRaw distribution archive for details).
13
14
 */
15
#include "../../internal/libraw_cxx_defs.h"
16
17
const char *LibRaw::unpack_function_name()
18
0
{
19
0
  libraw_decoder_info_t decoder_info;
20
0
  get_decoder_info(&decoder_info);
21
0
  return decoder_info.decoder_name;
22
0
}
23
24
int LibRaw::get_decoder_info(libraw_decoder_info_t *d_info)
25
10.4k
{
26
10.4k
  if (!d_info)
27
0
    return LIBRAW_UNSPECIFIED_ERROR;
28
10.4k
  d_info->decoder_name = 0;
29
10.4k
  d_info->decoder_flags = 0;
30
10.4k
  if (!load_raw)
31
0
    return LIBRAW_OUT_OF_ORDER_CALL;
32
33
  // dcraw.c names order
34
10.4k
  if (load_raw == &LibRaw::android_tight_load_raw)
35
0
  {
36
0
    d_info->decoder_name = "android_tight_load_raw()";
37
0
    d_info->decoder_flags = LIBRAW_DECODER_FIXEDMAXC;
38
0
  }
39
10.4k
  else if (load_raw == &LibRaw::android_loose_load_raw)
40
0
  {
41
0
    d_info->decoder_name = "android_loose_load_raw()";
42
0
    d_info->decoder_flags = LIBRAW_DECODER_FIXEDMAXC;
43
0
  }
44
10.4k
  else if (load_raw == &LibRaw::vc5_dng_load_raw_placeholder)
45
0
  {
46
0
      d_info->decoder_name = "vc5_dng_load_raw_placeholder()";
47
0
#ifndef USE_GPRSDK
48
0
    d_info->decoder_flags = LIBRAW_DECODER_UNSUPPORTED_FORMAT;
49
0
#endif
50
0
  }
51
10.4k
  else if (load_raw == &LibRaw::jxl_dng_load_raw_placeholder)
52
0
  {
53
0
    d_info->decoder_name = "jxl_dng_load_raw_placeholder()";
54
0
#ifndef USE_DNGSDK
55
0
    d_info->decoder_flags = LIBRAW_DECODER_UNSUPPORTED_FORMAT;
56
0
#endif
57
0
  }
58
10.4k
  else if (load_raw == &LibRaw::canon_600_load_raw)
59
6
  {
60
6
    d_info->decoder_name = "canon_600_load_raw()";
61
6
    d_info->decoder_flags = LIBRAW_DECODER_FIXEDMAXC;
62
6
  }
63
10.4k
  else if (load_raw == &LibRaw::fuji_compressed_load_raw)
64
859
  {
65
859
    d_info->decoder_name = "fuji_compressed_load_raw()";
66
859
  }
67
9.63k
  else if (load_raw == &LibRaw::fuji_14bit_load_raw)
68
0
  {
69
0
    d_info->decoder_name = "fuji_14bit_load_raw()";
70
0
  }
71
9.63k
  else if (load_raw == &LibRaw::canon_load_raw)
72
184
  {
73
184
    d_info->decoder_name = "canon_load_raw()";
74
184
  }
75
9.44k
  else if (load_raw == &LibRaw::lossless_jpeg_load_raw)
76
63
  {
77
63
    d_info->decoder_name = "lossless_jpeg_load_raw()";
78
63
    d_info->decoder_flags =
79
63
        LIBRAW_DECODER_HASCURVE | LIBRAW_DECODER_TRYRAWSPEED | LIBRAW_DECODER_TRYRAWSPEED3;
80
63
  }
81
9.38k
  else if (load_raw == &LibRaw::canon_sraw_load_raw)
82
6
  {
83
6
    d_info->decoder_name = "canon_sraw_load_raw()";
84
    //d_info->decoder_flags = LIBRAW_DECODER_TRYRAWSPEED3;
85
6
  }
86
9.38k
  else if (load_raw == &LibRaw::crxLoadRaw)
87
0
  {
88
0
    d_info->decoder_name = "crxLoadRaw()";
89
0
  }
90
9.38k
  else if (load_raw == &LibRaw::lossless_dng_load_raw)
91
9
  {
92
9
    d_info->decoder_name = "lossless_dng_load_raw()";
93
9
    d_info->decoder_flags = LIBRAW_DECODER_HASCURVE |
94
9
                            LIBRAW_DECODER_TRYRAWSPEED | LIBRAW_DECODER_TRYRAWSPEED3 |
95
9
                            LIBRAW_DECODER_ADOBECOPYPIXEL;
96
9
  }
97
9.37k
  else if (load_raw == &LibRaw::packed_dng_load_raw)
98
158
  {
99
158
    d_info->decoder_name = "packed_dng_load_raw()";
100
158
    d_info->decoder_flags = LIBRAW_DECODER_HASCURVE |
101
158
                            LIBRAW_DECODER_TRYRAWSPEED | LIBRAW_DECODER_TRYRAWSPEED3 |
102
158
                            LIBRAW_DECODER_ADOBECOPYPIXEL;
103
158
  }
104
9.21k
  else if (load_raw == &LibRaw::pentax_load_raw)
105
1.34k
  {
106
1.34k
    d_info->decoder_name = "pentax_load_raw()";
107
1.34k
    d_info->decoder_flags = LIBRAW_DECODER_TRYRAWSPEED | LIBRAW_DECODER_TRYRAWSPEED3;
108
1.34k
  }
109
7.86k
  else if (load_raw == &LibRaw::nikon_load_raw)
110
434
  {
111
434
    d_info->decoder_name = "nikon_load_raw()";
112
434
    d_info->decoder_flags =
113
434
        LIBRAW_DECODER_TRYRAWSPEED | LIBRAW_DECODER_HASCURVE | LIBRAW_DECODER_TRYRAWSPEED3;
114
434
  }
115
7.43k
  else if (load_raw == &LibRaw::nikon_coolscan_load_raw)
116
141
  {
117
141
    d_info->decoder_name = "nikon_coolscan_load_raw()";
118
141
    d_info->decoder_flags = LIBRAW_DECODER_FIXEDMAXC;
119
141
  }
120
7.29k
  else if (load_raw == &LibRaw::nikon_he_load_raw_placeholder)
121
0
  {
122
0
    d_info->decoder_name = "nikon_he_load_raw_placeholder()";
123
0
    d_info->decoder_flags = LIBRAW_DECODER_UNSUPPORTED_FORMAT;
124
0
  }
125
7.29k
  else if (load_raw == &LibRaw::nikon_load_sraw)
126
282
  {
127
282
    d_info->decoder_name = "nikon_load_sraw()";
128
282
    d_info->decoder_flags = LIBRAW_DECODER_HASCURVE | LIBRAW_DECODER_FIXEDMAXC;
129
282
  }
130
7.00k
  else if (load_raw == &LibRaw::nikon_yuv_load_raw)
131
0
  {
132
0
    d_info->decoder_name = "nikon_load_yuv_load_raw()";
133
0
    d_info->decoder_flags = LIBRAW_DECODER_HASCURVE | LIBRAW_DECODER_FIXEDMAXC;
134
0
  }
135
7.00k
  else if (load_raw == &LibRaw::rollei_load_raw)
136
129
  {
137
    // UNTESTED
138
129
    d_info->decoder_name = "rollei_load_raw()";
139
129
    d_info->decoder_flags = LIBRAW_DECODER_FIXEDMAXC;
140
129
  }
141
6.87k
  else if (load_raw == &LibRaw::phase_one_load_raw)
142
1
  {
143
1
    d_info->decoder_name = "phase_one_load_raw()";
144
1
  }
145
6.87k
  else if (load_raw == &LibRaw::phase_one_load_raw_c)
146
0
  {
147
0
    d_info->decoder_name = "phase_one_load_raw_c()";
148
0
    d_info->decoder_flags = imgdata.color.phase_one_data.format == 5 ? 0: LIBRAW_DECODER_TRYRAWSPEED3; /* Use only with patched RawSpeed3;  */
149
0
  }
150
6.87k
  else if (load_raw == &LibRaw::phase_one_load_raw_s)
151
0
  {
152
0
    d_info->decoder_name = "phase_one_load_raw_s()";
153
0
  }
154
6.87k
  else if (load_raw == &LibRaw::hasselblad_load_raw)
155
3
  {
156
3
    d_info->decoder_name = "hasselblad_load_raw()";
157
3
    d_info->decoder_flags = LIBRAW_DECODER_TRYRAWSPEED3; /* FIXME: need to make sure correction not applied*/
158
3
  }
159
6.87k
  else if (load_raw == &LibRaw::leaf_hdr_load_raw)
160
330
  {
161
330
    d_info->decoder_name = "leaf_hdr_load_raw()";
162
330
  }
163
6.54k
  else if (load_raw == &LibRaw::unpacked_load_raw)
164
570
  {
165
570
    d_info->decoder_name = "unpacked_load_raw()";
166
570
  d_info->decoder_flags = LIBRAW_DECODER_FLATDATA;
167
570
  }
168
5.97k
  else if (load_raw == &LibRaw::unpacked_load_raw_reversed)
169
0
  {
170
0
    d_info->decoder_name = "unpacked_load_raw_reversed()";
171
0
    d_info->decoder_flags = LIBRAW_DECODER_FIXEDMAXC;
172
0
  }
173
5.97k
  else if (load_raw == &LibRaw::sinar_4shot_load_raw)
174
38
  {
175
    // UNTESTED
176
38
    d_info->decoder_name = "sinar_4shot_load_raw()";
177
38
    d_info->decoder_flags = LIBRAW_DECODER_SINAR4SHOT;
178
38
  }
179
5.93k
  else if (load_raw == &LibRaw::imacon_full_load_raw)
180
18
  {
181
18
    d_info->decoder_name = "imacon_full_load_raw()";
182
18
  }
183
5.91k
  else if (load_raw == &LibRaw::hasselblad_full_load_raw)
184
0
  {
185
0
    d_info->decoder_name = "hasselblad_full_load_raw()";
186
0
  }
187
5.91k
  else if (load_raw == &LibRaw::packed_load_raw)
188
93
  {
189
93
    d_info->decoder_name = "packed_load_raw()";
190
93
    d_info->decoder_flags = LIBRAW_DECODER_TRYRAWSPEED | LIBRAW_DECODER_TRYRAWSPEED3;
191
93
  }
192
5.82k
  else if (load_raw == &LibRaw::broadcom_load_raw)
193
0
  {
194
    // UNTESTED
195
0
    d_info->decoder_name = "broadcom_load_raw()";
196
0
    d_info->decoder_flags = LIBRAW_DECODER_FIXEDMAXC;
197
0
  }
198
5.82k
  else if (load_raw == &LibRaw::nokia_load_raw)
199
871
  {
200
    // UNTESTED
201
871
    d_info->decoder_name = "nokia_load_raw()";
202
871
    d_info->decoder_flags = LIBRAW_DECODER_FIXEDMAXC;
203
871
  }
204
4.95k
  else if (load_raw == &LibRaw::panasonic_load_raw)
205
154
  {
206
154
    d_info->decoder_name = "panasonic_load_raw()";
207
154
    d_info->decoder_flags = LIBRAW_DECODER_TRYRAWSPEED | LIBRAW_DECODER_TRYRAWSPEED3;
208
154
  }
209
4.80k
  else if (load_raw == &LibRaw::panasonicC6_load_raw)
210
0
  {
211
0
    d_info->decoder_name = "panasonicC6_load_raw()";
212
    /* FIXME: No rawspeed3:  not sure it handles 12-bit data too */
213
0
  }
214
4.80k
  else if (load_raw == &LibRaw::panasonicC7_load_raw)
215
0
  {
216
0
    d_info->decoder_name = "panasonicC7_load_raw()";
217
0
  }
218
4.80k
  else if (load_raw == &LibRaw::panasonicC8_load_raw)
219
0
  {
220
0
    d_info->decoder_name = "panasonicC8_load_raw()";
221
0
  }
222
4.80k
  else if (load_raw == &LibRaw::olympus14_load_raw)
223
5
  {
224
5
    d_info->decoder_flags = 0; 
225
5
    d_info->decoder_name = "olympus14_load_raw()";
226
5
  }
227
4.79k
  else if (load_raw == &LibRaw::minolta_rd175_load_raw)
228
0
  {
229
    // UNTESTED
230
0
    d_info->decoder_name = "minolta_rd175_load_raw()";
231
0
  }
232
4.79k
  else if (load_raw == &LibRaw::quicktake_100_load_raw)
233
248
  {
234
    // UNTESTED
235
248
    d_info->decoder_name = "quicktake_100_load_raw()";
236
248
  }
237
4.54k
  else if (load_raw == &LibRaw::kodak_radc_load_raw)
238
191
  {
239
191
    d_info->decoder_name = "kodak_radc_load_raw()";
240
191
  }
241
4.35k
  else if (load_raw == &LibRaw::kodak_jpeg_load_raw)
242
0
  {
243
    // UNTESTED + RBAYER
244
0
    d_info->decoder_name = "kodak_jpeg_load_raw()";
245
0
  }
246
4.35k
  else if (load_raw == &LibRaw::lossy_dng_load_raw)
247
0
  {
248
    // Check rbayer
249
0
    d_info->decoder_name = "lossy_dng_load_raw()";
250
0
    d_info->decoder_flags =
251
0
        LIBRAW_DECODER_TRYRAWSPEED | LIBRAW_DECODER_HASCURVE;
252
0
  }
253
4.35k
  else if (load_raw == &LibRaw::kodak_dc120_load_raw)
254
6
  {
255
6
    d_info->decoder_name = "kodak_dc120_load_raw()";
256
6
  }
257
4.35k
  else if (load_raw == &LibRaw::eight_bit_load_raw)
258
34
  {
259
34
    d_info->decoder_name = "eight_bit_load_raw()";
260
34
    d_info->decoder_flags = LIBRAW_DECODER_HASCURVE | LIBRAW_DECODER_FIXEDMAXC;
261
34
  }
262
4.31k
  else if (load_raw == &LibRaw::kodak_c330_load_raw)
263
46
  {
264
46
    d_info->decoder_name = "kodak_yrgb_load_raw()";
265
46
    d_info->decoder_flags = LIBRAW_DECODER_HASCURVE | LIBRAW_DECODER_FIXEDMAXC;
266
46
  }
267
4.27k
  else if (load_raw == &LibRaw::kodak_c603_load_raw)
268
49
  {
269
49
    d_info->decoder_name = "kodak_yrgb_load_raw()";
270
49
    d_info->decoder_flags = LIBRAW_DECODER_HASCURVE | LIBRAW_DECODER_FIXEDMAXC;
271
49
  }
272
4.22k
  else if (load_raw == &LibRaw::kodak_262_load_raw)
273
931
  {
274
931
    d_info->decoder_name = "kodak_262_load_raw()"; // UNTESTED!
275
931
    d_info->decoder_flags = LIBRAW_DECODER_HASCURVE | LIBRAW_DECODER_FIXEDMAXC;
276
931
  }
277
3.29k
  else if (load_raw == &LibRaw::kodak_65000_load_raw)
278
194
  {
279
194
    d_info->decoder_name = "kodak_65000_load_raw()";
280
194
    d_info->decoder_flags = LIBRAW_DECODER_HASCURVE;
281
194
  }
282
3.09k
  else if (load_raw == &LibRaw::kodak_ycbcr_load_raw)
283
170
  {
284
    // UNTESTED
285
170
    d_info->decoder_name = "kodak_ycbcr_load_raw()";
286
170
    d_info->decoder_flags = LIBRAW_DECODER_HASCURVE | LIBRAW_DECODER_FIXEDMAXC;
287
170
  }
288
2.92k
  else if (load_raw == &LibRaw::kodak_rgb_load_raw)
289
143
  {
290
    // UNTESTED
291
143
    d_info->decoder_name = "kodak_rgb_load_raw()";
292
143
    d_info->decoder_flags = LIBRAW_DECODER_FIXEDMAXC;
293
143
  }
294
2.78k
  else if (load_raw == &LibRaw::sony_load_raw)
295
0
  {
296
0
    d_info->decoder_name = "sony_load_raw()";
297
0
  }
298
2.78k
  else if (load_raw == &LibRaw::sony_ljpeg_load_raw)
299
0
  {
300
0
    d_info->decoder_name = "sony_ljpeg_load_raw()";
301
0
  }
302
2.78k
  else if (load_raw == &LibRaw::sony_ycbcr_load_raw)
303
0
  {
304
0
    d_info->decoder_name = "sony_ycbcr_load_raw()";
305
0
    d_info->decoder_flags = LIBRAW_DECODER_LEGACY_WITH_MARGINS;
306
307
0
  }
308
2.78k
  else if (load_raw == &LibRaw::sony_arw_load_raw)
309
603
  {
310
603
    d_info->decoder_name = "sony_arw_load_raw()";
311
603
    d_info->decoder_flags = LIBRAW_DECODER_TRYRAWSPEED | LIBRAW_DECODER_TRYRAWSPEED3;
312
603
  }
313
2.18k
  else if (load_raw == &LibRaw::sony_arw2_load_raw)
314
150
  {
315
150
    d_info->decoder_name = "sony_arw2_load_raw()";
316
150
    d_info->decoder_flags = LIBRAW_DECODER_HASCURVE |
317
150
                            LIBRAW_DECODER_TRYRAWSPEED | LIBRAW_DECODER_TRYRAWSPEED3 |
318
150
                            LIBRAW_DECODER_SONYARW2;
319
150
  }
320
2.03k
  else if (load_raw == &LibRaw::sony_arq_load_raw)
321
0
  {
322
0
    d_info->decoder_name = "sony_arq_load_raw()";
323
0
    d_info->decoder_flags = LIBRAW_DECODER_LEGACY_WITH_MARGINS | LIBRAW_DECODER_FLATDATA | LIBRAW_DECODER_FLAT_BG2_SWAPPED;
324
0
  }
325
2.03k
  else if (load_raw == &LibRaw::samsung_load_raw)
326
395
  {
327
395
    d_info->decoder_name = "samsung_load_raw()";
328
395
    d_info->decoder_flags = LIBRAW_DECODER_TRYRAWSPEED | LIBRAW_DECODER_TRYRAWSPEED3;
329
395
  }
330
1.63k
  else if (load_raw == &LibRaw::samsung2_load_raw)
331
322
  {
332
322
    d_info->decoder_name = "samsung2_load_raw()";
333
322
  }
334
1.31k
  else if (load_raw == &LibRaw::samsung3_load_raw)
335
200
  {
336
200
    d_info->decoder_name = "samsung3_load_raw()";
337
200
  }
338
1.11k
  else if (load_raw == &LibRaw::smal_v6_load_raw)
339
51
  {
340
    // UNTESTED
341
51
    d_info->decoder_name = "smal_v6_load_raw()";
342
51
    d_info->decoder_flags = LIBRAW_DECODER_FIXEDMAXC;
343
51
  }
344
1.06k
  else if (load_raw == &LibRaw::smal_v9_load_raw)
345
389
  {
346
    // UNTESTED
347
389
    d_info->decoder_name = "smal_v9_load_raw()";
348
389
    d_info->decoder_flags = LIBRAW_DECODER_FIXEDMAXC;
349
389
  }
350
674
  else if (load_raw == &LibRaw::x3f_load_raw)
351
0
  {
352
0
    d_info->decoder_name = "x3f_load_raw()";
353
0
    d_info->decoder_flags = LIBRAW_DECODER_OWNALLOC | LIBRAW_DECODER_FIXEDMAXC |
354
0
                            LIBRAW_DECODER_LEGACY_WITH_MARGINS;
355
0
  }
356
674
  else if (load_raw == &LibRaw::pentax_4shot_load_raw)
357
0
  {
358
0
    d_info->decoder_name = "pentax_4shot_load_raw()";
359
0
    d_info->decoder_flags = LIBRAW_DECODER_OWNALLOC;
360
0
  }
361
674
  else if (load_raw == &LibRaw::deflate_dng_load_raw)
362
26
  {
363
26
    d_info->decoder_name = "deflate_dng_load_raw()";
364
26
    d_info->decoder_flags = LIBRAW_DECODER_OWNALLOC;
365
26
  }
366
648
  else if (load_raw == &LibRaw::uncompressed_fp_dng_load_raw)
367
637
  {
368
637
    d_info->decoder_name = "uncompressed_fp_dng_load_raw()";
369
637
    d_info->decoder_flags = LIBRAW_DECODER_OWNALLOC;
370
637
  }
371
11
  else if (load_raw == &LibRaw::nikon_load_striped_packed_raw)
372
0
  {
373
0
    d_info->decoder_name = "nikon_load_striped_packed_raw()";
374
0
  }
375
11
  else if (load_raw == &LibRaw::nikon_load_padded_packed_raw)
376
3
  {
377
3
    d_info->decoder_name = "nikon_load_padded_packed_raw()";
378
3
  }
379
8
  else if (load_raw == &LibRaw::nikon_14bit_load_raw)
380
0
  {
381
0
    d_info->decoder_name = "nikon_14bit_load_raw()";
382
0
  }
383
  /* -- added 07/02/18 -- */
384
8
  else if (load_raw == &LibRaw::unpacked_load_raw_fuji_f700s20)
385
8
  {
386
8
    d_info->decoder_name = "unpacked_load_raw_fuji_f700s20()";
387
8
  }
388
0
  else if (load_raw == &LibRaw::unpacked_load_raw_FujiDBP)
389
0
  {
390
0
    d_info->decoder_name = "unpacked_load_raw_FujiDBP()";
391
0
  }
392
#ifdef USE_6BY9RPI
393
  else if (load_raw == &LibRaw::rpi_load_raw8)
394
  {
395
  d_info->decoder_name = "rpi_load_raw8";
396
  }
397
  else if (load_raw == &LibRaw::rpi_load_raw12)
398
  {
399
  d_info->decoder_name = "rpi_load_raw12";
400
  }
401
  else if (load_raw == &LibRaw::rpi_load_raw14)
402
  {
403
  d_info->decoder_name = "rpi_load_raw14";
404
  }
405
  else if (load_raw == &LibRaw::rpi_load_raw16)
406
  {
407
  d_info->decoder_name = "rpi_load_raw16";
408
  }
409
#endif
410
0
  else
411
0
  {
412
0
    d_info->decoder_name = "Unknown unpack function";
413
0
    d_info->decoder_flags = LIBRAW_DECODER_NOTSET;
414
0
  }
415
10.4k
  return LIBRAW_SUCCESS;
416
10.4k
}