Coverage Report

Created: 2026-09-28 06:47

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libraw/src/utils/decoder_info.cpp
Line
Count
Source
1
/* -*- C++ -*-
2
 * Copyright 2019-2025 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
16.8k
{
26
16.8k
  if (!d_info)
27
0
    return LIBRAW_UNSPECIFIED_ERROR;
28
16.8k
  d_info->decoder_name = 0;
29
16.8k
  d_info->decoder_flags = 0;
30
16.8k
  if (!load_raw)
31
0
    return LIBRAW_OUT_OF_ORDER_CALL;
32
33
  // dcraw.c names order
34
16.8k
  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
16.8k
  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
16.8k
  else if (load_raw == &LibRaw::vc5_dng_load_raw_placeholder)
45
4
  {
46
4
      d_info->decoder_name = "vc5_dng_load_raw_placeholder()";
47
4
#ifndef USE_GPRSDK
48
4
    d_info->decoder_flags = LIBRAW_DECODER_UNSUPPORTED_FORMAT;
49
4
#endif
50
4
  }
51
16.8k
  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
16.8k
  else if (load_raw == &LibRaw::canon_600_load_raw)
59
8
  {
60
8
    d_info->decoder_name = "canon_600_load_raw()";
61
8
    d_info->decoder_flags = LIBRAW_DECODER_FIXEDMAXC;
62
8
  }
63
16.8k
  else if (load_raw == &LibRaw::fuji_compressed_load_raw)
64
670
  {
65
670
    d_info->decoder_name = "fuji_compressed_load_raw()";
66
670
  }
67
16.1k
  else if (load_raw == &LibRaw::fuji_14bit_load_raw)
68
288
  {
69
288
    d_info->decoder_name = "fuji_14bit_load_raw()";
70
288
  }
71
15.8k
  else if (load_raw == &LibRaw::canon_load_raw)
72
152
  {
73
152
    d_info->decoder_name = "canon_load_raw()";
74
152
  }
75
15.7k
  else if (load_raw == &LibRaw::lossless_jpeg_load_raw)
76
1.53k
  {
77
1.53k
    d_info->decoder_name = "lossless_jpeg_load_raw()";
78
1.53k
    d_info->decoder_flags =
79
1.53k
        LIBRAW_DECODER_HASCURVE | LIBRAW_DECODER_TRYRAWSPEED | LIBRAW_DECODER_TRYRAWSPEED3;
80
1.53k
  }
81
14.1k
  else if (load_raw == &LibRaw::canon_sraw_load_raw)
82
54
  {
83
54
    d_info->decoder_name = "canon_sraw_load_raw()";
84
    //d_info->decoder_flags = LIBRAW_DECODER_TRYRAWSPEED3;
85
54
  }
86
14.1k
  else if (load_raw == &LibRaw::crxLoadRaw)
87
0
  {
88
0
    d_info->decoder_name = "crxLoadRaw()";
89
0
  }
90
14.1k
  else if (load_raw == &LibRaw::lossless_dng_load_raw)
91
39
  {
92
39
    d_info->decoder_name = "lossless_dng_load_raw()";
93
39
    d_info->decoder_flags = LIBRAW_DECODER_HASCURVE |
94
39
                            LIBRAW_DECODER_TRYRAWSPEED | LIBRAW_DECODER_TRYRAWSPEED3 |
95
39
                            LIBRAW_DECODER_ADOBECOPYPIXEL;
96
39
  }
97
14.0k
  else if (load_raw == &LibRaw::packed_dng_load_raw)
98
663
  {
99
663
    d_info->decoder_name = "packed_dng_load_raw()";
100
663
    d_info->decoder_flags = LIBRAW_DECODER_HASCURVE |
101
663
                            LIBRAW_DECODER_TRYRAWSPEED | LIBRAW_DECODER_TRYRAWSPEED3 |
102
663
                            LIBRAW_DECODER_ADOBECOPYPIXEL;
103
663
  }
104
13.4k
  else if (load_raw == &LibRaw::pentax_load_raw)
105
2.92k
  {
106
2.92k
    d_info->decoder_name = "pentax_load_raw()";
107
2.92k
    d_info->decoder_flags = LIBRAW_DECODER_TRYRAWSPEED | LIBRAW_DECODER_TRYRAWSPEED3;
108
2.92k
  }
109
10.5k
  else if (load_raw == &LibRaw::nikon_load_raw)
110
395
  {
111
395
    d_info->decoder_name = "nikon_load_raw()";
112
395
    d_info->decoder_flags =
113
395
        LIBRAW_DECODER_TRYRAWSPEED | LIBRAW_DECODER_HASCURVE | LIBRAW_DECODER_TRYRAWSPEED3;
114
395
  }
115
10.1k
  else if (load_raw == &LibRaw::nikon_coolscan_load_raw)
116
63
  {
117
63
    d_info->decoder_name = "nikon_coolscan_load_raw()";
118
63
    d_info->decoder_flags = LIBRAW_DECODER_FIXEDMAXC;
119
63
  }
120
10.0k
  else if (load_raw == &LibRaw::nikon_he_load_raw)
121
0
  {
122
0
    d_info->decoder_name = "nikon_he_load_raw()";
123
0
    d_info->decoder_flags = LIBRAW_DECODER_UNSUPPORTED_FORMAT;
124
0
  }
125
10.0k
  else if (load_raw == &LibRaw::nikon_load_sraw)
126
186
  {
127
186
    d_info->decoder_name = "nikon_load_sraw()";
128
186
    d_info->decoder_flags = LIBRAW_DECODER_HASCURVE | LIBRAW_DECODER_FIXEDMAXC;
129
186
  }
130
9.86k
  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
9.86k
  else if (load_raw == &LibRaw::rollei_load_raw)
136
228
  {
137
    // UNTESTED
138
228
    d_info->decoder_name = "rollei_load_raw()";
139
228
    d_info->decoder_flags = LIBRAW_DECODER_FIXEDMAXC;
140
228
  }
141
9.63k
  else if (load_raw == &LibRaw::phase_one_load_raw)
142
933
  {
143
933
    d_info->decoder_name = "phase_one_load_raw()";
144
933
  }
145
8.70k
  else if (load_raw == &LibRaw::phase_one_load_raw_c)
146
370
  {
147
370
    d_info->decoder_name = "phase_one_load_raw_c()";
148
370
    d_info->decoder_flags = imgdata.color.phase_one_data.format == 5 ? 0: LIBRAW_DECODER_TRYRAWSPEED3; /* Use only with patched RawSpeed3;  */
