File indexing completed on 2025-01-05 03:57:07

0001 /* -*- C++ -*-
0002  * Copyright 2019-2021 LibRaw LLC (info@libraw.org)
0003  *
0004 
0005  LibRaw is free software; you can redistribute it and/or modify
0006  it under the terms of the one of two licenses as you choose:
0007 
0008 1. GNU LESSER GENERAL PUBLIC LICENSE version 2.1
0009    (See file LICENSE.LGPL provided in LibRaw distribution archive for details).
0010 
0011 2. COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
0012    (See file LICENSE.CDDL provided in LibRaw distribution archive for details).
0013 
0014  */
0015 #include "../../internal/libraw_cxx_defs.h"
0016 
0017 const char *LibRaw::unpack_function_name()
0018 {
0019   libraw_decoder_info_t decoder_info;
0020   get_decoder_info(&decoder_info);
0021   return decoder_info.decoder_name;
0022 }
0023 
0024 int LibRaw::get_decoder_info(libraw_decoder_info_t *d_info)
0025 {
0026   if (!d_info)
0027     return LIBRAW_UNSPECIFIED_ERROR;
0028   d_info->decoder_name = 0;
0029   d_info->decoder_flags = 0;
0030   if (!load_raw)
0031     return LIBRAW_OUT_OF_ORDER_CALL;
0032 
0033   // dcraw.c names order
0034   if (load_raw == &LibRaw::android_tight_load_raw)
0035   {
0036     d_info->decoder_name = "android_tight_load_raw()";
0037     d_info->decoder_flags = LIBRAW_DECODER_FIXEDMAXC;
0038   }
0039   else if (load_raw == &LibRaw::android_loose_load_raw)
0040   {
0041     d_info->decoder_name = "android_loose_load_raw()";
0042     d_info->decoder_flags = LIBRAW_DECODER_FIXEDMAXC;
0043   }
0044   else if (load_raw == &LibRaw::vc5_dng_load_raw_placeholder)
0045   {
0046       d_info->decoder_name = "vc5_dng_load_raw_placeholder()";
0047 #ifndef USE_GPRSDK
0048     d_info->decoder_flags = LIBRAW_DECODER_UNSUPPORTED_FORMAT;
0049 #endif
0050   }
0051   else if (load_raw == &LibRaw::canon_600_load_raw)
0052   {
0053     d_info->decoder_name = "canon_600_load_raw()";
0054     d_info->decoder_flags = LIBRAW_DECODER_FIXEDMAXC;
0055   }
0056   else if (load_raw == &LibRaw::fuji_compressed_load_raw)
0057   {
0058     d_info->decoder_name = "fuji_compressed_load_raw()";
0059   }
0060   else if (load_raw == &LibRaw::fuji_14bit_load_raw)
0061   {
0062     d_info->decoder_name = "fuji_14bit_load_raw()";
0063   }
0064   else if (load_raw == &LibRaw::canon_load_raw)
0065   {
0066     d_info->decoder_name = "canon_load_raw()";
0067   }
0068   else if (load_raw == &LibRaw::lossless_jpeg_load_raw)
0069   {
0070     d_info->decoder_name = "lossless_jpeg_load_raw()";
0071     d_info->decoder_flags =
0072         LIBRAW_DECODER_HASCURVE | LIBRAW_DECODER_TRYRAWSPEED | LIBRAW_DECODER_TRYRAWSPEED3;
0073   }
0074   else if (load_raw == &LibRaw::canon_sraw_load_raw)
0075   {
0076     d_info->decoder_name = "canon_sraw_load_raw()";
0077     d_info->decoder_flags = LIBRAW_DECODER_TRYRAWSPEED3;
0078   }
0079   else if (load_raw == &LibRaw::crxLoadRaw)
0080   {
0081     d_info->decoder_name = "crxLoadRaw()";
0082   }
0083   else if (load_raw == &LibRaw::lossless_dng_load_raw)
0084   {
0085     d_info->decoder_name = "lossless_dng_load_raw()";
0086     d_info->decoder_flags = LIBRAW_DECODER_HASCURVE |
0087                             LIBRAW_DECODER_TRYRAWSPEED | LIBRAW_DECODER_TRYRAWSPEED3 |
0088                             LIBRAW_DECODER_ADOBECOPYPIXEL;
0089   }
0090   else if (load_raw == &LibRaw::packed_dng_load_raw)
0091   {
0092     d_info->decoder_name = "packed_dng_load_raw()";
0093     d_info->decoder_flags = LIBRAW_DECODER_HASCURVE |
0094                             LIBRAW_DECODER_TRYRAWSPEED | LIBRAW_DECODER_TRYRAWSPEED3 |
0095                             LIBRAW_DECODER_ADOBECOPYPIXEL;
0096   }
0097   else if (load_raw == &LibRaw::pentax_load_raw)
0098   {
0099     d_info->decoder_name = "pentax_load_raw()";
0100     d_info->decoder_flags = LIBRAW_DECODER_TRYRAWSPEED | LIBRAW_DECODER_TRYRAWSPEED3;
0101   }
0102   else if (load_raw == &LibRaw::nikon_load_raw)
0103   {
0104     d_info->decoder_name = "nikon_load_raw()";
0105     d_info->decoder_flags =
0106         LIBRAW_DECODER_TRYRAWSPEED | LIBRAW_DECODER_HASCURVE | LIBRAW_DECODER_TRYRAWSPEED3;
0107   }
0108   else if (load_raw == &LibRaw::nikon_coolscan_load_raw)
0109   {
0110     d_info->decoder_name = "nikon_coolscan_load_raw()";
0111     d_info->decoder_flags = LIBRAW_DECODER_FIXEDMAXC;
0112   }
0113   else if (load_raw == &LibRaw::nikon_he_load_raw_placeholder)
0114   {
0115     d_info->decoder_name = "nikon_he_load_raw_placeholder()";
0116     d_info->decoder_flags = LIBRAW_DECODER_UNSUPPORTED_FORMAT;
0117   }
0118   else if (load_raw == &LibRaw::nikon_load_sraw)
0119   {
0120     d_info->decoder_name = "nikon_load_sraw()";
0121     d_info->decoder_flags = LIBRAW_DECODER_HASCURVE | LIBRAW_DECODER_FIXEDMAXC;
0122   }
0123   else if (load_raw == &LibRaw::nikon_yuv_load_raw)
0124   {
0125     d_info->decoder_name = "nikon_load_yuv_load_raw()";
0126     d_info->decoder_flags = LIBRAW_DECODER_HASCURVE | LIBRAW_DECODER_FIXEDMAXC;
0127   }
0128   else if (load_raw == &LibRaw::rollei_load_raw)
0129   {
0130     // UNTESTED
0131     d_info->decoder_name = "rollei_load_raw()";
0132     d_info->decoder_flags = LIBRAW_DECODER_FIXEDMAXC;
0133   }
0134   else if (load_raw == &LibRaw::phase_one_load_raw)
0135   {
0136     d_info->decoder_name = "phase_one_load_raw()";
0137   }
0138   else if (load_raw == &LibRaw::phase_one_load_raw_c)
0139   {
0140     d_info->decoder_name = "phase_one_load_raw_c()";
0141     d_info->decoder_flags = LIBRAW_DECODER_TRYRAWSPEED3; /* FIXME: need to make sure correction not applied*/
0142   }
0143   else if (load_raw == &LibRaw::phase_one_load_raw_s)
0144   {
0145     d_info->decoder_name = "phase_one_load_raw_s()";
0146   }
0147   else if (load_raw == &LibRaw::hasselblad_load_raw)
0148   {
0149     d_info->decoder_name = "hasselblad_load_raw()";
0150     d_info->decoder_flags = LIBRAW_DECODER_TRYRAWSPEED3; /* FIXME: need to make sure correction not applied*/
0151   }
0152   else if (load_raw == &LibRaw::leaf_hdr_load_raw)
0153   {
0154     d_info->decoder_name = "leaf_hdr_load_raw()";
0155   }
0156   else if (load_raw == &LibRaw::unpacked_load_raw)
0157   {
0158     d_info->decoder_name = "unpacked_load_raw()";
0159     d_info->decoder_flags = LIBRAW_DECODER_FLATDATA;
0160   }
0161   else if (load_raw == &LibRaw::unpacked_load_raw_reversed)
0162   {
0163     d_info->decoder_name = "unpacked_load_raw_reversed()";
0164     d_info->decoder_flags = LIBRAW_DECODER_FIXEDMAXC;
0165   }
0166   else if (load_raw == &LibRaw::sinar_4shot_load_raw)
0167   {
0168     // UNTESTED
0169     d_info->decoder_name = "sinar_4shot_load_raw()";
0170     d_info->decoder_flags = LIBRAW_DECODER_SINAR4SHOT;
0171   }
0172   else if (load_raw == &LibRaw::imacon_full_load_raw)
0173   {
0174     d_info->decoder_name = "imacon_full_load_raw()";
0175   }
0176   else if (load_raw == &LibRaw::hasselblad_full_load_raw)
0177   {
0178     d_info->decoder_name = "hasselblad_full_load_raw()";
0179   }
0180   else if (load_raw == &LibRaw::packed_load_raw)
0181   {
0182     d_info->decoder_name = "packed_load_raw()";
0183     d_info->decoder_flags = LIBRAW_DECODER_TRYRAWSPEED | LIBRAW_DECODER_TRYRAWSPEED3;
0184   }
0185   else if (load_raw == &LibRaw::broadcom_load_raw)
0186   {
0187     // UNTESTED
0188     d_info->decoder_name = "broadcom_load_raw()";
0189     d_info->decoder_flags = LIBRAW_DECODER_FIXEDMAXC;
0190   }
0191   else if (load_raw == &LibRaw::nokia_load_raw)
0192   {
0193     // UNTESTED
0194     d_info->decoder_name = "nokia_load_raw()";
0195     d_info->decoder_flags = LIBRAW_DECODER_FIXEDMAXC;
0196   }
0197 #ifdef LIBRAW_OLD_VIDEO_SUPPORT
0198   else if (load_raw == &LibRaw::canon_rmf_load_raw)
0199   {
0200     // UNTESTED
0201     d_info->decoder_name = "canon_rmf_load_raw()";
0202   }
0203 #endif
0204   else if (load_raw == &LibRaw::panasonic_load_raw)
0205   {
0206     d_info->decoder_name = "panasonic_load_raw()";
0207     d_info->decoder_flags = LIBRAW_DECODER_TRYRAWSPEED | LIBRAW_DECODER_TRYRAWSPEED;
0208   }
0209   else if (load_raw == &LibRaw::panasonicC6_load_raw)
0210   {
0211     d_info->decoder_name = "panasonicC6_load_raw()";
0212     /* FIXME: No rawspeed3:  not sure it handles 12-bit data too */
0213   }
0214   else if (load_raw == &LibRaw::panasonicC7_load_raw)
0215   {
0216     d_info->decoder_name = "panasonicC7_load_raw()";
0217   }
0218   else if (load_raw == &LibRaw::olympus_load_raw)
0219   {
0220     d_info->decoder_name = "olympus_load_raw()";
0221     d_info->decoder_flags = LIBRAW_DECODER_TRYRAWSPEED | LIBRAW_DECODER_TRYRAWSPEED3;;
0222   }
0223   else if (load_raw == &LibRaw::minolta_rd175_load_raw)
0224   {
0225     // UNTESTED
0226     d_info->decoder_name = "minolta_rd175_load_raw()";
0227   }
0228   else if (load_raw == &LibRaw::quicktake_100_load_raw)
0229   {
0230     // UNTESTED
0231     d_info->decoder_name = "quicktake_100_load_raw()";
0232   }
0233   else if (load_raw == &LibRaw::kodak_radc_load_raw)
0234   {
0235     d_info->decoder_name = "kodak_radc_load_raw()";
0236   }
0237   else if (load_raw == &LibRaw::kodak_jpeg_load_raw)
0238   {
0239     // UNTESTED + RBAYER
0240     d_info->decoder_name = "kodak_jpeg_load_raw()";
0241   }
0242   else if (load_raw == &LibRaw::lossy_dng_load_raw)
0243   {
0244     // Check rbayer
0245     d_info->decoder_name = "lossy_dng_load_raw()";
0246     d_info->decoder_flags =
0247         LIBRAW_DECODER_TRYRAWSPEED | LIBRAW_DECODER_HASCURVE;
0248   }
0249   else if (load_raw == &LibRaw::kodak_dc120_load_raw)
0250   {
0251     d_info->decoder_name = "kodak_dc120_load_raw()";
0252   }
0253   else if (load_raw == &LibRaw::eight_bit_load_raw)
0254   {
0255     d_info->decoder_name = "eight_bit_load_raw()";
0256     d_info->decoder_flags = LIBRAW_DECODER_HASCURVE | LIBRAW_DECODER_FIXEDMAXC;
0257   }
0258   else if (load_raw == &LibRaw::kodak_c330_load_raw)
0259   {
0260     d_info->decoder_name = "kodak_yrgb_load_raw()";
0261     d_info->decoder_flags = LIBRAW_DECODER_HASCURVE | LIBRAW_DECODER_FIXEDMAXC;
0262   }
0263   else if (load_raw == &LibRaw::kodak_c603_load_raw)
0264   {
0265     d_info->decoder_name = "kodak_yrgb_load_raw()";
0266     d_info->decoder_flags = LIBRAW_DECODER_HASCURVE | LIBRAW_DECODER_FIXEDMAXC;
0267   }
0268   else if (load_raw == &LibRaw::kodak_262_load_raw)
0269   {
0270     d_info->decoder_name = "kodak_262_load_raw()"; // UNTESTED!
0271     d_info->decoder_flags = LIBRAW_DECODER_HASCURVE | LIBRAW_DECODER_FIXEDMAXC;
0272   }
0273   else if (load_raw == &LibRaw::kodak_65000_load_raw)
0274   {
0275     d_info->decoder_name = "kodak_65000_load_raw()";
0276     d_info->decoder_flags = LIBRAW_DECODER_HASCURVE;
0277   }
0278   else if (load_raw == &LibRaw::kodak_ycbcr_load_raw)
0279   {
0280     // UNTESTED
0281     d_info->decoder_name = "kodak_ycbcr_load_raw()";
0282     d_info->decoder_flags = LIBRAW_DECODER_HASCURVE | LIBRAW_DECODER_FIXEDMAXC;
0283   }
0284   else if (load_raw == &LibRaw::kodak_rgb_load_raw)
0285   {
0286     // UNTESTED
0287     d_info->decoder_name = "kodak_rgb_load_raw()";
0288     d_info->decoder_flags = LIBRAW_DECODER_FIXEDMAXC;
0289   }
0290   else if (load_raw == &LibRaw::sony_load_raw)
0291   {
0292     d_info->decoder_name = "sony_load_raw()";
0293   }
0294   else if (load_raw == &LibRaw::sony_ljpeg_load_raw)
0295   {
0296     d_info->decoder_name = "sony_ljpeg_load_raw()";
0297   }
0298   else if (load_raw == &LibRaw::sony_arw_load_raw)
0299   {
0300     d_info->decoder_name = "sony_arw_load_raw()";
0301     d_info->decoder_flags = LIBRAW_DECODER_TRYRAWSPEED | LIBRAW_DECODER_TRYRAWSPEED3;
0302   }
0303   else if (load_raw == &LibRaw::sony_arw2_load_raw)
0304   {
0305     d_info->decoder_name = "sony_arw2_load_raw()";
0306     d_info->decoder_flags = LIBRAW_DECODER_HASCURVE |
0307                             LIBRAW_DECODER_TRYRAWSPEED | LIBRAW_DECODER_TRYRAWSPEED3 |
0308                             LIBRAW_DECODER_SONYARW2;
0309   }
0310   else if (load_raw == &LibRaw::sony_arq_load_raw)
0311   {
0312     d_info->decoder_name = "sony_arq_load_raw()";
0313     d_info->decoder_flags = LIBRAW_DECODER_LEGACY_WITH_MARGINS | LIBRAW_DECODER_FLATDATA | LIBRAW_DECODER_FLAT_BG2_SWAPPED;
0314   }
0315   else if (load_raw == &LibRaw::samsung_load_raw)
0316   {
0317     d_info->decoder_name = "samsung_load_raw()";
0318     d_info->decoder_flags = LIBRAW_DECODER_TRYRAWSPEED | LIBRAW_DECODER_TRYRAWSPEED3;
0319   }
0320   else if (load_raw == &LibRaw::samsung2_load_raw)
0321   {
0322     d_info->decoder_name = "samsung2_load_raw()";
0323   }
0324   else if (load_raw == &LibRaw::samsung3_load_raw)
0325   {
0326     d_info->decoder_name = "samsung3_load_raw()";
0327   }
0328   else if (load_raw == &LibRaw::smal_v6_load_raw)
0329   {
0330     // UNTESTED
0331     d_info->decoder_name = "smal_v6_load_raw()";
0332     d_info->decoder_flags = LIBRAW_DECODER_FIXEDMAXC;
0333   }
0334   else if (load_raw == &LibRaw::smal_v9_load_raw)
0335   {
0336     // UNTESTED
0337     d_info->decoder_name = "smal_v9_load_raw()";
0338     d_info->decoder_flags = LIBRAW_DECODER_FIXEDMAXC;
0339   }
0340 #ifdef LIBRAW_OLD_VIDEO_SUPPORT
0341   else if (load_raw == &LibRaw::redcine_load_raw)
0342   {
0343     d_info->decoder_name = "redcine_load_raw()";
0344     d_info->decoder_flags = LIBRAW_DECODER_HASCURVE;
0345   }
0346 #endif
0347   else if (load_raw == &LibRaw::x3f_load_raw)
0348   {
0349     d_info->decoder_name = "x3f_load_raw()";
0350     d_info->decoder_flags = LIBRAW_DECODER_OWNALLOC | LIBRAW_DECODER_FIXEDMAXC |
0351                             LIBRAW_DECODER_LEGACY_WITH_MARGINS;
0352   }
0353   else if (load_raw == &LibRaw::pentax_4shot_load_raw)
0354   {
0355     d_info->decoder_name = "pentax_4shot_load_raw()";
0356     d_info->decoder_flags = LIBRAW_DECODER_OWNALLOC;
0357   }
0358   else if (load_raw == &LibRaw::deflate_dng_load_raw)
0359   {
0360     d_info->decoder_name = "deflate_dng_load_raw()";
0361     d_info->decoder_flags = LIBRAW_DECODER_OWNALLOC;
0362   }
0363   else if (load_raw == &LibRaw::uncompressed_fp_dng_load_raw)
0364   {
0365     d_info->decoder_name = "uncompressed_fp_dng_load_raw()";
0366     d_info->decoder_flags = LIBRAW_DECODER_OWNALLOC;
0367   }
0368   else if (load_raw == &LibRaw::nikon_load_striped_packed_raw)
0369   {
0370     d_info->decoder_name = "nikon_load_striped_packed_raw()";
0371   }
0372   else if (load_raw == &LibRaw::nikon_load_padded_packed_raw)
0373   {
0374     d_info->decoder_name = "nikon_load_padded_packed_raw()";
0375   }
0376   else if (load_raw == &LibRaw::nikon_14bit_load_raw)
0377   {
0378     d_info->decoder_name = "nikon_14bit_load_raw()";
0379   }
0380   /* -- added 07/02/18 -- */
0381   else if (load_raw == &LibRaw::unpacked_load_raw_fuji_f700s20)
0382   {
0383     d_info->decoder_name = "unpacked_load_raw_fuji_f700s20()";
0384   }
0385   else if (load_raw == &LibRaw::unpacked_load_raw_FujiDBP)
0386   {
0387     d_info->decoder_name = "unpacked_load_raw_FujiDBP()";
0388   }
0389 #ifdef USE_6BY9RPI
0390   else if (load_raw == &LibRaw::rpi_load_raw8)
0391   {
0392     d_info->decoder_name = "rpi_load_raw8";
0393   }
0394   else if (load_raw == &LibRaw::rpi_load_raw12)
0395   {
0396     d_info->decoder_name = "rpi_load_raw12";
0397   }
0398   else if (load_raw == &LibRaw::rpi_load_raw14)
0399   {
0400     d_info->decoder_name = "rpi_load_raw14";
0401   }
0402   else if (load_raw == &LibRaw::rpi_load_raw16)
0403   {
0404     d_info->decoder_name = "rpi_load_raw16";
0405   }
0406 #endif
0407   else
0408   {
0409     d_info->decoder_name = "Unknown unpack function";
0410     d_info->decoder_flags = LIBRAW_DECODER_NOTSET;
0411   }
0412   return LIBRAW_SUCCESS;
0413 }