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,2890 @@
|
|
1
|
+
/* $Id: tif_getimage.c,v 1.11 2015/02/19 22:39:58 drolon Exp $ */
|
2
|
+
|
3
|
+
/*
|
4
|
+
* Copyright (c) 1991-1997 Sam Leffler
|
5
|
+
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
|
6
|
+
*
|
7
|
+
* Permission to use, copy, modify, distribute, and sell this software and
|
8
|
+
* its documentation for any purpose is hereby granted without fee, provided
|
9
|
+
* that (i) the above copyright notices and this permission notice appear in
|
10
|
+
* all copies of the software and related documentation, and (ii) the names of
|
11
|
+
* Sam Leffler and Silicon Graphics may not be used in any advertising or
|
12
|
+
* publicity relating to the software without the specific, prior written
|
13
|
+
* permission of Sam Leffler and Silicon Graphics.
|
14
|
+
*
|
15
|
+
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
17
|
+
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
18
|
+
*
|
19
|
+
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
|
20
|
+
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
21
|
+
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
22
|
+
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
23
|
+
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
24
|
+
* OF THIS SOFTWARE.
|
25
|
+
*/
|
26
|
+
|
27
|
+
/*
|
28
|
+
* TIFF Library
|
29
|
+
*
|
30
|
+
* Read and return a packed RGBA image.
|
31
|
+
*/
|
32
|
+
#include "tiffiop.h"
|
33
|
+
#include <stdio.h>
|
34
|
+
|
35
|
+
static int gtTileContig(TIFFRGBAImage*, uint32*, uint32, uint32);
|
36
|
+
static int gtTileSeparate(TIFFRGBAImage*, uint32*, uint32, uint32);
|
37
|
+
static int gtStripContig(TIFFRGBAImage*, uint32*, uint32, uint32);
|
38
|
+
static int gtStripSeparate(TIFFRGBAImage*, uint32*, uint32, uint32);
|
39
|
+
static int PickContigCase(TIFFRGBAImage*);
|
40
|
+
static int PickSeparateCase(TIFFRGBAImage*);
|
41
|
+
|
42
|
+
static int BuildMapUaToAa(TIFFRGBAImage* img);
|
43
|
+
static int BuildMapBitdepth16To8(TIFFRGBAImage* img);
|
44
|
+
|
45
|
+
static const char photoTag[] = "PhotometricInterpretation";
|
46
|
+
|
47
|
+
/*
|
48
|
+
* Helper constants used in Orientation tag handling
|
49
|
+
*/
|
50
|
+
#define FLIP_VERTICALLY 0x01
|
51
|
+
#define FLIP_HORIZONTALLY 0x02
|
52
|
+
|
53
|
+
/*
|
54
|
+
* Color conversion constants. We will define display types here.
|
55
|
+
*/
|
56
|
+
|
57
|
+
static const TIFFDisplay display_sRGB = {
|
58
|
+
{ /* XYZ -> luminance matrix */
|
59
|
+
{ 3.2410F, -1.5374F, -0.4986F },
|
60
|
+
{ -0.9692F, 1.8760F, 0.0416F },
|
61
|
+
{ 0.0556F, -0.2040F, 1.0570F }
|
62
|
+
},
|
63
|
+
100.0F, 100.0F, 100.0F, /* Light o/p for reference white */
|
64
|
+
255, 255, 255, /* Pixel values for ref. white */
|
65
|
+
1.0F, 1.0F, 1.0F, /* Residual light o/p for black pixel */
|
66
|
+
2.4F, 2.4F, 2.4F, /* Gamma values for the three guns */
|
67
|
+
};
|
68
|
+
|
69
|
+
/*
|
70
|
+
* Check the image to see if TIFFReadRGBAImage can deal with it.
|
71
|
+
* 1/0 is returned according to whether or not the image can
|
72
|
+
* be handled. If 0 is returned, emsg contains the reason
|
73
|
+
* why it is being rejected.
|
74
|
+
*/
|
75
|
+
int
|
76
|
+
TIFFRGBAImageOK(TIFF* tif, char emsg[1024])
|
77
|
+
{
|
78
|
+
TIFFDirectory* td = &tif->tif_dir;
|
79
|
+
uint16 photometric;
|
80
|
+
int colorchannels;
|
81
|
+
|
82
|
+
if (!tif->tif_decodestatus) {
|
83
|
+
sprintf(emsg, "Sorry, requested compression method is not configured");
|
84
|
+
return (0);
|
85
|
+
}
|
86
|
+
switch (td->td_bitspersample) {
|
87
|
+
case 1:
|
88
|
+
case 2:
|
89
|
+
case 4:
|
90
|
+
case 8:
|
91
|
+
case 16:
|
92
|
+
break;
|
93
|
+
default:
|
94
|
+
sprintf(emsg, "Sorry, can not handle images with %d-bit samples",
|
95
|
+
td->td_bitspersample);
|
96
|
+
return (0);
|
97
|
+
}
|
98
|
+
colorchannels = td->td_samplesperpixel - td->td_extrasamples;
|
99
|
+
if (!TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &photometric)) {
|
100
|
+
switch (colorchannels) {
|
101
|
+
case 1:
|
102
|
+
photometric = PHOTOMETRIC_MINISBLACK;
|
103
|
+
break;
|
104
|
+
case 3:
|
105
|
+
photometric = PHOTOMETRIC_RGB;
|
106
|
+
break;
|
107
|
+
default:
|
108
|
+
sprintf(emsg, "Missing needed %s tag", photoTag);
|
109
|
+
return (0);
|
110
|
+
}
|
111
|
+
}
|
112
|
+
switch (photometric) {
|
113
|
+
case PHOTOMETRIC_MINISWHITE:
|
114
|
+
case PHOTOMETRIC_MINISBLACK:
|
115
|
+
case PHOTOMETRIC_PALETTE:
|
116
|
+
if (td->td_planarconfig == PLANARCONFIG_CONTIG
|
117
|
+
&& td->td_samplesperpixel != 1
|
118
|
+
&& td->td_bitspersample < 8 ) {
|
119
|
+
sprintf(emsg,
|
120
|
+
"Sorry, can not handle contiguous data with %s=%d, "
|
121
|
+
"and %s=%d and Bits/Sample=%d",
|
122
|
+
photoTag, photometric,
|
123
|
+
"Samples/pixel", td->td_samplesperpixel,
|
124
|
+
td->td_bitspersample);
|
125
|
+
return (0);
|
126
|
+
}
|
127
|
+
/*
|
128
|
+
* We should likely validate that any extra samples are either
|
129
|
+
* to be ignored, or are alpha, and if alpha we should try to use
|
130
|
+
* them. But for now we won't bother with this.
|
131
|
+
*/
|
132
|
+
break;
|
133
|
+
case PHOTOMETRIC_YCBCR:
|
134
|
+
/*
|
135
|
+
* TODO: if at all meaningful and useful, make more complete
|
136
|
+
* support check here, or better still, refactor to let supporting
|
137
|
+
* code decide whether there is support and what meaningfull
|
138
|
+
* error to return
|
139
|
+
*/
|
140
|
+
break;
|
141
|
+
case PHOTOMETRIC_RGB:
|
142
|
+
if (colorchannels < 3) {
|
143
|
+
sprintf(emsg, "Sorry, can not handle RGB image with %s=%d",
|
144
|
+
"Color channels", colorchannels);
|
145
|
+
return (0);
|
146
|
+
}
|
147
|
+
break;
|
148
|
+
case PHOTOMETRIC_SEPARATED:
|
149
|
+
{
|
150
|
+
uint16 inkset;
|
151
|
+
TIFFGetFieldDefaulted(tif, TIFFTAG_INKSET, &inkset);
|
152
|
+
if (inkset != INKSET_CMYK) {
|
153
|
+
sprintf(emsg,
|
154
|
+
"Sorry, can not handle separated image with %s=%d",
|
155
|
+
"InkSet", inkset);
|
156
|
+
return 0;
|
157
|
+
}
|
158
|
+
if (td->td_samplesperpixel < 4) {
|
159
|
+
sprintf(emsg,
|
160
|
+
"Sorry, can not handle separated image with %s=%d",
|
161
|
+
"Samples/pixel", td->td_samplesperpixel);
|
162
|
+
return 0;
|
163
|
+
}
|
164
|
+
break;
|
165
|
+
}
|
166
|
+
case PHOTOMETRIC_LOGL:
|
167
|
+
if (td->td_compression != COMPRESSION_SGILOG) {
|
168
|
+
sprintf(emsg, "Sorry, LogL data must have %s=%d",
|
169
|
+
"Compression", COMPRESSION_SGILOG);
|
170
|
+
return (0);
|
171
|
+
}
|
172
|
+
break;
|
173
|
+
case PHOTOMETRIC_LOGLUV:
|
174
|
+
if (td->td_compression != COMPRESSION_SGILOG &&
|
175
|
+
td->td_compression != COMPRESSION_SGILOG24) {
|
176
|
+
sprintf(emsg, "Sorry, LogLuv data must have %s=%d or %d",
|
177
|
+
"Compression", COMPRESSION_SGILOG, COMPRESSION_SGILOG24);
|
178
|
+
return (0);
|
179
|
+
}
|
180
|
+
if (td->td_planarconfig != PLANARCONFIG_CONTIG) {
|
181
|
+
sprintf(emsg, "Sorry, can not handle LogLuv images with %s=%d",
|
182
|
+
"Planarconfiguration", td->td_planarconfig);
|
183
|
+
return (0);
|
184
|
+
}
|
185
|
+
if( td->td_samplesperpixel != 3 )
|
186
|
+
{
|
187
|
+
sprintf(emsg,
|
188
|
+
"Sorry, can not handle image with %s=%d",
|
189
|
+
"Samples/pixel", td->td_samplesperpixel);
|
190
|
+
return 0;
|
191
|
+
}
|
192
|
+
break;
|
193
|
+
case PHOTOMETRIC_CIELAB:
|
194
|
+
if( td->td_samplesperpixel != 3 || td->td_bitspersample != 8 )
|
195
|
+
{
|
196
|
+
sprintf(emsg,
|
197
|
+
"Sorry, can not handle image with %s=%d and %s=%d",
|
198
|
+
"Samples/pixel", td->td_samplesperpixel,
|
199
|
+
"Bits/sample", td->td_bitspersample);
|
200
|
+
return 0;
|
201
|
+
}
|
202
|
+
break;
|
203
|
+
default:
|
204
|
+
sprintf(emsg, "Sorry, can not handle image with %s=%d",
|
205
|
+
photoTag, photometric);
|
206
|
+
return (0);
|
207
|
+
}
|
208
|
+
return (1);
|
209
|
+
}
|
210
|
+
|
211
|
+
void
|
212
|
+
TIFFRGBAImageEnd(TIFFRGBAImage* img)
|
213
|
+
{
|
214
|
+
if (img->Map)
|
215
|
+
_TIFFfree(img->Map), img->Map = NULL;
|
216
|
+
if (img->BWmap)
|
217
|
+
_TIFFfree(img->BWmap), img->BWmap = NULL;
|
218
|
+
if (img->PALmap)
|
219
|
+
_TIFFfree(img->PALmap), img->PALmap = NULL;
|
220
|
+
if (img->ycbcr)
|
221
|
+
_TIFFfree(img->ycbcr), img->ycbcr = NULL;
|
222
|
+
if (img->cielab)
|
223
|
+
_TIFFfree(img->cielab), img->cielab = NULL;
|
224
|
+
if (img->UaToAa)
|
225
|
+
_TIFFfree(img->UaToAa), img->UaToAa = NULL;
|
226
|
+
if (img->Bitdepth16To8)
|
227
|
+
_TIFFfree(img->Bitdepth16To8), img->Bitdepth16To8 = NULL;
|
228
|
+
|
229
|
+
if( img->redcmap ) {
|
230
|
+
_TIFFfree( img->redcmap );
|
231
|
+
_TIFFfree( img->greencmap );
|
232
|
+
_TIFFfree( img->bluecmap );
|
233
|
+
img->redcmap = img->greencmap = img->bluecmap = NULL;
|
234
|
+
}
|
235
|
+
}
|
236
|
+
|
237
|
+
static int
|
238
|
+
isCCITTCompression(TIFF* tif)
|
239
|
+
{
|
240
|
+
uint16 compress;
|
241
|
+
TIFFGetField(tif, TIFFTAG_COMPRESSION, &compress);
|
242
|
+
return (compress == COMPRESSION_CCITTFAX3 ||
|
243
|
+
compress == COMPRESSION_CCITTFAX4 ||
|
244
|
+
compress == COMPRESSION_CCITTRLE ||
|
245
|
+
compress == COMPRESSION_CCITTRLEW);
|
246
|
+
}
|
247
|
+
|
248
|
+
int
|
249
|
+
TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int stop, char emsg[1024])
|
250
|
+
{
|
251
|
+
uint16* sampleinfo;
|
252
|
+
uint16 extrasamples;
|
253
|
+
uint16 planarconfig;
|
254
|
+
uint16 compress;
|
255
|
+
int colorchannels;
|
256
|
+
uint16 *red_orig, *green_orig, *blue_orig;
|
257
|
+
int n_color;
|
258
|
+
|
259
|
+
/* Initialize to normal values */
|
260
|
+
img->row_offset = 0;
|
261
|
+
img->col_offset = 0;
|
262
|
+
img->redcmap = NULL;
|
263
|
+
img->greencmap = NULL;
|
264
|
+
img->bluecmap = NULL;
|
265
|
+
img->req_orientation = ORIENTATION_BOTLEFT; /* It is the default */
|
266
|
+
|
267
|
+
img->tif = tif;
|
268
|
+
img->stoponerr = stop;
|
269
|
+
TIFFGetFieldDefaulted(tif, TIFFTAG_BITSPERSAMPLE, &img->bitspersample);
|
270
|
+
switch (img->bitspersample) {
|
271
|
+
case 1:
|
272
|
+
case 2:
|
273
|
+
case 4:
|
274
|
+
case 8:
|
275
|
+
case 16:
|
276
|
+
break;
|
277
|
+
default:
|
278
|
+
sprintf(emsg, "Sorry, can not handle images with %d-bit samples",
|
279
|
+
img->bitspersample);
|
280
|
+
goto fail_return;
|
281
|
+
}
|
282
|
+
img->alpha = 0;
|
283
|
+
TIFFGetFieldDefaulted(tif, TIFFTAG_SAMPLESPERPIXEL, &img->samplesperpixel);
|
284
|
+
TIFFGetFieldDefaulted(tif, TIFFTAG_EXTRASAMPLES,
|
285
|
+
&extrasamples, &sampleinfo);
|
286
|
+
if (extrasamples >= 1)
|
287
|
+
{
|
288
|
+
switch (sampleinfo[0]) {
|
289
|
+
case EXTRASAMPLE_UNSPECIFIED: /* Workaround for some images without */
|
290
|
+
if (img->samplesperpixel > 3) /* correct info about alpha channel */
|
291
|
+
img->alpha = EXTRASAMPLE_ASSOCALPHA;
|
292
|
+
break;
|
293
|
+
case EXTRASAMPLE_ASSOCALPHA: /* data is pre-multiplied */
|
294
|
+
case EXTRASAMPLE_UNASSALPHA: /* data is not pre-multiplied */
|
295
|
+
img->alpha = sampleinfo[0];
|
296
|
+
break;
|
297
|
+
}
|
298
|
+
}
|
299
|
+
|
300
|
+
#ifdef DEFAULT_EXTRASAMPLE_AS_ALPHA
|
301
|
+
if( !TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &img->photometric))
|
302
|
+
img->photometric = PHOTOMETRIC_MINISWHITE;
|
303
|
+
|
304
|
+
if( extrasamples == 0
|
305
|
+
&& img->samplesperpixel == 4
|
306
|
+
&& img->photometric == PHOTOMETRIC_RGB )
|
307
|
+
{
|
308
|
+
img->alpha = EXTRASAMPLE_ASSOCALPHA;
|
309
|
+
extrasamples = 1;
|
310
|
+
}
|
311
|
+
#endif
|
312
|
+
|
313
|
+
colorchannels = img->samplesperpixel - extrasamples;
|
314
|
+
TIFFGetFieldDefaulted(tif, TIFFTAG_COMPRESSION, &compress);
|
315
|
+
TIFFGetFieldDefaulted(tif, TIFFTAG_PLANARCONFIG, &planarconfig);
|
316
|
+
if (!TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &img->photometric)) {
|
317
|
+
switch (colorchannels) {
|
318
|
+
case 1:
|
319
|
+
if (isCCITTCompression(tif))
|
320
|
+
img->photometric = PHOTOMETRIC_MINISWHITE;
|
321
|
+
else
|
322
|
+
img->photometric = PHOTOMETRIC_MINISBLACK;
|
323
|
+
break;
|
324
|
+
case 3:
|
325
|
+
img->photometric = PHOTOMETRIC_RGB;
|
326
|
+
break;
|
327
|
+
default:
|
328
|
+
sprintf(emsg, "Missing needed %s tag", photoTag);
|
329
|
+
goto fail_return;
|
330
|
+
}
|
331
|
+
}
|
332
|
+
switch (img->photometric) {
|
333
|
+
case PHOTOMETRIC_PALETTE:
|
334
|
+
if (!TIFFGetField(tif, TIFFTAG_COLORMAP,
|
335
|
+
&red_orig, &green_orig, &blue_orig)) {
|
336
|
+
sprintf(emsg, "Missing required \"Colormap\" tag");
|
337
|
+
goto fail_return;
|
338
|
+
}
|
339
|
+
|
340
|
+
/* copy the colormaps so we can modify them */
|
341
|
+
n_color = (1L << img->bitspersample);
|
342
|
+
img->redcmap = (uint16 *) _TIFFmalloc(sizeof(uint16)*n_color);
|
343
|
+
img->greencmap = (uint16 *) _TIFFmalloc(sizeof(uint16)*n_color);
|
344
|
+
img->bluecmap = (uint16 *) _TIFFmalloc(sizeof(uint16)*n_color);
|
345
|
+
if( !img->redcmap || !img->greencmap || !img->bluecmap ) {
|
346
|
+
sprintf(emsg, "Out of memory for colormap copy");
|
347
|
+
goto fail_return;
|
348
|
+
}
|
349
|
+
|
350
|
+
_TIFFmemcpy( img->redcmap, red_orig, n_color * 2 );
|
351
|
+
_TIFFmemcpy( img->greencmap, green_orig, n_color * 2 );
|
352
|
+
_TIFFmemcpy( img->bluecmap, blue_orig, n_color * 2 );
|
353
|
+
|
354
|
+
/* fall thru... */
|
355
|
+
case PHOTOMETRIC_MINISWHITE:
|
356
|
+
case PHOTOMETRIC_MINISBLACK:
|
357
|
+
if (planarconfig == PLANARCONFIG_CONTIG
|
358
|
+
&& img->samplesperpixel != 1
|
359
|
+
&& img->bitspersample < 8 ) {
|
360
|
+
sprintf(emsg,
|
361
|
+
"Sorry, can not handle contiguous data with %s=%d, "
|
362
|
+
"and %s=%d and Bits/Sample=%d",
|
363
|
+
photoTag, img->photometric,
|
364
|
+
"Samples/pixel", img->samplesperpixel,
|
365
|
+
img->bitspersample);
|
366
|
+
goto fail_return;
|
367
|
+
}
|
368
|
+
break;
|
369
|
+
case PHOTOMETRIC_YCBCR:
|
370
|
+
/* It would probably be nice to have a reality check here. */
|
371
|
+
if (planarconfig == PLANARCONFIG_CONTIG)
|
372
|
+
/* can rely on libjpeg to convert to RGB */
|
373
|
+
/* XXX should restore current state on exit */
|
374
|
+
switch (compress) {
|
375
|
+
case COMPRESSION_JPEG:
|
376
|
+
/*
|
377
|
+
* TODO: when complete tests verify complete desubsampling
|
378
|
+
* and YCbCr handling, remove use of TIFFTAG_JPEGCOLORMODE in
|
379
|
+
* favor of tif_getimage.c native handling
|
380
|
+
*/
|
381
|
+
TIFFSetField(tif, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RGB);
|
382
|
+
img->photometric = PHOTOMETRIC_RGB;
|
383
|
+
break;
|
384
|
+
default:
|
385
|
+
/* do nothing */;
|
386
|
+
break;
|
387
|
+
}
|
388
|
+
/*
|
389
|
+
* TODO: if at all meaningful and useful, make more complete
|
390
|
+
* support check here, or better still, refactor to let supporting
|
391
|
+
* code decide whether there is support and what meaningfull
|
392
|
+
* error to return
|
393
|
+
*/
|
394
|
+
break;
|
395
|
+
case PHOTOMETRIC_RGB:
|
396
|
+
if (colorchannels < 3) {
|
397
|
+
sprintf(emsg, "Sorry, can not handle RGB image with %s=%d",
|
398
|
+
"Color channels", colorchannels);
|
399
|
+
goto fail_return;
|
400
|
+
}
|
401
|
+
break;
|
402
|
+
case PHOTOMETRIC_SEPARATED:
|
403
|
+
{
|
404
|
+
uint16 inkset;
|
405
|
+
TIFFGetFieldDefaulted(tif, TIFFTAG_INKSET, &inkset);
|
406
|
+
if (inkset != INKSET_CMYK) {
|
407
|
+
sprintf(emsg, "Sorry, can not handle separated image with %s=%d",
|
408
|
+
"InkSet", inkset);
|
409
|
+
goto fail_return;
|
410
|
+
}
|
411
|
+
if (img->samplesperpixel < 4) {
|
412
|
+
sprintf(emsg, "Sorry, can not handle separated image with %s=%d",
|
413
|
+
"Samples/pixel", img->samplesperpixel);
|
414
|
+
goto fail_return;
|
415
|
+
}
|
416
|
+
}
|
417
|
+
break;
|
418
|
+
case PHOTOMETRIC_LOGL:
|
419
|
+
if (compress != COMPRESSION_SGILOG) {
|
420
|
+
sprintf(emsg, "Sorry, LogL data must have %s=%d",
|
421
|
+
"Compression", COMPRESSION_SGILOG);
|
422
|
+
goto fail_return;
|
423
|
+
}
|
424
|
+
TIFFSetField(tif, TIFFTAG_SGILOGDATAFMT, SGILOGDATAFMT_8BIT);
|
425
|
+
img->photometric = PHOTOMETRIC_MINISBLACK; /* little white lie */
|
426
|
+
img->bitspersample = 8;
|
427
|
+
break;
|
428
|
+
case PHOTOMETRIC_LOGLUV:
|
429
|
+
if (compress != COMPRESSION_SGILOG && compress != COMPRESSION_SGILOG24) {
|
430
|
+
sprintf(emsg, "Sorry, LogLuv data must have %s=%d or %d",
|
431
|
+
"Compression", COMPRESSION_SGILOG, COMPRESSION_SGILOG24);
|
432
|
+
goto fail_return;
|
433
|
+
}
|
434
|
+
if (planarconfig != PLANARCONFIG_CONTIG) {
|
435
|
+
sprintf(emsg, "Sorry, can not handle LogLuv images with %s=%d",
|
436
|
+
"Planarconfiguration", planarconfig);
|
437
|
+
return (0);
|
438
|
+
}
|
439
|
+
TIFFSetField(tif, TIFFTAG_SGILOGDATAFMT, SGILOGDATAFMT_8BIT);
|
440
|
+
img->photometric = PHOTOMETRIC_RGB; /* little white lie */
|
441
|
+
img->bitspersample = 8;
|
442
|
+
break;
|
443
|
+
case PHOTOMETRIC_CIELAB:
|
444
|
+
break;
|
445
|
+
default:
|
446
|
+
sprintf(emsg, "Sorry, can not handle image with %s=%d",
|
447
|
+
photoTag, img->photometric);
|
448
|
+
goto fail_return;
|
449
|
+
}
|
450
|
+
img->Map = NULL;
|
451
|
+
img->BWmap = NULL;
|
452
|
+
img->PALmap = NULL;
|
453
|
+
img->ycbcr = NULL;
|
454
|
+
img->cielab = NULL;
|
455
|
+
img->UaToAa = NULL;
|
456
|
+
img->Bitdepth16To8 = NULL;
|
457
|
+
TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &img->width);
|
458
|
+
TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &img->height);
|
459
|
+
TIFFGetFieldDefaulted(tif, TIFFTAG_ORIENTATION, &img->orientation);
|
460
|
+
img->isContig =
|
461
|
+
!(planarconfig == PLANARCONFIG_SEPARATE && img->samplesperpixel > 1);
|
462
|
+
if (img->isContig) {
|
463
|
+
if (!PickContigCase(img)) {
|
464
|
+
sprintf(emsg, "Sorry, can not handle image");
|
465
|
+
goto fail_return;
|
466
|
+
}
|
467
|
+
} else {
|
468
|
+
if (!PickSeparateCase(img)) {
|
469
|
+
sprintf(emsg, "Sorry, can not handle image");
|
470
|
+
goto fail_return;
|
471
|
+
}
|
472
|
+
}
|
473
|
+
return 1;
|
474
|
+
|
475
|
+
fail_return:
|
476
|
+
_TIFFfree( img->redcmap );
|
477
|
+
_TIFFfree( img->greencmap );
|
478
|
+
_TIFFfree( img->bluecmap );
|
479
|
+
img->redcmap = img->greencmap = img->bluecmap = NULL;
|
480
|
+
return 0;
|
481
|
+
}
|
482
|
+
|
483
|
+
int
|
484
|
+
TIFFRGBAImageGet(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
|
485
|
+
{
|
486
|
+
if (img->get == NULL) {
|
487
|
+
TIFFErrorExt(img->tif->tif_clientdata, TIFFFileName(img->tif), "No \"get\" routine setup");
|
488
|
+
return (0);
|
489
|
+
}
|
490
|
+
if (img->put.any == NULL) {
|
491
|
+
TIFFErrorExt(img->tif->tif_clientdata, TIFFFileName(img->tif),
|
492
|
+
"No \"put\" routine setupl; probably can not handle image format");
|
493
|
+
return (0);
|
494
|
+
}
|
495
|
+
return (*img->get)(img, raster, w, h);
|
496
|
+
}
|
497
|
+
|
498
|
+
/*
|
499
|
+
* Read the specified image into an ABGR-format rastertaking in account
|
500
|
+
* specified orientation.
|
501
|
+
*/
|
502
|
+
int
|
503
|
+
TIFFReadRGBAImageOriented(TIFF* tif,
|
504
|
+
uint32 rwidth, uint32 rheight, uint32* raster,
|
505
|
+
int orientation, int stop)
|
506
|
+
{
|
507
|
+
char emsg[1024] = "";
|
508
|
+
TIFFRGBAImage img;
|
509
|
+
int ok;
|
510
|
+
|
511
|
+
if (TIFFRGBAImageOK(tif, emsg) && TIFFRGBAImageBegin(&img, tif, stop, emsg)) {
|
512
|
+
img.req_orientation = orientation;
|
513
|
+
/* XXX verify rwidth and rheight against width and height */
|
514
|
+
ok = TIFFRGBAImageGet(&img, raster+(rheight-img.height)*rwidth,
|
515
|
+
rwidth, img.height);
|
516
|
+
TIFFRGBAImageEnd(&img);
|
517
|
+
} else {
|
518
|
+
TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "%s", emsg);
|
519
|
+
ok = 0;
|
520
|
+
}
|
521
|
+
return (ok);
|
522
|
+
}
|
523
|
+
|
524
|
+
/*
|
525
|
+
* Read the specified image into an ABGR-format raster. Use bottom left
|
526
|
+
* origin for raster by default.
|
527
|
+
*/
|
528
|
+
int
|
529
|
+
TIFFReadRGBAImage(TIFF* tif,
|
530
|
+
uint32 rwidth, uint32 rheight, uint32* raster, int stop)
|
531
|
+
{
|
532
|
+
return TIFFReadRGBAImageOriented(tif, rwidth, rheight, raster,
|
533
|
+
ORIENTATION_BOTLEFT, stop);
|
534
|
+
}
|
535
|
+
|
536
|
+
static int
|
537
|
+
setorientation(TIFFRGBAImage* img)
|
538
|
+
{
|
539
|
+
switch (img->orientation) {
|
540
|
+
case ORIENTATION_TOPLEFT:
|
541
|
+
case ORIENTATION_LEFTTOP:
|
542
|
+
if (img->req_orientation == ORIENTATION_TOPRIGHT ||
|
543
|
+
img->req_orientation == ORIENTATION_RIGHTTOP)
|
544
|
+
return FLIP_HORIZONTALLY;
|
545
|
+
else if (img->req_orientation == ORIENTATION_BOTRIGHT ||
|
546
|
+
img->req_orientation == ORIENTATION_RIGHTBOT)
|
547
|
+
return FLIP_HORIZONTALLY | FLIP_VERTICALLY;
|
548
|
+
else if (img->req_orientation == ORIENTATION_BOTLEFT ||
|
549
|
+
img->req_orientation == ORIENTATION_LEFTBOT)
|
550
|
+
return FLIP_VERTICALLY;
|
551
|
+
else
|
552
|
+
return 0;
|
553
|
+
case ORIENTATION_TOPRIGHT:
|
554
|
+
case ORIENTATION_RIGHTTOP:
|
555
|
+
if (img->req_orientation == ORIENTATION_TOPLEFT ||
|
556
|
+
img->req_orientation == ORIENTATION_LEFTTOP)
|
557
|
+
return FLIP_HORIZONTALLY;
|
558
|
+
else if (img->req_orientation == ORIENTATION_BOTRIGHT ||
|
559
|
+
img->req_orientation == ORIENTATION_RIGHTBOT)
|
560
|
+
return FLIP_VERTICALLY;
|
561
|
+
else if (img->req_orientation == ORIENTATION_BOTLEFT ||
|
562
|
+
img->req_orientation == ORIENTATION_LEFTBOT)
|
563
|
+
return FLIP_HORIZONTALLY | FLIP_VERTICALLY;
|
564
|
+
else
|
565
|
+
return 0;
|
566
|
+
case ORIENTATION_BOTRIGHT:
|
567
|
+
case ORIENTATION_RIGHTBOT:
|
568
|
+
if (img->req_orientation == ORIENTATION_TOPLEFT ||
|
569
|
+
img->req_orientation == ORIENTATION_LEFTTOP)
|
570
|
+
return FLIP_HORIZONTALLY | FLIP_VERTICALLY;
|
571
|
+
else if (img->req_orientation == ORIENTATION_TOPRIGHT ||
|
572
|
+
img->req_orientation == ORIENTATION_RIGHTTOP)
|
573
|
+
return FLIP_VERTICALLY;
|
574
|
+
else if (img->req_orientation == ORIENTATION_BOTLEFT ||
|
575
|
+
img->req_orientation == ORIENTATION_LEFTBOT)
|
576
|
+
return FLIP_HORIZONTALLY;
|
577
|
+
else
|
578
|
+
return 0;
|
579
|
+
case ORIENTATION_BOTLEFT:
|
580
|
+
case ORIENTATION_LEFTBOT:
|
581
|
+
if (img->req_orientation == ORIENTATION_TOPLEFT ||
|
582
|
+
img->req_orientation == ORIENTATION_LEFTTOP)
|
583
|
+
return FLIP_VERTICALLY;
|
584
|
+
else if (img->req_orientation == ORIENTATION_TOPRIGHT ||
|
585
|
+
img->req_orientation == ORIENTATION_RIGHTTOP)
|
586
|
+
return FLIP_HORIZONTALLY | FLIP_VERTICALLY;
|
587
|
+
else if (img->req_orientation == ORIENTATION_BOTRIGHT ||
|
588
|
+
img->req_orientation == ORIENTATION_RIGHTBOT)
|
589
|
+
return FLIP_HORIZONTALLY;
|
590
|
+
else
|
591
|
+
return 0;
|
592
|
+
default: /* NOTREACHED */
|
593
|
+
return 0;
|
594
|
+
}
|
595
|
+
}
|
596
|
+
|
597
|
+
/*
|
598
|
+
* Get an tile-organized image that has
|
599
|
+
* PlanarConfiguration contiguous if SamplesPerPixel > 1
|
600
|
+
* or
|
601
|
+
* SamplesPerPixel == 1
|
602
|
+
*/
|
603
|
+
static int
|
604
|
+
gtTileContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
|
605
|
+
{
|
606
|
+
TIFF* tif = img->tif;
|
607
|
+
tileContigRoutine put = img->put.contig;
|
608
|
+
uint32 col, row, y, rowstoread;
|
609
|
+
tmsize_t pos;
|
610
|
+
uint32 tw, th;
|
611
|
+
unsigned char* buf;
|
612
|
+
int32 fromskew, toskew;
|
613
|
+
uint32 nrow;
|
614
|
+
int ret = 1, flip;
|
615
|
+
|
616
|
+
buf = (unsigned char*) _TIFFmalloc(TIFFTileSize(tif));
|
617
|
+
if (buf == 0) {
|
618
|
+
TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "%s", "No space for tile buffer");
|
619
|
+
return (0);
|
620
|
+
}
|
621
|
+
_TIFFmemset(buf, 0, TIFFTileSize(tif));
|
622
|
+
TIFFGetField(tif, TIFFTAG_TILEWIDTH, &tw);
|
623
|
+
TIFFGetField(tif, TIFFTAG_TILELENGTH, &th);
|
624
|
+
|
625
|
+
flip = setorientation(img);
|
626
|
+
if (flip & FLIP_VERTICALLY) {
|
627
|
+
y = h - 1;
|
628
|
+
toskew = -(int32)(tw + w);
|
629
|
+
}
|
630
|
+
else {
|
631
|
+
y = 0;
|
632
|
+
toskew = -(int32)(tw - w);
|
633
|
+
}
|
634
|
+
|
635
|
+
for (row = 0; row < h; row += nrow)
|
636
|
+
{
|
637
|
+
rowstoread = th - (row + img->row_offset) % th;
|
638
|
+
nrow = (row + rowstoread > h ? h - row : rowstoread);
|
639
|
+
for (col = 0; col < w; col += tw)
|
640
|
+
{
|
641
|
+
if (TIFFReadTile(tif, buf, col+img->col_offset,
|
642
|
+
row+img->row_offset, 0, 0)==(tmsize_t)(-1) && img->stoponerr)
|
643
|
+
{
|
644
|
+
ret = 0;
|
645
|
+
break;
|
646
|
+
}
|
647
|
+
|
648
|
+
pos = ((row+img->row_offset) % th) * TIFFTileRowSize(tif);
|
649
|
+
|
650
|
+
if (col + tw > w)
|
651
|
+
{
|
652
|
+
/*
|
653
|
+
* Tile is clipped horizontally. Calculate
|
654
|
+
* visible portion and skewing factors.
|
655
|
+
*/
|
656
|
+
uint32 npix = w - col;
|
657
|
+
fromskew = tw - npix;
|
658
|
+
(*put)(img, raster+y*w+col, col, y,
|
659
|
+
npix, nrow, fromskew, toskew + fromskew, buf + pos);
|
660
|
+
}
|
661
|
+
else
|
662
|
+
{
|
663
|
+
(*put)(img, raster+y*w+col, col, y, tw, nrow, 0, toskew, buf + pos);
|
664
|
+
}
|
665
|
+
}
|
666
|
+
|
667
|
+
y += (flip & FLIP_VERTICALLY ? -(int32) nrow : (int32) nrow);
|
668
|
+
}
|
669
|
+
_TIFFfree(buf);
|
670
|
+
|
671
|
+
if (flip & FLIP_HORIZONTALLY) {
|
672
|
+
uint32 line;
|
673
|
+
|
674
|
+
for (line = 0; line < h; line++) {
|
675
|
+
uint32 *left = raster + (line * w);
|
676
|
+
uint32 *right = left + w - 1;
|
677
|
+
|
678
|
+
while ( left < right ) {
|
679
|
+
uint32 temp = *left;
|
680
|
+
*left = *right;
|
681
|
+
*right = temp;
|
682
|
+
left++, right--;
|
683
|
+
}
|
684
|
+
}
|
685
|
+
}
|
686
|
+
|
687
|
+
return (ret);
|
688
|
+
}
|
689
|
+
|
690
|
+
/*
|
691
|
+
* Get an tile-organized image that has
|
692
|
+
* SamplesPerPixel > 1
|
693
|
+
* PlanarConfiguration separated
|
694
|
+
* We assume that all such images are RGB.
|
695
|
+
*/
|
696
|
+
static int
|
697
|
+
gtTileSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
|
698
|
+
{
|
699
|
+
TIFF* tif = img->tif;
|
700
|
+
tileSeparateRoutine put = img->put.separate;
|
701
|
+
uint32 col, row, y, rowstoread;
|
702
|
+
tmsize_t pos;
|
703
|
+
uint32 tw, th;
|
704
|
+
unsigned char* buf;
|
705
|
+
unsigned char* p0;
|
706
|
+
unsigned char* p1;
|
707
|
+
unsigned char* p2;
|
708
|
+
unsigned char* pa;
|
709
|
+
tmsize_t tilesize;
|
710
|
+
tmsize_t bufsize;
|
711
|
+
int32 fromskew, toskew;
|
712
|
+
int alpha = img->alpha;
|
713
|
+
uint32 nrow;
|
714
|
+
int ret = 1, flip;
|
715
|
+
int colorchannels;
|
716
|
+
|
717
|
+
tilesize = TIFFTileSize(tif);
|
718
|
+
bufsize = TIFFSafeMultiply(tmsize_t,alpha?4:3,tilesize);
|
719
|
+
if (bufsize == 0) {
|
720
|
+
TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "Integer overflow in %s", "gtTileSeparate");
|
721
|
+
return (0);
|
722
|
+
}
|
723
|
+
buf = (unsigned char*) _TIFFmalloc(bufsize);
|
724
|
+
if (buf == 0) {
|
725
|
+
TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "%s", "No space for tile buffer");
|
726
|
+
return (0);
|
727
|
+
}
|
728
|
+
_TIFFmemset(buf, 0, bufsize);
|
729
|
+
p0 = buf;
|
730
|
+
p1 = p0 + tilesize;
|
731
|
+
p2 = p1 + tilesize;
|
732
|
+
pa = (alpha?(p2+tilesize):NULL);
|
733
|
+
TIFFGetField(tif, TIFFTAG_TILEWIDTH, &tw);
|
734
|
+
TIFFGetField(tif, TIFFTAG_TILELENGTH, &th);
|
735
|
+
|
736
|
+
flip = setorientation(img);
|
737
|
+
if (flip & FLIP_VERTICALLY) {
|
738
|
+
y = h - 1;
|
739
|
+
toskew = -(int32)(tw + w);
|
740
|
+
}
|
741
|
+
else {
|
742
|
+
y = 0;
|
743
|
+
toskew = -(int32)(tw - w);
|
744
|
+
}
|
745
|
+
|
746
|
+
switch( img->photometric )
|
747
|
+
{
|
748
|
+
case PHOTOMETRIC_MINISWHITE:
|
749
|
+
case PHOTOMETRIC_MINISBLACK:
|
750
|
+
case PHOTOMETRIC_PALETTE:
|
751
|
+
colorchannels = 1;
|
752
|
+
p2 = p1 = p0;
|
753
|
+
break;
|
754
|
+
|
755
|
+
default:
|
756
|
+
colorchannels = 3;
|
757
|
+
break;
|
758
|
+
}
|
759
|
+
|
760
|
+
for (row = 0; row < h; row += nrow)
|
761
|
+
{
|
762
|
+
rowstoread = th - (row + img->row_offset) % th;
|
763
|
+
nrow = (row + rowstoread > h ? h - row : rowstoread);
|
764
|
+
for (col = 0; col < w; col += tw)
|
765
|
+
{
|
766
|
+
if (TIFFReadTile(tif, p0, col+img->col_offset,
|
767
|
+
row+img->row_offset,0,0)==(tmsize_t)(-1) && img->stoponerr)
|
768
|
+
{
|
769
|
+
ret = 0;
|
770
|
+
break;
|
771
|
+
}
|
772
|
+
if (colorchannels > 1
|
773
|
+
&& TIFFReadTile(tif, p1, col+img->col_offset,
|
774
|
+
row+img->row_offset,0,1) == (tmsize_t)(-1)
|
775
|
+
&& img->stoponerr)
|
776
|
+
{
|
777
|
+
ret = 0;
|
778
|
+
break;
|
779
|
+
}
|
780
|
+
if (colorchannels > 1
|
781
|
+
&& TIFFReadTile(tif, p2, col+img->col_offset,
|
782
|
+
row+img->row_offset,0,2) == (tmsize_t)(-1)
|
783
|
+
&& img->stoponerr)
|
784
|
+
{
|
785
|
+
ret = 0;
|
786
|
+
break;
|
787
|
+
}
|
788
|
+
if (alpha
|
789
|
+
&& TIFFReadTile(tif,pa,col+img->col_offset,
|
790
|
+
row+img->row_offset,0,colorchannels) == (tmsize_t)(-1)
|
791
|
+
&& img->stoponerr)
|
792
|
+
{
|
793
|
+
ret = 0;
|
794
|
+
break;
|
795
|
+
}
|
796
|
+
|
797
|
+
pos = ((row+img->row_offset) % th) * TIFFTileRowSize(tif);
|
798
|
+
|
799
|
+
if (col + tw > w)
|
800
|
+
{
|
801
|
+
/*
|
802
|
+
* Tile is clipped horizontally. Calculate
|
803
|
+
* visible portion and skewing factors.
|
804
|
+
*/
|
805
|
+
uint32 npix = w - col;
|
806
|
+
fromskew = tw - npix;
|
807
|
+
(*put)(img, raster+y*w+col, col, y,
|
808
|
+
npix, nrow, fromskew, toskew + fromskew,
|
809
|
+
p0 + pos, p1 + pos, p2 + pos, (alpha?(pa+pos):NULL));
|
810
|
+
} else {
|
811
|
+
(*put)(img, raster+y*w+col, col, y,
|
812
|
+
tw, nrow, 0, toskew, p0 + pos, p1 + pos, p2 + pos, (alpha?(pa+pos):NULL));
|
813
|
+
}
|
814
|
+
}
|
815
|
+
|
816
|
+
y += (flip & FLIP_VERTICALLY ?-(int32) nrow : (int32) nrow);
|
817
|
+
}
|
818
|
+
|
819
|
+
if (flip & FLIP_HORIZONTALLY) {
|
820
|
+
uint32 line;
|
821
|
+
|
822
|
+
for (line = 0; line < h; line++) {
|
823
|
+
uint32 *left = raster + (line * w);
|
824
|
+
uint32 *right = left + w - 1;
|
825
|
+
|
826
|
+
while ( left < right ) {
|
827
|
+
uint32 temp = *left;
|
828
|
+
*left = *right;
|
829
|
+
*right = temp;
|
830
|
+
left++, right--;
|
831
|
+
}
|
832
|
+
}
|
833
|
+
}
|
834
|
+
|
835
|
+
_TIFFfree(buf);
|
836
|
+
return (ret);
|
837
|
+
}
|
838
|
+
|
839
|
+
/*
|
840
|
+
* Get a strip-organized image that has
|
841
|
+
* PlanarConfiguration contiguous if SamplesPerPixel > 1
|
842
|
+
* or
|
843
|
+
* SamplesPerPixel == 1
|
844
|
+
*/
|
845
|
+
static int
|
846
|
+
gtStripContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
|
847
|
+
{
|
848
|
+
TIFF* tif = img->tif;
|
849
|
+
tileContigRoutine put = img->put.contig;
|
850
|
+
uint32 row, y, nrow, nrowsub, rowstoread;
|
851
|
+
tmsize_t pos;
|
852
|
+
unsigned char* buf;
|
853
|
+
uint32 rowsperstrip;
|
854
|
+
uint16 subsamplinghor,subsamplingver;
|
855
|
+
uint32 imagewidth = img->width;
|
856
|
+
tmsize_t scanline;
|
857
|
+
int32 fromskew, toskew;
|
858
|
+
int ret = 1, flip;
|
859
|
+
|
860
|
+
TIFFGetFieldDefaulted(tif, TIFFTAG_YCBCRSUBSAMPLING, &subsamplinghor, &subsamplingver);
|
861
|
+
if( subsamplingver == 0 ) {
|
862
|
+
TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "Invalid vertical YCbCr subsampling");
|
863
|
+
return (0);
|
864
|
+
}
|
865
|
+
|
866
|
+
buf = (unsigned char*) _TIFFmalloc(TIFFStripSize(tif));
|
867
|
+
if (buf == 0) {
|
868
|
+
TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "No space for strip buffer");
|
869
|
+
return (0);
|
870
|
+
}
|
871
|
+
_TIFFmemset(buf, 0, TIFFStripSize(tif));
|
872
|
+
|
873
|
+
flip = setorientation(img);
|
874
|
+
if (flip & FLIP_VERTICALLY) {
|
875
|
+
y = h - 1;
|
876
|
+
toskew = -(int32)(w + w);
|
877
|
+
} else {
|
878
|
+
y = 0;
|
879
|
+
toskew = -(int32)(w - w);
|
880
|
+
}
|
881
|
+
|
882
|
+
TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
|
883
|
+
|
884
|
+
scanline = TIFFScanlineSize(tif);
|
885
|
+
fromskew = (w < imagewidth ? imagewidth - w : 0);
|
886
|
+
for (row = 0; row < h; row += nrow)
|
887
|
+
{
|
888
|
+
rowstoread = rowsperstrip - (row + img->row_offset) % rowsperstrip;
|
889
|
+
nrow = (row + rowstoread > h ? h - row : rowstoread);
|
890
|
+
nrowsub = nrow;
|
891
|
+
if ((nrowsub%subsamplingver)!=0)
|
892
|
+
nrowsub+=subsamplingver-nrowsub%subsamplingver;
|
893
|
+
if (TIFFReadEncodedStrip(tif,
|
894
|
+
TIFFComputeStrip(tif,row+img->row_offset, 0),
|
895
|
+
buf,
|
896
|
+
((row + img->row_offset)%rowsperstrip + nrowsub) * scanline)==(tmsize_t)(-1)
|
897
|
+
&& img->stoponerr)
|
898
|
+
{
|
899
|
+
ret = 0;
|
900
|
+
break;
|
901
|
+
}
|
902
|
+
|
903
|
+
pos = ((row + img->row_offset) % rowsperstrip) * scanline;
|
904
|
+
(*put)(img, raster+y*w, 0, y, w, nrow, fromskew, toskew, buf + pos);
|
905
|
+
y += (flip & FLIP_VERTICALLY ? -(int32) nrow : (int32) nrow);
|
906
|
+
}
|
907
|
+
|
908
|
+
if (flip & FLIP_HORIZONTALLY) {
|
909
|
+
uint32 line;
|
910
|
+
|
911
|
+
for (line = 0; line < h; line++) {
|
912
|
+
uint32 *left = raster + (line * w);
|
913
|
+
uint32 *right = left + w - 1;
|
914
|
+
|
915
|
+
while ( left < right ) {
|
916
|
+
uint32 temp = *left;
|
917
|
+
*left = *right;
|
918
|
+
*right = temp;
|
919
|
+
left++, right--;
|
920
|
+
}
|
921
|
+
}
|
922
|
+
}
|
923
|
+
|
924
|
+
_TIFFfree(buf);
|
925
|
+
return (ret);
|
926
|
+
}
|
927
|
+
|
928
|
+
/*
|
929
|
+
* Get a strip-organized image with
|
930
|
+
* SamplesPerPixel > 1
|
931
|
+
* PlanarConfiguration separated
|
932
|
+
* We assume that all such images are RGB.
|
933
|
+
*/
|
934
|
+
static int
|
935
|
+
gtStripSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
|
936
|
+
{
|
937
|
+
TIFF* tif = img->tif;
|
938
|
+
tileSeparateRoutine put = img->put.separate;
|
939
|
+
unsigned char *buf;
|
940
|
+
unsigned char *p0, *p1, *p2, *pa;
|
941
|
+
uint32 row, y, nrow, rowstoread;
|
942
|
+
tmsize_t pos;
|
943
|
+
tmsize_t scanline;
|
944
|
+
uint32 rowsperstrip, offset_row;
|
945
|
+
uint32 imagewidth = img->width;
|
946
|
+
tmsize_t stripsize;
|
947
|
+
tmsize_t bufsize;
|
948
|
+
int32 fromskew, toskew;
|
949
|
+
int alpha = img->alpha;
|
950
|
+
int ret = 1, flip, colorchannels;
|
951
|
+
|
952
|
+
stripsize = TIFFStripSize(tif);
|
953
|
+
bufsize = TIFFSafeMultiply(tmsize_t,alpha?4:3,stripsize);
|
954
|
+
if (bufsize == 0) {
|
955
|
+
TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "Integer overflow in %s", "gtStripSeparate");
|
956
|
+
return (0);
|
957
|
+
}
|
958
|
+
p0 = buf = (unsigned char *)_TIFFmalloc(bufsize);
|
959
|
+
if (buf == 0) {
|
960
|
+
TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "No space for tile buffer");
|
961
|
+
return (0);
|
962
|
+
}
|
963
|
+
_TIFFmemset(buf, 0, bufsize);
|
964
|
+
p1 = p0 + stripsize;
|
965
|
+
p2 = p1 + stripsize;
|
966
|
+
pa = (alpha?(p2+stripsize):NULL);
|
967
|
+
|
968
|
+
flip = setorientation(img);
|
969
|
+
if (flip & FLIP_VERTICALLY) {
|
970
|
+
y = h - 1;
|
971
|
+
toskew = -(int32)(w + w);
|
972
|
+
}
|
973
|
+
else {
|
974
|
+
y = 0;
|
975
|
+
toskew = -(int32)(w - w);
|
976
|
+
}
|
977
|
+
|
978
|
+
switch( img->photometric )
|
979
|
+
{
|
980
|
+
case PHOTOMETRIC_MINISWHITE:
|
981
|
+
case PHOTOMETRIC_MINISBLACK:
|
982
|
+
case PHOTOMETRIC_PALETTE:
|
983
|
+
colorchannels = 1;
|
984
|
+
p2 = p1 = p0;
|
985
|
+
break;
|
986
|
+
|
987
|
+
default:
|
988
|
+
colorchannels = 3;
|
989
|
+
break;
|
990
|
+
}
|
991
|
+
|
992
|
+
TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
|
993
|
+
scanline = TIFFScanlineSize(tif);
|
994
|
+
fromskew = (w < imagewidth ? imagewidth - w : 0);
|
995
|
+
for (row = 0; row < h; row += nrow)
|
996
|
+
{
|
997
|
+
rowstoread = rowsperstrip - (row + img->row_offset) % rowsperstrip;
|
998
|
+
nrow = (row + rowstoread > h ? h - row : rowstoread);
|
999
|
+
offset_row = row + img->row_offset;
|
1000
|
+
if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, offset_row, 0),
|
1001
|
+
p0, ((row + img->row_offset)%rowsperstrip + nrow) * scanline)==(tmsize_t)(-1)
|
1002
|
+
&& img->stoponerr)
|
1003
|
+
{
|
1004
|
+
ret = 0;
|
1005
|
+
break;
|
1006
|
+
}
|
1007
|
+
if (colorchannels > 1
|
1008
|
+
&& TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, offset_row, 1),
|
1009
|
+
p1, ((row + img->row_offset)%rowsperstrip + nrow) * scanline) == (tmsize_t)(-1)
|
1010
|
+
&& img->stoponerr)
|
1011
|
+
{
|
1012
|
+
ret = 0;
|
1013
|
+
break;
|
1014
|
+
}
|
1015
|
+
if (colorchannels > 1
|
1016
|
+
&& TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, offset_row, 2),
|
1017
|
+
p2, ((row + img->row_offset)%rowsperstrip + nrow) * scanline) == (tmsize_t)(-1)
|
1018
|
+
&& img->stoponerr)
|
1019
|
+
{
|
1020
|
+
ret = 0;
|
1021
|
+
break;
|
1022
|
+
}
|
1023
|
+
if (alpha)
|
1024
|
+
{
|
1025
|
+
if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, offset_row, colorchannels),
|
1026
|
+
pa, ((row + img->row_offset)%rowsperstrip + nrow) * scanline)==(tmsize_t)(-1)
|
1027
|
+
&& img->stoponerr)
|
1028
|
+
{
|
1029
|
+
ret = 0;
|
1030
|
+
break;
|
1031
|
+
}
|
1032
|
+
}
|
1033
|
+
|
1034
|
+
pos = ((row + img->row_offset) % rowsperstrip) * scanline;
|
1035
|
+
(*put)(img, raster+y*w, 0, y, w, nrow, fromskew, toskew, p0 + pos, p1 + pos,
|
1036
|
+
p2 + pos, (alpha?(pa+pos):NULL));
|
1037
|
+
y += (flip & FLIP_VERTICALLY ? -(int32) nrow : (int32) nrow);
|
1038
|
+
}
|
1039
|
+
|
1040
|
+
if (flip & FLIP_HORIZONTALLY) {
|
1041
|
+
uint32 line;
|
1042
|
+
|
1043
|
+
for (line = 0; line < h; line++) {
|
1044
|
+
uint32 *left = raster + (line * w);
|
1045
|
+
uint32 *right = left + w - 1;
|
1046
|
+
|
1047
|
+
while ( left < right ) {
|
1048
|
+
uint32 temp = *left;
|
1049
|
+
*left = *right;
|
1050
|
+
*right = temp;
|
1051
|
+
left++, right--;
|
1052
|
+
}
|
1053
|
+
}
|
1054
|
+
}
|
1055
|
+
|
1056
|
+
_TIFFfree(buf);
|
1057
|
+
return (ret);
|
1058
|
+
}
|
1059
|
+
|
1060
|
+
/*
|
1061
|
+
* The following routines move decoded data returned
|
1062
|
+
* from the TIFF library into rasters filled with packed
|
1063
|
+
* ABGR pixels (i.e. suitable for passing to lrecwrite.)
|
1064
|
+
*
|
1065
|
+
* The routines have been created according to the most
|
1066
|
+
* important cases and optimized. PickContigCase and
|
1067
|
+
* PickSeparateCase analyze the parameters and select
|
1068
|
+
* the appropriate "get" and "put" routine to use.
|
1069
|
+
*/
|
1070
|
+
#define REPEAT8(op) REPEAT4(op); REPEAT4(op)
|
1071
|
+
#define REPEAT4(op) REPEAT2(op); REPEAT2(op)
|
1072
|
+
#define REPEAT2(op) op; op
|
1073
|
+
#define CASE8(x,op) \
|
1074
|
+
switch (x) { \
|
1075
|
+
case 7: op; case 6: op; case 5: op; \
|
1076
|
+
case 4: op; case 3: op; case 2: op; \
|
1077
|
+
case 1: op; \
|
1078
|
+
}
|
1079
|
+
#define CASE4(x,op) switch (x) { case 3: op; case 2: op; case 1: op; }
|
1080
|
+
#define NOP
|
1081
|
+
|
1082
|
+
#define UNROLL8(w, op1, op2) { \
|
1083
|
+
uint32 _x; \
|
1084
|
+
for (_x = w; _x >= 8; _x -= 8) { \
|
1085
|
+
op1; \
|
1086
|
+
REPEAT8(op2); \
|
1087
|
+
} \
|
1088
|
+
if (_x > 0) { \
|
1089
|
+
op1; \
|
1090
|
+
CASE8(_x,op2); \
|
1091
|
+
} \
|
1092
|
+
}
|
1093
|
+
#define UNROLL4(w, op1, op2) { \
|
1094
|
+
uint32 _x; \
|
1095
|
+
for (_x = w; _x >= 4; _x -= 4) { \
|
1096
|
+
op1; \
|
1097
|
+
REPEAT4(op2); \
|
1098
|
+
} \
|
1099
|
+
if (_x > 0) { \
|
1100
|
+
op1; \
|
1101
|
+
CASE4(_x,op2); \
|
1102
|
+
} \
|
1103
|
+
}
|
1104
|
+
#define UNROLL2(w, op1, op2) { \
|
1105
|
+
uint32 _x; \
|
1106
|
+
for (_x = w; _x >= 2; _x -= 2) { \
|
1107
|
+
op1; \
|
1108
|
+
REPEAT2(op2); \
|
1109
|
+
} \
|
1110
|
+
if (_x) { \
|
1111
|
+
op1; \
|
1112
|
+
op2; \
|
1113
|
+
} \
|
1114
|
+
}
|
1115
|
+
|
1116
|
+
#define SKEW(r,g,b,skew) { r += skew; g += skew; b += skew; }
|
1117
|
+
#define SKEW4(r,g,b,a,skew) { r += skew; g += skew; b += skew; a+= skew; }
|
1118
|
+
|
1119
|
+
#define A1 (((uint32)0xffL)<<24)
|
1120
|
+
#define PACK(r,g,b) \
|
1121
|
+
((uint32)(r)|((uint32)(g)<<8)|((uint32)(b)<<16)|A1)
|
1122
|
+
#define PACK4(r,g,b,a) \
|
1123
|
+
((uint32)(r)|((uint32)(g)<<8)|((uint32)(b)<<16)|((uint32)(a)<<24))
|
1124
|
+
#define W2B(v) (((v)>>8)&0xff)
|
1125
|
+
/* TODO: PACKW should have be made redundant in favor of Bitdepth16To8 LUT */
|
1126
|
+
#define PACKW(r,g,b) \
|
1127
|
+
((uint32)W2B(r)|((uint32)W2B(g)<<8)|((uint32)W2B(b)<<16)|A1)
|
1128
|
+
#define PACKW4(r,g,b,a) \
|
1129
|
+
((uint32)W2B(r)|((uint32)W2B(g)<<8)|((uint32)W2B(b)<<16)|((uint32)W2B(a)<<24))
|
1130
|
+
|
1131
|
+
#define DECLAREContigPutFunc(name) \
|
1132
|
+
static void name(\
|
1133
|
+
TIFFRGBAImage* img, \
|
1134
|
+
uint32* cp, \
|
1135
|
+
uint32 x, uint32 y, \
|
1136
|
+
uint32 w, uint32 h, \
|
1137
|
+
int32 fromskew, int32 toskew, \
|
1138
|
+
unsigned char* pp \
|
1139
|
+
)
|
1140
|
+
|
1141
|
+
/*
|
1142
|
+
* 8-bit palette => colormap/RGB
|
1143
|
+
*/
|
1144
|
+
DECLAREContigPutFunc(put8bitcmaptile)
|
1145
|
+
{
|
1146
|
+
uint32** PALmap = img->PALmap;
|
1147
|
+
int samplesperpixel = img->samplesperpixel;
|
1148
|
+
|
1149
|
+
(void) y;
|
1150
|
+
while (h-- > 0) {
|
1151
|
+
for (x = w; x-- > 0;)
|
1152
|
+
{
|
1153
|
+
*cp++ = PALmap[*pp][0];
|
1154
|
+
pp += samplesperpixel;
|
1155
|
+
}
|
1156
|
+
cp += toskew;
|
1157
|
+
pp += fromskew;
|
1158
|
+
}
|
1159
|
+
}
|
1160
|
+
|
1161
|
+
/*
|
1162
|
+
* 4-bit palette => colormap/RGB
|
1163
|
+
*/
|
1164
|
+
DECLAREContigPutFunc(put4bitcmaptile)
|
1165
|
+
{
|
1166
|
+
uint32** PALmap = img->PALmap;
|
1167
|
+
|
1168
|
+
(void) x; (void) y;
|
1169
|
+
fromskew /= 2;
|
1170
|
+
while (h-- > 0) {
|
1171
|
+
uint32* bw;
|
1172
|
+
UNROLL2(w, bw = PALmap[*pp++], *cp++ = *bw++);
|
1173
|
+
cp += toskew;
|
1174
|
+
pp += fromskew;
|
1175
|
+
}
|
1176
|
+
}
|
1177
|
+
|
1178
|
+
/*
|
1179
|
+
* 2-bit palette => colormap/RGB
|
1180
|
+
*/
|
1181
|
+
DECLAREContigPutFunc(put2bitcmaptile)
|
1182
|
+
{
|
1183
|
+
uint32** PALmap = img->PALmap;
|
1184
|
+
|
1185
|
+
(void) x; (void) y;
|
1186
|
+
fromskew /= 4;
|
1187
|
+
while (h-- > 0) {
|
1188
|
+
uint32* bw;
|
1189
|
+
UNROLL4(w, bw = PALmap[*pp++], *cp++ = *bw++);
|
1190
|
+
cp += toskew;
|
1191
|
+
pp += fromskew;
|
1192
|
+
}
|
1193
|
+
}
|
1194
|
+
|
1195
|
+
/*
|
1196
|
+
* 1-bit palette => colormap/RGB
|
1197
|
+
*/
|
1198
|
+
DECLAREContigPutFunc(put1bitcmaptile)
|
1199
|
+
{
|
1200
|
+
uint32** PALmap = img->PALmap;
|
1201
|
+
|
1202
|
+
(void) x; (void) y;
|
1203
|
+
fromskew /= 8;
|
1204
|
+
while (h-- > 0) {
|
1205
|
+
uint32* bw;
|
1206
|
+
UNROLL8(w, bw = PALmap[*pp++], *cp++ = *bw++);
|
1207
|
+
cp += toskew;
|
1208
|
+
pp += fromskew;
|
1209
|
+
}
|
1210
|
+
}
|
1211
|
+
|
1212
|
+
/*
|
1213
|
+
* 8-bit greyscale => colormap/RGB
|
1214
|
+
*/
|
1215
|
+
DECLAREContigPutFunc(putgreytile)
|
1216
|
+
{
|
1217
|
+
int samplesperpixel = img->samplesperpixel;
|
1218
|
+
uint32** BWmap = img->BWmap;
|
1219
|
+
|
1220
|
+
(void) y;
|
1221
|
+
while (h-- > 0) {
|
1222
|
+
for (x = w; x-- > 0;)
|
1223
|
+
{
|
1224
|
+
*cp++ = BWmap[*pp][0];
|
1225
|
+
pp += samplesperpixel;
|
1226
|
+
}
|
1227
|
+
cp += toskew;
|
1228
|
+
pp += fromskew;
|
1229
|
+
}
|
1230
|
+
}
|
1231
|
+
|
1232
|
+
/*
|
1233
|
+
* 8-bit greyscale with associated alpha => colormap/RGBA
|
1234
|
+
*/
|
1235
|
+
DECLAREContigPutFunc(putagreytile)
|
1236
|
+
{
|
1237
|
+
int samplesperpixel = img->samplesperpixel;
|
1238
|
+
uint32** BWmap = img->BWmap;
|
1239
|
+
|
1240
|
+
(void) y;
|
1241
|
+
while (h-- > 0) {
|
1242
|
+
for (x = w; x-- > 0;)
|
1243
|
+
{
|
1244
|
+
*cp++ = BWmap[*pp][0] & (*(pp+1) << 24 | ~A1);
|
1245
|
+
pp += samplesperpixel;
|
1246
|
+
}
|
1247
|
+
cp += toskew;
|
1248
|
+
pp += fromskew;
|
1249
|
+
}
|
1250
|
+
}
|
1251
|
+
|
1252
|
+
/*
|
1253
|
+
* 16-bit greyscale => colormap/RGB
|
1254
|
+
*/
|
1255
|
+
DECLAREContigPutFunc(put16bitbwtile)
|
1256
|
+
{
|
1257
|
+
int samplesperpixel = img->samplesperpixel;
|
1258
|
+
uint32** BWmap = img->BWmap;
|
1259
|
+
|
1260
|
+
(void) y;
|
1261
|
+
while (h-- > 0) {
|
1262
|
+
uint16 *wp = (uint16 *) pp;
|
1263
|
+
|
1264
|
+
for (x = w; x-- > 0;)
|
1265
|
+
{
|
1266
|
+
/* use high order byte of 16bit value */
|
1267
|
+
|
1268
|
+
*cp++ = BWmap[*wp >> 8][0];
|
1269
|
+
pp += 2 * samplesperpixel;
|
1270
|
+
wp += samplesperpixel;
|
1271
|
+
}
|
1272
|
+
cp += toskew;
|
1273
|
+
pp += fromskew;
|
1274
|
+
}
|
1275
|
+
}
|
1276
|
+
|
1277
|
+
/*
|
1278
|
+
* 1-bit bilevel => colormap/RGB
|
1279
|
+
*/
|
1280
|
+
DECLAREContigPutFunc(put1bitbwtile)
|
1281
|
+
{
|
1282
|
+
uint32** BWmap = img->BWmap;
|
1283
|
+
|
1284
|
+
(void) x; (void) y;
|
1285
|
+
fromskew /= 8;
|
1286
|
+
while (h-- > 0) {
|
1287
|
+
uint32* bw;
|
1288
|
+
UNROLL8(w, bw = BWmap[*pp++], *cp++ = *bw++);
|
1289
|
+
cp += toskew;
|
1290
|
+
pp += fromskew;
|
1291
|
+
}
|
1292
|
+
}
|
1293
|
+
|
1294
|
+
/*
|
1295
|
+
* 2-bit greyscale => colormap/RGB
|
1296
|
+
*/
|
1297
|
+
DECLAREContigPutFunc(put2bitbwtile)
|
1298
|
+
{
|
1299
|
+
uint32** BWmap = img->BWmap;
|
1300
|
+
|
1301
|
+
(void) x; (void) y;
|
1302
|
+
fromskew /= 4;
|
1303
|
+
while (h-- > 0) {
|
1304
|
+
uint32* bw;
|
1305
|
+
UNROLL4(w, bw = BWmap[*pp++], *cp++ = *bw++);
|
1306
|
+
cp += toskew;
|
1307
|
+
pp += fromskew;
|
1308
|
+
}
|
1309
|
+
}
|
1310
|
+
|
1311
|
+
/*
|
1312
|
+
* 4-bit greyscale => colormap/RGB
|
1313
|
+
*/
|
1314
|
+
DECLAREContigPutFunc(put4bitbwtile)
|
1315
|
+
{
|
1316
|
+
uint32** BWmap = img->BWmap;
|
1317
|
+
|
1318
|
+
(void) x; (void) y;
|
1319
|
+
fromskew /= 2;
|
1320
|
+
while (h-- > 0) {
|
1321
|
+
uint32* bw;
|
1322
|
+
UNROLL2(w, bw = BWmap[*pp++], *cp++ = *bw++);
|
1323
|
+
cp += toskew;
|
1324
|
+
pp += fromskew;
|
1325
|
+
}
|
1326
|
+
}
|
1327
|
+
|
1328
|
+
/*
|
1329
|
+
* 8-bit packed samples, no Map => RGB
|
1330
|
+
*/
|
1331
|
+
DECLAREContigPutFunc(putRGBcontig8bittile)
|
1332
|
+
{
|
1333
|
+
int samplesperpixel = img->samplesperpixel;
|
1334
|
+
|
1335
|
+
(void) x; (void) y;
|
1336
|
+
fromskew *= samplesperpixel;
|
1337
|
+
while (h-- > 0) {
|
1338
|
+
UNROLL8(w, NOP,
|
1339
|
+
*cp++ = PACK(pp[0], pp[1], pp[2]);
|
1340
|
+
pp += samplesperpixel);
|
1341
|
+
cp += toskew;
|
1342
|
+
pp += fromskew;
|
1343
|
+
}
|
1344
|
+
}
|
1345
|
+
|
1346
|
+
/*
|
1347
|
+
* 8-bit packed samples => RGBA w/ associated alpha
|
1348
|
+
* (known to have Map == NULL)
|
1349
|
+
*/
|
1350
|
+
DECLAREContigPutFunc(putRGBAAcontig8bittile)
|
1351
|
+
{
|
1352
|
+
int samplesperpixel = img->samplesperpixel;
|
1353
|
+
|
1354
|
+
(void) x; (void) y;
|
1355
|
+
fromskew *= samplesperpixel;
|
1356
|
+
while (h-- > 0) {
|
1357
|
+
UNROLL8(w, NOP,
|
1358
|
+
*cp++ = PACK4(pp[0], pp[1], pp[2], pp[3]);
|
1359
|
+
pp += samplesperpixel);
|
1360
|
+
cp += toskew;
|
1361
|
+
pp += fromskew;
|
1362
|
+
}
|
1363
|
+
}
|
1364
|
+
|
1365
|
+
/*
|
1366
|
+
* 8-bit packed samples => RGBA w/ unassociated alpha
|
1367
|
+
* (known to have Map == NULL)
|
1368
|
+
*/
|
1369
|
+
DECLAREContigPutFunc(putRGBUAcontig8bittile)
|
1370
|
+
{
|
1371
|
+
int samplesperpixel = img->samplesperpixel;
|
1372
|
+
(void) y;
|
1373
|
+
fromskew *= samplesperpixel;
|
1374
|
+
while (h-- > 0) {
|
1375
|
+
uint32 r, g, b, a;
|
1376
|
+
uint8* m;
|
1377
|
+
for (x = w; x-- > 0;) {
|
1378
|
+
a = pp[3];
|
1379
|
+
m = img->UaToAa+(a<<8);
|
1380
|
+
r = m[pp[0]];
|
1381
|
+
g = m[pp[1]];
|
1382
|
+
b = m[pp[2]];
|
1383
|
+
*cp++ = PACK4(r,g,b,a);
|
1384
|
+
pp += samplesperpixel;
|
1385
|
+
}
|
1386
|
+
cp += toskew;
|
1387
|
+
pp += fromskew;
|
1388
|
+
}
|
1389
|
+
}
|
1390
|
+
|
1391
|
+
/*
|
1392
|
+
* 16-bit packed samples => RGB
|
1393
|
+
*/
|
1394
|
+
DECLAREContigPutFunc(putRGBcontig16bittile)
|
1395
|
+
{
|
1396
|
+
int samplesperpixel = img->samplesperpixel;
|
1397
|
+
uint16 *wp = (uint16 *)pp;
|
1398
|
+
(void) y;
|
1399
|
+
fromskew *= samplesperpixel;
|
1400
|
+
while (h-- > 0) {
|
1401
|
+
for (x = w; x-- > 0;) {
|
1402
|
+
*cp++ = PACK(img->Bitdepth16To8[wp[0]],
|
1403
|
+
img->Bitdepth16To8[wp[1]],
|
1404
|
+
img->Bitdepth16To8[wp[2]]);
|
1405
|
+
wp += samplesperpixel;
|
1406
|
+
}
|
1407
|
+
cp += toskew;
|
1408
|
+
wp += fromskew;
|
1409
|
+
}
|
1410
|
+
}
|
1411
|
+
|
1412
|
+
/*
|
1413
|
+
* 16-bit packed samples => RGBA w/ associated alpha
|
1414
|
+
* (known to have Map == NULL)
|
1415
|
+
*/
|
1416
|
+
DECLAREContigPutFunc(putRGBAAcontig16bittile)
|
1417
|
+
{
|
1418
|
+
int samplesperpixel = img->samplesperpixel;
|
1419
|
+
uint16 *wp = (uint16 *)pp;
|
1420
|
+
(void) y;
|
1421
|
+
fromskew *= samplesperpixel;
|
1422
|
+
while (h-- > 0) {
|
1423
|
+
for (x = w; x-- > 0;) {
|
1424
|
+
*cp++ = PACK4(img->Bitdepth16To8[wp[0]],
|
1425
|
+
img->Bitdepth16To8[wp[1]],
|
1426
|
+
img->Bitdepth16To8[wp[2]],
|
1427
|
+
img->Bitdepth16To8[wp[3]]);
|
1428
|
+
wp += samplesperpixel;
|
1429
|
+
}
|
1430
|
+
cp += toskew;
|
1431
|
+
wp += fromskew;
|
1432
|
+
}
|
1433
|
+
}
|
1434
|
+
|
1435
|
+
/*
|
1436
|
+
* 16-bit packed samples => RGBA w/ unassociated alpha
|
1437
|
+
* (known to have Map == NULL)
|
1438
|
+
*/
|
1439
|
+
DECLAREContigPutFunc(putRGBUAcontig16bittile)
|
1440
|
+
{
|
1441
|
+
int samplesperpixel = img->samplesperpixel;
|
1442
|
+
uint16 *wp = (uint16 *)pp;
|
1443
|
+
(void) y;
|
1444
|
+
fromskew *= samplesperpixel;
|
1445
|
+
while (h-- > 0) {
|
1446
|
+
uint32 r,g,b,a;
|
1447
|
+
uint8* m;
|
1448
|
+
for (x = w; x-- > 0;) {
|
1449
|
+
a = img->Bitdepth16To8[wp[3]];
|
1450
|
+
m = img->UaToAa+(a<<8);
|
1451
|
+
r = m[img->Bitdepth16To8[wp[0]]];
|
1452
|
+
g = m[img->Bitdepth16To8[wp[1]]];
|
1453
|
+
b = m[img->Bitdepth16To8[wp[2]]];
|
1454
|
+
*cp++ = PACK4(r,g,b,a);
|
1455
|
+
wp += samplesperpixel;
|
1456
|
+
}
|
1457
|
+
cp += toskew;
|
1458
|
+
wp += fromskew;
|
1459
|
+
}
|
1460
|
+
}
|
1461
|
+
|
1462
|
+
/*
|
1463
|
+
* 8-bit packed CMYK samples w/o Map => RGB
|
1464
|
+
*
|
1465
|
+
* NB: The conversion of CMYK->RGB is *very* crude.
|
1466
|
+
*/
|
1467
|
+
DECLAREContigPutFunc(putRGBcontig8bitCMYKtile)
|
1468
|
+
{
|
1469
|
+
int samplesperpixel = img->samplesperpixel;
|
1470
|
+
uint16 r, g, b, k;
|
1471
|
+
|
1472
|
+
(void) x; (void) y;
|
1473
|
+
fromskew *= samplesperpixel;
|
1474
|
+
while (h-- > 0) {
|
1475
|
+
UNROLL8(w, NOP,
|
1476
|
+
k = 255 - pp[3];
|
1477
|
+
r = (k*(255-pp[0]))/255;
|
1478
|
+
g = (k*(255-pp[1]))/255;
|
1479
|
+
b = (k*(255-pp[2]))/255;
|
1480
|
+
*cp++ = PACK(r, g, b);
|
1481
|
+
pp += samplesperpixel);
|
1482
|
+
cp += toskew;
|
1483
|
+
pp += fromskew;
|
1484
|
+
}
|
1485
|
+
}
|
1486
|
+
|
1487
|
+
/*
|
1488
|
+
* 8-bit packed CMYK samples w/Map => RGB
|
1489
|
+
*
|
1490
|
+
* NB: The conversion of CMYK->RGB is *very* crude.
|
1491
|
+
*/
|
1492
|
+
DECLAREContigPutFunc(putRGBcontig8bitCMYKMaptile)
|
1493
|
+
{
|
1494
|
+
int samplesperpixel = img->samplesperpixel;
|
1495
|
+
TIFFRGBValue* Map = img->Map;
|
1496
|
+
uint16 r, g, b, k;
|
1497
|
+
|
1498
|
+
(void) y;
|
1499
|
+
fromskew *= samplesperpixel;
|
1500
|
+
while (h-- > 0) {
|
1501
|
+
for (x = w; x-- > 0;) {
|
1502
|
+
k = 255 - pp[3];
|
1503
|
+
r = (k*(255-pp[0]))/255;
|
1504
|
+
g = (k*(255-pp[1]))/255;
|
1505
|
+
b = (k*(255-pp[2]))/255;
|
1506
|
+
*cp++ = PACK(Map[r], Map[g], Map[b]);
|
1507
|
+
pp += samplesperpixel;
|
1508
|
+
}
|
1509
|
+
pp += fromskew;
|
1510
|
+
cp += toskew;
|
1511
|
+
}
|
1512
|
+
}
|
1513
|
+
|
1514
|
+
#define DECLARESepPutFunc(name) \
|
1515
|
+
static void name(\
|
1516
|
+
TIFFRGBAImage* img,\
|
1517
|
+
uint32* cp,\
|
1518
|
+
uint32 x, uint32 y, \
|
1519
|
+
uint32 w, uint32 h,\
|
1520
|
+
int32 fromskew, int32 toskew,\
|
1521
|
+
unsigned char* r, unsigned char* g, unsigned char* b, unsigned char* a\
|
1522
|
+
)
|
1523
|
+
|
1524
|
+
/*
|
1525
|
+
* 8-bit unpacked samples => RGB
|
1526
|
+
*/
|
1527
|
+
DECLARESepPutFunc(putRGBseparate8bittile)
|
1528
|
+
{
|
1529
|
+
(void) img; (void) x; (void) y; (void) a;
|
1530
|
+
while (h-- > 0) {
|
1531
|
+
UNROLL8(w, NOP, *cp++ = PACK(*r++, *g++, *b++));
|
1532
|
+
SKEW(r, g, b, fromskew);
|
1533
|
+
cp += toskew;
|
1534
|
+
}
|
1535
|
+
}
|
1536
|
+
|
1537
|
+
/*
|
1538
|
+
* 8-bit unpacked samples => RGBA w/ associated alpha
|
1539
|
+
*/
|
1540
|
+
DECLARESepPutFunc(putRGBAAseparate8bittile)
|
1541
|
+
{
|
1542
|
+
(void) img; (void) x; (void) y;
|
1543
|
+
while (h-- > 0) {
|
1544
|
+
UNROLL8(w, NOP, *cp++ = PACK4(*r++, *g++, *b++, *a++));
|
1545
|
+
SKEW4(r, g, b, a, fromskew);
|
1546
|
+
cp += toskew;
|
1547
|
+
}
|
1548
|
+
}
|
1549
|
+
|
1550
|
+
/*
|
1551
|
+
* 8-bit unpacked CMYK samples => RGBA
|
1552
|
+
*/
|
1553
|
+
DECLARESepPutFunc(putCMYKseparate8bittile)
|
1554
|
+
{
|
1555
|
+
(void) img; (void) y;
|
1556
|
+
while (h-- > 0) {
|
1557
|
+
uint32 rv, gv, bv, kv;
|
1558
|
+
for (x = w; x-- > 0;) {
|
1559
|
+
kv = 255 - *a++;
|
1560
|
+
rv = (kv*(255-*r++))/255;
|
1561
|
+
gv = (kv*(255-*g++))/255;
|
1562
|
+
bv = (kv*(255-*b++))/255;
|
1563
|
+
*cp++ = PACK4(rv,gv,bv,255);
|
1564
|
+
}
|
1565
|
+
SKEW4(r, g, b, a, fromskew);
|
1566
|
+
cp += toskew;
|
1567
|
+
}
|
1568
|
+
}
|
1569
|
+
|
1570
|
+
/*
|
1571
|
+
* 8-bit unpacked samples => RGBA w/ unassociated alpha
|
1572
|
+
*/
|
1573
|
+
DECLARESepPutFunc(putRGBUAseparate8bittile)
|
1574
|
+
{
|
1575
|
+
(void) img; (void) y;
|
1576
|
+
while (h-- > 0) {
|
1577
|
+
uint32 rv, gv, bv, av;
|
1578
|
+
uint8* m;
|
1579
|
+
for (x = w; x-- > 0;) {
|
1580
|
+
av = *a++;
|
1581
|
+
m = img->UaToAa+(av<<8);
|
1582
|
+
rv = m[*r++];
|
1583
|
+
gv = m[*g++];
|
1584
|
+
bv = m[*b++];
|
1585
|
+
*cp++ = PACK4(rv,gv,bv,av);
|
1586
|
+
}
|
1587
|
+
SKEW4(r, g, b, a, fromskew);
|
1588
|
+
cp += toskew;
|
1589
|
+
}
|
1590
|
+
}
|
1591
|
+
|
1592
|
+
/*
|
1593
|
+
* 16-bit unpacked samples => RGB
|
1594
|
+
*/
|
1595
|
+
DECLARESepPutFunc(putRGBseparate16bittile)
|
1596
|
+
{
|
1597
|
+
uint16 *wr = (uint16*) r;
|
1598
|
+
uint16 *wg = (uint16*) g;
|
1599
|
+
uint16 *wb = (uint16*) b;
|
1600
|
+
(void) img; (void) y; (void) a;
|
1601
|
+
while (h-- > 0) {
|
1602
|
+
for (x = 0; x < w; x++)
|
1603
|
+
*cp++ = PACK(img->Bitdepth16To8[*wr++],
|
1604
|
+
img->Bitdepth16To8[*wg++],
|
1605
|
+
img->Bitdepth16To8[*wb++]);
|
1606
|
+
SKEW(wr, wg, wb, fromskew);
|
1607
|
+
cp += toskew;
|
1608
|
+
}
|
1609
|
+
}
|
1610
|
+
|
1611
|
+
/*
|
1612
|
+
* 16-bit unpacked samples => RGBA w/ associated alpha
|
1613
|
+
*/
|
1614
|
+
DECLARESepPutFunc(putRGBAAseparate16bittile)
|
1615
|
+
{
|
1616
|
+
uint16 *wr = (uint16*) r;
|
1617
|
+
uint16 *wg = (uint16*) g;
|
1618
|
+
uint16 *wb = (uint16*) b;
|
1619
|
+
uint16 *wa = (uint16*) a;
|
1620
|
+
(void) img; (void) y;
|
1621
|
+
while (h-- > 0) {
|
1622
|
+
for (x = 0; x < w; x++)
|
1623
|
+
*cp++ = PACK4(img->Bitdepth16To8[*wr++],
|
1624
|
+
img->Bitdepth16To8[*wg++],
|
1625
|
+
img->Bitdepth16To8[*wb++],
|
1626
|
+
img->Bitdepth16To8[*wa++]);
|
1627
|
+
SKEW4(wr, wg, wb, wa, fromskew);
|
1628
|
+
cp += toskew;
|
1629
|
+
}
|
1630
|
+
}
|
1631
|
+
|
1632
|
+
/*
|
1633
|
+
* 16-bit unpacked samples => RGBA w/ unassociated alpha
|
1634
|
+
*/
|
1635
|
+
DECLARESepPutFunc(putRGBUAseparate16bittile)
|
1636
|
+
{
|
1637
|
+
uint16 *wr = (uint16*) r;
|
1638
|
+
uint16 *wg = (uint16*) g;
|
1639
|
+
uint16 *wb = (uint16*) b;
|
1640
|
+
uint16 *wa = (uint16*) a;
|
1641
|
+
(void) img; (void) y;
|
1642
|
+
while (h-- > 0) {
|
1643
|
+
uint32 r,g,b,a;
|
1644
|
+
uint8* m;
|
1645
|
+
for (x = w; x-- > 0;) {
|
1646
|
+
a = img->Bitdepth16To8[*wa++];
|
1647
|
+
m = img->UaToAa+(a<<8);
|
1648
|
+
r = m[img->Bitdepth16To8[*wr++]];
|
1649
|
+
g = m[img->Bitdepth16To8[*wg++]];
|
1650
|
+
b = m[img->Bitdepth16To8[*wb++]];
|
1651
|
+
*cp++ = PACK4(r,g,b,a);
|
1652
|
+
}
|
1653
|
+
SKEW4(wr, wg, wb, wa, fromskew);
|
1654
|
+
cp += toskew;
|
1655
|
+
}
|
1656
|
+
}
|
1657
|
+
|
1658
|
+
/*
|
1659
|
+
* 8-bit packed CIE L*a*b 1976 samples => RGB
|
1660
|
+
*/
|
1661
|
+
DECLAREContigPutFunc(putcontig8bitCIELab)
|
1662
|
+
{
|
1663
|
+
float X, Y, Z;
|
1664
|
+
uint32 r, g, b;
|
1665
|
+
(void) y;
|
1666
|
+
fromskew *= 3;
|
1667
|
+
while (h-- > 0) {
|
1668
|
+
for (x = w; x-- > 0;) {
|
1669
|
+
TIFFCIELabToXYZ(img->cielab,
|
1670
|
+
(unsigned char)pp[0],
|
1671
|
+
(signed char)pp[1],
|
1672
|
+
(signed char)pp[2],
|
1673
|
+
&X, &Y, &Z);
|
1674
|
+
TIFFXYZToRGB(img->cielab, X, Y, Z, &r, &g, &b);
|
1675
|
+
*cp++ = PACK(r, g, b);
|
1676
|
+
pp += 3;
|
1677
|
+
}
|
1678
|
+
cp += toskew;
|
1679
|
+
pp += fromskew;
|
1680
|
+
}
|
1681
|
+
}
|
1682
|
+
|
1683
|
+
/*
|
1684
|
+
* YCbCr -> RGB conversion and packing routines.
|
1685
|
+
*/
|
1686
|
+
|
1687
|
+
#define YCbCrtoRGB(dst, Y) { \
|
1688
|
+
uint32 r, g, b; \
|
1689
|
+
TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b); \
|
1690
|
+
dst = PACK(r, g, b); \
|
1691
|
+
}
|
1692
|
+
|
1693
|
+
/*
|
1694
|
+
* 8-bit packed YCbCr samples => RGB
|
1695
|
+
* This function is generic for different sampling sizes,
|
1696
|
+
* and can handle blocks sizes that aren't multiples of the
|
1697
|
+
* sampling size. However, it is substantially less optimized
|
1698
|
+
* than the specific sampling cases. It is used as a fallback
|
1699
|
+
* for difficult blocks.
|
1700
|
+
*/
|
1701
|
+
#ifdef notdef
|
1702
|
+
static void putcontig8bitYCbCrGenericTile(
|
1703
|
+
TIFFRGBAImage* img,
|
1704
|
+
uint32* cp,
|
1705
|
+
uint32 x, uint32 y,
|
1706
|
+
uint32 w, uint32 h,
|
1707
|
+
int32 fromskew, int32 toskew,
|
1708
|
+
unsigned char* pp,
|
1709
|
+
int h_group,
|
1710
|
+
int v_group )
|
1711
|
+
|
1712
|
+
{
|
1713
|
+
uint32* cp1 = cp+w+toskew;
|
1714
|
+
uint32* cp2 = cp1+w+toskew;
|
1715
|
+
uint32* cp3 = cp2+w+toskew;
|
1716
|
+
int32 incr = 3*w+4*toskew;
|
1717
|
+
int32 Cb, Cr;
|
1718
|
+
int group_size = v_group * h_group + 2;
|
1719
|
+
|
1720
|
+
(void) y;
|
1721
|
+
fromskew = (fromskew * group_size) / h_group;
|
1722
|
+
|
1723
|
+
for( yy = 0; yy < h; yy++ )
|
1724
|
+
{
|
1725
|
+
unsigned char *pp_line;
|
1726
|
+
int y_line_group = yy / v_group;
|
1727
|
+
int y_remainder = yy - y_line_group * v_group;
|
1728
|
+
|
1729
|
+
pp_line = pp + v_line_group *
|
1730
|
+
|
1731
|
+
|
1732
|
+
for( xx = 0; xx < w; xx++ )
|
1733
|
+
{
|
1734
|
+
Cb = pp
|
1735
|
+
}
|
1736
|
+
}
|
1737
|
+
for (; h >= 4; h -= 4) {
|
1738
|
+
x = w>>2;
|
1739
|
+
do {
|
1740
|
+
Cb = pp[16];
|
1741
|
+
Cr = pp[17];
|
1742
|
+
|
1743
|
+
YCbCrtoRGB(cp [0], pp[ 0]);
|
1744
|
+
YCbCrtoRGB(cp [1], pp[ 1]);
|
1745
|
+
YCbCrtoRGB(cp [2], pp[ 2]);
|
1746
|
+
YCbCrtoRGB(cp [3], pp[ 3]);
|
1747
|
+
YCbCrtoRGB(cp1[0], pp[ 4]);
|
1748
|
+
YCbCrtoRGB(cp1[1], pp[ 5]);
|
1749
|
+
YCbCrtoRGB(cp1[2], pp[ 6]);
|
1750
|
+
YCbCrtoRGB(cp1[3], pp[ 7]);
|
1751
|
+
YCbCrtoRGB(cp2[0], pp[ 8]);
|
1752
|
+
YCbCrtoRGB(cp2[1], pp[ 9]);
|
1753
|
+
YCbCrtoRGB(cp2[2], pp[10]);
|
1754
|
+
YCbCrtoRGB(cp2[3], pp[11]);
|
1755
|
+
YCbCrtoRGB(cp3[0], pp[12]);
|
1756
|
+
YCbCrtoRGB(cp3[1], pp[13]);
|
1757
|
+
YCbCrtoRGB(cp3[2], pp[14]);
|
1758
|
+
YCbCrtoRGB(cp3[3], pp[15]);
|
1759
|
+
|
1760
|
+
cp += 4, cp1 += 4, cp2 += 4, cp3 += 4;
|
1761
|
+
pp += 18;
|
1762
|
+
} while (--x);
|
1763
|
+
cp += incr, cp1 += incr, cp2 += incr, cp3 += incr;
|
1764
|
+
pp += fromskew;
|
1765
|
+
}
|
1766
|
+
}
|
1767
|
+
#endif
|
1768
|
+
|
1769
|
+
/*
|
1770
|
+
* 8-bit packed YCbCr samples w/ 4,4 subsampling => RGB
|
1771
|
+
*/
|
1772
|
+
DECLAREContigPutFunc(putcontig8bitYCbCr44tile)
|
1773
|
+
{
|
1774
|
+
uint32* cp1 = cp+w+toskew;
|
1775
|
+
uint32* cp2 = cp1+w+toskew;
|
1776
|
+
uint32* cp3 = cp2+w+toskew;
|
1777
|
+
int32 incr = 3*w+4*toskew;
|
1778
|
+
|
1779
|
+
(void) y;
|
1780
|
+
/* adjust fromskew */
|
1781
|
+
fromskew = (fromskew * 18) / 4;
|
1782
|
+
if ((h & 3) == 0 && (w & 3) == 0) {
|
1783
|
+
for (; h >= 4; h -= 4) {
|
1784
|
+
x = w>>2;
|
1785
|
+
do {
|
1786
|
+
int32 Cb = pp[16];
|
1787
|
+
int32 Cr = pp[17];
|
1788
|
+
|
1789
|
+
YCbCrtoRGB(cp [0], pp[ 0]);
|
1790
|
+
YCbCrtoRGB(cp [1], pp[ 1]);
|
1791
|
+
YCbCrtoRGB(cp [2], pp[ 2]);
|
1792
|
+
YCbCrtoRGB(cp [3], pp[ 3]);
|
1793
|
+
YCbCrtoRGB(cp1[0], pp[ 4]);
|
1794
|
+
YCbCrtoRGB(cp1[1], pp[ 5]);
|
1795
|
+
YCbCrtoRGB(cp1[2], pp[ 6]);
|
1796
|
+
YCbCrtoRGB(cp1[3], pp[ 7]);
|
1797
|
+
YCbCrtoRGB(cp2[0], pp[ 8]);
|
1798
|
+
YCbCrtoRGB(cp2[1], pp[ 9]);
|
1799
|
+
YCbCrtoRGB(cp2[2], pp[10]);
|
1800
|
+
YCbCrtoRGB(cp2[3], pp[11]);
|
1801
|
+
YCbCrtoRGB(cp3[0], pp[12]);
|
1802
|
+
YCbCrtoRGB(cp3[1], pp[13]);
|
1803
|
+
YCbCrtoRGB(cp3[2], pp[14]);
|
1804
|
+
YCbCrtoRGB(cp3[3], pp[15]);
|
1805
|
+
|
1806
|
+
cp += 4, cp1 += 4, cp2 += 4, cp3 += 4;
|
1807
|
+
pp += 18;
|
1808
|
+
} while (--x);
|
1809
|
+
cp += incr, cp1 += incr, cp2 += incr, cp3 += incr;
|
1810
|
+
pp += fromskew;
|
1811
|
+
}
|
1812
|
+
} else {
|
1813
|
+
while (h > 0) {
|
1814
|
+
for (x = w; x > 0;) {
|
1815
|
+
int32 Cb = pp[16];
|
1816
|
+
int32 Cr = pp[17];
|
1817
|
+
switch (x) {
|
1818
|
+
default:
|
1819
|
+
switch (h) {
|
1820
|
+
default: YCbCrtoRGB(cp3[3], pp[15]); /* FALLTHROUGH */
|
1821
|
+
case 3: YCbCrtoRGB(cp2[3], pp[11]); /* FALLTHROUGH */
|
1822
|
+
case 2: YCbCrtoRGB(cp1[3], pp[ 7]); /* FALLTHROUGH */
|
1823
|
+
case 1: YCbCrtoRGB(cp [3], pp[ 3]); /* FALLTHROUGH */
|
1824
|
+
} /* FALLTHROUGH */
|
1825
|
+
case 3:
|
1826
|
+
switch (h) {
|
1827
|
+
default: YCbCrtoRGB(cp3[2], pp[14]); /* FALLTHROUGH */
|
1828
|
+
case 3: YCbCrtoRGB(cp2[2], pp[10]); /* FALLTHROUGH */
|
1829
|
+
case 2: YCbCrtoRGB(cp1[2], pp[ 6]); /* FALLTHROUGH */
|
1830
|
+
case 1: YCbCrtoRGB(cp [2], pp[ 2]); /* FALLTHROUGH */
|
1831
|
+
} /* FALLTHROUGH */
|
1832
|
+
case 2:
|
1833
|
+
switch (h) {
|
1834
|
+
default: YCbCrtoRGB(cp3[1], pp[13]); /* FALLTHROUGH */
|
1835
|
+
case 3: YCbCrtoRGB(cp2[1], pp[ 9]); /* FALLTHROUGH */
|
1836
|
+
case 2: YCbCrtoRGB(cp1[1], pp[ 5]); /* FALLTHROUGH */
|
1837
|
+
case 1: YCbCrtoRGB(cp [1], pp[ 1]); /* FALLTHROUGH */
|
1838
|
+
} /* FALLTHROUGH */
|
1839
|
+
case 1:
|
1840
|
+
switch (h) {
|
1841
|
+
default: YCbCrtoRGB(cp3[0], pp[12]); /* FALLTHROUGH */
|
1842
|
+
case 3: YCbCrtoRGB(cp2[0], pp[ 8]); /* FALLTHROUGH */
|
1843
|
+
case 2: YCbCrtoRGB(cp1[0], pp[ 4]); /* FALLTHROUGH */
|
1844
|
+
case 1: YCbCrtoRGB(cp [0], pp[ 0]); /* FALLTHROUGH */
|
1845
|
+
} /* FALLTHROUGH */
|
1846
|
+
}
|
1847
|
+
if (x < 4) {
|
1848
|
+
cp += x; cp1 += x; cp2 += x; cp3 += x;
|
1849
|
+
x = 0;
|
1850
|
+
}
|
1851
|
+
else {
|
1852
|
+
cp += 4; cp1 += 4; cp2 += 4; cp3 += 4;
|
1853
|
+
x -= 4;
|
1854
|
+
}
|
1855
|
+
pp += 18;
|
1856
|
+
}
|
1857
|
+
if (h <= 4)
|
1858
|
+
break;
|
1859
|
+
h -= 4;
|
1860
|
+
cp += incr, cp1 += incr, cp2 += incr, cp3 += incr;
|
1861
|
+
pp += fromskew;
|
1862
|
+
}
|
1863
|
+
}
|
1864
|
+
}
|
1865
|
+
|
1866
|
+
/*
|
1867
|
+
* 8-bit packed YCbCr samples w/ 4,2 subsampling => RGB
|
1868
|
+
*/
|
1869
|
+
DECLAREContigPutFunc(putcontig8bitYCbCr42tile)
|
1870
|
+
{
|
1871
|
+
uint32* cp1 = cp+w+toskew;
|
1872
|
+
int32 incr = 2*toskew+w;
|
1873
|
+
|
1874
|
+
(void) y;
|
1875
|
+
fromskew = (fromskew * 10) / 4;
|
1876
|
+
if ((w & 3) == 0 && (h & 1) == 0) {
|
1877
|
+
for (; h >= 2; h -= 2) {
|
1878
|
+
x = w>>2;
|
1879
|
+
do {
|
1880
|
+
int32 Cb = pp[8];
|
1881
|
+
int32 Cr = pp[9];
|
1882
|
+
|
1883
|
+
YCbCrtoRGB(cp [0], pp[0]);
|
1884
|
+
YCbCrtoRGB(cp [1], pp[1]);
|
1885
|
+
YCbCrtoRGB(cp [2], pp[2]);
|
1886
|
+
YCbCrtoRGB(cp [3], pp[3]);
|
1887
|
+
YCbCrtoRGB(cp1[0], pp[4]);
|
1888
|
+
YCbCrtoRGB(cp1[1], pp[5]);
|
1889
|
+
YCbCrtoRGB(cp1[2], pp[6]);
|
1890
|
+
YCbCrtoRGB(cp1[3], pp[7]);
|
1891
|
+
|
1892
|
+
cp += 4, cp1 += 4;
|
1893
|
+
pp += 10;
|
1894
|
+
} while (--x);
|
1895
|
+
cp += incr, cp1 += incr;
|
1896
|
+
pp += fromskew;
|
1897
|
+
}
|
1898
|
+
} else {
|
1899
|
+
while (h > 0) {
|
1900
|
+
for (x = w; x > 0;) {
|
1901
|
+
int32 Cb = pp[8];
|
1902
|
+
int32 Cr = pp[9];
|
1903
|
+
switch (x) {
|
1904
|
+
default:
|
1905
|
+
switch (h) {
|
1906
|
+
default: YCbCrtoRGB(cp1[3], pp[ 7]); /* FALLTHROUGH */
|
1907
|
+
case 1: YCbCrtoRGB(cp [3], pp[ 3]); /* FALLTHROUGH */
|
1908
|
+
} /* FALLTHROUGH */
|
1909
|
+
case 3:
|
1910
|
+
switch (h) {
|
1911
|
+
default: YCbCrtoRGB(cp1[2], pp[ 6]); /* FALLTHROUGH */
|
1912
|
+
case 1: YCbCrtoRGB(cp [2], pp[ 2]); /* FALLTHROUGH */
|
1913
|
+
} /* FALLTHROUGH */
|
1914
|
+
case 2:
|
1915
|
+
switch (h) {
|
1916
|
+
default: YCbCrtoRGB(cp1[1], pp[ 5]); /* FALLTHROUGH */
|
1917
|
+
case 1: YCbCrtoRGB(cp [1], pp[ 1]); /* FALLTHROUGH */
|
1918
|
+
} /* FALLTHROUGH */
|
1919
|
+
case 1:
|
1920
|
+
switch (h) {
|
1921
|
+
default: YCbCrtoRGB(cp1[0], pp[ 4]); /* FALLTHROUGH */
|
1922
|
+
case 1: YCbCrtoRGB(cp [0], pp[ 0]); /* FALLTHROUGH */
|
1923
|
+
} /* FALLTHROUGH */
|
1924
|
+
}
|
1925
|
+
if (x < 4) {
|
1926
|
+
cp += x; cp1 += x;
|
1927
|
+
x = 0;
|
1928
|
+
}
|
1929
|
+
else {
|
1930
|
+
cp += 4; cp1 += 4;
|
1931
|
+
x -= 4;
|
1932
|
+
}
|
1933
|
+
pp += 10;
|
1934
|
+
}
|
1935
|
+
if (h <= 2)
|
1936
|
+
break;
|
1937
|
+
h -= 2;
|
1938
|
+
cp += incr, cp1 += incr;
|
1939
|
+
pp += fromskew;
|
1940
|
+
}
|
1941
|
+
}
|
1942
|
+
}
|
1943
|
+
|
1944
|
+
/*
|
1945
|
+
* 8-bit packed YCbCr samples w/ 4,1 subsampling => RGB
|
1946
|
+
*/
|
1947
|
+
DECLAREContigPutFunc(putcontig8bitYCbCr41tile)
|
1948
|
+
{
|
1949
|
+
(void) y;
|
1950
|
+
/* XXX adjust fromskew */
|
1951
|
+
do {
|
1952
|
+
x = w>>2;
|
1953
|
+
while(x>0) {
|
1954
|
+
int32 Cb = pp[4];
|
1955
|
+
int32 Cr = pp[5];
|
1956
|
+
|
1957
|
+
YCbCrtoRGB(cp [0], pp[0]);
|
1958
|
+
YCbCrtoRGB(cp [1], pp[1]);
|
1959
|
+
YCbCrtoRGB(cp [2], pp[2]);
|
1960
|
+
YCbCrtoRGB(cp [3], pp[3]);
|
1961
|
+
|
1962
|
+
cp += 4;
|
1963
|
+
pp += 6;
|
1964
|
+
x--;
|
1965
|
+
}
|
1966
|
+
|
1967
|
+
if( (w&3) != 0 )
|
1968
|
+
{
|
1969
|
+
int32 Cb = pp[4];
|
1970
|
+
int32 Cr = pp[5];
|
1971
|
+
|
1972
|
+
switch( (w&3) ) {
|
1973
|
+
case 3: YCbCrtoRGB(cp [2], pp[2]);
|
1974
|
+
case 2: YCbCrtoRGB(cp [1], pp[1]);
|
1975
|
+
case 1: YCbCrtoRGB(cp [0], pp[0]);
|
1976
|
+
case 0: break;
|
1977
|
+
}
|
1978
|
+
|
1979
|
+
cp += (w&3);
|
1980
|
+
pp += 6;
|
1981
|
+
}
|
1982
|
+
|
1983
|
+
cp += toskew;
|
1984
|
+
pp += fromskew;
|
1985
|
+
} while (--h);
|
1986
|
+
|
1987
|
+
}
|
1988
|
+
|
1989
|
+
/*
|
1990
|
+
* 8-bit packed YCbCr samples w/ 2,2 subsampling => RGB
|
1991
|
+
*/
|
1992
|
+
DECLAREContigPutFunc(putcontig8bitYCbCr22tile)
|
1993
|
+
{
|
1994
|
+
uint32* cp2;
|
1995
|
+
int32 incr = 2*toskew+w;
|
1996
|
+
(void) y;
|
1997
|
+
fromskew = (fromskew / 2) * 6;
|
1998
|
+
cp2 = cp+w+toskew;
|
1999
|
+
while (h>=2) {
|
2000
|
+
x = w;
|
2001
|
+
while (x>=2) {
|
2002
|
+
uint32 Cb = pp[4];
|
2003
|
+
uint32 Cr = pp[5];
|
2004
|
+
YCbCrtoRGB(cp[0], pp[0]);
|
2005
|
+
YCbCrtoRGB(cp[1], pp[1]);
|
2006
|
+
YCbCrtoRGB(cp2[0], pp[2]);
|
2007
|
+
YCbCrtoRGB(cp2[1], pp[3]);
|
2008
|
+
cp += 2;
|
2009
|
+
cp2 += 2;
|
2010
|
+
pp += 6;
|
2011
|
+
x -= 2;
|
2012
|
+
}
|
2013
|
+
if (x==1) {
|
2014
|
+
uint32 Cb = pp[4];
|
2015
|
+
uint32 Cr = pp[5];
|
2016
|
+
YCbCrtoRGB(cp[0], pp[0]);
|
2017
|
+
YCbCrtoRGB(cp2[0], pp[2]);
|
2018
|
+
cp ++ ;
|
2019
|
+
cp2 ++ ;
|
2020
|
+
pp += 6;
|
2021
|
+
}
|
2022
|
+
cp += incr;
|
2023
|
+
cp2 += incr;
|
2024
|
+
pp += fromskew;
|
2025
|
+
h-=2;
|
2026
|
+
}
|
2027
|
+
if (h==1) {
|
2028
|
+
x = w;
|
2029
|
+
while (x>=2) {
|
2030
|
+
uint32 Cb = pp[4];
|
2031
|
+
uint32 Cr = pp[5];
|
2032
|
+
YCbCrtoRGB(cp[0], pp[0]);
|
2033
|
+
YCbCrtoRGB(cp[1], pp[1]);
|
2034
|
+
cp += 2;
|
2035
|
+
cp2 += 2;
|
2036
|
+
pp += 6;
|
2037
|
+
x -= 2;
|
2038
|
+
}
|
2039
|
+
if (x==1) {
|
2040
|
+
uint32 Cb = pp[4];
|
2041
|
+
uint32 Cr = pp[5];
|
2042
|
+
YCbCrtoRGB(cp[0], pp[0]);
|
2043
|
+
}
|
2044
|
+
}
|
2045
|
+
}
|
2046
|
+
|
2047
|
+
/*
|
2048
|
+
* 8-bit packed YCbCr samples w/ 2,1 subsampling => RGB
|
2049
|
+
*/
|
2050
|
+
DECLAREContigPutFunc(putcontig8bitYCbCr21tile)
|
2051
|
+
{
|
2052
|
+
(void) y;
|
2053
|
+
fromskew = (fromskew * 4) / 2;
|
2054
|
+
do {
|
2055
|
+
x = w>>1;
|
2056
|
+
while(x>0) {
|
2057
|
+
int32 Cb = pp[2];
|
2058
|
+
int32 Cr = pp[3];
|
2059
|
+
|
2060
|
+
YCbCrtoRGB(cp[0], pp[0]);
|
2061
|
+
YCbCrtoRGB(cp[1], pp[1]);
|
2062
|
+
|
2063
|
+
cp += 2;
|
2064
|
+
pp += 4;
|
2065
|
+
x --;
|
2066
|
+
}
|
2067
|
+
|
2068
|
+
if( (w&1) != 0 )
|
2069
|
+
{
|
2070
|
+
int32 Cb = pp[2];
|
2071
|
+
int32 Cr = pp[3];
|
2072
|
+
|
2073
|
+
YCbCrtoRGB(cp[0], pp[0]);
|
2074
|
+
|
2075
|
+
cp += 1;
|
2076
|
+
pp += 4;
|
2077
|
+
}
|
2078
|
+
|
2079
|
+
cp += toskew;
|
2080
|
+
pp += fromskew;
|
2081
|
+
} while (--h);
|
2082
|
+
}
|
2083
|
+
|
2084
|
+
/*
|
2085
|
+
* 8-bit packed YCbCr samples w/ 1,2 subsampling => RGB
|
2086
|
+
*/
|
2087
|
+
DECLAREContigPutFunc(putcontig8bitYCbCr12tile)
|
2088
|
+
{
|
2089
|
+
uint32* cp2;
|
2090
|
+
int32 incr = 2*toskew+w;
|
2091
|
+
(void) y;
|
2092
|
+
fromskew = (fromskew / 2) * 4;
|
2093
|
+
cp2 = cp+w+toskew;
|
2094
|
+
while (h>=2) {
|
2095
|
+
x = w;
|
2096
|
+
do {
|
2097
|
+
uint32 Cb = pp[2];
|
2098
|
+
uint32 Cr = pp[3];
|
2099
|
+
YCbCrtoRGB(cp[0], pp[0]);
|
2100
|
+
YCbCrtoRGB(cp2[0], pp[1]);
|
2101
|
+
cp ++;
|
2102
|
+
cp2 ++;
|
2103
|
+
pp += 4;
|
2104
|
+
} while (--x);
|
2105
|
+
cp += incr;
|
2106
|
+
cp2 += incr;
|
2107
|
+
pp += fromskew;
|
2108
|
+
h-=2;
|
2109
|
+
}
|
2110
|
+
if (h==1) {
|
2111
|
+
x = w;
|
2112
|
+
do {
|
2113
|
+
uint32 Cb = pp[2];
|
2114
|
+
uint32 Cr = pp[3];
|
2115
|
+
YCbCrtoRGB(cp[0], pp[0]);
|
2116
|
+
cp ++;
|
2117
|
+
pp += 4;
|
2118
|
+
} while (--x);
|
2119
|
+
}
|
2120
|
+
}
|
2121
|
+
|
2122
|
+
/*
|
2123
|
+
* 8-bit packed YCbCr samples w/ no subsampling => RGB
|
2124
|
+
*/
|
2125
|
+
DECLAREContigPutFunc(putcontig8bitYCbCr11tile)
|
2126
|
+
{
|
2127
|
+
(void) y;
|
2128
|
+
fromskew *= 3;
|
2129
|
+
do {
|
2130
|
+
x = w; /* was x = w>>1; patched 2000/09/25 warmerda@home.com */
|
2131
|
+
do {
|
2132
|
+
int32 Cb = pp[1];
|
2133
|
+
int32 Cr = pp[2];
|
2134
|
+
|
2135
|
+
YCbCrtoRGB(*cp++, pp[0]);
|
2136
|
+
|
2137
|
+
pp += 3;
|
2138
|
+
} while (--x);
|
2139
|
+
cp += toskew;
|
2140
|
+
pp += fromskew;
|
2141
|
+
} while (--h);
|
2142
|
+
}
|
2143
|
+
|
2144
|
+
/*
|
2145
|
+
* 8-bit packed YCbCr samples w/ no subsampling => RGB
|
2146
|
+
*/
|
2147
|
+
DECLARESepPutFunc(putseparate8bitYCbCr11tile)
|
2148
|
+
{
|
2149
|
+
(void) y;
|
2150
|
+
(void) a;
|
2151
|
+
/* TODO: naming of input vars is still off, change obfuscating declaration inside define, or resolve obfuscation */
|
2152
|
+
while (h-- > 0) {
|
2153
|
+
x = w;
|
2154
|
+
do {
|
2155
|
+
uint32 dr, dg, db;
|
2156
|
+
TIFFYCbCrtoRGB(img->ycbcr,*r++,*g++,*b++,&dr,&dg,&db);
|
2157
|
+
*cp++ = PACK(dr,dg,db);
|
2158
|
+
} while (--x);
|
2159
|
+
SKEW(r, g, b, fromskew);
|
2160
|
+
cp += toskew;
|
2161
|
+
}
|
2162
|
+
}
|
2163
|
+
#undef YCbCrtoRGB
|
2164
|
+
|
2165
|
+
static int
|
2166
|
+
initYCbCrConversion(TIFFRGBAImage* img)
|
2167
|
+
{
|
2168
|
+
static const char module[] = "initYCbCrConversion";
|
2169
|
+
|
2170
|
+
float *luma, *refBlackWhite;
|
2171
|
+
|
2172
|
+
if (img->ycbcr == NULL) {
|
2173
|
+
img->ycbcr = (TIFFYCbCrToRGB*) _TIFFmalloc(
|
2174
|
+
TIFFroundup_32(sizeof (TIFFYCbCrToRGB), sizeof (long))
|
2175
|
+
+ 4*256*sizeof (TIFFRGBValue)
|
2176
|
+
+ 2*256*sizeof (int)
|
2177
|
+
+ 3*256*sizeof (int32)
|
2178
|
+
);
|
2179
|
+
if (img->ycbcr == NULL) {
|
2180
|
+
TIFFErrorExt(img->tif->tif_clientdata, module,
|
2181
|
+
"No space for YCbCr->RGB conversion state");
|
2182
|
+
return (0);
|
2183
|
+
}
|
2184
|
+
}
|
2185
|
+
|
2186
|
+
TIFFGetFieldDefaulted(img->tif, TIFFTAG_YCBCRCOEFFICIENTS, &luma);
|
2187
|
+
TIFFGetFieldDefaulted(img->tif, TIFFTAG_REFERENCEBLACKWHITE,
|
2188
|
+
&refBlackWhite);
|
2189
|
+
if (TIFFYCbCrToRGBInit(img->ycbcr, luma, refBlackWhite) < 0)
|
2190
|
+
return(0);
|
2191
|
+
return (1);
|
2192
|
+
}
|
2193
|
+
|
2194
|
+
static tileContigRoutine
|
2195
|
+
initCIELabConversion(TIFFRGBAImage* img)
|
2196
|
+
{
|
2197
|
+
static const char module[] = "initCIELabConversion";
|
2198
|
+
|
2199
|
+
float *whitePoint;
|
2200
|
+
float refWhite[3];
|
2201
|
+
|
2202
|
+
if (!img->cielab) {
|
2203
|
+
img->cielab = (TIFFCIELabToRGB *)
|
2204
|
+
_TIFFmalloc(sizeof(TIFFCIELabToRGB));
|
2205
|
+
if (!img->cielab) {
|
2206
|
+
TIFFErrorExt(img->tif->tif_clientdata, module,
|
2207
|
+
"No space for CIE L*a*b*->RGB conversion state.");
|
2208
|
+
return NULL;
|
2209
|
+
}
|
2210
|
+
}
|
2211
|
+
|
2212
|
+
TIFFGetFieldDefaulted(img->tif, TIFFTAG_WHITEPOINT, &whitePoint);
|
2213
|
+
refWhite[1] = 100.0F;
|
2214
|
+
refWhite[0] = whitePoint[0] / whitePoint[1] * refWhite[1];
|
2215
|
+
refWhite[2] = (1.0F - whitePoint[0] - whitePoint[1])
|
2216
|
+
/ whitePoint[1] * refWhite[1];
|
2217
|
+
if (TIFFCIELabToRGBInit(img->cielab, &display_sRGB, refWhite) < 0) {
|
2218
|
+
TIFFErrorExt(img->tif->tif_clientdata, module,
|
2219
|
+
"Failed to initialize CIE L*a*b*->RGB conversion state.");
|
2220
|
+
_TIFFfree(img->cielab);
|
2221
|
+
return NULL;
|
2222
|
+
}
|
2223
|
+
|
2224
|
+
return putcontig8bitCIELab;
|
2225
|
+
}
|
2226
|
+
|
2227
|
+
/*
|
2228
|
+
* Greyscale images with less than 8 bits/sample are handled
|
2229
|
+
* with a table to avoid lots of shifts and masks. The table
|
2230
|
+
* is setup so that put*bwtile (below) can retrieve 8/bitspersample
|
2231
|
+
* pixel values simply by indexing into the table with one
|
2232
|
+
* number.
|
2233
|
+
*/
|
2234
|
+
static int
|
2235
|
+
makebwmap(TIFFRGBAImage* img)
|
2236
|
+
{
|
2237
|
+
TIFFRGBValue* Map = img->Map;
|
2238
|
+
int bitspersample = img->bitspersample;
|
2239
|
+
int nsamples = 8 / bitspersample;
|
2240
|
+
int i;
|
2241
|
+
uint32* p;
|
2242
|
+
|
2243
|
+
if( nsamples == 0 )
|
2244
|
+
nsamples = 1;
|
2245
|
+
|
2246
|
+
img->BWmap = (uint32**) _TIFFmalloc(
|
2247
|
+
256*sizeof (uint32 *)+(256*nsamples*sizeof(uint32)));
|
2248
|
+
if (img->BWmap == NULL) {
|
2249
|
+
TIFFErrorExt(img->tif->tif_clientdata, TIFFFileName(img->tif), "No space for B&W mapping table");
|
2250
|
+
return (0);
|
2251
|
+
}
|
2252
|
+
p = (uint32*)(img->BWmap + 256);
|
2253
|
+
for (i = 0; i < 256; i++) {
|
2254
|
+
TIFFRGBValue c;
|
2255
|
+
img->BWmap[i] = p;
|
2256
|
+
switch (bitspersample) {
|
2257
|
+
#define GREY(x) c = Map[x]; *p++ = PACK(c,c,c);
|
2258
|
+
case 1:
|
2259
|
+
GREY(i>>7);
|
2260
|
+
GREY((i>>6)&1);
|
2261
|
+
GREY((i>>5)&1);
|
2262
|
+
GREY((i>>4)&1);
|
2263
|
+
GREY((i>>3)&1);
|
2264
|
+
GREY((i>>2)&1);
|
2265
|
+
GREY((i>>1)&1);
|
2266
|
+
GREY(i&1);
|
2267
|
+
break;
|
2268
|
+
case 2:
|
2269
|
+
GREY(i>>6);
|
2270
|
+
GREY((i>>4)&3);
|
2271
|
+
GREY((i>>2)&3);
|
2272
|
+
GREY(i&3);
|
2273
|
+
break;
|
2274
|
+
case 4:
|
2275
|
+
GREY(i>>4);
|
2276
|
+
GREY(i&0xf);
|
2277
|
+
break;
|
2278
|
+
case 8:
|
2279
|
+
case 16:
|
2280
|
+
GREY(i);
|
2281
|
+
break;
|
2282
|
+
}
|
2283
|
+
#undef GREY
|
2284
|
+
}
|
2285
|
+
return (1);
|
2286
|
+
}
|
2287
|
+
|
2288
|
+
/*
|
2289
|
+
* Construct a mapping table to convert from the range
|
2290
|
+
* of the data samples to [0,255] --for display. This
|
2291
|
+
* process also handles inverting B&W images when needed.
|
2292
|
+
*/
|
2293
|
+
static int
|
2294
|
+
setupMap(TIFFRGBAImage* img)
|
2295
|
+
{
|
2296
|
+
int32 x, range;
|
2297
|
+
|
2298
|
+
range = (int32)((1L<<img->bitspersample)-1);
|
2299
|
+
|
2300
|
+
/* treat 16 bit the same as eight bit */
|
2301
|
+
if( img->bitspersample == 16 )
|
2302
|
+
range = (int32) 255;
|
2303
|
+
|
2304
|
+
img->Map = (TIFFRGBValue*) _TIFFmalloc((range+1) * sizeof (TIFFRGBValue));
|
2305
|
+
if (img->Map == NULL) {
|
2306
|
+
TIFFErrorExt(img->tif->tif_clientdata, TIFFFileName(img->tif),
|
2307
|
+
"No space for photometric conversion table");
|
2308
|
+
return (0);
|
2309
|
+
}
|
2310
|
+
if (img->photometric == PHOTOMETRIC_MINISWHITE) {
|
2311
|
+
for (x = 0; x <= range; x++)
|
2312
|
+
img->Map[x] = (TIFFRGBValue) (((range - x) * 255) / range);
|
2313
|
+
} else {
|
2314
|
+
for (x = 0; x <= range; x++)
|
2315
|
+
img->Map[x] = (TIFFRGBValue) ((x * 255) / range);
|
2316
|
+
}
|
2317
|
+
if (img->bitspersample <= 16 &&
|
2318
|
+
(img->photometric == PHOTOMETRIC_MINISBLACK ||
|
2319
|
+
img->photometric == PHOTOMETRIC_MINISWHITE)) {
|
2320
|
+
/*
|
2321
|
+
* Use photometric mapping table to construct
|
2322
|
+
* unpacking tables for samples <= 8 bits.
|
2323
|
+
*/
|
2324
|
+
if (!makebwmap(img))
|
2325
|
+
return (0);
|
2326
|
+
/* no longer need Map, free it */
|
2327
|
+
_TIFFfree(img->Map), img->Map = NULL;
|
2328
|
+
}
|
2329
|
+
return (1);
|
2330
|
+
}
|
2331
|
+
|
2332
|
+
static int
|
2333
|
+
checkcmap(TIFFRGBAImage* img)
|
2334
|
+
{
|
2335
|
+
uint16* r = img->redcmap;
|
2336
|
+
uint16* g = img->greencmap;
|
2337
|
+
uint16* b = img->bluecmap;
|
2338
|
+
long n = 1L<<img->bitspersample;
|
2339
|
+
|
2340
|
+
while (n-- > 0)
|
2341
|
+
if (*r++ >= 256 || *g++ >= 256 || *b++ >= 256)
|
2342
|
+
return (16);
|
2343
|
+
return (8);
|
2344
|
+
}
|
2345
|
+
|
2346
|
+
static void
|
2347
|
+
cvtcmap(TIFFRGBAImage* img)
|
2348
|
+
{
|
2349
|
+
uint16* r = img->redcmap;
|
2350
|
+
uint16* g = img->greencmap;
|
2351
|
+
uint16* b = img->bluecmap;
|
2352
|
+
long i;
|
2353
|
+
|
2354
|
+
for (i = (1L<<img->bitspersample)-1; i >= 0; i--) {
|
2355
|
+
#define CVT(x) ((uint16)((x)>>8))
|
2356
|
+
r[i] = CVT(r[i]);
|
2357
|
+
g[i] = CVT(g[i]);
|
2358
|
+
b[i] = CVT(b[i]);
|
2359
|
+
#undef CVT
|
2360
|
+
}
|
2361
|
+
}
|
2362
|
+
|
2363
|
+
/*
|
2364
|
+
* Palette images with <= 8 bits/sample are handled
|
2365
|
+
* with a table to avoid lots of shifts and masks. The table
|
2366
|
+
* is setup so that put*cmaptile (below) can retrieve 8/bitspersample
|
2367
|
+
* pixel values simply by indexing into the table with one
|
2368
|
+
* number.
|
2369
|
+
*/
|
2370
|
+
static int
|
2371
|
+
makecmap(TIFFRGBAImage* img)
|
2372
|
+
{
|
2373
|
+
int bitspersample = img->bitspersample;
|
2374
|
+
int nsamples = 8 / bitspersample;
|
2375
|
+
uint16* r = img->redcmap;
|
2376
|
+
uint16* g = img->greencmap;
|
2377
|
+
uint16* b = img->bluecmap;
|
2378
|
+
uint32 *p;
|
2379
|
+
int i;
|
2380
|
+
|
2381
|
+
img->PALmap = (uint32**) _TIFFmalloc(
|
2382
|
+
256*sizeof (uint32 *)+(256*nsamples*sizeof(uint32)));
|
2383
|
+
if (img->PALmap == NULL) {
|
2384
|
+
TIFFErrorExt(img->tif->tif_clientdata, TIFFFileName(img->tif), "No space for Palette mapping table");
|
2385
|
+
return (0);
|
2386
|
+
}
|
2387
|
+
p = (uint32*)(img->PALmap + 256);
|
2388
|
+
for (i = 0; i < 256; i++) {
|
2389
|
+
TIFFRGBValue c;
|
2390
|
+
img->PALmap[i] = p;
|
2391
|
+
#define CMAP(x) c = (TIFFRGBValue) x; *p++ = PACK(r[c]&0xff, g[c]&0xff, b[c]&0xff);
|
2392
|
+
switch (bitspersample) {
|
2393
|
+
case 1:
|
2394
|
+
CMAP(i>>7);
|
2395
|
+
CMAP((i>>6)&1);
|
2396
|
+
CMAP((i>>5)&1);
|
2397
|
+
CMAP((i>>4)&1);
|
2398
|
+
CMAP((i>>3)&1);
|
2399
|
+
CMAP((i>>2)&1);
|
2400
|
+
CMAP((i>>1)&1);
|
2401
|
+
CMAP(i&1);
|
2402
|
+
break;
|
2403
|
+
case 2:
|
2404
|
+
CMAP(i>>6);
|
2405
|
+
CMAP((i>>4)&3);
|
2406
|
+
CMAP((i>>2)&3);
|
2407
|
+
CMAP(i&3);
|
2408
|
+
break;
|
2409
|
+
case 4:
|
2410
|
+
CMAP(i>>4);
|
2411
|
+
CMAP(i&0xf);
|
2412
|
+
break;
|
2413
|
+
case 8:
|
2414
|
+
CMAP(i);
|
2415
|
+
break;
|
2416
|
+
}
|
2417
|
+
#undef CMAP
|
2418
|
+
}
|
2419
|
+
return (1);
|
2420
|
+
}
|
2421
|
+
|
2422
|
+
/*
|
2423
|
+
* Construct any mapping table used
|
2424
|
+
* by the associated put routine.
|
2425
|
+
*/
|
2426
|
+
static int
|
2427
|
+
buildMap(TIFFRGBAImage* img)
|
2428
|
+
{
|
2429
|
+
switch (img->photometric) {
|
2430
|
+
case PHOTOMETRIC_RGB:
|
2431
|
+
case PHOTOMETRIC_YCBCR:
|
2432
|
+
case PHOTOMETRIC_SEPARATED:
|
2433
|
+
if (img->bitspersample == 8)
|
2434
|
+
break;
|
2435
|
+
/* fall thru... */
|
2436
|
+
case PHOTOMETRIC_MINISBLACK:
|
2437
|
+
case PHOTOMETRIC_MINISWHITE:
|
2438
|
+
if (!setupMap(img))
|
2439
|
+
return (0);
|
2440
|
+
break;
|
2441
|
+
case PHOTOMETRIC_PALETTE:
|
2442
|
+
/*
|
2443
|
+
* Convert 16-bit colormap to 8-bit (unless it looks
|
2444
|
+
* like an old-style 8-bit colormap).
|
2445
|
+
*/
|
2446
|
+
if (checkcmap(img) == 16)
|
2447
|
+
cvtcmap(img);
|
2448
|
+
else
|
2449
|
+
TIFFWarningExt(img->tif->tif_clientdata, TIFFFileName(img->tif), "Assuming 8-bit colormap");
|
2450
|
+
/*
|
2451
|
+
* Use mapping table and colormap to construct
|
2452
|
+
* unpacking tables for samples < 8 bits.
|
2453
|
+
*/
|
2454
|
+
if (img->bitspersample <= 8 && !makecmap(img))
|
2455
|
+
return (0);
|
2456
|
+
break;
|
2457
|
+
}
|
2458
|
+
return (1);
|
2459
|
+
}
|
2460
|
+
|
2461
|
+
/*
|
2462
|
+
* Select the appropriate conversion routine for packed data.
|
2463
|
+
*/
|
2464
|
+
static int
|
2465
|
+
PickContigCase(TIFFRGBAImage* img)
|
2466
|
+
{
|
2467
|
+
img->get = TIFFIsTiled(img->tif) ? gtTileContig : gtStripContig;
|
2468
|
+
img->put.contig = NULL;
|
2469
|
+
switch (img->photometric) {
|
2470
|
+
case PHOTOMETRIC_RGB:
|
2471
|
+
switch (img->bitspersample) {
|
2472
|
+
case 8:
|
2473
|
+
if (img->alpha == EXTRASAMPLE_ASSOCALPHA)
|
2474
|
+
img->put.contig = putRGBAAcontig8bittile;
|
2475
|
+
else if (img->alpha == EXTRASAMPLE_UNASSALPHA)
|
2476
|
+
{
|
2477
|
+
if (BuildMapUaToAa(img))
|
2478
|
+
img->put.contig = putRGBUAcontig8bittile;
|
2479
|
+
}
|
2480
|
+
else
|
2481
|
+
img->put.contig = putRGBcontig8bittile;
|
2482
|
+
break;
|
2483
|
+
case 16:
|
2484
|
+
if (img->alpha == EXTRASAMPLE_ASSOCALPHA)
|
2485
|
+
{
|
2486
|
+
if (BuildMapBitdepth16To8(img))
|
2487
|
+
img->put.contig = putRGBAAcontig16bittile;
|
2488
|
+
}
|
2489
|
+
else if (img->alpha == EXTRASAMPLE_UNASSALPHA)
|
2490
|
+
{
|
2491
|
+
if (BuildMapBitdepth16To8(img) &&
|
2492
|
+
BuildMapUaToAa(img))
|
2493
|
+
img->put.contig = putRGBUAcontig16bittile;
|
2494
|
+
}
|
2495
|
+
else
|
2496
|
+
{
|
2497
|
+
if (BuildMapBitdepth16To8(img))
|
2498
|
+
img->put.contig = putRGBcontig16bittile;
|
2499
|
+
}
|
2500
|
+
break;
|
2501
|
+
}
|
2502
|
+
break;
|
2503
|
+
case PHOTOMETRIC_SEPARATED:
|
2504
|
+
if (buildMap(img)) {
|
2505
|
+
if (img->bitspersample == 8) {
|
2506
|
+
if (!img->Map)
|
2507
|
+
img->put.contig = putRGBcontig8bitCMYKtile;
|
2508
|
+
else
|
2509
|
+
img->put.contig = putRGBcontig8bitCMYKMaptile;
|
2510
|
+
}
|
2511
|
+
}
|
2512
|
+
break;
|
2513
|
+
case PHOTOMETRIC_PALETTE:
|
2514
|
+
if (buildMap(img)) {
|
2515
|
+
switch (img->bitspersample) {
|
2516
|
+
case 8:
|
2517
|
+
img->put.contig = put8bitcmaptile;
|
2518
|
+
break;
|
2519
|
+
case 4:
|
2520
|
+
img->put.contig = put4bitcmaptile;
|
2521
|
+
break;
|
2522
|
+
case 2:
|
2523
|
+
img->put.contig = put2bitcmaptile;
|
2524
|
+
break;
|
2525
|
+
case 1:
|
2526
|
+
img->put.contig = put1bitcmaptile;
|
2527
|
+
break;
|
2528
|
+
}
|
2529
|
+
}
|
2530
|
+
break;
|
2531
|
+
case PHOTOMETRIC_MINISWHITE:
|
2532
|
+
case PHOTOMETRIC_MINISBLACK:
|
2533
|
+
if (buildMap(img)) {
|
2534
|
+
switch (img->bitspersample) {
|
2535
|
+
case 16:
|
2536
|
+
img->put.contig = put16bitbwtile;
|
2537
|
+
break;
|
2538
|
+
case 8:
|
2539
|
+
if (img->alpha && img->samplesperpixel == 2)
|
2540
|
+
img->put.contig = putagreytile;
|
2541
|
+
else
|
2542
|
+
img->put.contig = putgreytile;
|
2543
|
+
break;
|
2544
|
+
case 4:
|
2545
|
+
img->put.contig = put4bitbwtile;
|
2546
|
+
break;
|
2547
|
+
case 2:
|
2548
|
+
img->put.contig = put2bitbwtile;
|
2549
|
+
break;
|
2550
|
+
case 1:
|
2551
|
+
img->put.contig = put1bitbwtile;
|
2552
|
+
break;
|
2553
|
+
}
|
2554
|
+
}
|
2555
|
+
break;
|
2556
|
+
case PHOTOMETRIC_YCBCR:
|
2557
|
+
if ((img->bitspersample==8) && (img->samplesperpixel==3))
|
2558
|
+
{
|
2559
|
+
if (initYCbCrConversion(img)!=0)
|
2560
|
+
{
|
2561
|
+
/*
|
2562
|
+
* The 6.0 spec says that subsampling must be
|
2563
|
+
* one of 1, 2, or 4, and that vertical subsampling
|
2564
|
+
* must always be <= horizontal subsampling; so
|
2565
|
+
* there are only a few possibilities and we just
|
2566
|
+
* enumerate the cases.
|
2567
|
+
* Joris: added support for the [1,2] case, nonetheless, to accommodate
|
2568
|
+
* some OJPEG files
|
2569
|
+
*/
|
2570
|
+
uint16 SubsamplingHor;
|
2571
|
+
uint16 SubsamplingVer;
|
2572
|
+
TIFFGetFieldDefaulted(img->tif, TIFFTAG_YCBCRSUBSAMPLING, &SubsamplingHor, &SubsamplingVer);
|
2573
|
+
switch ((SubsamplingHor<<4)|SubsamplingVer) {
|
2574
|
+
case 0x44:
|
2575
|
+
img->put.contig = putcontig8bitYCbCr44tile;
|
2576
|
+
break;
|
2577
|
+
case 0x42:
|
2578
|
+
img->put.contig = putcontig8bitYCbCr42tile;
|
2579
|
+
break;
|
2580
|
+
case 0x41:
|
2581
|
+
img->put.contig = putcontig8bitYCbCr41tile;
|
2582
|
+
break;
|
2583
|
+
case 0x22:
|
2584
|
+
img->put.contig = putcontig8bitYCbCr22tile;
|
2585
|
+
break;
|
2586
|
+
case 0x21:
|
2587
|
+
img->put.contig = putcontig8bitYCbCr21tile;
|
2588
|
+
break;
|
2589
|
+
case 0x12:
|
2590
|
+
img->put.contig = putcontig8bitYCbCr12tile;
|
2591
|
+
break;
|
2592
|
+
case 0x11:
|
2593
|
+
img->put.contig = putcontig8bitYCbCr11tile;
|
2594
|
+
break;
|
2595
|
+
}
|
2596
|
+
}
|
2597
|
+
}
|
2598
|
+
break;
|
2599
|
+
case PHOTOMETRIC_CIELAB:
|
2600
|
+
if (buildMap(img)) {
|
2601
|
+
if (img->bitspersample == 8)
|
2602
|
+
img->put.contig = initCIELabConversion(img);
|
2603
|
+
break;
|
2604
|
+
}
|
2605
|
+
}
|
2606
|
+
return ((img->get!=NULL) && (img->put.contig!=NULL));
|
2607
|
+
}
|
2608
|
+
|
2609
|
+
/*
|
2610
|
+
* Select the appropriate conversion routine for unpacked data.
|
2611
|
+
*
|
2612
|
+
* NB: we assume that unpacked single channel data is directed
|
2613
|
+
* to the "packed routines.
|
2614
|
+
*/
|
2615
|
+
static int
|
2616
|
+
PickSeparateCase(TIFFRGBAImage* img)
|
2617
|
+
{
|
2618
|
+
img->get = TIFFIsTiled(img->tif) ? gtTileSeparate : gtStripSeparate;
|
2619
|
+
img->put.separate = NULL;
|
2620
|
+
switch (img->photometric) {
|
2621
|
+
case PHOTOMETRIC_MINISWHITE:
|
2622
|
+
case PHOTOMETRIC_MINISBLACK:
|
2623
|
+
/* greyscale images processed pretty much as RGB by gtTileSeparate */
|
2624
|
+
case PHOTOMETRIC_RGB:
|
2625
|
+
switch (img->bitspersample) {
|
2626
|
+
case 8:
|
2627
|
+
if (img->alpha == EXTRASAMPLE_ASSOCALPHA)
|
2628
|
+
img->put.separate = putRGBAAseparate8bittile;
|
2629
|
+
else if (img->alpha == EXTRASAMPLE_UNASSALPHA)
|
2630
|
+
{
|
2631
|
+
if (BuildMapUaToAa(img))
|
2632
|
+
img->put.separate = putRGBUAseparate8bittile;
|
2633
|
+
}
|
2634
|
+
else
|
2635
|
+
img->put.separate = putRGBseparate8bittile;
|
2636
|
+
break;
|
2637
|
+
case 16:
|
2638
|
+
if (img->alpha == EXTRASAMPLE_ASSOCALPHA)
|
2639
|
+
{
|
2640
|
+
if (BuildMapBitdepth16To8(img))
|
2641
|
+
img->put.separate = putRGBAAseparate16bittile;
|
2642
|
+
}
|
2643
|
+
else if (img->alpha == EXTRASAMPLE_UNASSALPHA)
|
2644
|
+
{
|
2645
|
+
if (BuildMapBitdepth16To8(img) &&
|
2646
|
+
BuildMapUaToAa(img))
|
2647
|
+
img->put.separate = putRGBUAseparate16bittile;
|
2648
|
+
}
|
2649
|
+
else
|
2650
|
+
{
|
2651
|
+
if (BuildMapBitdepth16To8(img))
|
2652
|
+
img->put.separate = putRGBseparate16bittile;
|
2653
|
+
}
|
2654
|
+
break;
|
2655
|
+
}
|
2656
|
+
break;
|
2657
|
+
case PHOTOMETRIC_SEPARATED:
|
2658
|
+
if (img->bitspersample == 8 && img->samplesperpixel == 4)
|
2659
|
+
{
|
2660
|
+
img->alpha = 1; // Not alpha, but seems like the only way to get 4th band
|
2661
|
+
img->put.separate = putCMYKseparate8bittile;
|
2662
|
+
}
|
2663
|
+
break;
|
2664
|
+
case PHOTOMETRIC_YCBCR:
|
2665
|
+
if ((img->bitspersample==8) && (img->samplesperpixel==3))
|
2666
|
+
{
|
2667
|
+
if (initYCbCrConversion(img)!=0)
|
2668
|
+
{
|
2669
|
+
uint16 hs, vs;
|
2670
|
+
TIFFGetFieldDefaulted(img->tif, TIFFTAG_YCBCRSUBSAMPLING, &hs, &vs);
|
2671
|
+
switch ((hs<<4)|vs) {
|
2672
|
+
case 0x11:
|
2673
|
+
img->put.separate = putseparate8bitYCbCr11tile;
|
2674
|
+
break;
|
2675
|
+
/* TODO: add other cases here */
|
2676
|
+
}
|
2677
|
+
}
|
2678
|
+
}
|
2679
|
+
break;
|
2680
|
+
}
|
2681
|
+
return ((img->get!=NULL) && (img->put.separate!=NULL));
|
2682
|
+
}
|
2683
|
+
|
2684
|
+
static int
|
2685
|
+
BuildMapUaToAa(TIFFRGBAImage* img)
|
2686
|
+
{
|
2687
|
+
static const char module[]="BuildMapUaToAa";
|
2688
|
+
uint8* m;
|
2689
|
+
uint16 na,nv;
|
2690
|
+
assert(img->UaToAa==NULL);
|
2691
|
+
img->UaToAa=_TIFFmalloc(65536);
|
2692
|
+
if (img->UaToAa==NULL)
|
2693
|
+
{
|
2694
|
+
TIFFErrorExt(img->tif->tif_clientdata,module,"Out of memory");
|
2695
|
+
return(0);
|
2696
|
+
}
|
2697
|
+
m=img->UaToAa;
|
2698
|
+
for (na=0; na<256; na++)
|
2699
|
+
{
|
2700
|
+
for (nv=0; nv<256; nv++)
|
2701
|
+
*m++=(nv*na+127)/255;
|
2702
|
+
}
|
2703
|
+
return(1);
|
2704
|
+
}
|
2705
|
+
|
2706
|
+
static int
|
2707
|
+
BuildMapBitdepth16To8(TIFFRGBAImage* img)
|
2708
|
+
{
|
2709
|
+
static const char module[]="BuildMapBitdepth16To8";
|
2710
|
+
uint8* m;
|
2711
|
+
uint32 n;
|
2712
|
+
assert(img->Bitdepth16To8==NULL);
|
2713
|
+
img->Bitdepth16To8=_TIFFmalloc(65536);
|
2714
|
+
if (img->Bitdepth16To8==NULL)
|
2715
|
+
{
|
2716
|
+
TIFFErrorExt(img->tif->tif_clientdata,module,"Out of memory");
|
2717
|
+
return(0);
|
2718
|
+
}
|
2719
|
+
m=img->Bitdepth16To8;
|
2720
|
+
for (n=0; n<65536; n++)
|
2721
|
+
*m++=(n+128)/257;
|
2722
|
+
return(1);
|
2723
|
+
}
|
2724
|
+
|
2725
|
+
|
2726
|
+
/*
|
2727
|
+
* Read a whole strip off data from the file, and convert to RGBA form.
|
2728
|
+
* If this is the last strip, then it will only contain the portion of
|
2729
|
+
* the strip that is actually within the image space. The result is
|
2730
|
+
* organized in bottom to top form.
|
2731
|
+
*/
|
2732
|
+
|
2733
|
+
|
2734
|
+
int
|
2735
|
+
TIFFReadRGBAStrip(TIFF* tif, uint32 row, uint32 * raster )
|
2736
|
+
|
2737
|
+
{
|
2738
|
+
char emsg[1024] = "";
|
2739
|
+
TIFFRGBAImage img;
|
2740
|
+
int ok;
|
2741
|
+
uint32 rowsperstrip, rows_to_read;
|
2742
|
+
|
2743
|
+
if( TIFFIsTiled( tif ) )
|
2744
|
+
{
|
2745
|
+
TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif),
|
2746
|
+
"Can't use TIFFReadRGBAStrip() with tiled file.");
|
2747
|
+
return (0);
|
2748
|
+
}
|
2749
|
+
|
2750
|
+
TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
|
2751
|
+
if( (row % rowsperstrip) != 0 )
|
2752
|
+
{
|
2753
|
+
TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif),
|
2754
|
+
"Row passed to TIFFReadRGBAStrip() must be first in a strip.");
|
2755
|
+
return (0);
|
2756
|
+
}
|
2757
|
+
|
2758
|
+
if (TIFFRGBAImageOK(tif, emsg) && TIFFRGBAImageBegin(&img, tif, 0, emsg)) {
|
2759
|
+
|
2760
|
+
img.row_offset = row;
|
2761
|
+
img.col_offset = 0;
|
2762
|
+
|
2763
|
+
if( row + rowsperstrip > img.height )
|
2764
|
+
rows_to_read = img.height - row;
|
2765
|
+
else
|
2766
|
+
rows_to_read = rowsperstrip;
|
2767
|
+
|
2768
|
+
ok = TIFFRGBAImageGet(&img, raster, img.width, rows_to_read );
|
2769
|
+
|
2770
|
+
TIFFRGBAImageEnd(&img);
|
2771
|
+
} else {
|
2772
|
+
TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "%s", emsg);
|
2773
|
+
ok = 0;
|
2774
|
+
}
|
2775
|
+
|
2776
|
+
return (ok);
|
2777
|
+
}
|
2778
|
+
|
2779
|
+
/*
|
2780
|
+
* Read a whole tile off data from the file, and convert to RGBA form.
|
2781
|
+
* The returned RGBA data is organized from bottom to top of tile,
|
2782
|
+
* and may include zeroed areas if the tile extends off the image.
|
2783
|
+
*/
|
2784
|
+
|
2785
|
+
int
|
2786
|
+
TIFFReadRGBATile(TIFF* tif, uint32 col, uint32 row, uint32 * raster)
|
2787
|
+
|
2788
|
+
{
|
2789
|
+
char emsg[1024] = "";
|
2790
|
+
TIFFRGBAImage img;
|
2791
|
+
int ok;
|
2792
|
+
uint32 tile_xsize, tile_ysize;
|
2793
|
+
uint32 read_xsize, read_ysize;
|
2794
|
+
uint32 i_row;
|
2795
|
+
|
2796
|
+
/*
|
2797
|
+
* Verify that our request is legal - on a tile file, and on a
|
2798
|
+
* tile boundary.
|
2799
|
+
*/
|
2800
|
+
|
2801
|
+
if( !TIFFIsTiled( tif ) )
|
2802
|
+
{
|
2803
|
+
TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif),
|
2804
|
+
"Can't use TIFFReadRGBATile() with stripped file.");
|
2805
|
+
return (0);
|
2806
|
+
}
|
2807
|
+
|
2808
|
+
TIFFGetFieldDefaulted(tif, TIFFTAG_TILEWIDTH, &tile_xsize);
|
2809
|
+
TIFFGetFieldDefaulted(tif, TIFFTAG_TILELENGTH, &tile_ysize);
|
2810
|
+
if( (col % tile_xsize) != 0 || (row % tile_ysize) != 0 )
|
2811
|
+
{
|
2812
|
+
TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif),
|
2813
|
+
"Row/col passed to TIFFReadRGBATile() must be top"
|
2814
|
+
"left corner of a tile.");
|
2815
|
+
return (0);
|
2816
|
+
}
|
2817
|
+
|
2818
|
+
/*
|
2819
|
+
* Setup the RGBA reader.
|
2820
|
+
*/
|
2821
|
+
|
2822
|
+
if (!TIFFRGBAImageOK(tif, emsg)
|
2823
|
+
|| !TIFFRGBAImageBegin(&img, tif, 0, emsg)) {
|
2824
|
+
TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "%s", emsg);
|
2825
|
+
return( 0 );
|
2826
|
+
}
|
2827
|
+
|
2828
|
+
/*
|
2829
|
+
* The TIFFRGBAImageGet() function doesn't allow us to get off the
|
2830
|
+
* edge of the image, even to fill an otherwise valid tile. So we
|
2831
|
+
* figure out how much we can read, and fix up the tile buffer to
|
2832
|
+
* a full tile configuration afterwards.
|
2833
|
+
*/
|
2834
|
+
|
2835
|
+
if( row + tile_ysize > img.height )
|
2836
|
+
read_ysize = img.height - row;
|
2837
|
+
else
|
2838
|
+
read_ysize = tile_ysize;
|
2839
|
+
|
2840
|
+
if( col + tile_xsize > img.width )
|
2841
|
+
read_xsize = img.width - col;
|
2842
|
+
else
|
2843
|
+
read_xsize = tile_xsize;
|
2844
|
+
|
2845
|
+
/*
|
2846
|
+
* Read the chunk of imagery.
|
2847
|
+
*/
|
2848
|
+
|
2849
|
+
img.row_offset = row;
|
2850
|
+
img.col_offset = col;
|
2851
|
+
|
2852
|
+
ok = TIFFRGBAImageGet(&img, raster, read_xsize, read_ysize );
|
2853
|
+
|
2854
|
+
TIFFRGBAImageEnd(&img);
|
2855
|
+
|
2856
|
+
/*
|
2857
|
+
* If our read was incomplete we will need to fix up the tile by
|
2858
|
+
* shifting the data around as if a full tile of data is being returned.
|
2859
|
+
*
|
2860
|
+
* This is all the more complicated because the image is organized in
|
2861
|
+
* bottom to top format.
|
2862
|
+
*/
|
2863
|
+
|
2864
|
+
if( read_xsize == tile_xsize && read_ysize == tile_ysize )
|
2865
|
+
return( ok );
|
2866
|
+
|
2867
|
+
for( i_row = 0; i_row < read_ysize; i_row++ ) {
|
2868
|
+
memmove( raster + (tile_ysize - i_row - 1) * tile_xsize,
|
2869
|
+
raster + (read_ysize - i_row - 1) * read_xsize,
|
2870
|
+
read_xsize * sizeof(uint32) );
|
2871
|
+
_TIFFmemset( raster + (tile_ysize - i_row - 1) * tile_xsize+read_xsize,
|
2872
|
+
0, sizeof(uint32) * (tile_xsize - read_xsize) );
|
2873
|
+
}
|
2874
|
+
|
2875
|
+
for( i_row = read_ysize; i_row < tile_ysize; i_row++ ) {
|
2876
|
+
_TIFFmemset( raster + (tile_ysize - i_row - 1) * tile_xsize,
|
2877
|
+
0, sizeof(uint32) * tile_xsize );
|
2878
|
+
}
|
2879
|
+
|
2880
|
+
return (ok);
|
2881
|
+
}
|
2882
|
+
|
2883
|
+
/* vim: set ts=8 sts=8 sw=8 noet: */
|
2884
|
+
/*
|
2885
|
+
* Local Variables:
|
2886
|
+
* mode: c
|
2887
|
+
* c-basic-offset: 8
|
2888
|
+
* fill-column: 78
|
2889
|
+
* End:
|
2890
|
+
*/
|