149
370
  }
150
8.33k
  else if (load_raw == &LibRaw::phase_one_load_raw_s)
151
459
  {
152
459
    d_info->decoder_name = "phase_one_load_raw_s()";
153
459
  }
154
7.87k
  else if (load_raw == &LibRaw::hasselblad_load_raw)
155
9
  {
156
9
    d_info->decoder_name = "hasselblad_load_raw()";
157
9
    d_info->decoder_flags = LIBRAW_DECODER_TRYRAWSPEED3; /* FIXME: need to make sure correction not applied*/
158
9
  }
159
7.86k
  else if (load_raw == &LibRaw::leaf_hdr_load_raw)
160
222
  {
161
222
    d_info->decoder_name = "leaf_hdr_load_raw()";
162
222
  }
163
7.64k
  else if (load_raw == &LibRaw::unpacked_load_raw)
164
457
  {
165
457
    d_info->decoder_name = "unpacked_load_raw()";
166
457
  d_info->decoder_flags = LIBRAW_DECODER_FLATDATA;
167
457
  }
168
7.18k
  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
7.18k
  else if (load_raw == &LibRaw::sinar_4shot_load_raw)
174
75
  {
175
    // UNTESTED
176
75
    d_info->decoder_name = "sinar_4shot_load_raw()";
177
75
    d_info->decoder_flags = LIBRAW_DECODER_SINAR4SHOT;
178
75
  }
179
7.10k
  else if (load_raw == &LibRaw::imacon_full_load_raw)
180
36
  {
181
36
    d_info->decoder_name = "imacon_full_load_raw()";
182
36
  }
183
7.07k
  else if (load_raw == &LibRaw::hasselblad_full_load_raw)
