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,1706 @@
|
|
1
|
+
// ==========================================================
|
2
|
+
// JPEG Loader and writer
|
3
|
+
// Based on code developed by The Independent JPEG Group
|
4
|
+
//
|
5
|
+
// Design and implementation by
|
6
|
+
// - Floris van den Berg (flvdberg@wxs.nl)
|
7
|
+
// - Jan L. Nauta (jln@magentammt.com)
|
8
|
+
// - Markus Loibl (markus.loibl@epost.de)
|
9
|
+
// - Karl-Heinz Bussian (khbussian@moss.de)
|
10
|
+
// - Herv� Drolon (drolon@infonie.fr)
|
11
|
+
// - Jascha Wetzel (jascha@mainia.de)
|
12
|
+
// - Mihail Naydenov (mnaydenov@users.sourceforge.net)
|
13
|
+
//
|
14
|
+
// This file is part of FreeImage 3
|
15
|
+
//
|
16
|
+
// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
|
17
|
+
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
|
18
|
+
// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
|
19
|
+
// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
|
20
|
+
// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
|
21
|
+
// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
|
22
|
+
// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
|
23
|
+
// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
|
24
|
+
// THIS DISCLAIMER.
|
25
|
+
//
|
26
|
+
// Use at your own risk!
|
27
|
+
// ==========================================================
|
28
|
+
|
29
|
+
#ifdef _MSC_VER
|
30
|
+
#pragma warning (disable : 4786) // identifier was truncated to 'number' characters
|
31
|
+
#endif
|
32
|
+
|
33
|
+
extern "C" {
|
34
|
+
#define XMD_H
|
35
|
+
#undef FAR
|
36
|
+
#include <setjmp.h>
|
37
|
+
|
38
|
+
#include "../LibJPEG/jinclude.h"
|
39
|
+
#include "../LibJPEG/jpeglib.h"
|
40
|
+
#include "../LibJPEG/jerror.h"
|
41
|
+
}
|
42
|
+
|
43
|
+
#include "FreeImage.h"
|
44
|
+
#include "Utilities.h"
|
45
|
+
|
46
|
+
#include "../Metadata/FreeImageTag.h"
|
47
|
+
|
48
|
+
|
49
|
+
// ==========================================================
|
50
|
+
// Plugin Interface
|
51
|
+
// ==========================================================
|
52
|
+
|
53
|
+
static int s_format_id;
|
54
|
+
|
55
|
+
// ----------------------------------------------------------
|
56
|
+
// Constant declarations
|
57
|
+
// ----------------------------------------------------------
|
58
|
+
|
59
|
+
#define INPUT_BUF_SIZE 4096 // choose an efficiently fread'able size
|
60
|
+
#define OUTPUT_BUF_SIZE 4096 // choose an efficiently fwrite'able size
|
61
|
+
|
62
|
+
#define EXIF_MARKER (JPEG_APP0+1) // EXIF marker / Adobe XMP marker
|
63
|
+
#define ICC_MARKER (JPEG_APP0+2) // ICC profile marker
|
64
|
+
#define IPTC_MARKER (JPEG_APP0+13) // IPTC marker / BIM marker
|
65
|
+
|
66
|
+
#define ICC_HEADER_SIZE 14 // size of non-profile data in APP2
|
67
|
+
#define MAX_BYTES_IN_MARKER 65533L // maximum data length of a JPEG marker
|
68
|
+
#define MAX_DATA_BYTES_IN_MARKER 65519L // maximum data length of a JPEG APP2 marker
|
69
|
+
|
70
|
+
#define MAX_JFXX_THUMB_SIZE (MAX_BYTES_IN_MARKER - 5 - 1)
|
71
|
+
|
72
|
+
#define JFXX_TYPE_JPEG 0x10 // JFIF extension marker: JPEG-compressed thumbnail image
|
73
|
+
#define JFXX_TYPE_8bit 0x11 // JFIF extension marker: palette thumbnail image
|
74
|
+
#define JFXX_TYPE_24bit 0x13 // JFIF extension marker: RGB thumbnail image
|
75
|
+
|
76
|
+
// ----------------------------------------------------------
|
77
|
+
// Typedef declarations
|
78
|
+
// ----------------------------------------------------------
|
79
|
+
|
80
|
+
typedef struct tagErrorManager {
|
81
|
+
/// "public" fields
|
82
|
+
struct jpeg_error_mgr pub;
|
83
|
+
/// for return to caller
|
84
|
+
jmp_buf setjmp_buffer;
|
85
|
+
} ErrorManager;
|
86
|
+
|
87
|
+
typedef struct tagSourceManager {
|
88
|
+
/// public fields
|
89
|
+
struct jpeg_source_mgr pub;
|
90
|
+
/// source stream
|
91
|
+
fi_handle infile;
|
92
|
+
FreeImageIO *m_io;
|
93
|
+
/// start of buffer
|
94
|
+
JOCTET * buffer;
|
95
|
+
/// have we gotten any data yet ?
|
96
|
+
boolean start_of_file;
|
97
|
+
} SourceManager;
|
98
|
+
|
99
|
+
typedef struct tagDestinationManager {
|
100
|
+
/// public fields
|
101
|
+
struct jpeg_destination_mgr pub;
|
102
|
+
/// destination stream
|
103
|
+
fi_handle outfile;
|
104
|
+
FreeImageIO *m_io;
|
105
|
+
/// start of buffer
|
106
|
+
JOCTET * buffer;
|
107
|
+
} DestinationManager;
|
108
|
+
|
109
|
+
typedef SourceManager* freeimage_src_ptr;
|
110
|
+
typedef DestinationManager* freeimage_dst_ptr;
|
111
|
+
typedef ErrorManager* freeimage_error_ptr;
|
112
|
+
|
113
|
+
// ----------------------------------------------------------
|
114
|
+
// Error handling
|
115
|
+
// ----------------------------------------------------------
|
116
|
+
|
117
|
+
/** Fatal errors (print message and exit) */
|
118
|
+
static inline void
|
119
|
+
JPEG_EXIT(j_common_ptr cinfo, int code) {
|
120
|
+
freeimage_error_ptr error_ptr = (freeimage_error_ptr)cinfo->err;
|
121
|
+
error_ptr->pub.msg_code = code;
|
122
|
+
error_ptr->pub.error_exit(cinfo);
|
123
|
+
}
|
124
|
+
|
125
|
+
/** Nonfatal errors (we can keep going, but the data is probably corrupt) */
|
126
|
+
static inline void
|
127
|
+
JPEG_WARNING(j_common_ptr cinfo, int code) {
|
128
|
+
freeimage_error_ptr error_ptr = (freeimage_error_ptr)cinfo->err;
|
129
|
+
error_ptr->pub.msg_code = code;
|
130
|
+
error_ptr->pub.emit_message(cinfo, -1);
|
131
|
+
}
|
132
|
+
|
133
|
+
/**
|
134
|
+
Receives control for a fatal error. Information sufficient to
|
135
|
+
generate the error message has been stored in cinfo->err; call
|
136
|
+
output_message to display it. Control must NOT return to the caller;
|
137
|
+
generally this routine will exit() or longjmp() somewhere.
|
138
|
+
*/
|
139
|
+
METHODDEF(void)
|
140
|
+
jpeg_error_exit (j_common_ptr cinfo) {
|
141
|
+
freeimage_error_ptr error_ptr = (freeimage_error_ptr)cinfo->err;
|
142
|
+
|
143
|
+
// always display the message
|
144
|
+
error_ptr->pub.output_message(cinfo);
|
145
|
+
|
146
|
+
// allow JPEG with unknown markers
|
147
|
+
if(error_ptr->pub.msg_code != JERR_UNKNOWN_MARKER) {
|
148
|
+
|
149
|
+
// let the memory manager delete any temp files before we die
|
150
|
+
jpeg_destroy(cinfo);
|
151
|
+
|
152
|
+
// return control to the setjmp point
|
153
|
+
longjmp(error_ptr->setjmp_buffer, 1);
|
154
|
+
}
|
155
|
+
}
|
156
|
+
|
157
|
+
/**
|
158
|
+
Actual output of any JPEG message. Note that this method does not know
|
159
|
+
how to generate a message, only where to send it.
|
160
|
+
*/
|
161
|
+
METHODDEF(void)
|
162
|
+
jpeg_output_message (j_common_ptr cinfo) {
|
163
|
+
char buffer[JMSG_LENGTH_MAX];
|
164
|
+
freeimage_error_ptr error_ptr = (freeimage_error_ptr)cinfo->err;
|
165
|
+
|
166
|
+
// create the message
|
167
|
+
error_ptr->pub.format_message(cinfo, buffer);
|
168
|
+
// send it to user's message proc
|
169
|
+
FreeImage_OutputMessageProc(s_format_id, buffer);
|
170
|
+
}
|
171
|
+
|
172
|
+
// ----------------------------------------------------------
|
173
|
+
// Destination manager
|
174
|
+
// ----------------------------------------------------------
|
175
|
+
|
176
|
+
/**
|
177
|
+
Initialize destination. This is called by jpeg_start_compress()
|
178
|
+
before any data is actually written. It must initialize
|
179
|
+
next_output_byte and free_in_buffer. free_in_buffer must be
|
180
|
+
initialized to a positive value.
|
181
|
+
*/
|
182
|
+
METHODDEF(void)
|
183
|
+
init_destination (j_compress_ptr cinfo) {
|
184
|
+
freeimage_dst_ptr dest = (freeimage_dst_ptr) cinfo->dest;
|
185
|
+
|
186
|
+
dest->buffer = (JOCTET *)
|
187
|
+
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
188
|
+
OUTPUT_BUF_SIZE * sizeof(JOCTET));
|
189
|
+
|
190
|
+
dest->pub.next_output_byte = dest->buffer;
|
191
|
+
dest->pub.free_in_buffer = OUTPUT_BUF_SIZE;
|
192
|
+
}
|
193
|
+
|
194
|
+
/**
|
195
|
+
This is called whenever the buffer has filled (free_in_buffer
|
196
|
+
reaches zero). In typical applications, it should write out the
|
197
|
+
*entire* buffer (use the saved start address and buffer length;
|
198
|
+
ignore the current state of next_output_byte and free_in_buffer).
|
199
|
+
Then reset the pointer & count to the start of the buffer, and
|
200
|
+
return TRUE indicating that the buffer has been dumped.
|
201
|
+
free_in_buffer must be set to a positive value when TRUE is
|
202
|
+
returned. A FALSE return should only be used when I/O suspension is
|
203
|
+
desired.
|
204
|
+
*/
|
205
|
+
METHODDEF(boolean)
|
206
|
+
empty_output_buffer (j_compress_ptr cinfo) {
|
207
|
+
freeimage_dst_ptr dest = (freeimage_dst_ptr) cinfo->dest;
|
208
|
+
|
209
|
+
if (dest->m_io->write_proc(dest->buffer, 1, OUTPUT_BUF_SIZE, dest->outfile) != OUTPUT_BUF_SIZE) {
|
210
|
+
// let the memory manager delete any temp files before we die
|
211
|
+
jpeg_destroy((j_common_ptr)cinfo);
|
212
|
+
|
213
|
+
JPEG_EXIT((j_common_ptr)cinfo, JERR_FILE_WRITE);
|
214
|
+
}
|
215
|
+
|
216
|
+
dest->pub.next_output_byte = dest->buffer;
|
217
|
+
dest->pub.free_in_buffer = OUTPUT_BUF_SIZE;
|
218
|
+
|
219
|
+
return TRUE;
|
220
|
+
}
|
221
|
+
|
222
|
+
/**
|
223
|
+
Terminate destination --- called by jpeg_finish_compress() after all
|
224
|
+
data has been written. In most applications, this must flush any
|
225
|
+
data remaining in the buffer. Use either next_output_byte or
|
226
|
+
free_in_buffer to determine how much data is in the buffer.
|
227
|
+
*/
|
228
|
+
METHODDEF(void)
|
229
|
+
term_destination (j_compress_ptr cinfo) {
|
230
|
+
freeimage_dst_ptr dest = (freeimage_dst_ptr) cinfo->dest;
|
231
|
+
|
232
|
+
size_t datacount = OUTPUT_BUF_SIZE - dest->pub.free_in_buffer;
|
233
|
+
|
234
|
+
// write any data remaining in the buffer
|
235
|
+
|
236
|
+
if (datacount > 0) {
|
237
|
+
if (dest->m_io->write_proc(dest->buffer, 1, (unsigned int)datacount, dest->outfile) != datacount) {
|
238
|
+
// let the memory manager delete any temp files before we die
|
239
|
+
jpeg_destroy((j_common_ptr)cinfo);
|
240
|
+
|
241
|
+
JPEG_EXIT((j_common_ptr)cinfo, JERR_FILE_WRITE);
|
242
|
+
}
|
243
|
+
}
|
244
|
+
}
|
245
|
+
|
246
|
+
// ----------------------------------------------------------
|
247
|
+
// Source manager
|
248
|
+
// ----------------------------------------------------------
|
249
|
+
|
250
|
+
/**
|
251
|
+
Initialize source. This is called by jpeg_read_header() before any
|
252
|
+
data is actually read. Unlike init_destination(), it may leave
|
253
|
+
bytes_in_buffer set to 0 (in which case a fill_input_buffer() call
|
254
|
+
will occur immediately).
|
255
|
+
*/
|
256
|
+
METHODDEF(void)
|
257
|
+
init_source (j_decompress_ptr cinfo) {
|
258
|
+
freeimage_src_ptr src = (freeimage_src_ptr) cinfo->src;
|
259
|
+
|
260
|
+
/* We reset the empty-input-file flag for each image,
|
261
|
+
* but we don't clear the input buffer.
|
262
|
+
* This is correct behavior for reading a series of images from one source.
|
263
|
+
*/
|
264
|
+
|
265
|
+
src->start_of_file = TRUE;
|
266
|
+
}
|
267
|
+
|
268
|
+
/**
|
269
|
+
This is called whenever bytes_in_buffer has reached zero and more
|
270
|
+
data is wanted. In typical applications, it should read fresh data
|
271
|
+
into the buffer (ignoring the current state of next_input_byte and
|
272
|
+
bytes_in_buffer), reset the pointer & count to the start of the
|
273
|
+
buffer, and return TRUE indicating that the buffer has been reloaded.
|
274
|
+
It is not necessary to fill the buffer entirely, only to obtain at
|
275
|
+
least one more byte. bytes_in_buffer MUST be set to a positive value
|
276
|
+
if TRUE is returned. A FALSE return should only be used when I/O
|
277
|
+
suspension is desired.
|
278
|
+
*/
|
279
|
+
METHODDEF(boolean)
|
280
|
+
fill_input_buffer (j_decompress_ptr cinfo) {
|
281
|
+
freeimage_src_ptr src = (freeimage_src_ptr) cinfo->src;
|
282
|
+
|
283
|
+
size_t nbytes = src->m_io->read_proc(src->buffer, 1, INPUT_BUF_SIZE, src->infile);
|
284
|
+
|
285
|
+
if (nbytes <= 0) {
|
286
|
+
if (src->start_of_file) {
|
287
|
+
// treat empty input file as fatal error
|
288
|
+
|
289
|
+
// let the memory manager delete any temp files before we die
|
290
|
+
jpeg_destroy((j_common_ptr)cinfo);
|
291
|
+
|
292
|
+
JPEG_EXIT((j_common_ptr)cinfo, JERR_INPUT_EMPTY);
|
293
|
+
}
|
294
|
+
|
295
|
+
JPEG_WARNING((j_common_ptr)cinfo, JWRN_JPEG_EOF);
|
296
|
+
|
297
|
+
/* Insert a fake EOI marker */
|
298
|
+
|
299
|
+
src->buffer[0] = (JOCTET) 0xFF;
|
300
|
+
src->buffer[1] = (JOCTET) JPEG_EOI;
|
301
|
+
|
302
|
+
nbytes = 2;
|
303
|
+
}
|
304
|
+
|
305
|
+
src->pub.next_input_byte = src->buffer;
|
306
|
+
src->pub.bytes_in_buffer = nbytes;
|
307
|
+
src->start_of_file = FALSE;
|
308
|
+
|
309
|
+
return TRUE;
|
310
|
+
}
|
311
|
+
|
312
|
+
/**
|
313
|
+
Skip num_bytes worth of data. The buffer pointer and count should
|
314
|
+
be advanced over num_bytes input bytes, refilling the buffer as
|
315
|
+
needed. This is used to skip over a potentially large amount of
|
316
|
+
uninteresting data (such as an APPn marker). In some applications
|
317
|
+
it may be possible to optimize away the reading of the skipped data,
|
318
|
+
but it's not clear that being smart is worth much trouble; large
|
319
|
+
skips are uncommon. bytes_in_buffer may be zero on return.
|
320
|
+
A zero or negative skip count should be treated as a no-op.
|
321
|
+
*/
|
322
|
+
METHODDEF(void)
|
323
|
+
skip_input_data (j_decompress_ptr cinfo, long num_bytes) {
|
324
|
+
freeimage_src_ptr src = (freeimage_src_ptr) cinfo->src;
|
325
|
+
|
326
|
+
/* Just a dumb implementation for now. Could use fseek() except
|
327
|
+
* it doesn't work on pipes. Not clear that being smart is worth
|
328
|
+
* any trouble anyway --- large skips are infrequent.
|
329
|
+
*/
|
330
|
+
|
331
|
+
if (num_bytes > 0) {
|
332
|
+
while (num_bytes > (long) src->pub.bytes_in_buffer) {
|
333
|
+
num_bytes -= (long) src->pub.bytes_in_buffer;
|
334
|
+
|
335
|
+
(void) fill_input_buffer(cinfo);
|
336
|
+
|
337
|
+
/* note we assume that fill_input_buffer will never return FALSE,
|
338
|
+
* so suspension need not be handled.
|
339
|
+
*/
|
340
|
+
}
|
341
|
+
|
342
|
+
src->pub.next_input_byte += (size_t) num_bytes;
|
343
|
+
src->pub.bytes_in_buffer -= (size_t) num_bytes;
|
344
|
+
}
|
345
|
+
}
|
346
|
+
|
347
|
+
/**
|
348
|
+
Terminate source --- called by jpeg_finish_decompress
|
349
|
+
after all data has been read. Often a no-op.
|
350
|
+
|
351
|
+
NB: *not* called by jpeg_abort or jpeg_destroy; surrounding
|
352
|
+
application must deal with any cleanup that should happen even
|
353
|
+
for error exit.
|
354
|
+
*/
|
355
|
+
METHODDEF(void)
|
356
|
+
term_source (j_decompress_ptr cinfo) {
|
357
|
+
// no work necessary here
|
358
|
+
}
|
359
|
+
|
360
|
+
// ----------------------------------------------------------
|
361
|
+
// Source manager & Destination manager setup
|
362
|
+
// ----------------------------------------------------------
|
363
|
+
|
364
|
+
/**
|
365
|
+
Prepare for input from a stdio stream.
|
366
|
+
The caller must have already opened the stream, and is responsible
|
367
|
+
for closing it after finishing decompression.
|
368
|
+
*/
|
369
|
+
GLOBAL(void)
|
370
|
+
jpeg_freeimage_src (j_decompress_ptr cinfo, fi_handle infile, FreeImageIO *io) {
|
371
|
+
freeimage_src_ptr src;
|
372
|
+
|
373
|
+
// allocate memory for the buffer. is released automatically in the end
|
374
|
+
|
375
|
+
if (cinfo->src == NULL) {
|
376
|
+
cinfo->src = (struct jpeg_source_mgr *) (*cinfo->mem->alloc_small)
|
377
|
+
((j_common_ptr) cinfo, JPOOL_PERMANENT, sizeof(SourceManager));
|
378
|
+
|
379
|
+
src = (freeimage_src_ptr) cinfo->src;
|
380
|
+
|
381
|
+
src->buffer = (JOCTET *) (*cinfo->mem->alloc_small)
|
382
|
+
((j_common_ptr) cinfo, JPOOL_PERMANENT, INPUT_BUF_SIZE * sizeof(JOCTET));
|
383
|
+
}
|
384
|
+
|
385
|
+
// initialize the jpeg pointer struct with pointers to functions
|
386
|
+
|
387
|
+
src = (freeimage_src_ptr) cinfo->src;
|
388
|
+
src->pub.init_source = init_source;
|
389
|
+
src->pub.fill_input_buffer = fill_input_buffer;
|
390
|
+
src->pub.skip_input_data = skip_input_data;
|
391
|
+
src->pub.resync_to_restart = jpeg_resync_to_restart; // use default method
|
392
|
+
src->pub.term_source = term_source;
|
393
|
+
src->infile = infile;
|
394
|
+
src->m_io = io;
|
395
|
+
src->pub.bytes_in_buffer = 0; // forces fill_input_buffer on first read
|
396
|
+
src->pub.next_input_byte = NULL; // until buffer loaded
|
397
|
+
}
|
398
|
+
|
399
|
+
/**
|
400
|
+
Prepare for output to a stdio stream.
|
401
|
+
The caller must have already opened the stream, and is responsible
|
402
|
+
for closing it after finishing compression.
|
403
|
+
*/
|
404
|
+
GLOBAL(void)
|
405
|
+
jpeg_freeimage_dst (j_compress_ptr cinfo, fi_handle outfile, FreeImageIO *io) {
|
406
|
+
freeimage_dst_ptr dest;
|
407
|
+
|
408
|
+
if (cinfo->dest == NULL) {
|
409
|
+
cinfo->dest = (struct jpeg_destination_mgr *)(*cinfo->mem->alloc_small)
|
410
|
+
((j_common_ptr) cinfo, JPOOL_PERMANENT, sizeof(DestinationManager));
|
411
|
+
}
|
412
|
+
|
413
|
+
dest = (freeimage_dst_ptr) cinfo->dest;
|
414
|
+
dest->pub.init_destination = init_destination;
|
415
|
+
dest->pub.empty_output_buffer = empty_output_buffer;
|
416
|
+
dest->pub.term_destination = term_destination;
|
417
|
+
dest->outfile = outfile;
|
418
|
+
dest->m_io = io;
|
419
|
+
}
|
420
|
+
|
421
|
+
// ----------------------------------------------------------
|
422
|
+
// Special markers read functions
|
423
|
+
// ----------------------------------------------------------
|
424
|
+
|
425
|
+
/**
|
426
|
+
Read JPEG_COM marker (comment)
|
427
|
+
*/
|
428
|
+
static BOOL
|
429
|
+
jpeg_read_comment(FIBITMAP *dib, const BYTE *dataptr, unsigned int datalen) {
|
430
|
+
size_t length = datalen;
|
431
|
+
BYTE *profile = (BYTE*)dataptr;
|
432
|
+
|
433
|
+
// read the comment
|
434
|
+
char *value = (char*)malloc((length + 1) * sizeof(char));
|
435
|
+
if(value == NULL) return FALSE;
|
436
|
+
memcpy(value, profile, length);
|
437
|
+
value[length] = '\0';
|
438
|
+
|
439
|
+
// create a tag
|
440
|
+
FITAG *tag = FreeImage_CreateTag();
|
441
|
+
if(tag) {
|
442
|
+
unsigned int count = (unsigned int)length + 1; // includes the null value
|
443
|
+
|
444
|
+
FreeImage_SetTagID(tag, JPEG_COM);
|
445
|
+
FreeImage_SetTagKey(tag, "Comment");
|
446
|
+
FreeImage_SetTagLength(tag, count);
|
447
|
+
FreeImage_SetTagCount(tag, count);
|
448
|
+
FreeImage_SetTagType(tag, FIDT_ASCII);
|
449
|
+
FreeImage_SetTagValue(tag, value);
|
450
|
+
|
451
|
+
// store the tag
|
452
|
+
FreeImage_SetMetadata(FIMD_COMMENTS, dib, FreeImage_GetTagKey(tag), tag);
|
453
|
+
|
454
|
+
// destroy the tag
|
455
|
+
FreeImage_DeleteTag(tag);
|
456
|
+
}
|
457
|
+
|
458
|
+
free(value);
|
459
|
+
|
460
|
+
return TRUE;
|
461
|
+
}
|
462
|
+
|
463
|
+
/**
|
464
|
+
Read JPEG_APP2 marker (ICC profile)
|
465
|
+
*/
|
466
|
+
|
467
|
+
/**
|
468
|
+
Handy subroutine to test whether a saved marker is an ICC profile marker.
|
469
|
+
*/
|
470
|
+
static BOOL
|
471
|
+
marker_is_icc(jpeg_saved_marker_ptr marker) {
|
472
|
+
// marker identifying string "ICC_PROFILE" (null-terminated)
|
473
|
+
const BYTE icc_signature[12] = { 0x49, 0x43, 0x43, 0x5F, 0x50, 0x52, 0x4F, 0x46, 0x49, 0x4C, 0x45, 0x00 };
|
474
|
+
|
475
|
+
if(marker->marker == ICC_MARKER) {
|
476
|
+
// verify the identifying string
|
477
|
+
if(marker->data_length >= ICC_HEADER_SIZE) {
|
478
|
+
if(memcmp(icc_signature, marker->data, sizeof(icc_signature)) == 0) {
|
479
|
+
return TRUE;
|
480
|
+
}
|
481
|
+
}
|
482
|
+
}
|
483
|
+
|
484
|
+
return FALSE;
|
485
|
+
}
|
486
|
+
|
487
|
+
/**
|
488
|
+
See if there was an ICC profile in the JPEG file being read;
|
489
|
+
if so, reassemble and return the profile data.
|
490
|
+
|
491
|
+
TRUE is returned if an ICC profile was found, FALSE if not.
|
492
|
+
If TRUE is returned, *icc_data_ptr is set to point to the
|
493
|
+
returned data, and *icc_data_len is set to its length.
|
494
|
+
|
495
|
+
IMPORTANT: the data at **icc_data_ptr has been allocated with malloc()
|
496
|
+
and must be freed by the caller with free() when the caller no longer
|
497
|
+
needs it. (Alternatively, we could write this routine to use the
|
498
|
+
IJG library's memory allocator, so that the data would be freed implicitly
|
499
|
+
at jpeg_finish_decompress() time. But it seems likely that many apps
|
500
|
+
will prefer to have the data stick around after decompression finishes.)
|
501
|
+
|
502
|
+
NOTE: if the file contains invalid ICC APP2 markers, we just silently
|
503
|
+
return FALSE. You might want to issue an error message instead.
|
504
|
+
*/
|
505
|
+
static BOOL
|
506
|
+
jpeg_read_icc_profile(j_decompress_ptr cinfo, JOCTET **icc_data_ptr, unsigned *icc_data_len) {
|
507
|
+
jpeg_saved_marker_ptr marker;
|
508
|
+
int num_markers = 0;
|
509
|
+
int seq_no;
|
510
|
+
JOCTET *icc_data;
|
511
|
+
unsigned total_length;
|
512
|
+
|
513
|
+
const int MAX_SEQ_NO = 255; // sufficient since marker numbers are bytes
|
514
|
+
BYTE marker_present[MAX_SEQ_NO+1]; // 1 if marker found
|
515
|
+
unsigned data_length[MAX_SEQ_NO+1]; // size of profile data in marker
|
516
|
+
unsigned data_offset[MAX_SEQ_NO+1]; // offset for data in marker
|
517
|
+
|
518
|
+
*icc_data_ptr = NULL; // avoid confusion if FALSE return
|
519
|
+
*icc_data_len = 0;
|
520
|
+
|
521
|
+
/**
|
522
|
+
this first pass over the saved markers discovers whether there are
|
523
|
+
any ICC markers and verifies the consistency of the marker numbering.
|
524
|
+
*/
|
525
|
+
|
526
|
+
memset(marker_present, 0, (MAX_SEQ_NO + 1));
|
527
|
+
|
528
|
+
for(marker = cinfo->marker_list; marker != NULL; marker = marker->next) {
|
529
|
+
if (marker_is_icc(marker)) {
|
530
|
+
if (num_markers == 0) {
|
531
|
+
// number of markers
|
532
|
+
num_markers = GETJOCTET(marker->data[13]);
|
533
|
+
}
|
534
|
+
else if (num_markers != GETJOCTET(marker->data[13])) {
|
535
|
+
return FALSE; // inconsistent num_markers fields
|
536
|
+
}
|
537
|
+
// sequence number
|
538
|
+
seq_no = GETJOCTET(marker->data[12]);
|
539
|
+
if (seq_no <= 0 || seq_no > num_markers) {
|
540
|
+
return FALSE; // bogus sequence number
|
541
|
+
}
|
542
|
+
if (marker_present[seq_no]) {
|
543
|
+
return FALSE; // duplicate sequence numbers
|
544
|
+
}
|
545
|
+
marker_present[seq_no] = 1;
|
546
|
+
data_length[seq_no] = marker->data_length - ICC_HEADER_SIZE;
|
547
|
+
}
|
548
|
+
}
|
549
|
+
|
550
|
+
if (num_markers == 0)
|
551
|
+
return FALSE;
|
552
|
+
|
553
|
+
/**
|
554
|
+
check for missing markers, count total space needed,
|
555
|
+
compute offset of each marker's part of the data.
|
556
|
+
*/
|
557
|
+
|
558
|
+
total_length = 0;
|
559
|
+
for(seq_no = 1; seq_no <= num_markers; seq_no++) {
|
560
|
+
if (marker_present[seq_no] == 0) {
|
561
|
+
return FALSE; // missing sequence number
|
562
|
+
}
|
563
|
+
data_offset[seq_no] = total_length;
|
564
|
+
total_length += data_length[seq_no];
|
565
|
+
}
|
566
|
+
|
567
|
+
if (total_length <= 0)
|
568
|
+
return FALSE; // found only empty markers ?
|
569
|
+
|
570
|
+
// allocate space for assembled data
|
571
|
+
icc_data = (JOCTET *) malloc(total_length * sizeof(JOCTET));
|
572
|
+
if (icc_data == NULL)
|
573
|
+
return FALSE; // out of memory
|
574
|
+
|
575
|
+
// and fill it in
|
576
|
+
for (marker = cinfo->marker_list; marker != NULL; marker = marker->next) {
|
577
|
+
if (marker_is_icc(marker)) {
|
578
|
+
JOCTET FAR *src_ptr;
|
579
|
+
JOCTET *dst_ptr;
|
580
|
+
unsigned length;
|
581
|
+
seq_no = GETJOCTET(marker->data[12]);
|
582
|
+
dst_ptr = icc_data + data_offset[seq_no];
|
583
|
+
src_ptr = marker->data + ICC_HEADER_SIZE;
|
584
|
+
length = data_length[seq_no];
|
585
|
+
while (length--) {
|
586
|
+
*dst_ptr++ = *src_ptr++;
|
587
|
+
}
|
588
|
+
}
|
589
|
+
}
|
590
|
+
|
591
|
+
*icc_data_ptr = icc_data;
|
592
|
+
*icc_data_len = total_length;
|
593
|
+
|
594
|
+
return TRUE;
|
595
|
+
}
|
596
|
+
|
597
|
+
/**
|
598
|
+
Read JPEG_APPD marker (IPTC or Adobe Photoshop profile)
|
599
|
+
*/
|
600
|
+
static BOOL
|
601
|
+
jpeg_read_iptc_profile(FIBITMAP *dib, const BYTE *dataptr, unsigned int datalen) {
|
602
|
+
return read_iptc_profile(dib, dataptr, datalen);
|
603
|
+
}
|
604
|
+
|
605
|
+
/**
|
606
|
+
Read JPEG_APP1 marker (XMP profile)
|
607
|
+
@param dib Input FIBITMAP
|
608
|
+
@param dataptr Pointer to the APP1 marker
|
609
|
+
@param datalen APP1 marker length
|
610
|
+
@return Returns TRUE if successful, FALSE otherwise
|
611
|
+
*/
|
612
|
+
static BOOL
|
613
|
+
jpeg_read_xmp_profile(FIBITMAP *dib, const BYTE *dataptr, unsigned int datalen) {
|
614
|
+
// marker identifying string for XMP (null terminated)
|
615
|
+
const char *xmp_signature = "http://ns.adobe.com/xap/1.0/";
|
616
|
+
// XMP signature is 29 bytes long
|
617
|
+
const size_t xmp_signature_size = strlen(xmp_signature) + 1;
|
618
|
+
|
619
|
+
size_t length = datalen;
|
620
|
+
BYTE *profile = (BYTE*)dataptr;
|
621
|
+
|
622
|
+
if(length <= xmp_signature_size) {
|
623
|
+
// avoid reading corrupted or empty data
|
624
|
+
return FALSE;
|
625
|
+
}
|
626
|
+
|
627
|
+
// verify the identifying string
|
628
|
+
|
629
|
+
if(memcmp(xmp_signature, profile, strlen(xmp_signature)) == 0) {
|
630
|
+
// XMP profile
|
631
|
+
|
632
|
+
profile += xmp_signature_size;
|
633
|
+
length -= xmp_signature_size;
|
634
|
+
|
635
|
+
// create a tag
|
636
|
+
FITAG *tag = FreeImage_CreateTag();
|
637
|
+
if(tag) {
|
638
|
+
FreeImage_SetTagID(tag, JPEG_APP0+1); // 0xFFE1
|
639
|
+
FreeImage_SetTagKey(tag, g_TagLib_XMPFieldName);
|
640
|
+
FreeImage_SetTagLength(tag, (DWORD)length);
|
641
|
+
FreeImage_SetTagCount(tag, (DWORD)length);
|
642
|
+
FreeImage_SetTagType(tag, FIDT_ASCII);
|
643
|
+
FreeImage_SetTagValue(tag, profile);
|
644
|
+
|
645
|
+
// store the tag
|
646
|
+
FreeImage_SetMetadata(FIMD_XMP, dib, FreeImage_GetTagKey(tag), tag);
|
647
|
+
|
648
|
+
// destroy the tag
|
649
|
+
FreeImage_DeleteTag(tag);
|
650
|
+
}
|
651
|
+
|
652
|
+
return TRUE;
|
653
|
+
}
|
654
|
+
|
655
|
+
return FALSE;
|
656
|
+
}
|
657
|
+
|
658
|
+
/**
|
659
|
+
Read JFIF "JFXX" extension APP0 marker
|
660
|
+
@param dib Input FIBITMAP
|
661
|
+
@param dataptr Pointer to the APP0 marker
|
662
|
+
@param datalen APP0 marker length
|
663
|
+
@return Returns TRUE if successful, FALSE otherwise
|
664
|
+
*/
|
665
|
+
static BOOL
|
666
|
+
jpeg_read_jfxx(FIBITMAP *dib, const BYTE *dataptr, unsigned int datalen) {
|
667
|
+
if(datalen < 6) {
|
668
|
+
return FALSE;
|
669
|
+
}
|
670
|
+
|
671
|
+
const int id_length = 5;
|
672
|
+
const BYTE *data = dataptr + id_length;
|
673
|
+
unsigned remaining = datalen - id_length;
|
674
|
+
|
675
|
+
const BYTE type = *data;
|
676
|
+
++data, --remaining;
|
677
|
+
|
678
|
+
switch(type) {
|
679
|
+
case JFXX_TYPE_JPEG:
|
680
|
+
{
|
681
|
+
// load the thumbnail
|
682
|
+
FIMEMORY* hmem = FreeImage_OpenMemory(const_cast<BYTE*>(data), remaining);
|
683
|
+
FIBITMAP* thumbnail = FreeImage_LoadFromMemory(FIF_JPEG, hmem);
|
684
|
+
FreeImage_CloseMemory(hmem);
|
685
|
+
// store the thumbnail
|
686
|
+
FreeImage_SetThumbnail(dib, thumbnail);
|
687
|
+
// then delete it
|
688
|
+
FreeImage_Unload(thumbnail);
|
689
|
+
break;
|
690
|
+
}
|
691
|
+
case JFXX_TYPE_8bit:
|
692
|
+
// colormapped uncompressed thumbnail (no supported)
|
693
|
+
break;
|
694
|
+
case JFXX_TYPE_24bit:
|
695
|
+
// truecolor uncompressed thumbnail (no supported)
|
696
|
+
break;
|
697
|
+
default:
|
698
|
+
break;
|
699
|
+
}
|
700
|
+
|
701
|
+
return TRUE;
|
702
|
+
}
|
703
|
+
|
704
|
+
|
705
|
+
/**
|
706
|
+
Read JPEG special markers
|
707
|
+
*/
|
708
|
+
static BOOL
|
709
|
+
read_markers(j_decompress_ptr cinfo, FIBITMAP *dib) {
|
710
|
+
jpeg_saved_marker_ptr marker;
|
711
|
+
|
712
|
+
for(marker = cinfo->marker_list; marker != NULL; marker = marker->next) {
|
713
|
+
switch(marker->marker) {
|
714
|
+
case JPEG_APP0:
|
715
|
+
// JFIF is handled by libjpeg already, handle JFXX
|
716
|
+
if(memcmp(marker->data, "JFIF" , 5) == 0) {
|
717
|
+
continue;
|
718
|
+
}
|
719
|
+
if(memcmp(marker->data, "JFXX" , 5) == 0) {
|
720
|
+
if(!cinfo->saw_JFIF_marker || cinfo->JFIF_minor_version < 2) {
|
721
|
+
FreeImage_OutputMessageProc(s_format_id, "Warning: non-standard JFXX segment");
|
722
|
+
}
|
723
|
+
jpeg_read_jfxx(dib, marker->data, marker->data_length);
|
724
|
+
}
|
725
|
+
// other values such as 'Picasa' : ignore safely unknown APP0 marker
|
726
|
+
break;
|
727
|
+
case JPEG_COM:
|
728
|
+
// JPEG comment
|
729
|
+
jpeg_read_comment(dib, marker->data, marker->data_length);
|
730
|
+
break;
|
731
|
+
case EXIF_MARKER:
|
732
|
+
// Exif or Adobe XMP profile
|
733
|
+
jpeg_read_exif_profile(dib, marker->data, marker->data_length);
|
734
|
+
jpeg_read_xmp_profile(dib, marker->data, marker->data_length);
|
735
|
+
jpeg_read_exif_profile_raw(dib, marker->data, marker->data_length);
|
736
|
+
break;
|
737
|
+
case IPTC_MARKER:
|
738
|
+
// IPTC/NAA or Adobe Photoshop profile
|
739
|
+
jpeg_read_iptc_profile(dib, marker->data, marker->data_length);
|
740
|
+
break;
|
741
|
+
}
|
742
|
+
}
|
743
|
+
|
744
|
+
// ICC profile
|
745
|
+
BYTE *icc_profile = NULL;
|
746
|
+
unsigned icc_length = 0;
|
747
|
+
|
748
|
+
if( jpeg_read_icc_profile(cinfo, &icc_profile, &icc_length) ) {
|
749
|
+
// copy ICC profile data
|
750
|
+
FreeImage_CreateICCProfile(dib, icc_profile, icc_length);
|
751
|
+
// clean up
|
752
|
+
free(icc_profile);
|
753
|
+
}
|
754
|
+
|
755
|
+
return TRUE;
|
756
|
+
}
|
757
|
+
|
758
|
+
// ----------------------------------------------------------
|
759
|
+
// Special markers write functions
|
760
|
+
// ----------------------------------------------------------
|
761
|
+
|
762
|
+
/**
|
763
|
+
Write JPEG_COM marker (comment)
|
764
|
+
*/
|
765
|
+
static BOOL
|
766
|
+
jpeg_write_comment(j_compress_ptr cinfo, FIBITMAP *dib) {
|
767
|
+
FITAG *tag = NULL;
|
768
|
+
|
769
|
+
// write user comment as a JPEG_COM marker
|
770
|
+
FreeImage_GetMetadata(FIMD_COMMENTS, dib, "Comment", &tag);
|
771
|
+
if(tag) {
|
772
|
+
const char *tag_value = (char*)FreeImage_GetTagValue(tag);
|
773
|
+
|
774
|
+
if(NULL != tag_value) {
|
775
|
+
for(long i = 0; i < (long)strlen(tag_value); i+= MAX_BYTES_IN_MARKER) {
|
776
|
+
jpeg_write_marker(cinfo, JPEG_COM, (BYTE*)tag_value + i, MIN((long)strlen(tag_value + i), MAX_BYTES_IN_MARKER));
|
777
|
+
}
|
778
|
+
return TRUE;
|
779
|
+
}
|
780
|
+
}
|
781
|
+
return FALSE;
|
782
|
+
}
|
783
|
+
|
784
|
+
/**
|
785
|
+
Write JPEG_APP2 marker (ICC profile)
|
786
|
+
*/
|
787
|
+
static BOOL
|
788
|
+
jpeg_write_icc_profile(j_compress_ptr cinfo, FIBITMAP *dib) {
|
789
|
+
// marker identifying string "ICC_PROFILE" (null-terminated)
|
790
|
+
BYTE icc_signature[12] = { 0x49, 0x43, 0x43, 0x5F, 0x50, 0x52, 0x4F, 0x46, 0x49, 0x4C, 0x45, 0x00 };
|
791
|
+
|
792
|
+
FIICCPROFILE *iccProfile = FreeImage_GetICCProfile(dib);
|
793
|
+
|
794
|
+
if (iccProfile->size && iccProfile->data) {
|
795
|
+
// ICC_HEADER_SIZE: ICC signature is 'ICC_PROFILE' + 2 bytes
|
796
|
+
|
797
|
+
BYTE *profile = (BYTE*)malloc((iccProfile->size + ICC_HEADER_SIZE) * sizeof(BYTE));
|
798
|
+
if(profile == NULL) return FALSE;
|
799
|
+
memcpy(profile, icc_signature, 12);
|
800
|
+
|
801
|
+
for(long i = 0; i < (long)iccProfile->size; i += MAX_DATA_BYTES_IN_MARKER) {
|
802
|
+
unsigned length = MIN((long)(iccProfile->size - i), MAX_DATA_BYTES_IN_MARKER);
|
803
|
+
// sequence number
|
804
|
+
profile[12] = (BYTE) ((i / MAX_DATA_BYTES_IN_MARKER) + 1);
|
805
|
+
// number of markers
|
806
|
+
profile[13] = (BYTE) (iccProfile->size / MAX_DATA_BYTES_IN_MARKER + 1);
|
807
|
+
|
808
|
+
memcpy(profile + ICC_HEADER_SIZE, (BYTE*)iccProfile->data + i, length);
|
809
|
+
jpeg_write_marker(cinfo, ICC_MARKER, profile, (length + ICC_HEADER_SIZE));
|
810
|
+
}
|
811
|
+
|
812
|
+
free(profile);
|
813
|
+
|
814
|
+
return TRUE;
|
815
|
+
}
|
816
|
+
|
817
|
+
return FALSE;
|
818
|
+
}
|
819
|
+
|
820
|
+
/**
|
821
|
+
Write JPEG_APPD marker (IPTC or Adobe Photoshop profile)
|
822
|
+
@return Returns TRUE if successful, FALSE otherwise
|
823
|
+
*/
|
824
|
+
static BOOL
|
825
|
+
jpeg_write_iptc_profile(j_compress_ptr cinfo, FIBITMAP *dib) {
|
826
|
+
//const char *ps_header = "Photoshop 3.0\x08BIM\x04\x04\x0\x0\x0\x0";
|
827
|
+
const unsigned tag_length = 26;
|
828
|
+
|
829
|
+
if(FreeImage_GetMetadataCount(FIMD_IPTC, dib)) {
|
830
|
+
BYTE *profile = NULL;
|
831
|
+
unsigned profile_size = 0;
|
832
|
+
|
833
|
+
// create a binary profile
|
834
|
+
if(write_iptc_profile(dib, &profile, &profile_size)) {
|
835
|
+
|
836
|
+
// write the profile
|
837
|
+
for(long i = 0; i < (long)profile_size; i += 65517L) {
|
838
|
+
unsigned length = MIN((long)profile_size - i, 65517L);
|
839
|
+
unsigned roundup = length & 0x01; // needed for Photoshop
|
840
|
+
BYTE *iptc_profile = (BYTE*)malloc(length + roundup + tag_length);
|
841
|
+
if(iptc_profile == NULL) break;
|
842
|
+
// Photoshop identification string
|
843
|
+
memcpy(&iptc_profile[0], "Photoshop 3.0\x0", 14);
|
844
|
+
// 8BIM segment type
|
845
|
+
memcpy(&iptc_profile[14], "8BIM\x04\x04\x0\x0\x0\x0", 10);
|
846
|
+
// segment size
|
847
|
+
iptc_profile[24] = (BYTE)(length >> 8);
|
848
|
+
iptc_profile[25] = (BYTE)(length & 0xFF);
|
849
|
+
// segment data
|
850
|
+
memcpy(&iptc_profile[tag_length], &profile[i], length);
|
851
|
+
if(roundup)
|
852
|
+
iptc_profile[length + tag_length] = 0;
|
853
|
+
jpeg_write_marker(cinfo, IPTC_MARKER, iptc_profile, length + roundup + tag_length);
|
854
|
+
free(iptc_profile);
|
855
|
+
}
|
856
|
+
|
857
|
+
// release profile
|
858
|
+
free(profile);
|
859
|
+
|
860
|
+
return TRUE;
|
861
|
+
}
|
862
|
+
}
|
863
|
+
|
864
|
+
return FALSE;
|
865
|
+
}
|
866
|
+
|
867
|
+
/**
|
868
|
+
Write JPEG_APP1 marker (XMP profile)
|
869
|
+
@return Returns TRUE if successful, FALSE otherwise
|
870
|
+
*/
|
871
|
+
static BOOL
|
872
|
+
jpeg_write_xmp_profile(j_compress_ptr cinfo, FIBITMAP *dib) {
|
873
|
+
// marker identifying string for XMP (null terminated)
|
874
|
+
const char *xmp_signature = "http://ns.adobe.com/xap/1.0/";
|
875
|
+
|
876
|
+
FITAG *tag_xmp = NULL;
|
877
|
+
FreeImage_GetMetadata(FIMD_XMP, dib, g_TagLib_XMPFieldName, &tag_xmp);
|
878
|
+
|
879
|
+
if(tag_xmp) {
|
880
|
+
const BYTE *tag_value = (BYTE*)FreeImage_GetTagValue(tag_xmp);
|
881
|
+
|
882
|
+
if(NULL != tag_value) {
|
883
|
+
// XMP signature is 29 bytes long
|
884
|
+
unsigned int xmp_header_size = (unsigned int)strlen(xmp_signature) + 1;
|
885
|
+
|
886
|
+
DWORD tag_length = FreeImage_GetTagLength(tag_xmp);
|
887
|
+
|
888
|
+
BYTE *profile = (BYTE*)malloc((tag_length + xmp_header_size) * sizeof(BYTE));
|
889
|
+
if(profile == NULL) return FALSE;
|
890
|
+
memcpy(profile, xmp_signature, xmp_header_size);
|
891
|
+
|
892
|
+
for(DWORD i = 0; i < tag_length; i += 65504L) {
|
893
|
+
unsigned length = MIN((long)(tag_length - i), 65504L);
|
894
|
+
|
895
|
+
memcpy(profile + xmp_header_size, tag_value + i, length);
|
896
|
+
jpeg_write_marker(cinfo, EXIF_MARKER, profile, (length + xmp_header_size));
|
897
|
+
}
|
898
|
+
|
899
|
+
free(profile);
|
900
|
+
|
901
|
+
return TRUE;
|
902
|
+
}
|
903
|
+
}
|
904
|
+
|
905
|
+
return FALSE;
|
906
|
+
}
|
907
|
+
|
908
|
+
/**
|
909
|
+
Write JPEG_APP1 marker (Exif profile)
|
910
|
+
@return Returns TRUE if successful, FALSE otherwise
|
911
|
+
*/
|
912
|
+
static BOOL
|
913
|
+
jpeg_write_exif_profile_raw(j_compress_ptr cinfo, FIBITMAP *dib) {
|
914
|
+
// marker identifying string for Exif = "Exif\0\0"
|
915
|
+
BYTE exif_signature[6] = { 0x45, 0x78, 0x69, 0x66, 0x00, 0x00 };
|
916
|
+
|
917
|
+
FITAG *tag_exif = NULL;
|
918
|
+
FreeImage_GetMetadata(FIMD_EXIF_RAW, dib, g_TagLib_ExifRawFieldName, &tag_exif);
|
919
|
+
|
920
|
+
if(tag_exif) {
|
921
|
+
const BYTE *tag_value = (BYTE*)FreeImage_GetTagValue(tag_exif);
|
922
|
+
|
923
|
+
// verify the identifying string
|
924
|
+
if(memcmp(exif_signature, tag_value, sizeof(exif_signature)) != 0) {
|
925
|
+
// not an Exif profile
|
926
|
+
return FALSE;
|
927
|
+
}
|
928
|
+
|
929
|
+
if(NULL != tag_value) {
|
930
|
+
DWORD tag_length = FreeImage_GetTagLength(tag_exif);
|
931
|
+
|
932
|
+
BYTE *profile = (BYTE*)malloc(tag_length * sizeof(BYTE));
|
933
|
+
if(profile == NULL) return FALSE;
|
934
|
+
|
935
|
+
for(DWORD i = 0; i < tag_length; i += 65504L) {
|
936
|
+
unsigned length = MIN((long)(tag_length - i), 65504L);
|
937
|
+
|
938
|
+
memcpy(profile, tag_value + i, length);
|
939
|
+
jpeg_write_marker(cinfo, EXIF_MARKER, profile, length);
|
940
|
+
}
|
941
|
+
|
942
|
+
free(profile);
|
943
|
+
|
944
|
+
return TRUE;
|
945
|
+
}
|
946
|
+
}
|
947
|
+
|
948
|
+
return FALSE;
|
949
|
+
}
|
950
|
+
|
951
|
+
/**
|
952
|
+
Write thumbnail (JFXX segment, JPEG compressed)
|
953
|
+
*/
|
954
|
+
static BOOL
|
955
|
+
jpeg_write_jfxx(j_compress_ptr cinfo, FIBITMAP *dib) {
|
956
|
+
// get the thumbnail to be stored
|
957
|
+
FIBITMAP* thumbnail = FreeImage_GetThumbnail(dib);
|
958
|
+
if(!thumbnail) {
|
959
|
+
return TRUE;
|
960
|
+
}
|
961
|
+
// check for a compatible output format
|
962
|
+
if((FreeImage_GetImageType(thumbnail) != FIT_BITMAP) || (FreeImage_GetBPP(thumbnail) != 8) && (FreeImage_GetBPP(thumbnail) != 24)) {
|
963
|
+
FreeImage_OutputMessageProc(s_format_id, FI_MSG_WARNING_INVALID_THUMBNAIL);
|
964
|
+
return FALSE;
|
965
|
+
}
|
966
|
+
|
967
|
+
// stores the thumbnail as a baseline JPEG into a memory block
|
968
|
+
// return the memory block only if its size is within JFXX marker size limit!
|
969
|
+
FIMEMORY *stream = FreeImage_OpenMemory();
|
970
|
+
|
971
|
+
if(FreeImage_SaveToMemory(FIF_JPEG, thumbnail, stream, JPEG_BASELINE)) {
|
972
|
+
// check that the memory block size is within JFXX marker size limit
|
973
|
+
FreeImage_SeekMemory(stream, 0, SEEK_END);
|
974
|
+
const long eof = FreeImage_TellMemory(stream);
|
975
|
+
if(eof > MAX_JFXX_THUMB_SIZE) {
|
976
|
+
FreeImage_OutputMessageProc(s_format_id, "Warning: attached thumbnail is %d bytes larger than maximum supported size - Thumbnail saving aborted", eof - MAX_JFXX_THUMB_SIZE);
|
977
|
+
FreeImage_CloseMemory(stream);
|
978
|
+
return FALSE;
|
979
|
+
}
|
980
|
+
} else {
|
981
|
+
FreeImage_CloseMemory(stream);
|
982
|
+
return FALSE;
|
983
|
+
}
|
984
|
+
|
985
|
+
BYTE* thData = NULL;
|
986
|
+
DWORD thSize = 0;
|
987
|
+
|
988
|
+
FreeImage_AcquireMemory(stream, &thData, &thSize);
|
989
|
+
|
990
|
+
BYTE id_length = 5; //< "JFXX"
|
991
|
+
BYTE type = JFXX_TYPE_JPEG;
|
992
|
+
|
993
|
+
DWORD totalsize = id_length + sizeof(type) + thSize;
|
994
|
+
jpeg_write_m_header(cinfo, JPEG_APP0, totalsize);
|
995
|
+
|
996
|
+
jpeg_write_m_byte(cinfo, 'J');
|
997
|
+
jpeg_write_m_byte(cinfo, 'F');
|
998
|
+
jpeg_write_m_byte(cinfo, 'X');
|
999
|
+
jpeg_write_m_byte(cinfo, 'X');
|
1000
|
+
jpeg_write_m_byte(cinfo, '\0');
|
1001
|
+
|
1002
|
+
jpeg_write_m_byte(cinfo, type);
|
1003
|
+
|
1004
|
+
// write thumbnail to destination.
|
1005
|
+
// We "cram it straight into the data destination module", because write_m_byte is slow
|
1006
|
+
|
1007
|
+
freeimage_dst_ptr dest = (freeimage_dst_ptr) cinfo->dest;
|
1008
|
+
|
1009
|
+
BYTE* & out = dest->pub.next_output_byte;
|
1010
|
+
size_t & bufRemain = dest->pub.free_in_buffer;
|
1011
|
+
|
1012
|
+
const BYTE *thData_end = thData + thSize;
|
1013
|
+
|
1014
|
+
while(thData < thData_end) {
|
1015
|
+
*(out)++ = *(thData)++;
|
1016
|
+
if (--bufRemain == 0) {
|
1017
|
+
// buffer full - flush
|
1018
|
+
if (!dest->pub.empty_output_buffer(cinfo)) {
|
1019
|
+
break;
|
1020
|
+
}
|
1021
|
+
}
|
1022
|
+
}
|
1023
|
+
|
1024
|
+
FreeImage_CloseMemory(stream);
|
1025
|
+
|
1026
|
+
return TRUE;
|
1027
|
+
}
|
1028
|
+
|
1029
|
+
/**
|
1030
|
+
Write JPEG special markers
|
1031
|
+
*/
|
1032
|
+
static BOOL
|
1033
|
+
write_markers(j_compress_ptr cinfo, FIBITMAP *dib) {
|
1034
|
+
// write thumbnail as a JFXX marker
|
1035
|
+
jpeg_write_jfxx(cinfo, dib);
|
1036
|
+
|
1037
|
+
// write user comment as a JPEG_COM marker
|
1038
|
+
jpeg_write_comment(cinfo, dib);
|
1039
|
+
|
1040
|
+
// write ICC profile
|
1041
|
+
jpeg_write_icc_profile(cinfo, dib);
|
1042
|
+
|
1043
|
+
// write IPTC profile
|
1044
|
+
jpeg_write_iptc_profile(cinfo, dib);
|
1045
|
+
|
1046
|
+
// write Adobe XMP profile
|
1047
|
+
jpeg_write_xmp_profile(cinfo, dib);
|
1048
|
+
|
1049
|
+
// write Exif raw data
|
1050
|
+
jpeg_write_exif_profile_raw(cinfo, dib);
|
1051
|
+
|
1052
|
+
return TRUE;
|
1053
|
+
}
|
1054
|
+
|
1055
|
+
// ------------------------------------------------------------
|
1056
|
+
// Keep original size info when using scale option on loading
|
1057
|
+
// ------------------------------------------------------------
|
1058
|
+
static void
|
1059
|
+
store_size_info(FIBITMAP *dib, JDIMENSION width, JDIMENSION height) {
|
1060
|
+
char buffer[256];
|
1061
|
+
// create a tag
|
1062
|
+
FITAG *tag = FreeImage_CreateTag();
|
1063
|
+
if(tag) {
|
1064
|
+
size_t length = 0;
|
1065
|
+
// set the original width
|
1066
|
+
sprintf(buffer, "%d", (int)width);
|
1067
|
+
length = strlen(buffer) + 1; // include the NULL/0 value
|
1068
|
+
FreeImage_SetTagKey(tag, "OriginalJPEGWidth");
|
1069
|
+
FreeImage_SetTagLength(tag, (DWORD)length);
|
1070
|
+
FreeImage_SetTagCount(tag, (DWORD)length);
|
1071
|
+
FreeImage_SetTagType(tag, FIDT_ASCII);
|
1072
|
+
FreeImage_SetTagValue(tag, buffer);
|
1073
|
+
FreeImage_SetMetadata(FIMD_COMMENTS, dib, FreeImage_GetTagKey(tag), tag);
|
1074
|
+
// set the original height
|
1075
|
+
sprintf(buffer, "%d", (int)height);
|
1076
|
+
length = strlen(buffer) + 1; // include the NULL/0 value
|
1077
|
+
FreeImage_SetTagKey(tag, "OriginalJPEGHeight");
|
1078
|
+
FreeImage_SetTagLength(tag, (DWORD)length);
|
1079
|
+
FreeImage_SetTagCount(tag, (DWORD)length);
|
1080
|
+
FreeImage_SetTagType(tag, FIDT_ASCII);
|
1081
|
+
FreeImage_SetTagValue(tag, buffer);
|
1082
|
+
FreeImage_SetMetadata(FIMD_COMMENTS, dib, FreeImage_GetTagKey(tag), tag);
|
1083
|
+
// destroy the tag
|
1084
|
+
FreeImage_DeleteTag(tag);
|
1085
|
+
}
|
1086
|
+
}
|
1087
|
+
|
1088
|
+
// ==========================================================
|
1089
|
+
// Plugin Implementation
|
1090
|
+
// ==========================================================
|
1091
|
+
|
1092
|
+
static const char * DLL_CALLCONV
|
1093
|
+
Format() {
|
1094
|
+
return "JPEG";
|
1095
|
+
}
|
1096
|
+
|
1097
|
+
static const char * DLL_CALLCONV
|
1098
|
+
Description() {
|
1099
|
+
return "JPEG - JFIF Compliant";
|
1100
|
+
}
|
1101
|
+
|
1102
|
+
static const char * DLL_CALLCONV
|
1103
|
+
Extension() {
|
1104
|
+
return "jpg,jif,jpeg,jpe";
|
1105
|
+
}
|
1106
|
+
|
1107
|
+
static const char * DLL_CALLCONV
|
1108
|
+
RegExpr() {
|
1109
|
+
return "^\377\330\377";
|
1110
|
+
}
|
1111
|
+
|
1112
|
+
static const char * DLL_CALLCONV
|
1113
|
+
MimeType() {
|
1114
|
+
return "image/jpeg";
|
1115
|
+
}
|
1116
|
+
|
1117
|
+
static BOOL DLL_CALLCONV
|
1118
|
+
Validate(FreeImageIO *io, fi_handle handle) {
|
1119
|
+
BYTE jpeg_signature[] = { 0xFF, 0xD8 };
|
1120
|
+
BYTE signature[2] = { 0, 0 };
|
1121
|
+
|
1122
|
+
io->read_proc(signature, 1, sizeof(jpeg_signature), handle);
|
1123
|
+
|
1124
|
+
return (memcmp(jpeg_signature, signature, sizeof(jpeg_signature)) == 0);
|
1125
|
+
}
|
1126
|
+
|
1127
|
+
static BOOL DLL_CALLCONV
|
1128
|
+
SupportsExportDepth(int depth) {
|
1129
|
+
return (
|
1130
|
+
(depth == 8) ||
|
1131
|
+
(depth == 24)
|
1132
|
+
);
|
1133
|
+
}
|
1134
|
+
|
1135
|
+
static BOOL DLL_CALLCONV
|
1136
|
+
SupportsExportType(FREE_IMAGE_TYPE type) {
|
1137
|
+
return (type == FIT_BITMAP) ? TRUE : FALSE;
|
1138
|
+
}
|
1139
|
+
|
1140
|
+
static BOOL DLL_CALLCONV
|
1141
|
+
SupportsICCProfiles() {
|
1142
|
+
return TRUE;
|
1143
|
+
}
|
1144
|
+
|
1145
|
+
static BOOL DLL_CALLCONV
|
1146
|
+
SupportsNoPixels() {
|
1147
|
+
return TRUE;
|
1148
|
+
}
|
1149
|
+
|
1150
|
+
// ----------------------------------------------------------
|
1151
|
+
|
1152
|
+
static FIBITMAP * DLL_CALLCONV
|
1153
|
+
Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
|
1154
|
+
if (handle) {
|
1155
|
+
FIBITMAP *dib = NULL;
|
1156
|
+
|
1157
|
+
BOOL header_only = (flags & FIF_LOAD_NOPIXELS) == FIF_LOAD_NOPIXELS;
|
1158
|
+
|
1159
|
+
// set up the jpeglib structures
|
1160
|
+
|
1161
|
+
struct jpeg_decompress_struct cinfo;
|
1162
|
+
ErrorManager fi_error_mgr;
|
1163
|
+
|
1164
|
+
try {
|
1165
|
+
|
1166
|
+
// step 1: allocate and initialize JPEG decompression object
|
1167
|
+
|
1168
|
+
// we set up the normal JPEG error routines, then override error_exit & output_message
|
1169
|
+
cinfo.err = jpeg_std_error(&fi_error_mgr.pub);
|
1170
|
+
fi_error_mgr.pub.error_exit = jpeg_error_exit;
|
1171
|
+
fi_error_mgr.pub.output_message = jpeg_output_message;
|
1172
|
+
|
1173
|
+
// establish the setjmp return context for jpeg_error_exit to use
|
1174
|
+
if (setjmp(fi_error_mgr.setjmp_buffer)) {
|
1175
|
+
// If we get here, the JPEG code has signaled an error.
|
1176
|
+
// We need to clean up the JPEG object, close the input file, and return.
|
1177
|
+
jpeg_destroy_decompress(&cinfo);
|
1178
|
+
throw (const char*)NULL;
|
1179
|
+
}
|
1180
|
+
|
1181
|
+
jpeg_create_decompress(&cinfo);
|
1182
|
+
|
1183
|
+
// step 2a: specify data source (eg, a handle)
|
1184
|
+
|
1185
|
+
jpeg_freeimage_src(&cinfo, handle, io);
|
1186
|
+
|
1187
|
+
// step 2b: save special markers for later reading
|
1188
|
+
|
1189
|
+
jpeg_save_markers(&cinfo, JPEG_COM, 0xFFFF);
|
1190
|
+
for(int m = 0; m < 16; m++) {
|
1191
|
+
jpeg_save_markers(&cinfo, JPEG_APP0 + m, 0xFFFF);
|
1192
|
+
}
|
1193
|
+
|
1194
|
+
// step 3: read handle parameters with jpeg_read_header()
|
1195
|
+
|
1196
|
+
jpeg_read_header(&cinfo, TRUE);
|
1197
|
+
|
1198
|
+
// step 4: set parameters for decompression
|
1199
|
+
|
1200
|
+
unsigned int scale_denom = 1; // fraction by which to scale image
|
1201
|
+
int requested_size = flags >> 16; // requested user size in pixels
|
1202
|
+
if(requested_size > 0) {
|
1203
|
+
// the JPEG codec can perform x2, x4 or x8 scaling on loading
|
1204
|
+
// try to find the more appropriate scaling according to user's need
|
1205
|
+
double scale = MAX((double)cinfo.image_width, (double)cinfo.image_height) / (double)requested_size;
|
1206
|
+
if(scale >= 8) {
|
1207
|
+
scale_denom = 8;
|
1208
|
+
} else if(scale >= 4) {
|
1209
|
+
scale_denom = 4;
|
1210
|
+
} else if(scale >= 2) {
|
1211
|
+
scale_denom = 2;
|
1212
|
+
}
|
1213
|
+
}
|
1214
|
+
cinfo.scale_num = 1;
|
1215
|
+
cinfo.scale_denom = scale_denom;
|
1216
|
+
|
1217
|
+
if ((flags & JPEG_ACCURATE) != JPEG_ACCURATE) {
|
1218
|
+
cinfo.dct_method = JDCT_IFAST;
|
1219
|
+
cinfo.do_fancy_upsampling = FALSE;
|
1220
|
+
}
|
1221
|
+
|
1222
|
+
if ((flags & JPEG_GREYSCALE) == JPEG_GREYSCALE) {
|
1223
|
+
// force loading as a 8-bit greyscale image
|
1224
|
+
cinfo.out_color_space = JCS_GRAYSCALE;
|
1225
|
+
}
|
1226
|
+
|
1227
|
+
// step 5a: start decompressor and calculate output width and height
|
1228
|
+
|
1229
|
+
jpeg_start_decompress(&cinfo);
|
1230
|
+
|
1231
|
+
// step 5b: allocate dib and init header
|
1232
|
+
|
1233
|
+
if((cinfo.output_components == 4) && (cinfo.out_color_space == JCS_CMYK)) {
|
1234
|
+
// CMYK image
|
1235
|
+
if((flags & JPEG_CMYK) == JPEG_CMYK) {
|
1236
|
+
// load as CMYK
|
1237
|
+
dib = FreeImage_AllocateHeader(header_only, cinfo.output_width, cinfo.output_height, 32, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK);
|
1238
|
+
if(!dib) throw FI_MSG_ERROR_DIB_MEMORY;
|
1239
|
+
FreeImage_GetICCProfile(dib)->flags |= FIICC_COLOR_IS_CMYK;
|
1240
|
+
} else {
|
1241
|
+
// load as CMYK and convert to RGB
|
1242
|
+
dib = FreeImage_AllocateHeader(header_only, cinfo.output_width, cinfo.output_height, 24, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK);
|
1243
|
+
if(!dib) throw FI_MSG_ERROR_DIB_MEMORY;
|
1244
|
+
}
|
1245
|
+
} else {
|
1246
|
+
// RGB or greyscale image
|
1247
|
+
dib = FreeImage_AllocateHeader(header_only, cinfo.output_width, cinfo.output_height, 8 * cinfo.output_components, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK);
|
1248
|
+
if(!dib) throw FI_MSG_ERROR_DIB_MEMORY;
|
1249
|
+
|
1250
|
+
if (cinfo.output_components == 1) {
|
1251
|
+
// build a greyscale palette
|
1252
|
+
RGBQUAD *colors = FreeImage_GetPalette(dib);
|
1253
|
+
|
1254
|
+
for (int i = 0; i < 256; i++) {
|
1255
|
+
colors[i].rgbRed = (BYTE)i;
|
1256
|
+
colors[i].rgbGreen = (BYTE)i;
|
1257
|
+
colors[i].rgbBlue = (BYTE)i;
|
1258
|
+
}
|
1259
|
+
}
|
1260
|
+
}
|
1261
|
+
if(scale_denom != 1) {
|
1262
|
+
// store original size info if a scaling was requested
|
1263
|
+
store_size_info(dib, cinfo.image_width, cinfo.image_height);
|
1264
|
+
}
|
1265
|
+
|
1266
|
+
// step 5c: handle metrices
|
1267
|
+
|
1268
|
+
if (cinfo.density_unit == 1) {
|
1269
|
+
// dots/inch
|
1270
|
+
FreeImage_SetDotsPerMeterX(dib, (unsigned) (((float)cinfo.X_density) / 0.0254000 + 0.5));
|
1271
|
+
FreeImage_SetDotsPerMeterY(dib, (unsigned) (((float)cinfo.Y_density) / 0.0254000 + 0.5));
|
1272
|
+
} else if (cinfo.density_unit == 2) {
|
1273
|
+
// dots/cm
|
1274
|
+
FreeImage_SetDotsPerMeterX(dib, (unsigned) (cinfo.X_density * 100));
|
1275
|
+
FreeImage_SetDotsPerMeterY(dib, (unsigned) (cinfo.Y_density * 100));
|
1276
|
+
}
|
1277
|
+
|
1278
|
+
// step 6: read special markers
|
1279
|
+
|
1280
|
+
read_markers(&cinfo, dib);
|
1281
|
+
|
1282
|
+
// --- header only mode => clean-up and return
|
1283
|
+
|
1284
|
+
if (header_only) {
|
1285
|
+
// release JPEG decompression object
|
1286
|
+
jpeg_destroy_decompress(&cinfo);
|
1287
|
+
// return header data
|
1288
|
+
return dib;
|
1289
|
+
}
|
1290
|
+
|
1291
|
+
// step 7a: while (scan lines remain to be read) jpeg_read_scanlines(...);
|
1292
|
+
|
1293
|
+
if((cinfo.out_color_space == JCS_CMYK) && ((flags & JPEG_CMYK) != JPEG_CMYK)) {
|
1294
|
+
// convert from CMYK to RGB
|
1295
|
+
|
1296
|
+
JSAMPARRAY buffer; // output row buffer
|
1297
|
+
unsigned row_stride; // physical row width in output buffer
|
1298
|
+
|
1299
|
+
// JSAMPLEs per row in output buffer
|
1300
|
+
row_stride = cinfo.output_width * cinfo.output_components;
|
1301
|
+
// make a one-row-high sample array that will go away when done with image
|
1302
|
+
buffer = (*cinfo.mem->alloc_sarray)((j_common_ptr) &cinfo, JPOOL_IMAGE, row_stride, 1);
|
1303
|
+
|
1304
|
+
while (cinfo.output_scanline < cinfo.output_height) {
|
1305
|
+
JSAMPROW src = buffer[0];
|
1306
|
+
JSAMPROW dst = FreeImage_GetScanLine(dib, cinfo.output_height - cinfo.output_scanline - 1);
|
1307
|
+
|
1308
|
+
jpeg_read_scanlines(&cinfo, buffer, 1);
|
1309
|
+
|
1310
|
+
for(unsigned x = 0; x < cinfo.output_width; x++) {
|
1311
|
+
WORD K = (WORD)src[3];
|
1312
|
+
dst[FI_RGBA_RED] = (BYTE)((K * src[0]) / 255); // C -> R
|
1313
|
+
dst[FI_RGBA_GREEN] = (BYTE)((K * src[1]) / 255); // M -> G
|
1314
|
+
dst[FI_RGBA_BLUE] = (BYTE)((K * src[2]) / 255); // Y -> B
|
1315
|
+
src += 4;
|
1316
|
+
dst += 3;
|
1317
|
+
}
|
1318
|
+
}
|
1319
|
+
} else if((cinfo.out_color_space == JCS_CMYK) && ((flags & JPEG_CMYK) == JPEG_CMYK)) {
|
1320
|
+
// convert from LibJPEG CMYK to standard CMYK
|
1321
|
+
|
1322
|
+
JSAMPARRAY buffer; // output row buffer
|
1323
|
+
unsigned row_stride; // physical row width in output buffer
|
1324
|
+
|
1325
|
+
// JSAMPLEs per row in output buffer
|
1326
|
+
row_stride = cinfo.output_width * cinfo.output_components;
|
1327
|
+
// make a one-row-high sample array that will go away when done with image
|
1328
|
+
buffer = (*cinfo.mem->alloc_sarray)((j_common_ptr) &cinfo, JPOOL_IMAGE, row_stride, 1);
|
1329
|
+
|
1330
|
+
while (cinfo.output_scanline < cinfo.output_height) {
|
1331
|
+
JSAMPROW src = buffer[0];
|
1332
|
+
JSAMPROW dst = FreeImage_GetScanLine(dib, cinfo.output_height - cinfo.output_scanline - 1);
|
1333
|
+
|
1334
|
+
jpeg_read_scanlines(&cinfo, buffer, 1);
|
1335
|
+
|
1336
|
+
for(unsigned x = 0; x < cinfo.output_width; x++) {
|
1337
|
+
// CMYK pixels are inverted
|
1338
|
+
dst[0] = ~src[0]; // C
|
1339
|
+
dst[1] = ~src[1]; // M
|
1340
|
+
dst[2] = ~src[2]; // Y
|
1341
|
+
dst[3] = ~src[3]; // K
|
1342
|
+
src += 4;
|
1343
|
+
dst += 4;
|
1344
|
+
}
|
1345
|
+
}
|
1346
|
+
|
1347
|
+
} else {
|
1348
|
+
// normal case (RGB or greyscale image)
|
1349
|
+
|
1350
|
+
while (cinfo.output_scanline < cinfo.output_height) {
|
1351
|
+
JSAMPROW dst = FreeImage_GetScanLine(dib, cinfo.output_height - cinfo.output_scanline - 1);
|
1352
|
+
|
1353
|
+
jpeg_read_scanlines(&cinfo, &dst, 1);
|
1354
|
+
}
|
1355
|
+
|
1356
|
+
// step 7b: swap red and blue components (see LibJPEG/jmorecfg.h: #define RGB_RED, ...)
|
1357
|
+
// The default behavior of the JPEG library is kept "as is" because LibTIFF uses
|
1358
|
+
// LibJPEG "as is".
|
1359
|
+
|
1360
|
+
#if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR
|
1361
|
+
SwapRedBlue32(dib);
|
1362
|
+
#endif
|
1363
|
+
}
|
1364
|
+
|
1365
|
+
// step 8: finish decompression
|
1366
|
+
|
1367
|
+
jpeg_finish_decompress(&cinfo);
|
1368
|
+
|
1369
|
+
// step 9: release JPEG decompression object
|
1370
|
+
|
1371
|
+
jpeg_destroy_decompress(&cinfo);
|
1372
|
+
|
1373
|
+
// check for automatic Exif rotation
|
1374
|
+
if(!header_only && ((flags & JPEG_EXIFROTATE) == JPEG_EXIFROTATE)) {
|
1375
|
+
RotateExif(&dib);
|
1376
|
+
}
|
1377
|
+
|
1378
|
+
// everything went well. return the loaded dib
|
1379
|
+
|
1380
|
+
return dib;
|
1381
|
+
|
1382
|
+
} catch (const char *text) {
|
1383
|
+
jpeg_destroy_decompress(&cinfo);
|
1384
|
+
if(NULL != dib) {
|
1385
|
+
FreeImage_Unload(dib);
|
1386
|
+
}
|
1387
|
+
if(NULL != text) {
|
1388
|
+
FreeImage_OutputMessageProc(s_format_id, text);
|
1389
|
+
}
|
1390
|
+
}
|
1391
|
+
}
|
1392
|
+
|
1393
|
+
return NULL;
|
1394
|
+
}
|
1395
|
+
|
1396
|
+
// ----------------------------------------------------------
|
1397
|
+
|
1398
|
+
static BOOL DLL_CALLCONV
|
1399
|
+
Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void *data) {
|
1400
|
+
if ((dib) && (handle)) {
|
1401
|
+
try {
|
1402
|
+
// Check dib format
|
1403
|
+
|
1404
|
+
const char *sError = "only 24-bit highcolor or 8-bit greyscale/palette bitmaps can be saved as JPEG";
|
1405
|
+
|
1406
|
+
FREE_IMAGE_COLOR_TYPE color_type = FreeImage_GetColorType(dib);
|
1407
|
+
WORD bpp = (WORD)FreeImage_GetBPP(dib);
|
1408
|
+
|
1409
|
+
if ((bpp != 24) && (bpp != 8)) {
|
1410
|
+
throw sError;
|
1411
|
+
}
|
1412
|
+
|
1413
|
+
if(bpp == 8) {
|
1414
|
+
// allow grey, reverse grey and palette
|
1415
|
+
if ((color_type != FIC_MINISBLACK) && (color_type != FIC_MINISWHITE) && (color_type != FIC_PALETTE)) {
|
1416
|
+
throw sError;
|
1417
|
+
}
|
1418
|
+
}
|
1419
|
+
|
1420
|
+
|
1421
|
+
struct jpeg_compress_struct cinfo;
|
1422
|
+
ErrorManager fi_error_mgr;
|
1423
|
+
|
1424
|
+
// Step 1: allocate and initialize JPEG compression object
|
1425
|
+
|
1426
|
+
// we set up the normal JPEG error routines, then override error_exit & output_message
|
1427
|
+
cinfo.err = jpeg_std_error(&fi_error_mgr.pub);
|
1428
|
+
fi_error_mgr.pub.error_exit = jpeg_error_exit;
|
1429
|
+
fi_error_mgr.pub.output_message = jpeg_output_message;
|
1430
|
+
|
1431
|
+
// establish the setjmp return context for jpeg_error_exit to use
|
1432
|
+
if (setjmp(fi_error_mgr.setjmp_buffer)) {
|
1433
|
+
// If we get here, the JPEG code has signaled an error.
|
1434
|
+
// We need to clean up the JPEG object, close the input file, and return.
|
1435
|
+
jpeg_destroy_compress(&cinfo);
|
1436
|
+
throw (const char*)NULL;
|
1437
|
+
}
|
1438
|
+
|
1439
|
+
// Now we can initialize the JPEG compression object
|
1440
|
+
|
1441
|
+
jpeg_create_compress(&cinfo);
|
1442
|
+
|
1443
|
+
// Step 2: specify data destination (eg, a file)
|
1444
|
+
|
1445
|
+
jpeg_freeimage_dst(&cinfo, handle, io);
|
1446
|
+
|
1447
|
+
// Step 3: set parameters for compression
|
1448
|
+
|
1449
|
+
cinfo.image_width = FreeImage_GetWidth(dib);
|
1450
|
+
cinfo.image_height = FreeImage_GetHeight(dib);
|
1451
|
+
|
1452
|
+
switch(color_type) {
|
1453
|
+
case FIC_MINISBLACK :
|
1454
|
+
case FIC_MINISWHITE :
|
1455
|
+
cinfo.in_color_space = JCS_GRAYSCALE;
|
1456
|
+
cinfo.input_components = 1;
|
1457
|
+
break;
|
1458
|
+
|
1459
|
+
default :
|
1460
|
+
cinfo.in_color_space = JCS_RGB;
|
1461
|
+
cinfo.input_components = 3;
|
1462
|
+
break;
|
1463
|
+
}
|
1464
|
+
|
1465
|
+
jpeg_set_defaults(&cinfo);
|
1466
|
+
|
1467
|
+
// progressive-JPEG support
|
1468
|
+
if((flags & JPEG_PROGRESSIVE) == JPEG_PROGRESSIVE) {
|
1469
|
+
jpeg_simple_progression(&cinfo);
|
1470
|
+
}
|
1471
|
+
|
1472
|
+
// compute optimal Huffman coding tables for the image
|
1473
|
+
if((flags & JPEG_OPTIMIZE) == JPEG_OPTIMIZE) {
|
1474
|
+
cinfo.optimize_coding = TRUE;
|
1475
|
+
}
|
1476
|
+
|
1477
|
+
// Set JFIF density parameters from the DIB data
|
1478
|
+
|
1479
|
+
cinfo.X_density = (UINT16) (0.5 + 0.0254 * FreeImage_GetDotsPerMeterX(dib));
|
1480
|
+
cinfo.Y_density = (UINT16) (0.5 + 0.0254 * FreeImage_GetDotsPerMeterY(dib));
|
1481
|
+
cinfo.density_unit = 1; // dots / inch
|
1482
|
+
|
1483
|
+
// thumbnail support (JFIF 1.02 extension markers)
|
1484
|
+
if(FreeImage_GetThumbnail(dib) != NULL) {
|
1485
|
+
cinfo.write_JFIF_header = 1; //<### force it, though when color is CMYK it will be incorrect
|
1486
|
+
cinfo.JFIF_minor_version = 2;
|
1487
|
+
}
|
1488
|
+
|
1489
|
+
// baseline JPEG support
|
1490
|
+
if ((flags & JPEG_BASELINE) == JPEG_BASELINE) {
|
1491
|
+
cinfo.write_JFIF_header = 0; // No marker for non-JFIF colorspaces
|
1492
|
+
cinfo.write_Adobe_marker = 0; // write no Adobe marker by default
|
1493
|
+
}
|
1494
|
+
|
1495
|
+
// set subsampling options if required
|
1496
|
+
|
1497
|
+
if(cinfo.in_color_space == JCS_RGB) {
|
1498
|
+
if((flags & JPEG_SUBSAMPLING_411) == JPEG_SUBSAMPLING_411) {
|
1499
|
+
// 4:1:1 (4x1 1x1 1x1) - CrH 25% - CbH 25% - CrV 100% - CbV 100%
|
1500
|
+
// the horizontal color resolution is quartered
|
1501
|
+
cinfo.comp_info[0].h_samp_factor = 4; // Y
|
1502
|
+
cinfo.comp_info[0].v_samp_factor = 1;
|
1503
|
+
cinfo.comp_info[1].h_samp_factor = 1; // Cb
|
1504
|
+
cinfo.comp_info[1].v_samp_factor = 1;
|
1505
|
+
cinfo.comp_info[2].h_samp_factor = 1; // Cr
|
1506
|
+
cinfo.comp_info[2].v_samp_factor = 1;
|
1507
|
+
} else if((flags & JPEG_SUBSAMPLING_420) == JPEG_SUBSAMPLING_420) {
|
1508
|
+
// 4:2:0 (2x2 1x1 1x1) - CrH 50% - CbH 50% - CrV 50% - CbV 50%
|
1509
|
+
// the chrominance resolution in both the horizontal and vertical directions is cut in half
|
1510
|
+
cinfo.comp_info[0].h_samp_factor = 2; // Y
|
1511
|
+
cinfo.comp_info[0].v_samp_factor = 2;
|
1512
|
+
cinfo.comp_info[1].h_samp_factor = 1; // Cb
|
1513
|
+
cinfo.comp_info[1].v_samp_factor = 1;
|
1514
|
+
cinfo.comp_info[2].h_samp_factor = 1; // Cr
|
1515
|
+
cinfo.comp_info[2].v_samp_factor = 1;
|
1516
|
+
} else if((flags & JPEG_SUBSAMPLING_422) == JPEG_SUBSAMPLING_422){ //2x1 (low)
|
1517
|
+
// 4:2:2 (2x1 1x1 1x1) - CrH 50% - CbH 50% - CrV 100% - CbV 100%
|
1518
|
+
// half of the horizontal resolution in the chrominance is dropped (Cb & Cr),
|
1519
|
+
// while the full resolution is retained in the vertical direction, with respect to the luminance
|
1520
|
+
cinfo.comp_info[0].h_samp_factor = 2; // Y
|
1521
|
+
cinfo.comp_info[0].v_samp_factor = 1;
|
1522
|
+
cinfo.comp_info[1].h_samp_factor = 1; // Cb
|
1523
|
+
cinfo.comp_info[1].v_samp_factor = 1;
|
1524
|
+
cinfo.comp_info[2].h_samp_factor = 1; // Cr
|
1525
|
+
cinfo.comp_info[2].v_samp_factor = 1;
|
1526
|
+
}
|
1527
|
+
else if((flags & JPEG_SUBSAMPLING_444) == JPEG_SUBSAMPLING_444){ //1x1 (no subsampling)
|
1528
|
+
// 4:4:4 (1x1 1x1 1x1) - CrH 100% - CbH 100% - CrV 100% - CbV 100%
|
1529
|
+
// the resolution of chrominance information (Cb & Cr) is preserved
|
1530
|
+
// at the same rate as the luminance (Y) information
|
1531
|
+
cinfo.comp_info[0].h_samp_factor = 1; // Y
|
1532
|
+
cinfo.comp_info[0].v_samp_factor = 1;
|
1533
|
+
cinfo.comp_info[1].h_samp_factor = 1; // Cb
|
1534
|
+
cinfo.comp_info[1].v_samp_factor = 1;
|
1535
|
+
cinfo.comp_info[2].h_samp_factor = 1; // Cr
|
1536
|
+
cinfo.comp_info[2].v_samp_factor = 1;
|
1537
|
+
}
|
1538
|
+
}
|
1539
|
+
|
1540
|
+
// Step 4: set quality
|
1541
|
+
// the first 7 bits are reserved for low level quality settings
|
1542
|
+
// the other bits are high level (i.e. enum-ish)
|
1543
|
+
|
1544
|
+
int quality;
|
1545
|
+
|
1546
|
+
if ((flags & JPEG_QUALITYBAD) == JPEG_QUALITYBAD) {
|
1547
|
+
quality = 10;
|
1548
|
+
} else if ((flags & JPEG_QUALITYAVERAGE) == JPEG_QUALITYAVERAGE) {
|
1549
|
+
quality = 25;
|
1550
|
+
} else if ((flags & JPEG_QUALITYNORMAL) == JPEG_QUALITYNORMAL) {
|
1551
|
+
quality = 50;
|
1552
|
+
} else if ((flags & JPEG_QUALITYGOOD) == JPEG_QUALITYGOOD) {
|
1553
|
+
quality = 75;
|
1554
|
+
} else if ((flags & JPEG_QUALITYSUPERB) == JPEG_QUALITYSUPERB) {
|
1555
|
+
quality = 100;
|
1556
|
+
} else {
|
1557
|
+
if ((flags & 0x7F) == 0) {
|
1558
|
+
quality = 75;
|
1559
|
+
} else {
|
1560
|
+
quality = flags & 0x7F;
|
1561
|
+
}
|
1562
|
+
}
|
1563
|
+
|
1564
|
+
jpeg_set_quality(&cinfo, quality, TRUE); /* limit to baseline-JPEG values */
|
1565
|
+
|
1566
|
+
// Step 5: Start compressor
|
1567
|
+
|
1568
|
+
jpeg_start_compress(&cinfo, TRUE);
|
1569
|
+
|
1570
|
+
// Step 6: Write special markers
|
1571
|
+
|
1572
|
+
if ((flags & JPEG_BASELINE) != JPEG_BASELINE) {
|
1573
|
+
write_markers(&cinfo, dib);
|
1574
|
+
}
|
1575
|
+
|
1576
|
+
// Step 7: while (scan lines remain to be written)
|
1577
|
+
|
1578
|
+
if(color_type == FIC_RGB) {
|
1579
|
+
// 24-bit RGB image : need to swap red and blue channels
|
1580
|
+
unsigned pitch = FreeImage_GetPitch(dib);
|
1581
|
+
BYTE *target = (BYTE*)malloc(pitch * sizeof(BYTE));
|
1582
|
+
if (target == NULL) {
|
1583
|
+
throw FI_MSG_ERROR_MEMORY;
|
1584
|
+
}
|
1585
|
+
|
1586
|
+
while (cinfo.next_scanline < cinfo.image_height) {
|
1587
|
+
// get a copy of the scanline
|
1588
|
+
memcpy(target, FreeImage_GetScanLine(dib, FreeImage_GetHeight(dib) - cinfo.next_scanline - 1), pitch);
|
1589
|
+
#if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR
|
1590
|
+
// swap R and B channels
|
1591
|
+
BYTE *target_p = target;
|
1592
|
+
for(unsigned x = 0; x < cinfo.image_width; x++) {
|
1593
|
+
INPLACESWAP(target_p[0], target_p[2]);
|
1594
|
+
target_p += 3;
|
1595
|
+
}
|
1596
|
+
#endif
|
1597
|
+
// write the scanline
|
1598
|
+
jpeg_write_scanlines(&cinfo, &target, 1);
|
1599
|
+
}
|
1600
|
+
free(target);
|
1601
|
+
}
|
1602
|
+
else if(color_type == FIC_MINISBLACK) {
|
1603
|
+
// 8-bit standard greyscale images
|
1604
|
+
while (cinfo.next_scanline < cinfo.image_height) {
|
1605
|
+
JSAMPROW b = FreeImage_GetScanLine(dib, FreeImage_GetHeight(dib) - cinfo.next_scanline - 1);
|
1606
|
+
|
1607
|
+
jpeg_write_scanlines(&cinfo, &b, 1);
|
1608
|
+
}
|
1609
|
+
}
|
1610
|
+
else if(color_type == FIC_PALETTE) {
|
1611
|
+
// 8-bit palettized images are converted to 24-bit images
|
1612
|
+
RGBQUAD *palette = FreeImage_GetPalette(dib);
|
1613
|
+
BYTE *target = (BYTE*)malloc(cinfo.image_width * 3);
|
1614
|
+
if (target == NULL) {
|
1615
|
+
throw FI_MSG_ERROR_MEMORY;
|
1616
|
+
}
|
1617
|
+
|
1618
|
+
while (cinfo.next_scanline < cinfo.image_height) {
|
1619
|
+
BYTE *source = FreeImage_GetScanLine(dib, FreeImage_GetHeight(dib) - cinfo.next_scanline - 1);
|
1620
|
+
FreeImage_ConvertLine8To24(target, source, cinfo.image_width, palette);
|
1621
|
+
|
1622
|
+
#if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR
|
1623
|
+
// swap R and B channels
|
1624
|
+
BYTE *target_p = target;
|
1625
|
+
for(unsigned x = 0; x < cinfo.image_width; x++) {
|
1626
|
+
INPLACESWAP(target_p[0], target_p[2]);
|
1627
|
+
target_p += 3;
|
1628
|
+
}
|
1629
|
+
#endif
|
1630
|
+
|
1631
|
+
|
1632
|
+
jpeg_write_scanlines(&cinfo, &target, 1);
|
1633
|
+
}
|
1634
|
+
|
1635
|
+
free(target);
|
1636
|
+
}
|
1637
|
+
else if(color_type == FIC_MINISWHITE) {
|
1638
|
+
// reverse 8-bit greyscale image, so reverse grey value on the fly
|
1639
|
+
unsigned i;
|
1640
|
+
BYTE reverse[256];
|
1641
|
+
BYTE *target = (BYTE *)malloc(cinfo.image_width);
|
1642
|
+
if (target == NULL) {
|
1643
|
+
throw FI_MSG_ERROR_MEMORY;
|
1644
|
+
}
|
1645
|
+
|
1646
|
+
for(i = 0; i < 256; i++) {
|
1647
|
+
reverse[i] = (BYTE)(255 - i);
|
1648
|
+
}
|
1649
|
+
|
1650
|
+
while(cinfo.next_scanline < cinfo.image_height) {
|
1651
|
+
BYTE *source = FreeImage_GetScanLine(dib, FreeImage_GetHeight(dib) - cinfo.next_scanline - 1);
|
1652
|
+
for(i = 0; i < cinfo.image_width; i++) {
|
1653
|
+
target[i] = reverse[ source[i] ];
|
1654
|
+
}
|
1655
|
+
jpeg_write_scanlines(&cinfo, &target, 1);
|
1656
|
+
}
|
1657
|
+
|
1658
|
+
free(target);
|
1659
|
+
}
|
1660
|
+
|
1661
|
+
// Step 8: Finish compression
|
1662
|
+
|
1663
|
+
jpeg_finish_compress(&cinfo);
|
1664
|
+
|
1665
|
+
// Step 9: release JPEG compression object
|
1666
|
+
|
1667
|
+
jpeg_destroy_compress(&cinfo);
|
1668
|
+
|
1669
|
+
return TRUE;
|
1670
|
+
|
1671
|
+
} catch (const char *text) {
|
1672
|
+
if(text) {
|
1673
|
+
FreeImage_OutputMessageProc(s_format_id, text);
|
1674
|
+
}
|
1675
|
+
return FALSE;
|
1676
|
+
}
|
1677
|
+
}
|
1678
|
+
|
1679
|
+
return FALSE;
|
1680
|
+
}
|
1681
|
+
|
1682
|
+
// ==========================================================
|
1683
|
+
// Init
|
1684
|
+
// ==========================================================
|
1685
|
+
|
1686
|
+
void DLL_CALLCONV
|
1687
|
+
InitJPEG(Plugin *plugin, int format_id) {
|
1688
|
+
s_format_id = format_id;
|
1689
|
+
|
1690
|
+
plugin->format_proc = Format;
|
1691
|
+
plugin->description_proc = Description;
|
1692
|
+
plugin->extension_proc = Extension;
|
1693
|
+
plugin->regexpr_proc = RegExpr;
|
1694
|
+
plugin->open_proc = NULL;
|
1695
|
+
plugin->close_proc = NULL;
|
1696
|
+
plugin->pagecount_proc = NULL;
|
1697
|
+
plugin->pagecapability_proc = NULL;
|
1698
|
+
plugin->load_proc = Load;
|
1699
|
+
plugin->save_proc = Save;
|
1700
|
+
plugin->validate_proc = Validate;
|
1701
|
+
plugin->mime_proc = MimeType;
|
1702
|
+
plugin->supports_export_bpp_proc = SupportsExportDepth;
|
1703
|
+
plugin->supports_export_type_proc = SupportsExportType;
|
1704
|
+
plugin->supports_icc_profiles_proc = SupportsICCProfiles;
|
1705
|
+
plugin->supports_no_pixels_proc = SupportsNoPixels;
|
1706
|
+
}
|