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,1584 @@
|
|
1
|
+
// Copyright 2012 Google Inc. All Rights Reserved.
|
2
|
+
//
|
3
|
+
// Use of this source code is governed by a BSD-style license
|
4
|
+
// that can be found in the COPYING file in the root of the source
|
5
|
+
// tree. An additional intellectual property rights grant can be found
|
6
|
+
// in the file PATENTS. All contributing project authors may
|
7
|
+
// be found in the AUTHORS file in the root of the source tree.
|
8
|
+
// -----------------------------------------------------------------------------
|
9
|
+
//
|
10
|
+
// main entry for the decoder
|
11
|
+
//
|
12
|
+
// Authors: Vikas Arora (vikaas.arora@gmail.com)
|
13
|
+
// Jyrki Alakuijala (jyrki@google.com)
|
14
|
+
|
15
|
+
#include <stdlib.h>
|
16
|
+
|
17
|
+
#include "./alphai.h"
|
18
|
+
#include "./vp8li.h"
|
19
|
+
#include "../dsp/dsp.h"
|
20
|
+
#include "../dsp/lossless.h"
|
21
|
+
#include "../dsp/yuv.h"
|
22
|
+
#include "../utils/huffman.h"
|
23
|
+
#include "../utils/utils.h"
|
24
|
+
|
25
|
+
#define NUM_ARGB_CACHE_ROWS 16
|
26
|
+
|
27
|
+
static const int kCodeLengthLiterals = 16;
|
28
|
+
static const int kCodeLengthRepeatCode = 16;
|
29
|
+
static const int kCodeLengthExtraBits[3] = { 2, 3, 7 };
|
30
|
+
static const int kCodeLengthRepeatOffsets[3] = { 3, 3, 11 };
|
31
|
+
|
32
|
+
// -----------------------------------------------------------------------------
|
33
|
+
// Five Huffman codes are used at each meta code:
|
34
|
+
// 1. green + length prefix codes + color cache codes,
|
35
|
+
// 2. alpha,
|
36
|
+
// 3. red,
|
37
|
+
// 4. blue, and,
|
38
|
+
// 5. distance prefix codes.
|
39
|
+
typedef enum {
|
40
|
+
GREEN = 0,
|
41
|
+
RED = 1,
|
42
|
+
BLUE = 2,
|
43
|
+
ALPHA = 3,
|
44
|
+
DIST = 4
|
45
|
+
} HuffIndex;
|
46
|
+
|
47
|
+
static const uint16_t kAlphabetSize[HUFFMAN_CODES_PER_META_CODE] = {
|
48
|
+
NUM_LITERAL_CODES + NUM_LENGTH_CODES,
|
49
|
+
NUM_LITERAL_CODES, NUM_LITERAL_CODES, NUM_LITERAL_CODES,
|
50
|
+
NUM_DISTANCE_CODES
|
51
|
+
};
|
52
|
+
|
53
|
+
static const uint8_t kLiteralMap[HUFFMAN_CODES_PER_META_CODE] = {
|
54
|
+
0, 1, 1, 1, 0
|
55
|
+
};
|
56
|
+
|
57
|
+
#define NUM_CODE_LENGTH_CODES 19
|
58
|
+
static const uint8_t kCodeLengthCodeOrder[NUM_CODE_LENGTH_CODES] = {
|
59
|
+
17, 18, 0, 1, 2, 3, 4, 5, 16, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
|
60
|
+
};
|
61
|
+
|
62
|
+
#define CODE_TO_PLANE_CODES 120
|
63
|
+
static const uint8_t kCodeToPlane[CODE_TO_PLANE_CODES] = {
|
64
|
+
0x18, 0x07, 0x17, 0x19, 0x28, 0x06, 0x27, 0x29, 0x16, 0x1a,
|
65
|
+
0x26, 0x2a, 0x38, 0x05, 0x37, 0x39, 0x15, 0x1b, 0x36, 0x3a,
|
66
|
+
0x25, 0x2b, 0x48, 0x04, 0x47, 0x49, 0x14, 0x1c, 0x35, 0x3b,
|
67
|
+
0x46, 0x4a, 0x24, 0x2c, 0x58, 0x45, 0x4b, 0x34, 0x3c, 0x03,
|
68
|
+
0x57, 0x59, 0x13, 0x1d, 0x56, 0x5a, 0x23, 0x2d, 0x44, 0x4c,
|
69
|
+
0x55, 0x5b, 0x33, 0x3d, 0x68, 0x02, 0x67, 0x69, 0x12, 0x1e,
|
70
|
+
0x66, 0x6a, 0x22, 0x2e, 0x54, 0x5c, 0x43, 0x4d, 0x65, 0x6b,
|
71
|
+
0x32, 0x3e, 0x78, 0x01, 0x77, 0x79, 0x53, 0x5d, 0x11, 0x1f,
|
72
|
+
0x64, 0x6c, 0x42, 0x4e, 0x76, 0x7a, 0x21, 0x2f, 0x75, 0x7b,
|
73
|
+
0x31, 0x3f, 0x63, 0x6d, 0x52, 0x5e, 0x00, 0x74, 0x7c, 0x41,
|
74
|
+
0x4f, 0x10, 0x20, 0x62, 0x6e, 0x30, 0x73, 0x7d, 0x51, 0x5f,
|
75
|
+
0x40, 0x72, 0x7e, 0x61, 0x6f, 0x50, 0x71, 0x7f, 0x60, 0x70
|
76
|
+
};
|
77
|
+
|
78
|
+
// Memory needed for lookup tables of one Huffman tree group. Red, blue, alpha
|
79
|
+
// and distance alphabets are constant (256 for red, blue and alpha, 40 for
|
80
|
+
// distance) and lookup table sizes for them in worst case are 630 and 410
|
81
|
+
// respectively. Size of green alphabet depends on color cache size and is equal
|
82
|
+
// to 256 (green component values) + 24 (length prefix values)
|
83
|
+
// + color_cache_size (between 0 and 2048).
|
84
|
+
// All values computed for 8-bit first level lookup with Mark Adler's tool:
|
85
|
+
// http://www.hdfgroup.org/ftp/lib-external/zlib/zlib-1.2.5/examples/enough.c
|
86
|
+
#define FIXED_TABLE_SIZE (630 * 3 + 410)
|
87
|
+
static const int kTableSize[12] = {
|
88
|
+
FIXED_TABLE_SIZE + 654,
|
89
|
+
FIXED_TABLE_SIZE + 656,
|
90
|
+
FIXED_TABLE_SIZE + 658,
|
91
|
+
FIXED_TABLE_SIZE + 662,
|
92
|
+
FIXED_TABLE_SIZE + 670,
|
93
|
+
FIXED_TABLE_SIZE + 686,
|
94
|
+
FIXED_TABLE_SIZE + 718,
|
95
|
+
FIXED_TABLE_SIZE + 782,
|
96
|
+
FIXED_TABLE_SIZE + 912,
|
97
|
+
FIXED_TABLE_SIZE + 1168,
|
98
|
+
FIXED_TABLE_SIZE + 1680,
|
99
|
+
FIXED_TABLE_SIZE + 2704
|
100
|
+
};
|
101
|
+
|
102
|
+
static int DecodeImageStream(int xsize, int ysize,
|
103
|
+
int is_level0,
|
104
|
+
VP8LDecoder* const dec,
|
105
|
+
uint32_t** const decoded_data);
|
106
|
+
|
107
|
+
//------------------------------------------------------------------------------
|
108
|
+
|
109
|
+
int VP8LCheckSignature(const uint8_t* const data, size_t size) {
|
110
|
+
return (size >= VP8L_FRAME_HEADER_SIZE &&
|
111
|
+
data[0] == VP8L_MAGIC_BYTE &&
|
112
|
+
(data[4] >> 5) == 0); // version
|
113
|
+
}
|
114
|
+
|
115
|
+
static int ReadImageInfo(VP8LBitReader* const br,
|
116
|
+
int* const width, int* const height,
|
117
|
+
int* const has_alpha) {
|
118
|
+
if (VP8LReadBits(br, 8) != VP8L_MAGIC_BYTE) return 0;
|
119
|
+
*width = VP8LReadBits(br, VP8L_IMAGE_SIZE_BITS) + 1;
|
120
|
+
*height = VP8LReadBits(br, VP8L_IMAGE_SIZE_BITS) + 1;
|
121
|
+
*has_alpha = VP8LReadBits(br, 1);
|
122
|
+
if (VP8LReadBits(br, VP8L_VERSION_BITS) != 0) return 0;
|
123
|
+
return !br->eos_;
|
124
|
+
}
|
125
|
+
|
126
|
+
int VP8LGetInfo(const uint8_t* data, size_t data_size,
|
127
|
+
int* const width, int* const height, int* const has_alpha) {
|
128
|
+
if (data == NULL || data_size < VP8L_FRAME_HEADER_SIZE) {
|
129
|
+
return 0; // not enough data
|
130
|
+
} else if (!VP8LCheckSignature(data, data_size)) {
|
131
|
+
return 0; // bad signature
|
132
|
+
} else {
|
133
|
+
int w, h, a;
|
134
|
+
VP8LBitReader br;
|
135
|
+
VP8LInitBitReader(&br, data, data_size);
|
136
|
+
if (!ReadImageInfo(&br, &w, &h, &a)) {
|
137
|
+
return 0;
|
138
|
+
}
|
139
|
+
if (width != NULL) *width = w;
|
140
|
+
if (height != NULL) *height = h;
|
141
|
+
if (has_alpha != NULL) *has_alpha = a;
|
142
|
+
return 1;
|
143
|
+
}
|
144
|
+
}
|
145
|
+
|
146
|
+
//------------------------------------------------------------------------------
|
147
|
+
|
148
|
+
static WEBP_INLINE int GetCopyDistance(int distance_symbol,
|
149
|
+
VP8LBitReader* const br) {
|
150
|
+
int extra_bits, offset;
|
151
|
+
if (distance_symbol < 4) {
|
152
|
+
return distance_symbol + 1;
|
153
|
+
}
|
154
|
+
extra_bits = (distance_symbol - 2) >> 1;
|
155
|
+
offset = (2 + (distance_symbol & 1)) << extra_bits;
|
156
|
+
return offset + VP8LReadBits(br, extra_bits) + 1;
|
157
|
+
}
|
158
|
+
|
159
|
+
static WEBP_INLINE int GetCopyLength(int length_symbol,
|
160
|
+
VP8LBitReader* const br) {
|
161
|
+
// Length and distance prefixes are encoded the same way.
|
162
|
+
return GetCopyDistance(length_symbol, br);
|
163
|
+
}
|
164
|
+
|
165
|
+
static WEBP_INLINE int PlaneCodeToDistance(int xsize, int plane_code) {
|
166
|
+
if (plane_code > CODE_TO_PLANE_CODES) {
|
167
|
+
return plane_code - CODE_TO_PLANE_CODES;
|
168
|
+
} else {
|
169
|
+
const int dist_code = kCodeToPlane[plane_code - 1];
|
170
|
+
const int yoffset = dist_code >> 4;
|
171
|
+
const int xoffset = 8 - (dist_code & 0xf);
|
172
|
+
const int dist = yoffset * xsize + xoffset;
|
173
|
+
return (dist >= 1) ? dist : 1; // dist<1 can happen if xsize is very small
|
174
|
+
}
|
175
|
+
}
|
176
|
+
|
177
|
+
//------------------------------------------------------------------------------
|
178
|
+
// Decodes the next Huffman code from bit-stream.
|
179
|
+
// FillBitWindow(br) needs to be called at minimum every second call
|
180
|
+
// to ReadSymbol, in order to pre-fetch enough bits.
|
181
|
+
static WEBP_INLINE int ReadSymbol(const HuffmanCode* table,
|
182
|
+
VP8LBitReader* const br) {
|
183
|
+
int nbits;
|
184
|
+
uint32_t val = VP8LPrefetchBits(br);
|
185
|
+
table += val & HUFFMAN_TABLE_MASK;
|
186
|
+
nbits = table->bits - HUFFMAN_TABLE_BITS;
|
187
|
+
if (nbits > 0) {
|
188
|
+
VP8LSetBitPos(br, br->bit_pos_ + HUFFMAN_TABLE_BITS);
|
189
|
+
val = VP8LPrefetchBits(br);
|
190
|
+
table += table->value;
|
191
|
+
table += val & ((1 << nbits) - 1);
|
192
|
+
}
|
193
|
+
VP8LSetBitPos(br, br->bit_pos_ + table->bits);
|
194
|
+
return table->value;
|
195
|
+
}
|
196
|
+
|
197
|
+
static int ReadHuffmanCodeLengths(
|
198
|
+
VP8LDecoder* const dec, const int* const code_length_code_lengths,
|
199
|
+
int num_symbols, int* const code_lengths) {
|
200
|
+
int ok = 0;
|
201
|
+
VP8LBitReader* const br = &dec->br_;
|
202
|
+
int symbol;
|
203
|
+
int max_symbol;
|
204
|
+
int prev_code_len = DEFAULT_CODE_LENGTH;
|
205
|
+
HuffmanCode table[1 << LENGTHS_TABLE_BITS];
|
206
|
+
|
207
|
+
if (!VP8LBuildHuffmanTable(table, LENGTHS_TABLE_BITS,
|
208
|
+
code_length_code_lengths,
|
209
|
+
NUM_CODE_LENGTH_CODES)) {
|
210
|
+
goto End;
|
211
|
+
}
|
212
|
+
|
213
|
+
if (VP8LReadBits(br, 1)) { // use length
|
214
|
+
const int length_nbits = 2 + 2 * VP8LReadBits(br, 3);
|
215
|
+
max_symbol = 2 + VP8LReadBits(br, length_nbits);
|
216
|
+
if (max_symbol > num_symbols) {
|
217
|
+
goto End;
|
218
|
+
}
|
219
|
+
} else {
|
220
|
+
max_symbol = num_symbols;
|
221
|
+
}
|
222
|
+
|
223
|
+
symbol = 0;
|
224
|
+
while (symbol < num_symbols) {
|
225
|
+
const HuffmanCode* p;
|
226
|
+
int code_len;
|
227
|
+
if (max_symbol-- == 0) break;
|
228
|
+
VP8LFillBitWindow(br);
|
229
|
+
p = &table[VP8LPrefetchBits(br) & LENGTHS_TABLE_MASK];
|
230
|
+
VP8LSetBitPos(br, br->bit_pos_ + p->bits);
|
231
|
+
code_len = p->value;
|
232
|
+
if (code_len < kCodeLengthLiterals) {
|
233
|
+
code_lengths[symbol++] = code_len;
|
234
|
+
if (code_len != 0) prev_code_len = code_len;
|
235
|
+
} else {
|
236
|
+
const int use_prev = (code_len == kCodeLengthRepeatCode);
|
237
|
+
const int slot = code_len - kCodeLengthLiterals;
|
238
|
+
const int extra_bits = kCodeLengthExtraBits[slot];
|
239
|
+
const int repeat_offset = kCodeLengthRepeatOffsets[slot];
|
240
|
+
int repeat = VP8LReadBits(br, extra_bits) + repeat_offset;
|
241
|
+
if (symbol + repeat > num_symbols) {
|
242
|
+
goto End;
|
243
|
+
} else {
|
244
|
+
const int length = use_prev ? prev_code_len : 0;
|
245
|
+
while (repeat-- > 0) code_lengths[symbol++] = length;
|
246
|
+
}
|
247
|
+
}
|
248
|
+
}
|
249
|
+
ok = 1;
|
250
|
+
|
251
|
+
End:
|
252
|
+
if (!ok) dec->status_ = VP8_STATUS_BITSTREAM_ERROR;
|
253
|
+
return ok;
|
254
|
+
}
|
255
|
+
|
256
|
+
// 'code_lengths' is pre-allocated temporary buffer, used for creating Huffman
|
257
|
+
// tree.
|
258
|
+
static int ReadHuffmanCode(int alphabet_size, VP8LDecoder* const dec,
|
259
|
+
int* const code_lengths, HuffmanCode* const table) {
|
260
|
+
int ok = 0;
|
261
|
+
int size = 0;
|
262
|
+
VP8LBitReader* const br = &dec->br_;
|
263
|
+
const int simple_code = VP8LReadBits(br, 1);
|
264
|
+
|
265
|
+
memset(code_lengths, 0, alphabet_size * sizeof(*code_lengths));
|
266
|
+
|
267
|
+
if (simple_code) { // Read symbols, codes & code lengths directly.
|
268
|
+
const int num_symbols = VP8LReadBits(br, 1) + 1;
|
269
|
+
const int first_symbol_len_code = VP8LReadBits(br, 1);
|
270
|
+
// The first code is either 1 bit or 8 bit code.
|
271
|
+
int symbol = VP8LReadBits(br, (first_symbol_len_code == 0) ? 1 : 8);
|
272
|
+
code_lengths[symbol] = 1;
|
273
|
+
// The second code (if present), is always 8 bit long.
|
274
|
+
if (num_symbols == 2) {
|
275
|
+
symbol = VP8LReadBits(br, 8);
|
276
|
+
code_lengths[symbol] = 1;
|
277
|
+
}
|
278
|
+
ok = 1;
|
279
|
+
} else { // Decode Huffman-coded code lengths.
|
280
|
+
int i;
|
281
|
+
int code_length_code_lengths[NUM_CODE_LENGTH_CODES] = { 0 };
|
282
|
+
const int num_codes = VP8LReadBits(br, 4) + 4;
|
283
|
+
if (num_codes > NUM_CODE_LENGTH_CODES) {
|
284
|
+
dec->status_ = VP8_STATUS_BITSTREAM_ERROR;
|
285
|
+
return 0;
|
286
|
+
}
|
287
|
+
|
288
|
+
for (i = 0; i < num_codes; ++i) {
|
289
|
+
code_length_code_lengths[kCodeLengthCodeOrder[i]] = VP8LReadBits(br, 3);
|
290
|
+
}
|
291
|
+
ok = ReadHuffmanCodeLengths(dec, code_length_code_lengths, alphabet_size,
|
292
|
+
code_lengths);
|
293
|
+
}
|
294
|
+
|
295
|
+
ok = ok && !br->eos_;
|
296
|
+
if (ok) {
|
297
|
+
size = VP8LBuildHuffmanTable(table, HUFFMAN_TABLE_BITS,
|
298
|
+
code_lengths, alphabet_size);
|
299
|
+
}
|
300
|
+
if (!ok || size == 0) {
|
301
|
+
dec->status_ = VP8_STATUS_BITSTREAM_ERROR;
|
302
|
+
return 0;
|
303
|
+
}
|
304
|
+
return size;
|
305
|
+
}
|
306
|
+
|
307
|
+
static int ReadHuffmanCodes(VP8LDecoder* const dec, int xsize, int ysize,
|
308
|
+
int color_cache_bits, int allow_recursion) {
|
309
|
+
int i, j;
|
310
|
+
VP8LBitReader* const br = &dec->br_;
|
311
|
+
VP8LMetadata* const hdr = &dec->hdr_;
|
312
|
+
uint32_t* huffman_image = NULL;
|
313
|
+
HTreeGroup* htree_groups = NULL;
|
314
|
+
HuffmanCode* huffman_tables = NULL;
|
315
|
+
HuffmanCode* next = NULL;
|
316
|
+
int num_htree_groups = 1;
|
317
|
+
int max_alphabet_size = 0;
|
318
|
+
int* code_lengths = NULL;
|
319
|
+
const int table_size = kTableSize[color_cache_bits];
|
320
|
+
|
321
|
+
if (allow_recursion && VP8LReadBits(br, 1)) {
|
322
|
+
// use meta Huffman codes.
|
323
|
+
const int huffman_precision = VP8LReadBits(br, 3) + 2;
|
324
|
+
const int huffman_xsize = VP8LSubSampleSize(xsize, huffman_precision);
|
325
|
+
const int huffman_ysize = VP8LSubSampleSize(ysize, huffman_precision);
|
326
|
+
const int huffman_pixs = huffman_xsize * huffman_ysize;
|
327
|
+
if (!DecodeImageStream(huffman_xsize, huffman_ysize, 0, dec,
|
328
|
+
&huffman_image)) {
|
329
|
+
goto Error;
|
330
|
+
}
|
331
|
+
hdr->huffman_subsample_bits_ = huffman_precision;
|
332
|
+
for (i = 0; i < huffman_pixs; ++i) {
|
333
|
+
// The huffman data is stored in red and green bytes.
|
334
|
+
const int group = (huffman_image[i] >> 8) & 0xffff;
|
335
|
+
huffman_image[i] = group;
|
336
|
+
if (group >= num_htree_groups) {
|
337
|
+
num_htree_groups = group + 1;
|
338
|
+
}
|
339
|
+
}
|
340
|
+
}
|
341
|
+
|
342
|
+
if (br->eos_) goto Error;
|
343
|
+
|
344
|
+
// Find maximum alphabet size for the htree group.
|
345
|
+
for (j = 0; j < HUFFMAN_CODES_PER_META_CODE; ++j) {
|
346
|
+
int alphabet_size = kAlphabetSize[j];
|
347
|
+
if (j == 0 && color_cache_bits > 0) {
|
348
|
+
alphabet_size += 1 << color_cache_bits;
|
349
|
+
}
|
350
|
+
if (max_alphabet_size < alphabet_size) {
|
351
|
+
max_alphabet_size = alphabet_size;
|
352
|
+
}
|
353
|
+
}
|
354
|
+
|
355
|
+
huffman_tables = (HuffmanCode*)WebPSafeMalloc(num_htree_groups * table_size,
|
356
|
+
sizeof(*huffman_tables));
|
357
|
+
htree_groups = VP8LHtreeGroupsNew(num_htree_groups);
|
358
|
+
code_lengths = (int*)WebPSafeCalloc((uint64_t)max_alphabet_size,
|
359
|
+
sizeof(*code_lengths));
|
360
|
+
|
361
|
+
if (htree_groups == NULL || code_lengths == NULL || huffman_tables == NULL) {
|
362
|
+
dec->status_ = VP8_STATUS_OUT_OF_MEMORY;
|
363
|
+
goto Error;
|
364
|
+
}
|
365
|
+
|
366
|
+
next = huffman_tables;
|
367
|
+
for (i = 0; i < num_htree_groups; ++i) {
|
368
|
+
HTreeGroup* const htree_group = &htree_groups[i];
|
369
|
+
HuffmanCode** const htrees = htree_group->htrees;
|
370
|
+
int size;
|
371
|
+
int is_trivial_literal = 1;
|
372
|
+
for (j = 0; j < HUFFMAN_CODES_PER_META_CODE; ++j) {
|
373
|
+
int alphabet_size = kAlphabetSize[j];
|
374
|
+
htrees[j] = next;
|
375
|
+
if (j == 0 && color_cache_bits > 0) {
|
376
|
+
alphabet_size += 1 << color_cache_bits;
|
377
|
+
}
|
378
|
+
size = ReadHuffmanCode(alphabet_size, dec, code_lengths, next);
|
379
|
+
if (is_trivial_literal && kLiteralMap[j] == 1) {
|
380
|
+
is_trivial_literal = (next->bits == 0);
|
381
|
+
}
|
382
|
+
next += size;
|
383
|
+
if (size == 0) {
|
384
|
+
goto Error;
|
385
|
+
}
|
386
|
+
}
|
387
|
+
htree_group->is_trivial_literal = is_trivial_literal;
|
388
|
+
if (is_trivial_literal) {
|
389
|
+
const int red = htrees[RED][0].value;
|
390
|
+
const int blue = htrees[BLUE][0].value;
|
391
|
+
const int alpha = htrees[ALPHA][0].value;
|
392
|
+
htree_group->literal_arb =
|
393
|
+
((uint32_t)alpha << 24) | (red << 16) | blue;
|
394
|
+
}
|
395
|
+
}
|
396
|
+
WebPSafeFree(code_lengths);
|
397
|
+
|
398
|
+
// All OK. Finalize pointers and return.
|
399
|
+
hdr->huffman_image_ = huffman_image;
|
400
|
+
hdr->num_htree_groups_ = num_htree_groups;
|
401
|
+
hdr->htree_groups_ = htree_groups;
|
402
|
+
hdr->huffman_tables_ = huffman_tables;
|
403
|
+
return 1;
|
404
|
+
|
405
|
+
Error:
|
406
|
+
WebPSafeFree(code_lengths);
|
407
|
+
WebPSafeFree(huffman_image);
|
408
|
+
WebPSafeFree(huffman_tables);
|
409
|
+
VP8LHtreeGroupsFree(htree_groups);
|
410
|
+
return 0;
|
411
|
+
}
|
412
|
+
|
413
|
+
//------------------------------------------------------------------------------
|
414
|
+
// Scaling.
|
415
|
+
|
416
|
+
static int AllocateAndInitRescaler(VP8LDecoder* const dec, VP8Io* const io) {
|
417
|
+
const int num_channels = 4;
|
418
|
+
const int in_width = io->mb_w;
|
419
|
+
const int out_width = io->scaled_width;
|
420
|
+
const int in_height = io->mb_h;
|
421
|
+
const int out_height = io->scaled_height;
|
422
|
+
const uint64_t work_size = 2 * num_channels * (uint64_t)out_width;
|
423
|
+
int32_t* work; // Rescaler work area.
|
424
|
+
const uint64_t scaled_data_size = num_channels * (uint64_t)out_width;
|
425
|
+
uint32_t* scaled_data; // Temporary storage for scaled BGRA data.
|
426
|
+
const uint64_t memory_size = sizeof(*dec->rescaler) +
|
427
|
+
work_size * sizeof(*work) +
|
428
|
+
scaled_data_size * sizeof(*scaled_data);
|
429
|
+
uint8_t* memory = (uint8_t*)WebPSafeCalloc(memory_size, sizeof(*memory));
|
430
|
+
if (memory == NULL) {
|
431
|
+
dec->status_ = VP8_STATUS_OUT_OF_MEMORY;
|
432
|
+
return 0;
|
433
|
+
}
|
434
|
+
assert(dec->rescaler_memory == NULL);
|
435
|
+
dec->rescaler_memory = memory;
|
436
|
+
|
437
|
+
dec->rescaler = (WebPRescaler*)memory;
|
438
|
+
memory += sizeof(*dec->rescaler);
|
439
|
+
work = (int32_t*)memory;
|
440
|
+
memory += work_size * sizeof(*work);
|
441
|
+
scaled_data = (uint32_t*)memory;
|
442
|
+
|
443
|
+
WebPRescalerInit(dec->rescaler, in_width, in_height, (uint8_t*)scaled_data,
|
444
|
+
out_width, out_height, 0, num_channels,
|
445
|
+
in_width, out_width, in_height, out_height, work);
|
446
|
+
return 1;
|
447
|
+
}
|
448
|
+
|
449
|
+
//------------------------------------------------------------------------------
|
450
|
+
// Export to ARGB
|
451
|
+
|
452
|
+
// We have special "export" function since we need to convert from BGRA
|
453
|
+
static int Export(WebPRescaler* const rescaler, WEBP_CSP_MODE colorspace,
|
454
|
+
int rgba_stride, uint8_t* const rgba) {
|
455
|
+
uint32_t* const src = (uint32_t*)rescaler->dst;
|
456
|
+
const int dst_width = rescaler->dst_width;
|
457
|
+
int num_lines_out = 0;
|
458
|
+
while (WebPRescalerHasPendingOutput(rescaler)) {
|
459
|
+
uint8_t* const dst = rgba + num_lines_out * rgba_stride;
|
460
|
+
WebPRescalerExportRow(rescaler, 0);
|
461
|
+
WebPMultARGBRow(src, dst_width, 1);
|
462
|
+
VP8LConvertFromBGRA(src, dst_width, colorspace, dst);
|
463
|
+
++num_lines_out;
|
464
|
+
}
|
465
|
+
return num_lines_out;
|
466
|
+
}
|
467
|
+
|
468
|
+
// Emit scaled rows.
|
469
|
+
static int EmitRescaledRowsRGBA(const VP8LDecoder* const dec,
|
470
|
+
uint8_t* in, int in_stride, int mb_h,
|
471
|
+
uint8_t* const out, int out_stride) {
|
472
|
+
const WEBP_CSP_MODE colorspace = dec->output_->colorspace;
|
473
|
+
int num_lines_in = 0;
|
474
|
+
int num_lines_out = 0;
|
475
|
+
while (num_lines_in < mb_h) {
|
476
|
+
uint8_t* const row_in = in + num_lines_in * in_stride;
|
477
|
+
uint8_t* const row_out = out + num_lines_out * out_stride;
|
478
|
+
const int lines_left = mb_h - num_lines_in;
|
479
|
+
const int needed_lines = WebPRescaleNeededLines(dec->rescaler, lines_left);
|
480
|
+
assert(needed_lines > 0 && needed_lines <= lines_left);
|
481
|
+
WebPMultARGBRows(row_in, in_stride,
|
482
|
+
dec->rescaler->src_width, needed_lines, 0);
|
483
|
+
WebPRescalerImport(dec->rescaler, lines_left, row_in, in_stride);
|
484
|
+
num_lines_in += needed_lines;
|
485
|
+
num_lines_out += Export(dec->rescaler, colorspace, out_stride, row_out);
|
486
|
+
}
|
487
|
+
return num_lines_out;
|
488
|
+
}
|
489
|
+
|
490
|
+
// Emit rows without any scaling.
|
491
|
+
static int EmitRows(WEBP_CSP_MODE colorspace,
|
492
|
+
const uint8_t* row_in, int in_stride,
|
493
|
+
int mb_w, int mb_h,
|
494
|
+
uint8_t* const out, int out_stride) {
|
495
|
+
int lines = mb_h;
|
496
|
+
uint8_t* row_out = out;
|
497
|
+
while (lines-- > 0) {
|
498
|
+
VP8LConvertFromBGRA((const uint32_t*)row_in, mb_w, colorspace, row_out);
|
499
|
+
row_in += in_stride;
|
500
|
+
row_out += out_stride;
|
501
|
+
}
|
502
|
+
return mb_h; // Num rows out == num rows in.
|
503
|
+
}
|
504
|
+
|
505
|
+
//------------------------------------------------------------------------------
|
506
|
+
// Export to YUVA
|
507
|
+
|
508
|
+
// TODO(skal): should be in yuv.c
|
509
|
+
static void ConvertToYUVA(const uint32_t* const src, int width, int y_pos,
|
510
|
+
const WebPDecBuffer* const output) {
|
511
|
+
const WebPYUVABuffer* const buf = &output->u.YUVA;
|
512
|
+
// first, the luma plane
|
513
|
+
{
|
514
|
+
int i;
|
515
|
+
uint8_t* const y = buf->y + y_pos * buf->y_stride;
|
516
|
+
for (i = 0; i < width; ++i) {
|
517
|
+
const uint32_t p = src[i];
|
518
|
+
y[i] = VP8RGBToY((p >> 16) & 0xff, (p >> 8) & 0xff, (p >> 0) & 0xff,
|
519
|
+
YUV_HALF);
|
520
|
+
}
|
521
|
+
}
|
522
|
+
|
523
|
+
// then U/V planes
|
524
|
+
{
|
525
|
+
uint8_t* const u = buf->u + (y_pos >> 1) * buf->u_stride;
|
526
|
+
uint8_t* const v = buf->v + (y_pos >> 1) * buf->v_stride;
|
527
|
+
const int uv_width = width >> 1;
|
528
|
+
int i;
|
529
|
+
for (i = 0; i < uv_width; ++i) {
|
530
|
+
const uint32_t v0 = src[2 * i + 0];
|
531
|
+
const uint32_t v1 = src[2 * i + 1];
|
532
|
+
// VP8RGBToU/V expects four accumulated pixels. Hence we need to
|
533
|
+
// scale r/g/b value by a factor 2. We just shift v0/v1 one bit less.
|
534
|
+
const int r = ((v0 >> 15) & 0x1fe) + ((v1 >> 15) & 0x1fe);
|
535
|
+
const int g = ((v0 >> 7) & 0x1fe) + ((v1 >> 7) & 0x1fe);
|
536
|
+
const int b = ((v0 << 1) & 0x1fe) + ((v1 << 1) & 0x1fe);
|
537
|
+
if (!(y_pos & 1)) { // even lines: store values
|
538
|
+
u[i] = VP8RGBToU(r, g, b, YUV_HALF << 2);
|
539
|
+
v[i] = VP8RGBToV(r, g, b, YUV_HALF << 2);
|
540
|
+
} else { // odd lines: average with previous values
|
541
|
+
const int tmp_u = VP8RGBToU(r, g, b, YUV_HALF << 2);
|
542
|
+
const int tmp_v = VP8RGBToV(r, g, b, YUV_HALF << 2);
|
543
|
+
// Approximated average-of-four. But it's an acceptable diff.
|
544
|
+
u[i] = (u[i] + tmp_u + 1) >> 1;
|
545
|
+
v[i] = (v[i] + tmp_v + 1) >> 1;
|
546
|
+
}
|
547
|
+
}
|
548
|
+
if (width & 1) { // last pixel
|
549
|
+
const uint32_t v0 = src[2 * i + 0];
|
550
|
+
const int r = (v0 >> 14) & 0x3fc;
|
551
|
+
const int g = (v0 >> 6) & 0x3fc;
|
552
|
+
const int b = (v0 << 2) & 0x3fc;
|
553
|
+
if (!(y_pos & 1)) { // even lines
|
554
|
+
u[i] = VP8RGBToU(r, g, b, YUV_HALF << 2);
|
555
|
+
v[i] = VP8RGBToV(r, g, b, YUV_HALF << 2);
|
556
|
+
} else { // odd lines (note: we could just skip this)
|
557
|
+
const int tmp_u = VP8RGBToU(r, g, b, YUV_HALF << 2);
|
558
|
+
const int tmp_v = VP8RGBToV(r, g, b, YUV_HALF << 2);
|
559
|
+
u[i] = (u[i] + tmp_u + 1) >> 1;
|
560
|
+
v[i] = (v[i] + tmp_v + 1) >> 1;
|
561
|
+
}
|
562
|
+
}
|
563
|
+
}
|
564
|
+
// Lastly, store alpha if needed.
|
565
|
+
if (buf->a != NULL) {
|
566
|
+
int i;
|
567
|
+
uint8_t* const a = buf->a + y_pos * buf->a_stride;
|
568
|
+
for (i = 0; i < width; ++i) a[i] = (src[i] >> 24);
|
569
|
+
}
|
570
|
+
}
|
571
|
+
|
572
|
+
static int ExportYUVA(const VP8LDecoder* const dec, int y_pos) {
|
573
|
+
WebPRescaler* const rescaler = dec->rescaler;
|
574
|
+
uint32_t* const src = (uint32_t*)rescaler->dst;
|
575
|
+
const int dst_width = rescaler->dst_width;
|
576
|
+
int num_lines_out = 0;
|
577
|
+
while (WebPRescalerHasPendingOutput(rescaler)) {
|
578
|
+
WebPRescalerExportRow(rescaler, 0);
|
579
|
+
WebPMultARGBRow(src, dst_width, 1);
|
580
|
+
ConvertToYUVA(src, dst_width, y_pos, dec->output_);
|
581
|
+
++y_pos;
|
582
|
+
++num_lines_out;
|
583
|
+
}
|
584
|
+
return num_lines_out;
|
585
|
+
}
|
586
|
+
|
587
|
+
static int EmitRescaledRowsYUVA(const VP8LDecoder* const dec,
|
588
|
+
uint8_t* in, int in_stride, int mb_h) {
|
589
|
+
int num_lines_in = 0;
|
590
|
+
int y_pos = dec->last_out_row_;
|
591
|
+
while (num_lines_in < mb_h) {
|
592
|
+
const int lines_left = mb_h - num_lines_in;
|
593
|
+
const int needed_lines = WebPRescaleNeededLines(dec->rescaler, lines_left);
|
594
|
+
WebPMultARGBRows(in, in_stride, dec->rescaler->src_width, needed_lines, 0);
|
595
|
+
WebPRescalerImport(dec->rescaler, lines_left, in, in_stride);
|
596
|
+
num_lines_in += needed_lines;
|
597
|
+
in += needed_lines * in_stride;
|
598
|
+
y_pos += ExportYUVA(dec, y_pos);
|
599
|
+
}
|
600
|
+
return y_pos;
|
601
|
+
}
|
602
|
+
|
603
|
+
static int EmitRowsYUVA(const VP8LDecoder* const dec,
|
604
|
+
const uint8_t* in, int in_stride,
|
605
|
+
int mb_w, int num_rows) {
|
606
|
+
int y_pos = dec->last_out_row_;
|
607
|
+
while (num_rows-- > 0) {
|
608
|
+
ConvertToYUVA((const uint32_t*)in, mb_w, y_pos, dec->output_);
|
609
|
+
in += in_stride;
|
610
|
+
++y_pos;
|
611
|
+
}
|
612
|
+
return y_pos;
|
613
|
+
}
|
614
|
+
|
615
|
+
//------------------------------------------------------------------------------
|
616
|
+
// Cropping.
|
617
|
+
|
618
|
+
// Sets io->mb_y, io->mb_h & io->mb_w according to start row, end row and
|
619
|
+
// crop options. Also updates the input data pointer, so that it points to the
|
620
|
+
// start of the cropped window. Note that pixels are in ARGB format even if
|
621
|
+
// 'in_data' is uint8_t*.
|
622
|
+
// Returns true if the crop window is not empty.
|
623
|
+
static int SetCropWindow(VP8Io* const io, int y_start, int y_end,
|
624
|
+
uint8_t** const in_data, int pixel_stride) {
|
625
|
+
assert(y_start < y_end);
|
626
|
+
assert(io->crop_left < io->crop_right);
|
627
|
+
if (y_end > io->crop_bottom) {
|
628
|
+
y_end = io->crop_bottom; // make sure we don't overflow on last row.
|
629
|
+
}
|
630
|
+
if (y_start < io->crop_top) {
|
631
|
+
const int delta = io->crop_top - y_start;
|
632
|
+
y_start = io->crop_top;
|
633
|
+
*in_data += delta * pixel_stride;
|
634
|
+
}
|
635
|
+
if (y_start >= y_end) return 0; // Crop window is empty.
|
636
|
+
|
637
|
+
*in_data += io->crop_left * sizeof(uint32_t);
|
638
|
+
|
639
|
+
io->mb_y = y_start - io->crop_top;
|
640
|
+
io->mb_w = io->crop_right - io->crop_left;
|
641
|
+
io->mb_h = y_end - y_start;
|
642
|
+
return 1; // Non-empty crop window.
|
643
|
+
}
|
644
|
+
|
645
|
+
//------------------------------------------------------------------------------
|
646
|
+
|
647
|
+
static WEBP_INLINE int GetMetaIndex(
|
648
|
+
const uint32_t* const image, int xsize, int bits, int x, int y) {
|
649
|
+
if (bits == 0) return 0;
|
650
|
+
return image[xsize * (y >> bits) + (x >> bits)];
|
651
|
+
}
|
652
|
+
|
653
|
+
static WEBP_INLINE HTreeGroup* GetHtreeGroupForPos(VP8LMetadata* const hdr,
|
654
|
+
int x, int y) {
|
655
|
+
const int meta_index = GetMetaIndex(hdr->huffman_image_, hdr->huffman_xsize_,
|
656
|
+
hdr->huffman_subsample_bits_, x, y);
|
657
|
+
assert(meta_index < hdr->num_htree_groups_);
|
658
|
+
return hdr->htree_groups_ + meta_index;
|
659
|
+
}
|
660
|
+
|
661
|
+
//------------------------------------------------------------------------------
|
662
|
+
// Main loop, with custom row-processing function
|
663
|
+
|
664
|
+
typedef void (*ProcessRowsFunc)(VP8LDecoder* const dec, int row);
|
665
|
+
|
666
|
+
static void ApplyInverseTransforms(VP8LDecoder* const dec, int num_rows,
|
667
|
+
const uint32_t* const rows) {
|
668
|
+
int n = dec->next_transform_;
|
669
|
+
const int cache_pixs = dec->width_ * num_rows;
|
670
|
+
const int start_row = dec->last_row_;
|
671
|
+
const int end_row = start_row + num_rows;
|
672
|
+
const uint32_t* rows_in = rows;
|
673
|
+
uint32_t* const rows_out = dec->argb_cache_;
|
674
|
+
|
675
|
+
// Inverse transforms.
|
676
|
+
// TODO: most transforms only need to operate on the cropped region only.
|
677
|
+
memcpy(rows_out, rows_in, cache_pixs * sizeof(*rows_out));
|
678
|
+
while (n-- > 0) {
|
679
|
+
VP8LTransform* const transform = &dec->transforms_[n];
|
680
|
+
VP8LInverseTransform(transform, start_row, end_row, rows_in, rows_out);
|
681
|
+
rows_in = rows_out;
|
682
|
+
}
|
683
|
+
}
|
684
|
+
|
685
|
+
// Special method for paletted alpha data.
|
686
|
+
static void ApplyInverseTransformsAlpha(VP8LDecoder* const dec, int num_rows,
|
687
|
+
const uint8_t* const rows) {
|
688
|
+
const int start_row = dec->last_row_;
|
689
|
+
const int end_row = start_row + num_rows;
|
690
|
+
const uint8_t* rows_in = rows;
|
691
|
+
uint8_t* rows_out = (uint8_t*)dec->io_->opaque + dec->io_->width * start_row;
|
692
|
+
VP8LTransform* const transform = &dec->transforms_[0];
|
693
|
+
assert(dec->next_transform_ == 1);
|
694
|
+
assert(transform->type_ == COLOR_INDEXING_TRANSFORM);
|
695
|
+
VP8LColorIndexInverseTransformAlpha(transform, start_row, end_row, rows_in,
|
696
|
+
rows_out);
|
697
|
+
}
|
698
|
+
|
699
|
+
// Processes (transforms, scales & color-converts) the rows decoded after the
|
700
|
+
// last call.
|
701
|
+
static void ProcessRows(VP8LDecoder* const dec, int row) {
|
702
|
+
const uint32_t* const rows = dec->pixels_ + dec->width_ * dec->last_row_;
|
703
|
+
const int num_rows = row - dec->last_row_;
|
704
|
+
|
705
|
+
if (num_rows <= 0) return; // Nothing to be done.
|
706
|
+
ApplyInverseTransforms(dec, num_rows, rows);
|
707
|
+
|
708
|
+
// Emit output.
|
709
|
+
{
|
710
|
+
VP8Io* const io = dec->io_;
|
711
|
+
uint8_t* rows_data = (uint8_t*)dec->argb_cache_;
|
712
|
+
const int in_stride = io->width * sizeof(uint32_t); // in unit of RGBA
|
713
|
+
if (!SetCropWindow(io, dec->last_row_, row, &rows_data, in_stride)) {
|
714
|
+
// Nothing to output (this time).
|
715
|
+
} else {
|
716
|
+
const WebPDecBuffer* const output = dec->output_;
|
717
|
+
if (output->colorspace < MODE_YUV) { // convert to RGBA
|
718
|
+
const WebPRGBABuffer* const buf = &output->u.RGBA;
|
719
|
+
uint8_t* const rgba = buf->rgba + dec->last_out_row_ * buf->stride;
|
720
|
+
const int num_rows_out = io->use_scaling ?
|
721
|
+
EmitRescaledRowsRGBA(dec, rows_data, in_stride, io->mb_h,
|
722
|
+
rgba, buf->stride) :
|
723
|
+
EmitRows(output->colorspace, rows_data, in_stride,
|
724
|
+
io->mb_w, io->mb_h, rgba, buf->stride);
|
725
|
+
// Update 'last_out_row_'.
|
726
|
+
dec->last_out_row_ += num_rows_out;
|
727
|
+
} else { // convert to YUVA
|
728
|
+
dec->last_out_row_ = io->use_scaling ?
|
729
|
+
EmitRescaledRowsYUVA(dec, rows_data, in_stride, io->mb_h) :
|
730
|
+
EmitRowsYUVA(dec, rows_data, in_stride, io->mb_w, io->mb_h);
|
731
|
+
}
|
732
|
+
assert(dec->last_out_row_ <= output->height);
|
733
|
+
}
|
734
|
+
}
|
735
|
+
|
736
|
+
// Update 'last_row_'.
|
737
|
+
dec->last_row_ = row;
|
738
|
+
assert(dec->last_row_ <= dec->height_);
|
739
|
+
}
|
740
|
+
|
741
|
+
// Row-processing for the special case when alpha data contains only one
|
742
|
+
// transform (color indexing), and trivial non-green literals.
|
743
|
+
static int Is8bOptimizable(const VP8LMetadata* const hdr) {
|
744
|
+
int i;
|
745
|
+
if (hdr->color_cache_size_ > 0) return 0;
|
746
|
+
// When the Huffman tree contains only one symbol, we can skip the
|
747
|
+
// call to ReadSymbol() for red/blue/alpha channels.
|
748
|
+
for (i = 0; i < hdr->num_htree_groups_; ++i) {
|
749
|
+
HuffmanCode** const htrees = hdr->htree_groups_[i].htrees;
|
750
|
+
if (htrees[RED][0].bits > 0) return 0;
|
751
|
+
if (htrees[BLUE][0].bits > 0) return 0;
|
752
|
+
if (htrees[ALPHA][0].bits > 0) return 0;
|
753
|
+
}
|
754
|
+
return 1;
|
755
|
+
}
|
756
|
+
|
757
|
+
static void ExtractPalettedAlphaRows(VP8LDecoder* const dec, int row) {
|
758
|
+
const int num_rows = row - dec->last_row_;
|
759
|
+
const uint8_t* const in =
|
760
|
+
(uint8_t*)dec->pixels_ + dec->width_ * dec->last_row_;
|
761
|
+
if (num_rows > 0) {
|
762
|
+
ApplyInverseTransformsAlpha(dec, num_rows, in);
|
763
|
+
}
|
764
|
+
dec->last_row_ = dec->last_out_row_ = row;
|
765
|
+
}
|
766
|
+
|
767
|
+
//------------------------------------------------------------------------------
|
768
|
+
// Helper functions for fast pattern copy (8b and 32b)
|
769
|
+
|
770
|
+
// cyclic rotation of pattern word
|
771
|
+
static WEBP_INLINE uint32_t Rotate8b(uint32_t V) {
|
772
|
+
#if defined(WORDS_BIGENDIAN)
|
773
|
+
return ((V & 0xff000000u) >> 24) | (V << 8);
|
774
|
+
#else
|
775
|
+
return ((V & 0xffu) << 24) | (V >> 8);
|
776
|
+
#endif
|
777
|
+
}
|
778
|
+
|
779
|
+
// copy 1, 2 or 4-bytes pattern
|
780
|
+
static WEBP_INLINE void CopySmallPattern8b(const uint8_t* src, uint8_t* dst,
|
781
|
+
int length, uint32_t pattern) {
|
782
|
+
int i;
|
783
|
+
// align 'dst' to 4-bytes boundary. Adjust the pattern along the way.
|
784
|
+
while ((uintptr_t)dst & 3) {
|
785
|
+
*dst++ = *src++;
|
786
|
+
pattern = Rotate8b(pattern);
|
787
|
+
--length;
|
788
|
+
}
|
789
|
+
// Copy the pattern 4 bytes at a time.
|
790
|
+
for (i = 0; i < (length >> 2); ++i) {
|
791
|
+
((uint32_t*)dst)[i] = pattern;
|
792
|
+
}
|
793
|
+
// Finish with left-overs. 'pattern' is still correctly positioned,
|
794
|
+
// so no Rotate8b() call is needed.
|
795
|
+
for (i <<= 2; i < length; ++i) {
|
796
|
+
dst[i] = src[i];
|
797
|
+
}
|
798
|
+
}
|
799
|
+
|
800
|
+
static WEBP_INLINE void CopyBlock8b(uint8_t* const dst, int dist, int length) {
|
801
|
+
const uint8_t* src = dst - dist;
|
802
|
+
if (length >= 8) {
|
803
|
+
uint32_t pattern = 0;
|
804
|
+
switch (dist) {
|
805
|
+
case 1:
|
806
|
+
pattern = src[0];
|
807
|
+
#if defined(__arm__) || defined(_M_ARM) // arm doesn't like multiply that much
|
808
|
+
pattern |= pattern << 8;
|
809
|
+
pattern |= pattern << 16;
|
810
|
+
#elif defined(WEBP_USE_MIPS_DSP_R2)
|
811
|
+
__asm__ volatile ("replv.qb %0, %0" : "+r"(pattern));
|
812
|
+
#else
|
813
|
+
pattern = 0x01010101u * pattern;
|
814
|
+
#endif
|
815
|
+
break;
|
816
|
+
case 2:
|
817
|
+
memcpy(&pattern, src, sizeof(uint16_t));
|
818
|
+
#if defined(__arm__) || defined(_M_ARM)
|
819
|
+
pattern |= pattern << 16;
|
820
|
+
#elif defined(WEBP_USE_MIPS_DSP_R2)
|
821
|
+
__asm__ volatile ("replv.ph %0, %0" : "+r"(pattern));
|
822
|
+
#else
|
823
|
+
pattern = 0x00010001u * pattern;
|
824
|
+
#endif
|
825
|
+
break;
|
826
|
+
case 4:
|
827
|
+
memcpy(&pattern, src, sizeof(uint32_t));
|
828
|
+
break;
|
829
|
+
default:
|
830
|
+
goto Copy;
|
831
|
+
break;
|
832
|
+
}
|
833
|
+
CopySmallPattern8b(src, dst, length, pattern);
|
834
|
+
return;
|
835
|
+
}
|
836
|
+
Copy:
|
837
|
+
if (dist >= length) { // no overlap -> use memcpy()
|
838
|
+
memcpy(dst, src, length * sizeof(*dst));
|
839
|
+
} else {
|
840
|
+
int i;
|
841
|
+
for (i = 0; i < length; ++i) dst[i] = src[i];
|
842
|
+
}
|
843
|
+
}
|
844
|
+
|
845
|
+
// copy pattern of 1 or 2 uint32_t's
|
846
|
+
static WEBP_INLINE void CopySmallPattern32b(const uint32_t* src,
|
847
|
+
uint32_t* dst,
|
848
|
+
int length, uint64_t pattern) {
|
849
|
+
int i;
|
850
|
+
if ((uintptr_t)dst & 4) { // Align 'dst' to 8-bytes boundary.
|
851
|
+
*dst++ = *src++;
|
852
|
+
pattern = (pattern >> 32) | (pattern << 32);
|
853
|
+
--length;
|
854
|
+
}
|
855
|
+
assert(0 == ((uintptr_t)dst & 7));
|
856
|
+
for (i = 0; i < (length >> 1); ++i) {
|
857
|
+
((uint64_t*)dst)[i] = pattern; // Copy the pattern 8 bytes at a time.
|
858
|
+
}
|
859
|
+
if (length & 1) { // Finish with left-over.
|
860
|
+
dst[i << 1] = src[i << 1];
|
861
|
+
}
|
862
|
+
}
|
863
|
+
|
864
|
+
static WEBP_INLINE void CopyBlock32b(uint32_t* const dst,
|
865
|
+
int dist, int length) {
|
866
|
+
const uint32_t* const src = dst - dist;
|
867
|
+
if (dist <= 2 && length >= 4 && ((uintptr_t)dst & 3) == 0) {
|
868
|
+
uint64_t pattern;
|
869
|
+
if (dist == 1) {
|
870
|
+
pattern = (uint64_t)src[0];
|
871
|
+
pattern |= pattern << 32;
|
872
|
+
} else {
|
873
|
+
memcpy(&pattern, src, sizeof(pattern));
|
874
|
+
}
|
875
|
+
CopySmallPattern32b(src, dst, length, pattern);
|
876
|
+
} else if (dist >= length) { // no overlap
|
877
|
+
memcpy(dst, src, length * sizeof(*dst));
|
878
|
+
} else {
|
879
|
+
int i;
|
880
|
+
for (i = 0; i < length; ++i) dst[i] = src[i];
|
881
|
+
}
|
882
|
+
}
|
883
|
+
|
884
|
+
//------------------------------------------------------------------------------
|
885
|
+
|
886
|
+
static int DecodeAlphaData(VP8LDecoder* const dec, uint8_t* const data,
|
887
|
+
int width, int height, int last_row) {
|
888
|
+
int ok = 1;
|
889
|
+
int row = dec->last_pixel_ / width;
|
890
|
+
int col = dec->last_pixel_ % width;
|
891
|
+
VP8LBitReader* const br = &dec->br_;
|
892
|
+
VP8LMetadata* const hdr = &dec->hdr_;
|
893
|
+
const HTreeGroup* htree_group = GetHtreeGroupForPos(hdr, col, row);
|
894
|
+
int pos = dec->last_pixel_; // current position
|
895
|
+
const int end = width * height; // End of data
|
896
|
+
const int last = width * last_row; // Last pixel to decode
|
897
|
+
const int len_code_limit = NUM_LITERAL_CODES + NUM_LENGTH_CODES;
|
898
|
+
const int mask = hdr->huffman_mask_;
|
899
|
+
assert(htree_group != NULL);
|
900
|
+
assert(pos < end);
|
901
|
+
assert(last_row <= height);
|
902
|
+
assert(Is8bOptimizable(hdr));
|
903
|
+
|
904
|
+
while (!br->eos_ && pos < last) {
|
905
|
+
int code;
|
906
|
+
// Only update when changing tile.
|
907
|
+
if ((col & mask) == 0) {
|
908
|
+
htree_group = GetHtreeGroupForPos(hdr, col, row);
|
909
|
+
}
|
910
|
+
VP8LFillBitWindow(br);
|
911
|
+
code = ReadSymbol(htree_group->htrees[GREEN], br);
|
912
|
+
if (code < NUM_LITERAL_CODES) { // Literal
|
913
|
+
data[pos] = code;
|
914
|
+
++pos;
|
915
|
+
++col;
|
916
|
+
if (col >= width) {
|
917
|
+
col = 0;
|
918
|
+
++row;
|
919
|
+
if (row % NUM_ARGB_CACHE_ROWS == 0) {
|
920
|
+
ExtractPalettedAlphaRows(dec, row);
|
921
|
+
}
|
922
|
+
}
|
923
|
+
} else if (code < len_code_limit) { // Backward reference
|
924
|
+
int dist_code, dist;
|
925
|
+
const int length_sym = code - NUM_LITERAL_CODES;
|
926
|
+
const int length = GetCopyLength(length_sym, br);
|
927
|
+
const int dist_symbol = ReadSymbol(htree_group->htrees[DIST], br);
|
928
|
+
VP8LFillBitWindow(br);
|
929
|
+
dist_code = GetCopyDistance(dist_symbol, br);
|
930
|
+
dist = PlaneCodeToDistance(width, dist_code);
|
931
|
+
if (pos >= dist && end - pos >= length) {
|
932
|
+
CopyBlock8b(data + pos, dist, length);
|
933
|
+
} else {
|
934
|
+
ok = 0;
|
935
|
+
goto End;
|
936
|
+
}
|
937
|
+
pos += length;
|
938
|
+
col += length;
|
939
|
+
while (col >= width) {
|
940
|
+
col -= width;
|
941
|
+
++row;
|
942
|
+
if (row % NUM_ARGB_CACHE_ROWS == 0) {
|
943
|
+
ExtractPalettedAlphaRows(dec, row);
|
944
|
+
}
|
945
|
+
}
|
946
|
+
if (pos < last && (col & mask)) {
|
947
|
+
htree_group = GetHtreeGroupForPos(hdr, col, row);
|
948
|
+
}
|
949
|
+
} else { // Not reached
|
950
|
+
ok = 0;
|
951
|
+
goto End;
|
952
|
+
}
|
953
|
+
assert(br->eos_ == VP8LIsEndOfStream(br));
|
954
|
+
}
|
955
|
+
// Process the remaining rows corresponding to last row-block.
|
956
|
+
ExtractPalettedAlphaRows(dec, row);
|
957
|
+
|
958
|
+
End:
|
959
|
+
if (!ok || (br->eos_ && pos < end)) {
|
960
|
+
ok = 0;
|
961
|
+
dec->status_ = br->eos_ ? VP8_STATUS_SUSPENDED
|
962
|
+
: VP8_STATUS_BITSTREAM_ERROR;
|
963
|
+
} else {
|
964
|
+
dec->last_pixel_ = (int)pos;
|
965
|
+
}
|
966
|
+
return ok;
|
967
|
+
}
|
968
|
+
|
969
|
+
static void SaveState(VP8LDecoder* const dec, int last_pixel) {
|
970
|
+
assert(dec->incremental_);
|
971
|
+
dec->saved_br_ = dec->br_;
|
972
|
+
dec->saved_last_pixel_ = last_pixel;
|
973
|
+
if (dec->hdr_.color_cache_size_ > 0) {
|
974
|
+
VP8LColorCacheCopy(&dec->hdr_.color_cache_, &dec->hdr_.saved_color_cache_);
|
975
|
+
}
|
976
|
+
}
|
977
|
+
|
978
|
+
static void RestoreState(VP8LDecoder* const dec) {
|
979
|
+
assert(dec->br_.eos_);
|
980
|
+
dec->status_ = VP8_STATUS_SUSPENDED;
|
981
|
+
dec->br_ = dec->saved_br_;
|
982
|
+
dec->last_pixel_ = dec->saved_last_pixel_;
|
983
|
+
if (dec->hdr_.color_cache_size_ > 0) {
|
984
|
+
VP8LColorCacheCopy(&dec->hdr_.saved_color_cache_, &dec->hdr_.color_cache_);
|
985
|
+
}
|
986
|
+
}
|
987
|
+
|
988
|
+
#define SYNC_EVERY_N_ROWS 8 // minimum number of rows between check-points
|
989
|
+
static int DecodeImageData(VP8LDecoder* const dec, uint32_t* const data,
|
990
|
+
int width, int height, int last_row,
|
991
|
+
ProcessRowsFunc process_func) {
|
992
|
+
int row = dec->last_pixel_ / width;
|
993
|
+
int col = dec->last_pixel_ % width;
|
994
|
+
VP8LBitReader* const br = &dec->br_;
|
995
|
+
VP8LMetadata* const hdr = &dec->hdr_;
|
996
|
+
HTreeGroup* htree_group = GetHtreeGroupForPos(hdr, col, row);
|
997
|
+
uint32_t* src = data + dec->last_pixel_;
|
998
|
+
uint32_t* last_cached = src;
|
999
|
+
uint32_t* const src_end = data + width * height; // End of data
|
1000
|
+
uint32_t* const src_last = data + width * last_row; // Last pixel to decode
|
1001
|
+
const int len_code_limit = NUM_LITERAL_CODES + NUM_LENGTH_CODES;
|
1002
|
+
const int color_cache_limit = len_code_limit + hdr->color_cache_size_;
|
1003
|
+
int next_sync_row = dec->incremental_ ? row : 1 << 24;
|
1004
|
+
VP8LColorCache* const color_cache =
|
1005
|
+
(hdr->color_cache_size_ > 0) ? &hdr->color_cache_ : NULL;
|
1006
|
+
const int mask = hdr->huffman_mask_;
|
1007
|
+
assert(htree_group != NULL);
|
1008
|
+
assert(src < src_end);
|
1009
|
+
assert(src_last <= src_end);
|
1010
|
+
|
1011
|
+
while (src < src_last) {
|
1012
|
+
int code;
|
1013
|
+
if (row >= next_sync_row) {
|
1014
|
+
SaveState(dec, (int)(src - data));
|
1015
|
+
next_sync_row = row + SYNC_EVERY_N_ROWS;
|
1016
|
+
}
|
1017
|
+
// Only update when changing tile. Note we could use this test:
|
1018
|
+
// if "((((prev_col ^ col) | prev_row ^ row)) > mask)" -> tile changed
|
1019
|
+
// but that's actually slower and needs storing the previous col/row.
|
1020
|
+
if ((col & mask) == 0) {
|
1021
|
+
htree_group = GetHtreeGroupForPos(hdr, col, row);
|
1022
|
+
}
|
1023
|
+
VP8LFillBitWindow(br);
|
1024
|
+
code = ReadSymbol(htree_group->htrees[GREEN], br);
|
1025
|
+
if (br->eos_) break; // early out
|
1026
|
+
if (code < NUM_LITERAL_CODES) { // Literal
|
1027
|
+
if (htree_group->is_trivial_literal) {
|
1028
|
+
*src = htree_group->literal_arb | (code << 8);
|
1029
|
+
} else {
|
1030
|
+
int red, blue, alpha;
|
1031
|
+
red = ReadSymbol(htree_group->htrees[RED], br);
|
1032
|
+
VP8LFillBitWindow(br);
|
1033
|
+
blue = ReadSymbol(htree_group->htrees[BLUE], br);
|
1034
|
+
alpha = ReadSymbol(htree_group->htrees[ALPHA], br);
|
1035
|
+
if (br->eos_) break;
|
1036
|
+
*src = ((uint32_t)alpha << 24) | (red << 16) | (code << 8) | blue;
|
1037
|
+
}
|
1038
|
+
AdvanceByOne:
|
1039
|
+
++src;
|
1040
|
+
++col;
|
1041
|
+
if (col >= width) {
|
1042
|
+
col = 0;
|
1043
|
+
++row;
|
1044
|
+
if ((row % NUM_ARGB_CACHE_ROWS == 0) && (process_func != NULL)) {
|
1045
|
+
process_func(dec, row);
|
1046
|
+
}
|
1047
|
+
if (color_cache != NULL) {
|
1048
|
+
while (last_cached < src) {
|
1049
|
+
VP8LColorCacheInsert(color_cache, *last_cached++);
|
1050
|
+
}
|
1051
|
+
}
|
1052
|
+
}
|
1053
|
+
} else if (code < len_code_limit) { // Backward reference
|
1054
|
+
int dist_code, dist;
|
1055
|
+
const int length_sym = code - NUM_LITERAL_CODES;
|
1056
|
+
const int length = GetCopyLength(length_sym, br);
|
1057
|
+
const int dist_symbol = ReadSymbol(htree_group->htrees[DIST], br);
|
1058
|
+
VP8LFillBitWindow(br);
|
1059
|
+
dist_code = GetCopyDistance(dist_symbol, br);
|
1060
|
+
dist = PlaneCodeToDistance(width, dist_code);
|
1061
|
+
if (br->eos_) break;
|
1062
|
+
if (src - data < (ptrdiff_t)dist || src_end - src < (ptrdiff_t)length) {
|
1063
|
+
goto Error;
|
1064
|
+
} else {
|
1065
|
+
CopyBlock32b(src, dist, length);
|
1066
|
+
}
|
1067
|
+
src += length;
|
1068
|
+
col += length;
|
1069
|
+
while (col >= width) {
|
1070
|
+
col -= width;
|
1071
|
+
++row;
|
1072
|
+
if ((row % NUM_ARGB_CACHE_ROWS == 0) && (process_func != NULL)) {
|
1073
|
+
process_func(dec, row);
|
1074
|
+
}
|
1075
|
+
}
|
1076
|
+
// Because of the check done above (before 'src' was incremented by
|
1077
|
+
// 'length'), the following holds true.
|
1078
|
+
assert(src <= src_end);
|
1079
|
+
if (col & mask) htree_group = GetHtreeGroupForPos(hdr, col, row);
|
1080
|
+
if (color_cache != NULL) {
|
1081
|
+
while (last_cached < src) {
|
1082
|
+
VP8LColorCacheInsert(color_cache, *last_cached++);
|
1083
|
+
}
|
1084
|
+
}
|
1085
|
+
} else if (code < color_cache_limit) { // Color cache
|
1086
|
+
const int key = code - len_code_limit;
|
1087
|
+
assert(color_cache != NULL);
|
1088
|
+
while (last_cached < src) {
|
1089
|
+
VP8LColorCacheInsert(color_cache, *last_cached++);
|
1090
|
+
}
|
1091
|
+
*src = VP8LColorCacheLookup(color_cache, key);
|
1092
|
+
goto AdvanceByOne;
|
1093
|
+
} else { // Not reached
|
1094
|
+
goto Error;
|
1095
|
+
}
|
1096
|
+
assert(br->eos_ == VP8LIsEndOfStream(br));
|
1097
|
+
}
|
1098
|
+
|
1099
|
+
if (dec->incremental_ && br->eos_ && src < src_end) {
|
1100
|
+
RestoreState(dec);
|
1101
|
+
} else if (!br->eos_) {
|
1102
|
+
// Process the remaining rows corresponding to last row-block.
|
1103
|
+
if (process_func != NULL) {
|
1104
|
+
process_func(dec, row);
|
1105
|
+
}
|
1106
|
+
dec->status_ = VP8_STATUS_OK;
|
1107
|
+
dec->last_pixel_ = (int)(src - data); // end-of-scan marker
|
1108
|
+
} else {
|
1109
|
+
// if not incremental, and we are past the end of buffer (eos_=1), then this
|
1110
|
+
// is a real bitstream error.
|
1111
|
+
goto Error;
|
1112
|
+
}
|
1113
|
+
return 1;
|
1114
|
+
|
1115
|
+
Error:
|
1116
|
+
dec->status_ = VP8_STATUS_BITSTREAM_ERROR;
|
1117
|
+
return 0;
|
1118
|
+
}
|
1119
|
+
|
1120
|
+
// -----------------------------------------------------------------------------
|
1121
|
+
// VP8LTransform
|
1122
|
+
|
1123
|
+
static void ClearTransform(VP8LTransform* const transform) {
|
1124
|
+
WebPSafeFree(transform->data_);
|
1125
|
+
transform->data_ = NULL;
|
1126
|
+
}
|
1127
|
+
|
1128
|
+
// For security reason, we need to remap the color map to span
|
1129
|
+
// the total possible bundled values, and not just the num_colors.
|
1130
|
+
static int ExpandColorMap(int num_colors, VP8LTransform* const transform) {
|
1131
|
+
int i;
|
1132
|
+
const int final_num_colors = 1 << (8 >> transform->bits_);
|
1133
|
+
uint32_t* const new_color_map =
|
1134
|
+
(uint32_t*)WebPSafeMalloc((uint64_t)final_num_colors,
|
1135
|
+
sizeof(*new_color_map));
|
1136
|
+
if (new_color_map == NULL) {
|
1137
|
+
return 0;
|
1138
|
+
} else {
|
1139
|
+
uint8_t* const data = (uint8_t*)transform->data_;
|
1140
|
+
uint8_t* const new_data = (uint8_t*)new_color_map;
|
1141
|
+
new_color_map[0] = transform->data_[0];
|
1142
|
+
for (i = 4; i < 4 * num_colors; ++i) {
|
1143
|
+
// Equivalent to AddPixelEq(), on a byte-basis.
|
1144
|
+
new_data[i] = (data[i] + new_data[i - 4]) & 0xff;
|
1145
|
+
}
|
1146
|
+
for (; i < 4 * final_num_colors; ++i)
|
1147
|
+
new_data[i] = 0; // black tail.
|
1148
|
+
WebPSafeFree(transform->data_);
|
1149
|
+
transform->data_ = new_color_map;
|
1150
|
+
}
|
1151
|
+
return 1;
|
1152
|
+
}
|
1153
|
+
|
1154
|
+
static int ReadTransform(int* const xsize, int const* ysize,
|
1155
|
+
VP8LDecoder* const dec) {
|
1156
|
+
int ok = 1;
|
1157
|
+
VP8LBitReader* const br = &dec->br_;
|
1158
|
+
VP8LTransform* transform = &dec->transforms_[dec->next_transform_];
|
1159
|
+
const VP8LImageTransformType type =
|
1160
|
+
(VP8LImageTransformType)VP8LReadBits(br, 2);
|
1161
|
+
|
1162
|
+
// Each transform type can only be present once in the stream.
|
1163
|
+
if (dec->transforms_seen_ & (1U << type)) {
|
1164
|
+
return 0; // Already there, let's not accept the second same transform.
|
1165
|
+
}
|
1166
|
+
dec->transforms_seen_ |= (1U << type);
|
1167
|
+
|
1168
|
+
transform->type_ = type;
|
1169
|
+
transform->xsize_ = *xsize;
|
1170
|
+
transform->ysize_ = *ysize;
|
1171
|
+
transform->data_ = NULL;
|
1172
|
+
++dec->next_transform_;
|
1173
|
+
assert(dec->next_transform_ <= NUM_TRANSFORMS);
|
1174
|
+
|
1175
|
+
switch (type) {
|
1176
|
+
case PREDICTOR_TRANSFORM:
|
1177
|
+
case CROSS_COLOR_TRANSFORM:
|
1178
|
+
transform->bits_ = VP8LReadBits(br, 3) + 2;
|
1179
|
+
ok = DecodeImageStream(VP8LSubSampleSize(transform->xsize_,
|
1180
|
+
transform->bits_),
|
1181
|
+
VP8LSubSampleSize(transform->ysize_,
|
1182
|
+
transform->bits_),
|
1183
|
+
0, dec, &transform->data_);
|
1184
|
+
break;
|
1185
|
+
case COLOR_INDEXING_TRANSFORM: {
|
1186
|
+
const int num_colors = VP8LReadBits(br, 8) + 1;
|
1187
|
+
const int bits = (num_colors > 16) ? 0
|
1188
|
+
: (num_colors > 4) ? 1
|
1189
|
+
: (num_colors > 2) ? 2
|
1190
|
+
: 3;
|
1191
|
+
*xsize = VP8LSubSampleSize(transform->xsize_, bits);
|
1192
|
+
transform->bits_ = bits;
|
1193
|
+
ok = DecodeImageStream(num_colors, 1, 0, dec, &transform->data_);
|
1194
|
+
ok = ok && ExpandColorMap(num_colors, transform);
|
1195
|
+
break;
|
1196
|
+
}
|
1197
|
+
case SUBTRACT_GREEN:
|
1198
|
+
break;
|
1199
|
+
default:
|
1200
|
+
assert(0); // can't happen
|
1201
|
+
break;
|
1202
|
+
}
|
1203
|
+
|
1204
|
+
return ok;
|
1205
|
+
}
|
1206
|
+
|
1207
|
+
// -----------------------------------------------------------------------------
|
1208
|
+
// VP8LMetadata
|
1209
|
+
|
1210
|
+
static void InitMetadata(VP8LMetadata* const hdr) {
|
1211
|
+
assert(hdr != NULL);
|
1212
|
+
memset(hdr, 0, sizeof(*hdr));
|
1213
|
+
}
|
1214
|
+
|
1215
|
+
static void ClearMetadata(VP8LMetadata* const hdr) {
|
1216
|
+
assert(hdr != NULL);
|
1217
|
+
|
1218
|
+
WebPSafeFree(hdr->huffman_image_);
|
1219
|
+
WebPSafeFree(hdr->huffman_tables_);
|
1220
|
+
VP8LHtreeGroupsFree(hdr->htree_groups_);
|
1221
|
+
VP8LColorCacheClear(&hdr->color_cache_);
|
1222
|
+
VP8LColorCacheClear(&hdr->saved_color_cache_);
|
1223
|
+
InitMetadata(hdr);
|
1224
|
+
}
|
1225
|
+
|
1226
|
+
// -----------------------------------------------------------------------------
|
1227
|
+
// VP8LDecoder
|
1228
|
+
|
1229
|
+
VP8LDecoder* VP8LNew(void) {
|
1230
|
+
VP8LDecoder* const dec = (VP8LDecoder*)WebPSafeCalloc(1ULL, sizeof(*dec));
|
1231
|
+
if (dec == NULL) return NULL;
|
1232
|
+
dec->status_ = VP8_STATUS_OK;
|
1233
|
+
dec->state_ = READ_DIM;
|
1234
|
+
|
1235
|
+
VP8LDspInit(); // Init critical function pointers.
|
1236
|
+
|
1237
|
+
return dec;
|
1238
|
+
}
|
1239
|
+
|
1240
|
+
void VP8LClear(VP8LDecoder* const dec) {
|
1241
|
+
int i;
|
1242
|
+
if (dec == NULL) return;
|
1243
|
+
ClearMetadata(&dec->hdr_);
|
1244
|
+
|
1245
|
+
WebPSafeFree(dec->pixels_);
|
1246
|
+
dec->pixels_ = NULL;
|
1247
|
+
for (i = 0; i < dec->next_transform_; ++i) {
|
1248
|
+
ClearTransform(&dec->transforms_[i]);
|
1249
|
+
}
|
1250
|
+
dec->next_transform_ = 0;
|
1251
|
+
dec->transforms_seen_ = 0;
|
1252
|
+
|
1253
|
+
WebPSafeFree(dec->rescaler_memory);
|
1254
|
+
dec->rescaler_memory = NULL;
|
1255
|
+
|
1256
|
+
dec->output_ = NULL; // leave no trace behind
|
1257
|
+
}
|
1258
|
+
|
1259
|
+
void VP8LDelete(VP8LDecoder* const dec) {
|
1260
|
+
if (dec != NULL) {
|
1261
|
+
VP8LClear(dec);
|
1262
|
+
WebPSafeFree(dec);
|
1263
|
+
}
|
1264
|
+
}
|
1265
|
+
|
1266
|
+
static void UpdateDecoder(VP8LDecoder* const dec, int width, int height) {
|
1267
|
+
VP8LMetadata* const hdr = &dec->hdr_;
|
1268
|
+
const int num_bits = hdr->huffman_subsample_bits_;
|
1269
|
+
dec->width_ = width;
|
1270
|
+
dec->height_ = height;
|
1271
|
+
|
1272
|
+
hdr->huffman_xsize_ = VP8LSubSampleSize(width, num_bits);
|
1273
|
+
hdr->huffman_mask_ = (num_bits == 0) ? ~0 : (1 << num_bits) - 1;
|
1274
|
+
}
|
1275
|
+
|
1276
|
+
static int DecodeImageStream(int xsize, int ysize,
|
1277
|
+
int is_level0,
|
1278
|
+
VP8LDecoder* const dec,
|
1279
|
+
uint32_t** const decoded_data) {
|
1280
|
+
int ok = 1;
|
1281
|
+
int transform_xsize = xsize;
|
1282
|
+
int transform_ysize = ysize;
|
1283
|
+
VP8LBitReader* const br = &dec->br_;
|
1284
|
+
VP8LMetadata* const hdr = &dec->hdr_;
|
1285
|
+
uint32_t* data = NULL;
|
1286
|
+
int color_cache_bits = 0;
|
1287
|
+
|
1288
|
+
// Read the transforms (may recurse).
|
1289
|
+
if (is_level0) {
|
1290
|
+
while (ok && VP8LReadBits(br, 1)) {
|
1291
|
+
ok = ReadTransform(&transform_xsize, &transform_ysize, dec);
|
1292
|
+
}
|
1293
|
+
}
|
1294
|
+
|
1295
|
+
// Color cache
|
1296
|
+
if (ok && VP8LReadBits(br, 1)) {
|
1297
|
+
color_cache_bits = VP8LReadBits(br, 4);
|
1298
|
+
ok = (color_cache_bits >= 1 && color_cache_bits <= MAX_CACHE_BITS);
|
1299
|
+
if (!ok) {
|
1300
|
+
dec->status_ = VP8_STATUS_BITSTREAM_ERROR;
|
1301
|
+
goto End;
|
1302
|
+
}
|
1303
|
+
}
|
1304
|
+
|
1305
|
+
// Read the Huffman codes (may recurse).
|
1306
|
+
ok = ok && ReadHuffmanCodes(dec, transform_xsize, transform_ysize,
|
1307
|
+
color_cache_bits, is_level0);
|
1308
|
+
if (!ok) {
|
1309
|
+
dec->status_ = VP8_STATUS_BITSTREAM_ERROR;
|
1310
|
+
goto End;
|
1311
|
+
}
|
1312
|
+
|
1313
|
+
// Finish setting up the color-cache
|
1314
|
+
if (color_cache_bits > 0) {
|
1315
|
+
hdr->color_cache_size_ = 1 << color_cache_bits;
|
1316
|
+
if (!VP8LColorCacheInit(&hdr->color_cache_, color_cache_bits)) {
|
1317
|
+
dec->status_ = VP8_STATUS_OUT_OF_MEMORY;
|
1318
|
+
ok = 0;
|
1319
|
+
goto End;
|
1320
|
+
}
|
1321
|
+
} else {
|
1322
|
+
hdr->color_cache_size_ = 0;
|
1323
|
+
}
|
1324
|
+
UpdateDecoder(dec, transform_xsize, transform_ysize);
|
1325
|
+
|
1326
|
+
if (is_level0) { // level 0 complete
|
1327
|
+
dec->state_ = READ_HDR;
|
1328
|
+
goto End;
|
1329
|
+
}
|
1330
|
+
|
1331
|
+
{
|
1332
|
+
const uint64_t total_size = (uint64_t)transform_xsize * transform_ysize;
|
1333
|
+
data = (uint32_t*)WebPSafeMalloc(total_size, sizeof(*data));
|
1334
|
+
if (data == NULL) {
|
1335
|
+
dec->status_ = VP8_STATUS_OUT_OF_MEMORY;
|
1336
|
+
ok = 0;
|
1337
|
+
goto End;
|
1338
|
+
}
|
1339
|
+
}
|
1340
|
+
|
1341
|
+
// Use the Huffman trees to decode the LZ77 encoded data.
|
1342
|
+
ok = DecodeImageData(dec, data, transform_xsize, transform_ysize,
|
1343
|
+
transform_ysize, NULL);
|
1344
|
+
ok = ok && !br->eos_;
|
1345
|
+
|
1346
|
+
End:
|
1347
|
+
if (!ok) {
|
1348
|
+
WebPSafeFree(data);
|
1349
|
+
ClearMetadata(hdr);
|
1350
|
+
} else {
|
1351
|
+
if (decoded_data != NULL) {
|
1352
|
+
*decoded_data = data;
|
1353
|
+
} else {
|
1354
|
+
// We allocate image data in this function only for transforms. At level 0
|
1355
|
+
// (that is: not the transforms), we shouldn't have allocated anything.
|
1356
|
+
assert(data == NULL);
|
1357
|
+
assert(is_level0);
|
1358
|
+
}
|
1359
|
+
dec->last_pixel_ = 0; // Reset for future DECODE_DATA_FUNC() calls.
|
1360
|
+
if (!is_level0) ClearMetadata(hdr); // Clean up temporary data behind.
|
1361
|
+
}
|
1362
|
+
return ok;
|
1363
|
+
}
|
1364
|
+
|
1365
|
+
//------------------------------------------------------------------------------
|
1366
|
+
// Allocate internal buffers dec->pixels_ and dec->argb_cache_.
|
1367
|
+
static int AllocateInternalBuffers32b(VP8LDecoder* const dec, int final_width) {
|
1368
|
+
const uint64_t num_pixels = (uint64_t)dec->width_ * dec->height_;
|
1369
|
+
// Scratch buffer corresponding to top-prediction row for transforming the
|
1370
|
+
// first row in the row-blocks. Not needed for paletted alpha.
|
1371
|
+
const uint64_t cache_top_pixels = (uint16_t)final_width;
|
1372
|
+
// Scratch buffer for temporary BGRA storage. Not needed for paletted alpha.
|
1373
|
+
const uint64_t cache_pixels = (uint64_t)final_width * NUM_ARGB_CACHE_ROWS;
|
1374
|
+
const uint64_t total_num_pixels =
|
1375
|
+
num_pixels + cache_top_pixels + cache_pixels;
|
1376
|
+
|
1377
|
+
assert(dec->width_ <= final_width);
|
1378
|
+
dec->pixels_ = (uint32_t*)WebPSafeMalloc(total_num_pixels, sizeof(uint32_t));
|
1379
|
+
if (dec->pixels_ == NULL) {
|
1380
|
+
dec->argb_cache_ = NULL; // for sanity check
|
1381
|
+
dec->status_ = VP8_STATUS_OUT_OF_MEMORY;
|
1382
|
+
return 0;
|
1383
|
+
}
|
1384
|
+
dec->argb_cache_ = dec->pixels_ + num_pixels + cache_top_pixels;
|
1385
|
+
return 1;
|
1386
|
+
}
|
1387
|
+
|
1388
|
+
static int AllocateInternalBuffers8b(VP8LDecoder* const dec) {
|
1389
|
+
const uint64_t total_num_pixels = (uint64_t)dec->width_ * dec->height_;
|
1390
|
+
dec->argb_cache_ = NULL; // for sanity check
|
1391
|
+
dec->pixels_ = (uint32_t*)WebPSafeMalloc(total_num_pixels, sizeof(uint8_t));
|
1392
|
+
if (dec->pixels_ == NULL) {
|
1393
|
+
dec->status_ = VP8_STATUS_OUT_OF_MEMORY;
|
1394
|
+
return 0;
|
1395
|
+
}
|
1396
|
+
return 1;
|
1397
|
+
}
|
1398
|
+
|
1399
|
+
//------------------------------------------------------------------------------
|
1400
|
+
|
1401
|
+
// Special row-processing that only stores the alpha data.
|
1402
|
+
static void ExtractAlphaRows(VP8LDecoder* const dec, int row) {
|
1403
|
+
const int num_rows = row - dec->last_row_;
|
1404
|
+
const uint32_t* const in = dec->pixels_ + dec->width_ * dec->last_row_;
|
1405
|
+
|
1406
|
+
if (num_rows <= 0) return; // Nothing to be done.
|
1407
|
+
ApplyInverseTransforms(dec, num_rows, in);
|
1408
|
+
|
1409
|
+
// Extract alpha (which is stored in the green plane).
|
1410
|
+
{
|
1411
|
+
const int width = dec->io_->width; // the final width (!= dec->width_)
|
1412
|
+
const int cache_pixs = width * num_rows;
|
1413
|
+
uint8_t* const dst = (uint8_t*)dec->io_->opaque + width * dec->last_row_;
|
1414
|
+
const uint32_t* const src = dec->argb_cache_;
|
1415
|
+
int i;
|
1416
|
+
for (i = 0; i < cache_pixs; ++i) dst[i] = (src[i] >> 8) & 0xff;
|
1417
|
+
}
|
1418
|
+
dec->last_row_ = dec->last_out_row_ = row;
|
1419
|
+
}
|
1420
|
+
|
1421
|
+
int VP8LDecodeAlphaHeader(ALPHDecoder* const alph_dec,
|
1422
|
+
const uint8_t* const data, size_t data_size,
|
1423
|
+
uint8_t* const output) {
|
1424
|
+
int ok = 0;
|
1425
|
+
VP8LDecoder* dec;
|
1426
|
+
VP8Io* io;
|
1427
|
+
assert(alph_dec != NULL);
|
1428
|
+
alph_dec->vp8l_dec_ = VP8LNew();
|
1429
|
+
if (alph_dec->vp8l_dec_ == NULL) return 0;
|
1430
|
+
dec = alph_dec->vp8l_dec_;
|
1431
|
+
|
1432
|
+
dec->width_ = alph_dec->width_;
|
1433
|
+
dec->height_ = alph_dec->height_;
|
1434
|
+
dec->io_ = &alph_dec->io_;
|
1435
|
+
io = dec->io_;
|
1436
|
+
|
1437
|
+
VP8InitIo(io);
|
1438
|
+
WebPInitCustomIo(NULL, io); // Just a sanity Init. io won't be used.
|
1439
|
+
io->opaque = output;
|
1440
|
+
io->width = alph_dec->width_;
|
1441
|
+
io->height = alph_dec->height_;
|
1442
|
+
|
1443
|
+
dec->status_ = VP8_STATUS_OK;
|
1444
|
+
VP8LInitBitReader(&dec->br_, data, data_size);
|
1445
|
+
|
1446
|
+
if (!DecodeImageStream(alph_dec->width_, alph_dec->height_, 1, dec, NULL)) {
|
1447
|
+
goto Err;
|
1448
|
+
}
|
1449
|
+
|
1450
|
+
// Special case: if alpha data uses only the color indexing transform and
|
1451
|
+
// doesn't use color cache (a frequent case), we will use DecodeAlphaData()
|
1452
|
+
// method that only needs allocation of 1 byte per pixel (alpha channel).
|
1453
|
+
if (dec->next_transform_ == 1 &&
|
1454
|
+
dec->transforms_[0].type_ == COLOR_INDEXING_TRANSFORM &&
|
1455
|
+
Is8bOptimizable(&dec->hdr_)) {
|
1456
|
+
alph_dec->use_8b_decode = 1;
|
1457
|
+
ok = AllocateInternalBuffers8b(dec);
|
1458
|
+
} else {
|
1459
|
+
// Allocate internal buffers (note that dec->width_ may have changed here).
|
1460
|
+
alph_dec->use_8b_decode = 0;
|
1461
|
+
ok = AllocateInternalBuffers32b(dec, alph_dec->width_);
|
1462
|
+
}
|
1463
|
+
|
1464
|
+
if (!ok) goto Err;
|
1465
|
+
|
1466
|
+
return 1;
|
1467
|
+
|
1468
|
+
Err:
|
1469
|
+
VP8LDelete(alph_dec->vp8l_dec_);
|
1470
|
+
alph_dec->vp8l_dec_ = NULL;
|
1471
|
+
return 0;
|
1472
|
+
}
|
1473
|
+
|
1474
|
+
int VP8LDecodeAlphaImageStream(ALPHDecoder* const alph_dec, int last_row) {
|
1475
|
+
VP8LDecoder* const dec = alph_dec->vp8l_dec_;
|
1476
|
+
assert(dec != NULL);
|
1477
|
+
assert(last_row <= dec->height_);
|
1478
|
+
|
1479
|
+
if (dec->last_pixel_ == dec->width_ * dec->height_) {
|
1480
|
+
return 1; // done
|
1481
|
+
}
|
1482
|
+
|
1483
|
+
// Decode (with special row processing).
|
1484
|
+
return alph_dec->use_8b_decode ?
|
1485
|
+
DecodeAlphaData(dec, (uint8_t*)dec->pixels_, dec->width_, dec->height_,
|
1486
|
+
last_row) :
|
1487
|
+
DecodeImageData(dec, dec->pixels_, dec->width_, dec->height_,
|
1488
|
+
last_row, ExtractAlphaRows);
|
1489
|
+
}
|
1490
|
+
|
1491
|
+
//------------------------------------------------------------------------------
|
1492
|
+
|
1493
|
+
int VP8LDecodeHeader(VP8LDecoder* const dec, VP8Io* const io) {
|
1494
|
+
int width, height, has_alpha;
|
1495
|
+
|
1496
|
+
if (dec == NULL) return 0;
|
1497
|
+
if (io == NULL) {
|
1498
|
+
dec->status_ = VP8_STATUS_INVALID_PARAM;
|
1499
|
+
return 0;
|
1500
|
+
}
|
1501
|
+
|
1502
|
+
dec->io_ = io;
|
1503
|
+
dec->status_ = VP8_STATUS_OK;
|
1504
|
+
VP8LInitBitReader(&dec->br_, io->data, io->data_size);
|
1505
|
+
if (!ReadImageInfo(&dec->br_, &width, &height, &has_alpha)) {
|
1506
|
+
dec->status_ = VP8_STATUS_BITSTREAM_ERROR;
|
1507
|
+
goto Error;
|
1508
|
+
}
|
1509
|
+
dec->state_ = READ_DIM;
|
1510
|
+
io->width = width;
|
1511
|
+
io->height = height;
|
1512
|
+
|
1513
|
+
if (!DecodeImageStream(width, height, 1, dec, NULL)) goto Error;
|
1514
|
+
return 1;
|
1515
|
+
|
1516
|
+
Error:
|
1517
|
+
VP8LClear(dec);
|
1518
|
+
assert(dec->status_ != VP8_STATUS_OK);
|
1519
|
+
return 0;
|
1520
|
+
}
|
1521
|
+
|
1522
|
+
int VP8LDecodeImage(VP8LDecoder* const dec) {
|
1523
|
+
VP8Io* io = NULL;
|
1524
|
+
WebPDecParams* params = NULL;
|
1525
|
+
|
1526
|
+
// Sanity checks.
|
1527
|
+
if (dec == NULL) return 0;
|
1528
|
+
|
1529
|
+
assert(dec->hdr_.huffman_tables_ != NULL);
|
1530
|
+
assert(dec->hdr_.htree_groups_ != NULL);
|
1531
|
+
assert(dec->hdr_.num_htree_groups_ > 0);
|
1532
|
+
|
1533
|
+
io = dec->io_;
|
1534
|
+
assert(io != NULL);
|
1535
|
+
params = (WebPDecParams*)io->opaque;
|
1536
|
+
assert(params != NULL);
|
1537
|
+
|
1538
|
+
// Initialization.
|
1539
|
+
if (dec->state_ != READ_DATA) {
|
1540
|
+
dec->output_ = params->output;
|
1541
|
+
assert(dec->output_ != NULL);
|
1542
|
+
|
1543
|
+
if (!WebPIoInitFromOptions(params->options, io, MODE_BGRA)) {
|
1544
|
+
dec->status_ = VP8_STATUS_INVALID_PARAM;
|
1545
|
+
goto Err;
|
1546
|
+
}
|
1547
|
+
|
1548
|
+
if (!AllocateInternalBuffers32b(dec, io->width)) goto Err;
|
1549
|
+
|
1550
|
+
if (io->use_scaling && !AllocateAndInitRescaler(dec, io)) goto Err;
|
1551
|
+
|
1552
|
+
if (io->use_scaling || WebPIsPremultipliedMode(dec->output_->colorspace)) {
|
1553
|
+
// need the alpha-multiply functions for premultiplied output or rescaling
|
1554
|
+
WebPInitAlphaProcessing();
|
1555
|
+
}
|
1556
|
+
if (dec->incremental_) {
|
1557
|
+
if (dec->hdr_.color_cache_size_ > 0 &&
|
1558
|
+
dec->hdr_.saved_color_cache_.colors_ == NULL) {
|
1559
|
+
if (!VP8LColorCacheInit(&dec->hdr_.saved_color_cache_,
|
1560
|
+
dec->hdr_.color_cache_.hash_bits_)) {
|
1561
|
+
dec->status_ = VP8_STATUS_OUT_OF_MEMORY;
|
1562
|
+
goto Err;
|
1563
|
+
}
|
1564
|
+
}
|
1565
|
+
}
|
1566
|
+
dec->state_ = READ_DATA;
|
1567
|
+
}
|
1568
|
+
|
1569
|
+
// Decode.
|
1570
|
+
if (!DecodeImageData(dec, dec->pixels_, dec->width_, dec->height_,
|
1571
|
+
dec->height_, ProcessRows)) {
|
1572
|
+
goto Err;
|
1573
|
+
}
|
1574
|
+
|
1575
|
+
params->last_y = dec->last_out_row_;
|
1576
|
+
return 1;
|
1577
|
+
|
1578
|
+
Err:
|
1579
|
+
VP8LClear(dec);
|
1580
|
+
assert(dec->status_ != VP8_STATUS_OK);
|
1581
|
+
return 0;
|
1582
|
+
}
|
1583
|
+
|
1584
|
+
//------------------------------------------------------------------------------
|