184
0
  {
185
0
    d_info->decoder_name = "hasselblad_full_load_raw()";
186
0
  }
187
7.07k
  else if (load_raw == &LibRaw::packed_load_raw)
188
265
  {
189
265
    d_info->decoder_name = "packed_load_raw()";
190
265
    d_info->decoder_flags = LIBRAW_DECODER_TRYRAWSPEED | LIBRAW_DECODER_TRYRAWSPEED3;
191
265
  }
192
6.80k
  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
6.80k
  else if (load_raw == &LibRaw::nokia_load_raw)
199
78
  {
200
    // UNTESTED
201
78
    d_info->decoder_name = "nokia_load_raw()";
202
78
    d_info->decoder_flags = LIBRAW_DECODER_FIXEDMAXC;
203
78
  }
204
6.73k
  else if (load_raw == &LibRaw::panasonic_load_raw)
205
478
  {
206
478
    d_info->decoder_name = "panasonic_load_raw()";
207
478
    d_info->decoder_flags = LIBRAW_DECODER_TRYRAWSPEED | LIBRAW_DECODER_TRYRAWSPEED3;
208
478
  }
209
6.25k
  else if (load_raw == &LibRaw::panasonicC6_load_raw)
210
42
  {
211
42
    d_info->decoder_name = "panasonicC6_load_raw()";
212
    /* FIXME: No rawspeed3:  not sure it handles 12-bit data too */
213
42
  }
214
6.21k
  else if (load_raw == &LibRaw::panasonicC7_load_raw)
215
2
  {
216
2
    d_info->decoder_name = "panasonicC7_load_raw()";
217
2
  }
218
6.20k
  else if (load_raw == &LibRaw::panasonicC8_load_raw)
219
0
  {
220
0
    d_info->decoder_name = "panasonicC8_load_raw()";
221
0
  }
222
6.20k
  else if (load_raw == &LibRaw::olympus_load_raw)
223
3
  {
224
3
    d_info->decoder_name = "olympus_load_raw()";
225
3
    d_info->decoder_flags = LIBRAW_DECODER_TRYRAWSPEED | LIBRAW_DECODER_TRYRAWSPEED3;
226
3
  }
227
6.20k
  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
6.20k
  else if (load_raw == &LibRaw::quicktake_100_load_raw)
233
239
  {
234
    // UNTESTED
235
239
    d_info->decoder_name = "quicktake_100_load_raw()";
236
239
  }
237
5.96k
  else if (load_raw == &LibRaw::kodak_radc_load_raw)
238
256
  {
239
256
    d_info->decoder_name = "kodak_radc_load_raw()";
240
256
  }
241
5.71k
  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
5.71k
  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
5.71k
  else if (load_raw == &LibRaw::kodak_dc120_load_raw)
254
7
  {
255
7
    d_info->decoder_name = "kodak_dc120_load_raw()";
256
7
  }
257
5.70k
  else if (load_raw == &LibRaw::eight_bit_load_raw)
258
81
  {
259
81
    d_info->decoder_name = "eight_bit_load_raw()";
260
81
    d_info->decoder_flags = LIBRAW_DECODER_HASCURVE | LIBRAW_DECODER_FIXEDMAXC;
261
81
  }
262
5.62k
  else if (load_raw == &LibRaw::kodak_c330_load_raw)
263
33
  {
264
33
    d_info->decoder_name = "kodak_yrgb_load_raw()";
265
33
    d_info->decoder_flags = LIBRAW_DECODER_HASCURVE | LIBRAW_DECODER_FIXEDMAXC;
266
33
  }
267
5.58k
  else if (load_raw == &LibRaw::kodak_c603_load_raw)
268
30
  {
269
30
    d_info->decoder_name = "kodak_yrgb_load_raw()";
270
30
    d_info->decoder_flags = LIBRAW_DECODER_HASCURVE | LIBRAW_DECODER_FIXEDMAXC;
271
30
  }
272
5.55k
  else if (load_raw == &LibRaw::kodak_262_load_raw)
273
1.78k
  {
274
1.78k
    d_info->decoder_name = "kodak_262_load_raw()"; // UNTESTED!
275
1.78k
    d_info->decoder_flags = LIBRAW_DECODER_HASCURVE | LIBRAW_DECODER_FIXEDMAXC;
276
1.78k
  }
