rfreeimage 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +1 -0
- data/Rakefile +34 -0
- data/ext/rfreeimage/extconf.rb +35 -0
- data/ext/rfreeimage/rfi_main.c +389 -0
- data/lib/rfreeimage/image.rb +26 -0
- data/lib/rfreeimage/version.rb +3 -0
- data/lib/rfreeimage.rb +3 -0
- data/rfreeimage.gemspec +32 -0
- data/vendor/FreeImage/Makefile +34 -0
- data/vendor/FreeImage/Makefile.cygwin +74 -0
- data/vendor/FreeImage/Makefile.fip +84 -0
- data/vendor/FreeImage/Makefile.gnu +83 -0
- data/vendor/FreeImage/Makefile.iphone +96 -0
- data/vendor/FreeImage/Makefile.mingw +136 -0
- data/vendor/FreeImage/Makefile.osx +115 -0
- data/vendor/FreeImage/Makefile.solaris +66 -0
- data/vendor/FreeImage/Makefile.srcs +6 -0
- data/vendor/FreeImage/README.iphone +19 -0
- data/vendor/FreeImage/README.linux +50 -0
- data/vendor/FreeImage/README.minGW +236 -0
- data/vendor/FreeImage/README.osx +44 -0
- data/vendor/FreeImage/README.solaris +67 -0
- data/vendor/FreeImage/Source/CacheFile.h +92 -0
- data/vendor/FreeImage/Source/DeprecationManager/Deprecated.cpp +36 -0
- data/vendor/FreeImage/Source/DeprecationManager/DeprecationMgr.cpp +103 -0
- data/vendor/FreeImage/Source/DeprecationManager/DeprecationMgr.h +83 -0
- data/vendor/FreeImage/Source/FreeImage/BitmapAccess.cpp +1573 -0
- data/vendor/FreeImage/Source/FreeImage/CacheFile.cpp +271 -0
- data/vendor/FreeImage/Source/FreeImage/ColorLookup.cpp +785 -0
- data/vendor/FreeImage/Source/FreeImage/Conversion.cpp +551 -0
- data/vendor/FreeImage/Source/FreeImage/Conversion16_555.cpp +209 -0
- data/vendor/FreeImage/Source/FreeImage/Conversion16_565.cpp +204 -0
- data/vendor/FreeImage/Source/FreeImage/Conversion24.cpp +252 -0
- data/vendor/FreeImage/Source/FreeImage/Conversion32.cpp +345 -0
- data/vendor/FreeImage/Source/FreeImage/Conversion4.cpp +246 -0
- data/vendor/FreeImage/Source/FreeImage/Conversion8.cpp +305 -0
- data/vendor/FreeImage/Source/FreeImage/ConversionFloat.cpp +194 -0
- data/vendor/FreeImage/Source/FreeImage/ConversionRGB16.cpp +144 -0
- data/vendor/FreeImage/Source/FreeImage/ConversionRGBA16.cpp +147 -0
- data/vendor/FreeImage/Source/FreeImage/ConversionRGBAF.cpp +250 -0
- data/vendor/FreeImage/Source/FreeImage/ConversionRGBF.cpp +243 -0
- data/vendor/FreeImage/Source/FreeImage/ConversionType.cpp +699 -0
- data/vendor/FreeImage/Source/FreeImage/ConversionUINT16.cpp +134 -0
- data/vendor/FreeImage/Source/FreeImage/FreeImage.cpp +226 -0
- data/vendor/FreeImage/Source/FreeImage/FreeImageC.c +22 -0
- data/vendor/FreeImage/Source/FreeImage/FreeImageIO.cpp +175 -0
- data/vendor/FreeImage/Source/FreeImage/GetType.cpp +92 -0
- data/vendor/FreeImage/Source/FreeImage/Halftoning.cpp +474 -0
- data/vendor/FreeImage/Source/FreeImage/J2KHelper.cpp +591 -0
- data/vendor/FreeImage/Source/FreeImage/J2KHelper.h +36 -0
- data/vendor/FreeImage/Source/FreeImage/LFPQuantizer.cpp +208 -0
- data/vendor/FreeImage/Source/FreeImage/MNGHelper.cpp +1320 -0
- data/vendor/FreeImage/Source/FreeImage/MemoryIO.cpp +237 -0
- data/vendor/FreeImage/Source/FreeImage/MultiPage.cpp +974 -0
- data/vendor/FreeImage/Source/FreeImage/NNQuantizer.cpp +507 -0
- data/vendor/FreeImage/Source/FreeImage/PSDParser.cpp +1057 -0
- data/vendor/FreeImage/Source/FreeImage/PSDParser.h +271 -0
- data/vendor/FreeImage/Source/FreeImage/PixelAccess.cpp +197 -0
- data/vendor/FreeImage/Source/FreeImage/Plugin.cpp +822 -0
- data/vendor/FreeImage/Source/FreeImage/PluginBMP.cpp +1494 -0
- data/vendor/FreeImage/Source/FreeImage/PluginCUT.cpp +240 -0
- data/vendor/FreeImage/Source/FreeImage/PluginDDS.cpp +655 -0
- data/vendor/FreeImage/Source/FreeImage/PluginEXR.cpp +773 -0
- data/vendor/FreeImage/Source/FreeImage/PluginG3.cpp +433 -0
- data/vendor/FreeImage/Source/FreeImage/PluginGIF.cpp +1407 -0
- data/vendor/FreeImage/Source/FreeImage/PluginHDR.cpp +722 -0
- data/vendor/FreeImage/Source/FreeImage/PluginICO.cpp +824 -0
- data/vendor/FreeImage/Source/FreeImage/PluginIFF.cpp +459 -0
- data/vendor/FreeImage/Source/FreeImage/PluginJ2K.cpp +328 -0
- data/vendor/FreeImage/Source/FreeImage/PluginJNG.cpp +162 -0
- data/vendor/FreeImage/Source/FreeImage/PluginJP2.cpp +328 -0
- data/vendor/FreeImage/Source/FreeImage/PluginJPEG.cpp +1706 -0
- data/vendor/FreeImage/Source/FreeImage/PluginJXR.cpp +1475 -0
- data/vendor/FreeImage/Source/FreeImage/PluginKOALA.cpp +243 -0
- data/vendor/FreeImage/Source/FreeImage/PluginMNG.cpp +153 -0
- data/vendor/FreeImage/Source/FreeImage/PluginPCD.cpp +251 -0
- data/vendor/FreeImage/Source/FreeImage/PluginPCX.cpp +659 -0
- data/vendor/FreeImage/Source/FreeImage/PluginPFM.cpp +409 -0
- data/vendor/FreeImage/Source/FreeImage/PluginPICT.cpp +1343 -0
- data/vendor/FreeImage/Source/FreeImage/PluginPNG.cpp +1115 -0
- data/vendor/FreeImage/Source/FreeImage/PluginPNM.cpp +838 -0
- data/vendor/FreeImage/Source/FreeImage/PluginPSD.cpp +131 -0
- data/vendor/FreeImage/Source/FreeImage/PluginRAS.cpp +512 -0
- data/vendor/FreeImage/Source/FreeImage/PluginRAW.cpp +793 -0
- data/vendor/FreeImage/Source/FreeImage/PluginSGI.cpp +425 -0
- data/vendor/FreeImage/Source/FreeImage/PluginTARGA.cpp +1591 -0
- data/vendor/FreeImage/Source/FreeImage/PluginTIFF.cpp +2631 -0
- data/vendor/FreeImage/Source/FreeImage/PluginWBMP.cpp +372 -0
- data/vendor/FreeImage/Source/FreeImage/PluginWebP.cpp +698 -0
- data/vendor/FreeImage/Source/FreeImage/PluginXBM.cpp +399 -0
- data/vendor/FreeImage/Source/FreeImage/PluginXPM.cpp +487 -0
- data/vendor/FreeImage/Source/FreeImage/TIFFLogLuv.cpp +65 -0
- data/vendor/FreeImage/Source/FreeImage/ToneMapping.cpp +75 -0
- data/vendor/FreeImage/Source/FreeImage/WuQuantizer.cpp +559 -0
- data/vendor/FreeImage/Source/FreeImage/ZLibInterface.cpp +223 -0
- data/vendor/FreeImage/Source/FreeImage/tmoColorConvert.cpp +479 -0
- data/vendor/FreeImage/Source/FreeImage/tmoDrago03.cpp +295 -0
- data/vendor/FreeImage/Source/FreeImage/tmoFattal02.cpp +689 -0
- data/vendor/FreeImage/Source/FreeImage/tmoReinhard05.cpp +260 -0
- data/vendor/FreeImage/Source/FreeImage.h +1153 -0
- data/vendor/FreeImage/Source/FreeImageIO.h +63 -0
- data/vendor/FreeImage/Source/FreeImageToolkit/BSplineRotate.cpp +730 -0
- data/vendor/FreeImage/Source/FreeImageToolkit/Background.cpp +895 -0
- data/vendor/FreeImage/Source/FreeImageToolkit/Channels.cpp +488 -0
- data/vendor/FreeImage/Source/FreeImageToolkit/ClassicRotate.cpp +917 -0
- data/vendor/FreeImage/Source/FreeImageToolkit/Colors.cpp +967 -0
- data/vendor/FreeImage/Source/FreeImageToolkit/CopyPaste.cpp +861 -0
- data/vendor/FreeImage/Source/FreeImageToolkit/Display.cpp +230 -0
- data/vendor/FreeImage/Source/FreeImageToolkit/Filters.h +287 -0
- data/vendor/FreeImage/Source/FreeImageToolkit/Flip.cpp +166 -0
- data/vendor/FreeImage/Source/FreeImageToolkit/JPEGTransform.cpp +623 -0
- data/vendor/FreeImage/Source/FreeImageToolkit/MultigridPoissonSolver.cpp +505 -0
- data/vendor/FreeImage/Source/FreeImageToolkit/Rescale.cpp +192 -0
- data/vendor/FreeImage/Source/FreeImageToolkit/Resize.cpp +2116 -0
- data/vendor/FreeImage/Source/FreeImageToolkit/Resize.h +196 -0
- data/vendor/FreeImage/Source/LibJPEG/ansi2knr.c +739 -0
- data/vendor/FreeImage/Source/LibJPEG/cderror.h +134 -0
- data/vendor/FreeImage/Source/LibJPEG/cdjpeg.c +181 -0
- data/vendor/FreeImage/Source/LibJPEG/cdjpeg.h +187 -0
- data/vendor/FreeImage/Source/LibJPEG/cjpeg.c +664 -0
- data/vendor/FreeImage/Source/LibJPEG/ckconfig.c +402 -0
- data/vendor/FreeImage/Source/LibJPEG/djpeg.c +617 -0
- data/vendor/FreeImage/Source/LibJPEG/example.c +433 -0
- data/vendor/FreeImage/Source/LibJPEG/jaricom.c +153 -0
- data/vendor/FreeImage/Source/LibJPEG/jcapimin.c +288 -0
- data/vendor/FreeImage/Source/LibJPEG/jcapistd.c +162 -0
- data/vendor/FreeImage/Source/LibJPEG/jcarith.c +944 -0
- data/vendor/FreeImage/Source/LibJPEG/jccoefct.c +454 -0
- data/vendor/FreeImage/Source/LibJPEG/jccolor.c +604 -0
- data/vendor/FreeImage/Source/LibJPEG/jcdctmgr.c +477 -0
- data/vendor/FreeImage/Source/LibJPEG/jchuff.c +1573 -0
- data/vendor/FreeImage/Source/LibJPEG/jcinit.c +84 -0
- data/vendor/FreeImage/Source/LibJPEG/jcmainct.c +297 -0
- data/vendor/FreeImage/Source/LibJPEG/jcmarker.c +719 -0
- data/vendor/FreeImage/Source/LibJPEG/jcmaster.c +856 -0
- data/vendor/FreeImage/Source/LibJPEG/jcomapi.c +106 -0
- data/vendor/FreeImage/Source/LibJPEG/jconfig.h +161 -0
- data/vendor/FreeImage/Source/LibJPEG/jcparam.c +675 -0
- data/vendor/FreeImage/Source/LibJPEG/jcprepct.c +358 -0
- data/vendor/FreeImage/Source/LibJPEG/jcsample.c +545 -0
- data/vendor/FreeImage/Source/LibJPEG/jctrans.c +385 -0
- data/vendor/FreeImage/Source/LibJPEG/jdapimin.c +399 -0
- data/vendor/FreeImage/Source/LibJPEG/jdapistd.c +276 -0
- data/vendor/FreeImage/Source/LibJPEG/jdarith.c +796 -0
- data/vendor/FreeImage/Source/LibJPEG/jdatadst.c +270 -0
- data/vendor/FreeImage/Source/LibJPEG/jdatasrc.c +275 -0
- data/vendor/FreeImage/Source/LibJPEG/jdcoefct.c +741 -0
- data/vendor/FreeImage/Source/LibJPEG/jdcolor.c +748 -0
- data/vendor/FreeImage/Source/LibJPEG/jdct.h +393 -0
- data/vendor/FreeImage/Source/LibJPEG/jddctmgr.c +384 -0
- data/vendor/FreeImage/Source/LibJPEG/jdhuff.c +1554 -0
- data/vendor/FreeImage/Source/LibJPEG/jdinput.c +662 -0
- data/vendor/FreeImage/Source/LibJPEG/jdmainct.c +513 -0
- data/vendor/FreeImage/Source/LibJPEG/jdmarker.c +1511 -0
- data/vendor/FreeImage/Source/LibJPEG/jdmaster.c +543 -0
- data/vendor/FreeImage/Source/LibJPEG/jdmerge.c +401 -0
- data/vendor/FreeImage/Source/LibJPEG/jdpostct.c +290 -0
- data/vendor/FreeImage/Source/LibJPEG/jdsample.c +361 -0
- data/vendor/FreeImage/Source/LibJPEG/jdtrans.c +140 -0
- data/vendor/FreeImage/Source/LibJPEG/jerror.c +253 -0
- data/vendor/FreeImage/Source/LibJPEG/jerror.h +304 -0
- data/vendor/FreeImage/Source/LibJPEG/jfdctflt.c +174 -0
- data/vendor/FreeImage/Source/LibJPEG/jfdctfst.c +230 -0
- data/vendor/FreeImage/Source/LibJPEG/jfdctint.c +4406 -0
- data/vendor/FreeImage/Source/LibJPEG/jidctflt.c +235 -0
- data/vendor/FreeImage/Source/LibJPEG/jidctfst.c +368 -0
- data/vendor/FreeImage/Source/LibJPEG/jidctint.c +5179 -0
- data/vendor/FreeImage/Source/LibJPEG/jinclude.h +91 -0
- data/vendor/FreeImage/Source/LibJPEG/jmemansi.c +167 -0
- data/vendor/FreeImage/Source/LibJPEG/jmemdos.c +638 -0
- data/vendor/FreeImage/Source/LibJPEG/jmemmac.c +289 -0
- data/vendor/FreeImage/Source/LibJPEG/jmemmgr.c +1119 -0
- data/vendor/FreeImage/Source/LibJPEG/jmemname.c +276 -0
- data/vendor/FreeImage/Source/LibJPEG/jmemnobs.c +109 -0
- data/vendor/FreeImage/Source/LibJPEG/jmemsys.h +198 -0
- data/vendor/FreeImage/Source/LibJPEG/jmorecfg.h +442 -0
- data/vendor/FreeImage/Source/LibJPEG/jpegint.h +426 -0
- data/vendor/FreeImage/Source/LibJPEG/jpeglib.h +1180 -0
- data/vendor/FreeImage/Source/LibJPEG/jpegtran.c +577 -0
- data/vendor/FreeImage/Source/LibJPEG/jquant1.c +857 -0
- data/vendor/FreeImage/Source/LibJPEG/jquant2.c +1311 -0
- data/vendor/FreeImage/Source/LibJPEG/jutils.c +227 -0
- data/vendor/FreeImage/Source/LibJPEG/jversion.h +14 -0
- data/vendor/FreeImage/Source/LibJPEG/rdbmp.c +480 -0
- data/vendor/FreeImage/Source/LibJPEG/rdcolmap.c +253 -0
- data/vendor/FreeImage/Source/LibJPEG/rdgif.c +38 -0
- data/vendor/FreeImage/Source/LibJPEG/rdjpgcom.c +515 -0
- data/vendor/FreeImage/Source/LibJPEG/rdppm.c +459 -0
- data/vendor/FreeImage/Source/LibJPEG/rdrle.c +387 -0
- data/vendor/FreeImage/Source/LibJPEG/rdswitch.c +365 -0
- data/vendor/FreeImage/Source/LibJPEG/rdtarga.c +500 -0
- data/vendor/FreeImage/Source/LibJPEG/transupp.c +1763 -0
- data/vendor/FreeImage/Source/LibJPEG/transupp.h +219 -0
- data/vendor/FreeImage/Source/LibJPEG/wrbmp.c +442 -0
- data/vendor/FreeImage/Source/LibJPEG/wrgif.c +399 -0
- data/vendor/FreeImage/Source/LibJPEG/wrjpgcom.c +583 -0
- data/vendor/FreeImage/Source/LibJPEG/wrppm.c +269 -0
- data/vendor/FreeImage/Source/LibJPEG/wrrle.c +305 -0
- data/vendor/FreeImage/Source/LibJPEG/wrtarga.c +253 -0
- data/vendor/FreeImage/Source/LibJXR/common/include/guiddef.h +230 -0
- data/vendor/FreeImage/Source/LibJXR/common/include/wmsal.h +757 -0
- data/vendor/FreeImage/Source/LibJXR/common/include/wmspecstring.h +342 -0
- data/vendor/FreeImage/Source/LibJXR/common/include/wmspecstrings_adt.h +71 -0
- data/vendor/FreeImage/Source/LibJXR/common/include/wmspecstrings_strict.h +1096 -0
- data/vendor/FreeImage/Source/LibJXR/common/include/wmspecstrings_undef.h +406 -0
- data/vendor/FreeImage/Source/LibJXR/image/decode/JXRTranscode.c +987 -0
- data/vendor/FreeImage/Source/LibJXR/image/decode/decode.c +200 -0
- data/vendor/FreeImage/Source/LibJXR/image/decode/decode.h +143 -0
- data/vendor/FreeImage/Source/LibJXR/image/decode/postprocess.c +288 -0
- data/vendor/FreeImage/Source/LibJXR/image/decode/segdec.c +1205 -0
- data/vendor/FreeImage/Source/LibJXR/image/decode/strInvTransform.c +1888 -0
- data/vendor/FreeImage/Source/LibJXR/image/decode/strPredQuantDec.c +539 -0
- data/vendor/FreeImage/Source/LibJXR/image/decode/strdec.c +3628 -0
- data/vendor/FreeImage/Source/LibJXR/image/decode/strdec_x86.c +1640 -0
- data/vendor/FreeImage/Source/LibJXR/image/encode/encode.c +144 -0
- data/vendor/FreeImage/Source/LibJXR/image/encode/encode.h +113 -0
- data/vendor/FreeImage/Source/LibJXR/image/encode/segenc.c +1186 -0
- data/vendor/FreeImage/Source/LibJXR/image/encode/strFwdTransform.c +1111 -0
- data/vendor/FreeImage/Source/LibJXR/image/encode/strPredQuantEnc.c +511 -0
- data/vendor/FreeImage/Source/LibJXR/image/encode/strenc.c +2370 -0
- data/vendor/FreeImage/Source/LibJXR/image/encode/strenc_x86.c +409 -0
- data/vendor/FreeImage/Source/LibJXR/image/sys/adapthuff.c +511 -0
- data/vendor/FreeImage/Source/LibJXR/image/sys/ansi.h +61 -0
- data/vendor/FreeImage/Source/LibJXR/image/sys/common.h +131 -0
- data/vendor/FreeImage/Source/LibJXR/image/sys/image.c +183 -0
- data/vendor/FreeImage/Source/LibJXR/image/sys/perfTimer.h +115 -0
- data/vendor/FreeImage/Source/LibJXR/image/sys/perfTimerANSI.c +274 -0
- data/vendor/FreeImage/Source/LibJXR/image/sys/strPredQuant.c +306 -0
- data/vendor/FreeImage/Source/LibJXR/image/sys/strTransform.c +85 -0
- data/vendor/FreeImage/Source/LibJXR/image/sys/strTransform.h +50 -0
- data/vendor/FreeImage/Source/LibJXR/image/sys/strcodec.c +1251 -0
- data/vendor/FreeImage/Source/LibJXR/image/sys/strcodec.h +681 -0
- data/vendor/FreeImage/Source/LibJXR/image/sys/windowsmediaphoto.h +515 -0
- data/vendor/FreeImage/Source/LibJXR/image/sys/xplatform_image.h +84 -0
- data/vendor/FreeImage/Source/LibJXR/image/x86/x86.h +58 -0
- data/vendor/FreeImage/Source/LibJXR/jxrgluelib/JXRGlue.c +930 -0
- data/vendor/FreeImage/Source/LibJXR/jxrgluelib/JXRGlue.h +636 -0
- data/vendor/FreeImage/Source/LibJXR/jxrgluelib/JXRGlueJxr.c +2246 -0
- data/vendor/FreeImage/Source/LibJXR/jxrgluelib/JXRGluePFC.c +2338 -0
- data/vendor/FreeImage/Source/LibJXR/jxrgluelib/JXRMeta.c +905 -0
- data/vendor/FreeImage/Source/LibJXR/jxrgluelib/JXRMeta.h +258 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/bio.c +188 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/bio.h +128 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/cidx_manager.c +239 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/cidx_manager.h +68 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/cio.c +644 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/cio.h +393 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/dwt.c +919 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/dwt.h +116 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/event.c +141 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/event.h +97 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/function_list.c +114 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/function_list.h +126 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/image.c +235 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/image.h +63 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/indexbox_manager.h +148 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/invert.c +289 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/invert.h +59 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/j2k.c +10238 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/j2k.h +838 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/jp2.c +2776 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/jp2.h +490 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/mct.c +319 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/mct.h +149 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/mqc.c +604 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/mqc.h +201 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/openjpeg.c +955 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/openjpeg.h +1475 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/opj_clock.c +59 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/opj_clock.h +54 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/opj_codec.h +160 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/opj_config.h +9 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/opj_config_private.h +16 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/opj_includes.h +175 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/opj_intmath.h +172 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/opj_inttypes.h +43 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/opj_malloc.h +180 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/opj_stdint.h +47 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/phix_manager.c +191 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/pi.c +1870 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/pi.h +182 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/ppix_manager.c +194 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/raw.c +89 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/raw.h +100 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/t1.c +1751 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/t1.h +157 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/t1_generate_luts.c +276 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/t1_luts.h +143 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/t2.c +1334 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/t2.h +127 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/tcd.c +2123 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/tcd.h +348 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/tgt.c +331 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/tgt.h +140 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/thix_manager.c +134 -0
- data/vendor/FreeImage/Source/LibOpenJPEG/tpix_manager.c +185 -0
- data/vendor/FreeImage/Source/LibPNG/example.c +1061 -0
- data/vendor/FreeImage/Source/LibPNG/png.c +4493 -0
- data/vendor/FreeImage/Source/LibPNG/png.h +3282 -0
- data/vendor/FreeImage/Source/LibPNG/pngconf.h +644 -0
- data/vendor/FreeImage/Source/LibPNG/pngdebug.h +154 -0
- data/vendor/FreeImage/Source/LibPNG/pngerror.c +963 -0
- data/vendor/FreeImage/Source/LibPNG/pngget.c +1213 -0
- data/vendor/FreeImage/Source/LibPNG/pnginfo.h +260 -0
- data/vendor/FreeImage/Source/LibPNG/pnglibconf.h +218 -0
- data/vendor/FreeImage/Source/LibPNG/pngmem.c +281 -0
- data/vendor/FreeImage/Source/LibPNG/pngpread.c +1168 -0
- data/vendor/FreeImage/Source/LibPNG/pngpriv.h +1944 -0
- data/vendor/FreeImage/Source/LibPNG/pngread.c +4121 -0
- data/vendor/FreeImage/Source/LibPNG/pngrio.c +120 -0
- data/vendor/FreeImage/Source/LibPNG/pngrtran.c +4994 -0
- data/vendor/FreeImage/Source/LibPNG/pngrutil.c +4474 -0
- data/vendor/FreeImage/Source/LibPNG/pngset.c +1611 -0
- data/vendor/FreeImage/Source/LibPNG/pngstruct.h +489 -0
- data/vendor/FreeImage/Source/LibPNG/pngtest.c +2011 -0
- data/vendor/FreeImage/Source/LibPNG/pngtrans.c +849 -0
- data/vendor/FreeImage/Source/LibPNG/pngwio.c +168 -0
- data/vendor/FreeImage/Source/LibPNG/pngwrite.c +2455 -0
- data/vendor/FreeImage/Source/LibPNG/pngwtran.c +574 -0
- data/vendor/FreeImage/Source/LibPNG/pngwutil.c +3029 -0
- data/vendor/FreeImage/Source/LibRawLite/dcraw/dcraw.c +15462 -0
- data/vendor/FreeImage/Source/LibRawLite/internal/aahd_demosaic.cpp +706 -0
- data/vendor/FreeImage/Source/LibRawLite/internal/dcb_demosaicing.c +710 -0
- data/vendor/FreeImage/Source/LibRawLite/internal/dcraw_common.cpp +13593 -0
- data/vendor/FreeImage/Source/LibRawLite/internal/dcraw_fileio.cpp +240 -0
- data/vendor/FreeImage/Source/LibRawLite/internal/defines.h +167 -0
- data/vendor/FreeImage/Source/LibRawLite/internal/demosaic_packs.cpp +99 -0
- data/vendor/FreeImage/Source/LibRawLite/internal/dht_demosaic.cpp +873 -0
- data/vendor/FreeImage/Source/LibRawLite/internal/libraw_internal_funcs.h +282 -0
- data/vendor/FreeImage/Source/LibRawLite/internal/libraw_x3f.cpp +1919 -0
- data/vendor/FreeImage/Source/LibRawLite/internal/var_defines.h +216 -0
- data/vendor/FreeImage/Source/LibRawLite/internal/wf_filtering.cpp +1950 -0
- data/vendor/FreeImage/Source/LibRawLite/libraw/libraw.h +338 -0
- data/vendor/FreeImage/Source/LibRawLite/libraw/libraw_alloc.h +99 -0
- data/vendor/FreeImage/Source/LibRawLite/libraw/libraw_const.h +233 -0
- data/vendor/FreeImage/Source/LibRawLite/libraw/libraw_datastream.h +238 -0
- data/vendor/FreeImage/Source/LibRawLite/libraw/libraw_internal.h +225 -0
- data/vendor/FreeImage/Source/LibRawLite/libraw/libraw_types.h +442 -0
- data/vendor/FreeImage/Source/LibRawLite/libraw/libraw_version.h +62 -0
- data/vendor/FreeImage/Source/LibRawLite/src/libraw_c_api.cpp +230 -0
- data/vendor/FreeImage/Source/LibRawLite/src/libraw_cxx.cpp +4533 -0
- data/vendor/FreeImage/Source/LibRawLite/src/libraw_datastream.cpp +703 -0
- data/vendor/FreeImage/Source/LibTIFF4/mkg3states.c +451 -0
- data/vendor/FreeImage/Source/LibTIFF4/mkspans.c +82 -0
- data/vendor/FreeImage/Source/LibTIFF4/t4.h +292 -0
- data/vendor/FreeImage/Source/LibTIFF4/tif_aux.c +358 -0
- data/vendor/FreeImage/Source/LibTIFF4/tif_close.c +140 -0
- data/vendor/FreeImage/Source/LibTIFF4/tif_codec.c +166 -0
- data/vendor/FreeImage/Source/LibTIFF4/tif_color.c +287 -0
- data/vendor/FreeImage/Source/LibTIFF4/tif_compress.c +304 -0
- data/vendor/FreeImage/Source/LibTIFF4/tif_config.h +97 -0
- data/vendor/FreeImage/Source/LibTIFF4/tif_config.vc.h +74 -0
- data/vendor/FreeImage/Source/LibTIFF4/tif_config.wince.h +71 -0
- data/vendor/FreeImage/Source/LibTIFF4/tif_dir.c +1700 -0
- data/vendor/FreeImage/Source/LibTIFF4/tif_dir.h +308 -0
- data/vendor/FreeImage/Source/LibTIFF4/tif_dirinfo.c +959 -0
- data/vendor/FreeImage/Source/LibTIFF4/tif_dirread.c +5640 -0
- data/vendor/FreeImage/Source/LibTIFF4/tif_dirwrite.c +2910 -0
- data/vendor/FreeImage/Source/LibTIFF4/tif_dumpmode.c +143 -0
- data/vendor/FreeImage/Source/LibTIFF4/tif_error.c +80 -0
- data/vendor/FreeImage/Source/LibTIFF4/tif_extension.c +118 -0
- data/vendor/FreeImage/Source/LibTIFF4/tif_fax3.c +1595 -0
- data/vendor/FreeImage/Source/LibTIFF4/tif_fax3.h +538 -0
- data/vendor/FreeImage/Source/LibTIFF4/tif_fax3sm.c +1260 -0
- data/vendor/FreeImage/Source/LibTIFF4/tif_flush.c +118 -0
- data/vendor/FreeImage/Source/LibTIFF4/tif_getimage.c +2890 -0
- data/vendor/FreeImage/Source/LibTIFF4/tif_jbig.c +213 -0
- data/vendor/FreeImage/Source/LibTIFF4/tif_jpeg.c +2354 -0
- data/vendor/FreeImage/Source/LibTIFF4/tif_jpeg_12.c +65 -0
- data/vendor/FreeImage/Source/LibTIFF4/tif_luv.c +1683 -0
- data/vendor/FreeImage/Source/LibTIFF4/tif_lzma.c +495 -0
- data/vendor/FreeImage/Source/LibTIFF4/tif_lzw.c +1169 -0
- data/vendor/FreeImage/Source/LibTIFF4/tif_next.c +181 -0
- data/vendor/FreeImage/Source/LibTIFF4/tif_ojpeg.c +2501 -0
- data/vendor/FreeImage/Source/LibTIFF4/tif_open.c +725 -0
- data/vendor/FreeImage/Source/LibTIFF4/tif_packbits.c +300 -0
- data/vendor/FreeImage/Source/LibTIFF4/tif_pixarlog.c +1442 -0
- data/vendor/FreeImage/Source/LibTIFF4/tif_predict.c +764 -0
- data/vendor/FreeImage/Source/LibTIFF4/tif_predict.h +77 -0
- data/vendor/FreeImage/Source/LibTIFF4/tif_print.c +716 -0
- data/vendor/FreeImage/Source/LibTIFF4/tif_read.c +1086 -0
- data/vendor/FreeImage/Source/LibTIFF4/tif_strip.c +383 -0
- data/vendor/FreeImage/Source/LibTIFF4/tif_swab.c +310 -0
- data/vendor/FreeImage/Source/LibTIFF4/tif_thunder.c +207 -0
- data/vendor/FreeImage/Source/LibTIFF4/tif_tile.c +299 -0
- data/vendor/FreeImage/Source/LibTIFF4/tif_unix.c +325 -0
- data/vendor/FreeImage/Source/LibTIFF4/tif_version.c +40 -0
- data/vendor/FreeImage/Source/LibTIFF4/tif_vms.c +603 -0
- data/vendor/FreeImage/Source/LibTIFF4/tif_warning.c +81 -0
- data/vendor/FreeImage/Source/LibTIFF4/tif_win32.c +443 -0
- data/vendor/FreeImage/Source/LibTIFF4/tif_wince.c +293 -0
- data/vendor/FreeImage/Source/LibTIFF4/tif_write.c +771 -0
- data/vendor/FreeImage/Source/LibTIFF4/tif_zip.c +472 -0
- data/vendor/FreeImage/Source/LibTIFF4/tiff.h +681 -0
- data/vendor/FreeImage/Source/LibTIFF4/tiffconf.h +170 -0
- data/vendor/FreeImage/Source/LibTIFF4/tiffconf.vc.h +160 -0
- data/vendor/FreeImage/Source/LibTIFF4/tiffconf.wince.h +121 -0
- data/vendor/FreeImage/Source/LibTIFF4/tiffio.h +557 -0
- data/vendor/FreeImage/Source/LibTIFF4/tiffiop.h +367 -0
- data/vendor/FreeImage/Source/LibTIFF4/tiffvers.h +9 -0
- data/vendor/FreeImage/Source/LibTIFF4/uvcode.h +180 -0
- data/vendor/FreeImage/Source/LibWebP/src/dec/alphai.h +55 -0
- data/vendor/FreeImage/Source/LibWebP/src/dec/dec.alpha.c +167 -0
- data/vendor/FreeImage/Source/LibWebP/src/dec/dec.buffer.c +249 -0
- data/vendor/FreeImage/Source/LibWebP/src/dec/dec.frame.c +827 -0
- data/vendor/FreeImage/Source/LibWebP/src/dec/dec.idec.c +857 -0
- data/vendor/FreeImage/Source/LibWebP/src/dec/dec.io.c +640 -0
- data/vendor/FreeImage/Source/LibWebP/src/dec/dec.quant.c +110 -0
- data/vendor/FreeImage/Source/LibWebP/src/dec/dec.tree.c +525 -0
- data/vendor/FreeImage/Source/LibWebP/src/dec/dec.vp8.c +663 -0
- data/vendor/FreeImage/Source/LibWebP/src/dec/dec.vp8l.c +1584 -0
- data/vendor/FreeImage/Source/LibWebP/src/dec/dec.webp.c +834 -0
- data/vendor/FreeImage/Source/LibWebP/src/dec/decode_vp8.h +185 -0
- data/vendor/FreeImage/Source/LibWebP/src/dec/vp8i.h +353 -0
- data/vendor/FreeImage/Source/LibWebP/src/dec/vp8li.h +136 -0
- data/vendor/FreeImage/Source/LibWebP/src/dec/webpi.h +120 -0
- data/vendor/FreeImage/Source/LibWebP/src/demux/demux.demux.c +957 -0
- data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.alpha_processing.c +377 -0
- data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.alpha_processing_mips_dsp_r2.c +139 -0
- data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.alpha_processing_sse2.c +296 -0
- data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.argb.c +68 -0
- data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.argb_mips_dsp_r2.c +108 -0
- data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.argb_sse2.c +62 -0
- data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.cost.c +412 -0
- data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.cost_mips32.c +154 -0
- data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.cost_mips_dsp_r2.c +107 -0
- data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.cost_sse2.c +121 -0
- data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.cpu.c +138 -0
- data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.dec.c +760 -0
- data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.dec_clip_tables.c +366 -0
- data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.dec_mips32.c +585 -0
- data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.dec_mips_dsp_r2.c +992 -0
- data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.dec_neon.c +1489 -0
- data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.dec_sse2.c +1284 -0
- data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.enc.c +788 -0
- data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.enc_avx2.c +24 -0
- data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.enc_mips32.c +670 -0
- data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.enc_mips_dsp_r2.c +1510 -0
- data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.enc_neon.c +932 -0
- data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.enc_sse2.c +940 -0
- data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.filters.c +240 -0
- data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.filters_mips_dsp_r2.c +404 -0
- data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.filters_sse2.c +349 -0
- data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.h +434 -0
- data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.lossless.c +1838 -0
- data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.lossless_mips32.c +416 -0
- data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.lossless_mips_dsp_r2.c +921 -0
- data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.lossless_neon.c +357 -0
- data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.lossless_sse2.c +535 -0
- data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.rescaler.c +115 -0
- data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.rescaler_mips32.c +192 -0
- data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.rescaler_mips_dsp_r2.c +210 -0
- data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.upsampling.c +252 -0
- data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.upsampling_mips_dsp_r2.c +280 -0
- data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.upsampling_neon.c +267 -0
- data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.upsampling_sse2.c +214 -0
- data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.yuv.c +166 -0
- data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.yuv_mips32.c +100 -0
- data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.yuv_mips_dsp_r2.c +131 -0
- data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.yuv_sse2.c +322 -0
- data/vendor/FreeImage/Source/LibWebP/src/dsp/lossless.h +313 -0
- data/vendor/FreeImage/Source/LibWebP/src/dsp/mips_macro.h +200 -0
- data/vendor/FreeImage/Source/LibWebP/src/dsp/neon.h +82 -0
- data/vendor/FreeImage/Source/LibWebP/src/dsp/yuv.h +321 -0
- data/vendor/FreeImage/Source/LibWebP/src/dsp/yuv_tables_sse2.h +536 -0
- data/vendor/FreeImage/Source/LibWebP/src/enc/backward_references.h +202 -0
- data/vendor/FreeImage/Source/LibWebP/src/enc/cost.h +69 -0
- data/vendor/FreeImage/Source/LibWebP/src/enc/enc.alpha.c +440 -0
- data/vendor/FreeImage/Source/LibWebP/src/enc/enc.analysis.c +501 -0
- data/vendor/FreeImage/Source/LibWebP/src/enc/enc.backward_references.c +1076 -0
- data/vendor/FreeImage/Source/LibWebP/src/enc/enc.config.c +163 -0
- data/vendor/FreeImage/Source/LibWebP/src/enc/enc.cost.c +355 -0
- data/vendor/FreeImage/Source/LibWebP/src/enc/enc.filter.c +296 -0
- data/vendor/FreeImage/Source/LibWebP/src/enc/enc.frame.c +850 -0
- data/vendor/FreeImage/Source/LibWebP/src/enc/enc.histogram.c +897 -0
- data/vendor/FreeImage/Source/LibWebP/src/enc/enc.iterator.c +456 -0
- data/vendor/FreeImage/Source/LibWebP/src/enc/enc.near_lossless.c +160 -0
- data/vendor/FreeImage/Source/LibWebP/src/enc/enc.picture.c +290 -0
- data/vendor/FreeImage/Source/LibWebP/src/enc/enc.picture_csp.c +1100 -0
- data/vendor/FreeImage/Source/LibWebP/src/enc/enc.picture_psnr.c +150 -0
- data/vendor/FreeImage/Source/LibWebP/src/enc/enc.picture_rescale.c +285 -0
- data/vendor/FreeImage/Source/LibWebP/src/enc/enc.picture_tools.c +206 -0
- data/vendor/FreeImage/Source/LibWebP/src/enc/enc.quant.c +1191 -0
- data/vendor/FreeImage/Source/LibWebP/src/enc/enc.syntax.c +383 -0
- data/vendor/FreeImage/Source/LibWebP/src/enc/enc.token.c +285 -0
- data/vendor/FreeImage/Source/LibWebP/src/enc/enc.tree.c +504 -0
- data/vendor/FreeImage/Source/LibWebP/src/enc/enc.vp8l.c +1437 -0
- data/vendor/FreeImage/Source/LibWebP/src/enc/enc.webpenc.c +379 -0
- data/vendor/FreeImage/Source/LibWebP/src/enc/histogram.h +114 -0
- data/vendor/FreeImage/Source/LibWebP/src/enc/vp8enci.h +551 -0
- data/vendor/FreeImage/Source/LibWebP/src/enc/vp8li.h +78 -0
- data/vendor/FreeImage/Source/LibWebP/src/mux/mux.anim_encode.c +1241 -0
- data/vendor/FreeImage/Source/LibWebP/src/mux/mux.muxedit.c +696 -0
- data/vendor/FreeImage/Source/LibWebP/src/mux/mux.muxinternal.c +551 -0
- data/vendor/FreeImage/Source/LibWebP/src/mux/mux.muxread.c +544 -0
- data/vendor/FreeImage/Source/LibWebP/src/mux/muxi.h +232 -0
- data/vendor/FreeImage/Source/LibWebP/src/utils/bit_reader.h +168 -0
- data/vendor/FreeImage/Source/LibWebP/src/utils/bit_reader_inl.h +172 -0
- data/vendor/FreeImage/Source/LibWebP/src/utils/bit_writer.h +120 -0
- data/vendor/FreeImage/Source/LibWebP/src/utils/color_cache.h +74 -0
- data/vendor/FreeImage/Source/LibWebP/src/utils/endian_inl.h +100 -0
- data/vendor/FreeImage/Source/LibWebP/src/utils/filters.h +32 -0
- data/vendor/FreeImage/Source/LibWebP/src/utils/huffman.h +67 -0
- data/vendor/FreeImage/Source/LibWebP/src/utils/huffman_encode.h +60 -0
- data/vendor/FreeImage/Source/LibWebP/src/utils/quant_levels.h +36 -0
- data/vendor/FreeImage/Source/LibWebP/src/utils/quant_levels_dec.h +35 -0
- data/vendor/FreeImage/Source/LibWebP/src/utils/random.h +63 -0
- data/vendor/FreeImage/Source/LibWebP/src/utils/rescaler.h +78 -0
- data/vendor/FreeImage/Source/LibWebP/src/utils/thread.h +93 -0
- data/vendor/FreeImage/Source/LibWebP/src/utils/utils.bit_reader.c +208 -0
- data/vendor/FreeImage/Source/LibWebP/src/utils/utils.bit_writer.c +308 -0
- data/vendor/FreeImage/Source/LibWebP/src/utils/utils.color_cache.c +49 -0
- data/vendor/FreeImage/Source/LibWebP/src/utils/utils.filters.c +76 -0
- data/vendor/FreeImage/Source/LibWebP/src/utils/utils.h +121 -0
- data/vendor/FreeImage/Source/LibWebP/src/utils/utils.huffman.c +205 -0
- data/vendor/FreeImage/Source/LibWebP/src/utils/utils.huffman_encode.c +417 -0
- data/vendor/FreeImage/Source/LibWebP/src/utils/utils.quant_levels.c +140 -0
- data/vendor/FreeImage/Source/LibWebP/src/utils/utils.quant_levels_dec.c +279 -0
- data/vendor/FreeImage/Source/LibWebP/src/utils/utils.random.c +43 -0
- data/vendor/FreeImage/Source/LibWebP/src/utils/utils.rescaler.c +82 -0
- data/vendor/FreeImage/Source/LibWebP/src/utils/utils.thread.c +309 -0
- data/vendor/FreeImage/Source/LibWebP/src/utils/utils.utils.c +211 -0
- data/vendor/FreeImage/Source/LibWebP/src/webp/decode.h +493 -0
- data/vendor/FreeImage/Source/LibWebP/src/webp/demux.h +224 -0
- data/vendor/FreeImage/Source/LibWebP/src/webp/encode.h +515 -0
- data/vendor/FreeImage/Source/LibWebP/src/webp/format_constants.h +88 -0
- data/vendor/FreeImage/Source/LibWebP/src/webp/mux.h +507 -0
- data/vendor/FreeImage/Source/LibWebP/src/webp/mux_types.h +97 -0
- data/vendor/FreeImage/Source/LibWebP/src/webp/types.h +52 -0
- data/vendor/FreeImage/Source/MapIntrospector.h +212 -0
- data/vendor/FreeImage/Source/Metadata/Exif.cpp +1253 -0
- data/vendor/FreeImage/Source/Metadata/FIRational.cpp +176 -0
- data/vendor/FreeImage/Source/Metadata/FIRational.h +108 -0
- data/vendor/FreeImage/Source/Metadata/FreeImageTag.cpp +353 -0
- data/vendor/FreeImage/Source/Metadata/FreeImageTag.h +500 -0
- data/vendor/FreeImage/Source/Metadata/IPTC.cpp +342 -0
- data/vendor/FreeImage/Source/Metadata/TagConversion.cpp +1094 -0
- data/vendor/FreeImage/Source/Metadata/TagLib.cpp +1618 -0
- data/vendor/FreeImage/Source/Metadata/XTIFF.cpp +766 -0
- data/vendor/FreeImage/Source/OpenEXR/Half/eLut.cpp +114 -0
- data/vendor/FreeImage/Source/OpenEXR/Half/eLut.h +71 -0
- data/vendor/FreeImage/Source/OpenEXR/Half/half.cpp +310 -0
- data/vendor/FreeImage/Source/OpenEXR/Half/half.h +757 -0
- data/vendor/FreeImage/Source/OpenEXR/Half/halfExport.h +27 -0
- data/vendor/FreeImage/Source/OpenEXR/Half/halfFunction.h +179 -0
- data/vendor/FreeImage/Source/OpenEXR/Half/halfLimits.h +102 -0
- data/vendor/FreeImage/Source/OpenEXR/Half/toFloat.cpp +164 -0
- data/vendor/FreeImage/Source/OpenEXR/Half/toFloat.h +16391 -0
- data/vendor/FreeImage/Source/OpenEXR/Iex/Iex.h +60 -0
- data/vendor/FreeImage/Source/OpenEXR/Iex/IexBaseExc.cpp +156 -0
- data/vendor/FreeImage/Source/OpenEXR/Iex/IexBaseExc.h +264 -0
- data/vendor/FreeImage/Source/OpenEXR/Iex/IexErrnoExc.h +208 -0
- data/vendor/FreeImage/Source/OpenEXR/Iex/IexExport.h +51 -0
- data/vendor/FreeImage/Source/OpenEXR/Iex/IexForward.h +229 -0
- data/vendor/FreeImage/Source/OpenEXR/Iex/IexMacros.h +170 -0
- data/vendor/FreeImage/Source/OpenEXR/Iex/IexMathExc.h +57 -0
- data/vendor/FreeImage/Source/OpenEXR/Iex/IexNamespace.h +112 -0
- data/vendor/FreeImage/Source/OpenEXR/Iex/IexThrowErrnoExc.cpp +873 -0
- data/vendor/FreeImage/Source/OpenEXR/Iex/IexThrowErrnoExc.h +97 -0
- data/vendor/FreeImage/Source/OpenEXR/IexMath/IexMathFloatExc.cpp +113 -0
- data/vendor/FreeImage/Source/OpenEXR/IexMath/IexMathFloatExc.h +146 -0
- data/vendor/FreeImage/Source/OpenEXR/IexMath/IexMathFpu.cpp +530 -0
- data/vendor/FreeImage/Source/OpenEXR/IexMath/IexMathFpu.h +91 -0
- data/vendor/FreeImage/Source/OpenEXR/IexMath/IexMathIeeeExc.h +62 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmBaseConfig.h +61 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfAcesFile.cpp +633 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfAcesFile.h +324 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfArray.h +285 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfAttribute.cpp +158 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfAttribute.h +407 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfAutoArray.h +95 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfB44Compressor.cpp +1072 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfB44Compressor.h +118 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfBoxAttribute.cpp +111 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfBoxAttribute.h +87 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfCRgbaFile.cpp +1438 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfCRgbaFile.h +555 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfChannelList.cpp +322 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfChannelList.h +436 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfChannelListAttribute.cpp +150 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfChannelListAttribute.h +74 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfCheckedArithmetic.h +163 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfChromaticities.cpp +151 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfChromaticities.h +131 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfChromaticitiesAttribute.cpp +87 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfChromaticitiesAttribute.h +73 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfCompositeDeepScanLine.cpp +591 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfCompositeDeepScanLine.h +142 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfCompression.h +84 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfCompressionAttribute.cpp +78 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfCompressionAttribute.h +64 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfCompressor.cpp +226 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfCompressor.h +265 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfConvert.cpp +143 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfConvert.h +107 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepCompositing.cpp +110 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepCompositing.h +132 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepFrameBuffer.cpp +230 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepFrameBuffer.h +339 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepImageState.h +96 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepImageStateAttribute.cpp +78 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepImageStateAttribute.h +68 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepScanLineInputFile.cpp +2025 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepScanLineInputFile.h +276 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepScanLineInputPart.cpp +149 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepScanLineInputPart.h +181 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepScanLineOutputFile.cpp +1552 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepScanLineOutputFile.h +244 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepScanLineOutputPart.cpp +107 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepScanLineOutputPart.h +168 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepTiledInputFile.cpp +1979 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepTiledInputFile.h +437 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepTiledInputPart.cpp +273 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepTiledInputPart.h +362 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepTiledOutputFile.cpp +2055 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepTiledOutputFile.h +475 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepTiledOutputPart.cpp +250 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepTiledOutputPart.h +394 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDoubleAttribute.cpp +57 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDoubleAttribute.h +59 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDwaCompressor.cpp +3424 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDwaCompressor.h +210 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDwaCompressorSimd.h +2145 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfEnvmap.cpp +335 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfEnvmap.h +336 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfEnvmapAttribute.cpp +76 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfEnvmapAttribute.h +68 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfExport.h +46 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfFastHuf.cpp +768 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfFastHuf.h +148 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfFloatAttribute.cpp +57 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfFloatAttribute.h +58 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfFloatVectorAttribute.cpp +84 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfFloatVectorAttribute.h +76 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfForward.h +127 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfFrameBuffer.cpp +228 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfFrameBuffer.h +386 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfFramesPerSecond.cpp +76 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfFramesPerSecond.h +94 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfGenericInputFile.cpp +76 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfGenericInputFile.h +58 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfGenericOutputFile.cpp +112 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfGenericOutputFile.h +62 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfHeader.cpp +1283 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfHeader.h +699 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfHuf.cpp +1114 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfHuf.h +82 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfIO.cpp +110 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfIO.h +255 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfInputFile.cpp +895 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfInputFile.h +240 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfInputPart.cpp +114 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfInputPart.h +84 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfInputPartData.cpp +51 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfInputPartData.h +69 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfInputStreamMutex.h +68 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfInt64.h +56 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfIntAttribute.cpp +57 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfIntAttribute.h +58 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfKeyCode.cpp +217 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfKeyCode.h +167 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfKeyCodeAttribute.cpp +99 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfKeyCodeAttribute.h +73 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfLineOrder.h +69 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfLineOrderAttribute.cpp +78 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfLineOrderAttribute.h +72 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfLut.cpp +178 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfLut.h +188 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfMatrixAttribute.cpp +263 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfMatrixAttribute.h +83 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfMisc.cpp +1872 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfMisc.h +466 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfMultiPartInputFile.cpp +783 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfMultiPartInputFile.h +128 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfMultiPartOutputFile.cpp +519 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfMultiPartOutputFile.h +118 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfMultiView.cpp +435 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfMultiView.h +187 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfName.h +150 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfNamespace.h +115 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfOpaqueAttribute.cpp +126 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfOpaqueAttribute.h +110 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfOptimizedPixelReading.h +646 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfOutputFile.cpp +1378 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfOutputFile.h +263 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfOutputPart.cpp +105 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfOutputPart.h +77 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfOutputPartData.cpp +52 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfOutputPartData.h +62 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfOutputStreamMutex.h +70 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfPartHelper.h +262 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfPartType.cpp +63 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfPartType.h +62 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfPixelType.h +67 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfPizCompressor.cpp +667 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfPizCompressor.h +117 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfPreviewImage.cpp +104 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfPreviewImage.h +135 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfPreviewImageAttribute.cpp +103 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfPreviewImageAttribute.h +70 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfPxr24Compressor.cpp +553 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfPxr24Compressor.h +109 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfRational.cpp +127 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfRational.h +98 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfRationalAttribute.cpp +74 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfRationalAttribute.h +69 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfRgba.h +109 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfRgbaFile.cpp +1405 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfRgbaFile.h +346 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfRgbaYca.cpp +497 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfRgbaYca.h +259 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfRle.cpp +157 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfRle.h +63 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfRleCompressor.cpp +220 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfRleCompressor.h +80 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfScanLineInputFile.cpp +1702 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfScanLineInputFile.h +210 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfSimd.h +59 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfStandardAttributes.cpp +125 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfStandardAttributes.h +382 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfStdIO.cpp +242 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfStdIO.h +160 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfStringAttribute.cpp +80 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfStringAttribute.h +71 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfStringVectorAttribute.cpp +100 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfStringVectorAttribute.h +74 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfSystemSpecific.cpp +129 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfSystemSpecific.h +172 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTestFile.cpp +216 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTestFile.h +97 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfThreading.cpp +62 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfThreading.h +95 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTileDescription.h +107 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTileDescriptionAttribute.cpp +86 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTileDescriptionAttribute.h +72 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTileOffsets.cpp +552 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTileOffsets.h +125 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTiledInputFile.cpp +1533 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTiledInputFile.h +401 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTiledInputPart.cpp +208 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTiledInputPart.h +100 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTiledMisc.cpp +389 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTiledMisc.h +106 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTiledOutputFile.cpp +1841 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTiledOutputFile.h +495 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTiledOutputPart.cpp +228 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTiledOutputPart.h +105 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTiledRgbaFile.cpp +1163 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTiledRgbaFile.h +482 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTimeCode.cpp +431 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTimeCode.h +242 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTimeCodeAttribute.cpp +79 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTimeCodeAttribute.h +74 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfVecAttribute.cpp +217 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfVecAttribute.h +100 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfVersion.cpp +60 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfVersion.h +136 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfWav.cpp +391 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfWav.h +78 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfXdr.h +927 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfZip.cpp +196 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfZip.h +78 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfZipCompressor.cpp +127 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfZipCompressor.h +89 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/b44ExpLogTable.cpp +136 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/b44ExpLogTable.h +16396 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/dwaLookups.cpp +573 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmImf/dwaLookups.h +98334 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThread.cpp +80 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThread.h +143 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThreadExport.h +46 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThreadForward.h +52 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThreadMutex.cpp +59 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThreadMutex.h +160 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThreadMutexPosix.cpp +85 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThreadMutexWin32.cpp +79 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThreadNamespace.h +114 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThreadPool.cpp +483 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThreadPool.h +160 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThreadPosix.cpp +98 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThreadSemaphore.cpp +60 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThreadSemaphore.h +112 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThreadSemaphorePosix.cpp +106 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThreadSemaphorePosixCompat.cpp +155 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThreadSemaphoreWin32.cpp +153 -0
- data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThreadWin32.cpp +100 -0
- data/vendor/FreeImage/Source/OpenEXR/Imath/ImathBox.cpp +37 -0
- data/vendor/FreeImage/Source/OpenEXR/Imath/ImathBox.h +849 -0
- data/vendor/FreeImage/Source/OpenEXR/Imath/ImathBoxAlgo.h +1016 -0
- data/vendor/FreeImage/Source/OpenEXR/Imath/ImathColor.h +736 -0
- data/vendor/FreeImage/Source/OpenEXR/Imath/ImathColorAlgo.cpp +178 -0
- data/vendor/FreeImage/Source/OpenEXR/Imath/ImathColorAlgo.h +257 -0
- data/vendor/FreeImage/Source/OpenEXR/Imath/ImathEuler.h +926 -0
- data/vendor/FreeImage/Source/OpenEXR/Imath/ImathExc.h +73 -0
- data/vendor/FreeImage/Source/OpenEXR/Imath/ImathExport.h +46 -0
- data/vendor/FreeImage/Source/OpenEXR/Imath/ImathForward.h +72 -0
- data/vendor/FreeImage/Source/OpenEXR/Imath/ImathFrame.h +192 -0
- data/vendor/FreeImage/Source/OpenEXR/Imath/ImathFrustum.h +741 -0
- data/vendor/FreeImage/Source/OpenEXR/Imath/ImathFrustumTest.h +417 -0
- data/vendor/FreeImage/Source/OpenEXR/Imath/ImathFun.cpp +181 -0
- data/vendor/FreeImage/Source/OpenEXR/Imath/ImathFun.h +269 -0
- data/vendor/FreeImage/Source/OpenEXR/Imath/ImathGL.h +166 -0
- data/vendor/FreeImage/Source/OpenEXR/Imath/ImathGLU.h +54 -0
- data/vendor/FreeImage/Source/OpenEXR/Imath/ImathHalfLimits.h +68 -0
- data/vendor/FreeImage/Source/OpenEXR/Imath/ImathInt64.h +62 -0
- data/vendor/FreeImage/Source/OpenEXR/Imath/ImathInterval.h +226 -0
- data/vendor/FreeImage/Source/OpenEXR/Imath/ImathLimits.h +268 -0
- data/vendor/FreeImage/Source/OpenEXR/Imath/ImathLine.h +185 -0
- data/vendor/FreeImage/Source/OpenEXR/Imath/ImathLineAlgo.h +288 -0
- data/vendor/FreeImage/Source/OpenEXR/Imath/ImathMath.h +208 -0
- data/vendor/FreeImage/Source/OpenEXR/Imath/ImathMatrix.h +3441 -0
- data/vendor/FreeImage/Source/OpenEXR/Imath/ImathMatrixAlgo.cpp +1252 -0
- data/vendor/FreeImage/Source/OpenEXR/Imath/ImathMatrixAlgo.h +1425 -0
- data/vendor/FreeImage/Source/OpenEXR/Imath/ImathNamespace.h +115 -0
- data/vendor/FreeImage/Source/OpenEXR/Imath/ImathPlane.h +257 -0
- data/vendor/FreeImage/Source/OpenEXR/Imath/ImathPlatform.h +112 -0
- data/vendor/FreeImage/Source/OpenEXR/Imath/ImathQuat.h +964 -0
- data/vendor/FreeImage/Source/OpenEXR/Imath/ImathRandom.cpp +194 -0
- data/vendor/FreeImage/Source/OpenEXR/Imath/ImathRandom.h +401 -0
- data/vendor/FreeImage/Source/OpenEXR/Imath/ImathRoots.h +219 -0
- data/vendor/FreeImage/Source/OpenEXR/Imath/ImathShear.cpp +54 -0
- data/vendor/FreeImage/Source/OpenEXR/Imath/ImathShear.h +656 -0
- data/vendor/FreeImage/Source/OpenEXR/Imath/ImathSphere.h +177 -0
- data/vendor/FreeImage/Source/OpenEXR/Imath/ImathVec.cpp +583 -0
- data/vendor/FreeImage/Source/OpenEXR/Imath/ImathVec.h +2227 -0
- data/vendor/FreeImage/Source/OpenEXR/Imath/ImathVecAlgo.h +147 -0
- data/vendor/FreeImage/Source/OpenEXR/OpenEXRConfig.h +72 -0
- data/vendor/FreeImage/Source/Plugin.h +144 -0
- data/vendor/FreeImage/Source/Quantizers.h +354 -0
- data/vendor/FreeImage/Source/ToneMapping.h +44 -0
- data/vendor/FreeImage/Source/Utilities.h +516 -0
- data/vendor/FreeImage/Source/ZLib/adler32.c +179 -0
- data/vendor/FreeImage/Source/ZLib/compress.c +80 -0
- data/vendor/FreeImage/Source/ZLib/crc32.c +425 -0
- data/vendor/FreeImage/Source/ZLib/crc32.h +441 -0
- data/vendor/FreeImage/Source/ZLib/deflate.c +1967 -0
- data/vendor/FreeImage/Source/ZLib/deflate.h +346 -0
- data/vendor/FreeImage/Source/ZLib/gzclose.c +25 -0
- data/vendor/FreeImage/Source/ZLib/gzguts.h +209 -0
- data/vendor/FreeImage/Source/ZLib/gzlib.c +634 -0
- data/vendor/FreeImage/Source/ZLib/gzread.c +594 -0
- data/vendor/FreeImage/Source/ZLib/gzwrite.c +577 -0
- data/vendor/FreeImage/Source/ZLib/infback.c +640 -0
- data/vendor/FreeImage/Source/ZLib/inffast.c +340 -0
- data/vendor/FreeImage/Source/ZLib/inffast.h +11 -0
- data/vendor/FreeImage/Source/ZLib/inffixed.h +94 -0
- data/vendor/FreeImage/Source/ZLib/inflate.c +1512 -0
- data/vendor/FreeImage/Source/ZLib/inflate.h +122 -0
- data/vendor/FreeImage/Source/ZLib/inftrees.c +306 -0
- data/vendor/FreeImage/Source/ZLib/inftrees.h +62 -0
- data/vendor/FreeImage/Source/ZLib/trees.c +1226 -0
- data/vendor/FreeImage/Source/ZLib/trees.h +128 -0
- data/vendor/FreeImage/Source/ZLib/uncompr.c +59 -0
- data/vendor/FreeImage/Source/ZLib/zconf.h +511 -0
- data/vendor/FreeImage/Source/ZLib/zlib.h +1768 -0
- data/vendor/FreeImage/Source/ZLib/zutil.c +324 -0
- data/vendor/FreeImage/Source/ZLib/zutil.h +253 -0
- metadata +931 -0
@@ -0,0 +1,1919 @@
|
|
1
|
+
/* Library for accessing X3F Files
|
2
|
+
----------------------------------------------------------------
|
3
|
+
BSD-style License
|
4
|
+
----------------------------------------------------------------
|
5
|
+
|
6
|
+
* Copyright (c) 2010, Roland Karlsson (roland@proxel.se)
|
7
|
+
* All rights reserved.
|
8
|
+
*
|
9
|
+
* Redistribution and use in source and binary forms, with or without
|
10
|
+
* modification, are permitted provided that the following conditions are met:
|
11
|
+
* * Redistributions of source code must retain the above copyright
|
12
|
+
* notice, this list of conditions and the following disclaimer.
|
13
|
+
* * Redistributions in binary form must reproduce the above copyright
|
14
|
+
* notice, this list of conditions and the following disclaimer in the
|
15
|
+
* documentation and/or other materials provided with the distribution.
|
16
|
+
* * Neither the name of the organization nor the
|
17
|
+
* names of its contributors may be used to endorse or promote products
|
18
|
+
* derived from this software without specific prior written permission.
|
19
|
+
*
|
20
|
+
* THIS SOFTWARE IS PROVIDED BY ROLAND KARLSSON ''AS IS'' AND ANY
|
21
|
+
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
22
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
23
|
+
* DISCLAIMED. IN NO EVENT SHALL ROLAND KARLSSON BE LIABLE FOR ANY
|
24
|
+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
25
|
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
26
|
+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
27
|
+
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
28
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
29
|
+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30
|
+
|
31
|
+
*/
|
32
|
+
|
33
|
+
/* From X3F_IO.H */
|
34
|
+
|
35
|
+
#include <stdio.h>
|
36
|
+
#include <string.h>
|
37
|
+
#include <stdlib.h>
|
38
|
+
#include <math.h>
|
39
|
+
#include <stdio.h>
|
40
|
+
#include "../libraw/libraw_datastream.h"
|
41
|
+
|
42
|
+
#define SIZE_UNIQUE_IDENTIFIER 16
|
43
|
+
#define SIZE_WHITE_BALANCE 32
|
44
|
+
#define NUM_EXT_DATA 32
|
45
|
+
|
46
|
+
#define X3F_VERSION(MAJ,MIN) (uint32_t)(((MAJ)<<16) + MIN)
|
47
|
+
#define X3F_VERSION_2_0 X3F_VERSION(2,0)
|
48
|
+
#define X3F_VERSION_2_1 X3F_VERSION(2,1)
|
49
|
+
|
50
|
+
/* Main file identifier */
|
51
|
+
#define X3F_FOVb (uint32_t)(0x62564f46)
|
52
|
+
/* Directory identifier */
|
53
|
+
#define X3F_SECd (uint32_t)(0x64434553)
|
54
|
+
/* Property section identifiers */
|
55
|
+
#define X3F_PROP (uint32_t)(0x504f5250)
|
56
|
+
#define X3F_SECp (uint32_t)(0x70434553)
|
57
|
+
/* Image section identifiers */
|
58
|
+
#define X3F_IMAG (uint32_t)(0x46414d49)
|
59
|
+
#define X3F_IMA2 (uint32_t)(0x32414d49)
|
60
|
+
#define X3F_SECi (uint32_t)(0x69434553)
|
61
|
+
/* CAMF identifiers */
|
62
|
+
#define X3F_CAMF (uint32_t)(0x464d4143)
|
63
|
+
#define X3F_SECc (uint32_t)(0x63434553)
|
64
|
+
/* CAMF entry identifiers */
|
65
|
+
#define X3F_CMbP (uint32_t)(0x50624d43)
|
66
|
+
#define X3F_CMbT (uint32_t)(0x54624d43)
|
67
|
+
#define X3F_CMbM (uint32_t)(0x4d624d43)
|
68
|
+
#define X3F_CMb (uint32_t)(0x00624d43)
|
69
|
+
|
70
|
+
#define X3F_IMAGE_THUMB_PLAIN (uint32_t)(0x00020003)
|
71
|
+
#define X3F_IMAGE_THUMB_HUFFMAN (uint32_t)(0x0002000b)
|
72
|
+
#define X3F_IMAGE_THUMB_JPEG (uint32_t)(0x00020012)
|
73
|
+
|
74
|
+
#define X3F_IMAGE_RAW_HUFFMAN_X530 (uint32_t)(0x00030005)
|
75
|
+
#define X3F_IMAGE_RAW_HUFFMAN_10BIT (uint32_t)(0x00030006)
|
76
|
+
#define X3F_IMAGE_RAW_TRUE (uint32_t)(0x0003001e)
|
77
|
+
#define X3F_IMAGE_RAW_MERRILL (uint32_t)(0x0001001e)
|
78
|
+
#define X3F_IMAGE_RAW_QUATTRO (uint32_t)(0x00010023)
|
79
|
+
|
80
|
+
#define X3F_IMAGE_HEADER_SIZE 28
|
81
|
+
#define X3F_CAMF_HEADER_SIZE 28
|
82
|
+
#define X3F_PROPERTY_LIST_HEADER_SIZE 24
|
83
|
+
|
84
|
+
typedef uint16_t utf16_t;
|
85
|
+
|
86
|
+
typedef int bool_t;
|
87
|
+
|
88
|
+
typedef enum x3f_extended_types_e {
|
89
|
+
X3F_EXT_TYPE_NONE=0,
|
90
|
+
X3F_EXT_TYPE_EXPOSURE_ADJUST=1,
|
91
|
+
X3F_EXT_TYPE_CONTRAST_ADJUST=2,
|
92
|
+
X3F_EXT_TYPE_SHADOW_ADJUST=3,
|
93
|
+
X3F_EXT_TYPE_HIGHLIGHT_ADJUST=4,
|
94
|
+
X3F_EXT_TYPE_SATURATION_ADJUST=5,
|
95
|
+
X3F_EXT_TYPE_SHARPNESS_ADJUST=6,
|
96
|
+
X3F_EXT_TYPE_RED_ADJUST=7,
|
97
|
+
X3F_EXT_TYPE_GREEN_ADJUST=8,
|
98
|
+
X3F_EXT_TYPE_BLUE_ADJUST=9,
|
99
|
+
X3F_EXT_TYPE_FILL_LIGHT_ADJUST=10
|
100
|
+
} x3f_extended_types_t;
|
101
|
+
|
102
|
+
typedef struct x3f_property_s {
|
103
|
+
/* Read from file */
|
104
|
+
uint32_t name_offset;
|
105
|
+
uint32_t value_offset;
|
106
|
+
|
107
|
+
/* Computed */
|
108
|
+
utf16_t *name; /* 0x00 terminated UTF 16 */
|
109
|
+
utf16_t *value; /* 0x00 terminated UTF 16 */
|
110
|
+
} x3f_property_t;
|
111
|
+
|
112
|
+
typedef struct x3f_property_table_s {
|
113
|
+
uint32_t size;
|
114
|
+
x3f_property_t *element;
|
115
|
+
} x3f_property_table_t;
|
116
|
+
|
117
|
+
typedef struct x3f_property_list_s {
|
118
|
+
/* 2.0 Fields */
|
119
|
+
uint32_t num_properties;
|
120
|
+
uint32_t character_format;
|
121
|
+
uint32_t reserved;
|
122
|
+
uint32_t total_length;
|
123
|
+
|
124
|
+
x3f_property_table_t property_table;
|
125
|
+
|
126
|
+
void *data;
|
127
|
+
|
128
|
+
uint32_t data_size;
|
129
|
+
|
130
|
+
} x3f_property_list_t;
|
131
|
+
|
132
|
+
typedef struct x3f_table8_s {
|
133
|
+
uint32_t size;
|
134
|
+
uint8_t *element;
|
135
|
+
} x3f_table8_t;
|
136
|
+
|
137
|
+
typedef struct x3f_table16_s {
|
138
|
+
uint32_t size;
|
139
|
+
uint16_t *element;
|
140
|
+
} x3f_table16_t;
|
141
|
+
|
142
|
+
typedef struct x3f_table32_s {
|
143
|
+
uint32_t size;
|
144
|
+
uint32_t *element;
|
145
|
+
} x3f_table32_t;
|
146
|
+
|
147
|
+
#define UNDEFINED_LEAF 0xffffffff
|
148
|
+
|
149
|
+
typedef struct x3f_huffnode_s {
|
150
|
+
struct x3f_huffnode_s *branch[2];
|
151
|
+
uint32_t leaf;
|
152
|
+
} x3f_huffnode_t;
|
153
|
+
|
154
|
+
typedef struct x3f_hufftree_s {
|
155
|
+
uint32_t free_node_index; /* Free node index in huffman tree array */
|
156
|
+
x3f_huffnode_t *nodes; /* Coding tree */
|
157
|
+
} x3f_hufftree_t;
|
158
|
+
|
159
|
+
typedef struct x3f_true_huffman_element_s {
|
160
|
+
uint8_t code_size;
|
161
|
+
uint8_t code;
|
162
|
+
} x3f_true_huffman_element_t;
|
163
|
+
|
164
|
+
typedef struct x3f_true_huffman_s {
|
165
|
+
uint32_t size;
|
166
|
+
x3f_true_huffman_element_t *element;
|
167
|
+
} x3f_true_huffman_t;
|
168
|
+
|
169
|
+
/* 0=bottom, 1=middle, 2=top */
|
170
|
+
#define TRUE_PLANES 3
|
171
|
+
|
172
|
+
typedef struct x3f_true_s {
|
173
|
+
uint16_t seed[TRUE_PLANES]; /* Always 512,512,512 */
|
174
|
+
uint16_t unknown; /* Always 0 */
|
175
|
+
x3f_true_huffman_t table; /* Huffman table - zero
|
176
|
+
terminated. size is the number of
|
177
|
+
leaves plus 1.*/
|
178
|
+
|
179
|
+
x3f_table32_t plane_size; /* Size of the 3 planes */
|
180
|
+
uint8_t *plane_address[TRUE_PLANES]; /* computed offset to the planes */
|
181
|
+
x3f_hufftree_t tree; /* Coding tree */
|
182
|
+
x3f_table16_t x3rgb16; /* 3x16 bit X3-RGB data */
|
183
|
+
} x3f_true_t;
|
184
|
+
|
185
|
+
typedef struct x3f_quattro_s {
|
186
|
+
struct {
|
187
|
+
uint16_t columns;
|
188
|
+
uint16_t rows;
|
189
|
+
} plane[TRUE_PLANES];
|
190
|
+
uint32_t unknown;
|
191
|
+
} x3f_quattro_t;
|
192
|
+
|
193
|
+
typedef struct x3f_huffman_s {
|
194
|
+
x3f_table16_t mapping; /* Value Mapping = X3F lossy compression */
|
195
|
+
x3f_table32_t table; /* Coding Table */
|
196
|
+
x3f_hufftree_t tree; /* Coding tree */
|
197
|
+
x3f_table32_t row_offsets; /* Row offsets */
|
198
|
+
x3f_table8_t rgb8; /* 3x8 bit RGB data */
|
199
|
+
x3f_table16_t x3rgb16; /* 3x16 bit X3-RGB data */
|
200
|
+
} x3f_huffman_t;
|
201
|
+
|
202
|
+
typedef struct x3f_image_data_s {
|
203
|
+
/* 2.0 Fields */
|
204
|
+
/* ------------------------------------------------------------------ */
|
205
|
+
/* Known combinations of type and format are:
|
206
|
+
1-6, 2-3, 2-11, 2-18, 3-6 */
|
207
|
+
uint32_t type; /* 1 = RAW X3 (SD1)
|
208
|
+
2 = thumbnail or maybe just RGB
|
209
|
+
3 = RAW X3 */
|
210
|
+
uint32_t format; /* 3 = 3x8 bit pixmap
|
211
|
+
6 = 3x10 bit huffman with map table
|
212
|
+
11 = 3x8 bit huffman
|
213
|
+
18 = JPEG */
|
214
|
+
uint32_t type_format; /* type<<16 + format */
|
215
|
+
/* ------------------------------------------------------------------ */
|
216
|
+
|
217
|
+
uint32_t columns; /* width / row size in pixels */
|
218
|
+
uint32_t rows; /* height */
|
219
|
+
uint32_t row_stride; /* row size in bytes */
|
220
|
+
|
221
|
+
/* NULL if not used */
|
222
|
+
x3f_huffman_t *huffman; /* Huffman help data */
|
223
|
+
x3f_true_t *tru; /* TRUE help data */
|
224
|
+
x3f_quattro_t *quattro; /* Quattro help data */
|
225
|
+
|
226
|
+
void *data; /* Take from file if NULL. Otherwise,
|
227
|
+
this is the actual data bytes in
|
228
|
+
the file. */
|
229
|
+
uint32_t data_size;
|
230
|
+
|
231
|
+
} x3f_image_data_t;
|
232
|
+
|
233
|
+
typedef struct camf_entry_s {
|
234
|
+
uint32_t id;
|
235
|
+
uint32_t version;
|
236
|
+
uint32_t entry_size;
|
237
|
+
uint32_t name_offset;
|
238
|
+
uint32_t value_offset;
|
239
|
+
void *entry; /* pointer into decoded data */
|
240
|
+
|
241
|
+
/* computed values */
|
242
|
+
uint8_t *name_address;
|
243
|
+
void *value_address;
|
244
|
+
} camf_entry_t;
|
245
|
+
|
246
|
+
typedef struct camf_entry_table_s {
|
247
|
+
uint32_t size;
|
248
|
+
camf_entry_t *element;
|
249
|
+
} camf_entry_table_t;
|
250
|
+
|
251
|
+
typedef struct x3f_camf_typeN_s {
|
252
|
+
uint32_t val0;
|
253
|
+
uint32_t val1;
|
254
|
+
uint32_t val2;
|
255
|
+
uint32_t val3;
|
256
|
+
} x3f_camf_typeN_t;
|
257
|
+
|
258
|
+
typedef struct x3f_camf_type2_s {
|
259
|
+
uint32_t reserved;
|
260
|
+
uint32_t infotype;
|
261
|
+
uint32_t infotype_version;
|
262
|
+
uint32_t crypt_key;
|
263
|
+
} x3f_camf_type2_t;
|
264
|
+
|
265
|
+
typedef struct x3f_camf_type4_s {
|
266
|
+
uint32_t reserved;
|
267
|
+
uint32_t decode_bias;
|
268
|
+
uint32_t block_size;
|
269
|
+
uint32_t block_count;
|
270
|
+
} x3f_camf_type4_t;
|
271
|
+
|
272
|
+
typedef struct x3f_camf_s {
|
273
|
+
|
274
|
+
/* Header info */
|
275
|
+
uint32_t type;
|
276
|
+
union {
|
277
|
+
x3f_camf_typeN_t tN;
|
278
|
+
x3f_camf_type2_t t2;
|
279
|
+
x3f_camf_type4_t t4;
|
280
|
+
};
|
281
|
+
|
282
|
+
/* The encrypted raw data */
|
283
|
+
void *data;
|
284
|
+
uint32_t data_size;
|
285
|
+
|
286
|
+
/* Help data for type 4 Huffman compression */
|
287
|
+
x3f_true_huffman_t table;
|
288
|
+
x3f_hufftree_t tree;
|
289
|
+
uint8_t *decoding_start;
|
290
|
+
|
291
|
+
/* The decrypted data */
|
292
|
+
void *decoded_data;
|
293
|
+
uint32_t decoded_data_size;
|
294
|
+
|
295
|
+
/* Pointers into the decrypted data */
|
296
|
+
camf_entry_table_t entry_table;
|
297
|
+
} x3f_camf_t;
|
298
|
+
|
299
|
+
typedef struct x3f_directory_entry_header_s {
|
300
|
+
uint32_t identifier; /* Should be ´SECp´, "SECi", ... */
|
301
|
+
uint32_t version; /* 0x00020001 is version 2.1 */
|
302
|
+
union {
|
303
|
+
x3f_property_list_t property_list;
|
304
|
+
x3f_image_data_t image_data;
|
305
|
+
x3f_camf_t camf;
|
306
|
+
} data_subsection;
|
307
|
+
} x3f_directory_entry_header_t;
|
308
|
+
|
309
|
+
typedef struct x3f_directory_entry_s {
|
310
|
+
struct {
|
311
|
+
uint32_t offset;
|
312
|
+
uint32_t size;
|
313
|
+
} input, output;
|
314
|
+
|
315
|
+
uint32_t type;
|
316
|
+
|
317
|
+
x3f_directory_entry_header_t header;
|
318
|
+
} x3f_directory_entry_t;
|
319
|
+
|
320
|
+
typedef struct x3f_directory_section_s {
|
321
|
+
uint32_t identifier; /* Should be ´SECd´ */
|
322
|
+
uint32_t version; /* 0x00020001 is version 2.1 */
|
323
|
+
|
324
|
+
/* 2.0 Fields */
|
325
|
+
uint32_t num_directory_entries;
|
326
|
+
x3f_directory_entry_t *directory_entry;
|
327
|
+
} x3f_directory_section_t;
|
328
|
+
|
329
|
+
typedef struct x3f_header_s {
|
330
|
+
/* 2.0 Fields */
|
331
|
+
uint32_t identifier; /* Should be ´FOVb´ */
|
332
|
+
uint32_t version; /* 0x00020001 means 2.1 */
|
333
|
+
uint8_t unique_identifier[SIZE_UNIQUE_IDENTIFIER];
|
334
|
+
uint32_t mark_bits;
|
335
|
+
uint32_t columns; /* Columns and rows ... */
|
336
|
+
uint32_t rows; /* ... before rotation */
|
337
|
+
uint32_t rotation; /* 0, 90, 180, 270 */
|
338
|
+
|
339
|
+
/* Added for 2.1 and 2.2 */
|
340
|
+
uint8_t white_balance[SIZE_WHITE_BALANCE];
|
341
|
+
uint8_t extended_types[NUM_EXT_DATA]; /* x3f_extended_types_t */
|
342
|
+
uint32_t extended_data[NUM_EXT_DATA];
|
343
|
+
} x3f_header_t;
|
344
|
+
|
345
|
+
typedef struct x3f_info_s {
|
346
|
+
char *error;
|
347
|
+
struct {
|
348
|
+
LibRaw_abstract_datastream *file; /* Use if more data is needed */
|
349
|
+
} input, output;
|
350
|
+
} x3f_info_t;
|
351
|
+
|
352
|
+
typedef struct x3f_s {
|
353
|
+
x3f_info_t info;
|
354
|
+
x3f_header_t header;
|
355
|
+
x3f_directory_section_t directory_section;
|
356
|
+
} x3f_t;
|
357
|
+
|
358
|
+
typedef enum x3f_return_e {
|
359
|
+
X3F_OK=0,
|
360
|
+
X3F_ARGUMENT_ERROR=1,
|
361
|
+
X3F_INFILE_ERROR=2,
|
362
|
+
X3F_OUTFILE_ERROR=3,
|
363
|
+
X3F_INTERNAL_ERROR=4
|
364
|
+
} x3f_return_t;
|
365
|
+
|
366
|
+
x3f_return_t x3f_delete(x3f_t *x3f);
|
367
|
+
|
368
|
+
|
369
|
+
/* --------------------------------------------------------------------- */
|
370
|
+
/* Hacky external flags */
|
371
|
+
/* --------------------------------------------------------------------- */
|
372
|
+
|
373
|
+
/* extern */ int legacy_offset = 0;
|
374
|
+
/* extern */ bool_t auto_legacy_offset = 1;
|
375
|
+
|
376
|
+
/* --------------------------------------------------------------------- */
|
377
|
+
/* Huffman Decode Macros */
|
378
|
+
/* --------------------------------------------------------------------- */
|
379
|
+
|
380
|
+
#define HUF_TREE_MAX_LENGTH 27
|
381
|
+
#define HUF_TREE_MAX_NODES(_leaves) ((HUF_TREE_MAX_LENGTH+1)*(_leaves))
|
382
|
+
#define HUF_TREE_GET_LENGTH(_v) (((_v)>>27)&0x1f)
|
383
|
+
#define HUF_TREE_GET_CODE(_v) ((_v)&0x07ffffff)
|
384
|
+
|
385
|
+
/* --------------------------------------------------------------------- */
|
386
|
+
/* Reading and writing - assuming little endian in the file */
|
387
|
+
/* --------------------------------------------------------------------- */
|
388
|
+
|
389
|
+
static int x3f_get1(LibRaw_abstract_datastream *f)
|
390
|
+
{
|
391
|
+
/* Little endian file */
|
392
|
+
return f->get_char();
|
393
|
+
}
|
394
|
+
|
395
|
+
static int x3f_sget2 (uchar *s)
|
396
|
+
{
|
397
|
+
return s[0] | s[1] << 8;
|
398
|
+
}
|
399
|
+
|
400
|
+
static int x3f_get2(LibRaw_abstract_datastream *f)
|
401
|
+
{
|
402
|
+
uchar str[2] = { 0xff,0xff };
|
403
|
+
f->read (str, 1, 2);
|
404
|
+
return x3f_sget2(str);
|
405
|
+
}
|
406
|
+
|
407
|
+
unsigned x3f_sget4 (uchar *s)
|
408
|
+
{
|
409
|
+
return s[0] | s[1] << 8 | s[2] << 16 | s[3] << 24;
|
410
|
+
}
|
411
|
+
|
412
|
+
unsigned x3f_get4(LibRaw_abstract_datastream *f)
|
413
|
+
{
|
414
|
+
uchar str[4] = { 0xff,0xff,0xff,0xff };
|
415
|
+
f->read (str, 1, 4);
|
416
|
+
return x3f_sget4(str);
|
417
|
+
}
|
418
|
+
|
419
|
+
#define FREE(P) do { free(P); (P) = NULL; } while (0)
|
420
|
+
|
421
|
+
#define PUT_GET_N(_buffer,_size,_file,_func) \
|
422
|
+
do \
|
423
|
+
{ \
|
424
|
+
int _left = _size; \
|
425
|
+
while (_left != 0) { \
|
426
|
+
int _cur = _file->_func(_buffer,1,_left); \
|
427
|
+
if (_cur == 0) { \
|
428
|
+
break; \
|
429
|
+
} \
|
430
|
+
_left -= _cur; \
|
431
|
+
} \
|
432
|
+
} while(0)
|
433
|
+
|
434
|
+
#define GET1(_v) do {(_v) = x3f_get1(I->input.file);} while (0)
|
435
|
+
#define GET2(_v) do {(_v) = x3f_get2(I->input.file);} while (0)
|
436
|
+
#define GET4(_v) do {(_v) = x3f_get4(I->input.file);} while (0)
|
437
|
+
#define GETN(_v,_s) PUT_GET_N(_v,_s,I->input.file,read)
|
438
|
+
|
439
|
+
#define GET_TABLE(_T, _GETX, _NUM,_TYPE) \
|
440
|
+
do { \
|
441
|
+
int _i; \
|
442
|
+
(_T).size = (_NUM); \
|
443
|
+
(_T).element = (_TYPE *)realloc((_T).element, \
|
444
|
+
(_NUM)*sizeof((_T).element[0])); \
|
445
|
+
for (_i = 0; _i < (_T).size; _i++) \
|
446
|
+
_GETX((_T).element[_i]); \
|
447
|
+
} while (0)
|
448
|
+
|
449
|
+
#define GET_PROPERTY_TABLE(_T, _NUM) \
|
450
|
+
do { \
|
451
|
+
int _i; \
|
452
|
+
(_T).size = (_NUM); \
|
453
|
+
(_T).element = (x3f_property_t *)realloc((_T).element, \
|
454
|
+
(_NUM)*sizeof((_T).element[0])); \
|
455
|
+
for (_i = 0; _i < (_T).size; _i++) { \
|
456
|
+
GET4((_T).element[_i].name_offset); \
|
457
|
+
GET4((_T).element[_i].value_offset); \
|
458
|
+
} \
|
459
|
+
} while (0)
|
460
|
+
|
461
|
+
#define GET_TRUE_HUFF_TABLE(_T) \
|
462
|
+
do { \
|
463
|
+
int _i; \
|
464
|
+
(_T).element = NULL; \
|
465
|
+
for (_i = 0; ; _i++) { \
|
466
|
+
(_T).size = _i + 1; \
|
467
|
+
(_T).element = (x3f_true_huffman_element_t *)realloc((_T).element, \
|
468
|
+
(_i + 1)*sizeof((_T).element[0])); \
|
469
|
+
GET1((_T).element[_i].code_size); \
|
470
|
+
GET1((_T).element[_i].code); \
|
471
|
+
if ((_T).element[_i].code_size == 0) break; \
|
472
|
+
} \
|
473
|
+
} while (0)
|
474
|
+
|
475
|
+
|
476
|
+
|
477
|
+
/* --------------------------------------------------------------------- */
|
478
|
+
/* Allocating Huffman tree help data */
|
479
|
+
/* --------------------------------------------------------------------- */
|
480
|
+
|
481
|
+
static void cleanup_huffman_tree(x3f_hufftree_t *HTP)
|
482
|
+
{
|
483
|
+
free(HTP->nodes);
|
484
|
+
}
|
485
|
+
|
486
|
+
static void new_huffman_tree(x3f_hufftree_t *HTP, int bits)
|
487
|
+
{
|
488
|
+
int leaves = 1<<bits;
|
489
|
+
|
490
|
+
HTP->free_node_index = 0;
|
491
|
+
HTP->nodes = (x3f_huffnode_t *)
|
492
|
+
calloc(1, HUF_TREE_MAX_NODES(leaves)*sizeof(x3f_huffnode_t));
|
493
|
+
}
|
494
|
+
|
495
|
+
/* --------------------------------------------------------------------- */
|
496
|
+
/* Allocating TRUE engine RAW help data */
|
497
|
+
/* --------------------------------------------------------------------- */
|
498
|
+
|
499
|
+
static void cleanup_true(x3f_true_t **TRUP)
|
500
|
+
{
|
501
|
+
x3f_true_t *TRU = *TRUP;
|
502
|
+
|
503
|
+
if (TRU == NULL) return;
|
504
|
+
|
505
|
+
FREE(TRU->table.element);
|
506
|
+
FREE(TRU->plane_size.element);
|
507
|
+
cleanup_huffman_tree(&TRU->tree);
|
508
|
+
FREE(TRU->x3rgb16.element);
|
509
|
+
|
510
|
+
FREE(TRU);
|
511
|
+
|
512
|
+
*TRUP = NULL;
|
513
|
+
}
|
514
|
+
|
515
|
+
static x3f_true_t *new_true(x3f_true_t **TRUP)
|
516
|
+
{
|
517
|
+
x3f_true_t *TRU = (x3f_true_t *)calloc(1, sizeof(x3f_true_t));
|
518
|
+
|
519
|
+
cleanup_true(TRUP);
|
520
|
+
|
521
|
+
TRU->table.size = 0;
|
522
|
+
TRU->table.element = NULL;
|
523
|
+
TRU->plane_size.size = 0;
|
524
|
+
TRU->plane_size.element = NULL;
|
525
|
+
TRU->tree.nodes = NULL;
|
526
|
+
TRU->x3rgb16.size = 0;
|
527
|
+
TRU->x3rgb16.element = NULL;
|
528
|
+
|
529
|
+
*TRUP = TRU;
|
530
|
+
|
531
|
+
return TRU;
|
532
|
+
}
|
533
|
+
|
534
|
+
static void cleanup_quattro(x3f_quattro_t **QP)
|
535
|
+
{
|
536
|
+
x3f_quattro_t *Q = *QP;
|
537
|
+
|
538
|
+
if (Q == NULL) return;
|
539
|
+
|
540
|
+
FREE(Q);
|
541
|
+
|
542
|
+
*QP = NULL;
|
543
|
+
}
|
544
|
+
|
545
|
+
static x3f_quattro_t *new_quattro(x3f_quattro_t **QP)
|
546
|
+
{
|
547
|
+
x3f_quattro_t *Q = (x3f_quattro_t *)calloc(1, sizeof(x3f_quattro_t));
|
548
|
+
int i;
|
549
|
+
|
550
|
+
cleanup_quattro(QP);
|
551
|
+
|
552
|
+
for (i=0; i<TRUE_PLANES; i++) {
|
553
|
+
Q->plane[i].columns = 0;
|
554
|
+
Q->plane[i].rows = 0;
|
555
|
+
}
|
556
|
+
|
557
|
+
Q->unknown = 0;
|
558
|
+
|
559
|
+
*QP = Q;
|
560
|
+
|
561
|
+
return Q;
|
562
|
+
}
|
563
|
+
|
564
|
+
/* --------------------------------------------------------------------- */
|
565
|
+
/* Allocating Huffman engine help data */
|
566
|
+
/* --------------------------------------------------------------------- */
|
567
|
+
|
568
|
+
static void cleanup_huffman(x3f_huffman_t **HUFP)
|
569
|
+
{
|
570
|
+
x3f_huffman_t *HUF = *HUFP;
|
571
|
+
|
572
|
+
if (HUF == NULL) return;
|
573
|
+
|
574
|
+
FREE(HUF->mapping.element);
|
575
|
+
FREE(HUF->table.element);
|
576
|
+
cleanup_huffman_tree(&HUF->tree);
|
577
|
+
FREE(HUF->row_offsets.element);
|
578
|
+
FREE(HUF->rgb8.element);
|
579
|
+
FREE(HUF->x3rgb16.element);
|
580
|
+
FREE(HUF);
|
581
|
+
|
582
|
+
*HUFP = NULL;
|
583
|
+
}
|
584
|
+
|
585
|
+
static x3f_huffman_t *new_huffman(x3f_huffman_t **HUFP)
|
586
|
+
{
|
587
|
+
x3f_huffman_t *HUF = (x3f_huffman_t *)calloc(1, sizeof(x3f_huffman_t));
|
588
|
+
|
589
|
+
cleanup_huffman(HUFP);
|
590
|
+
|
591
|
+
/* Set all not read data block pointers to NULL */
|
592
|
+
HUF->mapping.size = 0;
|
593
|
+
HUF->mapping.element = NULL;
|
594
|
+
HUF->table.size = 0;
|
595
|
+
HUF->table.element = NULL;
|
596
|
+
HUF->tree.nodes = NULL;
|
597
|
+
HUF->row_offsets.size = 0;
|
598
|
+
HUF->row_offsets.element = NULL;
|
599
|
+
HUF->rgb8.size = 0;
|
600
|
+
HUF->rgb8.element = NULL;
|
601
|
+
HUF->x3rgb16.size = 0;
|
602
|
+
HUF->x3rgb16.element = NULL;
|
603
|
+
|
604
|
+
*HUFP = HUF;
|
605
|
+
|
606
|
+
return HUF;
|
607
|
+
}
|
608
|
+
|
609
|
+
|
610
|
+
/* --------------------------------------------------------------------- */
|
611
|
+
/* Creating a new x3f structure from file */
|
612
|
+
/* --------------------------------------------------------------------- */
|
613
|
+
|
614
|
+
/* extern */ x3f_t *x3f_new_from_file(LibRaw_abstract_datastream *infile)
|
615
|
+
{
|
616
|
+
x3f_t *x3f = (x3f_t *)calloc(1, sizeof(x3f_t));
|
617
|
+
x3f_info_t *I = NULL;
|
618
|
+
x3f_header_t *H = NULL;
|
619
|
+
x3f_directory_section_t *DS = NULL;
|
620
|
+
int i, d;
|
621
|
+
|
622
|
+
I = &x3f->info;
|
623
|
+
I->error = NULL;
|
624
|
+
I->input.file = infile;
|
625
|
+
I->output.file = NULL;
|
626
|
+
|
627
|
+
if (infile == NULL) {
|
628
|
+
I->error = "No infile";
|
629
|
+
return x3f;
|
630
|
+
}
|
631
|
+
|
632
|
+
/* Read file header */
|
633
|
+
H = &x3f->header;
|
634
|
+
infile->seek(0, SEEK_SET);
|
635
|
+
GET4(H->identifier);
|
636
|
+
|
637
|
+
if (H->identifier != X3F_FOVb) {
|
638
|
+
#ifdef DCRAW_VERBOSE
|
639
|
+
fprintf(stderr, "Faulty file type\n");
|
640
|
+
#endif
|
641
|
+
x3f_delete(x3f);
|
642
|
+
return NULL;
|
643
|
+
}
|
644
|
+
|
645
|
+
GET4(H->version);
|
646
|
+
GETN(H->unique_identifier, SIZE_UNIQUE_IDENTIFIER);
|
647
|
+
GET4(H->mark_bits);
|
648
|
+
GET4(H->columns);
|
649
|
+
GET4(H->rows);
|
650
|
+
GET4(H->rotation);
|
651
|
+
if (H->version > X3F_VERSION_2_0) {
|
652
|
+
GETN(H->white_balance, SIZE_WHITE_BALANCE);
|
653
|
+
GETN(H->extended_types, NUM_EXT_DATA);
|
654
|
+
for (i=0; i<NUM_EXT_DATA; i++)
|
655
|
+
GET4(H->extended_data[i]);
|
656
|
+
}
|
657
|
+
|
658
|
+
/* Go to the beginning of the directory */
|
659
|
+
infile->seek(-4, SEEK_END);
|
660
|
+
infile->seek(x3f_get4(infile), SEEK_SET);
|
661
|
+
|
662
|
+
/* Read the directory header */
|
663
|
+
DS = &x3f->directory_section;
|
664
|
+
GET4(DS->identifier);
|
665
|
+
GET4(DS->version);
|
666
|
+
GET4(DS->num_directory_entries);
|
667
|
+
|
668
|
+
if (DS->num_directory_entries > 0) {
|
669
|
+
size_t size = DS->num_directory_entries * sizeof(x3f_directory_entry_t);
|
670
|
+
DS->directory_entry = (x3f_directory_entry_t *)calloc(1, size);
|
671
|
+
}
|
672
|
+
|
673
|
+
/* Traverse the directory */
|
674
|
+
for (d=0; d<DS->num_directory_entries; d++) {
|
675
|
+
x3f_directory_entry_t *DE = &DS->directory_entry[d];
|
676
|
+
x3f_directory_entry_header_t *DEH = &DE->header;
|
677
|
+
uint32_t save_dir_pos;
|
678
|
+
|
679
|
+
/* Read the directory entry info */
|
680
|
+
GET4(DE->input.offset);
|
681
|
+
GET4(DE->input.size);
|
682
|
+
|
683
|
+
DE->output.offset = 0;
|
684
|
+
DE->output.size = 0;
|
685
|
+
|
686
|
+
GET4(DE->type);
|
687
|
+
|
688
|
+
/* Save current pos and go to the entry */
|
689
|
+
save_dir_pos = infile->tell();
|
690
|
+
infile->seek(DE->input.offset, SEEK_SET);
|
691
|
+
|
692
|
+
/* Read the type independent part of the entry header */
|
693
|
+
DEH = &DE->header;
|
694
|
+
GET4(DEH->identifier);
|
695
|
+
GET4(DEH->version);
|
696
|
+
|
697
|
+
/* NOTE - the tests below could be made on DE->type instead */
|
698
|
+
|
699
|
+
if (DEH->identifier == X3F_SECp) {
|
700
|
+
x3f_property_list_t *PL = &DEH->data_subsection.property_list;
|
701
|
+
|
702
|
+
/* Read the property part of the header */
|
703
|
+
GET4(PL->num_properties);
|
704
|
+
GET4(PL->character_format);
|
705
|
+
GET4(PL->reserved);
|
706
|
+
GET4(PL->total_length);
|
707
|
+
|
708
|
+
/* Set all not read data block pointers to NULL */
|
709
|
+
PL->data = NULL;
|
710
|
+
PL->data_size = 0;
|
711
|
+
}
|
712
|
+
|
713
|
+
if (DEH->identifier == X3F_SECi) {
|
714
|
+
x3f_image_data_t *ID = &DEH->data_subsection.image_data;
|
715
|
+
|
716
|
+
/* Read the image part of the header */
|
717
|
+
GET4(ID->type);
|
718
|
+
GET4(ID->format);
|
719
|
+
ID->type_format = (ID->type << 16) + (ID->format);
|
720
|
+
GET4(ID->columns);
|
721
|
+
GET4(ID->rows);
|
722
|
+
GET4(ID->row_stride);
|
723
|
+
|
724
|
+
/* Set all not read data block pointers to NULL */
|
725
|
+
ID->huffman = NULL;
|
726
|
+
|
727
|
+
ID->data = NULL;
|
728
|
+
ID->data_size = 0;
|
729
|
+
}
|
730
|
+
|
731
|
+
if (DEH->identifier == X3F_SECc) {
|
732
|
+
x3f_camf_t *CAMF = &DEH->data_subsection.camf;
|
733
|
+
|
734
|
+
/* Read the CAMF part of the header */
|
735
|
+
GET4(CAMF->type);
|
736
|
+
GET4(CAMF->tN.val0);
|
737
|
+
GET4(CAMF->tN.val1);
|
738
|
+
GET4(CAMF->tN.val2);
|
739
|
+
GET4(CAMF->tN.val3);
|
740
|
+
|
741
|
+
/* Set all not read data block pointers to NULL */
|
742
|
+
CAMF->data = NULL;
|
743
|
+
CAMF->data_size = 0;
|
744
|
+
|
745
|
+
/* Set all not allocated help pointers to NULL */
|
746
|
+
CAMF->table.element = NULL;
|
747
|
+
CAMF->table.size = 0;
|
748
|
+
CAMF->tree.nodes = NULL;
|
749
|
+
CAMF->decoded_data = NULL;
|
750
|
+
CAMF->decoded_data_size = 0;
|
751
|
+
CAMF->entry_table.element = NULL;
|
752
|
+
CAMF->entry_table.size = 0;
|
753
|
+
}
|
754
|
+
|
755
|
+
/* Reset the file pointer back to the directory */
|
756
|
+
infile->seek(save_dir_pos, SEEK_SET);
|
757
|
+
}
|
758
|
+
|
759
|
+
return x3f;
|
760
|
+
}
|
761
|
+
|
762
|
+
|
763
|
+
|
764
|
+
/* --------------------------------------------------------------------- */
|
765
|
+
/* Clean up an x3f structure */
|
766
|
+
/* --------------------------------------------------------------------- */
|
767
|
+
|
768
|
+
/* extern */ x3f_return_t x3f_delete(x3f_t *x3f)
|
769
|
+
{
|
770
|
+
x3f_directory_section_t *DS;
|
771
|
+
int d;
|
772
|
+
|
773
|
+
if (x3f == NULL)
|
774
|
+
return X3F_ARGUMENT_ERROR;
|
775
|
+
|
776
|
+
DS = &x3f->directory_section;
|
777
|
+
|
778
|
+
for (d=0; d<DS->num_directory_entries; d++) {
|
779
|
+
x3f_directory_entry_t *DE = &DS->directory_entry[d];
|
780
|
+
x3f_directory_entry_header_t *DEH = &DE->header;
|
781
|
+
|
782
|
+
if (DEH->identifier == X3F_SECp) {
|
783
|
+
x3f_property_list_t *PL = &DEH->data_subsection.property_list;
|
784
|
+
|
785
|
+
FREE(PL->property_table.element);
|
786
|
+
FREE(PL->data);
|
787
|
+
}
|
788
|
+
|
789
|
+
if (DEH->identifier == X3F_SECi) {
|
790
|
+
x3f_image_data_t *ID = &DEH->data_subsection.image_data;
|
791
|
+
|
792
|
+
cleanup_huffman(&ID->huffman);
|
793
|
+
|
794
|
+
FREE(ID->data);
|
795
|
+
}
|
796
|
+
|
797
|
+
if (DEH->identifier == X3F_SECc) {
|
798
|
+
x3f_camf_t *CAMF = &DEH->data_subsection.camf;
|
799
|
+
|
800
|
+
FREE(CAMF->data);
|
801
|
+
FREE(CAMF->table.element);
|
802
|
+
cleanup_huffman_tree(&CAMF->tree);
|
803
|
+
FREE(CAMF->decoded_data);
|
804
|
+
FREE(CAMF->entry_table.element);
|
805
|
+
}
|
806
|
+
}
|
807
|
+
|
808
|
+
FREE(DS->directory_entry);
|
809
|
+
FREE(x3f);
|
810
|
+
|
811
|
+
return X3F_OK;
|
812
|
+
}
|
813
|
+
|
814
|
+
|
815
|
+
/* --------------------------------------------------------------------- */
|
816
|
+
/* Getting a reference to a directory entry */
|
817
|
+
/* --------------------------------------------------------------------- */
|
818
|
+
|
819
|
+
/* TODO: all those only get the first instance */
|
820
|
+
|
821
|
+
static x3f_directory_entry_t *x3f_get(x3f_t *x3f,
|
822
|
+
uint32_t type,
|
823
|
+
uint32_t image_type)
|
824
|
+
{
|
825
|
+
x3f_directory_section_t *DS;
|
826
|
+
int d;
|
827
|
+
|
828
|
+
if (x3f == NULL) return NULL;
|
829
|
+
|
830
|
+
DS = &x3f->directory_section;
|
831
|
+
|
832
|
+
for (d=0; d<DS->num_directory_entries; d++) {
|
833
|
+
x3f_directory_entry_t *DE = &DS->directory_entry[d];
|
834
|
+
x3f_directory_entry_header_t *DEH = &DE->header;
|
835
|
+
|
836
|
+
if (DEH->identifier == type) {
|
837
|
+
switch (DEH->identifier) {
|
838
|
+
case X3F_SECi:
|
839
|
+
{
|
840
|
+
x3f_image_data_t *ID = &DEH->data_subsection.image_data;
|
841
|
+
|
842
|
+
if (ID->type_format == image_type)
|
843
|
+
return DE;
|
844
|
+
}
|
845
|
+
break;
|
846
|
+
default:
|
847
|
+
return DE;
|
848
|
+
}
|
849
|
+
}
|
850
|
+
}
|
851
|
+
|
852
|
+
return NULL;
|
853
|
+
}
|
854
|
+
|
855
|
+
/* extern */ x3f_directory_entry_t *x3f_get_raw(x3f_t *x3f)
|
856
|
+
{
|
857
|
+
x3f_directory_entry_t *DE;
|
858
|
+
|
859
|
+
if ((DE = x3f_get(x3f, X3F_SECi, X3F_IMAGE_RAW_HUFFMAN_X530)) != NULL)
|
860
|
+
return DE;
|
861
|
+
|
862
|
+
if ((DE = x3f_get(x3f, X3F_SECi, X3F_IMAGE_RAW_HUFFMAN_10BIT)) != NULL)
|
863
|
+
return DE;
|
864
|
+
|
865
|
+
if ((DE = x3f_get(x3f, X3F_SECi, X3F_IMAGE_RAW_TRUE)) != NULL)
|
866
|
+
return DE;
|
867
|
+
|
868
|
+
if ((DE = x3f_get(x3f, X3F_SECi, X3F_IMAGE_RAW_MERRILL)) != NULL)
|
869
|
+
return DE;
|
870
|
+
|
871
|
+
if ((DE = x3f_get(x3f, X3F_SECi, X3F_IMAGE_RAW_QUATTRO)) != NULL)
|
872
|
+
return DE;
|
873
|
+
|
874
|
+
return NULL;
|
875
|
+
}
|
876
|
+
|
877
|
+
/* extern */ x3f_directory_entry_t *x3f_get_thumb_plain(x3f_t *x3f)
|
878
|
+
{
|
879
|
+
return x3f_get(x3f, X3F_SECi, X3F_IMAGE_THUMB_PLAIN);
|
880
|
+
}
|
881
|
+
|
882
|
+
/* extern */ x3f_directory_entry_t *x3f_get_thumb_huffman(x3f_t *x3f)
|
883
|
+
{
|
884
|
+
return x3f_get(x3f, X3F_SECi, X3F_IMAGE_THUMB_HUFFMAN);
|
885
|
+
}
|
886
|
+
|
887
|
+
/* extern */ x3f_directory_entry_t *x3f_get_thumb_jpeg(x3f_t *x3f)
|
888
|
+
{
|
889
|
+
return x3f_get(x3f, X3F_SECi, X3F_IMAGE_THUMB_JPEG);
|
890
|
+
}
|
891
|
+
|
892
|
+
/* extern */ x3f_directory_entry_t *x3f_get_camf(x3f_t *x3f)
|
893
|
+
{
|
894
|
+
return x3f_get(x3f, X3F_SECc, 0);
|
895
|
+
}
|
896
|
+
|
897
|
+
/* extern */ x3f_directory_entry_t *x3f_get_prop(x3f_t *x3f)
|
898
|
+
{
|
899
|
+
return x3f_get(x3f, X3F_SECp, 0);
|
900
|
+
}
|
901
|
+
|
902
|
+
/* For some obscure reason, the bit numbering is weird. It is
|
903
|
+
generally some kind of "big endian" style - e.g. the bit 7 is the
|
904
|
+
first in a byte and bit 31 first in a 4 byte int. For patterns in
|
905
|
+
the huffman pattern table, bit 27 is the first bit and bit 26 the
|
906
|
+
next one. */
|
907
|
+
|
908
|
+
#define PATTERN_BIT_POS(_len, _bit) ((_len) - (_bit) - 1)
|
909
|
+
#define MEMORY_BIT_POS(_bit) PATTERN_BIT_POS(8, _bit)
|
910
|
+
|
911
|
+
|
912
|
+
/* --------------------------------------------------------------------- */
|
913
|
+
/* Huffman Decode */
|
914
|
+
/* --------------------------------------------------------------------- */
|
915
|
+
|
916
|
+
/* Make the huffman tree */
|
917
|
+
|
918
|
+
#ifdef DBG_PRNT
|
919
|
+
static char *display_code(int length, uint32_t code, char *buffer)
|
920
|
+
{
|
921
|
+
int i;
|
922
|
+
|
923
|
+
for (i=0; i<length; i++) {
|
924
|
+
int pos = PATTERN_BIT_POS(length, i);
|
925
|
+
buffer[i] = ((code>>pos)&1) == 0 ? '0' : '1';
|
926
|
+
}
|
927
|
+
|
928
|
+
buffer[i] = 0;
|
929
|
+
|
930
|
+
return buffer;
|
931
|
+
}
|
932
|
+
#endif
|
933
|
+
|
934
|
+
static x3f_huffnode_t *new_node(x3f_hufftree_t *tree)
|
935
|
+
{
|
936
|
+
x3f_huffnode_t *t = &tree->nodes[tree->free_node_index];
|
937
|
+
|
938
|
+
t->branch[0] = NULL;
|
939
|
+
t->branch[1] = NULL;
|
940
|
+
t->leaf = UNDEFINED_LEAF;
|
941
|
+
|
942
|
+
tree->free_node_index++;
|
943
|
+
|
944
|
+
return t;
|
945
|
+
}
|
946
|
+
|
947
|
+
static void add_code_to_tree(x3f_hufftree_t *tree,
|
948
|
+
int length, uint32_t code, uint32_t value)
|
949
|
+
{
|
950
|
+
int i;
|
951
|
+
|
952
|
+
x3f_huffnode_t *t = tree->nodes;
|
953
|
+
|
954
|
+
for (i=0; i<length; i++) {
|
955
|
+
int pos = PATTERN_BIT_POS(length, i);
|
956
|
+
int bit = (code>>pos)&1;
|
957
|
+
x3f_huffnode_t *t_next = t->branch[bit];
|
958
|
+
|
959
|
+
if (t_next == NULL)
|
960
|
+
t_next = t->branch[bit] = new_node(tree);
|
961
|
+
|
962
|
+
t = t_next;
|
963
|
+
}
|
964
|
+
|
965
|
+
t->leaf = value;
|
966
|
+
}
|
967
|
+
|
968
|
+
static void populate_true_huffman_tree(x3f_hufftree_t *tree,
|
969
|
+
x3f_true_huffman_t *table)
|
970
|
+
{
|
971
|
+
int i;
|
972
|
+
|
973
|
+
new_node(tree);
|
974
|
+
|
975
|
+
for (i=0; i<table->size; i++) {
|
976
|
+
x3f_true_huffman_element_t *element = &table->element[i];
|
977
|
+
uint32_t length = element->code_size;
|
978
|
+
|
979
|
+
if (length != 0) {
|
980
|
+
/* add_code_to_tree wants the code right adjusted */
|
981
|
+
uint32_t code = ((element->code) >> (8 - length)) & 0xff;
|
982
|
+
uint32_t value = i;
|
983
|
+
|
984
|
+
add_code_to_tree(tree, length, code, value);
|
985
|
+
|
986
|
+
#ifdef DBG_PRNT
|
987
|
+
{
|
988
|
+
char buffer[100];
|
989
|
+
|
990
|
+
printf("H %5d : %5x : %5d : %02x %08x (%08x) (%s)\n",
|
991
|
+
i, i, value, length, code, value,
|
992
|
+
display_code(length, code, buffer));
|
993
|
+
}
|
994
|
+
#endif
|
995
|
+
}
|
996
|
+
}
|
997
|
+
}
|
998
|
+
|
999
|
+
static void populate_huffman_tree(x3f_hufftree_t *tree,
|
1000
|
+
x3f_table32_t *table,
|
1001
|
+
x3f_table16_t *mapping)
|
1002
|
+
{
|
1003
|
+
int i;
|
1004
|
+
|
1005
|
+
new_node(tree);
|
1006
|
+
|
1007
|
+
for (i=0; i<table->size; i++) {
|
1008
|
+
uint32_t element = table->element[i];
|
1009
|
+
|
1010
|
+
if (element != 0) {
|
1011
|
+
uint32_t length = HUF_TREE_GET_LENGTH(element);
|
1012
|
+
uint32_t code = HUF_TREE_GET_CODE(element);
|
1013
|
+
uint32_t value;
|
1014
|
+
|
1015
|
+
/* If we have a valid mapping table - then the value from the
|
1016
|
+
mapping table shall be used. Otherwise we use the current
|
1017
|
+
index in the table as value. */
|
1018
|
+
if (table->size == mapping->size)
|
1019
|
+
value = mapping->element[i];
|
1020
|
+
else
|
1021
|
+
value = i;
|
1022
|
+
|
1023
|
+
add_code_to_tree(tree, length, code, value);
|
1024
|
+
|
1025
|
+
#ifdef DBG_PRNT
|
1026
|
+
{
|
1027
|
+
char buffer[100];
|
1028
|
+
|
1029
|
+
printf("H %5d : %5x : %5d : %02x %08x (%08x) (%s)\n",
|
1030
|
+
i, i, value, length, code, element,
|
1031
|
+
display_code(length, code, buffer));
|
1032
|
+
}
|
1033
|
+
#endif
|
1034
|
+
}
|
1035
|
+
}
|
1036
|
+
}
|
1037
|
+
|
1038
|
+
#ifdef DBG_PRNT
|
1039
|
+
static void print_huffman_tree(x3f_huffnode_t *t, int length, uint32_t code)
|
1040
|
+
{
|
1041
|
+
char buf1[100];
|
1042
|
+
char buf2[100];
|
1043
|
+
|
1044
|
+
printf("%*s (%s,%s) %s (%s)\n",
|
1045
|
+
length, length < 1 ? "-" : (code&1) ? "1" : "0",
|
1046
|
+
t->branch[0]==NULL ? "-" : "0",
|
1047
|
+
t->branch[1]==NULL ? "-" : "1",
|
1048
|
+
t->leaf==UNDEFINED_LEAF ? "-" : (sprintf(buf1, "%x", t->leaf),buf1),
|
1049
|
+
display_code(length, code, buf2));
|
1050
|
+
|
1051
|
+
code = code << 1;
|
1052
|
+
if (t->branch[0]) print_huffman_tree(t->branch[0], length+1, code+0);
|
1053
|
+
if (t->branch[1]) print_huffman_tree(t->branch[1], length+1, code+1);
|
1054
|
+
}
|
1055
|
+
#endif
|
1056
|
+
|
1057
|
+
/* Help machinery for reading bits in a memory */
|
1058
|
+
|
1059
|
+
typedef struct bit_state_s {
|
1060
|
+
uint8_t *next_address;
|
1061
|
+
uint8_t bit_offset;
|
1062
|
+
uint8_t bits[8];
|
1063
|
+
} bit_state_t;
|
1064
|
+
|
1065
|
+
static void set_bit_state(bit_state_t *BS, uint8_t *address)
|
1066
|
+
{
|
1067
|
+
BS->next_address = address;
|
1068
|
+
BS->bit_offset = 8;
|
1069
|
+
}
|
1070
|
+
|
1071
|
+
static uint8_t get_bit(bit_state_t *BS)
|
1072
|
+
{
|
1073
|
+
if (BS->bit_offset == 8) {
|
1074
|
+
uint8_t byte = *BS->next_address;
|
1075
|
+
int i;
|
1076
|
+
|
1077
|
+
for (i=7; i>= 0; i--) {
|
1078
|
+
BS->bits[i] = byte&1;
|
1079
|
+
byte = byte >> 1;
|
1080
|
+
}
|
1081
|
+
BS->next_address++;
|
1082
|
+
BS->bit_offset = 0;
|
1083
|
+
}
|
1084
|
+
|
1085
|
+
return BS->bits[BS->bit_offset++];
|
1086
|
+
}
|
1087
|
+
|
1088
|
+
/* Decode use the TRUE algorithm */
|
1089
|
+
|
1090
|
+
static int32_t get_true_diff(bit_state_t *BS, x3f_hufftree_t *HTP)
|
1091
|
+
{
|
1092
|
+
int32_t diff;
|
1093
|
+
x3f_huffnode_t *node = &HTP->nodes[0];
|
1094
|
+
uint8_t bits;
|
1095
|
+
|
1096
|
+
while (node->branch[0] != NULL || node->branch[1] != NULL) {
|
1097
|
+
uint8_t bit = get_bit(BS);
|
1098
|
+
x3f_huffnode_t *new_node = node->branch[bit];
|
1099
|
+
|
1100
|
+
node = new_node;
|
1101
|
+
if (node == NULL) {
|
1102
|
+
#ifdef DCRAW_VERBOSE
|
1103
|
+
fprintf(stderr, "Huffman coding got unexpected bit\n");
|
1104
|
+
#endif
|
1105
|
+
return 0;
|
1106
|
+
}
|
1107
|
+
}
|
1108
|
+
|
1109
|
+
bits = node->leaf;
|
1110
|
+
|
1111
|
+
if (bits == 0)
|
1112
|
+
diff = 0;
|
1113
|
+
else {
|
1114
|
+
uint8_t first_bit = get_bit(BS);
|
1115
|
+
int i;
|
1116
|
+
|
1117
|
+
diff = first_bit;
|
1118
|
+
|
1119
|
+
for (i=1; i<bits; i++)
|
1120
|
+
diff = (diff << 1) + get_bit(BS);
|
1121
|
+
|
1122
|
+
if (first_bit == 0)
|
1123
|
+
diff -= (1<<bits) - 1;
|
1124
|
+
}
|
1125
|
+
|
1126
|
+
return diff;
|
1127
|
+
}
|
1128
|
+
|
1129
|
+
/* This code (that decodes one of the X3F color planes, really is a
|
1130
|
+
decoding of a compression algorithm suited for Bayer CFA data. In
|
1131
|
+
Bayer CFA the data is divided into 2x2 squares that represents
|
1132
|
+
(R,G1,G2,B) data. Those four positions are (in this compression)
|
1133
|
+
treated as one data stream each, where you store the differences to
|
1134
|
+
previous data in the stream. The reason for this is, of course,
|
1135
|
+
that the date is more often than not near to the next data in a
|
1136
|
+
stream that represents the same color. */
|
1137
|
+
|
1138
|
+
/* TODO: write more about the compression */
|
1139
|
+
|
1140
|
+
static void true_decode_one_color(x3f_image_data_t *ID, int color)
|
1141
|
+
{
|
1142
|
+
x3f_true_t *TRU = ID->tru;
|
1143
|
+
uint32_t seed = TRU->seed[color]; /* TODO : Is this correct ? */
|
1144
|
+
int row;
|
1145
|
+
|
1146
|
+
x3f_hufftree_t *tree = &TRU->tree;
|
1147
|
+
bit_state_t BS;
|
1148
|
+
|
1149
|
+
int32_t row_start_acc[2][2];
|
1150
|
+
uint32_t rows = ID->rows;
|
1151
|
+
uint32_t cols = ID->columns;
|
1152
|
+
uint32_t out_cols = ID->columns;
|
1153
|
+
|
1154
|
+
|
1155
|
+
set_bit_state(&BS, TRU->plane_address[color]);
|
1156
|
+
|
1157
|
+
row_start_acc[0][0] = seed;
|
1158
|
+
row_start_acc[0][1] = seed;
|
1159
|
+
row_start_acc[1][0] = seed;
|
1160
|
+
row_start_acc[1][1] = seed;
|
1161
|
+
|
1162
|
+
|
1163
|
+
int datastep = 1;
|
1164
|
+
|
1165
|
+
if (ID->type_format == X3F_IMAGE_RAW_QUATTRO) {
|
1166
|
+
if(ID->quattro->plane[color].rows < (rows/2)+16)
|
1167
|
+
{
|
1168
|
+
// Half sized layer
|
1169
|
+
datastep = 2;
|
1170
|
+
}
|
1171
|
+
rows = ID->quattro->plane[color].rows;
|
1172
|
+
cols = ID->quattro->plane[color].columns;
|
1173
|
+
}
|
1174
|
+
|
1175
|
+
|
1176
|
+
for (row = 0; row < rows; row++)
|
1177
|
+
{
|
1178
|
+
uint16_t *dst = TRU->x3rgb16.element + row * out_cols * 3 * datastep+ color;
|
1179
|
+
int col;
|
1180
|
+
bool_t odd_row = row&1;
|
1181
|
+
int32_t acc[2];
|
1182
|
+
for (col = 0; col < cols; col++)
|
1183
|
+
{
|
1184
|
+
bool_t odd_col = col&1;
|
1185
|
+
int32_t diff = get_true_diff(&BS, tree);
|
1186
|
+
int32_t prev = col < 2 ? row_start_acc[odd_row][odd_col] : acc[odd_col];
|
1187
|
+
int32_t value = prev + diff;
|
1188
|
+
acc[odd_col] = value;
|
1189
|
+
if (col < 2)
|
1190
|
+
row_start_acc[odd_row][odd_col] = value;
|
1191
|
+
if (col < out_cols)
|
1192
|
+
{
|
1193
|
+
/* For quattro the input may be larger than the output */
|
1194
|
+
*dst = value;
|
1195
|
+
dst += 3*datastep;
|
1196
|
+
}
|
1197
|
+
}
|
1198
|
+
}
|
1199
|
+
}
|
1200
|
+
|
1201
|
+
static void true_decode(x3f_info_t *I,
|
1202
|
+
x3f_directory_entry_t *DE)
|
1203
|
+
{
|
1204
|
+
x3f_directory_entry_header_t *DEH = &DE->header;
|
1205
|
+
x3f_image_data_t *ID = &DEH->data_subsection.image_data;
|
1206
|
+
int color;
|
1207
|
+
|
1208
|
+
for (color = 0; color < 3; color++) {
|
1209
|
+
true_decode_one_color(ID, color);
|
1210
|
+
}
|
1211
|
+
}
|
1212
|
+
|
1213
|
+
/* Decode use the huffman tree */
|
1214
|
+
|
1215
|
+
static int32_t get_huffman_diff(bit_state_t *BS, x3f_hufftree_t *HTP)
|
1216
|
+
{
|
1217
|
+
int32_t diff;
|
1218
|
+
x3f_huffnode_t *node = &HTP->nodes[0];
|
1219
|
+
|
1220
|
+
while (node->branch[0] != NULL || node->branch[1] != NULL) {
|
1221
|
+
uint8_t bit = get_bit(BS);
|
1222
|
+
x3f_huffnode_t *new_node = node->branch[bit];
|
1223
|
+
|
1224
|
+
node = new_node;
|
1225
|
+
if (node == NULL) {
|
1226
|
+
#ifdef DCRAW_VERBOSE
|
1227
|
+
fprintf(stderr, "Huffman coding got unexpected bit\n");
|
1228
|
+
#endif
|
1229
|
+
return 0;
|
1230
|
+
}
|
1231
|
+
}
|
1232
|
+
|
1233
|
+
diff = node->leaf;
|
1234
|
+
|
1235
|
+
return diff;
|
1236
|
+
}
|
1237
|
+
|
1238
|
+
static void huffman_decode_row(x3f_info_t *I,
|
1239
|
+
x3f_directory_entry_t *DE,
|
1240
|
+
int bits,
|
1241
|
+
int row,
|
1242
|
+
int offset,
|
1243
|
+
int *minimum)
|
1244
|
+
{
|
1245
|
+
x3f_directory_entry_header_t *DEH = &DE->header;
|
1246
|
+
x3f_image_data_t *ID = &DEH->data_subsection.image_data;
|
1247
|
+
x3f_huffman_t *HUF = ID->huffman;
|
1248
|
+
|
1249
|
+
int16_t c[3] = {offset,offset,offset};
|
1250
|
+
int col;
|
1251
|
+
bit_state_t BS;
|
1252
|
+
|
1253
|
+
set_bit_state(&BS, ((unsigned char*)ID->data) + HUF->row_offsets.element[row]);
|
1254
|
+
|
1255
|
+
for (col = 0; col < ID->columns; col++) {
|
1256
|
+
int color;
|
1257
|
+
|
1258
|
+
for (color = 0; color < 3; color++) {
|
1259
|
+
uint16_t c_fix;
|
1260
|
+
|
1261
|
+
c[color] += get_huffman_diff(&BS, &HUF->tree);
|
1262
|
+
if (c[color] < 0) {
|
1263
|
+
c_fix = 0;
|
1264
|
+
if (c[color] < *minimum)
|
1265
|
+
*minimum = c[color];
|
1266
|
+
} else {
|
1267
|
+
c_fix = c[color];
|
1268
|
+
}
|
1269
|
+
|
1270
|
+
switch (ID->type_format) {
|
1271
|
+
case X3F_IMAGE_RAW_HUFFMAN_X530:
|
1272
|
+
case X3F_IMAGE_RAW_HUFFMAN_10BIT:
|
1273
|
+
HUF->x3rgb16.element[3*(row*ID->columns + col) + color] = (uint16_t)c_fix;
|
1274
|
+
break;
|
1275
|
+
case X3F_IMAGE_THUMB_HUFFMAN:
|
1276
|
+
HUF->rgb8.element[3*(row*ID->columns + col) + color] = (uint8_t)c_fix;
|
1277
|
+
break;
|
1278
|
+
default:
|
1279
|
+
#ifdef DCRAW_VERBOSE
|
1280
|
+
fprintf(stderr, "Unknown huffman image type\n");
|
1281
|
+
#endif
|
1282
|
+
break;
|
1283
|
+
}
|
1284
|
+
}
|
1285
|
+
}
|
1286
|
+
}
|
1287
|
+
|
1288
|
+
static void huffman_decode(x3f_info_t *I,
|
1289
|
+
x3f_directory_entry_t *DE,
|
1290
|
+
int bits)
|
1291
|
+
{
|
1292
|
+
x3f_directory_entry_header_t *DEH = &DE->header;
|
1293
|
+
x3f_image_data_t *ID = &DEH->data_subsection.image_data;
|
1294
|
+
|
1295
|
+
int row;
|
1296
|
+
int minimum = 0;
|
1297
|
+
int offset = legacy_offset;
|
1298
|
+
|
1299
|
+
#ifdef DCRAW_VERBOSE
|
1300
|
+
printf("Huffman decode with offset: %d\n", offset);
|
1301
|
+
#endif
|
1302
|
+
for (row = 0; row < ID->rows; row++)
|
1303
|
+
huffman_decode_row(I, DE, bits, row, offset, &minimum);
|
1304
|
+
|
1305
|
+
if (auto_legacy_offset && minimum < 0) {
|
1306
|
+
offset = -minimum;
|
1307
|
+
#ifdef DCRAW_VERBOSE
|
1308
|
+
printf("Redo with offset: %d\n", offset);
|
1309
|
+
#endif
|
1310
|
+
for (row = 0; row < ID->rows; row++)
|
1311
|
+
huffman_decode_row(I, DE, bits, row, offset, &minimum);
|
1312
|
+
}
|
1313
|
+
}
|
1314
|
+
|
1315
|
+
static int32_t get_simple_diff(x3f_huffman_t *HUF, uint16_t index)
|
1316
|
+
{
|
1317
|
+
if (HUF->mapping.size == 0)
|
1318
|
+
return index;
|
1319
|
+
else
|
1320
|
+
return HUF->mapping.element[index];
|
1321
|
+
}
|
1322
|
+
|
1323
|
+
static void simple_decode_row(x3f_info_t *I,
|
1324
|
+
x3f_directory_entry_t *DE,
|
1325
|
+
int bits,
|
1326
|
+
int row,
|
1327
|
+
int row_stride)
|
1328
|
+
{
|
1329
|
+
x3f_directory_entry_header_t *DEH = &DE->header;
|
1330
|
+
x3f_image_data_t *ID = &DEH->data_subsection.image_data;
|
1331
|
+
x3f_huffman_t *HUF = ID->huffman;
|
1332
|
+
|
1333
|
+
uint32_t *data = (uint32_t *)((unsigned char*)ID->data + row*row_stride);
|
1334
|
+
|
1335
|
+
uint16_t c[3] = {0,0,0};
|
1336
|
+
int col;
|
1337
|
+
|
1338
|
+
uint32_t mask = 0;
|
1339
|
+
|
1340
|
+
switch (bits) {
|
1341
|
+
case 8:
|
1342
|
+
mask = 0x0ff;
|
1343
|
+
break;
|
1344
|
+
case 9:
|
1345
|
+
mask = 0x1ff;
|
1346
|
+
break;
|
1347
|
+
case 10:
|
1348
|
+
mask = 0x3ff;
|
1349
|
+
break;
|
1350
|
+
case 11:
|
1351
|
+
mask = 0x7ff;
|
1352
|
+
break;
|
1353
|
+
case 12:
|
1354
|
+
mask = 0xfff;
|
1355
|
+
break;
|
1356
|
+
default:
|
1357
|
+
#ifdef DCRAW_VERBOSE
|
1358
|
+
fprintf(stderr, "Unknown number of bits: %d\n", bits);
|
1359
|
+
#endif
|
1360
|
+
mask = 0;
|
1361
|
+
break;
|
1362
|
+
}
|
1363
|
+
|
1364
|
+
for (col = 0; col < ID->columns; col++) {
|
1365
|
+
int color;
|
1366
|
+
uint32_t val = data[col];
|
1367
|
+
|
1368
|
+
for (color = 0; color < 3; color++) {
|
1369
|
+
uint16_t c_fix;
|
1370
|
+
c[color] += get_simple_diff(HUF, (val>>(color*bits))&mask);
|
1371
|
+
|
1372
|
+
switch (ID->type_format) {
|
1373
|
+
case X3F_IMAGE_RAW_HUFFMAN_X530:
|
1374
|
+
case X3F_IMAGE_RAW_HUFFMAN_10BIT:
|
1375
|
+
c_fix = (int16_t)c[color] > 0 ? c[color] : 0;
|
1376
|
+
|
1377
|
+
HUF->x3rgb16.element[3*(row*ID->columns + col) + color] = c_fix;
|
1378
|
+
break;
|
1379
|
+
case X3F_IMAGE_THUMB_HUFFMAN:
|
1380
|
+
c_fix = (int8_t)c[color] > 0 ? c[color] : 0;
|
1381
|
+
|
1382
|
+
HUF->rgb8.element[3*(row*ID->columns + col) + color] = c_fix;
|
1383
|
+
break;
|
1384
|
+
default:
|
1385
|
+
#ifdef DCRAW_VERBOSE
|
1386
|
+
fprintf(stderr, "Unknown huffman image type\n");
|
1387
|
+
#endif
|
1388
|
+
break;
|
1389
|
+
}
|
1390
|
+
}
|
1391
|
+
}
|
1392
|
+
}
|
1393
|
+
|
1394
|
+
static void simple_decode(x3f_info_t *I,
|
1395
|
+
x3f_directory_entry_t *DE,
|
1396
|
+
int bits,
|
1397
|
+
int row_stride)
|
1398
|
+
{
|
1399
|
+
x3f_directory_entry_header_t *DEH = &DE->header;
|
1400
|
+
x3f_image_data_t *ID = &DEH->data_subsection.image_data;
|
1401
|
+
|
1402
|
+
int row;
|
1403
|
+
|
1404
|
+
for (row = 0; row < ID->rows; row++)
|
1405
|
+
simple_decode_row(I, DE, bits, row, row_stride);
|
1406
|
+
}
|
1407
|
+
|
1408
|
+
/* --------------------------------------------------------------------- */
|
1409
|
+
/* Loading the data in a directory entry */
|
1410
|
+
/* --------------------------------------------------------------------- */
|
1411
|
+
|
1412
|
+
/* First you set the offset to where to start reading the data ... */
|
1413
|
+
|
1414
|
+
static void read_data_set_offset(x3f_info_t *I,
|
1415
|
+
x3f_directory_entry_t *DE,
|
1416
|
+
uint32_t header_size)
|
1417
|
+
{
|
1418
|
+
uint32_t i_off = DE->input.offset + header_size;
|
1419
|
+
|
1420
|
+
I->input.file->seek(i_off, SEEK_SET);
|
1421
|
+
}
|
1422
|
+
|
1423
|
+
/* ... then you read the data, block for block */
|
1424
|
+
|
1425
|
+
static uint32_t read_data_block(void **data,
|
1426
|
+
x3f_info_t *I,
|
1427
|
+
x3f_directory_entry_t *DE,
|
1428
|
+
uint32_t footer)
|
1429
|
+
{
|
1430
|
+
uint32_t size =
|
1431
|
+
DE->input.size + DE->input.offset - I->input.file->tell() - footer;
|
1432
|
+
|
1433
|
+
*data = (void *)malloc(size);
|
1434
|
+
|
1435
|
+
GETN(*data, size);
|
1436
|
+
|
1437
|
+
return size;
|
1438
|
+
}
|
1439
|
+
|
1440
|
+
static void x3f_load_image_verbatim(x3f_info_t *I, x3f_directory_entry_t *DE)
|
1441
|
+
{
|
1442
|
+
x3f_directory_entry_header_t *DEH = &DE->header;
|
1443
|
+
x3f_image_data_t *ID = &DEH->data_subsection.image_data;
|
1444
|
+
|
1445
|
+
#ifdef DCRAW_VERBOSE
|
1446
|
+
printf("Load image verbatim\n");
|
1447
|
+
#endif
|
1448
|
+
|
1449
|
+
ID->data_size = read_data_block((void**)&ID->data, I, DE, 0);
|
1450
|
+
}
|
1451
|
+
|
1452
|
+
static void x3f_load_property_list(x3f_info_t *I, x3f_directory_entry_t *DE)
|
1453
|
+
{
|
1454
|
+
x3f_directory_entry_header_t *DEH = &DE->header;
|
1455
|
+
x3f_property_list_t *PL = &DEH->data_subsection.property_list;
|
1456
|
+
|
1457
|
+
int i;
|
1458
|
+
|
1459
|
+
read_data_set_offset(I, DE, X3F_PROPERTY_LIST_HEADER_SIZE);
|
1460
|
+
|
1461
|
+
GET_PROPERTY_TABLE(PL->property_table, PL->num_properties);
|
1462
|
+
|
1463
|
+
PL->data_size = read_data_block(&PL->data, I, DE, 0);
|
1464
|
+
|
1465
|
+
for (i=0; i<PL->num_properties; i++) {
|
1466
|
+
x3f_property_t *P = &PL->property_table.element[i];
|
1467
|
+
|
1468
|
+
P->name = ((utf16_t *)PL->data + P->name_offset);
|
1469
|
+
P->value = ((utf16_t *)PL->data + P->value_offset);
|
1470
|
+
}
|
1471
|
+
}
|
1472
|
+
|
1473
|
+
static void x3f_load_true(x3f_info_t *I,
|
1474
|
+
x3f_directory_entry_t *DE)
|
1475
|
+
{
|
1476
|
+
x3f_directory_entry_header_t *DEH = &DE->header;
|
1477
|
+
x3f_image_data_t *ID = &DEH->data_subsection.image_data;
|
1478
|
+
x3f_true_t *TRU = new_true(&ID->tru);
|
1479
|
+
x3f_quattro_t *Q = NULL;
|
1480
|
+
int i;
|
1481
|
+
|
1482
|
+
if (ID->type_format == X3F_IMAGE_RAW_QUATTRO) {
|
1483
|
+
#ifdef DCRAW_VERBOSE
|
1484
|
+
printf("Load Quattro extra info\n");
|
1485
|
+
#endif
|
1486
|
+
Q = new_quattro(&ID->quattro);
|
1487
|
+
|
1488
|
+
for (i=0; i<TRUE_PLANES; i++) {
|
1489
|
+
GET2(Q->plane[i].columns);
|
1490
|
+
GET2(Q->plane[i].rows);
|
1491
|
+
}
|
1492
|
+
}
|
1493
|
+
#ifdef DCRAW_VERBOSE
|
1494
|
+
printf("Load TRUE\n");
|
1495
|
+
#endif
|
1496
|
+
|
1497
|
+
/* Read TRUE header data */
|
1498
|
+
GET2(TRU->seed[0]); /* TODO : should it always be 512 ?? */
|
1499
|
+
GET2(TRU->seed[1]); /* TODO : should it always be 512 ?? */
|
1500
|
+
GET2(TRU->seed[2]); /* TODO : should it always be 512 ?? */
|
1501
|
+
GET2(TRU->unknown); /* TODO : should it always be zero ?? */
|
1502
|
+
GET_TRUE_HUFF_TABLE(TRU->table);
|
1503
|
+
|
1504
|
+
if (ID->type_format == X3F_IMAGE_RAW_QUATTRO) {
|
1505
|
+
#ifdef DCRAW_VERBOSE
|
1506
|
+
printf("Load Quattro extra info 2\n");
|
1507
|
+
#endif
|
1508
|
+
GET4(Q->unknown);
|
1509
|
+
}
|
1510
|
+
|
1511
|
+
GET_TABLE(TRU->plane_size, GET4, TRUE_PLANES,uint32_t);
|
1512
|
+
|
1513
|
+
/* Read image data */
|
1514
|
+
ID->data_size = read_data_block(&ID->data, I, DE, 0);
|
1515
|
+
|
1516
|
+
/* TODO: can it be fewer than 8 bits? Maybe taken from TRU->table? */
|
1517
|
+
new_huffman_tree(&TRU->tree, 8);
|
1518
|
+
|
1519
|
+
populate_true_huffman_tree(&TRU->tree, &TRU->table);
|
1520
|
+
|
1521
|
+
#ifdef DBG_PRNT
|
1522
|
+
print_huffman_tree(TRU->tree.nodes, 0, 0);
|
1523
|
+
#endif
|
1524
|
+
|
1525
|
+
TRU->plane_address[0] = (uint8_t*)ID->data;
|
1526
|
+
for (i=1; i<TRUE_PLANES; i++)
|
1527
|
+
TRU->plane_address[i] =
|
1528
|
+
TRU->plane_address[i-1] +
|
1529
|
+
(((TRU->plane_size.element[i-1] + 15) / 16) * 16);
|
1530
|
+
|
1531
|
+
TRU->x3rgb16.size = ID->columns * ID->rows * 3;
|
1532
|
+
TRU->x3rgb16.element =
|
1533
|
+
(uint16_t *)malloc(sizeof(uint16_t)*TRU->x3rgb16.size);
|
1534
|
+
|
1535
|
+
true_decode(I, DE);
|
1536
|
+
}
|
1537
|
+
|
1538
|
+
static void x3f_load_huffman_compressed(x3f_info_t *I,
|
1539
|
+
x3f_directory_entry_t *DE,
|
1540
|
+
int bits,
|
1541
|
+
int use_map_table)
|
1542
|
+
{
|
1543
|
+
x3f_directory_entry_header_t *DEH = &DE->header;
|
1544
|
+
x3f_image_data_t *ID = &DEH->data_subsection.image_data;
|
1545
|
+
x3f_huffman_t *HUF = ID->huffman;
|
1546
|
+
int table_size = 1<<bits;
|
1547
|
+
int row_offsets_size = ID->rows * sizeof(HUF->row_offsets.element[0]);
|
1548
|
+
|
1549
|
+
#ifdef DCRAW_VERBOSE
|
1550
|
+
printf("Load huffman compressed\n");
|
1551
|
+
#endif
|
1552
|
+
GET_TABLE(HUF->table, GET4, table_size,uint32_t);
|
1553
|
+
|
1554
|
+
ID->data_size = read_data_block(&ID->data, I, DE, row_offsets_size);
|
1555
|
+
|
1556
|
+
GET_TABLE(HUF->row_offsets, GET4, ID->rows,uint32_t);
|
1557
|
+
#ifdef DCRAW_VERBOSE
|
1558
|
+
printf("Make huffman tree ...\n");
|
1559
|
+
#endif
|
1560
|
+
new_huffman_tree(&HUF->tree, bits);
|
1561
|
+
populate_huffman_tree(&HUF->tree, &HUF->table, &HUF->mapping);
|
1562
|
+
#ifdef DCRAW_VERBOSE
|
1563
|
+
printf("... DONE\n");
|
1564
|
+
#endif
|
1565
|
+
#ifdef DBG_PRNT
|
1566
|
+
print_huffman_tree(HUF->tree.nodes, 0, 0);
|
1567
|
+
#endif
|
1568
|
+
|
1569
|
+
huffman_decode(I, DE, bits);
|
1570
|
+
}
|
1571
|
+
|
1572
|
+
static void x3f_load_huffman_not_compressed(x3f_info_t *I,
|
1573
|
+
x3f_directory_entry_t *DE,
|
1574
|
+
int bits,
|
1575
|
+
int use_map_table,
|
1576
|
+
int row_stride)
|
1577
|
+
{
|
1578
|
+
x3f_directory_entry_header_t *DEH = &DE->header;
|
1579
|
+
x3f_image_data_t *ID = &DEH->data_subsection.image_data;
|
1580
|
+
#ifdef DCRAW_VERBOSE
|
1581
|
+
printf("Load huffman not compressed\n");
|
1582
|
+
#endif
|
1583
|
+
ID->data_size = read_data_block(&ID->data, I, DE, 0);
|
1584
|
+
|
1585
|
+
simple_decode(I, DE, bits, row_stride);
|
1586
|
+
}
|
1587
|
+
|
1588
|
+
static void x3f_load_huffman(x3f_info_t *I,
|
1589
|
+
x3f_directory_entry_t *DE,
|
1590
|
+
int bits,
|
1591
|
+
int use_map_table,
|
1592
|
+
int row_stride)
|
1593
|
+
{
|
1594
|
+
x3f_directory_entry_header_t *DEH = &DE->header;
|
1595
|
+
x3f_image_data_t *ID = &DEH->data_subsection.image_data;
|
1596
|
+
x3f_huffman_t *HUF = new_huffman(&ID->huffman);
|
1597
|
+
|
1598
|
+
if (use_map_table) {
|
1599
|
+
int table_size = 1<<bits;
|
1600
|
+
|
1601
|
+
GET_TABLE(HUF->mapping, GET2, table_size,uint16_t);
|
1602
|
+
}
|
1603
|
+
|
1604
|
+
switch (ID->type_format) {
|
1605
|
+
case X3F_IMAGE_RAW_HUFFMAN_X530:
|
1606
|
+
case X3F_IMAGE_RAW_HUFFMAN_10BIT:
|
1607
|
+
HUF->x3rgb16.size = ID->columns * ID->rows * 3;
|
1608
|
+
HUF->x3rgb16.element =
|
1609
|
+
(uint16_t *)malloc(sizeof(uint16_t)*HUF->x3rgb16.size);
|
1610
|
+
break;
|
1611
|
+
case X3F_IMAGE_THUMB_HUFFMAN:
|
1612
|
+
HUF->rgb8.size = ID->columns * ID->rows * 3;
|
1613
|
+
HUF->rgb8.element =
|
1614
|
+
(uint8_t *)malloc(sizeof(uint8_t)*HUF->rgb8.size);
|
1615
|
+
break;
|
1616
|
+
default:
|
1617
|
+
#ifdef DCRAW_VERBOSE
|
1618
|
+
fprintf(stderr, "Unknown huffman image type\n");
|
1619
|
+
#endif
|
1620
|
+
break;
|
1621
|
+
}
|
1622
|
+
|
1623
|
+
if (row_stride == 0)
|
1624
|
+
return x3f_load_huffman_compressed(I, DE, bits, use_map_table);
|
1625
|
+
else
|
1626
|
+
return x3f_load_huffman_not_compressed(I, DE, bits, use_map_table, row_stride);
|
1627
|
+
}
|
1628
|
+
|
1629
|
+
static void x3f_load_pixmap(x3f_info_t *I, x3f_directory_entry_t *DE)
|
1630
|
+
{
|
1631
|
+
x3f_load_image_verbatim(I, DE);
|
1632
|
+
}
|
1633
|
+
|
1634
|
+
static void x3f_load_jpeg(x3f_info_t *I, x3f_directory_entry_t *DE)
|
1635
|
+
{
|
1636
|
+
x3f_load_image_verbatim(I, DE);
|
1637
|
+
}
|
1638
|
+
|
1639
|
+
static void x3f_load_image(x3f_info_t *I, x3f_directory_entry_t *DE)
|
1640
|
+
{
|
1641
|
+
x3f_directory_entry_header_t *DEH = &DE->header;
|
1642
|
+
x3f_image_data_t *ID = &DEH->data_subsection.image_data;
|
1643
|
+
|
1644
|
+
read_data_set_offset(I, DE, X3F_IMAGE_HEADER_SIZE);
|
1645
|
+
|
1646
|
+
switch (ID->type_format) {
|
1647
|
+
case X3F_IMAGE_RAW_TRUE:
|
1648
|
+
case X3F_IMAGE_RAW_MERRILL:
|
1649
|
+
case X3F_IMAGE_RAW_QUATTRO:
|
1650
|
+
x3f_load_true(I, DE);
|
1651
|
+
break;
|
1652
|
+
case X3F_IMAGE_RAW_HUFFMAN_X530:
|
1653
|
+
case X3F_IMAGE_RAW_HUFFMAN_10BIT:
|
1654
|
+
x3f_load_huffman(I, DE, 10, 1, ID->row_stride);
|
1655
|
+
break;
|
1656
|
+
case X3F_IMAGE_THUMB_PLAIN:
|
1657
|
+
x3f_load_pixmap(I, DE);
|
1658
|
+
break;
|
1659
|
+
case X3F_IMAGE_THUMB_HUFFMAN:
|
1660
|
+
x3f_load_huffman(I, DE, 8, 0, ID->row_stride);
|
1661
|
+
break;
|
1662
|
+
case X3F_IMAGE_THUMB_JPEG:
|
1663
|
+
x3f_load_jpeg(I, DE);
|
1664
|
+
break;
|
1665
|
+
default:
|
1666
|
+
#ifdef DCRAW_VERBOSE
|
1667
|
+
fprintf(stderr, "Unknown image type\n");
|
1668
|
+
#endif
|
1669
|
+
break;
|
1670
|
+
}
|
1671
|
+
}
|
1672
|
+
|
1673
|
+
static void x3f_load_camf_decode_type2(x3f_camf_t *CAMF)
|
1674
|
+
{
|
1675
|
+
uint32_t key = CAMF->t2.crypt_key;
|
1676
|
+
int i;
|
1677
|
+
|
1678
|
+
CAMF->decoded_data_size = CAMF->data_size;
|
1679
|
+
CAMF->decoded_data = malloc(CAMF->decoded_data_size);
|
1680
|
+
|
1681
|
+
for (i=0; i<CAMF->data_size; i++) {
|
1682
|
+
uint8_t old, _new;
|
1683
|
+
uint32_t tmp;
|
1684
|
+
|
1685
|
+
old = ((uint8_t *)CAMF->data)[i];
|
1686
|
+
key = (key * 1597 + 51749) % 244944;
|
1687
|
+
tmp = (uint32_t)(key * ((int64_t)301593171) >> 24);
|
1688
|
+
_new = (uint8_t)(old ^ (uint8_t)(((((key << 8) - tmp) >> 1) + tmp) >> 17));
|
1689
|
+
((uint8_t *)CAMF->decoded_data)[i] = _new;
|
1690
|
+
}
|
1691
|
+
}
|
1692
|
+
|
1693
|
+
|
1694
|
+
/* NOTE: the unpacking in this code is in big respects identical to
|
1695
|
+
true_decode_one_color(). The difference is in the output you
|
1696
|
+
build. It might be possible to make some parts shared. NOTE ALSO:
|
1697
|
+
This means that the meta data is obfuscated using an image
|
1698
|
+
compression algorithm. */
|
1699
|
+
|
1700
|
+
static void camf_decode_type4(x3f_camf_t *CAMF)
|
1701
|
+
{
|
1702
|
+
uint32_t seed = CAMF->t4.decode_bias;
|
1703
|
+
int row;
|
1704
|
+
|
1705
|
+
uint8_t *dst;
|
1706
|
+
bool_t odd_dst = 0;
|
1707
|
+
|
1708
|
+
x3f_hufftree_t *tree = &CAMF->tree;
|
1709
|
+
bit_state_t BS;
|
1710
|
+
|
1711
|
+
int32_t row_start_acc[2][2];
|
1712
|
+
uint32_t rows = CAMF->t4.block_count;
|
1713
|
+
uint32_t cols = CAMF->t4.block_size;
|
1714
|
+
|
1715
|
+
CAMF->decoded_data_size = (cols * rows * 3) / 2;
|
1716
|
+
CAMF->decoded_data = malloc(CAMF->decoded_data_size);
|
1717
|
+
|
1718
|
+
dst = (uint8_t *)CAMF->decoded_data;
|
1719
|
+
|
1720
|
+
set_bit_state(&BS, CAMF->decoding_start);
|
1721
|
+
|
1722
|
+
row_start_acc[0][0] = seed;
|
1723
|
+
row_start_acc[0][1] = seed;
|
1724
|
+
row_start_acc[1][0] = seed;
|
1725
|
+
row_start_acc[1][1] = seed;
|
1726
|
+
|
1727
|
+
for (row = 0; row < rows; row++) {
|
1728
|
+
int col;
|
1729
|
+
bool_t odd_row = row&1;
|
1730
|
+
int32_t acc[2];
|
1731
|
+
|
1732
|
+
for (col = 0; col < cols; col++) {
|
1733
|
+
bool_t odd_col = col&1;
|
1734
|
+
int32_t diff = get_true_diff(&BS, tree);
|
1735
|
+
int32_t prev = col < 2 ?
|
1736
|
+
row_start_acc[odd_row][odd_col] :
|
1737
|
+
acc[odd_col];
|
1738
|
+
int32_t value = prev + diff;
|
1739
|
+
|
1740
|
+
acc[odd_col] = value;
|
1741
|
+
if (col < 2)
|
1742
|
+
row_start_acc[odd_row][odd_col] = value;
|
1743
|
+
|
1744
|
+
switch(odd_dst) {
|
1745
|
+
case 0:
|
1746
|
+
*dst++ = (uint8_t)((value>>4)&0xff);
|
1747
|
+
*dst = (uint8_t)((value<<4)&0xf0);
|
1748
|
+
break;
|
1749
|
+
case 1:
|
1750
|
+
*dst++ |= (uint8_t)((value>>8)&0x0f);
|
1751
|
+
*dst++ = (uint8_t)((value<<0)&0xff);
|
1752
|
+
break;
|
1753
|
+
}
|
1754
|
+
|
1755
|
+
odd_dst = !odd_dst;
|
1756
|
+
|
1757
|
+
} /* end col */
|
1758
|
+
} /* end row */
|
1759
|
+
}
|
1760
|
+
|
1761
|
+
static void x3f_load_camf_decode_type4(x3f_camf_t *CAMF)
|
1762
|
+
{
|
1763
|
+
int i;
|
1764
|
+
uint8_t *p;
|
1765
|
+
x3f_true_huffman_element_t *element = NULL;
|
1766
|
+
|
1767
|
+
for (i=0, p = (uint8_t*)CAMF->data; *p != 0; i++) {
|
1768
|
+
/* TODO: Is this too expensive ??*/
|
1769
|
+
element =
|
1770
|
+
(x3f_true_huffman_element_t *)realloc(element, (i+1)*sizeof(*element));
|
1771
|
+
|
1772
|
+
element[i].code_size = *p++;
|
1773
|
+
element[i].code = *p++;
|
1774
|
+
}
|
1775
|
+
|
1776
|
+
CAMF->table.size = i;
|
1777
|
+
CAMF->table.element = element;
|
1778
|
+
|
1779
|
+
/* TODO: where does thes value 32 come from? */
|
1780
|
+
#define CAMF_T4_DATA_OFFSET 32
|
1781
|
+
CAMF->decoding_start = (uint8_t *)CAMF->data + CAMF_T4_DATA_OFFSET;
|
1782
|
+
|
1783
|
+
/* TODO: can it be fewer than 8 bits? Maybe taken from TRU->table? */
|
1784
|
+
new_huffman_tree(&CAMF->tree, 8);
|
1785
|
+
|
1786
|
+
populate_true_huffman_tree(&CAMF->tree, &CAMF->table);
|
1787
|
+
|
1788
|
+
#ifdef DBG_PRNT
|
1789
|
+
print_huffman_tree(CAMF->tree.nodes, 0, 0);
|
1790
|
+
#endif
|
1791
|
+
|
1792
|
+
camf_decode_type4(CAMF);
|
1793
|
+
}
|
1794
|
+
|
1795
|
+
static void x3f_setup_camf_entries(x3f_camf_t *CAMF)
|
1796
|
+
{
|
1797
|
+
uint8_t *p = (uint8_t *)CAMF->decoded_data;
|
1798
|
+
uint8_t *end = p + CAMF->decoded_data_size;
|
1799
|
+
camf_entry_t *table = NULL;
|
1800
|
+
int i;
|
1801
|
+
|
1802
|
+
for (i=0; p < end; i++) {
|
1803
|
+
uint32_t *p4 = (uint32_t *)p;
|
1804
|
+
|
1805
|
+
if ((*p4 & 0xffffff) != X3F_CMb) {
|
1806
|
+
/* TODO: whats this all about ? Is it OK to just terminate if
|
1807
|
+
you find an invalid entry ? */
|
1808
|
+
#ifdef DCRAW_VERBOSE
|
1809
|
+
fprintf(stderr, "Unknown CAMF entry %x\n", *p4);
|
1810
|
+
#endif
|
1811
|
+
break;
|
1812
|
+
}
|
1813
|
+
|
1814
|
+
/* TODO: lots of realloc - may be inefficient */
|
1815
|
+
table = (camf_entry_t *)realloc(table, (i+1)*sizeof(camf_entry_t));
|
1816
|
+
|
1817
|
+
table[i].id = *p4++;
|
1818
|
+
table[i].version = *p4++;
|
1819
|
+
table[i].entry_size = *p4++;
|
1820
|
+
table[i].name_offset = *p4++;
|
1821
|
+
table[i].value_offset = *p4++;
|
1822
|
+
|
1823
|
+
table[i].entry = p;
|
1824
|
+
|
1825
|
+
table[i].name_address = p + table[i].name_offset;
|
1826
|
+
table[i].value_address = p + table[i].value_offset;
|
1827
|
+
|
1828
|
+
p += table[i].entry_size;
|
1829
|
+
}
|
1830
|
+
|
1831
|
+
CAMF->entry_table.size = i;
|
1832
|
+
CAMF->entry_table.element = table;
|
1833
|
+
}
|
1834
|
+
|
1835
|
+
static void x3f_load_camf(x3f_info_t *I, x3f_directory_entry_t *DE)
|
1836
|
+
{
|
1837
|
+
x3f_directory_entry_header_t *DEH = &DE->header;
|
1838
|
+
x3f_camf_t *CAMF = &DEH->data_subsection.camf;
|
1839
|
+
|
1840
|
+
read_data_set_offset(I, DE, X3F_CAMF_HEADER_SIZE);
|
1841
|
+
|
1842
|
+
CAMF->data_size = read_data_block(&CAMF->data, I, DE, 0);
|
1843
|
+
|
1844
|
+
switch (CAMF->type) {
|
1845
|
+
case 2: /* Older SD9-SD14 */
|
1846
|
+
x3f_load_camf_decode_type2(CAMF);
|
1847
|
+
break;
|
1848
|
+
case 4: /* TRUE DP1-... */
|
1849
|
+
x3f_load_camf_decode_type4(CAMF);
|
1850
|
+
break;
|
1851
|
+
default:
|
1852
|
+
#ifdef DCRAW_VERBOSE
|
1853
|
+
fprintf(stderr, "Unknown CAMF type\n");
|
1854
|
+
#endif
|
1855
|
+
break;
|
1856
|
+
}
|
1857
|
+
|
1858
|
+
if (CAMF->decoded_data != NULL)
|
1859
|
+
x3f_setup_camf_entries(CAMF);
|
1860
|
+
#ifdef DCRAW_VERBOSE
|
1861
|
+
else
|
1862
|
+
fprintf(stderr, "No decoded CAMF data\n");
|
1863
|
+
#endif
|
1864
|
+
}
|
1865
|
+
|
1866
|
+
/* extern */ x3f_return_t x3f_load_data(x3f_t *x3f, x3f_directory_entry_t *DE)
|
1867
|
+
{
|
1868
|
+
x3f_info_t *I = &x3f->info;
|
1869
|
+
|
1870
|
+
if (DE == NULL)
|
1871
|
+
return X3F_ARGUMENT_ERROR;
|
1872
|
+
|
1873
|
+
switch (DE->header.identifier) {
|
1874
|
+
case X3F_SECp:
|
1875
|
+
x3f_load_property_list(I, DE);
|
1876
|
+
break;
|
1877
|
+
case X3F_SECi:
|
1878
|
+
x3f_load_image(I, DE);
|
1879
|
+
break;
|
1880
|
+
case X3F_SECc:
|
1881
|
+
x3f_load_camf(I, DE);
|
1882
|
+
break;
|
1883
|
+
default:
|
1884
|
+
#ifdef DCRAW_VERBOSE
|
1885
|
+
fprintf(stderr, "Unknown directory entry type\n");
|
1886
|
+
#endif
|
1887
|
+
return X3F_INTERNAL_ERROR;
|
1888
|
+
}
|
1889
|
+
|
1890
|
+
return X3F_OK;
|
1891
|
+
}
|
1892
|
+
|
1893
|
+
/* extern */ x3f_return_t x3f_load_image_block(x3f_t *x3f, x3f_directory_entry_t *DE)
|
1894
|
+
{
|
1895
|
+
x3f_info_t *I = &x3f->info;
|
1896
|
+
|
1897
|
+
if (DE == NULL)
|
1898
|
+
return X3F_ARGUMENT_ERROR;
|
1899
|
+
|
1900
|
+
switch (DE->header.identifier) {
|
1901
|
+
case X3F_SECi:
|
1902
|
+
read_data_set_offset(I, DE, X3F_IMAGE_HEADER_SIZE);
|
1903
|
+
x3f_load_image_verbatim(I, DE);
|
1904
|
+
break;
|
1905
|
+
default:
|
1906
|
+
#ifdef DCRAW_VERBOSE
|
1907
|
+
fprintf(stderr, "Unknown image directory entry type\n");
|
1908
|
+
#endif
|
1909
|
+
return X3F_INTERNAL_ERROR;
|
1910
|
+
}
|
1911
|
+
|
1912
|
+
return X3F_OK;
|
1913
|
+
}
|
1914
|
+
|
1915
|
+
|
1916
|
+
|
1917
|
+
/* --------------------------------------------------------------------- */
|
1918
|
+
/* The End */
|
1919
|
+
/* --------------------------------------------------------------------- */
|