277
3.77k
  else if (load_raw == &LibRaw::kodak_65000_load_raw)
278
185
  {
279
185
    d_info->decoder_name = "kodak_65000_load_raw()";
280
185
    d_info->decoder_flags = LIBRAW_DECODER_HASCURVE;
281
185
  }
282
3.58k
  else if (load_raw == &LibRaw::kodak_ycbcr_load_raw)
283
138
  {
284
    // UNTESTED
285
138
    d_info->decoder_name = "kodak_ycbcr_load_raw()";
286
138
    d_info->decoder_flags = LIBRAW_DECODER_HASCURVE | LIBRAW_DECODER_FIXEDMAXC;
287
138
  }
288
3.44k
  else if (load_raw == &LibRaw::kodak_rgb_load_raw)
289
112
  {
290
    // UNTESTED
291
112
    d_info->decoder_name = "kodak_rgb_load_raw()";
292
112
    d_info->decoder_flags = LIBRAW_DECODER_FIXEDMAXC;
293
112
  }
294
3.33k
  else if (load_raw == &LibRaw::sony_load_raw)
295
0
  {
296
0
    d_info->decoder_name = "sony_load_raw()";
297
0
  }
298
3.33k
  else if (load_raw == &LibRaw::sony_ljpeg_load_raw)
299
21
  {
300
21
    d_info->decoder_name = "sony_ljpeg_load_raw()";
301
21
  }
302
3.31k
  else if (load_raw == &LibRaw::sony_ycbcr_load_raw)
303
3
  {
304
3
    d_info->decoder_name = "sony_ycbcr_load_raw()";
305
3
    d_info->decoder_flags = LIBRAW_DECODER_LEGACY_WITH_MARGINS;
306
307
3
  }
308
3.31k
  else if (load_raw == &LibRaw::sony_arw_load_raw)
309
1.20k
  {
310
1.20k
    d_info->decoder_name = "sony_arw_load_raw()";
311
1.20k
    d_info->decoder_flags = LIBRAW_DECODER_TRYRAWSPEED | LIBRAW_DECODER_TRYRAWSPEED3;
312
1.20k
  }
313
2.10k
  else if (load_raw == &LibRaw::sony_arw2_load_raw)
314
111
  {
315
111
    d_info->decoder_name = "sony_arw2_load_raw()";
316
111
    d_info->decoder_flags = LIBRAW_DECODER_HASCURVE |
317
111
                            LIBRAW_DECODER_TRYRAWSPEED | LIBRAW_DECODER_TRYRAWSPEED3 |
318
111
                            LIBRAW_DECODER_SONYARW2;
319
111
  }
320
1.99k
  else if (load_raw == &LibRaw::sony_arw6_load_raw)
321
0
  {
322
0
    d_info->decoder_name = "sony_arw6_load_raw()";
323
0
    d_info->decoder_flags = LIBRAW_DECODER_HASCURVE | LIBRAW_DECODER_FIXEDMAXC;
324
0
  }
325
1.99k
  else if (load_raw == &LibRaw::sony_arq_load_raw)
326
0
  {
327
0
    d_info->decoder_name = "sony_arq_load_raw()";
328
0
    d_info->decoder_flags = LIBRAW_DECODER_LEGACY_WITH_MARGINS | LIBRAW_DECODER_FLATDATA | LIBRAW_DECODER_FLAT_BG2_SWAPPED;
329
0
  }
330
1.99k
  else if (load_raw == &LibRaw::samsung_load_raw)
331
487
  {
332
487
    d_info->decoder_name = "samsung_load_raw()";
333
487
    d_info->decoder_flags = LIBRAW_DECODER_TRYRAWSPEED | LIBRAW_DECODER_TRYRAWSPEED3;
334
487
  }
335
1.50k
  else if (load_raw == &LibRaw::samsung2_load_raw)
336
217
  {
337
217
    d_info->decoder_name = "samsung2_load_raw()";
338
217
  }
339
1.29k
  else if (load_raw == &LibRaw::samsung3_load_raw)
340
49
  {
341
49
    d_info->decoder_name = "samsung3_load_raw()";
342
49
  }
343
1.24k
  else if (load_raw == &LibRaw::smal_v6_load_raw)
344
42
  {
345
    // UNTESTED
346
42
    d_info->decoder_name = "smal_v6_load_raw()";
347
42
    d_info->decoder_flags = LIBRAW_DECODER_FIXEDMAXC;
348
42
  }
349
1.20k
  else if (load_raw == &LibRaw::smal_v9_load_raw)
350
402
  {
351
    // UNTESTED
352
402
    d_info->decoder_name = "smal_v9_load_raw()";
353
402
    d_info->decoder_flags = LIBRAW_DECODER_FIXEDMAXC;
354
402
  }
355
798
  else if (load_raw == &LibRaw::x3f_load_raw)
356
0
  {
357
0
    d_info->decoder_name = "x3f_load_raw()";
358
0
    d_info->decoder_flags = LIBRAW_DECODER_OWNALLOC | LIBRAW_DECODER_FIXEDMAXC |
359
0
                            LIBRAW_DECODER_LEGACY_WITH_MARGINS;
360
0
  }
361
798
  else if (load_raw == &LibRaw::pentax_4shot_load_raw)
362
0
  {
363
0
    d_info->decoder_name = "pentax_4shot_load_raw()";
364
0
    d_info->decoder_flags = LIBRAW_DECODER_OWNALLOC;
365
0
  }
366
798
  else if (load_raw == &LibRaw::deflate_dng_load_raw)
367
74
  {
368
74
    d_info->decoder_name = "deflate_dng_load_raw()";
369
74
    d_info->decoder_flags = LIBRAW_DECODER_OWNALLOC;
370
74
  }
371
724
  else if (load_raw == &LibRaw::uncompressed_fp_dng_load_raw)
372
712
  {
373
712
    d_info->decoder_name = "uncompressed_fp_dng_load_raw()";
374
712
    d_info->decoder_flags = LIBRAW_DECODER_OWNALLOC;
375
712
  }
376
12
  else if (load_raw == &LibRaw::nikon_load_striped_packed_raw)
377
0
  {
378
0
    d_info->decoder_name = "nikon_load_striped_packed_raw()";
379
0
  }
380
12
  else if (load_raw == &LibRaw::nikon_load_padded_packed_raw)
381
1
  {
382
1
    d_info->decoder_name = "nikon_load_padded_packed_raw()";
383
1
  }
384
11
  else if (load_raw == &LibRaw::nikon_14bit_load_raw)
385
0
  {
386
0
    d_info->decoder_name = "nikon_14bit_load_raw()";
387
0
  }
388
  /* -- added 07/02/18 -- */
389
11
  else if (load_raw == &LibRaw::unpacked_load_raw_fuji_f700s20)
390
11
  {
391
11
    d_info->decoder_name = "unpacked_load_raw_fuji_f700s20()";
392
11
  }
393
0
  else if (load_raw == &LibRaw::unpacked_load_raw_FujiDBP)
394
0
  {
395
0
    d_info->decoder_name = "unpacked_load_raw_FujiDBP()";
396
0
  }
397
#ifdef USE_6BY9RPI
398
  else if (load_raw == &LibRaw::rpi_load_raw8)
399
  {
400
  d_info->decoder_name = "rpi_load_raw8";
401
  }
402
  else if (load_raw == &LibRaw::rpi_load_raw12)
403
  {
404
  d_info->decoder_name = "rpi_load_raw12";
405
  }
406
  else if (load_raw == &LibRaw::rpi_load_raw14)
407
  {
408
  d_info->decoder_name = "rpi_load_raw14";
409
  }
410
  else if (load_raw == &LibRaw::rpi_load_raw16)
411
  {
412
  d_info->decoder_name = "rpi_load_raw16";
413
  }
414
#endif
415
0
  else
416
0
  {
417
0
    d_info->decoder_name = "Unknown unpack function";
418
0
    d_info->decoder_flags = LIBRAW_DECODER_NOTSET;
419
0
  }
420
16.8k
  return LIBRAW_SUCCESS;
421
16.8k
}