diff options
author | Thomas Deutschmann <whissi@gentoo.org> | 2020-09-10 18:10:49 +0200 |
---|---|---|
committer | Thomas Deutschmann <whissi@gentoo.org> | 2020-09-11 20:06:36 +0200 |
commit | acfc02c1747065fe450c7cfeb6f1844b62335f08 (patch) | |
tree | 5887806a2e6b99bbb0255e013a9028810e230a7f /lcms2mt | |
parent | Import Ghostscript 9.52 (diff) | |
download | ghostscript-gpl-patches-acfc02c1747065fe450c7cfeb6f1844b62335f08.tar.gz ghostscript-gpl-patches-acfc02c1747065fe450c7cfeb6f1844b62335f08.tar.bz2 ghostscript-gpl-patches-acfc02c1747065fe450c7cfeb6f1844b62335f08.zip |
Import Ghostscript 9.53ghostscript-9.53
Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
Diffstat (limited to 'lcms2mt')
149 files changed, 14572 insertions, 4008 deletions
diff --git a/lcms2mt/AUTHORS b/lcms2mt/AUTHORS index dd801a9d..d581f086 100644 --- a/lcms2mt/AUTHORS +++ b/lcms2mt/AUTHORS @@ -38,6 +38,7 @@ Thomas Weber (Debian) Mark Allen Noel Carboni Sergei Trofimovic +Philipp Knechtges Special Thanks -------------- diff --git a/lcms2mt/COPYING b/lcms2mt/COPYING index fda5c9eb..21ed6fb8 100644 --- a/lcms2mt/COPYING +++ b/lcms2mt/COPYING @@ -1,5 +1,5 @@ Little CMS -Copyright (c) 1998-2011 Marti Maria Saguer +Copyright (c) 1998-2020 Marti Maria Saguer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/lcms2mt/ChangeLog b/lcms2mt/ChangeLog index 9a30cd41..81a38b9d 100644 --- a/lcms2mt/ChangeLog +++ b/lcms2mt/ChangeLog @@ -1,14 +1,16 @@ + LCMS2MT ChangeLog: + ------------------------ -2.9.art Featured release +2.10.art Featured release ------------------------ -Merge 2.9 with 2.8.art. +Merge 2.10 with 2.9.art. ------------------------ -2.9 Maintenance release +2.9.art Featured release ------------------------ -No changelog provided. +Merge 2.9 with 2.8.art. ------------------------ 2.8.art Featured release @@ -21,6 +23,26 @@ Removed the 'THR' API functions as now unnecessary. Changed LCMS_VERSION (and checking logic). Extend T_EXTRA etc to allow for 63 extra channels. + + Vanilla LCMS2 Changelog: + ~~~~~~~~~~~~~~~~~~~~~~~~ + +------------------------ +2.9 Maintenance release +------------------------ + +No changelog provided. + +----------------------- +2.10 Featured release +----------------------- +Added a compilation toggle to remove "register" keyword in API. +Previously commercial, fast_float plug-in is now released as open source under GPL3 license. +MD5 functions are now accesible through plug-in API. +Added support for Visual Studio 2019 +Bug fixing. + + ----------------------- 2.9 Maintenance release ----------------------- diff --git a/lcms2mt/Makefile.am b/lcms2mt/Makefile.am index bf3c37b0..4c25794d 100644 --- a/lcms2mt/Makefile.am +++ b/lcms2mt/Makefile.am @@ -14,10 +14,10 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ SUBDIRS = src include utils/tificc utils/transicc utils/linkicc utils/jpgicc utils/psicc testbed # Additional files to distribute -EXTRA_DIST = AUTHORS COPYING ChangeLog doc Projects include bin Lib INSTALL README.1ST autogen.sh lcms2.pc.in +EXTRA_DIST = AUTHORS COPYING ChangeLog doc Projects include bin Lib INSTALL README.1ST autogen.sh lcms2.pc.in plugins pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = lcms2.pc +pkgconfig_DATA = lcms2mt.pc # Get names of plug-ins in the source package PLUGIN_DIRECTORIES = $(sort $(dir $(wildcard plugins/*/))) @@ -39,17 +39,12 @@ clean-local: # Handle plug-ins all-local: @for d in $(PLUGIN_DIRECTORIES); do (cd $$d; $(MAKE) $(AM_MAKEFLAGS) all ); done - + check-local: @for d in $(PLUGIN_DIRECTORIES); do (cd $$d; $(MAKE) $(AM_MAKEFLAGS) check ); done - + install-exec-local: @for d in $(PLUGIN_DIRECTORIES); do (cd $$d; $(MAKE) $(AM_MAKEFLAGS) install-exec ); done uninstall-local: @for d in $(PLUGIN_DIRECTORIES); do (cd $$d; $(MAKE) $(AM_MAKEFLAGS) uninstall ); done - - - - - diff --git a/lcms2mt/Makefile.in b/lcms2mt/Makefile.in index 5ba77459..9bc16049 100644 --- a/lcms2mt/Makefile.in +++ b/lcms2mt/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -110,7 +110,7 @@ DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d -CONFIG_CLEAN_FILES = lcms2.pc +CONFIG_CLEAN_FILES = lcms2mt.pc CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) @@ -175,7 +175,7 @@ am__recursive_targets = \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ - cscope distdir dist dist-all distcheck + cscope distdir distdir-am dist dist-all distcheck am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is @@ -197,9 +197,9 @@ ETAGS = etags CTAGS = ctags CSCOPE = cscope DIST_SUBDIRS = $(SUBDIRS) -am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/lcms2.pc.in AUTHORS \ - COPYING ChangeLog INSTALL compile config.guess config.sub \ - depcomp install-sh ltmain.sh missing +am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/lcms2mt.pc.in \ + AUTHORS COPYING ChangeLog INSTALL compile config.guess \ + config.sub depcomp install-sh ltmain.sh missing DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) @@ -391,9 +391,9 @@ ACLOCAL_AMFLAGS = -I m4 SUBDIRS = src include utils/tificc utils/transicc utils/linkicc utils/jpgicc utils/psicc testbed # Additional files to distribute -EXTRA_DIST = AUTHORS COPYING ChangeLog doc Projects include bin Lib INSTALL README.1ST autogen.sh lcms2.pc.in +EXTRA_DIST = AUTHORS COPYING ChangeLog doc Projects include bin Lib INSTALL README.1ST autogen.sh lcms2.pc.in plugins pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = lcms2.pc +pkgconfig_DATA = lcms2mt.pc # Get names of plug-ins in the source package PLUGIN_DIRECTORIES = $(sort $(dir $(wildcard plugins/*/))) @@ -421,8 +421,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -433,7 +433,7 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): -lcms2.pc: $(top_builddir)/config.status $(srcdir)/lcms2.pc.in +lcms2mt.pc: $(top_builddir)/config.status $(srcdir)/lcms2mt.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ mostlyclean-libtool: @@ -572,7 +572,10 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ @@ -637,7 +640,7 @@ distdir: $(DISTFILES) ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz $(am__post_remove_distdir) dist-bzip2: distdir @@ -663,7 +666,7 @@ dist-shar: distdir @echo WARNING: "Support for shar distribution archives is" \ "deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 - shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir -rm -f $(distdir).zip @@ -680,7 +683,7 @@ dist dist-all: distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ - GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ + eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ @@ -690,7 +693,7 @@ distcheck: dist *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ - GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ + eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac diff --git a/lcms2mt/Projects/BorlandC_5.5/lcms2mt.rc b/lcms2mt/Projects/BorlandC_5.5/lcms2mt.rc new file mode 100644 index 00000000..4446318c --- /dev/null +++ b/lcms2mt/Projects/BorlandC_5.5/lcms2mt.rc @@ -0,0 +1,30 @@ + + +1 VERSIONINFO +FILEVERSION 2, 8, 0, 0 +PRODUCTVERSION 2, 8, 0, 0 +FILEOS VOS_NT_WINDOWS32 +FILETYPE VFT_DLL +{ + BLOCK "StringFileInfo" + { + BLOCK "040904E4" + { + VALUE "CompanyName", "Marti Maria\000\000" + VALUE "FileDescription", "lcms color engine\000" + VALUE "FileVersion", "2.10\000\000" + VALUE "InternalName", "lcms2\000" + VALUE "LegalCopyright", "Copyright © Marti Maria 2020\000\000" + VALUE "OriginalFilename", "lcms2mt.dll\000" + } + + } + + BLOCK "VarFileInfo" + { + VALUE "Translation", 0x409, 1252 + } + +} + + diff --git a/lcms2mt/Projects/BorlandC_5.5/lcmsdll.lk b/lcms2mt/Projects/BorlandC_5.5/lcmsdll.lk index ed4c0fcf..637442d0 100644 --- a/lcms2mt/Projects/BorlandC_5.5/lcmsdll.lk +++ b/lcms2mt/Projects/BorlandC_5.5/lcmsdll.lk @@ -25,7 +25,7 @@ cmstypes.obj+ cmsvirt.obj+ cmswtpnt.obj+ cmsxform.obj -..\..\bin\lcms2.dll +..\..\bin\lcms2mt.dll cw32mt.lib import32.lib -..\..\src\lcms2.def
\ No newline at end of file +..\..\src\lcms2mt.def
\ No newline at end of file diff --git a/lcms2mt/Projects/VC2013/lcms2mt.rc b/lcms2mt/Projects/VC2013/lcms2mt.rc index 40768274..9f7e813c 100644 --- a/lcms2mt/Projects/VC2013/lcms2mt.rc +++ b/lcms2mt/Projects/VC2013/lcms2mt.rc @@ -27,8 +27,8 @@ LANGUAGE LANG_SPANISH, SUBLANG_SPANISH_MODERN // 1 VERSIONINFO - FILEVERSION 2,9,0,0 - PRODUCTVERSION 2,9,0,0 + FILEVERSION 2,10,0,0 + PRODUCTVERSION 2,10,0,0 FILEFLAGSMASK 0x0L #ifdef _DEBUG FILEFLAGS 0x1L @@ -45,12 +45,12 @@ BEGIN BEGIN VALUE "CompanyName", "Marti Maria" VALUE "FileDescription", "lcms color engine" - VALUE "FileVersion", "2.9.0.0" + VALUE "FileVersion", "2.10.0.0" VALUE "InternalName", "lcms" - VALUE "LegalCopyright", "Copyright © Marti Maria 2017" - VALUE "OriginalFilename", "lcms2mt.dll" + VALUE "LegalCopyright", "Copyright © Marti Maria 2020" + VALUE "OriginalFilename", "lcms2.dll" VALUE "ProductName", "LittleCMS color engine" - VALUE "ProductVersion", "2.9.0.0" + VALUE "ProductVersion", "2.10.0.0" END END BLOCK "VarFileInfo" diff --git a/lcms2mt/Projects/VC2013/lcms2mt.sln b/lcms2mt/Projects/VC2013/lcms2mt.sln Binary files differindex 75035059..2d44cba3 100644 --- a/lcms2mt/Projects/VC2013/lcms2mt.sln +++ b/lcms2mt/Projects/VC2013/lcms2mt.sln diff --git a/lcms2mt/Projects/VC2013/lcms2mt_DLL/lcms2mt_DLL.vcxproj b/lcms2mt/Projects/VC2013/lcms2mt_DLL/lcms2mt_DLL.vcxproj index 7f73cdeb..81addf6c 100644 --- a/lcms2mt/Projects/VC2013/lcms2mt_DLL/lcms2mt_DLL.vcxproj +++ b/lcms2mt/Projects/VC2013/lcms2mt_DLL/lcms2mt_DLL.vcxproj @@ -20,7 +20,7 @@ </ItemGroup> <PropertyGroup Label="Globals"> <ProjectGuid>{8C51BE48-ADB8-4089-A9EC-F6BF993A0548}</ProjectGuid> - <RootNamespace>lcms2mt_DLL</RootNamespace> + <RootNamespace>lcms2_DLL</RootNamespace> <Keyword>Win32Proj</Keyword> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> @@ -90,16 +90,16 @@ <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <TargetName>lcms2mt</TargetName> + <TargetName>lcms2</TargetName> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <TargetName>lcms2mt</TargetName> + <TargetName>lcms2</TargetName> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <TargetName>lcms2mt</TargetName> + <TargetName>lcms2</TargetName> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <TargetName>lcms2mt</TargetName> + <TargetName>lcms2</TargetName> </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ClCompile> @@ -116,7 +116,7 @@ <MultiProcessorCompilation>true</MultiProcessorCompilation> </ClCompile> <Link> - <ModuleDefinitionFile>..\..\..\src\lcms2mt.def</ModuleDefinitionFile> + <ModuleDefinitionFile>..\..\..\src\lcms2.def</ModuleDefinitionFile> <GenerateDebugInformation>true</GenerateDebugInformation> <SubSystem>Windows</SubSystem> <TargetMachine>MachineX86</TargetMachine> @@ -165,7 +165,7 @@ <BrowseInformation>true</BrowseInformation> </ClCompile> <Link> - <ModuleDefinitionFile>..\..\..\src\lcms2mt.def</ModuleDefinitionFile> + <ModuleDefinitionFile>..\..\..\src\lcms2.def</ModuleDefinitionFile> <GenerateDebugInformation>true</GenerateDebugInformation> <SubSystem>Windows</SubSystem> <OptimizeReferences>true</OptimizeReferences> @@ -234,18 +234,18 @@ <ClCompile Include="..\..\..\src\cmsxform.c" /> </ItemGroup> <ItemGroup> - <CustomBuild Include="..\..\..\src\lcms2mt.def"> + <CustomBuild Include="..\..\..\src\lcms2.def"> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> </CustomBuild> </ItemGroup> <ItemGroup> <ClInclude Include="..\..\..\src\lcms2_internal.h" /> - <ClInclude Include="..\..\..\include\lcms2mt.h" /> - <ClInclude Include="..\..\..\include\lcms2mt_plugin.h" /> + <ClInclude Include="..\..\..\include\lcms2.h" /> + <ClInclude Include="..\..\..\include\lcms2_plugin.h" /> <ClInclude Include="..\resource.h" /> </ItemGroup> <ItemGroup> - <ResourceCompile Include="..\lcms2mt.rc" /> + <ResourceCompile Include="..\lcms2.rc" /> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> diff --git a/lcms2mt/Projects/VC2015/lcms2mt.rc b/lcms2mt/Projects/VC2015/lcms2mt.rc index 40768274..9f7e813c 100644 --- a/lcms2mt/Projects/VC2015/lcms2mt.rc +++ b/lcms2mt/Projects/VC2015/lcms2mt.rc @@ -27,8 +27,8 @@ LANGUAGE LANG_SPANISH, SUBLANG_SPANISH_MODERN // 1 VERSIONINFO - FILEVERSION 2,9,0,0 - PRODUCTVERSION 2,9,0,0 + FILEVERSION 2,10,0,0 + PRODUCTVERSION 2,10,0,0 FILEFLAGSMASK 0x0L #ifdef _DEBUG FILEFLAGS 0x1L @@ -45,12 +45,12 @@ BEGIN BEGIN VALUE "CompanyName", "Marti Maria" VALUE "FileDescription", "lcms color engine" - VALUE "FileVersion", "2.9.0.0" + VALUE "FileVersion", "2.10.0.0" VALUE "InternalName", "lcms" - VALUE "LegalCopyright", "Copyright © Marti Maria 2017" - VALUE "OriginalFilename", "lcms2mt.dll" + VALUE "LegalCopyright", "Copyright © Marti Maria 2020" + VALUE "OriginalFilename", "lcms2.dll" VALUE "ProductName", "LittleCMS color engine" - VALUE "ProductVersion", "2.9.0.0" + VALUE "ProductVersion", "2.10.0.0" END END BLOCK "VarFileInfo" diff --git a/lcms2mt/Projects/VC2015/lcms2mt.sln b/lcms2mt/Projects/VC2015/lcms2mt.sln Binary files differindex 402cb8ed..5a58ab79 100644 --- a/lcms2mt/Projects/VC2015/lcms2mt.sln +++ b/lcms2mt/Projects/VC2015/lcms2mt.sln diff --git a/lcms2mt/Projects/VC2015/lcms2mt_DLL/lcms2mt_DLL.vcxproj b/lcms2mt/Projects/VC2015/lcms2mt_DLL/lcms2mt_DLL.vcxproj index c169da69..08495c33 100644 --- a/lcms2mt/Projects/VC2015/lcms2mt_DLL/lcms2mt_DLL.vcxproj +++ b/lcms2mt/Projects/VC2015/lcms2mt_DLL/lcms2mt_DLL.vcxproj @@ -248,4 +248,4 @@ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> -</Project> +</Project>
\ No newline at end of file diff --git a/lcms2mt/Projects/VC2015/lcms2mt_DLL/lcms2mt_DLL.vcxproj.filters b/lcms2mt/Projects/VC2015/lcms2mt_DLL/lcms2mt_DLL.vcxproj.filters index 4d685cce..c9542c76 100644 --- a/lcms2mt/Projects/VC2015/lcms2mt_DLL/lcms2mt_DLL.vcxproj.filters +++ b/lcms2mt/Projects/VC2015/lcms2mt_DLL/lcms2mt_DLL.vcxproj.filters @@ -118,4 +118,4 @@ <Filter>Source Files</Filter> </CustomBuild> </ItemGroup> -</Project> +</Project>
\ No newline at end of file diff --git a/lcms2mt/Projects/VC2015/lcms2mt_static/lcms2mt_static.vcxproj b/lcms2mt/Projects/VC2015/lcms2mt_static/lcms2mt_static.vcxproj index 359e67ae..8a49f611 100644 --- a/lcms2mt/Projects/VC2015/lcms2mt_static/lcms2mt_static.vcxproj +++ b/lcms2mt/Projects/VC2015/lcms2mt_static/lcms2mt_static.vcxproj @@ -205,4 +205,4 @@ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> -</Project> +</Project>
\ No newline at end of file diff --git a/lcms2mt/Projects/VC2015/lcms2mt_static/lcms2mt_static.vcxproj.filters b/lcms2mt/Projects/VC2015/lcms2mt_static/lcms2mt_static.vcxproj.filters index fdb81018..91149825 100644 --- a/lcms2mt/Projects/VC2015/lcms2mt_static/lcms2mt_static.vcxproj.filters +++ b/lcms2mt/Projects/VC2015/lcms2mt_static/lcms2mt_static.vcxproj.filters @@ -105,4 +105,4 @@ <Filter>Source Files</Filter> </ClInclude> </ItemGroup> -</Project> +</Project>
\ No newline at end of file diff --git a/lcms2mt/Projects/VC2017/lcms2mt.rc b/lcms2mt/Projects/VC2017/lcms2mt.rc index 40768274..9f7e813c 100644 --- a/lcms2mt/Projects/VC2017/lcms2mt.rc +++ b/lcms2mt/Projects/VC2017/lcms2mt.rc @@ -27,8 +27,8 @@ LANGUAGE LANG_SPANISH, SUBLANG_SPANISH_MODERN // 1 VERSIONINFO - FILEVERSION 2,9,0,0 - PRODUCTVERSION 2,9,0,0 + FILEVERSION 2,10,0,0 + PRODUCTVERSION 2,10,0,0 FILEFLAGSMASK 0x0L #ifdef _DEBUG FILEFLAGS 0x1L @@ -45,12 +45,12 @@ BEGIN BEGIN VALUE "CompanyName", "Marti Maria" VALUE "FileDescription", "lcms color engine" - VALUE "FileVersion", "2.9.0.0" + VALUE "FileVersion", "2.10.0.0" VALUE "InternalName", "lcms" - VALUE "LegalCopyright", "Copyright © Marti Maria 2017" - VALUE "OriginalFilename", "lcms2mt.dll" + VALUE "LegalCopyright", "Copyright © Marti Maria 2020" + VALUE "OriginalFilename", "lcms2.dll" VALUE "ProductName", "LittleCMS color engine" - VALUE "ProductVersion", "2.9.0.0" + VALUE "ProductVersion", "2.10.0.0" END END BLOCK "VarFileInfo" diff --git a/lcms2mt/Projects/VC2017/lcms2mt.sln b/lcms2mt/Projects/VC2017/lcms2mt.sln Binary files differindex 402cb8ed..5a58ab79 100644 --- a/lcms2mt/Projects/VC2017/lcms2mt.sln +++ b/lcms2mt/Projects/VC2017/lcms2mt.sln diff --git a/lcms2mt/Projects/VC2017/lcms2mt_DLL/lcms2mt_DLL.vcxproj b/lcms2mt/Projects/VC2017/lcms2mt_DLL/lcms2mt_DLL.vcxproj index e258c0de..8ae9c120 100644 --- a/lcms2mt/Projects/VC2017/lcms2mt_DLL/lcms2mt_DLL.vcxproj +++ b/lcms2mt/Projects/VC2017/lcms2mt_DLL/lcms2mt_DLL.vcxproj @@ -248,4 +248,4 @@ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> -</Project> +</Project>
\ No newline at end of file diff --git a/lcms2mt/Projects/VC2017/lcms2mt_DLL/lcms2mt_DLL.vcxproj.filters b/lcms2mt/Projects/VC2017/lcms2mt_DLL/lcms2mt_DLL.vcxproj.filters index 4d685cce..c9542c76 100644 --- a/lcms2mt/Projects/VC2017/lcms2mt_DLL/lcms2mt_DLL.vcxproj.filters +++ b/lcms2mt/Projects/VC2017/lcms2mt_DLL/lcms2mt_DLL.vcxproj.filters @@ -118,4 +118,4 @@ <Filter>Source Files</Filter> </CustomBuild> </ItemGroup> -</Project> +</Project>
\ No newline at end of file diff --git a/lcms2mt/Projects/VC2017/lcms2mt_static/lcms2mt_static.vcxproj b/lcms2mt/Projects/VC2017/lcms2mt_static/lcms2mt_static.vcxproj index 0d26f770..76195f68 100644 --- a/lcms2mt/Projects/VC2017/lcms2mt_static/lcms2mt_static.vcxproj +++ b/lcms2mt/Projects/VC2017/lcms2mt_static/lcms2mt_static.vcxproj @@ -205,4 +205,4 @@ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> -</Project> +</Project>
\ No newline at end of file diff --git a/lcms2mt/Projects/VC2017/lcms2mt_static/lcms2mt_static.vcxproj.filters b/lcms2mt/Projects/VC2017/lcms2mt_static/lcms2mt_static.vcxproj.filters index fdb81018..91149825 100644 --- a/lcms2mt/Projects/VC2017/lcms2mt_static/lcms2mt_static.vcxproj.filters +++ b/lcms2mt/Projects/VC2017/lcms2mt_static/lcms2mt_static.vcxproj.filters @@ -105,4 +105,4 @@ <Filter>Source Files</Filter> </ClInclude> </ItemGroup> -</Project> +</Project>
\ No newline at end of file diff --git a/lcms2mt/Projects/VC2019/jpegicc/jpegicc.vcxproj b/lcms2mt/Projects/VC2019/jpegicc/jpegicc.vcxproj new file mode 100644 index 00000000..787b397d --- /dev/null +++ b/lcms2mt/Projects/VC2019/jpegicc/jpegicc.vcxproj @@ -0,0 +1,215 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{62812507-F926-4968-96A9-17678460AD90}</ProjectGuid> + <RootNamespace>jpegicc</RootNamespace> + <Keyword>Win32Proj</Keyword> + <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>v142</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>v142</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <PlatformToolset>v142</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <PlatformToolset>v142</PlatformToolset> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.21006.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\bin\</OutDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\..\bin\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\bin\</OutDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\..\bin\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + <IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IncludePath);;C:\code\jpeg-9a</IncludePath> + <IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IncludePath);;C:\code\jpeg-9a</IncludePath> + <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(LibraryPath);;C:\code\jpeg-9a</LibraryPath> + <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(LibraryPath);;C:\code\jpeg-9a</LibraryPath> + <IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IncludePath);;C:\code\jpeg-9a</IncludePath> + <IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IncludePath);;C:\code\jpeg-9a</IncludePath> + <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(LibraryPath);;C:\code\jpeg-9a</LibraryPath> + <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(LibraryPath);;C:\code\jpeg-9a</LibraryPath> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>../../../include;../../../utils/common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + </ClCompile> + <Link> + <AdditionalDependencies>libjpeg.lib;%(AdditionalDependencies)</AdditionalDependencies> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>../../../include;../../../utils/common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + </ClCompile> + <Link> + <AdditionalDependencies>libjpeg.lib;%(AdditionalDependencies)</AdditionalDependencies> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <Optimization>Full</Optimization> + <IntrinsicFunctions>true</IntrinsicFunctions> + <AdditionalIncludeDirectories>../../../include;../../../utils/common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <OmitFramePointers>true</OmitFramePointers> + <EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <BrowseInformation>false</BrowseInformation> + </ClCompile> + <Link> + <AdditionalDependencies>libjpeg.lib;%(AdditionalDependencies)</AdditionalDependencies> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <TargetMachine>MachineX86</TargetMachine> + <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers> + </Link> + <Bscmake> + <PreserveSbr>true</PreserveSbr> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <Optimization>Full</Optimization> + <IntrinsicFunctions>true</IntrinsicFunctions> + <AdditionalIncludeDirectories>../../../include;../../../utils/common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <OmitFramePointers>true</OmitFramePointers> + <EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + </ClCompile> + <Link> + <AdditionalDependencies>libjpeg.lib;%(AdditionalDependencies)</AdditionalDependencies> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\..\utils\common\vprf.c" /> + <ClCompile Include="..\..\..\utils\common\xgetopt.c" /> + <ClCompile Include="..\..\..\utils\jpgicc\iccjpeg.c" /> + <ClCompile Include="..\..\..\utils\jpgicc\jpgicc.c" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\lcms2mt_static\lcms2mt_static.vcxproj"> + <Project>{71dede59-3f1e-486b-a899-4283000f76b5}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/lcms2mt/Projects/VC2019/jpegicc/jpegicc.vcxproj.filters b/lcms2mt/Projects/VC2019/jpegicc/jpegicc.vcxproj.filters new file mode 100644 index 00000000..a05c36d6 --- /dev/null +++ b/lcms2mt/Projects/VC2019/jpegicc/jpegicc.vcxproj.filters @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions> + </Filter> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\..\utils\common\vprf.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\utils\common\xgetopt.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\utils\jpgicc\iccjpeg.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\utils\jpgicc\jpgicc.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/lcms2mt/Projects/VC2019/lcms2mt.rc b/lcms2mt/Projects/VC2019/lcms2mt.rc new file mode 100644 index 00000000..9f7e813c --- /dev/null +++ b/lcms2mt/Projects/VC2019/lcms2mt.rc @@ -0,0 +1,104 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Spanish (Spain, International Sort) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ESN) +LANGUAGE LANG_SPANISH, SUBLANG_SPANISH_MODERN +#pragma code_page(1252) + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +1 VERSIONINFO + FILEVERSION 2,10,0,0 + PRODUCTVERSION 2,10,0,0 + FILEFLAGSMASK 0x0L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904e4" + BEGIN + VALUE "CompanyName", "Marti Maria" + VALUE "FileDescription", "lcms color engine" + VALUE "FileVersion", "2.10.0.0" + VALUE "InternalName", "lcms" + VALUE "LegalCopyright", "Copyright © Marti Maria 2020" + VALUE "OriginalFilename", "lcms2.dll" + VALUE "ProductName", "LittleCMS color engine" + VALUE "ProductVersion", "2.10.0.0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 + END +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + +#endif // Spanish (Spain, International Sort) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/lcms2mt/Projects/VC2019/lcms2mt.sln b/lcms2mt/Projects/VC2019/lcms2mt.sln Binary files differnew file mode 100644 index 00000000..9563c36c --- /dev/null +++ b/lcms2mt/Projects/VC2019/lcms2mt.sln diff --git a/lcms2mt/Projects/VC2019/lcms2mt_DLL/lcms2mt_DLL.vcxproj b/lcms2mt/Projects/VC2019/lcms2mt_DLL/lcms2mt_DLL.vcxproj new file mode 100644 index 00000000..ddfbbee2 --- /dev/null +++ b/lcms2mt/Projects/VC2019/lcms2mt_DLL/lcms2mt_DLL.vcxproj @@ -0,0 +1,252 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{8C51BE48-ADB8-4089-A9EC-F6BF993A0548}</ProjectGuid> + <RootNamespace>lcms2mt_DLL</RootNamespace> + <Keyword>Win32Proj</Keyword> + <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>v142</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>v142</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <PlatformToolset>v142</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <PlatformToolset>v142</PlatformToolset> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.21006.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\bin\</OutDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\..\bin\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)_$(Platform)\</IntDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Configuration)_$(Platform)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\bin\</OutDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\..\bin\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)_$(Platform)\</IntDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Configuration)_$(Platform)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <TargetName>lcms2mt</TargetName> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <TargetName>lcms2mt</TargetName> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <TargetName>lcms2mt</TargetName> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <TargetName>lcms2mt</TargetName> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;CMS_DLL_BUILD;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <StringPooling>false</StringPooling> + </ClCompile> + <Link> + <ModuleDefinitionFile>..\..\..\src\lcms2mt.def</ModuleDefinitionFile> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;CMS_DLL_BUILD;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <StringPooling>false</StringPooling> + </ClCompile> + <Link> + <ModuleDefinitionFile> + </ModuleDefinitionFile> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <Optimization>Full</Optimization> + <IntrinsicFunctions>true</IntrinsicFunctions> + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <OmitFramePointers>true</OmitFramePointers> + <EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations> + <WholeProgramOptimization>true</WholeProgramOptimization> + <AdditionalIncludeDirectories>../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;CMS_DLL_BUILD;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <StringPooling>true</StringPooling> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + </ClCompile> + <Link> + <ModuleDefinitionFile>..\..\..\src\lcms2mt.def</ModuleDefinitionFile> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <PreserveSbr>true</PreserveSbr> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <Optimization>Full</Optimization> + <IntrinsicFunctions>true</IntrinsicFunctions> + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <OmitFramePointers>true</OmitFramePointers> + <EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations> + <WholeProgramOptimization>true</WholeProgramOptimization> + <AdditionalIncludeDirectories>../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;CMS_DLL_BUILD;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <StringPooling>true</StringPooling> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + </ClCompile> + <Link> + <ModuleDefinitionFile> + </ModuleDefinitionFile> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\..\src\cmsalpha.c" /> + <ClCompile Include="..\..\..\src\cmscam02.c" /> + <ClCompile Include="..\..\..\src\cmscgats.c" /> + <ClCompile Include="..\..\..\src\cmscnvrt.c" /> + <ClCompile Include="..\..\..\src\cmserr.c" /> + <ClCompile Include="..\..\..\src\cmsgamma.c" /> + <ClCompile Include="..\..\..\src\cmsgmt.c" /> + <ClCompile Include="..\..\..\src\cmshalf.c" /> + <ClCompile Include="..\..\..\src\cmsintrp.c" /> + <ClCompile Include="..\..\..\src\cmsio0.c" /> + <ClCompile Include="..\..\..\src\cmsio1.c" /> + <ClCompile Include="..\..\..\src\cmslut.c" /> + <ClCompile Include="..\..\..\src\cmsmd5.c" /> + <ClCompile Include="..\..\..\src\cmsmtrx.c" /> + <ClCompile Include="..\..\..\src\cmsnamed.c" /> + <ClCompile Include="..\..\..\src\cmsopt.c" /> + <ClCompile Include="..\..\..\src\cmspack.c" /> + <ClCompile Include="..\..\..\src\cmspcs.c" /> + <ClCompile Include="..\..\..\src\cmsplugin.c" /> + <ClCompile Include="..\..\..\src\cmsps2.c" /> + <ClCompile Include="..\..\..\src\cmssamp.c" /> + <ClCompile Include="..\..\..\src\cmssm.c" /> + <ClCompile Include="..\..\..\src\cmstypes.c" /> + <ClCompile Include="..\..\..\src\cmsvirt.c" /> + <ClCompile Include="..\..\..\src\cmswtpnt.c" /> + <ClCompile Include="..\..\..\src\cmsxform.c" /> + </ItemGroup> + <ItemGroup> + <CustomBuild Include="..\..\..\src\lcms2mt.def"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + </CustomBuild> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\..\src\lcms2_internal.h" /> + <ClInclude Include="..\..\..\include\lcms2mt.h" /> + <ClInclude Include="..\..\..\include\lcms2mt_plugin.h" /> + <ClInclude Include="..\resource.h" /> + </ItemGroup> + <ItemGroup> + <ResourceCompile Include="..\lcms2mt.rc" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/lcms2mt/Projects/VC2019/lcms2mt_DLL/lcms2mt_DLL.vcxproj.filters b/lcms2mt/Projects/VC2019/lcms2mt_DLL/lcms2mt_DLL.vcxproj.filters new file mode 100644 index 00000000..c9542c76 --- /dev/null +++ b/lcms2mt/Projects/VC2019/lcms2mt_DLL/lcms2mt_DLL.vcxproj.filters @@ -0,0 +1,121 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions> + </Filter> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\..\src\cmscam02.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmscgats.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmscnvrt.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmserr.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmsgamma.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmsgmt.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmsintrp.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmsio0.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmsio1.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmslut.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmsmd5.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmsmtrx.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmsnamed.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmsopt.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmspack.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmspcs.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmsplugin.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmsps2.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmssamp.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmssm.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmstypes.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmsvirt.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmswtpnt.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmsxform.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmshalf.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmsalpha.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\..\include\lcms2mt.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\lcms2mt_plugin.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\src\lcms2_internal.h"> + <Filter>Source Files</Filter> + </ClInclude> + <ClInclude Include="..\resource.h"> + <Filter>Resource Files</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ResourceCompile Include="..\lcms2mt.rc"> + <Filter>Resource Files</Filter> + </ResourceCompile> + </ItemGroup> + <ItemGroup> + <CustomBuild Include="..\..\..\src\lcms2mt.def"> + <Filter>Source Files</Filter> + </CustomBuild> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/lcms2mt/Projects/VC2019/lcms2mt_static/lcms2mt_static.vcxproj b/lcms2mt/Projects/VC2019/lcms2mt_static/lcms2mt_static.vcxproj new file mode 100644 index 00000000..cc7b9fe6 --- /dev/null +++ b/lcms2mt/Projects/VC2019/lcms2mt_static/lcms2mt_static.vcxproj @@ -0,0 +1,208 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{71DEDE59-3F1E-486B-A899-4283000F76B5}</ProjectGuid> + <RootNamespace>lcms2mt_static</RootNamespace> + <Keyword>Win32Proj</Keyword> + <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>v142</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>v142</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <PlatformToolset>v142</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <PlatformToolset>v142</PlatformToolset> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.21006.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\Lib\MS\</OutDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\..\Lib\MS\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)_$(Platform)\</IntDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Configuration)_$(Platform)\</IntDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\Lib\MS\</OutDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\..\Lib\MS\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)_$(Platform)\</IntDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Configuration)_$(Platform)\</IntDir> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + <FunctionLevelLinking> + </FunctionLevelLinking> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <FunctionLevelLinking> + </FunctionLevelLinking> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <CompileAs>Default</CompileAs> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <IntrinsicFunctions>true</IntrinsicFunctions> + <AdditionalIncludeDirectories>../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <OmitFramePointers>true</OmitFramePointers> + <EnableFiberSafeOptimizations>false</EnableFiberSafeOptimizations> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <ExceptionHandling>false</ExceptionHandling> + <StringPooling>true</StringPooling> + <FloatingPointModel>Precise</FloatingPointModel> + <FloatingPointExceptions>false</FloatingPointExceptions> + <RuntimeTypeInfo>false</RuntimeTypeInfo> + <BrowseInformation>false</BrowseInformation> + </ClCompile> + <Bscmake> + <PreserveSbr>true</PreserveSbr> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <IntrinsicFunctions>true</IntrinsicFunctions> + <AdditionalIncludeDirectories>../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <OmitFramePointers>true</OmitFramePointers> + <EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <ExceptionHandling>false</ExceptionHandling> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <EnableParallelCodeGeneration>true</EnableParallelCodeGeneration> + <StringPooling>true</StringPooling> + </ClCompile> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\..\src\cmsalpha.c" /> + <ClCompile Include="..\..\..\src\cmscam02.c" /> + <ClCompile Include="..\..\..\src\cmscgats.c" /> + <ClCompile Include="..\..\..\src\cmscnvrt.c" /> + <ClCompile Include="..\..\..\src\cmserr.c" /> + <ClCompile Include="..\..\..\src\cmsgamma.c" /> + <ClCompile Include="..\..\..\src\cmsgmt.c" /> + <ClCompile Include="..\..\..\src\cmshalf.c" /> + <ClCompile Include="..\..\..\src\cmsintrp.c" /> + <ClCompile Include="..\..\..\src\cmsio0.c" /> + <ClCompile Include="..\..\..\src\cmsio1.c" /> + <ClCompile Include="..\..\..\src\cmslut.c" /> + <ClCompile Include="..\..\..\src\cmsmd5.c" /> + <ClCompile Include="..\..\..\src\cmsmtrx.c" /> + <ClCompile Include="..\..\..\src\cmsnamed.c" /> + <ClCompile Include="..\..\..\src\cmsopt.c" /> + <ClCompile Include="..\..\..\src\cmspack.c" /> + <ClCompile Include="..\..\..\src\cmspcs.c" /> + <ClCompile Include="..\..\..\src\cmsplugin.c" /> + <ClCompile Include="..\..\..\src\cmsps2.c" /> + <ClCompile Include="..\..\..\src\cmssamp.c" /> + <ClCompile Include="..\..\..\src\cmssm.c" /> + <ClCompile Include="..\..\..\src\cmstypes.c" /> + <ClCompile Include="..\..\..\src\cmsvirt.c" /> + <ClCompile Include="..\..\..\src\cmswtpnt.c" /> + <ClCompile Include="..\..\..\src\cmsxform.c" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\..\src\lcms2_internal.h" /> + <ClInclude Include="..\..\..\include\lcms2mt.h" /> + <ClInclude Include="..\..\..\include\lcms2mt_plugin.h" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/lcms2mt/Projects/VC2019/lcms2mt_static/lcms2mt_static.vcxproj.filters b/lcms2mt/Projects/VC2019/lcms2mt_static/lcms2mt_static.vcxproj.filters new file mode 100644 index 00000000..91149825 --- /dev/null +++ b/lcms2mt/Projects/VC2019/lcms2mt_static/lcms2mt_static.vcxproj.filters @@ -0,0 +1,108 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions> + </Filter> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\..\src\cmscam02.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmscgats.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmscnvrt.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmserr.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmsgamma.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmsgmt.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmsintrp.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmsio0.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmsio1.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmslut.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmsmd5.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmsmtrx.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmsnamed.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmsopt.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmspack.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmspcs.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmsplugin.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmsps2.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmssamp.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmssm.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmstypes.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmsvirt.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmswtpnt.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmsxform.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmshalf.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\src\cmsalpha.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\..\include\lcms2mt.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\lcms2mt_plugin.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\src\lcms2_internal.h"> + <Filter>Source Files</Filter> + </ClInclude> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/lcms2mt/Projects/VC2019/linkicc/linkicc.vcxproj b/lcms2mt/Projects/VC2019/linkicc/linkicc.vcxproj new file mode 100644 index 00000000..4ec2dd7d --- /dev/null +++ b/lcms2mt/Projects/VC2019/linkicc/linkicc.vcxproj @@ -0,0 +1,192 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{FBFBE1DC-DB84-4BA1-9552-B4780F457849}</ProjectGuid> + <RootNamespace>linkicc</RootNamespace> + <Keyword>Win32Proj</Keyword> + <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>v142</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>v142</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <PlatformToolset>v142</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <PlatformToolset>v142</PlatformToolset> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.21006.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\bin\</OutDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\..\bin\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)_$(Platform)\</IntDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Configuration)_$(Platform)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\bin\</OutDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\..\bin\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)_$(Platform)\</IntDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Configuration)_$(Platform)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>../../../include;../../../utils/common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>../../../include;../../../utils/common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <IntrinsicFunctions>true</IntrinsicFunctions> + <AdditionalIncludeDirectories>../../../include;../../../utils/common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <BrowseInformation>false</BrowseInformation> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <PreserveSbr>true</PreserveSbr> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <IntrinsicFunctions>true</IntrinsicFunctions> + <AdditionalIncludeDirectories>../../../include;../../../utils/common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\..\utils\linkicc\linkicc.c" /> + <ClCompile Include="..\..\..\utils\common\vprf.c" /> + <ClCompile Include="..\..\..\utils\common\xgetopt.c" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\lcms2mt_static\lcms2mt_static.vcxproj"> + <Project>{71dede59-3f1e-486b-a899-4283000f76b5}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/lcms2mt/Projects/VC2019/linkicc/linkicc.vcxproj.filters b/lcms2mt/Projects/VC2019/linkicc/linkicc.vcxproj.filters new file mode 100644 index 00000000..95c77cdb --- /dev/null +++ b/lcms2mt/Projects/VC2019/linkicc/linkicc.vcxproj.filters @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions> + </Filter> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\..\utils\common\vprf.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\utils\common\xgetopt.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\utils\linkicc\linkicc.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/lcms2mt/Projects/VC2019/psicc/psicc.vcxproj b/lcms2mt/Projects/VC2019/psicc/psicc.vcxproj new file mode 100644 index 00000000..a895d391 --- /dev/null +++ b/lcms2mt/Projects/VC2019/psicc/psicc.vcxproj @@ -0,0 +1,192 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{EF6A8851-65FE-46F5-B9EF-14F0B671F693}</ProjectGuid> + <RootNamespace>psicc</RootNamespace> + <Keyword>Win32Proj</Keyword> + <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>v142</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>v142</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <PlatformToolset>v142</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <PlatformToolset>v142</PlatformToolset> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.21006.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\bin\</OutDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\..\bin\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)_$(Platform)\</IntDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Configuration)_$(Platform)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\bin\</OutDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\..\bin\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)_$(Platform)\</IntDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Configuration)_$(Platform)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>../../../include;../../../utils/common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>../../../include;../../../utils/common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <IntrinsicFunctions>true</IntrinsicFunctions> + <AdditionalIncludeDirectories>../../../include;../../../utils/common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <BrowseInformation>false</BrowseInformation> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <PreserveSbr>true</PreserveSbr> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <IntrinsicFunctions>true</IntrinsicFunctions> + <AdditionalIncludeDirectories>../../../include;../../../utils/common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\..\utils\psicc\psicc.c" /> + <ClCompile Include="..\..\..\utils\common\vprf.c" /> + <ClCompile Include="..\..\..\utils\common\xgetopt.c" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\lcms2mt_static\lcms2mt_static.vcxproj"> + <Project>{71dede59-3f1e-486b-a899-4283000f76b5}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/lcms2mt/Projects/VC2019/psicc/psicc.vcxproj.filters b/lcms2mt/Projects/VC2019/psicc/psicc.vcxproj.filters new file mode 100644 index 00000000..c42429d8 --- /dev/null +++ b/lcms2mt/Projects/VC2019/psicc/psicc.vcxproj.filters @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions> + </Filter> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\..\utils\common\vprf.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\utils\common\xgetopt.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\utils\psicc\psicc.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/lcms2mt/Projects/VC2019/resource.h b/lcms2mt/Projects/VC2019/resource.h new file mode 100644 index 00000000..7655978d --- /dev/null +++ b/lcms2mt/Projects/VC2019/resource.h @@ -0,0 +1,16 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by lcms2.rc +// + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/lcms2mt/Projects/VC2019/testbed/testbed.vcxproj b/lcms2mt/Projects/VC2019/testbed/testbed.vcxproj new file mode 100644 index 00000000..6aa71afa --- /dev/null +++ b/lcms2mt/Projects/VC2019/testbed/testbed.vcxproj @@ -0,0 +1,208 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{928A3A2B-46EF-4279-959C-513B3652FF0E}</ProjectGuid> + <RootNamespace>testbed</RootNamespace> + <Keyword>Win32Proj</Keyword> + <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>v142</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>v142</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <PlatformToolset>v142</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <PlatformToolset>v142</PlatformToolset> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.21006.1</_ProjectFileVersion> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)_$(Platform)\</IntDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Configuration)_$(Platform)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\testbed\</OutDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\..\testbed\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)_$(Platform)\</IntDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Configuration)_$(Platform)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\testbed\</OutDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\..\testbed\</OutDir> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>../../../include;../../../src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + <Profile>false</Profile> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>../../../include;../../../src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <Profile>false</Profile> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <Optimization>Full</Optimization> + <IntrinsicFunctions>true</IntrinsicFunctions> + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <OmitFramePointers>true</OmitFramePointers> + <EnableFiberSafeOptimizations>false</EnableFiberSafeOptimizations> + <AdditionalIncludeDirectories>../../../include;../../../src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FunctionLevelLinking>true</FunctionLevelLinking> + <EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <CallingConvention>Cdecl</CallingConvention> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <BrowseInformation>false</BrowseInformation> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <TargetMachine>MachineX86</TargetMachine> + <Profile>false</Profile> + </Link> + <Bscmake> + <PreserveSbr>true</PreserveSbr> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <Optimization>Full</Optimization> + <IntrinsicFunctions>true</IntrinsicFunctions> + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <OmitFramePointers>true</OmitFramePointers> + <EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations> + <AdditionalIncludeDirectories>../../../include;../../../src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FunctionLevelLinking>true</FunctionLevelLinking> + <EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <CallingConvention>Cdecl</CallingConvention> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <Profile>false</Profile> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ProjectReference Include="..\lcms2mt_static\lcms2mt_static.vcxproj"> + <Project>{71dede59-3f1e-486b-a899-4283000f76b5}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\..\testbed\testcms2.c" /> + <ClCompile Include="..\..\..\testbed\testplugin.c" /> + <ClCompile Include="..\..\..\testbed\zoo_icc.c" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/lcms2mt/Projects/VC2019/testbed/testbed.vcxproj.filters b/lcms2mt/Projects/VC2019/testbed/testbed.vcxproj.filters new file mode 100644 index 00000000..993ee151 --- /dev/null +++ b/lcms2mt/Projects/VC2019/testbed/testbed.vcxproj.filters @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions> + </Filter> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\..\testbed\testcms2.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\testbed\testplugin.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\testbed\zoo_icc.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/lcms2mt/Projects/VC2019/tiffdiff/tiffdiff.vcxproj b/lcms2mt/Projects/VC2019/tiffdiff/tiffdiff.vcxproj new file mode 100644 index 00000000..5126c64c --- /dev/null +++ b/lcms2mt/Projects/VC2019/tiffdiff/tiffdiff.vcxproj @@ -0,0 +1,210 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{75B91835-CCD7-48BE-A606-A9C997D5DBEE}</ProjectGuid> + <RootNamespace>tiffdiff</RootNamespace> + <Keyword>Win32Proj</Keyword> + <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>v142</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>v142</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <PlatformToolset>v142</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <PlatformToolset>v142</PlatformToolset> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.21006.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\bin\</OutDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\..\bin\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)_$(Platform)\</IntDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Configuration)_$(Platform)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\bin\</OutDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\..\bin\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)_$(Platform)\</IntDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Configuration)_$(Platform)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + <IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">C:\jpeg-8d;c:\tiff-4.0.2\libtiff;$(IncludePath)</IncludePath> + <IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|x64'">C:\jpeg-8d;c:\tiff-4.0.2\libtiff;$(IncludePath)</IncludePath> + <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">C:\jpeg-8d;C:\tiff-4.0.2\libtiff;$(LibraryPath)</LibraryPath> + <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Release|x64'">C:\jpeg-8d;C:\tiff-4.0.2\libtiff;$(LibraryPath)</LibraryPath> + <IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\jpeg-8d;c:\tiff-4.0.2\libtiff;$(IncludePath)</IncludePath> + <IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">C:\jpeg-8d;c:\tiff-4.0.2\libtiff;$(IncludePath)</IncludePath> + <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\jpeg-8d;C:\tiff-4.0.2\libtiff;$(LibraryPath)</LibraryPath> + <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">C:\jpeg-8d;C:\tiff-4.0.2\libtiff;$(LibraryPath)</LibraryPath> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>../../../include;../../../utils/common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + </ClCompile> + <Link> + <AdditionalDependencies>libtiff.lib;%(AdditionalDependencies)</AdditionalDependencies> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>../../../include;../../../utils/common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + </ClCompile> + <Link> + <AdditionalDependencies>libtiff.lib;%(AdditionalDependencies)</AdditionalDependencies> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <IntrinsicFunctions>true</IntrinsicFunctions> + <AdditionalIncludeDirectories>../../../include;../../../utils/common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <BrowseInformation>false</BrowseInformation> + </ClCompile> + <Link> + <AdditionalDependencies>libtiff.lib;%(AdditionalDependencies)</AdditionalDependencies> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <TargetMachine>MachineX86</TargetMachine> + <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> + <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers> + </Link> + <Bscmake> + <PreserveSbr>true</PreserveSbr> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <IntrinsicFunctions>true</IntrinsicFunctions> + <AdditionalIncludeDirectories>../../../include;../../../utils/common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + </ClCompile> + <Link> + <AdditionalDependencies>libtiff.lib;%(AdditionalDependencies)</AdditionalDependencies> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> + <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\..\utils\common\vprf.c" /> + <ClCompile Include="..\..\..\utils\common\xgetopt.c" /> + <ClCompile Include="..\..\..\utils\tificc\tifdiff.c" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\lcms2mt_static\lcms2mt_static.vcxproj"> + <Project>{71dede59-3f1e-486b-a899-4283000f76b5}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/lcms2mt/Projects/VC2019/tiffdiff/tiffdiff.vcxproj.filters b/lcms2mt/Projects/VC2019/tiffdiff/tiffdiff.vcxproj.filters new file mode 100644 index 00000000..b7f9a80d --- /dev/null +++ b/lcms2mt/Projects/VC2019/tiffdiff/tiffdiff.vcxproj.filters @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions> + </Filter> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\..\utils\common\vprf.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\utils\common\xgetopt.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\utils\tificc\tifdiff.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/lcms2mt/Projects/VC2019/tifficc/tifficc.vcxproj b/lcms2mt/Projects/VC2019/tifficc/tifficc.vcxproj new file mode 100644 index 00000000..d6af7049 --- /dev/null +++ b/lcms2mt/Projects/VC2019/tifficc/tifficc.vcxproj @@ -0,0 +1,211 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{2256DE16-ED92-4A6F-9C54-F65BB61E64A2}</ProjectGuid> + <RootNamespace>tifficc</RootNamespace> + <Keyword>Win32Proj</Keyword> + <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>v142</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>v142</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <PlatformToolset>v142</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <PlatformToolset>v142</PlatformToolset> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.21006.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\bin\</OutDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\..\bin\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)_$(Platform)\</IntDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Configuration)_$(Platform)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\bin\</OutDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\..\bin\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)_$(Platform)\</IntDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Configuration)_$(Platform)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + <IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IncludePath);C:\tiff-4.0.2\libtiff</IncludePath> + <IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IncludePath);C:\tiff-4.0.2\libtiff</IncludePath> + <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(LibraryPath);C:\tiff-4.0.2\libtiff</LibraryPath> + <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(LibraryPath);C:\tiff-4.0.2\libtiff</LibraryPath> + <IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IncludePath);C:\tiff-4.0.2\libtiff</IncludePath> + <IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IncludePath);C:\tiff-4.0.2\libtiff</IncludePath> + <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(LibraryPath);C:\tiff-4.0.2\libtiff</LibraryPath> + <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(LibraryPath);C:\tiff-4.0.2\libtiff</LibraryPath> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>../../../include;../../../utils/common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + </ClCompile> + <Link> + <AdditionalDependencies>libtiff.lib;%(AdditionalDependencies)</AdditionalDependencies> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>../../../include;../../../utils/common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + </ClCompile> + <Link> + <AdditionalDependencies>libtiff.lib;%(AdditionalDependencies)</AdditionalDependencies> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <IntrinsicFunctions>true</IntrinsicFunctions> + <AdditionalIncludeDirectories>../../../include;../../../utils/common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <BrowseInformation>false</BrowseInformation> + </ClCompile> + <Link> + <AdditionalDependencies>libtiff.lib;%(AdditionalDependencies)</AdditionalDependencies> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <TargetMachine>MachineX86</TargetMachine> + <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers> + </Link> + <Bscmake> + <PreserveSbr>true</PreserveSbr> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <IntrinsicFunctions>true</IntrinsicFunctions> + <AdditionalIncludeDirectories>../../../include;../../../utils/common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + </ClCompile> + <Link> + <AdditionalDependencies>libtiff.lib;%(AdditionalDependencies)</AdditionalDependencies> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\..\utils\common\vprf.c" /> + <ClCompile Include="..\..\..\utils\common\xgetopt.c" /> + <ClCompile Include="..\..\..\utils\tificc\tificc.c" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\..\utils\common\utils.h" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\lcms2mt_static\lcms2mt_static.vcxproj"> + <Project>{71dede59-3f1e-486b-a899-4283000f76b5}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/lcms2mt/Projects/VC2019/tifficc/tifficc.vcxproj.filters b/lcms2mt/Projects/VC2019/tifficc/tifficc.vcxproj.filters new file mode 100644 index 00000000..2e0e44d1 --- /dev/null +++ b/lcms2mt/Projects/VC2019/tifficc/tifficc.vcxproj.filters @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions> + </Filter> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\..\utils\common\vprf.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\utils\common\xgetopt.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\utils\tificc\tificc.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\..\utils\common\utils.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/lcms2mt/Projects/VC2019/transicc/transicc.vcxproj b/lcms2mt/Projects/VC2019/transicc/transicc.vcxproj new file mode 100644 index 00000000..e3e4feeb --- /dev/null +++ b/lcms2mt/Projects/VC2019/transicc/transicc.vcxproj @@ -0,0 +1,197 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{9EE22D66-C849-474C-9ED5-C3E141DAB160}</ProjectGuid> + <RootNamespace>transicc</RootNamespace> + <Keyword>Win32Proj</Keyword> + <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>v142</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>v142</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <PlatformToolset>v142</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <PlatformToolset>v142</PlatformToolset> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.21006.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\bin\</OutDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\..\bin\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)_$(Platform)\</IntDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Configuration)_$(Platform)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\bin\</OutDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\..\bin\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)_$(Platform)\</IntDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Configuration)_$(Platform)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>../../../include;../../../utils/common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>../../../include;../../../utils/common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <IntrinsicFunctions>true</IntrinsicFunctions> + <AdditionalIncludeDirectories>../../../include;../../../utils/common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <BrowseInformation>false</BrowseInformation> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <PreserveSbr>true</PreserveSbr> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <IntrinsicFunctions>true</IntrinsicFunctions> + <AdditionalIncludeDirectories>../../../include;../../../utils/common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\..\utils\transicc\transicc.c"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild> + </ClCompile> + <ClCompile Include="..\..\..\utils\common\vprf.c" /> + <ClCompile Include="..\..\..\utils\common\xgetopt.c" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\..\utils\common\utils.h" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\lcms2mt_static\lcms2mt_static.vcxproj"> + <Project>{71dede59-3f1e-486b-a899-4283000f76b5}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/lcms2mt/Projects/VC2019/transicc/transicc.vcxproj.filters b/lcms2mt/Projects/VC2019/transicc/transicc.vcxproj.filters new file mode 100644 index 00000000..3d454430 --- /dev/null +++ b/lcms2mt/Projects/VC2019/transicc/transicc.vcxproj.filters @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions> + </Filter> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\..\utils\common\vprf.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\utils\common\xgetopt.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\utils\transicc\transicc.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\..\utils\common\utils.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/lcms2mt/Projects/cppcheck/lcms2mt.cppcheck b/lcms2mt/Projects/cppcheck/lcms2mt.cppcheck new file mode 100644 index 00000000..fb6ac068 --- /dev/null +++ b/lcms2mt/Projects/cppcheck/lcms2mt.cppcheck @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="1"> + <includedir> + <dir name="../../include/"/> + </includedir> + <paths> + <dir name="../../src"/> + </paths> +</project> diff --git a/lcms2mt/Projects/mac/LittleCMS/LittleCMS.xcodeproj/project.pbxproj b/lcms2mt/Projects/mac/LittleCMS/LittleCMS.xcodeproj/project.pbxproj index c2e15fe1..df99b953 100755 --- a/lcms2mt/Projects/mac/LittleCMS/LittleCMS.xcodeproj/project.pbxproj +++ b/lcms2mt/Projects/mac/LittleCMS/LittleCMS.xcodeproj/project.pbxproj @@ -31,8 +31,8 @@ 546B295E10AC5E4A0054D33A /* cmsvirt.c in Sources */ = {isa = PBXBuildFile; fileRef = 546B294610AC5E4A0054D33A /* cmsvirt.c */; }; 546B295F10AC5E4A0054D33A /* cmswtpnt.c in Sources */ = {isa = PBXBuildFile; fileRef = 546B294710AC5E4A0054D33A /* cmswtpnt.c */; }; 546B296010AC5E4A0054D33A /* cmsxform.c in Sources */ = {isa = PBXBuildFile; fileRef = 546B294810AC5E4A0054D33A /* cmsxform.c */; }; - 546B296310AC5E600054D33A /* lcms2mt.h in Headers */ = {isa = PBXBuildFile; fileRef = 546B296110AC5E600054D33A /* lcms2mt.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 546B296410AC5E600054D33A /* lcms2mt_plugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 546B296210AC5E600054D33A /* lcms2mt_plugin.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 546B296310AC5E600054D33A /* lcms2.h in Headers */ = {isa = PBXBuildFile; fileRef = 546B296110AC5E600054D33A /* lcms2.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 546B296410AC5E600054D33A /* lcms2_plugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 546B296210AC5E600054D33A /* lcms2_plugin.h */; settings = {ATTRIBUTES = (Public, ); }; }; 546B29AE10AC68410054D33A /* testcms2.c in Sources */ = {isa = PBXBuildFile; fileRef = 546B29AD10AC68410054D33A /* testcms2.c */; }; 54DBD06215A202BB00180017 /* cmshalf.c in Sources */ = {isa = PBXBuildFile; fileRef = 54DBD06015A202B200180017 /* cmshalf.c */; }; 54E6DC7E18AE052800445185 /* testplugin.c in Sources */ = {isa = PBXBuildFile; fileRef = 54E6DC7D18AE052800445185 /* testplugin.c */; }; @@ -119,8 +119,8 @@ 546B294610AC5E4A0054D33A /* cmsvirt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = cmsvirt.c; path = ../../../src/cmsvirt.c; sourceTree = SOURCE_ROOT; }; 546B294710AC5E4A0054D33A /* cmswtpnt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = cmswtpnt.c; path = ../../../src/cmswtpnt.c; sourceTree = SOURCE_ROOT; }; 546B294810AC5E4A0054D33A /* cmsxform.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = cmsxform.c; path = ../../../src/cmsxform.c; sourceTree = SOURCE_ROOT; }; - 546B296110AC5E600054D33A /* lcms2mt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lcms2mt.h; path = ../../../include/lcms2mt.h; sourceTree = SOURCE_ROOT; }; - 546B296210AC5E600054D33A /* lcms2mt_plugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lcms2mt_plugin.h; path = ../../../include/lcms2mt_plugin.h; sourceTree = SOURCE_ROOT; }; + 546B296110AC5E600054D33A /* lcms2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lcms2.h; path = ../../../include/lcms2.h; sourceTree = SOURCE_ROOT; }; + 546B296210AC5E600054D33A /* lcms2_plugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lcms2_plugin.h; path = ../../../include/lcms2_plugin.h; sourceTree = SOURCE_ROOT; }; 546B29A310AC677E0054D33A /* testbed */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testbed; sourceTree = BUILT_PRODUCTS_DIR; }; 546B29AC10AC682F0054D33A /* lcms2_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lcms2_internal.h; path = ../../../src/lcms2_internal.h; sourceTree = SOURCE_ROOT; }; 546B29AD10AC68410054D33A /* testcms2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testcms2.c; path = ../../../testbed/testcms2.c; sourceTree = SOURCE_ROOT; }; @@ -213,8 +213,8 @@ CEBB92E31BF8EF2700B79324 /* cmsalpha.c */, 54DBD06015A202B200180017 /* cmshalf.c */, 546B29AC10AC682F0054D33A /* lcms2_internal.h */, - 546B296110AC5E600054D33A /* lcms2mt.h */, - 546B296210AC5E600054D33A /* lcms2mt_plugin.h */, + 546B296110AC5E600054D33A /* lcms2.h */, + 546B296210AC5E600054D33A /* lcms2_plugin.h */, 546B293110AC5E4A0054D33A /* cmscam02.c */, 546B293210AC5E4A0054D33A /* cmscgats.c */, 546B293310AC5E4A0054D33A /* cmscnvrt.c */, @@ -252,8 +252,8 @@ buildActionMask = 2147483647; files = ( 8D07F2BE0486CC7A007CD1D0 /* LittleCMS_Prefix.pch in Headers */, - 546B296310AC5E600054D33A /* lcms2mt.h in Headers */, - 546B296410AC5E600054D33A /* lcms2mt_plugin.h in Headers */, + 546B296310AC5E600054D33A /* lcms2.h in Headers */, + 546B296410AC5E600054D33A /* lcms2_plugin.h in Headers */, CE790F6B1A31C2400083D722 /* lcms2_internal.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/lcms2mt/README.1ST b/lcms2mt/README.1ST index a0fb1e9a..431b2c9d 100644 --- a/lcms2mt/README.1ST +++ b/lcms2mt/README.1ST @@ -1,5 +1,15 @@ -This is lcms2mt, version 2.9. This is a forked, binary incompatible -version of lcms2.9. For details of the differences from vanilla -lcms2.9 see doc/WhyThisFork.txt +This is lcms2mt, version 2.10. This is a forked, binary incompatible +version of lcms2.10. For details of the differences from vanilla +lcms2.10 see doc/WhyThisFork.txt -Please see the documentation in doc folder +About Little CMS +Little CMS intends to be an OPEN SOURCE small-footprint color management engine, with special focus on accuracy and performance. It uses the International Color Consortium standard (ICC), which is the modern standard when regarding to color management. The ICC specification is widely used and is referred to in many International and other de-facto standards. It was approved as an International Standard, ISO 15076-1, in 2005. + +Conformance +Little CMS 2.10 is a FULL IMPLEMENTATION of ICC specification 4.3, it fully supports all kind of V2 and V4 profiles, including abstract, devicelink and named color profiles. Check the tutorial for a exhaustive list of features. + + +A bit of story +Since the initial release, back in 1998, Little CMS has grown to become one of the most popular open-source color management libraries, and has been used in a large number of production projects, in areas as printer firmware, monitors, digital cameras, RIPs, publishing, scientific, and many others. You can find Little CMS in most Linux distributions, and it's released under an open source license. + +Please see the complete documentation in doc folder diff --git a/lcms2mt/aclocal.m4 b/lcms2mt/aclocal.m4 index 76613461..ed6a6af8 100644 --- a/lcms2mt/aclocal.m4 +++ b/lcms2mt/aclocal.m4 @@ -1,6 +1,6 @@ -# generated automatically by aclocal 1.15 -*- Autoconf -*- +# generated automatically by aclocal 1.16.1 -*- Autoconf -*- -# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# Copyright (C) 1996-2018 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -20,7 +20,7 @@ You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) -# Copyright (C) 2002-2014 Free Software Foundation, Inc. +# Copyright (C) 2002-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -32,10 +32,10 @@ To do so, use the procedure documented by the package, typically 'autoreconf'.]) # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], -[am__api_version='1.15' +[am__api_version='1.16' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.15], [], +m4_if([$1], [1.16.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -51,14 +51,14 @@ m4_define([_AM_AUTOCONF_VERSION], []) # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.15])dnl +[AM_AUTOMAKE_VERSION([1.16.1])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -110,7 +110,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd` # AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997-2014 Free Software Foundation, Inc. +# Copyright (C) 1997-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -141,7 +141,7 @@ AC_CONFIG_COMMANDS_PRE( Usually this means the macro was only invoked conditionally.]]) fi])]) -# Copyright (C) 1999-2014 Free Software Foundation, Inc. +# Copyright (C) 1999-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -332,13 +332,12 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl # Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999-2014 Free Software Foundation, Inc. +# Copyright (C) 1999-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. - # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], @@ -346,49 +345,41 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. - case $CONFIG_FILES in - *\'*) eval set x "$CONFIG_FILES" ;; - *) set x $CONFIG_FILES ;; - esac + # TODO: see whether this extra hack can be removed once we start + # requiring Autoconf 2.70 or later. + AS_CASE([$CONFIG_FILES], + [*\'*], [eval set x "$CONFIG_FILES"], + [*], [set x $CONFIG_FILES]) shift - for mf + # Used to flag and report bootstrapping failures. + am_rc=0 + for am_mf do # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named 'Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # Grep'ing the whole file is not good either: AIX grep has a line + am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile which includes + # dependency-tracking related rules and includes. + # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then - dirpart=`AS_DIRNAME("$mf")` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running 'make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "$am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`AS_DIRNAME(["$file"])` - AS_MKDIR_P([$dirpart/$fdir]) - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done + sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ + || continue + am_dirpart=`AS_DIRNAME(["$am_mf"])` + am_filepart=`AS_BASENAME(["$am_mf"])` + AM_RUN_LOG([cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles]) || am_rc=$? done + if test $am_rc -ne 0; then + AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments + for automatic dependency tracking. Try re-running configure with the + '--disable-dependency-tracking' option to at least be able to build + the package (albeit without support for automatic dependency tracking).]) + fi + AS_UNSET([am_dirpart]) + AS_UNSET([am_filepart]) + AS_UNSET([am_mf]) + AS_UNSET([am_rc]) + rm -f conftest-deps.mk } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS @@ -397,18 +388,17 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # -# This code is only required when automatic dependency tracking -# is enabled. FIXME. This creates each '.P' file that we will -# need in order to bootstrap the dependency handling code. +# This code is only required when automatic dependency tracking is enabled. +# This creates each '.Po' and '.Plo' makefile fragment that we'll need in +# order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], - [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) -]) + [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])]) # Do all the work for Automake. -*- Autoconf -*- -# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# Copyright (C) 1996-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -495,8 +485,8 @@ AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: -# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html> -# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html> +# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html> +# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html> AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. @@ -563,7 +553,7 @@ END Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation -that behaves properly: <http://www.gnu.org/software/coreutils/>. +that behaves properly: <https://www.gnu.org/software/coreutils/>. If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM @@ -605,7 +595,7 @@ for _am_header in $config_headers :; do done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -626,7 +616,7 @@ if test x"${install_sh+set}" != xset; then fi AC_SUBST([install_sh])]) -# Copyright (C) 2003-2014 Free Software Foundation, Inc. +# Copyright (C) 2003-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -648,7 +638,7 @@ AC_SUBST([am__leading_dot])]) # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering -# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# Copyright (C) 1996-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -683,7 +673,7 @@ AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) # Check to see how 'make' treats includes. -*- Autoconf -*- -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -691,49 +681,42 @@ AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) # AM_MAKE_INCLUDE() # ----------------- -# Check to see how make treats includes. +# Check whether make has an 'include' directive that can support all +# the idioms we need for our automatic dependency tracking code. AC_DEFUN([AM_MAKE_INCLUDE], -[am_make=${MAKE-make} -cat > confinc << 'END' +[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive]) +cat > confinc.mk << 'END' am__doit: - @echo this is the am__doit target + @echo this is the am__doit target >confinc.out .PHONY: am__doit END -# If we don't find an include directive, just comment out the code. -AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# Ignore all kinds of additional output from 'make'. -case `$am_make -s -f confmf 2> /dev/null` in #( -*the\ am__doit\ target*) - am__include=include - am__quote= - _am_result=GNU - ;; -esac -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - case `$am_make -s -f confmf 2> /dev/null` in #( - *the\ am__doit\ target*) - am__include=.include - am__quote="\"" - _am_result=BSD - ;; - esac -fi -AC_SUBST([am__include]) -AC_SUBST([am__quote]) -AC_MSG_RESULT([$_am_result]) -rm -f confinc confmf -]) +# BSD make does it like this. +echo '.include "confinc.mk" # ignored' > confmf.BSD +# Other make implementations (GNU, Solaris 10, AIX) do it like this. +echo 'include confinc.mk # ignored' > confmf.GNU +_am_result=no +for s in GNU BSD; do + AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out]) + AS_CASE([$?:`cat confinc.out 2>/dev/null`], + ['0:this is the am__doit target'], + [AS_CASE([$s], + [BSD], [am__include='.include' am__quote='"'], + [am__include='include' am__quote=''])]) + if test "$am__include" != "#"; then + _am_result="yes ($s style)" + break + fi +done +rm -f confinc.* confmf.* +AC_MSG_RESULT([${_am_result}]) +AC_SUBST([am__include])]) +AC_SUBST([am__quote])]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- -# Copyright (C) 1997-2014 Free Software Foundation, Inc. +# Copyright (C) 1997-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -772,7 +755,7 @@ fi # Helper functions for option handling. -*- Autoconf -*- -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -801,7 +784,7 @@ AC_DEFUN([_AM_SET_OPTIONS], AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) -# Copyright (C) 1999-2014 Free Software Foundation, Inc. +# Copyright (C) 1999-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -848,7 +831,7 @@ AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -867,7 +850,7 @@ AC_DEFUN([AM_RUN_LOG], # Check to make sure that the build environment is sane. -*- Autoconf -*- -# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# Copyright (C) 1996-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -948,7 +931,7 @@ AC_CONFIG_COMMANDS_PRE( rm -f conftest.file ]) -# Copyright (C) 2009-2014 Free Software Foundation, Inc. +# Copyright (C) 2009-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1008,7 +991,7 @@ AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1036,7 +1019,7 @@ fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) -# Copyright (C) 2006-2014 Free Software Foundation, Inc. +# Copyright (C) 2006-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1055,7 +1038,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- -# Copyright (C) 2004-2014 Free Software Foundation, Inc. +# Copyright (C) 2004-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, diff --git a/lcms2mt/config.guess b/lcms2mt/config.guess index 82e59e2a..e7464614 100755 --- a/lcms2mt/config.guess +++ b/lcms2mt/config.guess @@ -1101,7 +1101,6 @@ EOF # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configuration will decide that - # prints for the "djgpp" host, or else GDB configuration will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; diff --git a/lcms2mt/configure b/lcms2mt/configure index 952d80b8..32ba181b 100644 --- a/lcms2mt/configure +++ b/lcms2mt/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for lcms2 2.9. +# Generated by GNU Autoconf 2.69 for lcms2mt 2.10. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -585,10 +585,10 @@ MFLAGS= MAKEFLAGS= # Identity of this package. -PACKAGE_NAME='lcms2' -PACKAGE_TARNAME='lcms2' -PACKAGE_VERSION='2.9' -PACKAGE_STRING='lcms2 2.9' +PACKAGE_NAME='lcms2mt' +PACKAGE_TARNAME='lcms2mt' +PACKAGE_VERSION='2.10' +PACKAGE_STRING='lcms2mt 2.10' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -693,7 +693,6 @@ am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE -am__quote am__include DEPDIR OBJEXT @@ -779,7 +778,8 @@ PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR -SHELL' +SHELL +am__quote' ac_subst_files='' ac_user_opts=' enable_option_checking @@ -1361,7 +1361,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures lcms2 2.9 to adapt to many kinds of systems. +\`configure' configures lcms2mt 2.10 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1410,7 +1410,7 @@ Fine tuning of the installation directories: --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root [DATAROOTDIR/doc/lcms2] + --docdir=DIR documentation root [DATAROOTDIR/doc/lcms2mt] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] @@ -1432,7 +1432,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of lcms2 2.9:";; + short | recursive ) echo "Configuration of lcms2mt 2.10:";; esac cat <<\_ACEOF @@ -1547,7 +1547,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -lcms2 configure 2.9 +lcms2mt configure 2.10 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2033,7 +2033,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by lcms2 $as_me 2.9, which was +It was created by lcms2mt $as_me 2.10, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2407,7 +2407,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu # then set age to 0. # LIBRARY_CURRENT=2 -LIBRARY_REVISION=8 +LIBRARY_REVISION=10 LIBRARY_AGE=0 @@ -2513,7 +2513,7 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac -am__api_version='1.15' +am__api_version='1.16' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or @@ -2998,8 +2998,8 @@ fi # Define the identity of the package. - PACKAGE='lcms2' - VERSION='2.9' + PACKAGE='lcms2mt' + VERSION='2.10' # Some tools Automake needs. @@ -3020,8 +3020,8 @@ MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: -# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html> -# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html> +# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html> +# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html> mkdir_p='$(MKDIR_P)' # We need awk for the "check" target (and possibly the TAP driver). The @@ -3072,7 +3072,7 @@ END Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation -that behaves properly: <http://www.gnu.org/software/coreutils/>. +that behaves properly: <https://www.gnu.org/software/coreutils/>. If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM @@ -3090,45 +3090,45 @@ DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" - -am_make=${MAKE-make} -cat > confinc << 'END' +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 +$as_echo_n "checking whether ${MAKE-make} supports the include directive... " >&6; } +cat > confinc.mk << 'END' am__doit: - @echo this is the am__doit target + @echo this is the am__doit target >confinc.out .PHONY: am__doit END -# If we don't find an include directive, just comment out the code. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 -$as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# Ignore all kinds of additional output from 'make'. -case `$am_make -s -f confmf 2> /dev/null` in #( -*the\ am__doit\ target*) - am__include=include - am__quote= - _am_result=GNU - ;; -esac -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - case `$am_make -s -f confmf 2> /dev/null` in #( - *the\ am__doit\ target*) - am__include=.include - am__quote="\"" - _am_result=BSD +# BSD make does it like this. +echo '.include "confinc.mk" # ignored' > confmf.BSD +# Other make implementations (GNU, Solaris 10, AIX) do it like this. +echo 'include confinc.mk # ignored' > confmf.GNU +_am_result=no +for s in GNU BSD; do + { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5 + (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + case $?:`cat confinc.out 2>/dev/null` in #( + '0:this is the am__doit target') : + case $s in #( + BSD) : + am__include='.include' am__quote='"' ;; #( + *) : + am__include='include' am__quote='' ;; +esac ;; #( + *) : ;; - esac -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 -$as_echo "$_am_result" >&6; } -rm -f confinc confmf +esac + if test "$am__include" != "#"; then + _am_result="yes ($s style)" + break + fi +done +rm -f confinc.* confmf.* +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 +$as_echo "${_am_result}" >&6; } # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : @@ -16938,7 +16938,8 @@ else fi - ac_fn_c_check_header_mongrel "$LINENO" "jmorecfg.h" "ac_cv_header_jmorecfg_h" "$ac_includes_default" + ac_fn_c_check_header_compile "$LINENO" "jmorecfg.h" "ac_cv_header_jmorecfg_h" "#include <jconfig.h> +" if test "x$ac_cv_header_jmorecfg_h" = xyes; then : passed=`expr $passed + 1` else @@ -17080,7 +17081,7 @@ fi # Check for ZLIB # have_zlib='no' -if test ! "$with_zlib" = 'no' || test ! "$with_png" = 'no' +if test ! "$with_zlib" = 'no' || test ! "$with_tiff" = 'no' then LIB_ZLIB='' { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ZLIB support " >&5 @@ -17593,7 +17594,7 @@ fi -# Libraries that the LCMS library depends on +# Libraries that the LCMS2MT library depends on LCMS_LIB_DEPLIBS="$LIB_MATH $LIB_THREAD" LCMS_LIB_DEPLIBS=`echo $LCMS_LIB_DEPLIBS | sed -e 's/ */ /g'` @@ -17615,7 +17616,7 @@ LIBS='' # ac_config_files="$ac_config_files Makefile" -ac_config_files="$ac_config_files lcms2.pc" +ac_config_files="$ac_config_files lcms2mt.pc" ac_config_files="$ac_config_files include/Makefile" @@ -18220,7 +18221,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by lcms2 $as_me 2.9, which was +This file was extended by lcms2mt $as_me 2.10, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -18277,7 +18278,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -lcms2 config.status 2.9 +lcms2mt config.status 2.10 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -18385,7 +18386,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # -AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" +AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}" # The HP-UX ksh and POSIX shell print the target directory to stdout @@ -18775,7 +18776,7 @@ do "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "lcms2.pc") CONFIG_FILES="$CONFIG_FILES lcms2.pc" ;; + "lcms2mt.pc") CONFIG_FILES="$CONFIG_FILES lcms2mt.pc" ;; "include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "utils/tificc/Makefile") CONFIG_FILES="$CONFIG_FILES utils/tificc/Makefile" ;; @@ -19217,29 +19218,35 @@ $as_echo "$as_me: executing $ac_file commands" >&6;} # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. - case $CONFIG_FILES in - *\'*) eval set x "$CONFIG_FILES" ;; - *) set x $CONFIG_FILES ;; - esac + # TODO: see whether this extra hack can be removed once we start + # requiring Autoconf 2.70 or later. + case $CONFIG_FILES in #( + *\'*) : + eval set x "$CONFIG_FILES" ;; #( + *) : + set x $CONFIG_FILES ;; #( + *) : + ;; +esac shift - for mf + # Used to flag and report bootstrapping failures. + am_rc=0 + for am_mf do # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named 'Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # Grep'ing the whole file is not good either: AIX grep has a line + am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile which includes + # dependency-tracking related rules and includes. + # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then - dirpart=`$as_dirname -- "$mf" || -$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$mf" : 'X\(//\)[^/]' \| \ - X"$mf" : 'X\(//\)$' \| \ - X"$mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$mf" | + sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ + || continue + am_dirpart=`$as_dirname -- "$am_mf" || +$as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$am_mf" : 'X\(//\)[^/]' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$am_mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -19257,53 +19264,48 @@ $as_echo X"$mf" | q } s/.*/./; q'` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running 'make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "$am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`$as_dirname -- "$file" || -$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$file" : 'X\(//\)[^/]' \| \ - X"$file" : 'X\(//\)$' \| \ - X"$file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ + am_filepart=`$as_basename -- "$am_mf" || +$as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$am_mf" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } - /^X\(\/\/\)$/{ + /^X\/\(\/\/\)$/{ s//\1/ q } - /^X\(\/\).*/{ + /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` - as_dir=$dirpart/$fdir; as_fn_mkdir_p - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done + { echo "$as_me:$LINENO: cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles" >&5 + (cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } || am_rc=$? done + if test $am_rc -ne 0; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "Something went wrong bootstrapping makefile fragments + for automatic dependency tracking. Try re-running configure with the + '--disable-dependency-tracking' option to at least be able to build + the package (albeit without support for automatic dependency tracking). +See \`config.log' for more details" "$LINENO" 5; } + fi + { am_dirpart=; unset am_dirpart;} + { am_filepart=; unset am_filepart;} + { am_mf=; unset am_mf;} + { am_rc=; unset am_rc;} + rm -f conftest-deps.mk } ;; "libtool":C) diff --git a/lcms2mt/configure.ac b/lcms2mt/configure.ac index b4c2bc62..e347750f 100644 --- a/lcms2mt/configure.ac +++ b/lcms2mt/configure.ac @@ -7,7 +7,7 @@ AC_PREREQ(2.60) # # Set the package name and version # -AC_INIT(lcms2mt,2.9) +AC_INIT(lcms2mt,2.10) # Specify directory where m4 macros may be found. AC_CONFIG_MACRO_DIR([m4]) @@ -34,7 +34,7 @@ AC_CONFIG_MACRO_DIR([m4]) # then set age to 0. # LIBRARY_CURRENT=2 -LIBRARY_REVISION=8 +LIBRARY_REVISION=10 LIBRARY_AGE=0 AC_SUBST(LIBRARY_CURRENT)dnl @@ -218,7 +218,7 @@ then passed=0; AC_CHECK_HEADER(jconfig.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`) AC_CHECK_HEADER(jerror.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`) - AC_CHECK_HEADER(jmorecfg.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`) + AC_CHECK_HEADER(jmorecfg.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`,[#include <jconfig.h>]) AC_CHECK_HEADER(jpeglib.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`) AC_CHECK_LIB(jpeg,jpeg_read_header,passed=`expr $passed + 1`,failed=`expr $failed + 1`,) @@ -273,8 +273,8 @@ AC_SUBST(LIB_JPEG) # Check for ZLIB # have_zlib='no' -dnl PNG requires zlib so enable zlib check if PNG is requested -if test ! "$with_zlib" = 'no' || test ! "$with_png" = 'no' +dnl TIFF may require zlib so enable zlib check if TIFF is requested +if test ! "$with_zlib" = 'no' || test ! "$with_tiff" = 'no' then LIB_ZLIB='' AC_MSG_CHECKING(for ZLIB support ) @@ -350,9 +350,9 @@ AC_SUBST(LIB_TIFF) # Libraries that the LCMS2MT library depends on -LCMS2MT_LIB_DEPLIBS="$LIB_MATH $LIB_THREAD" -LCMS2MT_LIB_DEPLIBS=`echo $LCMS2MT_LIB_DEPLIBS | sed -e 's/ */ /g'` -AC_SUBST(LCMS2MT_LIB_DEPLIBS) +LCMS_LIB_DEPLIBS="$LIB_MATH $LIB_THREAD" +LCMS_LIB_DEPLIBS=`echo $LCMS_LIB_DEPLIBS | sed -e 's/ */ /g'` +AC_SUBST(LCMS_LIB_DEPLIBS) # Libraries that the jpegicc program depends on JPEGICC_DEPLIBS="$LIB_JPEG $LIB_MATH $LIB_THREAD" diff --git a/lcms2mt/doc/LittleCMS2.10 API.pdf b/lcms2mt/doc/LittleCMS2.10 API.pdf Binary files differnew file mode 100644 index 00000000..2d9223c4 --- /dev/null +++ b/lcms2mt/doc/LittleCMS2.10 API.pdf diff --git a/lcms2mt/doc/LittleCMS2.10 Plugin API.pdf b/lcms2mt/doc/LittleCMS2.10 Plugin API.pdf Binary files differnew file mode 100644 index 00000000..51ae6f6f --- /dev/null +++ b/lcms2mt/doc/LittleCMS2.10 Plugin API.pdf diff --git a/lcms2mt/doc/LittleCMS2.10 tutorial.pdf b/lcms2mt/doc/LittleCMS2.10 tutorial.pdf Binary files differnew file mode 100644 index 00000000..5351c0e3 --- /dev/null +++ b/lcms2mt/doc/LittleCMS2.10 tutorial.pdf diff --git a/lcms2mt/doc/LittleCMS2.9 API.pdf b/lcms2mt/doc/LittleCMS2.9 API.pdf Binary files differdeleted file mode 100644 index 16c16f6b..00000000 --- a/lcms2mt/doc/LittleCMS2.9 API.pdf +++ /dev/null diff --git a/lcms2mt/doc/LittleCMS2.9 Plugin API.pdf b/lcms2mt/doc/LittleCMS2.9 Plugin API.pdf Binary files differdeleted file mode 100644 index 83f30438..00000000 --- a/lcms2mt/doc/LittleCMS2.9 Plugin API.pdf +++ /dev/null diff --git a/lcms2mt/doc/LittleCMS2.9 tutorial.pdf b/lcms2mt/doc/LittleCMS2.9 tutorial.pdf Binary files differdeleted file mode 100644 index 2fd33351..00000000 --- a/lcms2mt/doc/LittleCMS2.9 tutorial.pdf +++ /dev/null diff --git a/lcms2mt/doc/WhyThisFork.txt b/lcms2mt/doc/WhyThisFork.txt index e3cbde47..2026abc7 100644 --- a/lcms2mt/doc/WhyThisFork.txt +++ b/lcms2mt/doc/WhyThisFork.txt @@ -1,5 +1,5 @@ - LCMS 2.9.MT - =========== + LCMS 2.10.MT + ============ Why does this fork exist? ~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/lcms2mt/include/Makefile.in b/lcms2mt/include/Makefile.in index a69fc7f3..be55841c 100644 --- a/lcms2mt/include/Makefile.in +++ b/lcms2mt/include/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -341,8 +341,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -433,7 +433,10 @@ cscopelist-am: $(am__tagged_files) distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ diff --git a/lcms2mt/include/lcms2mt.h b/lcms2mt/include/lcms2mt.h index 6d5ad1aa..5791a5dc 100644 --- a/lcms2mt/include/lcms2mt.h +++ b/lcms2mt/include/lcms2mt.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2017 Marti Maria Saguer +// Copyright (c) 1998-2020 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -23,7 +23,7 @@ // //--------------------------------------------------------------------------------- // -// Version 2.9rc3 +// Version 2.10 // #ifndef _lcms2mt_H @@ -61,6 +61,9 @@ // Uncomment this for special windows mutex initialization (see lcms2_internal.h) // #define CMS_RELY_ON_WINDOWS_STATIC_MUTEX_INIT +// Uncomment this to remove the "register" storage class +// #define CMS_NO_REGISTER_KEYWORD 1 + // ********** End of configuration toggles ****************************** // Needed for streams @@ -78,15 +81,15 @@ extern "C" { #endif // Version/release -// Vanilla LCMS2 uses values from 2000-2090. This is +// Vanilla LCMS2 uses values from 2000-2100. This is // used as an unsigned number. We want any attempt to // use OUR numbers with a mainline LCMS to fail, so -// we have to go under 2000-2090. Let's subtract +// we have to go under 2000-2100. Let's subtract // 2000 from the mainline release. -#define LCMS_VERSION (2090 - 2000) +#define LCMS_VERSION (2100 - 2000) // We expect any LCMS2MT release to fall within the -// following rance. +// following range. #define LCMS2MT_VERSION_MIN (0) #define LCMS2MT_VERSION_MAX (999) @@ -158,6 +161,13 @@ typedef double cmsFloat64Number; #endif #endif +// Handle "register" keyword +#if defined(CMS_NO_REGISTER_KEYWORD) && !defined(CMS_DLL) && !defined(CMS_DLL_BUILD) +# define CMSREGISTER +#else +# define CMSREGISTER register +#endif + // In the case 64 bit numbers are not supported by the compiler #ifdef CMS_DONT_USE_INT64 typedef cmsUInt32Number cmsUInt64Number[2]; @@ -244,10 +254,15 @@ typedef int cmsBool; # define CMSEXPORT # define CMSAPI # endif +#else // not Windows +# ifdef HAVE_FUNC_ATTRIBUTE_VISIBILITY +# define CMSEXPORT +# define CMSAPI __attribute__((visibility("default"))) #else # define CMSEXPORT # define CMSAPI #endif +#endif // CMS_IS_WINDOWS_ #ifdef HasTHREADS # if HasTHREADS == 1 @@ -1035,7 +1050,7 @@ CMSAPI long int CMSEXPORT cmsfilelength(FILE* f); typedef struct _cmsContext_struct* cmsContext; CMSAPI cmsContext CMSEXPORT cmsCreateContext(void* Plugin, void* UserData); -CMSAPI void CMSEXPORT cmsDeleteContext(cmsContext ContexID); +CMSAPI void CMSEXPORT cmsDeleteContext(cmsContext ContextID); CMSAPI cmsContext CMSEXPORT cmsDupContext(cmsContext ContextID, void* NewUserData); CMSAPI void* CMSEXPORT cmsGetContextUserData(cmsContext ContextID); @@ -1249,13 +1264,15 @@ CMSAPI cmsStageSignature CMSEXPORT cmsStageType(cmsContext ContextID, const cmsS CMSAPI void* CMSEXPORT cmsStageData(cmsContext ContextID, const cmsStage* mpe); // Sampling -typedef cmsInt32Number (* cmsSAMPLER16) (cmsContext ContextID, register const cmsUInt16Number In[], - register cmsUInt16Number Out[], - register void * Cargo); +typedef cmsInt32Number (* cmsSAMPLER16) (cmsContext ContextID, + CMSREGISTER const cmsUInt16Number In[], + CMSREGISTER cmsUInt16Number Out[], + CMSREGISTER void * Cargo); -typedef cmsInt32Number (* cmsSAMPLERFLOAT)(cmsContext ContextID, register const cmsFloat32Number In[], - register cmsFloat32Number Out[], - register void * Cargo); +typedef cmsInt32Number (* cmsSAMPLERFLOAT)(cmsContext ContextID, + CMSREGISTER const cmsFloat32Number In[], + CMSREGISTER cmsFloat32Number Out[], + CMSREGISTER void * Cargo); // Use this flag to prevent changes being written to destination #define SAMPLER_INSPECT 0x01000000 @@ -1396,7 +1413,6 @@ typedef struct { typedef struct { cmsUInt32Number n; - cmsContext ContextIDContextID; cmsPSEQDESC* seq; } cmsSEQ; @@ -1644,8 +1660,6 @@ CMSAPI cmsUInt32Number CMSEXPORT cmsGetSupportedIntents(cmsContext ContextID, // Copy alpha channels when transforming #define cmsFLAGS_COPY_ALPHA 0x04000000 // Alpha channels are copied on cmsDoTransform() -#define cmsFLAGS_FORCE_LINEARINTERP 0x08000000 // Force slower but more accurate interpolation - // Fine-tune control over number of gridpoints #define cmsFLAGS_GRIDPOINTS(n) (((n) & 0xFF) << 16) diff --git a/lcms2mt/include/lcms2mt_plugin.h b/lcms2mt/include/lcms2mt_plugin.h index efd05a34..fad17247 100644 --- a/lcms2mt/include/lcms2mt_plugin.h +++ b/lcms2mt/include/lcms2mt_plugin.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2017 Marti Maria Saguer +// Copyright (c) 1998-2020 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -94,6 +94,12 @@ CMSAPI cmsBool CMSEXPORT _cmsMAT3solve(cmsContext ContextID, cmsVEC3* CMSAPI void CMSEXPORT _cmsMAT3eval(cmsContext ContextID, cmsVEC3* r, const cmsMAT3* a, const cmsVEC3* v); +// MD5 low level ------------------------------------------------------------------------------------- + +CMSAPI cmsHANDLE CMSEXPORT cmsMD5alloc(cmsContext ContextID); +CMSAPI void CMSEXPORT cmsMD5add(cmsHANDLE Handle, const cmsUInt8Number* buf, cmsUInt32Number len); +CMSAPI void CMSEXPORT cmsMD5finish(cmsContext ContextID, cmsProfileID* ProfileID, cmsHANDLE Handle); + // Error logging ------------------------------------------------------------------------------------- CMSAPI void CMSEXPORT cmsSignalError(cmsContext ContextID, cmsUInt32Number ErrorCode, const char *ErrorText, ...); @@ -254,9 +260,10 @@ struct _cms_interp_struc; // 16 bits forward interpolation. This function performs precision-limited linear interpolation // and is supposed to be quite fast. Implementation may be tetrahedral or trilinear, and plug-ins may // choose to implement any other interpolation algorithm. -typedef void (* _cmsInterpFn16)(cmsContext ContextID, register const cmsUInt16Number Input[], - register cmsUInt16Number Output[], - register const struct _cms_interp_struc* p); +typedef void (* _cmsInterpFn16)(cmsContext ContextID, + CMSREGISTER const cmsUInt16Number Input[], + CMSREGISTER cmsUInt16Number Output[], + CMSREGISTER const struct _cms_interp_struc* p); // Floating point forward interpolation. Full precision interpolation using floats. This is not a // time critical function. Implementation may be tetrahedral or trilinear, and plug-ins may @@ -337,10 +344,11 @@ typedef struct { struct _cmstransform_struct; -typedef cmsUInt8Number* (* cmsFormatter16)(cmsContext ContextID, register struct _cmstransform_struct* CMMcargo, - register cmsUInt16Number Values[], - register cmsUInt8Number* Buffer, - register cmsUInt32Number Stride); +typedef cmsUInt8Number* (* cmsFormatter16)(cmsContext ContextID, + CMSREGISTER struct _cmstransform_struct* CMMcargo, + CMSREGISTER cmsUInt16Number Values[], + CMSREGISTER cmsUInt8Number* Buffer, + CMSREGISTER cmsUInt32Number Stride); typedef cmsUInt8Number* (* cmsFormatterFloat)(cmsContext ContextID, struct _cmstransform_struct* CMMcargo, cmsFloat32Number Values[], @@ -537,9 +545,10 @@ typedef struct { // the optimization search. Or FALSE if it is unable to optimize and want to give a chance // to the rest of optimizers. -typedef void (* _cmsOPTeval16Fn)(cmsContext ContextID, register const cmsUInt16Number In[], - register cmsUInt16Number Out[], - register const void* Data); +typedef void (* _cmsOPTeval16Fn)(cmsContext ContextID, + CMSREGISTER const cmsUInt16Number In[], + CMSREGISTER cmsUInt16Number Out[], + CMSREGISTER const void* Data); typedef cmsBool (* _cmsOPToptimizeFn)(cmsContext ContextID, cmsPipeline** Lut, diff --git a/lcms2mt/plugins/README.1ST b/lcms2mt/plugins/README.1ST new file mode 100644 index 00000000..c8ab2860 --- /dev/null +++ b/lcms2mt/plugins/README.1ST @@ -0,0 +1,6 @@ + + + IMPORTANT: Before adding those plug-ins to your commercial project, please check licenses for each plugin. + + LittleCMS core is released under MIT, but plug-ins may be released under other license. fast_float, for example is GPL3 +
\ No newline at end of file diff --git a/lcms2mt/plugins/fast_float/COPYING.GPL3 b/lcms2mt/plugins/fast_float/COPYING.GPL3 new file mode 100644 index 00000000..20d40b6b --- /dev/null +++ b/lcms2mt/plugins/fast_float/COPYING.GPL3 @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + <program> Copyright (C) <year> <name of author> + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<http://www.gnu.org/licenses/>. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +<http://www.gnu.org/philosophy/why-not-lgpl.html>.
\ No newline at end of file diff --git a/lcms2mt/plugins/fast_float/Makefile b/lcms2mt/plugins/fast_float/Makefile new file mode 100644 index 00000000..c77ff48c --- /dev/null +++ b/lcms2mt/plugins/fast_float/Makefile @@ -0,0 +1,12 @@ + +# Dummy +all: +check: +install: +install-exec: +uninstall: +clean: +distclean: + echo . + +
\ No newline at end of file diff --git a/lcms2mt/plugins/fast_float/Projects/VC2019/lcms2mt_fast_float_plugin.vcxproj b/lcms2mt/plugins/fast_float/Projects/VC2019/lcms2mt_fast_float_plugin.vcxproj new file mode 100644 index 00000000..4c45cd6a --- /dev/null +++ b/lcms2mt/plugins/fast_float/Projects/VC2019/lcms2mt_fast_float_plugin.vcxproj @@ -0,0 +1,201 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\include\lcms2mt_fast_float.h" /> + <ClInclude Include="..\..\src\fast_float_internal.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\src\fast_16_tethra.c" /> + <ClCompile Include="..\..\src\fast_8_curves.c" /> + <ClCompile Include="..\..\src\fast_8_matsh.c" /> + <ClCompile Include="..\..\src\fast_8_tethra.c" /> + <ClCompile Include="..\..\src\fast_float_15bits.c" /> + <ClCompile Include="..\..\src\fast_float_15mats.c" /> + <ClCompile Include="..\..\src\fast_float_cmyk.c" /> + <ClCompile Include="..\..\src\fast_float_curves.c" /> + <ClCompile Include="..\..\src\fast_float_matsh.c" /> + <ClCompile Include="..\..\src\fast_float_separate.c" /> + <ClCompile Include="..\..\src\fast_float_sup.c" /> + <ClCompile Include="..\..\src\fast_float_tethra.c" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\..\Projects\VC2019\lcms2mt_static\lcms2mt_static.vcxproj"> + <Project>{71dede59-3f1e-486b-a899-4283000f76b5}</Project> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <None Include="..\..\COPYING.GPL3" /> + <None Include="..\..\doc\LittleCMS fast float extensions 1.0.pdf" /> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{AD9FF79B-CF6E-4971-A7CF-DAA47D636676}</ProjectGuid> + <Keyword>Win32Proj</Keyword> + <RootNamespace>fast</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <CharacterSet>Unicode</CharacterSet> + <PlatformToolset>v142</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <CharacterSet>Unicode</CharacterSet> + <PlatformToolset>v142</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>Unicode</CharacterSet> + <PlatformToolset>v142</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>Unicode</CharacterSet> + <PlatformToolset>v142</PlatformToolset> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> + <IntDir>$(Platform)\fast_float_plugin_$(Configuration)\</IntDir> + <OutDir>..\..\..\..\Lib\MS\</OutDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> + <IntDir>$(Platform)\fast_float_plugin_$(Configuration)\</IntDir> + <OutDir>..\..\..\..\Lib\MS\</OutDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <IntDir>$(Platform)\fast_float_plugin_$(Configuration)\</IntDir> + <OutDir>..\..\..\..\Lib\MS\</OutDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <IntDir>$(Platform)\fast_float_plugin_$(Configuration)\</IntDir> + <OutDir>..\..\..\..\Lib\MS\</OutDir> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>..\..\include;..\..\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <FloatingPointModel>Fast</FloatingPointModel> + </ClCompile> + <Link> + <SubSystem>Windows</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;WIN64;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>..\..\include;..\..\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <FloatingPointModel>Fast</FloatingPointModel> + </ClCompile> + <Link> + <SubSystem>Windows</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <WarningLevel>Level4</WarningLevel> + <PrecompiledHeader> + </PrecompiledHeader> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>..\..\include;..\..\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <BrowseInformation>false</BrowseInformation> + <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <OmitFramePointers>true</OmitFramePointers> + <EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations> + <FloatingPointModel>Fast</FloatingPointModel> + <EnableParallelCodeGeneration>true</EnableParallelCodeGeneration> + </ClCompile> + <Link> + <SubSystem>Windows</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + <Bscmake> + <PreserveSbr>true</PreserveSbr> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <WarningLevel>Level4</WarningLevel> + <PrecompiledHeader> + </PrecompiledHeader> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>WIN32;WIN64;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>..\..\include;..\..\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <OmitFramePointers>true</OmitFramePointers> + <EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations> + <EnableParallelCodeGeneration>true</EnableParallelCodeGeneration> + <FloatingPointModel>Fast</FloatingPointModel> + </ClCompile> + <Link> + <SubSystem>Windows</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/lcms2mt/plugins/fast_float/Projects/VC2019/lcms2mt_fast_float_plugin.vcxproj.filters b/lcms2mt/plugins/fast_float/Projects/VC2019/lcms2mt_fast_float_plugin.vcxproj.filters new file mode 100644 index 00000000..f78d01cd --- /dev/null +++ b/lcms2mt/plugins/fast_float/Projects/VC2019/lcms2mt_fast_float_plugin.vcxproj.filters @@ -0,0 +1,69 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Source Files"> + <UniqueIdentifier>{7d5b1769-2be4-46f2-9e35-6260eea79d7f}</UniqueIdentifier> + </Filter> + <Filter Include="doc"> + <UniqueIdentifier>{012df308-35db-4909-b035-b1cd5fd1ee5b}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\include\lcms2mt_fast_float.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\src\fast_float_internal.h"> + <Filter>Source Files</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\src\fast_float_15bits.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\fast_float_curves.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\fast_float_separate.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\fast_float_sup.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\fast_float_tethra.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\fast_float_15mats.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\fast_float_matsh.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\fast_float_cmyk.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\fast_8_matsh.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\fast_8_curves.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\fast_8_tethra.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\src\fast_16_tethra.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <None Include="..\..\COPYING.GPL3"> + <Filter>doc</Filter> + </None> + <None Include="..\..\doc\LittleCMS fast float extensions 1.0.pdf"> + <Filter>doc</Filter> + </None> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/lcms2mt/plugins/fast_float/Projects/VC2019/lcms2mt_fast_float_plugin.vcxproj.user b/lcms2mt/plugins/fast_float/Projects/VC2019/lcms2mt_fast_float_plugin.vcxproj.user new file mode 100644 index 00000000..88a55094 --- /dev/null +++ b/lcms2mt/plugins/fast_float/Projects/VC2019/lcms2mt_fast_float_plugin.vcxproj.user @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup /> +</Project>
\ No newline at end of file diff --git a/lcms2mt/plugins/fast_float/Projects/VC2019/lcms2mt_fast_float_plugin_testbed.vcxproj b/lcms2mt/plugins/fast_float/Projects/VC2019/lcms2mt_fast_float_plugin_testbed.vcxproj new file mode 100644 index 00000000..771e42ec --- /dev/null +++ b/lcms2mt/plugins/fast_float/Projects/VC2019/lcms2mt_fast_float_plugin_testbed.vcxproj @@ -0,0 +1,170 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{7629D670-C419-402B-8A90-747952EE9FC0}</ProjectGuid> + <Keyword>Win32Proj</Keyword> + <RootNamespace>fast_testbed</RootNamespace> + <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <CharacterSet>Unicode</CharacterSet> + <PlatformToolset>v142</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <CharacterSet>Unicode</CharacterSet> + <PlatformToolset>v142</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>Unicode</CharacterSet> + <PlatformToolset>v142</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>Unicode</CharacterSet> + <PlatformToolset>v142</PlatformToolset> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <LinkIncremental>true</LinkIncremental> + <IntDir>$(Platform)\testbed_$(Configuration)\</IntDir> + <OutDir>$(ProjectDir)..\..\testbed\</OutDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <LinkIncremental>true</LinkIncremental> + <IntDir>$(Platform)\testbed_$(Configuration)\</IntDir> + <OutDir>$(ProjectDir)..\..\testbed\</OutDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <LinkIncremental>false</LinkIncremental> + <IntDir>$(Platform)\testbed_$(Configuration)\</IntDir> + <OutDir>$(ProjectDir)..\..\testbed\</OutDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <LinkIncremental>false</LinkIncremental> + <IntDir>$(Platform)\testbed_$(Configuration)\</IntDir> + <OutDir>$(ProjectDir)..\..\testbed\</OutDir> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>..\..\..\..\include;..\..\include;..\..\src</AdditionalIncludeDirectories> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>..\..\..\..\include;..\..\include;..\..\src</AdditionalIncludeDirectories> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <WarningLevel>Level4</WarningLevel> + <PrecompiledHeader> + </PrecompiledHeader> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>..\..\..\..\include;..\..\include;..\..\src</AdditionalIncludeDirectories> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <WarningLevel>Level4</WarningLevel> + <PrecompiledHeader> + </PrecompiledHeader> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>..\..\..\..\include;..\..\include;..\..\src</AdditionalIncludeDirectories> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\testbed\fast_float_testbed.c" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\..\Projects\VC2019\lcms2mt_static\lcms2mt_static.vcxproj"> + <Project>{71dede59-3f1e-486b-a899-4283000f76b5}</Project> + </ProjectReference> + <ProjectReference Include="lcms2mt_fast_float_plugin.vcxproj"> + <Project>{ad9ff79b-cf6e-4971-a7cf-daa47d636676}</Project> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> diff --git a/lcms2mt/plugins/fast_float/Projects/VC2019/lcms2mt_fast_float_plugin_testbed.vcxproj.filters b/lcms2mt/plugins/fast_float/Projects/VC2019/lcms2mt_fast_float_plugin_testbed.vcxproj.filters new file mode 100644 index 00000000..4cec6b7c --- /dev/null +++ b/lcms2mt/plugins/fast_float/Projects/VC2019/lcms2mt_fast_float_plugin_testbed.vcxproj.filters @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\testbed\fast_float_testbed.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/lcms2mt/plugins/fast_float/Projects/VC2019/lcms2mt_fast_float_plugin_testbed.vcxproj.user b/lcms2mt/plugins/fast_float/Projects/VC2019/lcms2mt_fast_float_plugin_testbed.vcxproj.user new file mode 100644 index 00000000..88a55094 --- /dev/null +++ b/lcms2mt/plugins/fast_float/Projects/VC2019/lcms2mt_fast_float_plugin_testbed.vcxproj.user @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup /> +</Project>
\ No newline at end of file diff --git a/lcms2mt/plugins/fast_float/doc/LittleCMS fast float extensions 1.0.pdf b/lcms2mt/plugins/fast_float/doc/LittleCMS fast float extensions 1.0.pdf Binary files differnew file mode 100644 index 00000000..e6e0daa1 --- /dev/null +++ b/lcms2mt/plugins/fast_float/doc/LittleCMS fast float extensions 1.0.pdf diff --git a/lcms2mt/plugins/fast_float/include/Makefile.am b/lcms2mt/plugins/fast_float/include/Makefile.am new file mode 100644 index 00000000..01d8ed71 --- /dev/null +++ b/lcms2mt/plugins/fast_float/include/Makefile.am @@ -0,0 +1,6 @@ +# +# Makefile for include directory + +include_HEADERS = lcms2mt_fast_float.h + +EXTRA_DIST = lcms2mt_fast_float.h diff --git a/lcms2mt/plugins/fast_float/include/lcms2mt_fast_float.h b/lcms2mt/plugins/fast_float/include/lcms2mt_fast_float.h new file mode 100644 index 00000000..572d82d1 --- /dev/null +++ b/lcms2mt/plugins/fast_float/include/lcms2mt_fast_float.h @@ -0,0 +1,139 @@ +//--------------------------------------------------------------------------------- +// +// Little Color Management System, fast floating point extensions +// Copyright (c) 1998-2020 Marti Maria Saguer, all rights reserved +// +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +//--------------------------------------------------------------------------------- + +#ifndef _LCMS2MT_FAST_FLOAT_H +#define _LCMS2MT_FAST_FLOAT_H + +#include "lcms2mt_plugin.h" + +#ifndef CMS_USE_CPP_API +# ifdef __cplusplus +extern "C" { +# endif +#endif + +#define LCMS2_FAST_FLOAT_VERSION 1200 + +// The one and only plug-in entry point. To install this plugin in your code +// you need to place this in some initialization place: +// +// cmsPlugin(cmsFastFloatExtensions()); +// + +void* cmsFastFloatExtensions(void); + + +// New encodings that the plug-in implements + +#define BIT15_SH(a) ((a) << 26) +#define T_BIT15(a) (((a)>>26)&1) +#define DITHER_SH(a) ((a) << 27) +#define T_DITHER(a) (((a)>>27)&1) + +#define TYPE_GRAY_15 (COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(2)|BIT15_SH(1)) +#define TYPE_GRAY_15_REV (COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(2)|FLAVOR_SH(1)|BIT15_SH(1)) +#define TYPE_GRAY_15_SE (COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(2)|ENDIAN16_SH(1)|BIT15_SH(1)) +#define TYPE_GRAYA_15 (COLORSPACE_SH(PT_GRAY)|EXTRA_SH(1)|CHANNELS_SH(1)|BYTES_SH(2)|BIT15_SH(1)) +#define TYPE_GRAYA_15_SE (COLORSPACE_SH(PT_GRAY)|EXTRA_SH(1)|CHANNELS_SH(1)|BYTES_SH(2)|ENDIAN16_SH(1)|BIT15_SH(1)) +#define TYPE_GRAYA_15_PLANAR (COLORSPACE_SH(PT_GRAY)|EXTRA_SH(1)|CHANNELS_SH(1)|BYTES_SH(2)|PLANAR_SH(1)|BIT15_SH(1)) + +#define TYPE_RGB_15 (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2)|BIT15_SH(1)) +#define TYPE_RGB_15_PLANAR (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2)|PLANAR_SH(1)|BIT15_SH(1)) +#define TYPE_RGB_15_SE (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2)|ENDIAN16_SH(1)|BIT15_SH(1)) + +#define TYPE_BGR_15 (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1)|BIT15_SH(1)) +#define TYPE_BGR_15_PLANAR (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1)|PLANAR_SH(1)|BIT15_SH(1)) +#define TYPE_BGR_15_SE (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1)|BIT15_SH(1)) + +#define TYPE_RGBA_15 (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|BIT15_SH(1)) +#define TYPE_RGBA_15_PLANAR (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|PLANAR_SH(1)|BIT15_SH(1)) +#define TYPE_RGBA_15_SE (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|ENDIAN16_SH(1)|BIT15_SH(1)) + +#define TYPE_ARGB_15 (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|SWAPFIRST_SH(1)|BIT15_SH(1)) + +#define TYPE_ABGR_15 (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1)|BIT15_SH(1)) +#define TYPE_ABGR_15_PLANAR (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1)|PLANAR_SH(1)|BIT15_SH(1)) +#define TYPE_ABGR_15_SE (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1)|BIT15_SH(1)) + +#define TYPE_BGRA_15 (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1)|SWAPFIRST_SH(1)|BIT15_SH(1)) +#define TYPE_BGRA_15_SE (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|ENDIAN16_SH(1)|DOSWAP_SH(1)|SWAPFIRST_SH(1)|BIT15_SH(1)) + +#define TYPE_CMY_15 (COLORSPACE_SH(PT_CMY)|CHANNELS_SH(3)|BYTES_SH(2)|BIT15_SH(1)) +#define TYPE_YMC_15 (COLORSPACE_SH(PT_CMY)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1)|BIT15_SH(1)) +#define TYPE_CMY_15_PLANAR (COLORSPACE_SH(PT_CMY)|CHANNELS_SH(3)|BYTES_SH(2)|PLANAR_SH(1)|BIT15_SH(1)) +#define TYPE_CMY_15_SE (COLORSPACE_SH(PT_CMY)|CHANNELS_SH(3)|BYTES_SH(2)|ENDIAN16_SH(1)|BIT15_SH(1)) + +#define TYPE_CMYK_15 (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|BIT15_SH(1)) +#define TYPE_CMYK_15_REV (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|FLAVOR_SH(1)|BIT15_SH(1)) +#define TYPE_CMYK_15_PLANAR (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|PLANAR_SH(1)|BIT15_SH(1)) +#define TYPE_CMYK_15_SE (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|ENDIAN16_SH(1)|BIT15_SH(1)) + +#define TYPE_KYMC_15 (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|DOSWAP_SH(1)|BIT15_SH(1)) +#define TYPE_KYMC_15_SE (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1)|BIT15_SH(1)) + +#define TYPE_KCMY_15 (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|SWAPFIRST_SH(1)|BIT15_SH(1)) +#define TYPE_KCMY_15_REV (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|FLAVOR_SH(1)|SWAPFIRST_SH(1)|BIT15_SH(1)) +#define TYPE_KCMY_15_SE (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|ENDIAN16_SH(1)|SWAPFIRST_SH(1)|BIT15_SH(1)) + +#define TYPE_GRAY_8_DITHER (COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(1)|DITHER_SH(1)) +#define TYPE_RGB_8_DITHER (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(1)|DITHER_SH(1)) +#define TYPE_RGBA_8_DITHER (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(1)|EXTRA_SH(1)|DITHER_SH(1)) +#define TYPE_BGR_8_DITHER (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(1)|DOSWAP_SH(1)|DITHER_SH(1)) +#define TYPE_ABGR_8_DITHER (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(1)|DOSWAP_SH(1)|EXTRA_SH(1)|DITHER_SH(1)) +#define TYPE_CMYK_8_DITHER (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(1)|DITHER_SH(1)) +#define TYPE_KYMC_8_DITHER (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(1)|DOSWAP_SH(1)|DITHER_SH(1)) + + +#define TYPE_AGRAY_8 (COLORSPACE_SH(PT_GRAY)|EXTRA_SH(1)|CHANNELS_SH(1)|DOSWAP_SH(1)|BYTES_SH(1)) +#define TYPE_AGRAY_16 (COLORSPACE_SH(PT_GRAY)|EXTRA_SH(1)|CHANNELS_SH(1)|DOSWAP_SH(1)|BYTES_SH(2)) +#define TYPE_AGRAY_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_GRAY)|EXTRA_SH(1)|CHANNELS_SH(1)|DOSWAP_SH(1)|BYTES_SH(4)) +#define TYPE_GRAYA_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_GRAY)|EXTRA_SH(1)|CHANNELS_SH(1)|BYTES_SH(4)) +#define TYPE_AGRAY_DBL (FLOAT_SH(1)|COLORSPACE_SH(PT_GRAY)|EXTRA_SH(1)|CHANNELS_SH(1)|DOSWAP_SH(1)|BYTES_SH(0)) + +#define TYPE_ACMYK_8 (COLORSPACE_SH(PT_CMYK)|EXTRA_SH(1)|CHANNELS_SH(4)|BYTES_SH(1)|SWAPFIRST_SH(1)) +#define TYPE_KYMCA_8 (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|EXTRA_SH(1)|BYTES_SH(1)|DOSWAP_SH(1)|SWAPFIRST_SH(1)) +#define TYPE_AKYMC_8 (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|EXTRA_SH(1)|BYTES_SH(1)|DOSWAP_SH(1)) + +#define TYPE_CMYKA_16 (COLORSPACE_SH(PT_CMYK)|EXTRA_SH(1)|CHANNELS_SH(4)|BYTES_SH(2)) +#define TYPE_ACMYK_16 (COLORSPACE_SH(PT_CMYK)|EXTRA_SH(1)|CHANNELS_SH(4)|BYTES_SH(2)|SWAPFIRST_SH(1)) +#define TYPE_KYMCA_16 (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|EXTRA_SH(1)|BYTES_SH(2)|DOSWAP_SH(1)|SWAPFIRST_SH(1)) +#define TYPE_AKYMC_16 (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|EXTRA_SH(1)|BYTES_SH(2)|DOSWAP_SH(1)) + + +#define TYPE_AGRAY_8_PLANAR (COLORSPACE_SH(PT_GRAY)|EXTRA_SH(1)|CHANNELS_SH(1)|BYTES_SH(1)|PLANAR_SH(1)|SWAPFIRST_SH(1)) +#define TYPE_AGRAY_16_PLANAR (COLORSPACE_SH(PT_GRAY)|EXTRA_SH(1)|CHANNELS_SH(1)|BYTES_SH(2)|PLANAR_SH(1)|SWAPFIRST_SH(1)) + +#define TYPE_GRAYA_FLT_PLANAR (FLOAT_SH(1)|COLORSPACE_SH(PT_GRAY)|EXTRA_SH(1)|CHANNELS_SH(1)|BYTES_SH(4)|PLANAR_SH(1)) +#define TYPE_AGRAY_FLT_PLANAR (FLOAT_SH(1)|COLORSPACE_SH(PT_GRAY)|EXTRA_SH(1)|CHANNELS_SH(1)|BYTES_SH(4)|PLANAR_SH(1)|SWAPFIRST_SH(1)) + +#define TYPE_GRAYA_DBL_PLANAR (FLOAT_SH(1)|COLORSPACE_SH(PT_GRAY)|EXTRA_SH(1)|CHANNELS_SH(1)|BYTES_SH(0)|PLANAR_SH(1)) +#define TYPE_AGRAY_DBL_PLANAR (FLOAT_SH(1)|COLORSPACE_SH(PT_GRAY)|EXTRA_SH(1)|CHANNELS_SH(1)|BYTES_SH(0)|PLANAR_SH(1)|SWAPFIRST_SH(1)) + +#define TYPE_ARGB_16_PLANAR (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|SWAPFIRST_SH(1)|PLANAR_SH(1)) +#define TYPE_BGRA_16_PLANAR (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|SWAPFIRST_SH(1)|DOSWAP_SH(1)|PLANAR_SH(1)) + +#ifndef CMS_USE_CPP_API +# ifdef __cplusplus + } +# endif +#endif + +#endif diff --git a/lcms2mt/plugins/fast_float/src/Makefile.am b/lcms2mt/plugins/fast_float/src/Makefile.am new file mode 100644 index 00000000..a7d1af38 --- /dev/null +++ b/lcms2mt/plugins/fast_float/src/Makefile.am @@ -0,0 +1,27 @@ +# +# Makefile for building lcms2_fast_float library +# + +# Don't require all the GNU mandated files +AUTOMAKE_OPTIONS = 1.7 foreign + +includedir = ${prefix}/include + +# Shared libraries built in this directory +lib_LTLIBRARIES = liblcms2mt_fast_float.la + +LIBRARY_CURRENT = 1 +LIBRARY_REVISION = 1 +LIBRARY_AGE = 0 + +INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I$(srcdir)/../include -I$(builddir)/../include + +liblcms2mt_fast_float_la_LDFLAGS = -no-undefined \ + -version-info $(LIBRARY_CURRENT):$(LIBRARY_REVISION):$(LIBRARY_AGE) + +liblcms2mt_fast_float_la_LIBADD = $(LCMS_LIB_DEPLIBS) $(top_builddir)/src/liblcms2mt.la + +liblcms2mt_fast_float_la_SOURCES = \ + fast_float_15bits.c fast_float_15mats.c fast_float_curves.c fast_float_matsh.c fast_float_separate.c \ + fast_float_sup.c fast_float_tethra.c fast_float_cmyk.c fast_float_internal.h \ + fast_8_curves.c fast_8_matsh.c fast_8_tethra.c diff --git a/lcms2mt/plugins/fast_float/src/fast_16_tethra.c b/lcms2mt/plugins/fast_float/src/fast_16_tethra.c new file mode 100644 index 00000000..a67340d5 --- /dev/null +++ b/lcms2mt/plugins/fast_float/src/fast_16_tethra.c @@ -0,0 +1,370 @@ +//--------------------------------------------------------------------------------- +// +// Little Color Management System, fast floating point extensions +// Copyright (c) 1998-2020 Marti Maria Saguer, all rights reserved +// +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +//--------------------------------------------------------------------------------- + +#include "fast_float_internal.h" + +// lcms internal +cmsBool _cmsOptimizePipeline(cmsContext ContextID, + cmsPipeline** Lut, + cmsUInt32Number Intent, + cmsUInt32Number* InputFormat, + cmsUInt32Number* OutputFormat, + cmsUInt32Number* dwFlags); + + +// Optimization for 16 bits, 3 inputs only +typedef struct { + + const cmsInterpParams* p; // Tetrahedrical interpolation parameters. This is a not-owned pointer. + +} Performance16Data; + + +// Precomputes tables for 16-bit on input devicelink. +static +Performance16Data* Performance16alloc(cmsContext ContextID, const cmsInterpParams* p) +{ + Performance16Data* p16; + + p16 = (Performance16Data*) _cmsMallocZero(ContextID, sizeof(Performance16Data)); + if (p16 == NULL) return NULL; + + p16 ->p = p; + + return p16; +} + +static +void Performance16free(cmsContext ContextID, void* ptr) +{ + _cmsFree(ContextID, ptr); +} + +/** +* Because cmsChangeBuffersFormat, we have to allow this code to output data in either 8 or 16 bits. +* The increments are already computed correctly, but the data may change. So, we use a macro to +* increase xput +*/ +#define TO_OUTPUT_16(d,v) do { *(cmsUInt16Number*) (d) = v; } while(0) +#define TO_OUTPUT_8(d,v) do { *(cmsUInt8Number*) (d) = FROM_16_TO_8(v); } while(0) + +#define TO_OUTPUT(d,v) do { if (out16) TO_OUTPUT_16(d,v); else TO_OUTPUT_8(d,v); } while(0) + +#define FROM_INPUT(v) (in16 ? (*((const cmsUInt16Number*)(v))) : FROM_8_TO_16(*((const cmsUInt8Number*)(v)))) + +static +void PerformanceEval16(cmsContext ContextID, + struct _cmstransform_struct *CMMcargo, + const void* Input, + void* Output, + cmsUInt32Number PixelsPerLine, + cmsUInt32Number LineCount, + const cmsStride* Stride) +{ + + cmsUInt16Number r, g, b; + int x0, y0, z0; + cmsS15Fixed16Number rx, ry, rz; + cmsS15Fixed16Number fx, fy, fz; + cmsS15Fixed16Number c0, c1, c2, c3, Rest; + cmsUInt32Number OutChan, TotalPlusAlpha; + cmsS15Fixed16Number X0, X1, Y0, Y1, Z0, Z1; + Performance16Data* p16 = (Performance16Data*)_cmsGetTransformUserData(CMMcargo); + const cmsInterpParams* p = p16->p; + cmsUInt32Number TotalOut = p->nOutputs; + const cmsUInt16Number* BaseTable = (const cmsUInt16Number*)p->Table; + const cmsUInt16Number* LutTable; + + cmsUInt8Number* out[cmsMAXCHANNELS]; + cmsUInt16Number res16; + + cmsUInt32Number i, ii; + + cmsUInt32Number SourceStartingOrder[cmsMAXCHANNELS]; + cmsUInt32Number SourceIncrements[cmsMAXCHANNELS]; + cmsUInt32Number DestStartingOrder[cmsMAXCHANNELS]; + cmsUInt32Number DestIncrements[cmsMAXCHANNELS]; + + const cmsUInt8Number* rin; + const cmsUInt8Number* gin; + const cmsUInt8Number* bin; + const cmsUInt8Number* ain = NULL; + + int in16, out16; // Used by macros! + + cmsUInt32Number nalpha, strideIn, strideOut; + + cmsUInt32Number dwInFormat = cmsGetTransformInputFormat(ContextID, (cmsHTRANSFORM)CMMcargo); + cmsUInt32Number dwOutFormat = cmsGetTransformOutputFormat(ContextID, (cmsHTRANSFORM)CMMcargo); + + _cmsComputeComponentIncrements(dwInFormat, Stride->BytesPerPlaneIn, NULL, &nalpha, SourceStartingOrder, SourceIncrements); + _cmsComputeComponentIncrements(dwOutFormat, Stride->BytesPerPlaneOut, NULL, &nalpha, DestStartingOrder, DestIncrements); + + in16 = (T_BYTES(dwInFormat) == 2); + out16 = (T_BYTES(dwOutFormat) == 2); + + strideIn = strideOut = 0; + for (i = 0; i < LineCount; i++) { + + rin = (const cmsUInt8Number*)Input + SourceStartingOrder[0] + strideIn; + gin = (const cmsUInt8Number*)Input + SourceStartingOrder[1] + strideIn; + bin = (const cmsUInt8Number*)Input + SourceStartingOrder[2] + strideIn; + if (nalpha) + ain = (const cmsUInt8Number*)Input + SourceStartingOrder[3] + strideIn; + + TotalPlusAlpha = TotalOut; + if (ain) TotalPlusAlpha++; + + for (OutChan = 0; OutChan < TotalPlusAlpha; OutChan++) { + out[OutChan] = (cmsUInt8Number*)Output + DestStartingOrder[OutChan] + strideOut; + } + + + for (ii = 0; ii < PixelsPerLine; ii++) { + + r = FROM_INPUT(rin); + g = FROM_INPUT(gin); + b = FROM_INPUT(bin); + + rin += SourceIncrements[0]; + gin += SourceIncrements[1]; + bin += SourceIncrements[2]; + + fx = _cmsToFixedDomain((int)r * p->Domain[0]); + fy = _cmsToFixedDomain((int)g * p->Domain[1]); + fz = _cmsToFixedDomain((int)b * p->Domain[2]); + + x0 = FIXED_TO_INT(fx); + y0 = FIXED_TO_INT(fy); + z0 = FIXED_TO_INT(fz); + + rx = FIXED_REST_TO_INT(fx); + ry = FIXED_REST_TO_INT(fy); + rz = FIXED_REST_TO_INT(fz); + + X0 = p->opta[2] * x0; + X1 = (r == 0xFFFFU ? 0 : p->opta[2]); + + Y0 = p->opta[1] * y0; + Y1 = (g == 0xFFFFU ? 0 : p->opta[1]); + + Z0 = p->opta[0] * z0; + Z1 = (b == 0xFFFFU ? 0 : p->opta[0]); + + + LutTable = &BaseTable[X0 + Y0 + Z0]; + + // Output should be computed as x = ROUND_FIXED_TO_INT(_cmsToFixedDomain(Rest)) + // which expands as: x = (Rest + ((Rest+0x7fff)/0xFFFF) + 0x8000)>>16 + // This can be replaced by: t = Rest+0x8001, x = (t + (t>>16))>>16 + // at the cost of being off by one at 7fff and 17ffe. + + if (rx >= ry) { + if (ry >= rz) { + Y1 += X1; + Z1 += Y1; + for (OutChan = 0; OutChan < TotalOut; OutChan++) { + c1 = LutTable[X1]; + c2 = LutTable[Y1]; + c3 = LutTable[Z1]; + c0 = *LutTable++; + c3 -= c2; + c2 -= c1; + c1 -= c0; + Rest = c1 * rx + c2 * ry + c3 * rz + 0x8001; + res16 = (cmsUInt16Number)c0 + ((Rest + (Rest >> 16)) >> 16); + TO_OUTPUT(out[OutChan], res16); + out[OutChan] += DestIncrements[OutChan]; + } + } + else if (rz >= rx) { + X1 += Z1; + Y1 += X1; + for (OutChan = 0; OutChan < TotalOut; OutChan++) { + c1 = LutTable[X1]; + c2 = LutTable[Y1]; + c3 = LutTable[Z1]; + c0 = *LutTable++; + c2 -= c1; + c1 -= c3; + c3 -= c0; + Rest = c1 * rx + c2 * ry + c3 * rz + 0x8001; + res16 = (cmsUInt16Number)c0 + ((Rest + (Rest >> 16)) >> 16); + TO_OUTPUT(out[OutChan], res16); + out[OutChan] += DestIncrements[OutChan]; + } + } + else { + Z1 += X1; + Y1 += Z1; + for (OutChan = 0; OutChan < TotalOut; OutChan++) { + c1 = LutTable[X1]; + c2 = LutTable[Y1]; + c3 = LutTable[Z1]; + c0 = *LutTable++; + c2 -= c3; + c3 -= c1; + c1 -= c0; + Rest = c1 * rx + c2 * ry + c3 * rz + 0x8001; + res16 = (cmsUInt16Number)c0 + ((Rest + (Rest >> 16)) >> 16); + TO_OUTPUT(out[OutChan], res16); + out[OutChan] += DestIncrements[OutChan]; + } + } + } + else { + if (rx >= rz) { + X1 += Y1; + Z1 += X1; + for (OutChan = 0; OutChan < TotalOut; OutChan++) { + c1 = LutTable[X1]; + c2 = LutTable[Y1]; + c3 = LutTable[Z1]; + c0 = *LutTable++; + c3 -= c1; + c1 -= c2; + c2 -= c0; + Rest = c1 * rx + c2 * ry + c3 * rz + 0x8001; + res16 = (cmsUInt16Number)c0 + ((Rest + (Rest >> 16)) >> 16); + TO_OUTPUT(out[OutChan], res16); + out[OutChan] += DestIncrements[OutChan]; + } + } + else if (ry >= rz) { + Z1 += Y1; + X1 += Z1; + for (OutChan = 0; OutChan < TotalOut; OutChan++) { + c1 = LutTable[X1]; + c2 = LutTable[Y1]; + c3 = LutTable[Z1]; + c0 = *LutTable++; + c1 -= c3; + c3 -= c2; + c2 -= c0; + Rest = c1 * rx + c2 * ry + c3 * rz + 0x8001; + res16 = (cmsUInt16Number)c0 + ((Rest + (Rest >> 16)) >> 16); + TO_OUTPUT(out[OutChan], res16); + out[OutChan] += DestIncrements[OutChan]; + } + } + else { + Y1 += Z1; + X1 += Y1; + for (OutChan = 0; OutChan < TotalOut; OutChan++) { + c1 = LutTable[X1]; + c2 = LutTable[Y1]; + c3 = LutTable[Z1]; + c0 = *LutTable++; + c1 -= c2; + c2 -= c3; + c3 -= c0; + Rest = c1 * rx + c2 * ry + c3 * rz + 0x8001; + res16 = (cmsUInt16Number)c0 + ((Rest + (Rest >> 16)) >> 16); + TO_OUTPUT(out[OutChan], res16); + out[OutChan] += DestIncrements[OutChan]; + } + } + } + + if (ain) + { + res16 = *(const cmsUInt16Number*)ain; + TO_OUTPUT(out[OutChan], res16); + out[TotalOut] += DestIncrements[TotalOut]; + } + + } + + strideIn += Stride->BytesPerLineIn; + strideOut += Stride->BytesPerLineOut; + } +} + +#undef DENS + + + +// -------------------------------------------------------------------------------------------------------------- + +cmsBool Optimize16BitRGBTransform(cmsContext ContextID, + _cmsTransformFn* TransformFn, + void** UserData, + _cmsFreeUserDataFn* FreeDataFn, + cmsPipeline** Lut, + cmsUInt32Number* InputFormat, + cmsUInt32Number* OutputFormat, + cmsUInt32Number* dwFlags) +{ + cmsStage* mpe; + Performance16Data* p16; + _cmsStageCLutData* data; + cmsUInt32Number newFlags; + cmsStage* OptimizedCLUTmpe; + + + // For empty transforms, do nothing + if (*Lut == NULL) return FALSE; + + // This is a loosy optimization! does not apply in floating-point cases + if (T_FLOAT(*InputFormat) || T_FLOAT(*OutputFormat)) return FALSE; + + // Only on 16-bit + if (T_BYTES(*InputFormat) != 2 || T_BYTES(*OutputFormat) != 2) return FALSE; + + // Only real 16 bits + if (T_BIT15(*InputFormat) != 0 || T_BIT15(*OutputFormat) != 0) return FALSE; + + // Only on input RGB + if (T_COLORSPACE(*InputFormat) != PT_RGB) return FALSE; + + // Named color pipelines cannot be optimized either + for (mpe = cmsPipelineGetPtrToFirstStage(ContextID, *Lut); + mpe != NULL; + mpe = cmsStageNext(ContextID, mpe)) { + if (cmsStageType(ContextID, mpe) == cmsSigNamedColorElemType) return FALSE; + } + + newFlags = *dwFlags | cmsFLAGS_FORCE_CLUT; + + if (!_cmsOptimizePipeline(ContextID, + Lut, + INTENT_PERCEPTUAL, // Dont care + InputFormat, + OutputFormat, + &newFlags)) return FALSE; + + OptimizedCLUTmpe = cmsPipelineGetPtrToFirstStage(ContextID, *Lut); + + // Set the evaluator + data = (_cmsStageCLutData*)cmsStageData(ContextID, OptimizedCLUTmpe); + + p16 = Performance16alloc(ContextID, data->Params); + if (p16 == NULL) return FALSE; + + *TransformFn = (_cmsTransformFn) PerformanceEval16; + *UserData = p16; + *FreeDataFn = Performance16free; + *InputFormat |= 0x02000000; + *OutputFormat |= 0x02000000; + *dwFlags |= cmsFLAGS_CAN_CHANGE_FORMATTER; + + return TRUE; +} diff --git a/lcms2mt/plugins/fast_float/src/fast_8_curves.c b/lcms2mt/plugins/fast_float/src/fast_8_curves.c new file mode 100644 index 00000000..cb8e5df6 --- /dev/null +++ b/lcms2mt/plugins/fast_float/src/fast_8_curves.c @@ -0,0 +1,409 @@ +//--------------------------------------------------------------------------------- +// +// Little Color Management System, fast floating point extensions +// Copyright (c) 1998-2020 Marti Maria Saguer, all rights reserved +// +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +//--------------------------------------------------------------------------------- + +#include "fast_float_internal.h" + +// Curves, optimization is valid for 8 bits only +typedef struct { + + int nCurves; + cmsUInt8Number Curves[cmsMAXCHANNELS][256]; + +} Curves8Data; + + +// Evaluator for RGB 8-bit curves. This are just 1D tables +static void FastEvaluateRGBCurves8(cmsContext ContextID, + struct _cmstransform_struct *CMMcargo, + const void* Input, + void* Output, + cmsUInt32Number PixelsPerLine, + cmsUInt32Number LineCount, + const cmsStride* Stride) +{ + cmsUInt32Number i, ii; + + cmsUInt32Number SourceStartingOrder[cmsMAXCHANNELS]; + cmsUInt32Number SourceIncrements[cmsMAXCHANNELS]; + cmsUInt32Number DestStartingOrder[cmsMAXCHANNELS]; + cmsUInt32Number DestIncrements[cmsMAXCHANNELS]; + + const cmsUInt8Number* rin; + const cmsUInt8Number* gin; + const cmsUInt8Number* bin; + const cmsUInt8Number* ain = NULL; + + cmsUInt8Number* rout; + cmsUInt8Number* gout; + cmsUInt8Number* bout; + cmsUInt8Number* aout = NULL; + + cmsUInt32Number nalpha, strideIn, strideOut; + + Curves8Data* Data = (Curves8Data*)_cmsGetTransformUserData(CMMcargo); + + _cmsComputeComponentIncrements(cmsGetTransformInputFormat(ContextID, (cmsHTRANSFORM)CMMcargo), Stride->BytesPerPlaneIn, NULL, &nalpha, SourceStartingOrder, SourceIncrements); + _cmsComputeComponentIncrements(cmsGetTransformOutputFormat(ContextID, (cmsHTRANSFORM)CMMcargo), Stride->BytesPerPlaneOut, NULL, &nalpha, DestStartingOrder, DestIncrements); + + strideIn = strideOut = 0; + for (i = 0; i < LineCount; i++) { + + rin = (const cmsUInt8Number*)Input + SourceStartingOrder[0] + strideIn; + gin = (const cmsUInt8Number*)Input + SourceStartingOrder[1] + strideIn; + bin = (const cmsUInt8Number*)Input + SourceStartingOrder[2] + strideIn; + if (nalpha) + ain = (const cmsUInt8Number*)Input + SourceStartingOrder[3] + strideIn; + + rout = (cmsUInt8Number*)Output + DestStartingOrder[0] + strideOut; + gout = (cmsUInt8Number*)Output + DestStartingOrder[1] + strideOut; + bout = (cmsUInt8Number*)Output + DestStartingOrder[2] + strideOut; + if (nalpha) + aout = (cmsUInt8Number*)Output + DestStartingOrder[3] + strideOut; + + for (ii = 0; ii < PixelsPerLine; ii++) { + + + *rout = Data->Curves[0][*rin]; + *gout = Data->Curves[1][*gin]; + *bout = Data->Curves[2][*bin]; + + // Handle alpha + if (ain) { + *aout = *ain; + } + + rin += SourceIncrements[0]; + gin += SourceIncrements[1]; + bin += SourceIncrements[2]; + if (ain) ain += SourceIncrements[3]; + + rout += DestIncrements[0]; + gout += DestIncrements[1]; + bout += DestIncrements[2]; + if (aout) aout += DestIncrements[3]; + } + + strideIn += Stride->BytesPerLineIn; + strideOut += Stride->BytesPerLineOut; + } +} + + +// Do nothing but arrange the format. RGB +static void FastRGBIdentity8(cmsContext ContextID, + struct _cmstransform_struct *CMMcargo, + const void* Input, + void* Output, + cmsUInt32Number PixelsPerLine, + cmsUInt32Number LineCount, + const cmsStride* Stride) +{ + cmsUInt32Number i, ii; + + cmsUInt32Number SourceStartingOrder[cmsMAXCHANNELS]; + cmsUInt32Number SourceIncrements[cmsMAXCHANNELS]; + cmsUInt32Number DestStartingOrder[cmsMAXCHANNELS]; + cmsUInt32Number DestIncrements[cmsMAXCHANNELS]; + + const cmsUInt8Number* rin; + const cmsUInt8Number* gin; + const cmsUInt8Number* bin; + const cmsUInt8Number* ain = NULL; + + cmsUInt8Number* rout; + cmsUInt8Number* gout; + cmsUInt8Number* bout; + cmsUInt8Number* aout = NULL; + + cmsUInt32Number nalpha, strideIn, strideOut; + + _cmsComputeComponentIncrements(cmsGetTransformInputFormat(ContextID, (cmsHTRANSFORM)CMMcargo), Stride->BytesPerPlaneIn, NULL, &nalpha, SourceStartingOrder, SourceIncrements); + _cmsComputeComponentIncrements(cmsGetTransformOutputFormat(ContextID, (cmsHTRANSFORM)CMMcargo), Stride->BytesPerPlaneOut, NULL, &nalpha, DestStartingOrder, DestIncrements); + + strideIn = strideOut = 0; + for (i = 0; i < LineCount; i++) { + + rin = (const cmsUInt8Number*)Input + SourceStartingOrder[0] + strideIn; + gin = (const cmsUInt8Number*)Input + SourceStartingOrder[1] + strideIn; + bin = (const cmsUInt8Number*)Input + SourceStartingOrder[2] + strideIn; + if (nalpha) + ain = (const cmsUInt8Number*)Input + SourceStartingOrder[3] + strideIn; + + rout = (cmsUInt8Number*)Output + DestStartingOrder[0] + strideOut; + gout = (cmsUInt8Number*)Output + DestStartingOrder[1] + strideOut; + bout = (cmsUInt8Number*)Output + DestStartingOrder[2] + strideOut; + if (nalpha) + aout = (cmsUInt8Number*)Output + DestStartingOrder[3] + strideOut; + + for (ii = 0; ii < PixelsPerLine; ii++) { + + + *rout = *rin; + *gout = *gin; + *bout = *bin; + + // Handle alpha + if (ain) { + *aout = *ain; + } + + rin += SourceIncrements[0]; + gin += SourceIncrements[1]; + bin += SourceIncrements[2]; + if (ain) ain += SourceIncrements[3]; + + rout += DestIncrements[0]; + gout += DestIncrements[1]; + bout += DestIncrements[2]; + if (aout) aout += DestIncrements[3]; + } + + strideIn += Stride->BytesPerLineIn; + strideOut += Stride->BytesPerLineOut; + } +} + + + +// Evaluate 1 channel only +static void FastEvaluateGrayCurves8(cmsContext ContextID, + struct _cmstransform_struct *CMMcargo, + const void* Input, + void* Output, + cmsUInt32Number PixelsPerLine, + cmsUInt32Number LineCount, + const cmsStride* Stride) +{ + cmsUInt32Number i, ii; + + cmsUInt32Number SourceStartingOrder[cmsMAXCHANNELS]; + cmsUInt32Number SourceIncrements[cmsMAXCHANNELS]; + cmsUInt32Number DestStartingOrder[cmsMAXCHANNELS]; + cmsUInt32Number DestIncrements[cmsMAXCHANNELS]; + + const cmsUInt8Number* gin; + const cmsUInt8Number* ain = NULL; + + cmsUInt8Number* gout; + cmsUInt8Number* aout = NULL; + + cmsUInt32Number nalpha, strideIn, strideOut; + + Curves8Data* Data = (Curves8Data*)_cmsGetTransformUserData(CMMcargo); + + _cmsComputeComponentIncrements(cmsGetTransformInputFormat(ContextID, (cmsHTRANSFORM)CMMcargo), Stride->BytesPerPlaneIn, NULL, &nalpha, SourceStartingOrder, SourceIncrements); + _cmsComputeComponentIncrements(cmsGetTransformOutputFormat(ContextID, (cmsHTRANSFORM)CMMcargo), Stride->BytesPerPlaneOut, NULL, &nalpha, DestStartingOrder, DestIncrements); + + strideIn = strideOut = 0; + for (i = 0; i < LineCount; i++) { + + gin = (const cmsUInt8Number*)Input + SourceStartingOrder[0] + strideIn; + if (nalpha) + ain = (const cmsUInt8Number*)Input + SourceStartingOrder[1] + strideIn; + + gout = (cmsUInt8Number*)Output + DestStartingOrder[0] + strideOut; + if (nalpha) + aout = (cmsUInt8Number*)Output + DestStartingOrder[1] + strideOut; + + for (ii = 0; ii < PixelsPerLine; ii++) { + + *gout = Data->Curves[0][*gin]; + + // Handle alpha + if (ain) { + *aout = *ain; + } + + gin += SourceIncrements[0]; + + if (ain) ain += SourceIncrements[1]; + + gout += DestIncrements[0]; + + if (aout) aout += DestIncrements[1]; + } + + strideIn += Stride->BytesPerLineIn; + strideOut += Stride->BytesPerLineOut; + } +} + + +static void FastGrayIdentity8(cmsContext ContextID, + struct _cmstransform_struct *CMMcargo, + const void* Input, + void* Output, + cmsUInt32Number PixelsPerLine, + cmsUInt32Number LineCount, + const cmsStride* Stride) +{ + cmsUInt32Number i, ii; + + cmsUInt32Number SourceStartingOrder[cmsMAXCHANNELS]; + cmsUInt32Number SourceIncrements[cmsMAXCHANNELS]; + cmsUInt32Number DestStartingOrder[cmsMAXCHANNELS]; + cmsUInt32Number DestIncrements[cmsMAXCHANNELS]; + + const cmsUInt8Number* gin; + const cmsUInt8Number* ain = NULL; + + cmsUInt8Number* gout; + cmsUInt8Number* aout = NULL; + + cmsUInt32Number nalpha, strideIn, strideOut; + + _cmsComputeComponentIncrements(cmsGetTransformInputFormat(ContextID, (cmsHTRANSFORM)CMMcargo), Stride->BytesPerPlaneIn, NULL, &nalpha, SourceStartingOrder, SourceIncrements); + _cmsComputeComponentIncrements(cmsGetTransformOutputFormat(ContextID, (cmsHTRANSFORM)CMMcargo), Stride->BytesPerPlaneOut, NULL, &nalpha, DestStartingOrder, DestIncrements); + + strideIn = strideOut = 0; + for (i = 0; i < LineCount; i++) { + + gin = (const cmsUInt8Number*)Input + SourceStartingOrder[0] + strideIn; + if (nalpha) + ain = (const cmsUInt8Number*)Input + SourceStartingOrder[1] + strideIn; + + gout = (cmsUInt8Number*)Output + DestStartingOrder[0] + strideOut; + if (nalpha) + aout = (cmsUInt8Number*)Output + DestStartingOrder[1] + strideOut; + + for (ii = 0; ii < PixelsPerLine; ii++) { + + *gout = *gin; + + // Handle alpha + if (ain) { + *aout = *ain; + } + + gin += SourceIncrements[0]; + + if (ain) ain += SourceIncrements[1]; + + gout += DestIncrements[0]; + + if (aout) aout += DestIncrements[1]; + } + + strideIn += Stride->BytesPerLineIn; + strideOut += Stride->BytesPerLineOut; + } +} + + + + + +// Try to see if the curves are linear +static +cmsBool AllCurvesAreLinear(Curves8Data* data) +{ + int i, j; + + for (i=0; i < 3; i++) { + for (j = 0; j < 256; j++) { + if (data ->Curves[i][j] != j) return FALSE; + } + } + + return TRUE; +} + + +static +Curves8Data* ComputeCompositeCurves(cmsContext ContextID, cmsUInt32Number nChan, cmsPipeline* Src) +{ + cmsUInt32Number i, j; + cmsFloat32Number InFloat[3], OutFloat[3]; + + Curves8Data* Data = (Curves8Data*) _cmsMallocZero(ContextID, sizeof(Curves8Data)); + if (Data == NULL) return NULL; + + // Create target curves + for (i=0; i < 256; i++) { + + for (j=0; j <nChan; j++) + InFloat[j] = (cmsFloat32Number) ((cmsFloat64Number) i / 255.0); + + cmsPipelineEvalFloat(ContextID, InFloat, OutFloat, Src); + + for (j=0; j < nChan; j++) + Data -> Curves[j][i] = FROM_16_TO_8(_cmsSaturateWord(OutFloat[j] * 65535.0)); + } + + return Data; +} + + +// If the target LUT holds only curves, the optimization procedure is to join all those +// curves together. That only works on curves and does not work on matrices. +// Any number of channels up to 16 +cmsBool Optimize8ByJoiningCurves(cmsContext ContextID, + _cmsTransformFn* TransformFn, + void** UserData, + _cmsFreeUserDataFn* FreeUserData, + cmsPipeline** Lut, + cmsUInt32Number* InputFormat, + cmsUInt32Number* OutputFormat, + cmsUInt32Number* dwFlags) +{ + + cmsPipeline* Src = *Lut; + cmsStage* mpe; + Curves8Data* Data; + cmsUInt32Number nChans; + + // This is a loosy optimization! does not apply in floating-point cases + if (T_FLOAT(*InputFormat) || T_FLOAT(*OutputFormat)) return FALSE; + + // Only on 8-bit + if (T_BYTES(*InputFormat) != 1 || T_BYTES(*OutputFormat) != 1) return FALSE; + + // Curves need same channels on input and output (despite extra channels may differ) + nChans = T_CHANNELS(*InputFormat); + if (nChans != T_CHANNELS(*OutputFormat)) return FALSE; + + // gray and RGB + if (nChans != 1 && nChans != 3) return FALSE; + + // Only curves in this LUT? + for (mpe = cmsPipelineGetPtrToFirstStage(ContextID, Src); + mpe != NULL; + mpe = cmsStageNext(ContextID, mpe)) { + + if (cmsStageType(ContextID, mpe) != cmsSigCurveSetElemType) return FALSE; + } + + Data = ComputeCompositeCurves(ContextID, nChans, Src); + + *dwFlags |= cmsFLAGS_NOCACHE; + *dwFlags &= ~cmsFLAGS_CAN_CHANGE_FORMATTER; + *UserData = Data; + *FreeUserData = _cmsFree; + + // Maybe the curves are linear at the end + if (nChans == 1) + *TransformFn = (_cmsTransformFn) (AllCurvesAreLinear(Data) ? FastGrayIdentity8 : FastEvaluateGrayCurves8); + else + *TransformFn = (_cmsTransformFn) (AllCurvesAreLinear(Data) ? FastRGBIdentity8 : FastEvaluateRGBCurves8); + + return TRUE; + +} diff --git a/lcms2mt/plugins/fast_float/src/fast_8_matsh.c b/lcms2mt/plugins/fast_float/src/fast_8_matsh.c new file mode 100644 index 00000000..26dc12a1 --- /dev/null +++ b/lcms2mt/plugins/fast_float/src/fast_8_matsh.c @@ -0,0 +1,399 @@ +//--------------------------------------------------------------------------------- +// +// Little Color Management System, fast floating point extensions +// Copyright (c) 1998-2020 Marti Maria Saguer, all rights reserved +// +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +//--------------------------------------------------------------------------------- + +// Optimization for matrix-shaper in 8 bits. Numbers are operated in n.14 signed, tables are stored in 1.14 fixed + +#include "fast_float_internal.h" + +typedef cmsInt32Number cmsS1Fixed14Number; // Note that this may hold more than 16 bits! + +#define DOUBLE_TO_1FIXED14(x) ((cmsS1Fixed14Number) floor((x) * 16384.0 + 0.5)) + +// This is the private data container used by this optimization +typedef struct { + + // This is for SSE2, MUST be aligned at 16 bit boundary + + cmsFloat32Number fMatrix[4][4]; + cmsFloat32Number fShaper1[256 * 3]; + + void * real_ptr; + + cmsS1Fixed14Number Shaper1R[256]; // from 0..255 to 1.14 (0.0...1.0) + cmsS1Fixed14Number Shaper1G[256]; + cmsS1Fixed14Number Shaper1B[256]; + + cmsS1Fixed14Number Mat[3][3]; // n.14 to n.14 (needs a saturation after that) + cmsS1Fixed14Number Off[3]; + + cmsUInt8Number Shaper2R[0x4001]; // 1.14 to 0..255 + cmsUInt8Number Shaper2G[0x4001]; + cmsUInt8Number Shaper2B[0x4001]; + +} XMatShaper8Data; + + +static +XMatShaper8Data* malloc_aligned(cmsContext ContextID) +{ + cmsUInt8Number* real_ptr = (cmsUInt8Number*) _cmsMallocZero(ContextID, sizeof(XMatShaper8Data) + 32); + cmsUInt8Number* aligned = (cmsUInt8Number*) (((uintptr_t)real_ptr + 16) & ~0xf); + XMatShaper8Data* p = (XMatShaper8Data*) aligned; + + p ->real_ptr = real_ptr; + return p; +} + +static +void free_aligned(cmsContext ContextID, XMatShaper8Data* a) +{ + _cmsFree(ContextID, a->real_ptr); +} + + +// Free the private data container +static +void FreeMatShaper(cmsContext ContextID, void* Data) +{ + UNUSED_PARAMETER(ContextID); + + if (Data != NULL) free_aligned(ContextID, (XMatShaper8Data*) Data); +} + + +// This table converts from 8 bits to 1.14 after applying the curve +static +void FillFirstShaper(cmsContext ContextID, cmsS1Fixed14Number* Table, cmsToneCurve* Curve) +{ + int i; + cmsFloat32Number R, y; + + for (i=0; i < 256; i++) { + + R = (cmsFloat32Number) (i / 255.0); + y = cmsEvalToneCurveFloat(ContextID, Curve, R); + + Table[i] = DOUBLE_TO_1FIXED14(y); + } +} + +static +void FillFirstShaperFloat(cmsContext ContextID, cmsFloat32Number* Table, cmsToneCurve* Curve) +{ + int i; + cmsFloat32Number R; + + for (i=0; i < 256; i++) { + + R = (cmsFloat32Number) (i / 255.0); + + Table[i] = cmsEvalToneCurveFloat(ContextID, Curve, R); + } +} + + +// This table converts form 1.14 (being 0x4000 the last entry) to 8 bits after applying the curve +static +void FillSecondShaper(cmsContext ContextID, cmsUInt8Number* Table, cmsToneCurve* Curve) +{ + int i; + cmsFloat32Number R, Val; + cmsUInt16Number w; + + for (i=0; i < 0x4001; i++) { + + R = (cmsFloat32Number) (i / 16384.0); + Val = cmsEvalToneCurveFloat(ContextID, Curve, R); + w = _cmsSaturateWord(Val * 65535.0 + 0.5); + + Table[i] = FROM_16_TO_8(w); + + } +} + +// Compute the matrix-shaper structure +static +XMatShaper8Data* SetMatShaper(cmsContext ContextID, cmsToneCurve* Curve1[3], cmsMAT3* Mat, cmsVEC3* Off, cmsToneCurve* Curve2[3]) +{ + XMatShaper8Data* p; + int i, j; + + // Allocate a big chuck of memory to store precomputed tables + p = malloc_aligned(ContextID); + if (p == NULL) return FALSE; + + // Precompute tables + FillFirstShaper(ContextID, p ->Shaper1R, Curve1[0]); + FillFirstShaper(ContextID, p ->Shaper1G, Curve1[1]); + FillFirstShaper(ContextID, p ->Shaper1B, Curve1[2]); + + FillSecondShaper(ContextID, p ->Shaper2R, Curve2[0]); + FillSecondShaper(ContextID, p ->Shaper2G, Curve2[1]); + FillSecondShaper(ContextID, p ->Shaper2B, Curve2[2]); + + + FillFirstShaperFloat(ContextID, p ->fShaper1, Curve1[0]); + FillFirstShaperFloat(ContextID, p ->fShaper1 + 256, Curve1[1]); + FillFirstShaperFloat(ContextID, p ->fShaper1 + 256*2, Curve1[2]); + + // Convert matrix to nFixed14. Note that those values may take more than 16 bits as + for (i=0; i < 3; i++) { + for (j=0; j < 3; j++) { + p ->Mat[i][j] = DOUBLE_TO_1FIXED14(Mat->v[i].n[j]); + p ->fMatrix[j][i] = (cmsFloat32Number) Mat ->v[i].n[j]; + } + } + + + for (i=0; i < 3; i++) { + + if (Off == NULL) { + + p ->Off[i] = 0x2000; + p ->fMatrix[3][i] = 0.0f; + } + else { + p ->Off[i] = DOUBLE_TO_1FIXED14(Off->n[i]) + 0x2000; + p ->fMatrix[3][i] = (cmsFloat32Number) Off->n[i]; + } + } + + + return p; +} + +// A fast matrix-shaper evaluator for 8 bits. This is a bit ticky since I'm using 1.14 signed fixed point +// to accomplish some performance. Actually it takes 256x3 16 bits tables and 16385 x 3 tables of 8 bits, +// in total about 50K, and the performance boost is huge! + +static +void MatShaperXform8(cmsContext ContextID, + struct _cmstransform_struct *CMMcargo, + const void* Input, + void* Output, + cmsUInt32Number PixelsPerLine, + cmsUInt32Number LineCount, + const cmsStride* Stride) +{ + XMatShaper8Data* p = (XMatShaper8Data*) _cmsGetTransformUserData(CMMcargo); + + register cmsS1Fixed14Number l1, l2, l3; + cmsS1Fixed14Number r, g, b; + cmsUInt32Number ri, gi, bi; + cmsUInt32Number i, ii; + + cmsUInt32Number SourceStartingOrder[cmsMAXCHANNELS]; + cmsUInt32Number SourceIncrements[cmsMAXCHANNELS]; + cmsUInt32Number DestStartingOrder[cmsMAXCHANNELS]; + cmsUInt32Number DestIncrements[cmsMAXCHANNELS]; + + const cmsUInt8Number* rin; + const cmsUInt8Number* gin; + const cmsUInt8Number* bin; + const cmsUInt8Number* ain = NULL; + + cmsUInt8Number* rout; + cmsUInt8Number* gout; + cmsUInt8Number* bout; + cmsUInt8Number* aout = NULL; + + cmsUInt32Number nalpha, strideIn, strideOut; + + _cmsComputeComponentIncrements(cmsGetTransformInputFormat(ContextID, (cmsHTRANSFORM)CMMcargo), Stride->BytesPerPlaneIn, NULL, &nalpha, SourceStartingOrder, SourceIncrements); + _cmsComputeComponentIncrements(cmsGetTransformOutputFormat(ContextID, (cmsHTRANSFORM)CMMcargo), Stride->BytesPerPlaneOut, NULL, &nalpha, DestStartingOrder, DestIncrements); + + strideIn = strideOut = 0; + for (i = 0; i < LineCount; i++) { + + rin = (const cmsUInt8Number*)Input + SourceStartingOrder[0] + strideIn; + gin = (const cmsUInt8Number*)Input + SourceStartingOrder[1] + strideIn; + bin = (const cmsUInt8Number*)Input + SourceStartingOrder[2] + strideIn; + if (nalpha) + ain = (const cmsUInt8Number*)Input + SourceStartingOrder[3] + strideIn; + + + rout = (cmsUInt8Number*)Output + DestStartingOrder[0] + strideOut; + gout = (cmsUInt8Number*)Output + DestStartingOrder[1] + strideOut; + bout = (cmsUInt8Number*)Output + DestStartingOrder[2] + strideOut; + if (nalpha) + aout = (cmsUInt8Number*)Output + DestStartingOrder[3] + strideOut; + + + for (ii = 0; ii < PixelsPerLine; ii++) { + + // Across first shaper, which also converts to 1.14 fixed point. 16 bits guaranteed. + r = p->Shaper1R[*rin]; + g = p->Shaper1G[*gin]; + b = p->Shaper1B[*bin]; + + // Evaluate the matrix in 1.14 fixed point + l1 = (p->Mat[0][0] * r + p->Mat[0][1] * g + p->Mat[0][2] * b + p->Off[0]) >> 14; + l2 = (p->Mat[1][0] * r + p->Mat[1][1] * g + p->Mat[1][2] * b + p->Off[1]) >> 14; + l3 = (p->Mat[2][0] * r + p->Mat[2][1] * g + p->Mat[2][2] * b + p->Off[2]) >> 14; + + + // Now we have to clip to 0..1.0 range + ri = (l1 < 0) ? 0 : ((l1 > 0x4000) ? 0x4000 : l1); + gi = (l2 < 0) ? 0 : ((l2 > 0x4000) ? 0x4000 : l2); + bi = (l3 < 0) ? 0 : ((l3 > 0x4000) ? 0x4000 : l3); + + + // And across second shaper, + *rout = p->Shaper2R[ri]; + *gout = p->Shaper2G[gi]; + *bout = p->Shaper2B[bi]; + + // Handle alpha + if (ain) { + *aout = *ain; + } + + rin += SourceIncrements[0]; + gin += SourceIncrements[1]; + bin += SourceIncrements[2]; + if (ain) ain += SourceIncrements[3]; + + rout += DestIncrements[0]; + gout += DestIncrements[1]; + bout += DestIncrements[2]; + if (aout) aout += DestIncrements[3]; + } + + strideIn += Stride->BytesPerLineIn; + strideOut += Stride->BytesPerLineOut; + } +} + + +// 8 bits on input allows matrix-shaper boost up a little bit +cmsBool Optimize8MatrixShaper( cmsContext ContextID, + _cmsTransformFn* TransformFn, + void** UserData, + _cmsFreeUserDataFn* FreeUserData, + cmsPipeline** Lut, + cmsUInt32Number* InputFormat, + cmsUInt32Number* OutputFormat, + cmsUInt32Number* dwFlags) +{ + cmsStage* Curve1, *Curve2; + cmsStage* Matrix1, *Matrix2; + _cmsStageMatrixData* Data1; + _cmsStageMatrixData* Data2; + cmsMAT3 res; + cmsBool IdentityMat = FALSE; + cmsPipeline* Dest, *Src; + cmsUInt32Number nChans; + cmsFloat64Number factor = 1.0; + + // Only works on RGB to RGB and gray to gray + + if ( !( (T_CHANNELS(*InputFormat) == 3 && T_CHANNELS(*OutputFormat) == 3) || + (T_CHANNELS(*InputFormat) == 1 && T_CHANNELS(*OutputFormat) == 1) )) return FALSE; + + // Only works on 8 bit input + if (T_BYTES(*InputFormat) != 1 || T_BYTES(*OutputFormat) != 1) return FALSE; + + // Seems suitable, proceed + Src = *Lut; + + // Check for shaper-matrix-matrix-shaper structure, that is what this optimizer stands for + if (!cmsPipelineCheckAndRetreiveStages(ContextID, Src, 4, + cmsSigCurveSetElemType, cmsSigMatrixElemType, cmsSigMatrixElemType, cmsSigCurveSetElemType, + &Curve1, &Matrix1, &Matrix2, &Curve2)) return FALSE; + + nChans = T_CHANNELS(*InputFormat); + + // Get both matrices, which are 3x3 + Data1 = (_cmsStageMatrixData*) cmsStageData(ContextID, Matrix1); + Data2 = (_cmsStageMatrixData*) cmsStageData(ContextID, Matrix2); + + // Input offset should be zero + if (Data1 ->Offset != NULL) return FALSE; + + if (cmsStageInputChannels(ContextID, Matrix1) == 1 && cmsStageOutputChannels(ContextID, Matrix2) == 1) + { + // This is a gray to gray. Just multiply + factor = Data1->Double[0]*Data2->Double[0] + + Data1->Double[1]*Data2->Double[1] + + Data1->Double[2]*Data2->Double[2]; + + if (fabs(1 - factor) < (1.0 / 65535.0)) IdentityMat = TRUE; + } + else + { + // Multiply both matrices to get the result + _cmsMAT3per(ContextID, &res, (cmsMAT3*) Data2 ->Double, (cmsMAT3*) Data1 ->Double); + + // Now the result is in res + Data2 -> Offset. Maybe is a plain identity? + IdentityMat = FALSE; + if (_cmsMAT3isIdentity(ContextID, &res) && Data2 ->Offset == NULL) { + + // We can get rid of full matrix + IdentityMat = TRUE; + } + } + + // Allocate an empty LUT + Dest = cmsPipelineAlloc(ContextID, nChans, nChans); + if (!Dest) return FALSE; + + // Assamble the new LUT + cmsPipelineInsertStage(ContextID, Dest, cmsAT_BEGIN, cmsStageDup(ContextID, Curve1)); + + if (!IdentityMat) { + + if (nChans == 1) + cmsPipelineInsertStage(ContextID, Dest, cmsAT_END, + cmsStageAllocMatrix(ContextID, 1, 1, (const cmsFloat64Number*) &factor, Data2->Offset)); + else + cmsPipelineInsertStage(ContextID, Dest, cmsAT_END, + cmsStageAllocMatrix(ContextID, 3, 3, (const cmsFloat64Number*) &res, Data2 ->Offset)); + } + + + cmsPipelineInsertStage(ContextID, Dest, cmsAT_END, cmsStageDup(ContextID, Curve2)); + + // If identity on matrix, we can further optimize the curves, so call the join curves routine + if (IdentityMat) { + + Optimize8ByJoiningCurves(ContextID, TransformFn, UserData, FreeUserData, &Dest, InputFormat, OutputFormat, dwFlags); + } + else { + _cmsStageToneCurvesData* mpeC1 = (_cmsStageToneCurvesData*) cmsStageData(ContextID, Curve1); + _cmsStageToneCurvesData* mpeC2 = (_cmsStageToneCurvesData*) cmsStageData(ContextID, Curve2); + + // In this particular optimization, caché does not help as it takes more time to deal with + // the caché that with the pixel handling + *dwFlags |= cmsFLAGS_NOCACHE; + + + // Setup the optimizarion routines + *UserData = SetMatShaper(ContextID, mpeC1 ->TheCurves, &res, (cmsVEC3*) Data2 ->Offset, mpeC2->TheCurves); + *FreeUserData = FreeMatShaper; + + *TransformFn = (_cmsTransformFn) MatShaperXform8; + } + + *dwFlags &= ~cmsFLAGS_CAN_CHANGE_FORMATTER; + cmsPipelineFree(ContextID, Src); + *Lut = Dest; + return TRUE; +} diff --git a/lcms2mt/plugins/fast_float/src/fast_8_tethra.c b/lcms2mt/plugins/fast_float/src/fast_8_tethra.c new file mode 100644 index 00000000..bde4649d --- /dev/null +++ b/lcms2mt/plugins/fast_float/src/fast_8_tethra.c @@ -0,0 +1,501 @@ +//--------------------------------------------------------------------------------- +// +// Little Color Management System, fast floating point extensions +// Copyright (c) 1998-2020 Marti Maria Saguer, all rights reserved +// +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +//--------------------------------------------------------------------------------- + +#include "fast_float_internal.h" + +#define PRELINEARIZATION_POINTS 4096 + +// Optimization for 8 bits, 3 inputs only +typedef struct { + + const cmsInterpParams* p; // Tetrahedrical interpolation parameters. This is a not-owned pointer. + + cmsUInt16Number rx[256], ry[256], rz[256]; + cmsUInt32Number X0[256], Y0[256], Z0[256]; // Precomputed nodes and offsets for 8-bit input data + + +} Performance8Data; + + +// Precomputes tables for 8-bit on input devicelink. +static +Performance8Data* Performance8alloc(cmsContext ContextID, const cmsInterpParams* p, cmsToneCurve* G[3]) +{ + int i; + cmsUInt16Number Input[3]; + cmsS15Fixed16Number v1, v2, v3; + Performance8Data* p8; + + p8 = (Performance8Data*) _cmsMallocZero(ContextID, sizeof(Performance8Data)); + if (p8 == NULL) return NULL; + + // Since this only works for 8 bit input, values comes always as x * 257, + // we can safely take msb byte (x << 8 + x) + for (i=0; i < 256; i++) { + + if (G != NULL) { + + // Get 16-bit representation + Input[0] = cmsEvalToneCurve16(ContextID, G[0], FROM_8_TO_16(i)); + Input[1] = cmsEvalToneCurve16(ContextID, G[1], FROM_8_TO_16(i)); + Input[2] = cmsEvalToneCurve16(ContextID, G[2], FROM_8_TO_16(i)); + } + else { + Input[0] = FROM_8_TO_16(i); + Input[1] = FROM_8_TO_16(i); + Input[2] = FROM_8_TO_16(i); + } + + // Move to 0..1.0 in fixed domain + v1 = _cmsToFixedDomain(Input[0] * p -> Domain[0]); + v2 = _cmsToFixedDomain(Input[1] * p -> Domain[1]); + v3 = _cmsToFixedDomain(Input[2] * p -> Domain[2]); + + // Store the precalculated table of nodes + p8 ->X0[i] = (p->opta[2] * FIXED_TO_INT(v1)); + p8 ->Y0[i] = (p->opta[1] * FIXED_TO_INT(v2)); + p8 ->Z0[i] = (p->opta[0] * FIXED_TO_INT(v3)); + + // Store the precalculated table of offsets + p8 ->rx[i] = (cmsUInt16Number) FIXED_REST_TO_INT(v1); + p8 ->ry[i] = (cmsUInt16Number) FIXED_REST_TO_INT(v2); + p8 ->rz[i] = (cmsUInt16Number) FIXED_REST_TO_INT(v3); + } + + + p8 ->p = p; + + return p8; +} + +static +void Performance8free(cmsContext ContextID, void* ptr) +{ + _cmsFree(ContextID, ptr); +} + + +// Sampler implemented by another LUT. This is a clean way to precalculate the devicelink 3D CLUT for +// almost any transform. We use floating point precision and then convert from floating point to 16 bits. +static +int XFormSampler16(cmsContext ContextID, CMSREGISTER const cmsUInt16Number In[], CMSREGISTER cmsUInt16Number Out[], CMSREGISTER void* Cargo) +{ + // Evaluate in 16 bits + cmsPipelineEval16(ContextID, In, Out, (cmsPipeline*) Cargo); + + // Always succeed + return TRUE; +} + + +// A optimized interpolation for 8-bit input. +#define DENS(i,j,k) (LutTable[(i)+(j)+(k)+OutChan]) + +static +void PerformanceEval8(cmsContext ContextID, + struct _cmstransform_struct *CMMcargo, + const void* Input, + void* Output, + cmsUInt32Number PixelsPerLine, + cmsUInt32Number LineCount, + const cmsStride* Stride) +{ + + cmsUInt8Number r, g, b; + cmsS15Fixed16Number rx, ry, rz; + cmsS15Fixed16Number c0, c1, c2, c3, Rest; + cmsUInt32Number OutChan, TotalPlusAlpha; + cmsS15Fixed16Number X0, X1, Y0, Y1, Z0, Z1; + Performance8Data* p8 = (Performance8Data*)_cmsGetTransformUserData(CMMcargo); + const cmsInterpParams* p = p8->p; + cmsUInt32Number TotalOut = p->nOutputs; + const cmsUInt16Number* LutTable = (const cmsUInt16Number*)p->Table; + + cmsUInt8Number* out[cmsMAXCHANNELS]; + cmsUInt16Number res16; + + cmsUInt32Number i, ii; + + cmsUInt32Number SourceStartingOrder[cmsMAXCHANNELS]; + cmsUInt32Number SourceIncrements[cmsMAXCHANNELS]; + cmsUInt32Number DestStartingOrder[cmsMAXCHANNELS]; + cmsUInt32Number DestIncrements[cmsMAXCHANNELS]; + + const cmsUInt8Number* rin; + const cmsUInt8Number* gin; + const cmsUInt8Number* bin; + const cmsUInt8Number* ain = NULL; + + cmsUInt32Number nalpha, strideIn, strideOut; + + + _cmsComputeComponentIncrements(cmsGetTransformInputFormat(ContextID, (cmsHTRANSFORM)CMMcargo), Stride->BytesPerPlaneIn, NULL, &nalpha, SourceStartingOrder, SourceIncrements); + _cmsComputeComponentIncrements(cmsGetTransformOutputFormat(ContextID, (cmsHTRANSFORM)CMMcargo), Stride->BytesPerPlaneOut, NULL, &nalpha, DestStartingOrder, DestIncrements); + + strideIn = strideOut = 0; + for (i = 0; i < LineCount; i++) { + + rin = (const cmsUInt8Number*)Input + SourceStartingOrder[0] + strideIn; + gin = (const cmsUInt8Number*)Input + SourceStartingOrder[1] + strideIn; + bin = (const cmsUInt8Number*)Input + SourceStartingOrder[2] + strideIn; + if (nalpha) + ain = (const cmsUInt8Number*)Input + SourceStartingOrder[3] + strideIn; + + TotalPlusAlpha = TotalOut; + if (ain) TotalPlusAlpha++; + + for (OutChan = 0; OutChan < TotalPlusAlpha; OutChan++) { + out[OutChan] = (cmsUInt8Number*)Output + DestStartingOrder[OutChan] + strideOut; + } + + + for (ii = 0; ii < PixelsPerLine; ii++) { + + r = *rin; g = *gin; b = *bin; + + rin += SourceIncrements[0]; + gin += SourceIncrements[1]; + bin += SourceIncrements[2]; + + X0 = X1 = p8->X0[r]; + Y0 = Y1 = p8->Y0[g]; + Z0 = Z1 = p8->Z0[b]; + + rx = p8->rx[r]; + ry = p8->ry[g]; + rz = p8->rz[b]; + + X1 = X0 + ((rx == 0) ? 0 : p->opta[2]); + Y1 = Y0 + ((ry == 0) ? 0 : p->opta[1]); + Z1 = Z0 + ((rz == 0) ? 0 : p->opta[0]); + + + // These are the 6 Tetrahedral + for (OutChan = 0; OutChan < TotalOut; OutChan++) { + + c0 = DENS(X0, Y0, Z0); + + if (rx >= ry && ry >= rz) + { + c1 = DENS(X1, Y0, Z0) - c0; + c2 = DENS(X1, Y1, Z0) - DENS(X1, Y0, Z0); + c3 = DENS(X1, Y1, Z1) - DENS(X1, Y1, Z0); + } + else + if (rx >= rz && rz >= ry) + { + c1 = DENS(X1, Y0, Z0) - c0; + c2 = DENS(X1, Y1, Z1) - DENS(X1, Y0, Z1); + c3 = DENS(X1, Y0, Z1) - DENS(X1, Y0, Z0); + } + else + if (rz >= rx && rx >= ry) + { + c1 = DENS(X1, Y0, Z1) - DENS(X0, Y0, Z1); + c2 = DENS(X1, Y1, Z1) - DENS(X1, Y0, Z1); + c3 = DENS(X0, Y0, Z1) - c0; + } + else + if (ry >= rx && rx >= rz) + { + c1 = DENS(X1, Y1, Z0) - DENS(X0, Y1, Z0); + c2 = DENS(X0, Y1, Z0) - c0; + c3 = DENS(X1, Y1, Z1) - DENS(X1, Y1, Z0); + } + else + if (ry >= rz && rz >= rx) + { + c1 = DENS(X1, Y1, Z1) - DENS(X0, Y1, Z1); + c2 = DENS(X0, Y1, Z0) - c0; + c3 = DENS(X0, Y1, Z1) - DENS(X0, Y1, Z0); + } + else + if (rz >= ry && ry >= rx) + { + c1 = DENS(X1, Y1, Z1) - DENS(X0, Y1, Z1); + c2 = DENS(X0, Y1, Z1) - DENS(X0, Y0, Z1); + c3 = DENS(X0, Y0, Z1) - c0; + } + else { + c1 = c2 = c3 = 0; + } + + + Rest = c1 * rx + c2 * ry + c3 * rz + 0x8001; + res16 = (cmsUInt16Number)c0 + ((Rest + (Rest >> 16)) >> 16); + + *out[OutChan] = FROM_16_TO_8(res16); + out[OutChan] += DestIncrements[OutChan]; + + if (ain) + *out[TotalOut] = *ain; + + } + + + } + + strideIn += Stride->BytesPerLineIn; + strideOut += Stride->BytesPerLineOut; + } +} + +#undef DENS + + +// Curves that contain wide empty areas are not optimizeable +static +cmsBool IsDegenerated(cmsContext ContextID, const cmsToneCurve* g) +{ + int i, Zeros = 0, Poles = 0; + int nEntries = cmsGetToneCurveEstimatedTableEntries(ContextID, g); + const cmsUInt16Number* Table16 = cmsGetToneCurveEstimatedTable(ContextID, g); + + for (i=0; i < nEntries; i++) { + + if (Table16[i] == 0x0000) Zeros++; + if (Table16[i] == 0xffff) Poles++; + } + + if (Zeros == 1 && Poles == 1) return FALSE; // For linear tables + if (Zeros > (nEntries / 4)) return TRUE; // Degenerated, mostly zeros + if (Poles > (nEntries / 4)) return TRUE; // Degenerated, mostly poles + + return FALSE; +} + + + +// Normalize endpoints by slope limiting max and min. This assures endpoints as well. +// Descending curves are handled as well. +static +void SlopeLimiting(cmsUInt16Number* Table16, int nEntries) +{ + int BeginVal, EndVal; + + int AtBegin = (int) floor((cmsFloat64Number)nEntries * 0.02 + 0.5); // Cutoff at 2% + int AtEnd = nEntries - AtBegin - 1; // And 98% + cmsFloat64Number Val, Slope, beta; + int i; + + + if (Table16[0] > Table16[nEntries-1]) { + BeginVal = 0xffff; EndVal = 0; + } + else { + BeginVal = 0; EndVal = 0xffff; + } + + // Compute slope and offset for begin of curve + Val = Table16[AtBegin]; + Slope = (Val - BeginVal) / AtBegin; + beta = Val - Slope * AtBegin; + + for (i=0; i < AtBegin; i++) + Table16[i] = _cmsSaturateWord(i * Slope + beta); + + // Compute slope and offset for the end + Val = Table16[AtEnd]; + Slope = (EndVal - Val) / AtBegin; // AtBegin holds the X interval, which is same in both cases + beta = Val - Slope * AtEnd; + + for (i = AtEnd; i < (int) nEntries; i++) + Table16[i] = _cmsSaturateWord(i * Slope + beta); +} + + +// -------------------------------------------------------------------------------------------------------------- + +cmsBool Optimize8BitRGBTransform( cmsContext ContextID, + _cmsTransformFn* TransformFn, + void** UserData, + _cmsFreeUserDataFn* FreeDataFn, + cmsPipeline** Lut, + cmsUInt32Number* InputFormat, + cmsUInt32Number* OutputFormat, + cmsUInt32Number* dwFlags) +{ + cmsPipeline* OriginalLut; + int nGridPoints; + cmsToneCurve *Trans[cmsMAXCHANNELS], *TransReverse[cmsMAXCHANNELS]; + cmsUInt32Number t, i, j; + cmsFloat32Number v, In[cmsMAXCHANNELS], Out[cmsMAXCHANNELS]; + cmsBool lIsSuitable, lIsLinear; + cmsPipeline* OptimizedLUT = NULL, *LutPlusCurves = NULL; + cmsStage* OptimizedCLUTmpe; + cmsColorSpaceSignature OutputColorSpace; + cmsStage* OptimizedPrelinMpe; + cmsStage* mpe; + Performance8Data* p8; + cmsUInt16Number* MyTable[3]; + _cmsStageCLutData* data; + + // For empty transforms, do nothing + if (*Lut == NULL) return FALSE; + + // This is a loosy optimization! does not apply in floating-point cases + if (T_FLOAT(*InputFormat) || T_FLOAT(*OutputFormat)) return FALSE; + + // Only on 8-bit + if (T_BYTES(*InputFormat) != 1 || T_BYTES(*OutputFormat) != 1) return FALSE; + + // Only on RGB + if (T_COLORSPACE(*InputFormat) != PT_RGB) return FALSE; + + OriginalLut = *Lut; + + // Named color pipelines cannot be optimized either + for (mpe = cmsPipelineGetPtrToFirstStage(ContextID, OriginalLut); + mpe != NULL; + mpe = cmsStageNext(ContextID, mpe)) { + if (cmsStageType(ContextID, mpe) == cmsSigNamedColorElemType) return FALSE; + } + + OutputColorSpace = _cmsICCcolorSpace(ContextID, T_COLORSPACE(*OutputFormat)); + nGridPoints = _cmsReasonableGridpointsByColorspace(cmsSigRgbData, *dwFlags); + + // Empty gamma containers + memset(Trans, 0, sizeof(Trans)); + memset(TransReverse, 0, sizeof(TransReverse)); + + MyTable[0] = (cmsUInt16Number*) _cmsMallocZero(ContextID, sizeof(cmsUInt16Number) * PRELINEARIZATION_POINTS); + MyTable[1] = (cmsUInt16Number*) _cmsMallocZero(ContextID, sizeof(cmsUInt16Number) * PRELINEARIZATION_POINTS); + MyTable[2] = (cmsUInt16Number*) _cmsMallocZero(ContextID, sizeof(cmsUInt16Number) * PRELINEARIZATION_POINTS); + + if (MyTable[0] == NULL || MyTable[1] == NULL || MyTable[2] == NULL) goto Error; + + // Populate the curves + + for (i=0; i < PRELINEARIZATION_POINTS; i++) { + + v = (cmsFloat32Number) ((cmsFloat64Number) i / (PRELINEARIZATION_POINTS - 1)); + + // Feed input with a gray ramp + for (j=0; j < 3; j++) + In[j] = v; + + // Evaluate the gray value + cmsPipelineEvalFloat(ContextID, In, Out, OriginalLut); + + // Store result in curve + for (j=0; j < 3; j++) + MyTable[j][i] = _cmsSaturateWord(Out[j] * 65535.0); + } + + for (t=0; t < 3; t++) { + + SlopeLimiting(MyTable[t], PRELINEARIZATION_POINTS); + + Trans[t] = cmsBuildTabulatedToneCurve16(ContextID, PRELINEARIZATION_POINTS, MyTable[t]); + if (Trans[t] == NULL) goto Error; + + _cmsFree(ContextID, MyTable[t]); + } + + // Check for validity + lIsSuitable = TRUE; + lIsLinear = TRUE; + for (t=0; (lIsSuitable && (t < 3)); t++) { + + // Exclude if already linear + if (!cmsIsToneCurveLinear(ContextID, Trans[t])) + lIsLinear = FALSE; + + // Exclude if non-monotonic + if (!cmsIsToneCurveMonotonic(ContextID, Trans[t])) + lIsSuitable = FALSE; + + if (IsDegenerated(ContextID, Trans[t])) + lIsSuitable = FALSE; + } + + // If it is not suitable, just quit + if (!lIsSuitable) goto Error; + + // Invert curves if possible + for (t = 0; t < cmsPipelineInputChannels(ContextID, OriginalLut); t++) { + TransReverse[t] = cmsReverseToneCurveEx(ContextID, PRELINEARIZATION_POINTS, Trans[t]); + if (TransReverse[t] == NULL) goto Error; + } + + // Now inset the reversed curves at the begin of transform + LutPlusCurves = cmsPipelineDup(ContextID, OriginalLut); + if (LutPlusCurves == NULL) goto Error; + + cmsPipelineInsertStage(ContextID, LutPlusCurves, cmsAT_BEGIN, cmsStageAllocToneCurves(ContextID, 3, TransReverse)); + + // Create the result LUT + OptimizedLUT = cmsPipelineAlloc(ContextID, 3, cmsPipelineOutputChannels(ContextID, OriginalLut)); + if (OptimizedLUT == NULL) goto Error; + + OptimizedPrelinMpe = cmsStageAllocToneCurves(ContextID, 3, Trans); + + // Create and insert the curves at the beginning + cmsPipelineInsertStage(ContextID, OptimizedLUT, cmsAT_BEGIN, OptimizedPrelinMpe); + + // Allocate the CLUT for result + OptimizedCLUTmpe = cmsStageAllocCLut16bit(ContextID, nGridPoints, 3, cmsPipelineOutputChannels(ContextID, OriginalLut), NULL); + + // Add the CLUT to the destination LUT + cmsPipelineInsertStage(ContextID, OptimizedLUT, cmsAT_END, OptimizedCLUTmpe); + + // Resample the LUT + if (!cmsStageSampleCLut16bit(ContextID, OptimizedCLUTmpe, XFormSampler16, (void*) LutPlusCurves, 0)) goto Error; + + // Set the evaluator + data = (_cmsStageCLutData*) cmsStageData(ContextID, OptimizedCLUTmpe); + + p8 = Performance8alloc(ContextID, data ->Params, Trans); + if (p8 == NULL) return FALSE; + + // Free resources + for (t = 0; t <3; t++) { + + if (Trans[t]) cmsFreeToneCurve(ContextID, Trans[t]); + if (TransReverse[t]) cmsFreeToneCurve(ContextID, TransReverse[t]); + } + + cmsPipelineFree(ContextID, LutPlusCurves); + + // And return the obtained LUT + cmsPipelineFree(ContextID, OriginalLut); + + *dwFlags &= ~cmsFLAGS_CAN_CHANGE_FORMATTER; + *Lut = OptimizedLUT; + *TransformFn = (_cmsTransformFn) PerformanceEval8; + *UserData = p8; + *FreeDataFn = Performance8free; + + return TRUE; + +Error: + + for (t = 0; t < 3; t++) { + + if (Trans[t]) cmsFreeToneCurve(ContextID, Trans[t]); + if (TransReverse[t]) cmsFreeToneCurve(ContextID, TransReverse[t]); + } + + if (LutPlusCurves != NULL) cmsPipelineFree(ContextID, LutPlusCurves); + if (OptimizedLUT != NULL) cmsPipelineFree(ContextID, OptimizedLUT); + + return FALSE; +} diff --git a/lcms2mt/plugins/fast_float/src/fast_float_15bits.c b/lcms2mt/plugins/fast_float/src/fast_float_15bits.c new file mode 100644 index 00000000..3dbfe036 --- /dev/null +++ b/lcms2mt/plugins/fast_float/src/fast_float_15bits.c @@ -0,0 +1,603 @@ +//--------------------------------------------------------------------------------- +// +// Little Color Management System, fast floating point extensions +// Copyright (c) 1998-2020 Marti Maria Saguer, all rights reserved +// +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +//--------------------------------------------------------------------------------- + +#include "fast_float_internal.h" + + +//--------------------------------------------------------------------------------- + +// The internal photoshop 16 bit format range is 1.15 fixed point, which goes 0..32768 +// (NOT 32767) that means: +// +// 16 bits encoding 15 bit Photoshop encoding +// ================ ========================= +// +// 0x0000 0x0000 +// 0xFFFF 0x8000 +// +// A nice (and fast) way to implement conversions is by using 64 bit values, which are +// native CPU word size in most today architectures. +// In CMYK, internal Photoshop format comes inverted, and this inversion happens after +// the resizing, so values 32769 to 65535 are never used in PhotoShop. + +//--------------------------------------------------------------------------------- + +// This macro converts 16 bits to 15 bits by using a 64 bits value +cmsINLINE cmsUInt16Number From16To15(cmsUInt16Number x16) +{ + cmsUInt64Number r64 = (((cmsUInt64Number)x16 << 15)) / 0xFFFFL; + return (cmsUInt16Number)r64; +} + +// This macro converts 15 bits to 16 bits by using a 64 bit value. It is based in fixed 1.15 math +cmsINLINE cmsUInt16Number From15To16(cmsUInt16Number x15) +{ + cmsUInt64Number r64 = ((cmsUInt64Number) x15 * 0xFFFF + 0x4000L) >> 15; + return (cmsUInt16Number)r64; +} + +// Specialized 1-channel formatters +static +cmsUInt8Number* Unroll15bitsGray(cmsContext ContextID, + CMSREGISTER struct _cmstransform_struct* CMMcargo, + CMSREGISTER cmsUInt16Number Values[], + CMSREGISTER cmsUInt8Number* Buffer, + CMSREGISTER cmsUInt32Number Stride) +{ + UNUSED_PARAMETER(ContextID); + UNUSED_PARAMETER(CMMcargo); + UNUSED_PARAMETER(Stride); + UNUSED_PARAMETER(ContextID); + + Values[0] = From15To16(*(cmsUInt16Number*)Buffer); + + return Buffer + 2; +} + + +static +cmsUInt8Number* Pack15bitsGray(cmsContext ContextID, + CMSREGISTER struct _cmstransform_struct* CMMcargo, + CMSREGISTER cmsUInt16Number Values[], + CMSREGISTER cmsUInt8Number* Buffer, + CMSREGISTER cmsUInt32Number Stride) +{ + UNUSED_PARAMETER(ContextID); + UNUSED_PARAMETER(CMMcargo); + UNUSED_PARAMETER(Stride); + + *(cmsUInt16Number*)Buffer = From16To15(Values[0]); + return Buffer + 2; +} + +// Specialized 3-channels formatters +static +cmsUInt8Number* Unroll15bitsRGB(cmsContext ContextID, + CMSREGISTER struct _cmstransform_struct* CMMcargo, + CMSREGISTER cmsUInt16Number Values[], + CMSREGISTER cmsUInt8Number* Buffer, + CMSREGISTER cmsUInt32Number Stride) +{ + UNUSED_PARAMETER(ContextID); + UNUSED_PARAMETER(CMMcargo); + UNUSED_PARAMETER(Stride); + + Values[0] = From15To16(*(cmsUInt16Number*)Buffer); + Buffer += 2; + Values[1] = From15To16(*(cmsUInt16Number*)Buffer); + Buffer += 2; + Values[2] = From15To16(*(cmsUInt16Number*)Buffer); + + return Buffer + 2; +} + + +static +cmsUInt8Number* Pack15bitsRGB(cmsContext ContextID, + CMSREGISTER struct _cmstransform_struct* CMMcargo, + CMSREGISTER cmsUInt16Number Values[], + CMSREGISTER cmsUInt8Number* Buffer, + CMSREGISTER cmsUInt32Number Stride) +{ + UNUSED_PARAMETER(ContextID); + UNUSED_PARAMETER(CMMcargo); + UNUSED_PARAMETER(Stride); + + *(cmsUInt16Number*)Buffer = From16To15(Values[0]); + Buffer += 2; + *(cmsUInt16Number*)Buffer = From16To15(Values[1]); + Buffer += 2; + *(cmsUInt16Number*)Buffer = From16To15(Values[2]); + + return Buffer + 2; +} + + +static +cmsUInt8Number* Unroll15bitsRGBA(cmsContext ContextID, + CMSREGISTER struct _cmstransform_struct* CMMcargo, + CMSREGISTER cmsUInt16Number Values[], + CMSREGISTER cmsUInt8Number* Buffer, + CMSREGISTER cmsUInt32Number Stride) +{ + UNUSED_PARAMETER(ContextID); + UNUSED_PARAMETER(CMMcargo); + UNUSED_PARAMETER(Stride); + + Values[0] = From15To16(*(cmsUInt16Number*)Buffer); + Buffer += 2; + Values[1] = From15To16(*(cmsUInt16Number*)Buffer); + Buffer += 2; + Values[2] = From15To16(*(cmsUInt16Number*)Buffer); + + return Buffer + 4; +} + + +static +cmsUInt8Number* Pack15bitsRGBA(cmsContext ContextID, + CMSREGISTER struct _cmstransform_struct* CMMcargo, + CMSREGISTER cmsUInt16Number Values[], + CMSREGISTER cmsUInt8Number* Buffer, + CMSREGISTER cmsUInt32Number Stride) +{ + UNUSED_PARAMETER(ContextID); + UNUSED_PARAMETER(CMMcargo); + UNUSED_PARAMETER(Stride); + + *(cmsUInt16Number*)Buffer = From16To15(Values[0]); + Buffer += 2; + *(cmsUInt16Number*)Buffer = From16To15(Values[1]); + Buffer += 2; + *(cmsUInt16Number*)Buffer = From16To15(Values[2]); + + return Buffer + 4; +} + + +// Specialized 3 channels reversed formatters +static +cmsUInt8Number* Unroll15bitsBGR(cmsContext ContextID, + CMSREGISTER struct _cmstransform_struct* CMMcargo, + CMSREGISTER cmsUInt16Number Values[], + CMSREGISTER cmsUInt8Number* Buffer, + CMSREGISTER cmsUInt32Number Stride) +{ + UNUSED_PARAMETER(ContextID); + UNUSED_PARAMETER(CMMcargo); + UNUSED_PARAMETER(Stride); + + Values[2] = From15To16(*(cmsUInt16Number*)Buffer); + Buffer += 2; + Values[1] = From15To16(*(cmsUInt16Number*)Buffer); + Buffer += 2; + Values[0] = From15To16(*(cmsUInt16Number*)Buffer); + + return Buffer + 2; +} + + +static +cmsUInt8Number* Pack15bitsBGR(cmsContext ContextID, + CMSREGISTER struct _cmstransform_struct* CMMcargo, + CMSREGISTER cmsUInt16Number Values[], + CMSREGISTER cmsUInt8Number* Buffer, + CMSREGISTER cmsUInt32Number Stride) +{ + UNUSED_PARAMETER(ContextID); + UNUSED_PARAMETER(CMMcargo); + UNUSED_PARAMETER(Stride); + + *(cmsUInt16Number*)Buffer = From16To15(Values[2]); + Buffer += 2; + *(cmsUInt16Number*)Buffer = From16To15(Values[1]); + Buffer += 2; + *(cmsUInt16Number*)Buffer = From16To15(Values[0]); + + return Buffer+2; +} + +// Specialized 4 channels CMYK formatters. Note Photoshop stores CMYK reversed +static +cmsUInt8Number* Unroll15bitsCMYK(cmsContext ContextID, + CMSREGISTER struct _cmstransform_struct* CMMcargo, + CMSREGISTER cmsUInt16Number Values[], + CMSREGISTER cmsUInt8Number* Buffer, + CMSREGISTER cmsUInt32Number Stride) +{ + UNUSED_PARAMETER(ContextID); + UNUSED_PARAMETER(CMMcargo); + UNUSED_PARAMETER(Stride); + + Values[0] = From15To16(0x8000 - *(cmsUInt16Number*)Buffer); + Buffer += 2; + Values[1] = From15To16(0x8000 - *(cmsUInt16Number*)Buffer); + Buffer += 2; + Values[2] = From15To16(0x8000 - *(cmsUInt16Number*)Buffer); + Buffer += 2; + Values[3] = From15To16(0x8000 - *(cmsUInt16Number*)Buffer); + + return Buffer + 2; +} + +static +cmsUInt8Number* Pack15bitsCMYK(cmsContext ContextID, + CMSREGISTER struct _cmstransform_struct* CMMcargo, + CMSREGISTER cmsUInt16Number Values[], + CMSREGISTER cmsUInt8Number* Buffer, + CMSREGISTER cmsUInt32Number Stride) +{ + UNUSED_PARAMETER(ContextID); + UNUSED_PARAMETER(CMMcargo); + UNUSED_PARAMETER(Stride); + + *(cmsUInt16Number*)Buffer = 0x8000U - From16To15(Values[0]); + Buffer += 2; + *(cmsUInt16Number*)Buffer = 0x8000U - From16To15(Values[1]); + Buffer += 2; + *(cmsUInt16Number*)Buffer = 0x8000U - From16To15(Values[2]); + Buffer += 2; + *(cmsUInt16Number*)Buffer = 0x8000U - From16To15(Values[3]); + + return Buffer + 2; +} + + +// This macros does all handling for fallthrough cases +cmsINLINE cmsUInt16Number UnrollOne(cmsUInt16Number x, cmsBool Reverse, cmsBool SwapEndian) +{ + if (SwapEndian) + x = (x << 8) | (x >> 8); + + if (Reverse) + x = 0xffff - x; + + return From15To16(x); +} + +cmsINLINE cmsUInt16Number PackOne(cmsUInt16Number x, cmsBool Reverse, cmsBool SwapEndian) +{ + x = From16To15(x); + + if (Reverse) + x = 0xffff - x; + + if (SwapEndian) + x = (x << 8) | (x >> 8); + + return x; +} + +// Generic planar support +static +cmsUInt8Number* Unroll15bitsPlanar(cmsContext ContextID, + CMSREGISTER struct _cmstransform_struct* CMMcargo, + CMSREGISTER cmsUInt16Number wIn[], + CMSREGISTER cmsUInt8Number* accum, + CMSREGISTER cmsUInt32Number Stride) +{ + _xform_head* head = (_xform_head*) CMMcargo; + int nChan = T_CHANNELS(head->InputFormat); + int DoSwap = T_DOSWAP(head->InputFormat); + int Reverse = T_FLAVOR(head->InputFormat); + int SwapEndian = T_ENDIAN16(head->InputFormat); + int i; + cmsUInt8Number* Init = accum; + + UNUSED_PARAMETER(ContextID); + UNUSED_PARAMETER(Stride); + + if (DoSwap) { + accum += T_EXTRA(head->InputFormat) * Stride * 2; + } + + for (i = 0; i < nChan; i++) { + + int index = DoSwap ? (nChan - i - 1) : i; + + wIn[index] = UnrollOne(*(cmsUInt16Number*)accum, Reverse, SwapEndian); + + accum += Stride * 2; + } + + return (Init + 2); +} + + +static +cmsUInt8Number* Pack15bitsPlanar(cmsContext ContextID, + CMSREGISTER struct _cmstransform_struct* CMMcargo, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) +{ + _xform_head* head = (_xform_head*)CMMcargo; + int nChan = T_CHANNELS(head->OutputFormat); + int DoSwap = T_DOSWAP(head->OutputFormat); + int Reverse = T_FLAVOR(head->OutputFormat); + int SwapEndian = T_ENDIAN16(head->OutputFormat); + CMSREGISTER int i; + cmsUInt8Number* Init = output; + + UNUSED_PARAMETER(ContextID); + + if (DoSwap) { + output += T_EXTRA(head->OutputFormat) * Stride * 2; + } + + for (i = 0; i < nChan; i++) { + + int index = DoSwap ? (nChan - i - 1) : i; + + *(cmsUInt16Number*)output = PackOne(wOut[index], Reverse, SwapEndian); + output += (Stride * sizeof(cmsUInt16Number)); + } + + return (Init + sizeof(cmsUInt16Number)); +} + + + +// Generic falltrough +static +cmsUInt8Number* Unroll15bitsChunky(cmsContext ContextID, + CMSREGISTER struct _cmstransform_struct* CMMcargo, + CMSREGISTER cmsUInt16Number Values[], + CMSREGISTER cmsUInt8Number* Buffer, + CMSREGISTER cmsUInt32Number Stride) +{ + _xform_head* head = (_xform_head*) CMMcargo; + + int nChan = T_CHANNELS(head->InputFormat); + int DoSwap = T_DOSWAP(head->InputFormat); + int Reverse = T_FLAVOR(head->InputFormat); + int SwapEndian = T_ENDIAN16(head->InputFormat); + + CMSREGISTER int i; + + UNUSED_PARAMETER(ContextID); + UNUSED_PARAMETER(Stride); + + if (DoSwap) { + Buffer += T_EXTRA(head->OutputFormat) * 2; + } + + for (i = 0; i < nChan; i++) { + + int index = DoSwap ? (nChan - i - 1) : i; + + Values[index] = UnrollOne(*(cmsUInt16Number*)Buffer, Reverse, SwapEndian); + + Buffer += 2; + } + + + return Buffer; +} + + +static +cmsUInt8Number* Pack15bitsChunky(cmsContext ContextID, + CMSREGISTER struct _cmstransform_struct* CMMcargo, + CMSREGISTER cmsUInt16Number Values[], + CMSREGISTER cmsUInt8Number* Buffer, + CMSREGISTER cmsUInt32Number Stride) +{ + _xform_head* head = (_xform_head*)CMMcargo; + + int nChan = T_CHANNELS(head->OutputFormat); + int DoSwap = T_DOSWAP(head->OutputFormat); + int Reverse = T_FLAVOR(head->OutputFormat); + int SwapEndian = T_ENDIAN16(head->OutputFormat); + + CMSREGISTER int i; + + UNUSED_PARAMETER(ContextID); + UNUSED_PARAMETER(Stride); + + if (DoSwap) { + Buffer += T_EXTRA(head->OutputFormat) * 2; + } + + for (i = 0; i < nChan; i++) { + + int index = DoSwap ? (nChan - i - 1) : i; + + *(cmsUInt16Number*)Buffer = PackOne(Values[index], Reverse, SwapEndian); + + Buffer += 2; + } + + return Buffer; +} + + + +// Generic N-bytes plus dither 16-to-8 conversion. +static int err[cmsMAXCHANNELS]; + +static +cmsUInt8Number* PackNBytesDither(cmsContext ContextID, + CMSREGISTER struct _cmstransform_struct* CMMcargo, + CMSREGISTER cmsUInt16Number Values[], + CMSREGISTER cmsUInt8Number* Buffer, + CMSREGISTER cmsUInt32Number Stride) +{ + _xform_head* info = (_xform_head*)CMMcargo; + + int nChan = T_CHANNELS(info->OutputFormat); + CMSREGISTER int i; + unsigned int n, pe, pf; + + UNUSED_PARAMETER(ContextID); + UNUSED_PARAMETER(Stride); + + for (i = 0; i < nChan; i++) { + + n = Values[i] + err[i]; // Value + + pe = (n / 257); // Whole part + pf = (n % 257); // Fractional part + + err[i] = pf; // Store it for next pixel + + *Buffer++ = (cmsUInt8Number) pe; + } + + return Buffer + T_EXTRA(info->OutputFormat); +} + + +static +cmsUInt8Number* PackNBytesSwapDither(cmsContext ContextID, + CMSREGISTER struct _cmstransform_struct* CMMcargo, + CMSREGISTER cmsUInt16Number Values[], + CMSREGISTER cmsUInt8Number* Buffer, + CMSREGISTER cmsUInt32Number Stride) +{ + _xform_head* info = (_xform_head*)CMMcargo; + + int nChan = T_CHANNELS(info->OutputFormat); + CMSREGISTER int i; + unsigned int n, pe, pf; + + UNUSED_PARAMETER(ContextID); + UNUSED_PARAMETER(Stride); + + for (i = nChan - 1; i >= 0; --i) { + + n = Values[i] + err[i]; // Value + + pe = (n / 257); // Whole part + pf = (n % 257); // Fractional part + + err[i] = pf; // Store it for next pixel + + *Buffer++ = (cmsUInt8Number)pe; + } + + + return Buffer + T_EXTRA(info->OutputFormat); +} + + +// The factory for 15 bits. This function returns a pointer to specialized function +// that would deal with the asked format. It return a pointer to NULL if the format +// is not supported. This is tha basis of formatter plug-in for 15 bit formats. +cmsFormatter Formatter_15Bit_Factory(cmsContext ContextID, + cmsUInt32Number Type, + cmsFormatterDirection Dir, + cmsUInt32Number dwFlags) +{ + cmsFormatter Result = { NULL }; + + UNUSED_PARAMETER(ContextID); + UNUSED_PARAMETER(dwFlags); + + switch (Type) { + + // Simple Gray + case TYPE_GRAY_15: + Result.Fmt16 = (Dir == cmsFormatterInput) ? Unroll15bitsGray : Pack15bitsGray; + break; + + // 3 channels + case TYPE_CMY_15: + case TYPE_RGB_15: + Result.Fmt16 = (Dir == cmsFormatterInput) ? Unroll15bitsRGB : Pack15bitsRGB; + break; + + // 3 channels reversed + case TYPE_YMC_15: + case TYPE_BGR_15: + Result.Fmt16 = (Dir == cmsFormatterInput) ? Unroll15bitsBGR : Pack15bitsBGR; + break; + + // 3 Channels plus one alpha + case TYPE_RGBA_15: + Result.Fmt16 = (Dir == cmsFormatterInput) ? Unroll15bitsRGBA : Pack15bitsRGBA; + break; + + // 4 channels + case TYPE_CMYK_15: + Result.Fmt16 = (Dir == cmsFormatterInput) ? Unroll15bitsCMYK : Pack15bitsCMYK; + break; + + // Planar versions + case TYPE_GRAYA_15_PLANAR: + case TYPE_RGB_15_PLANAR: + case TYPE_BGR_15_PLANAR: + case TYPE_RGBA_15_PLANAR: + case TYPE_ABGR_15_PLANAR: + case TYPE_CMY_15_PLANAR: + case TYPE_CMYK_15_PLANAR: + Result.Fmt16 = (Dir == cmsFormatterInput) ? Unroll15bitsPlanar : Pack15bitsPlanar; + break; + + // Falltrough for remaining (corner) cases + case TYPE_GRAY_15_REV: + case TYPE_GRAY_15_SE: + case TYPE_GRAYA_15: + case TYPE_GRAYA_15_SE: + case TYPE_RGB_15_SE: + case TYPE_BGR_15_SE: + case TYPE_RGBA_15_SE: + case TYPE_ARGB_15: + case TYPE_ABGR_15: + case TYPE_ABGR_15_SE: + case TYPE_BGRA_15: + case TYPE_BGRA_15_SE: + case TYPE_CMY_15_SE: + case TYPE_CMYK_15_REV: + case TYPE_CMYK_15_SE: + case TYPE_KYMC_15: + case TYPE_KYMC_15_SE: + case TYPE_KCMY_15: + case TYPE_KCMY_15_REV: + case TYPE_KCMY_15_SE: + Result.Fmt16 = (Dir == cmsFormatterInput) ? Unroll15bitsChunky : Pack15bitsChunky; + break; + + case TYPE_GRAY_8_DITHER: + case TYPE_RGB_8_DITHER: + case TYPE_RGBA_8_DITHER: + case TYPE_CMYK_8_DITHER: + if (Dir == cmsFormatterOutput) { + Result.Fmt16 = PackNBytesDither; + } + break; + + case TYPE_ABGR_8_DITHER: + case TYPE_BGR_8_DITHER: + case TYPE_KYMC_8_DITHER: + if (Dir == cmsFormatterOutput) { + Result.Fmt16 = PackNBytesSwapDither; + } + break; + + default:; + } + + return Result; +} + + + diff --git a/lcms2mt/plugins/fast_float/src/fast_float_15mats.c b/lcms2mt/plugins/fast_float/src/fast_float_15mats.c new file mode 100644 index 00000000..e2a7da68 --- /dev/null +++ b/lcms2mt/plugins/fast_float/src/fast_float_15mats.c @@ -0,0 +1,347 @@ +//--------------------------------------------------------------------------------- +// +// Little Color Management System, fast floating point extensions +// Copyright (c) 1998-2020 Marti Maria Saguer, all rights reserved +// +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +//--------------------------------------------------------------------------------- + +// Optimization for matrix-shaper in 15 bits. Numbers are operated in 1.15 usigned, + +#include "fast_float_internal.h" + +// An storage capable to keep 1.15 signed and some extra precission. +// Actually I use 32 bits integer (signed) +typedef cmsInt32Number cmsS1Fixed15Number; + +// Conversion to fixed. Note we don't use floor to get proper sign roundoff +#define DOUBLE_TO_1FIXED15(x) ((cmsS1Fixed15Number) ((double) (x) * 0x8000 + 0.5)) + +// This is the private data container used by this optimization +typedef struct { + + cmsS1Fixed15Number Mat[3][3]; + cmsS1Fixed15Number Off[3]; + + // Precalculated tables for first shaper (375 Kb in total of both shapers) + cmsUInt16Number Shaper1R[MAX_NODES_IN_CURVE]; + cmsUInt16Number Shaper1G[MAX_NODES_IN_CURVE]; + cmsUInt16Number Shaper1B[MAX_NODES_IN_CURVE]; + + // Second shaper + cmsUInt16Number Shaper2R[MAX_NODES_IN_CURVE]; + cmsUInt16Number Shaper2G[MAX_NODES_IN_CURVE]; + cmsUInt16Number Shaper2B[MAX_NODES_IN_CURVE]; + + // A flag for fast operation if identity + cmsBool IdentityMat; + + // Poits to the raw, unaligned memory + void * real_ptr; + + +} XMatShaperData; + +// A special malloc that returns memory aligned to DWORD boundary. Aligned memory access is way faster than unaligned +// reference to the real block is kept for later free +static XMatShaperData* malloc_aligned(cmsContext ContextID) +{ + cmsUInt8Number* real_ptr = (cmsUInt8Number*)_cmsMallocZero(ContextID, sizeof(XMatShaperData) + 32); + cmsUInt8Number* aligned = (cmsUInt8Number*)(((uintptr_t)real_ptr + 16) & ~0xf); + XMatShaperData* p = (XMatShaperData*)aligned; + + p->real_ptr = real_ptr; + return p; +} + + +// Free the private data container +static +void FreeMatShaper(cmsContext ContextID, void* Data) +{ + + XMatShaperData* p = (XMatShaperData*)Data; + if (p != NULL) + _cmsFree(ContextID, p->real_ptr); +} + + +// This table converts from 8 bits to 1.14 after applying the curve +static +void FillShaper(cmsContext ContextID, cmsUInt16Number* Table, cmsToneCurve* Curve) +{ + int i; + cmsFloat32Number R, y; + + for (i = 0; i < MAX_NODES_IN_CURVE; i++) { + + R = (cmsFloat32Number)i / (cmsFloat32Number) (MAX_NODES_IN_CURVE - 1); + y = cmsEvalToneCurveFloat(ContextID, Curve, R); + + Table[i] = (cmsUInt16Number) DOUBLE_TO_1FIXED15(y); + } +} + + +// Compute the matrix-shaper structure +static +XMatShaperData* SetMatShaper(cmsContext ContextID, cmsToneCurve* Curve1[3], cmsMAT3* Mat, cmsVEC3* Off, cmsToneCurve* Curve2[3], cmsBool IdentityMat) +{ + XMatShaperData* p; + int i, j; + + // Allocate a big chuck of memory to store precomputed tables + p = malloc_aligned(ContextID); + if (p == NULL) return FALSE; + + p->IdentityMat = IdentityMat; + + // Precompute tables + FillShaper(ContextID, p->Shaper1R, Curve1[0]); + FillShaper(ContextID, p->Shaper1G, Curve1[1]); + FillShaper(ContextID, p->Shaper1B, Curve1[2]); + + FillShaper(ContextID, p->Shaper2R, Curve2[0]); + FillShaper(ContextID, p->Shaper2G, Curve2[1]); + FillShaper(ContextID, p->Shaper2B, Curve2[2]); + + // Convert matrix to nFixed14. Note that those values may take more than 16 bits if negative + for (i = 0; i < 3; i++) { + for (j = 0; j < 3; j++) { + + p->Mat[i][j] = DOUBLE_TO_1FIXED15(Mat->v[i].n[j]); + } + } + + + for (i = 0; i < 3; i++) { + + if (Off == NULL) { + + p->Off[i] = 0x4000; + + } + else { + p->Off[i] = DOUBLE_TO_1FIXED15(Off->n[i]) + 0x4000; + + } + } + + + return p; +} + +// A fast matrix-shaper evaluator for 15 bits. This is a bit ticky since I'm using 1.15 signed fixed point. +static +void MatShaperXform(cmsContext ContextID, + struct _cmstransform_struct *CMMcargo, + const void* Input, + void* Output, + cmsUInt32Number PixelsPerLine, + cmsUInt32Number LineCount, + const cmsStride* Stride) +{ + XMatShaperData* p = (XMatShaperData*)_cmsGetTransformUserData(CMMcargo); + + cmsS1Fixed15Number l1, l2, l3; + + cmsS1Fixed15Number r, g, b; + cmsUInt32Number ri, gi, bi; + cmsUInt32Number i, ii; + cmsUInt32Number SourceStartingOrder[cmsMAXCHANNELS]; + cmsUInt32Number SourceIncrements[cmsMAXCHANNELS]; + cmsUInt32Number DestStartingOrder[cmsMAXCHANNELS]; + cmsUInt32Number DestIncrements[cmsMAXCHANNELS]; + + const cmsUInt8Number* rin; + const cmsUInt8Number* gin; + const cmsUInt8Number* bin; + const cmsUInt8Number* ain = NULL; + + cmsUInt8Number* rout; + cmsUInt8Number* gout; + cmsUInt8Number* bout; + cmsUInt8Number* aout = NULL; + + cmsUInt32Number nalpha, strideIn, strideOut; + + _cmsComputeComponentIncrements(cmsGetTransformInputFormat(ContextID, (cmsHTRANSFORM)CMMcargo), Stride->BytesPerPlaneIn, NULL, &nalpha, SourceStartingOrder, SourceIncrements); + _cmsComputeComponentIncrements(cmsGetTransformOutputFormat(ContextID, (cmsHTRANSFORM)CMMcargo), Stride->BytesPerPlaneOut, NULL, &nalpha, DestStartingOrder, DestIncrements); + + strideIn = strideOut = 0; + for (i = 0; i < LineCount; i++) { + + rin = (const cmsUInt8Number*)Input + SourceStartingOrder[0] + strideIn; + gin = (const cmsUInt8Number*)Input + SourceStartingOrder[1] + strideIn; + bin = (const cmsUInt8Number*)Input + SourceStartingOrder[2] + strideIn; + if (nalpha) + ain = (const cmsUInt8Number*)Input + SourceStartingOrder[3] + strideIn; + + + rout = (cmsUInt8Number*)Output + DestStartingOrder[0] + strideOut; + gout = (cmsUInt8Number*)Output + DestStartingOrder[1] + strideOut; + bout = (cmsUInt8Number*)Output + DestStartingOrder[2] + strideOut; + if (nalpha) + aout = (cmsUInt8Number*)Output + DestStartingOrder[3] + strideOut; + + + for (ii = 0; ii < PixelsPerLine; ii++) { + + // Across first shaper, which also converts to 1.15 fixed point. + r = p->Shaper1R[*(cmsUInt16Number*)rin]; + g = p->Shaper1G[*(cmsUInt16Number*)gin]; + b = p->Shaper1B[*(cmsUInt16Number*)bin]; + + if (p->IdentityMat) + { + l1 = r; l2 = g; l3 = b; + } + else + { + // Evaluate the matrix in 1.14 fixed point + l1 = (p->Mat[0][0] * r + p->Mat[0][1] * g + p->Mat[0][2] * b + p->Off[0]) >> 15; + l2 = (p->Mat[1][0] * r + p->Mat[1][1] * g + p->Mat[1][2] * b + p->Off[1]) >> 15; + l3 = (p->Mat[2][0] * r + p->Mat[2][1] * g + p->Mat[2][2] * b + p->Off[2]) >> 15; + } + + // Now we have to clip to 0..1.0 range + ri = (l1 < 0) ? 0 : ((l1 > 0x8000) ? 0x8000 : l1); + gi = (l2 < 0) ? 0 : ((l2 > 0x8000) ? 0x8000 : l2); + bi = (l3 < 0) ? 0 : ((l3 > 0x8000) ? 0x8000 : l3); + + + // And across second shaper, + *(cmsUInt16Number*)rout = p->Shaper2R[ri]; + *(cmsUInt16Number*)gout = p->Shaper2G[gi]; + *(cmsUInt16Number*)bout = p->Shaper2B[bi]; + + + // Handle alpha + if (ain) { + memmove(aout, ain, 2); + } + + rin += SourceIncrements[0]; + gin += SourceIncrements[1]; + bin += SourceIncrements[2]; + if (ain) ain += SourceIncrements[3]; + + rout += DestIncrements[0]; + gout += DestIncrements[1]; + bout += DestIncrements[2]; + if (aout) aout += DestIncrements[3]; + } + + strideIn += Stride->BytesPerLineIn; + strideOut += Stride->BytesPerLineOut; + } +} + + + +// 15 bits on input allows matrix-shaper boost up a little bit +cmsBool OptimizeMatrixShaper15(cmsContext ContextID, + _cmsTransformFn* TransformFn, + void** UserData, + _cmsFreeUserDataFn* FreeUserData, + cmsPipeline** Lut, + cmsUInt32Number* InputFormat, + cmsUInt32Number* OutputFormat, + cmsUInt32Number* dwFlags) +{ + cmsStage* Curve1, *Curve2; + cmsStage* Matrix1, *Matrix2; + _cmsStageMatrixData* Data1; + _cmsStageMatrixData* Data2; + cmsMAT3 res; + cmsBool IdentityMat = FALSE; + cmsPipeline* Dest, *Src; + + cmsUInt32Number nChans; + + // Only works on RGB to RGB and gray + + if (!(T_CHANNELS(*InputFormat) == 3 && T_CHANNELS(*OutputFormat) == 3)) return FALSE; + + // Only works on 15 bit to 15 bit + if (T_BYTES(*InputFormat) != 2 || T_BYTES(*OutputFormat) != 2 || + T_BIT15(*InputFormat) == 0 || T_BIT15(*OutputFormat) == 0) return FALSE; + + // Seems suitable, proceed + Src = *Lut; + + // Check for shaper-matrix-matrix-shaper structure, that is what this optimizer stands for + if (!cmsPipelineCheckAndRetreiveStages(ContextID, Src, 4, + cmsSigCurveSetElemType, cmsSigMatrixElemType, cmsSigMatrixElemType, cmsSigCurveSetElemType, + &Curve1, &Matrix1, &Matrix2, &Curve2)) return FALSE; + + nChans = T_CHANNELS(*InputFormat); + + // Get both matrices, which are 3x3 + Data1 = (_cmsStageMatrixData*)cmsStageData(ContextID, Matrix1); + Data2 = (_cmsStageMatrixData*)cmsStageData(ContextID, Matrix2); + + // Input offset should be zero + if (Data1->Offset != NULL) return FALSE; + + // Multiply both matrices to get the result + _cmsMAT3per(ContextID, &res, (cmsMAT3*)Data2->Double, (cmsMAT3*)Data1->Double); + + // Now the result is in res + Data2 -> Offset. Maybe is a plain identity? + IdentityMat = FALSE; + if (_cmsMAT3isIdentity(ContextID, &res) && Data2->Offset == NULL) { + + // We can get rid of full matrix + IdentityMat = TRUE; + } + + + // Allocate an empty LUT + Dest = cmsPipelineAlloc(ContextID, nChans, nChans); + if (!Dest) return FALSE; + + // Assamble the new LUT + cmsPipelineInsertStage(ContextID, Dest, cmsAT_BEGIN, cmsStageDup(ContextID, Curve1)); + + if (!IdentityMat) { + + cmsPipelineInsertStage(ContextID, Dest, cmsAT_END, + cmsStageAllocMatrix(ContextID, 3, 3, (const cmsFloat64Number*)&res, Data2->Offset)); + } + + cmsPipelineInsertStage(ContextID, Dest, cmsAT_END, cmsStageDup(ContextID, Curve2)); + + { + _cmsStageToneCurvesData* mpeC1 = (_cmsStageToneCurvesData*)cmsStageData(ContextID, Curve1); + _cmsStageToneCurvesData* mpeC2 = (_cmsStageToneCurvesData*)cmsStageData(ContextID, Curve2); + + // In this particular optimization, caché does not help as it takes more time to deal with + // the caché that with the pixel handling + *dwFlags |= cmsFLAGS_NOCACHE; + + // Setup the optimizarion routines + *UserData = SetMatShaper(ContextID, mpeC1->TheCurves, &res, (cmsVEC3*)Data2->Offset, mpeC2->TheCurves, IdentityMat); + *FreeUserData = FreeMatShaper; + + *TransformFn = (_cmsTransformFn)MatShaperXform; + } + + + cmsPipelineFree(ContextID, Src); + *dwFlags &= ~cmsFLAGS_CAN_CHANGE_FORMATTER; + *Lut = Dest; + return TRUE; +} diff --git a/lcms2mt/plugins/fast_float/src/fast_float_cmyk.c b/lcms2mt/plugins/fast_float/src/fast_float_cmyk.c new file mode 100644 index 00000000..1886b966 --- /dev/null +++ b/lcms2mt/plugins/fast_float/src/fast_float_cmyk.c @@ -0,0 +1,379 @@ +//--------------------------------------------------------------------------------- +// +// Little Color Management System, fast floating point extensions +// Copyright (c) 1998-2020 Marti Maria Saguer, all rights reserved +// +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +//--------------------------------------------------------------------------------- + +#include "fast_float_internal.h" + +// Optimization for floating point tetrahedral interpolation +typedef struct { + + const cmsInterpParams* p; // Tetrahedrical interpolation parameters. This is a not-owned pointer. + +} FloatCMYKData; + + + +// Precomputes tables on input devicelink. +static +FloatCMYKData* FloatCMYKAlloc(cmsContext ContextID, const cmsInterpParams* p) +{ + FloatCMYKData* fd; + + fd = (FloatCMYKData*) _cmsMallocZero(ContextID, sizeof(FloatCMYKData)); + if (fd == NULL) return NULL; + + fd ->p = p; + return fd; +} + + +static +int XFormSampler(cmsContext ContextID, CMSREGISTER const cmsFloat32Number In[], CMSREGISTER cmsFloat32Number Out[], CMSREGISTER void* Cargo) +{ + // Evaluate in 16 bits + cmsPipelineEvalFloat(ContextID, In, Out, (cmsPipeline*) Cargo); + + // Always succeed + return TRUE; +} + +cmsINLINE cmsFloat32Number LinearInterpInt(cmsFloat32Number a, cmsFloat32Number l, cmsFloat32Number h) +{ + return (h - l) * a + l; +} + +// To prevent out of bounds indexing +cmsINLINE cmsFloat32Number fclamp100(cmsFloat32Number v) +{ + return v < 0.0f ? 0.0f : (v > 100.0f ? 100.0f : v); +} + + +// A optimized interpolation for 8-bit input. +#define DENS(i,j,k) (LutTable[(i)+(j)+(k)+OutChan]) + +static +void FloatCMYKCLUTEval(cmsContext ContextID, + struct _cmstransform_struct *CMMcargo, + const cmsFloat32Number* Input, + cmsFloat32Number* Output, + cmsUInt32Number len, + cmsUInt32Number Stride) +{ + + cmsFloat32Number c, m, y, k; + cmsFloat32Number px, py, pz, pk; + int x0, y0, z0, k0; + int X0, Y0, Z0, K0, X1, Y1, Z1, K1; + cmsFloat32Number rx, ry, rz, rk; + cmsFloat32Number c0, c1 = 0, c2 = 0, c3 = 0; + + cmsUInt32Number OutChan; + FloatCMYKData* p8 = (FloatCMYKData*) _cmsGetTransformUserData(CMMcargo); + + const cmsInterpParams* p = p8 ->p; + cmsUInt32Number TotalOut = p -> nOutputs; + const cmsFloat32Number* LutTable = (const cmsFloat32Number*)p->Table; + cmsUInt32Number ii; + const cmsUInt8Number* cin; + const cmsUInt8Number* min; + const cmsUInt8Number* yin; + const cmsUInt8Number* kin; + + cmsFloat32Number Tmp1[cmsMAXCHANNELS], Tmp2[cmsMAXCHANNELS]; + + cmsUInt8Number* out[cmsMAXCHANNELS]; + cmsUInt32Number SourceStartingOrder[cmsMAXCHANNELS]; + cmsUInt32Number SourceIncrements[cmsMAXCHANNELS]; + cmsUInt32Number DestStartingOrder[cmsMAXCHANNELS]; + cmsUInt32Number DestIncrements[cmsMAXCHANNELS]; + + cmsUInt32Number InputFormat = cmsGetTransformInputFormat(ContextID, (cmsHTRANSFORM) CMMcargo); + cmsUInt32Number OutputFormat = cmsGetTransformOutputFormat(ContextID, (cmsHTRANSFORM) CMMcargo); + + cmsUInt32Number nchans, nalpha; + + _cmsComputeComponentIncrements(InputFormat, Stride, &nchans, &nalpha, SourceStartingOrder, SourceIncrements); + _cmsComputeComponentIncrements(OutputFormat, Stride, &nchans, &nalpha, DestStartingOrder, DestIncrements); + + // SeparateCMYK(InputFormat, Stride, SourceStartingOrder, SourceIncrements); + // SeparateCMYK(OutputFormat, Stride, DestStartingOrder, DestIncrements); + + cin = (const cmsUInt8Number*)Input + SourceStartingOrder[0]; + min = (const cmsUInt8Number*)Input + SourceStartingOrder[1]; + yin = (const cmsUInt8Number*)Input + SourceStartingOrder[2]; + kin = (const cmsUInt8Number*)Input + SourceStartingOrder[3]; + + for (ii=0; ii < TotalOut; ii++) + out[ii] = (cmsUInt8Number*)Output + DestStartingOrder[ii]; + + for (ii=0; ii < len; ii++) { + + c = fclamp100(*(cmsFloat32Number*)cin) / 100.0f; + m = fclamp100(*(cmsFloat32Number*)min) / 100.0f; + y = fclamp100(*(cmsFloat32Number*)yin) / 100.0f; + k = fclamp100(*(cmsFloat32Number*)kin) / 100.0f; + + cin += SourceIncrements[0]; + min += SourceIncrements[1]; + yin += SourceIncrements[2]; + kin += SourceIncrements[3]; + + pk = c * p->Domain[0]; // C + px = m * p->Domain[1]; // M + py = y * p->Domain[2]; // Y + pz = k * p->Domain[3]; // K + + + k0 = (int)_cmsQuickFloor(pk); rk = (pk - (cmsFloat32Number)k0); + x0 = (int)_cmsQuickFloor(px); rx = (px - (cmsFloat32Number)x0); + y0 = (int)_cmsQuickFloor(py); ry = (py - (cmsFloat32Number)y0); + z0 = (int)_cmsQuickFloor(pz); rz = (pz - (cmsFloat32Number)z0); + + + K0 = p->opta[3] * k0; + K1 = K0 + (c >= 1.0 ? 0 : p->opta[3]); + + X0 = p->opta[2] * x0; + X1 = X0 + (m >= 1.0 ? 0 : p->opta[2]); + + Y0 = p->opta[1] * y0; + Y1 = Y0 + (y >= 1.0 ? 0 : p->opta[1]); + + Z0 = p->opta[0] * z0; + Z1 = Z0 + (k >= 1.0 ? 0 : p->opta[0]); + + for (OutChan = 0; OutChan < TotalOut; OutChan++) { + + c0 = DENS(X0, Y0, Z0); + + if (rx >= ry && ry >= rz) { + + c1 = DENS(X1, Y0, Z0) - c0; + c2 = DENS(X1, Y1, Z0) - DENS(X1, Y0, Z0); + c3 = DENS(X1, Y1, Z1) - DENS(X1, Y1, Z0); + + } + else + if (rx >= rz && rz >= ry) { + + c1 = DENS(X1, Y0, Z0) - c0; + c2 = DENS(X1, Y1, Z1) - DENS(X1, Y0, Z1); + c3 = DENS(X1, Y0, Z1) - DENS(X1, Y0, Z0); + + } + else + if (rz >= rx && rx >= ry) { + + c1 = DENS(X1, Y0, Z1) - DENS(X0, Y0, Z1); + c2 = DENS(X1, Y1, Z1) - DENS(X1, Y0, Z1); + c3 = DENS(X0, Y0, Z1) - c0; + + } + else + if (ry >= rx && rx >= rz) { + + c1 = DENS(X1, Y1, Z0) - DENS(X0, Y1, Z0); + c2 = DENS(X0, Y1, Z0) - c0; + c3 = DENS(X1, Y1, Z1) - DENS(X1, Y1, Z0); + + } + else + if (ry >= rz && rz >= rx) { + + c1 = DENS(X1, Y1, Z1) - DENS(X0, Y1, Z1); + c2 = DENS(X0, Y1, Z0) - c0; + c3 = DENS(X0, Y1, Z1) - DENS(X0, Y1, Z0); + + } + else + if (rz >= ry && ry >= rx) { + + c1 = DENS(X1, Y1, Z1) - DENS(X0, Y1, Z1); + c2 = DENS(X0, Y1, Z1) - DENS(X0, Y0, Z1); + c3 = DENS(X0, Y0, Z1) - c0; + + } + else { + c1 = c2 = c3 = 0; + } + + + Tmp1[OutChan] = c0 + c1 * rx + c2 * ry + c3 * rz; + + } + + + LutTable = (cmsFloat32Number*)p->Table; + LutTable += K1; + + for (OutChan = 0; OutChan < p->nOutputs; OutChan++) { + + c0 = DENS(X0, Y0, Z0); + + if (rx >= ry && ry >= rz) { + + c1 = DENS(X1, Y0, Z0) - c0; + c2 = DENS(X1, Y1, Z0) - DENS(X1, Y0, Z0); + c3 = DENS(X1, Y1, Z1) - DENS(X1, Y1, Z0); + + } + else + if (rx >= rz && rz >= ry) { + + c1 = DENS(X1, Y0, Z0) - c0; + c2 = DENS(X1, Y1, Z1) - DENS(X1, Y0, Z1); + c3 = DENS(X1, Y0, Z1) - DENS(X1, Y0, Z0); + + } + else + if (rz >= rx && rx >= ry) { + + c1 = DENS(X1, Y0, Z1) - DENS(X0, Y0, Z1); + c2 = DENS(X1, Y1, Z1) - DENS(X1, Y0, Z1); + c3 = DENS(X0, Y0, Z1) - c0; + + } + else + if (ry >= rx && rx >= rz) { + + c1 = DENS(X1, Y1, Z0) - DENS(X0, Y1, Z0); + c2 = DENS(X0, Y1, Z0) - c0; + c3 = DENS(X1, Y1, Z1) - DENS(X1, Y1, Z0); + + } + else + if (ry >= rz && rz >= rx) { + + c1 = DENS(X1, Y1, Z1) - DENS(X0, Y1, Z1); + c2 = DENS(X0, Y1, Z0) - c0; + c3 = DENS(X0, Y1, Z1) - DENS(X0, Y1, Z0); + + } + else + if (rz >= ry && ry >= rx) { + + c1 = DENS(X1, Y1, Z1) - DENS(X0, Y1, Z1); + c2 = DENS(X0, Y1, Z1) - DENS(X0, Y0, Z1); + c3 = DENS(X0, Y0, Z1) - c0; + + } + else { + c1 = c2 = c3 = 0; + } + + Tmp2[OutChan] = c0 + c1 * rx + c2 * ry + c3 * rz; + } + + + for (OutChan = 0; OutChan < p->nOutputs; OutChan++) { + + *(cmsFloat32Number*)(out[OutChan]) = LinearInterpInt(rk, Tmp1[OutChan], Tmp2[OutChan]); + out[OutChan] += DestIncrements[OutChan]; + } + + + } +} + +#undef DENS + + + +// -------------------------------------------------------------------------------------------------------------- + +cmsBool OptimizeCLUTCMYKTransform(cmsContext ContextID, + _cmsTransformFn* TransformFn, + void** UserData, + _cmsFreeUserDataFn* FreeDataFn, + cmsPipeline** Lut, + cmsUInt32Number* InputFormat, + cmsUInt32Number* OutputFormat, + cmsUInt32Number* dwFlags) +{ + cmsPipeline* OriginalLut; + int nGridPoints; + cmsPipeline* OptimizedLUT = NULL; + cmsStage* OptimizedCLUTmpe; + cmsColorSpaceSignature OutputColorSpace; + cmsStage* mpe; + FloatCMYKData* p8; + _cmsStageCLutData* data; + + // For empty transforms, do nothing + if (*Lut == NULL) return FALSE; + + // This is a loosy optimization! does not apply in floating-point cases + if (!T_FLOAT(*InputFormat) || !T_FLOAT(*OutputFormat)) return FALSE; + + // Only on 8-bit + if (T_BYTES(*InputFormat) != 4 || T_BYTES(*OutputFormat) != 4) return FALSE; + + // Only on CMYK + if (T_COLORSPACE(*InputFormat) != PT_CMYK) return FALSE; + + OriginalLut = *Lut; + + // Named color pipelines cannot be optimized either + for (mpe = cmsPipelineGetPtrToFirstStage(ContextID, OriginalLut); + mpe != NULL; + mpe = cmsStageNext(ContextID, mpe)) { + if (cmsStageType(ContextID, mpe) == cmsSigNamedColorElemType) return FALSE; + } + + OutputColorSpace = _cmsICCcolorSpace(ContextID, T_COLORSPACE(*OutputFormat)); + nGridPoints = _cmsReasonableGridpointsByColorspace(cmsSigRgbData, *dwFlags); + + // Create the result LUT + OptimizedLUT = cmsPipelineAlloc(ContextID, 4, cmsPipelineOutputChannels(ContextID, OriginalLut)); + if (OptimizedLUT == NULL) goto Error; + + + // Allocate the CLUT for result + OptimizedCLUTmpe = cmsStageAllocCLutFloat(ContextID, nGridPoints, 4, cmsPipelineOutputChannels(ContextID, OriginalLut), NULL); + + // Add the CLUT to the destination LUT + cmsPipelineInsertStage(ContextID, OptimizedLUT, cmsAT_BEGIN, OptimizedCLUTmpe); + + // Resample the LUT + if (!cmsStageSampleCLutFloat(ContextID, OptimizedCLUTmpe, XFormSampler, (void*)OriginalLut, 0)) goto Error; + + // Set the evaluator, copy parameters + data = (_cmsStageCLutData*) cmsStageData(ContextID, OptimizedCLUTmpe); + + p8 = FloatCMYKAlloc(ContextID, data ->Params); + if (p8 == NULL) return FALSE; + + // And return the obtained LUT + cmsPipelineFree(ContextID, OriginalLut); + + *Lut = OptimizedLUT; + *TransformFn = (_cmsTransformFn) FloatCMYKCLUTEval; + *UserData = p8; + *FreeDataFn = _cmsFree; + *dwFlags &= ~cmsFLAGS_CAN_CHANGE_FORMATTER; + return TRUE; + +Error: + + if (OptimizedLUT != NULL) cmsPipelineFree(ContextID, OptimizedLUT); + + return FALSE; +} diff --git a/lcms2mt/plugins/fast_float/src/fast_float_curves.c b/lcms2mt/plugins/fast_float/src/fast_float_curves.c new file mode 100644 index 00000000..e6e42fb6 --- /dev/null +++ b/lcms2mt/plugins/fast_float/src/fast_float_curves.c @@ -0,0 +1,384 @@ +//--------------------------------------------------------------------------------- +// +// Little Color Management System, fast floating point extensions +// Copyright (c) 1998-2020 Marti Maria Saguer, all rights reserved +// +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +//--------------------------------------------------------------------------------- + +#include "fast_float_internal.h" + +// Curves, optimization is valid for floating point curves +typedef struct { + + cmsFloat32Number CurveR[MAX_NODES_IN_CURVE]; + cmsFloat32Number CurveG[MAX_NODES_IN_CURVE]; + cmsFloat32Number CurveB[MAX_NODES_IN_CURVE]; + + void* real_ptr; + +} CurvesFloatData; + + + +// A special malloc that returns memory aligned to DWORD boundary. Aligned memory access is way faster than unaligned +// reference to the real block is kept for later free +static CurvesFloatData* malloc_aligned(cmsContext ContextID) +{ + cmsUInt8Number* real_ptr = (cmsUInt8Number*)_cmsMallocZero(ContextID, sizeof(CurvesFloatData) + 32); + cmsUInt8Number* aligned = (cmsUInt8Number*)(((uintptr_t)real_ptr + 16) & ~0xf); + CurvesFloatData* p = (CurvesFloatData*)aligned; + + p->real_ptr = real_ptr; + + return p; +} + +// Free the private data container +static void free_aligned(cmsContext ContextID, void* Data) +{ + CurvesFloatData* p = (CurvesFloatData*)Data; + if (p != NULL) + _cmsFree(ContextID, p->real_ptr); +} + +// Evaluator for float curves. This are just 1D tables + +static void FastEvaluateFloatRGBCurves(cmsContext ContextID, + struct _cmstransform_struct *CMMcargo, + const cmsFloat32Number* Input, + cmsFloat32Number* Output, + cmsUInt32Number len, + cmsUInt32Number Stride) +{ + cmsUInt32Number ii; + cmsUInt32Number SourceStartingOrder[cmsMAXCHANNELS]; + cmsUInt32Number SourceIncrements[cmsMAXCHANNELS]; + cmsUInt32Number DestStartingOrder[cmsMAXCHANNELS]; + cmsUInt32Number DestIncrements[cmsMAXCHANNELS]; + + const cmsUInt8Number* rin; + const cmsUInt8Number* gin; + const cmsUInt8Number* bin; + + cmsUInt8Number* rout; + cmsUInt8Number* gout; + cmsUInt8Number* bout; + + cmsUInt32Number InputFormat = cmsGetTransformInputFormat(ContextID, (cmsHTRANSFORM) CMMcargo); + cmsUInt32Number OutputFormat = cmsGetTransformOutputFormat(ContextID, (cmsHTRANSFORM) CMMcargo); + + CurvesFloatData* Data = (CurvesFloatData*) _cmsGetTransformUserData(CMMcargo); + + cmsUInt32Number nchans, nalpha; + + _cmsComputeComponentIncrements(InputFormat, Stride, &nchans, &nalpha, SourceStartingOrder, SourceIncrements); + _cmsComputeComponentIncrements(OutputFormat, Stride, &nchans, &nalpha, DestStartingOrder, DestIncrements); + + // SeparateRGB(InputFormat, Stride, SourceStartingOrder, SourceIncrements); + // SeparateRGB(OutputFormat, Stride, DestStartingOrder, DestIncrements); + + rin = (const cmsUInt8Number*)Input + SourceStartingOrder[0]; + gin = (const cmsUInt8Number*)Input + SourceStartingOrder[1]; + bin = (const cmsUInt8Number*)Input + SourceStartingOrder[2]; + + rout = (cmsUInt8Number*)Output + DestStartingOrder[0]; + gout = (cmsUInt8Number*)Output + DestStartingOrder[1]; + bout = (cmsUInt8Number*)Output + DestStartingOrder[2]; + + for (ii = 0; ii < len; ii++) { + + *(cmsFloat32Number*)rout = flerp(Data->CurveR, *(cmsFloat32Number*)rin); + *(cmsFloat32Number*)gout = flerp(Data->CurveG, *(cmsFloat32Number*)gin); + *(cmsFloat32Number*)bout = flerp(Data->CurveB, *(cmsFloat32Number*)bin); + + rin += SourceIncrements[0]; + gin += SourceIncrements[1]; + bin += SourceIncrements[2]; + + rout += DestIncrements[0]; + gout += DestIncrements[1]; + bout += DestIncrements[2]; + } +} + +// Do nothing but arrange the RGB format. +static void FastFloatRGBIdentity(cmsContext ContextID, + struct _cmstransform_struct *CMMcargo, + const cmsFloat32Number* Input, + cmsFloat32Number* Output, + cmsUInt32Number len, + cmsUInt32Number Stride) +{ + cmsUInt32Number ii; + cmsUInt32Number SourceStartingOrder[cmsMAXCHANNELS]; + cmsUInt32Number SourceIncrements[cmsMAXCHANNELS]; + cmsUInt32Number DestStartingOrder[cmsMAXCHANNELS]; + cmsUInt32Number DestIncrements[cmsMAXCHANNELS]; + const cmsUInt8Number* rin; + const cmsUInt8Number* gin; + const cmsUInt8Number* bin; + cmsUInt8Number* rout; + cmsUInt8Number* gout; + cmsUInt8Number* bout; + + + cmsUInt32Number InputFormat = cmsGetTransformInputFormat(ContextID, (cmsHTRANSFORM) CMMcargo); + cmsUInt32Number OutputFormat = cmsGetTransformOutputFormat(ContextID, (cmsHTRANSFORM) CMMcargo); + + + cmsUInt32Number nchans, nalpha; + + _cmsComputeComponentIncrements(InputFormat, Stride, &nchans, &nalpha, SourceStartingOrder, SourceIncrements); + _cmsComputeComponentIncrements(OutputFormat, Stride, &nchans, &nalpha, DestStartingOrder, DestIncrements); + + // SeparateRGB(InputFormat, Stride, SourceStartingOrder, SourceIncrements); + // SeparateRGB(OutputFormat, Stride, DestStartingOrder, DestIncrements); + + rin = (const cmsUInt8Number*)Input + SourceStartingOrder[0]; + gin = (const cmsUInt8Number*)Input + SourceStartingOrder[1]; + bin = (const cmsUInt8Number*)Input + SourceStartingOrder[2]; + + rout = (cmsUInt8Number*)Output + DestStartingOrder[0]; + gout = (cmsUInt8Number*)Output + DestStartingOrder[1]; + bout = (cmsUInt8Number*)Output + DestStartingOrder[2]; + + for (ii=0; ii < len; ii++) { + + memmove(rout, rin, 4); + memmove(gout, gin, 4); + memmove(bout, bin, 4); + + rin += SourceIncrements[0]; + gin += SourceIncrements[1]; + bin += SourceIncrements[2]; + + rout += DestIncrements[0]; + gout += DestIncrements[1]; + bout += DestIncrements[2]; + } +} + +// Evaluate 1 channel only +static void FastEvaluateFloatGrayCurves(cmsContext ContextID, + struct _cmstransform_struct *CMMcargo, + const cmsFloat32Number* Input, + cmsFloat32Number* Output, + cmsUInt32Number len, + cmsUInt32Number Stride) +{ + cmsUInt32Number ii; + cmsUInt32Number SourceStartingOrder[cmsMAXCHANNELS]; + cmsUInt32Number SourceIncrements[cmsMAXCHANNELS]; + cmsUInt32Number DestStartingOrder[cmsMAXCHANNELS]; + cmsUInt32Number DestIncrements[cmsMAXCHANNELS]; + const cmsUInt8Number* kin; + cmsUInt8Number* kout; + + cmsUInt32Number InputFormat = cmsGetTransformInputFormat(ContextID, (cmsHTRANSFORM) CMMcargo); + cmsUInt32Number OutputFormat = cmsGetTransformOutputFormat(ContextID, (cmsHTRANSFORM) CMMcargo); + + CurvesFloatData* Data = (CurvesFloatData*) _cmsGetTransformUserData(CMMcargo); + + cmsUInt32Number nchans, nalpha; + + _cmsComputeComponentIncrements(InputFormat, Stride, &nchans, &nalpha, SourceStartingOrder, SourceIncrements); + _cmsComputeComponentIncrements(OutputFormat, Stride, &nchans, &nalpha, DestStartingOrder, DestIncrements); + + // SeparateGray(InputFormat, Stride, &SourceStartingOrder, &SourceIncrement); + // SeparateGray(OutputFormat, Stride, &DestStartingOrder, &DestIncrement); + + kin = (const cmsUInt8Number*)Input + SourceStartingOrder[0]; + kout = (cmsUInt8Number*)Output + DestStartingOrder[0]; + + for (ii = 0; ii < len; ii++) { + + *(cmsFloat32Number*)kout = flerp(Data->CurveR, *(cmsFloat32Number*)kin); + + kin += SourceIncrements[0]; + kout += DestIncrements[0]; + } +} + + +static void FastFloatGrayIdentity(cmsContext ContextID, + struct _cmstransform_struct *CMMcargo, + const cmsFloat32Number* Input, + cmsFloat32Number* Output, + cmsUInt32Number len, + cmsUInt32Number Stride) +{ + cmsUInt32Number ii; + cmsUInt32Number SourceStartingOrder[cmsMAXCHANNELS]; + cmsUInt32Number SourceIncrements[cmsMAXCHANNELS]; + cmsUInt32Number DestStartingOrder[cmsMAXCHANNELS]; + cmsUInt32Number DestIncrements[cmsMAXCHANNELS]; + const cmsUInt8Number* kin; + cmsUInt8Number* kout; + + cmsUInt32Number InputFormat = cmsGetTransformInputFormat(ContextID, (cmsHTRANSFORM) CMMcargo); + cmsUInt32Number OutputFormat = cmsGetTransformOutputFormat(ContextID, (cmsHTRANSFORM) CMMcargo); + + cmsUInt32Number nchans, nalpha; + + _cmsComputeComponentIncrements(InputFormat, Stride, &nchans, &nalpha, SourceStartingOrder, SourceIncrements); + _cmsComputeComponentIncrements(OutputFormat, Stride, &nchans, &nalpha, DestStartingOrder, DestIncrements); + + // SeparateGray(InputFormat, Stride, &SourceStartingOrder, &SourceIncrement); + // SeparateGray(OutputFormat, Stride, &DestStartingOrder, &DestIncrement); + + kin = (const cmsUInt8Number*) Input + SourceStartingOrder[0]; + kout = (cmsUInt8Number*)Output + DestStartingOrder[0]; + + for (ii=0; ii < len; ii++) { + + memmove(kout, kin, 4); + + kin += SourceIncrements[0]; + kout += DestIncrements[0]; + } +} + + +#define LINEAR_CURVES_EPSILON 0.00001 + +// Try to see if the curves are linear +static +cmsBool AllRGBCurvesAreLinear(CurvesFloatData* data) +{ + int j; + cmsFloat32Number expected; + + for (j = 0; j < MAX_NODES_IN_CURVE; j++) { + + expected = (cmsFloat32Number)j / (cmsFloat32Number)(MAX_NODES_IN_CURVE - 1); + + if (fabsf(data->CurveR[j] - expected) > LINEAR_CURVES_EPSILON || + fabsf(data->CurveG[j] - expected) > LINEAR_CURVES_EPSILON || + fabsf(data->CurveB[j] - expected) > LINEAR_CURVES_EPSILON) { + return FALSE; + } + } + + return TRUE; +} + +static +cmsBool KCurveIsLinear(CurvesFloatData* data) +{ + int j; + cmsFloat32Number expected; + + for (j = 0; j < MAX_NODES_IN_CURVE; j++) { + expected = (cmsFloat32Number)j / (cmsFloat32Number)(MAX_NODES_IN_CURVE - 1); + + if (fabs(data->CurveR[j] - expected) > LINEAR_CURVES_EPSILON) return FALSE; + } + + + return TRUE; +} + + +// Create linearization tables with a reasonable number of entries. Precission is about 32 bits. +static +CurvesFloatData* ComputeCompositeCurves(cmsContext ContextID, cmsUInt32Number nChan, cmsPipeline* Src) +{ + cmsUInt32Number i, j; + cmsFloat32Number InFloat[3], OutFloat[3]; + + CurvesFloatData* Data = malloc_aligned(ContextID); + if (Data == NULL) return NULL; + + // Create target curves + for (i = 0; i < MAX_NODES_IN_CURVE; i++) { + + for (j=0; j <nChan; j++) + InFloat[j] = (cmsFloat32Number)i / (cmsFloat32Number)(MAX_NODES_IN_CURVE-1); + + cmsPipelineEvalFloat(ContextID, InFloat, OutFloat, Src); + + if (nChan == 1) { + + Data->CurveR[i] = OutFloat[0]; + } + else { + Data->CurveR[i] = OutFloat[0]; + Data->CurveG[i] = OutFloat[1]; + Data->CurveB[i] = OutFloat[2]; + } + + } + + return Data; +} + + +// If the target LUT holds only curves, the optimization procedure is to join all those +// curves together. That only works on curves and does not work on matrices. +cmsBool OptimizeFloatByJoiningCurves(cmsContext ContextID, + _cmsTransformFn* TransformFn, + void** UserData, + _cmsFreeUserDataFn* FreeUserData, + cmsPipeline** Lut, + cmsUInt32Number* InputFormat, + cmsUInt32Number* OutputFormat, + cmsUInt32Number* dwFlags) +{ + + cmsPipeline* Src = *Lut; + cmsStage* mpe; + CurvesFloatData* Data; + cmsUInt32Number nChans; + + // Apply only to floating-point cases + if (!T_FLOAT(*InputFormat) || !T_FLOAT(*OutputFormat)) return FALSE; + + // Only on 8-bit + if (T_BYTES(*InputFormat) != 4 || T_BYTES(*OutputFormat) != 4) return FALSE; + + // Curves need same channels on input and output (despite extra channels may differ) + nChans = T_CHANNELS(*InputFormat); + if (nChans != T_CHANNELS(*OutputFormat)) return FALSE; + + // gray and RGB + if (nChans != 1 && nChans != 3) return FALSE; + + // Only curves in this LUT? + for (mpe = cmsPipelineGetPtrToFirstStage(ContextID, Src); + mpe != NULL; + mpe = cmsStageNext(ContextID, mpe)) { + + if (cmsStageType(ContextID, mpe) != cmsSigCurveSetElemType) return FALSE; + } + + Data = ComputeCompositeCurves(ContextID, nChans, Src); + + *dwFlags |= cmsFLAGS_NOCACHE; + *dwFlags &= ~cmsFLAGS_CAN_CHANGE_FORMATTER; + *UserData = Data; + *FreeUserData = free_aligned; + + // Maybe the curves are linear at the end + if (nChans == 1) + *TransformFn = (_cmsTransformFn) (KCurveIsLinear(Data) ? FastFloatGrayIdentity : FastEvaluateFloatGrayCurves); + else + *TransformFn = (_cmsTransformFn) (AllRGBCurvesAreLinear(Data) ? FastFloatRGBIdentity : FastEvaluateFloatRGBCurves); + + return TRUE; + +} + diff --git a/lcms2mt/plugins/fast_float/src/fast_float_internal.h b/lcms2mt/plugins/fast_float/src/fast_float_internal.h new file mode 100644 index 00000000..0f153cb8 --- /dev/null +++ b/lcms2mt/plugins/fast_float/src/fast_float_internal.h @@ -0,0 +1,249 @@ +//--------------------------------------------------------------------------------- +// +// Little Color Management System, fast floating point extensions +// Copyright (c) 1998-2020 Marti Maria Saguer, all rights reserved +// +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +//--------------------------------------------------------------------------------- + +#ifndef _FAST_INTERNAL_H +#define _FAST_INTERNAL_H + +#include "lcms2mt_fast_float.h" +#include <stdint.h> + +#define REQUIRED_LCMS_VERSION (2100-2000) + +// Unused parameter warning supression +#define UNUSED_PARAMETER(x) ((void)x) + +// The specification for "inline" is section 6.7.4 of the C99 standard (ISO/IEC 9899:1999). +// unfortunately VisualC++ does not conform that +#if defined(_MSC_VER) || defined(__BORLANDC__) +# define cmsINLINE __inline +#else +# define cmsINLINE static inline +#endif + +// A fast way to convert from/to 16 <-> 8 bits +#define FROM_8_TO_16(rgb) (cmsUInt16Number) ((((cmsUInt16Number) (rgb)) << 8)|(rgb)) +#define FROM_16_TO_8(rgb) (cmsUInt8Number) ((((rgb) * 65281 + 8388608) >> 24) & 0xFF) + + +// This macro return words stored as big endian +#define CHANGE_ENDIAN(w) (cmsUInt16Number) ((cmsUInt16Number) ((w)<<8)|((w)>>8)) + +// This macro changes the polarity of a word +#define REVERSE_FLAVOR_16(x) ((cmsUInt16Number)(0xffff-(x))) + +// Fixed point +#define FIXED_TO_INT(x) ((x)>>16) +#define FIXED_REST_TO_INT(x) ((x)&0xFFFFU) + +#define cmsFLAGS_CAN_CHANGE_FORMATTER 0x02000000 // Allow change buffer format + +// Utility macros to convert from to 0...1.0 in 15.16 fixed domain to 0..0xffff as integer +cmsINLINE cmsS15Fixed16Number _cmsToFixedDomain(int a) { return a + ((a + 0x7fff) / 0xffff); } +cmsINLINE int _cmsFromFixedDomain(cmsS15Fixed16Number a) { return a - ((a + 0x7fff) >> 16); } + +// This is the upper part of internal transform structure. Only format specifiers are used +typedef struct { + + cmsUInt32Number InputFormat, OutputFormat; // Keep formats for further reference + +} _xform_head; + + +#define MAX_NODES_IN_CURVE 0x8001 + + +// To prevent out of bounds indexing +cmsINLINE cmsFloat32Number fclamp(cmsFloat32Number v) +{ + return v < 0.0f ? 0.0f : (v > 1.0f ? 1.0f : v); +} + +// Fast floor conversion logic. +cmsINLINE int _cmsQuickFloor(cmsFloat64Number val) +{ +#ifdef CMS_DONT_USE_FAST_FLOOR + return (int)floor(val); +#else +#define _lcms_double2fixmagic (68719476736.0 * 1.5) + + union { + cmsFloat64Number val; + int halves[2]; + } temp; + + temp.val = val + _lcms_double2fixmagic; + +#ifdef CMS_USE_BIG_ENDIAN + return temp.halves[1] >> 16; +#else + return temp.halves[0] >> 16; +#endif +#endif +} + +// Floor to word, taking care of saturation. This is not critical in terms of performance +cmsINLINE cmsUInt16Number _cmsSaturateWord(cmsFloat64Number d) +{ + d += 0.5; + + if (d <= 0) return 0; + if (d >= 65535.0) return 0xffff; + + return (cmsUInt16Number)floor(d); +} + + +cmsINLINE cmsFloat32Number flerp(const cmsFloat32Number LutTable[], cmsFloat32Number v) +{ + cmsFloat32Number y1, y0; + cmsFloat32Number rest; + int cell0, cell1; + + if (v <= 0.0) { + return LutTable[0]; + } + else + if (v >= 1.0) { + return LutTable[MAX_NODES_IN_CURVE - 1]; + } + + v *= (MAX_NODES_IN_CURVE - 1); + + cell0 = _cmsQuickFloor(v); + cell1 = (int)ceilf(v); + + // Rest is 16 LSB bits + rest = v - cell0; + + y0 = LutTable[cell0]; + y1 = LutTable[cell1]; + + return y0 + (y1 - y0) * rest; +} + + + + +// Some secret sauce from lcms +int _cmsReasonableGridpointsByColorspace(cmsColorSpaceSignature Colorspace, cmsUInt32Number dwFlags); + + + +// Compute the increments to be used by the transform functions +void _cmsComputeComponentIncrements(cmsUInt32Number Format, + cmsUInt32Number BytesPerPlane, + cmsUInt32Number* nChannels, + cmsUInt32Number* nAlpha, + cmsUInt32Number ComponentStartingOrder[], + cmsUInt32Number ComponentPointerIncrements[]); + +// 15 bits formatters +cmsFormatter Formatter_15Bit_Factory(cmsContext ContextID, + cmsUInt32Number Type, + cmsFormatterDirection Dir, + cmsUInt32Number dwFlags); + +// Optimizers + +// 8 bits on input allows matrix-shaper boost up a little bit +cmsBool Optimize8MatrixShaper(cmsContext ContextID, + _cmsTransformFn* TransformFn, + void** UserData, + _cmsFreeUserDataFn* FreeUserData, + cmsPipeline** Lut, + cmsUInt32Number* InputFormat, + cmsUInt32Number* OutputFormat, + cmsUInt32Number* dwFlags); + +cmsBool OptimizeMatrixShaper15(cmsContext ContextID, + _cmsTransformFn* TransformFn, + void** UserData, + _cmsFreeUserDataFn* FreeUserData, + cmsPipeline** Lut, + cmsUInt32Number* InputFormat, + cmsUInt32Number* OutputFormat, + cmsUInt32Number* dwFlags); + + +cmsBool Optimize8ByJoiningCurves(cmsContext ContextID, + _cmsTransformFn* TransformFn, + void** UserData, + _cmsFreeUserDataFn* FreeUserData, + cmsPipeline** Lut, + cmsUInt32Number* InputFormat, + cmsUInt32Number* OutputFormat, + cmsUInt32Number* dwFlags); + +cmsBool OptimizeFloatByJoiningCurves(cmsContext ContextID, + _cmsTransformFn* TransformFn, + void** UserData, + _cmsFreeUserDataFn* FreeUserData, + cmsPipeline** Lut, + cmsUInt32Number* InputFormat, + cmsUInt32Number* OutputFormat, + cmsUInt32Number* dwFlags); + +cmsBool OptimizeFloatMatrixShaper(cmsContext ContextID, + _cmsTransformFn* TransformFn, + void** UserData, + _cmsFreeUserDataFn* FreeUserData, + cmsPipeline** Lut, + cmsUInt32Number* InputFormat, + cmsUInt32Number* OutputFormat, + cmsUInt32Number* dwFlags); + +cmsBool Optimize8BitRGBTransform(cmsContext ContextID, + _cmsTransformFn* TransformFn, + void** UserData, + _cmsFreeUserDataFn* FreeDataFn, + cmsPipeline** Lut, + cmsUInt32Number* InputFormat, + cmsUInt32Number* OutputFormat, + cmsUInt32Number* dwFlags); + +cmsBool Optimize16BitRGBTransform(cmsContext ContextID, + _cmsTransformFn* TransformFn, + void** UserData, + _cmsFreeUserDataFn* FreeDataFn, + cmsPipeline** Lut, + cmsUInt32Number* InputFormat, + cmsUInt32Number* OutputFormat, + cmsUInt32Number* dwFlags); + +cmsBool OptimizeCLUTRGBTransform(cmsContext ContextID, + _cmsTransformFn* TransformFn, + void** UserData, + _cmsFreeUserDataFn* FreeDataFn, + cmsPipeline** Lut, + cmsUInt32Number* InputFormat, + cmsUInt32Number* OutputFormat, + cmsUInt32Number* dwFlags); + +cmsBool OptimizeCLUTCMYKTransform(cmsContext ContextID, + _cmsTransformFn* TransformFn, + void** UserData, + _cmsFreeUserDataFn* FreeDataFn, + cmsPipeline** Lut, + cmsUInt32Number* InputFormat, + cmsUInt32Number* OutputFormat, + cmsUInt32Number* dwFlags); + +#endif diff --git a/lcms2mt/plugins/fast_float/src/fast_float_matsh.c b/lcms2mt/plugins/fast_float/src/fast_float_matsh.c new file mode 100644 index 00000000..07396e59 --- /dev/null +++ b/lcms2mt/plugins/fast_float/src/fast_float_matsh.c @@ -0,0 +1,323 @@ +//--------------------------------------------------------------------------------- +// +// Little Color Management System, fast floating point extensions +// Copyright (c) 1998-2020 Marti Maria Saguer, all rights reserved +// +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +//--------------------------------------------------------------------------------- + +// Optimization for matrix-shaper in float + +#include "fast_float_internal.h" + + +// This is the private data container used by this optimization +typedef struct { + + + cmsFloat32Number Mat[3][3]; + cmsFloat32Number Off[3]; + + cmsFloat32Number Shaper1R[MAX_NODES_IN_CURVE]; + cmsFloat32Number Shaper1G[MAX_NODES_IN_CURVE]; + cmsFloat32Number Shaper1B[MAX_NODES_IN_CURVE]; + + cmsFloat32Number Shaper2R[MAX_NODES_IN_CURVE]; + cmsFloat32Number Shaper2G[MAX_NODES_IN_CURVE]; + cmsFloat32Number Shaper2B[MAX_NODES_IN_CURVE]; + + cmsBool UseOff; + + void * real_ptr; + +} VXMatShaperFloatData; + + +static +VXMatShaperFloatData* malloc_aligned(cmsContext ContextID) +{ + cmsUInt8Number* real_ptr = (cmsUInt8Number*) _cmsMallocZero(ContextID, sizeof(VXMatShaperFloatData) + 32); + cmsUInt8Number* aligned = (cmsUInt8Number*) (((uintptr_t)real_ptr + 16) & ~0xf); + VXMatShaperFloatData* p = (VXMatShaperFloatData*) aligned; + + p ->real_ptr = real_ptr; + return p; +} + + + +// Free the private data container +static +void FreeMatShaper(cmsContext ContextID, void* Data) +{ + VXMatShaperFloatData* d = (VXMatShaperFloatData*)Data; + + if (d != NULL) + _cmsFree(ContextID, d->real_ptr); +} + + +static +void FillShaper(cmsContext ContextID, cmsFloat32Number* Table, cmsToneCurve* Curve) +{ + int i; + cmsFloat32Number R; + + for (i = 0; i < MAX_NODES_IN_CURVE; i++) { + + R = (cmsFloat32Number) i / (cmsFloat32Number) (MAX_NODES_IN_CURVE - 1); + + Table[i] = cmsEvalToneCurveFloat(ContextID, Curve, R); + } +} + + +// Compute the matrix-shaper structure +static +VXMatShaperFloatData* SetMatShaper(cmsContext ContextID, cmsToneCurve* Curve1[3], cmsMAT3* Mat, cmsVEC3* Off, cmsToneCurve* Curve2[3]) +{ + VXMatShaperFloatData* p; + int i, j; + + // Allocate a big chuck of memory to store precomputed tables + p = malloc_aligned(ContextID); + if (p == NULL) return FALSE; + + + // Precompute tables + FillShaper(ContextID, p->Shaper1R, Curve1[0]); + FillShaper(ContextID, p->Shaper1G, Curve1[1]); + FillShaper(ContextID, p->Shaper1B, Curve1[2]); + + FillShaper(ContextID, p->Shaper2R, Curve2[0]); + FillShaper(ContextID, p->Shaper2G, Curve2[1]); + FillShaper(ContextID, p->Shaper2B, Curve2[2]); + + + for (i=0; i < 3; i++) { + for (j=0; j < 3; j++) { + p->Mat[i][j] = (cmsFloat32Number) Mat->v[i].n[j]; + } + } + + + for (i = 0; i < 3; i++) { + + if (Off == NULL) { + + p->UseOff = FALSE; + p->Off[i] = 0.0; + } + else { + p->UseOff = TRUE; + p->Off[i] = (cmsFloat32Number)Off->n[i]; + + } + } + + + return p; +} + + + +// A fast matrix-shaper evaluator for floating point +static +void MatShaperFloat(cmsContext ContextID, struct _cmstransform_struct *CMMcargo, + const cmsFloat32Number* Input, + cmsFloat32Number* Output, + cmsUInt32Number len, + cmsUInt32Number Stride) +{ + VXMatShaperFloatData* p = (VXMatShaperFloatData*) _cmsGetTransformUserData(CMMcargo); + cmsFloat32Number l1, l2, l3; + cmsFloat32Number r, g, b; + cmsUInt32Number ii; + cmsUInt32Number SourceStartingOrder[cmsMAXCHANNELS]; + cmsUInt32Number SourceIncrements[cmsMAXCHANNELS]; + cmsUInt32Number DestStartingOrder[cmsMAXCHANNELS]; + cmsUInt32Number DestIncrements[cmsMAXCHANNELS]; + + const cmsUInt8Number* rin; + const cmsUInt8Number* gin; + const cmsUInt8Number* bin; + + cmsUInt8Number* rout; + cmsUInt8Number* gout; + cmsUInt8Number* bout; + + cmsUInt32Number nchans, nalpha; + + _cmsComputeComponentIncrements(cmsGetTransformInputFormat(ContextID, (cmsHTRANSFORM)CMMcargo), Stride, &nchans, &nalpha, SourceStartingOrder, SourceIncrements); + _cmsComputeComponentIncrements(cmsGetTransformOutputFormat(ContextID, (cmsHTRANSFORM)CMMcargo), Stride, &nchans, &nalpha, DestStartingOrder, DestIncrements); + + rin = (const cmsUInt8Number*)Input + SourceStartingOrder[0]; + gin = (const cmsUInt8Number*)Input + SourceStartingOrder[1]; + bin = (const cmsUInt8Number*)Input + SourceStartingOrder[2]; + + rout = (cmsUInt8Number*)Output + DestStartingOrder[0]; + gout = (cmsUInt8Number*)Output + DestStartingOrder[1]; + bout = (cmsUInt8Number*)Output + DestStartingOrder[2]; + + for (ii=0; ii < len; ii++) { + + r = flerp(p->Shaper1R, *(cmsFloat32Number*)rin); + g = flerp(p->Shaper1G, *(cmsFloat32Number*)gin); + b = flerp(p->Shaper1B, *(cmsFloat32Number*)bin); + + l1 = p->Mat[0][0] * r + p->Mat[0][1] * g + p->Mat[0][2] * b ; + l2 = p->Mat[1][0] * r + p->Mat[1][1] * g + p->Mat[1][2] * b ; + l3 = p->Mat[2][0] * r + p->Mat[2][1] * g + p->Mat[2][2] * b ; + + if (p->UseOff) { + + l1 += p->Off[0]; + l2 += p->Off[1]; + l3 += p->Off[2]; + } + + *(cmsFloat32Number*)rout = flerp(p->Shaper2R, l1); + *(cmsFloat32Number*)gout = flerp(p->Shaper2G, l2); + *(cmsFloat32Number*)bout = flerp(p->Shaper2B, l3); + + rin += SourceIncrements[0]; + gin += SourceIncrements[1]; + bin += SourceIncrements[2]; + + rout += DestIncrements[0]; + gout += DestIncrements[1]; + bout += DestIncrements[2]; + } + +} + + + +cmsBool OptimizeFloatMatrixShaper(cmsContext ContextID, + _cmsTransformFn* TransformFn, + void** UserData, + _cmsFreeUserDataFn* FreeUserData, + cmsPipeline** Lut, + cmsUInt32Number* InputFormat, + cmsUInt32Number* OutputFormat, + cmsUInt32Number* dwFlags) +{ + cmsStage* Curve1, *Curve2; + cmsStage* Matrix1, *Matrix2; + _cmsStageMatrixData* Data1; + _cmsStageMatrixData* Data2; + cmsMAT3 res; + cmsBool IdentityMat = FALSE; + cmsPipeline* Dest, *Src; + cmsUInt32Number nChans; + cmsFloat64Number factor = 1.0; + + + // Apply only to floating-point cases + if (!T_FLOAT(*InputFormat) || !T_FLOAT(*OutputFormat)) return FALSE; + + // Only works on RGB to RGB and gray to gray + if ( !( (T_CHANNELS(*InputFormat) == 3 && T_CHANNELS(*OutputFormat) == 3)) && + !( (T_CHANNELS(*InputFormat) == 1 && T_CHANNELS(*OutputFormat) == 1))) return FALSE; + + // Only works on float + if (T_BYTES(*InputFormat) != 4 || T_BYTES(*OutputFormat) != 4) return FALSE; + + // Seems suitable, proceed + Src = *Lut; + + // Check for shaper-matrix-matrix-shaper structure, that is what this optimizer stands for + if (!cmsPipelineCheckAndRetreiveStages(ContextID, Src, 4, + cmsSigCurveSetElemType, cmsSigMatrixElemType, cmsSigMatrixElemType, cmsSigCurveSetElemType, + &Curve1, &Matrix1, &Matrix2, &Curve2)) return FALSE; + + nChans = T_CHANNELS(*InputFormat); + + // Get both matrices, which are 3x3 + Data1 = (_cmsStageMatrixData*) cmsStageData(ContextID, Matrix1); + Data2 = (_cmsStageMatrixData*) cmsStageData(ContextID, Matrix2); + + // Input offset should be zero + if (Data1 ->Offset != NULL) return FALSE; + + if (cmsStageInputChannels(ContextID, Matrix1) == 1 && cmsStageOutputChannels(ContextID, Matrix2) == 1) + { + // This is a gray to gray. Just multiply + factor = Data1->Double[0]*Data2->Double[0] + + Data1->Double[1]*Data2->Double[1] + + Data1->Double[2]*Data2->Double[2]; + + if (fabs(1 - factor) < (1.0 / 65535.0)) IdentityMat = TRUE; + } + else + { + // Multiply both matrices to get the result + _cmsMAT3per(ContextID, &res, (cmsMAT3*) Data2 ->Double, (cmsMAT3*) Data1 ->Double); + + // Now the result is in res + Data2 -> Offset. Maybe is a plain identity? + IdentityMat = FALSE; + if (_cmsMAT3isIdentity(ContextID, &res) && Data2 ->Offset == NULL) { + + // We can get rid of full matrix + IdentityMat = TRUE; + } + } + + // Allocate an empty LUT + Dest = cmsPipelineAlloc(ContextID, nChans, nChans); + if (!Dest) return FALSE; + + // Assamble the new LUT + cmsPipelineInsertStage(ContextID, Dest, cmsAT_BEGIN, cmsStageDup(ContextID, Curve1)); + + if (!IdentityMat) { + + if (nChans == 1) + cmsPipelineInsertStage(ContextID, Dest, cmsAT_END, + cmsStageAllocMatrix(ContextID, 1, 1, (const cmsFloat64Number*) &factor, Data2->Offset)); + else + cmsPipelineInsertStage(ContextID, Dest, cmsAT_END, + cmsStageAllocMatrix(ContextID, 3, 3, (const cmsFloat64Number*) &res, Data2 ->Offset)); + } + + + cmsPipelineInsertStage(ContextID, Dest, cmsAT_END, cmsStageDup(ContextID, Curve2)); + + // If identity on matrix, we can further optimize the curves, so call the join curves routine + if (IdentityMat) { + + OptimizeFloatByJoiningCurves(ContextID, TransformFn, UserData, FreeUserData, &Dest, InputFormat, OutputFormat, dwFlags); + } + else { + _cmsStageToneCurvesData* mpeC1 = (_cmsStageToneCurvesData*) cmsStageData(ContextID, Curve1); + _cmsStageToneCurvesData* mpeC2 = (_cmsStageToneCurvesData*) cmsStageData(ContextID, Curve2); + + // In this particular optimization, caché does not help as it takes more time to deal with + // the cachthat with the pixel handling + *dwFlags |= cmsFLAGS_NOCACHE; + + // Setup the optimizarion routines + *UserData = SetMatShaper(ContextID, mpeC1 ->TheCurves, &res, (cmsVEC3*) Data2 ->Offset, mpeC2->TheCurves); + *FreeUserData = FreeMatShaper; + + *TransformFn = (_cmsTransformFn) MatShaperFloat; + } + + *dwFlags &= ~cmsFLAGS_CAN_CHANGE_FORMATTER; + cmsPipelineFree(ContextID, Src); + *Lut = Dest; + return TRUE; +} diff --git a/lcms2mt/plugins/fast_float/src/fast_float_separate.c b/lcms2mt/plugins/fast_float/src/fast_float_separate.c new file mode 100644 index 00000000..c4186a92 --- /dev/null +++ b/lcms2mt/plugins/fast_float/src/fast_float_separate.c @@ -0,0 +1,199 @@ +//--------------------------------------------------------------------------------- +// +// Little Color Management System, fast floating point extensions +// Copyright (c) 1998-2020 Marti Maria Saguer, all rights reserved +// +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +//--------------------------------------------------------------------------------- + +#include "fast_float_internal.h" + +// Separable input. It just computes the distance from +// each component to the next one in bytes. It gives components RGB in this order +// +// Encoding Starting Increment DoSwap Swapfirst Extra +// RGB, 012 333 0 0 0 +// RGBA, 012 444 0 0 1 +// ARGB, 123 444 0 1 1 +// BGR, 210 333 1 0 0 +// BGRA, 210 444 1 1 1 +// ABGR 321 444 1 0 1 +// +// +// On planar configurations, the distance is the stride added to any non-negative +// +// RGB 0, S, 2*S 111 +// RGBA 0, S, 2*S 111 (fourth plane is safely ignored) +// ARGB S, 2*S, 3*S 111 +// BGR 2*S, S, 0 111 +// BGRA 2*S, S, 0, 111 (fourth plane is safely ignored) +// ABGR 3*S, 2*S, S 111 +// +//---------------------------------------------------------------------------------------- + + +// Return the size in bytes of a given formatter +static +int trueBytesSize(cmsUInt32Number Format) +{ + int fmt_bytes = T_BYTES(Format); + + // For double, the T_BYTES field returns zero + if (fmt_bytes == 0) + return sizeof(double); + + // Otherwise, it is already correct for all formats + return fmt_bytes; +} + +// RGBA -> normal +// ARGB -> swap first +// ABGR -> doSwap +// BGRA -> doSwap swapFirst + +// This function computes the distance from each component to the next one in bytes. +static +void ComputeIncrementsForChunky(cmsUInt32Number Format, + cmsUInt32Number BytesPerPlane, + cmsUInt32Number* nChannels, + cmsUInt32Number* nAlpha, + cmsUInt32Number ComponentStartingOrder[], + cmsUInt32Number ComponentPointerIncrements[]) +{ + int extra = T_EXTRA(Format); + int channels = T_CHANNELS(Format); + int total_chans = channels + extra; + int i; + int channelSize = trueBytesSize(Format); + int pixelSize = channelSize * total_chans; + + UNUSED_PARAMETER(BytesPerPlane); + + // Setup the counts + if (nChannels != NULL) + *nChannels = channels; + + if (nAlpha != NULL) + *nAlpha = extra; + + // Separation is independent of starting point and only depends on channel size + for (i = 0; i < total_chans; i++) + ComponentPointerIncrements[i] = pixelSize; + + // Handle do swap + for (i = 0; i < total_chans; i++) + { + if (T_DOSWAP(Format)) { + ComponentStartingOrder[i] = total_chans - i - 1; + } + else { + ComponentStartingOrder[i] = i; + } + } + + // Handle swap first (ROL of positions), example CMYK -> KCMY | 0123 -> 3012 + if (T_SWAPFIRST(Format)) { + + cmsUInt32Number tmp = ComponentStartingOrder[0]; + for (i = 0; i < total_chans-1; i++) + ComponentStartingOrder[i] = ComponentStartingOrder[i + 1]; + + ComponentStartingOrder[total_chans - 1] = tmp; + } + + // Handle size + if (channelSize > 1) + for (i = 0; i < total_chans; i++) { + ComponentStartingOrder[i] *= channelSize; + } +} + + + +// On planar configurations, the distance is the stride added to any non-negative +static +void ComputeIncrementsForPlanar(cmsUInt32Number Format, + cmsUInt32Number BytesPerPlane, + cmsUInt32Number* nChannels, + cmsUInt32Number* nAlpha, + cmsUInt32Number ComponentStartingOrder[], + cmsUInt32Number ComponentPointerIncrements[]) +{ + int extra = T_EXTRA(Format); + int channels = T_CHANNELS(Format); + int total_chans = channels + extra; + int i; + int channelSize = trueBytesSize(Format); + + // Setup the counts + if (nChannels != NULL) + *nChannels = channels; + + if (nAlpha != NULL) + *nAlpha = extra; + + // Separation is independent of starting point and only depends on channel size + for (i = 0; i < total_chans; i++) + ComponentPointerIncrements[i] = channelSize; + + // Handle do swap + for (i = 0; i < total_chans; i++) + { + if (T_DOSWAP(Format)) { + ComponentStartingOrder[i] = total_chans - i - 1; + } + else { + ComponentStartingOrder[i] = i; + } + } + + // Handle swap first (ROL of positions), example CMYK -> KCMY | 0123 -> 3012 + if (T_SWAPFIRST(Format)) { + + cmsUInt32Number tmp = ComponentStartingOrder[0]; + for (i = 0; i < total_chans - 1; i++) + ComponentStartingOrder[i] = ComponentStartingOrder[i + 1]; + + ComponentStartingOrder[total_chans - 1] = tmp; + } + + // Handle size + for (i = 0; i < total_chans; i++) { + ComponentStartingOrder[i] *= BytesPerPlane; + } +} + + + +// Dispatcher por chunky and planar RGB +void _cmsComputeComponentIncrements(cmsUInt32Number Format, + cmsUInt32Number BytesPerPlane, + cmsUInt32Number* nChannels, + cmsUInt32Number* nAlpha, + cmsUInt32Number ComponentStartingOrder[], + cmsUInt32Number ComponentPointerIncrements[]) +{ + if (T_PLANAR(Format)) { + + ComputeIncrementsForPlanar(Format, BytesPerPlane, nChannels, nAlpha, ComponentStartingOrder, ComponentPointerIncrements); + } + else { + ComputeIncrementsForChunky(Format, BytesPerPlane, nChannels, nAlpha, ComponentStartingOrder, ComponentPointerIncrements); + } + +} + + diff --git a/lcms2mt/plugins/fast_float/src/fast_float_sup.c b/lcms2mt/plugins/fast_float/src/fast_float_sup.c new file mode 100644 index 00000000..9a375a4b --- /dev/null +++ b/lcms2mt/plugins/fast_float/src/fast_float_sup.c @@ -0,0 +1,90 @@ +//--------------------------------------------------------------------------------- +// +// Little Color Management System, fast floating point extensions +// Copyright (c) 1998-2020 Marti Maria Saguer, all rights reserved +// +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +//--------------------------------------------------------------------------------- + + +#include "fast_float_internal.h" + + +// This is the main dispatcher +static +cmsBool Floating_Point_Transforms_Dispatcher(cmsContext ContextID, + _cmsTransformFn* TransformFn, + void** UserData, + _cmsFreeUserDataFn* FreeUserData, + cmsPipeline** Lut, + cmsUInt32Number* InputFormat, + cmsUInt32Number* OutputFormat, + cmsUInt32Number* dwFlags) +{ + + // Try to optimize as a set of curves plus a matrix plus a set of curves + if (OptimizeMatrixShaper15(ContextID, TransformFn, UserData, FreeUserData, Lut, InputFormat, OutputFormat, dwFlags)) return TRUE; + + // Try to optimize by joining curves + if (Optimize8ByJoiningCurves(ContextID, TransformFn, UserData, FreeUserData, Lut, InputFormat, OutputFormat, dwFlags)) return TRUE; + + // Try to optimize as a set of curves plus a matrix plus a set of curves + if (Optimize8MatrixShaper(ContextID, TransformFn, UserData, FreeUserData, Lut, InputFormat, OutputFormat, dwFlags)) return TRUE; + + // Try to optimize by joining curves + if (OptimizeFloatByJoiningCurves(ContextID, TransformFn, UserData, FreeUserData, Lut, InputFormat, OutputFormat, dwFlags)) return TRUE; + + // Try to optimize as a set of curves plus a matrix plus a set of curves + if (OptimizeFloatMatrixShaper(ContextID, TransformFn, UserData, FreeUserData, Lut, InputFormat, OutputFormat, dwFlags)) return TRUE; + + // Try to optimize using prelinearization plus tetrahedral + if (Optimize8BitRGBTransform(ContextID, TransformFn, UserData, FreeUserData, Lut, InputFormat, OutputFormat, dwFlags)) return TRUE; + + // Try to optimize using prelinearization plus tetrahedral + if (Optimize16BitRGBTransform(ContextID, TransformFn, UserData, FreeUserData, Lut, InputFormat, OutputFormat, dwFlags)) return TRUE; + + // Try to optimize using prelinearization plus tetrahedral + if (OptimizeCLUTRGBTransform(ContextID, TransformFn, UserData, FreeUserData, Lut, InputFormat, OutputFormat, dwFlags)) return TRUE; + + // Try to optimize using prelinearization plus tetrahedral + if (OptimizeCLUTCMYKTransform(ContextID, TransformFn, UserData, FreeUserData, Lut, InputFormat, OutputFormat, dwFlags)) return TRUE; + + + // Cannot optimize, use lcms normal process + return FALSE; +} + +// The Plug-in entry points +static cmsPluginFormatters PluginFastFloat = { + { cmsPluginMagicNumber, REQUIRED_LCMS_VERSION, cmsPluginFormattersSig, NULL }, + + Formatter_15Bit_Factory +}; + +static cmsPluginTransform PluginList = { + + { cmsPluginMagicNumber, REQUIRED_LCMS_VERSION, cmsPluginTransformSig, (cmsPluginBase *) &PluginFastFloat }, + + Floating_Point_Transforms_Dispatcher +}; + +// This is the main plug-in installer. +// Using a function to retrieve the plug-in entry point allows us to execute initialization data. +void* cmsFastFloatExtensions(void) +{ + return (void*)&PluginList; +} + diff --git a/lcms2mt/plugins/fast_float/src/fast_float_tethra.c b/lcms2mt/plugins/fast_float/src/fast_float_tethra.c new file mode 100644 index 00000000..6bb688f7 --- /dev/null +++ b/lcms2mt/plugins/fast_float/src/fast_float_tethra.c @@ -0,0 +1,292 @@ +//--------------------------------------------------------------------------------- +// +// Little Color Management System, fast floating point extensions +// Copyright (c) 1998-2020 Marti Maria Saguer, all rights reserved +// +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +//--------------------------------------------------------------------------------- + +#include "fast_float_internal.h" + +// Optimization for floating point tetrahedral interpolation +typedef struct { + + const cmsInterpParams* p; // Tetrahedrical interpolation parameters. This is a not-owned pointer. + +} FloatCLUTData; + +// Precomputes tables for 8-bit on input devicelink. +static +FloatCLUTData* FloatCLUTAlloc(cmsContext ContextID, const cmsInterpParams* p) +{ + FloatCLUTData* fd; + + fd = (FloatCLUTData*) _cmsMallocZero(ContextID, sizeof(FloatCLUTData)); + if (fd == NULL) return NULL; + + fd ->p = p; + return fd; +} + + +// Sampler implemented by another LUT. This is a clean way to precalculate the devicelink 3D CLUT for +// almost any transform. We use floating point precision and then convert from floating point to 16 bits. +static +int XFormSampler(cmsContext ContextID, CMSREGISTER const cmsFloat32Number In[], CMSREGISTER cmsFloat32Number Out[], CMSREGISTER void* Cargo) +{ + // Evaluate in 16 bits + cmsPipelineEvalFloat(ContextID, In, Out, (cmsPipeline*) Cargo); + + // Always succeed + return TRUE; +} + + + +// A optimized interpolation for 8-bit input. +#define DENS(i,j,k) (LutTable[(i)+(j)+(k)+OutChan]) + +static +void FloatCLUTEval(cmsContext ContextID, + struct _cmstransform_struct *CMMcargo, + const cmsFloat32Number* Input, + cmsFloat32Number* Output, + cmsUInt32Number len, + cmsUInt32Number Stride) +{ + + cmsFloat32Number r, g, b; + cmsFloat32Number px, py, pz; + int x0, y0, z0; + int X0, Y0, Z0, X1, Y1, Z1; + cmsFloat32Number rx, ry, rz; + cmsFloat32Number c0, c1 = 0, c2 = 0, c3 = 0; + + cmsUInt32Number OutChan; + FloatCLUTData* p8 = (FloatCLUTData*) _cmsGetTransformUserData(CMMcargo); + + const cmsInterpParams* p = p8 ->p; + cmsUInt32Number TotalOut = p -> nOutputs; + const cmsFloat32Number* LutTable = (const cmsFloat32Number*)p->Table; + cmsUInt32Number ii; + const cmsUInt8Number* rin; + const cmsUInt8Number* gin; + const cmsUInt8Number* bin; + + cmsUInt8Number* out[cmsMAXCHANNELS]; + cmsUInt32Number SourceStartingOrder[cmsMAXCHANNELS]; + cmsUInt32Number SourceIncrements[cmsMAXCHANNELS]; + cmsUInt32Number DestStartingOrder[cmsMAXCHANNELS]; + cmsUInt32Number DestIncrements[cmsMAXCHANNELS]; + + cmsUInt32Number InputFormat = cmsGetTransformInputFormat(ContextID, (cmsHTRANSFORM) CMMcargo); + cmsUInt32Number OutputFormat = cmsGetTransformOutputFormat(ContextID, (cmsHTRANSFORM) CMMcargo); + + cmsUInt32Number nchans, nalpha; + + _cmsComputeComponentIncrements(InputFormat, Stride, &nchans, &nalpha, SourceStartingOrder, SourceIncrements); + _cmsComputeComponentIncrements(OutputFormat, Stride, &nchans, &nalpha, DestStartingOrder, DestIncrements); + + // SeparateRGB(InputFormat, Stride, SourceStartingOrder, SourceIncrements); + // SeparateRGB(OutputFormat, Stride, DestStartingOrder, DestIncrements); + + rin = (const cmsUInt8Number*)Input + SourceStartingOrder[0]; + gin = (const cmsUInt8Number*)Input + SourceStartingOrder[1]; + bin = (const cmsUInt8Number*)Input + SourceStartingOrder[2]; + + for (ii=0; ii < TotalOut; ii++) + out[ii] = (cmsUInt8Number*) Output + DestStartingOrder[ii]; + + for (ii=0; ii < len; ii++) { + + r = fclamp(*(cmsFloat32Number*)rin); + g = fclamp(*(cmsFloat32Number*)gin); + b = fclamp(*(cmsFloat32Number*)bin); + + rin += SourceIncrements[0]; + gin += SourceIncrements[1]; + bin += SourceIncrements[2]; + + px = r * p->Domain[0]; + py = g * p->Domain[1]; + pz = b * p->Domain[2]; + + + x0 = (int)_cmsQuickFloor(px); rx = (px - (cmsFloat32Number)x0); + y0 = (int)_cmsQuickFloor(py); ry = (py - (cmsFloat32Number)y0); + z0 = (int)_cmsQuickFloor(pz); rz = (pz - (cmsFloat32Number)z0); + + X0 = p->opta[2] * x0; + X1 = X0 + (r >= 1.0 ? 0 : p->opta[2]); + + Y0 = p->opta[1] * y0; + Y1 = Y0 + (g >= 1.0 ? 0 : p->opta[1]); + + Z0 = p->opta[0] * z0; + Z1 = Z0 + (b >= 1.0 ? 0 : p->opta[0]); + + for (OutChan = 0; OutChan < TotalOut; OutChan++) { + + // These are the 6 Tetrahedral + + c0 = DENS(X0, Y0, Z0); + + if (rx >= ry && ry >= rz) { + + c1 = DENS(X1, Y0, Z0) - c0; + c2 = DENS(X1, Y1, Z0) - DENS(X1, Y0, Z0); + c3 = DENS(X1, Y1, Z1) - DENS(X1, Y1, Z0); + + } + else + if (rx >= rz && rz >= ry) { + + c1 = DENS(X1, Y0, Z0) - c0; + c2 = DENS(X1, Y1, Z1) - DENS(X1, Y0, Z1); + c3 = DENS(X1, Y0, Z1) - DENS(X1, Y0, Z0); + + } + else + if (rz >= rx && rx >= ry) { + + c1 = DENS(X1, Y0, Z1) - DENS(X0, Y0, Z1); + c2 = DENS(X1, Y1, Z1) - DENS(X1, Y0, Z1); + c3 = DENS(X0, Y0, Z1) - c0; + + } + else + if (ry >= rx && rx >= rz) { + + c1 = DENS(X1, Y1, Z0) - DENS(X0, Y1, Z0); + c2 = DENS(X0, Y1, Z0) - c0; + c3 = DENS(X1, Y1, Z1) - DENS(X1, Y1, Z0); + + } + else + if (ry >= rz && rz >= rx) { + + c1 = DENS(X1, Y1, Z1) - DENS(X0, Y1, Z1); + c2 = DENS(X0, Y1, Z0) - c0; + c3 = DENS(X0, Y1, Z1) - DENS(X0, Y1, Z0); + + } + else + if (rz >= ry && ry >= rx) { + + c1 = DENS(X1, Y1, Z1) - DENS(X0, Y1, Z1); + c2 = DENS(X0, Y1, Z1) - DENS(X0, Y0, Z1); + c3 = DENS(X0, Y0, Z1) - c0; + + } + else { + c1 = c2 = c3 = 0; + } + + *(cmsFloat32Number*) (out[OutChan]) = c0 + c1 * rx + c2 * ry + c3 * rz; + + out[OutChan] += DestIncrements[OutChan]; + + } + + + } +} + +#undef DENS + + + +// -------------------------------------------------------------------------------------------------------------- + +cmsBool OptimizeCLUTRGBTransform(cmsContext ContextID, + _cmsTransformFn* TransformFn, + void** UserData, + _cmsFreeUserDataFn* FreeDataFn, + cmsPipeline** Lut, + cmsUInt32Number* InputFormat, + cmsUInt32Number* OutputFormat, + cmsUInt32Number* dwFlags) +{ + cmsPipeline* OriginalLut; + int nGridPoints; + cmsPipeline* OptimizedLUT = NULL; + cmsStage* OptimizedCLUTmpe; + cmsColorSpaceSignature OutputColorSpace; + cmsStage* mpe; + FloatCLUTData* p8; + _cmsStageCLutData* data; + + // For empty transforms, do nothing + if (*Lut == NULL) return FALSE; + + // This is a loosy optimization! does not apply in floating-point cases + if (!T_FLOAT(*InputFormat) || !T_FLOAT(*OutputFormat)) return FALSE; + + // Only on 8-bit + if (T_BYTES(*InputFormat) != 4 || T_BYTES(*OutputFormat) != 4) return FALSE; + + // Only on RGB + if (T_COLORSPACE(*InputFormat) != PT_RGB) return FALSE; + if (T_COLORSPACE(*OutputFormat) != PT_RGB) return FALSE; + + OriginalLut = *Lut; + + // Named color pipelines cannot be optimized either + for (mpe = cmsPipelineGetPtrToFirstStage(ContextID, OriginalLut); + mpe != NULL; + mpe = cmsStageNext(ContextID, mpe)) { + if (cmsStageType(ContextID, mpe) == cmsSigNamedColorElemType) return FALSE; + } + + OutputColorSpace = _cmsICCcolorSpace(ContextID, T_COLORSPACE(*OutputFormat)); + nGridPoints = _cmsReasonableGridpointsByColorspace(cmsSigRgbData, *dwFlags); + + // Create the result LUT + OptimizedLUT = cmsPipelineAlloc(ContextID, 3, cmsPipelineOutputChannels(ContextID, OriginalLut)); + if (OptimizedLUT == NULL) goto Error; + + + // Allocate the CLUT for result + OptimizedCLUTmpe = cmsStageAllocCLutFloat(ContextID, nGridPoints, 3, cmsPipelineOutputChannels(ContextID, OriginalLut), NULL); + + // Add the CLUT to the destination LUT + cmsPipelineInsertStage(ContextID, OptimizedLUT, cmsAT_BEGIN, OptimizedCLUTmpe); + + // Resample the LUT + if (!cmsStageSampleCLutFloat(ContextID, OptimizedCLUTmpe, XFormSampler, (void*)OriginalLut, 0)) goto Error; + + // Set the evaluator, copy parameters + data = (_cmsStageCLutData*) cmsStageData(ContextID, OptimizedCLUTmpe); + + p8 = FloatCLUTAlloc(ContextID, data ->Params); + if (p8 == NULL) return FALSE; + + // And return the obtained LUT + cmsPipelineFree(ContextID, OriginalLut); + + *Lut = OptimizedLUT; + *TransformFn = (_cmsTransformFn) FloatCLUTEval; + *UserData = p8; + *FreeDataFn = _cmsFree; + *dwFlags &= ~cmsFLAGS_CAN_CHANGE_FORMATTER; + return TRUE; + +Error: + + if (OptimizedLUT != NULL) cmsPipelineFree(ContextID, OptimizedLUT); + + return FALSE; +} diff --git a/lcms2mt/plugins/fast_float/testbed/Makefile.am b/lcms2mt/plugins/fast_float/testbed/Makefile.am new file mode 100644 index 00000000..9bd2412a --- /dev/null +++ b/lcms2mt/plugins/fast_float/testbed/Makefile.am @@ -0,0 +1,22 @@ +# +# Makefile for building fast_float_testbed +# + +# Don't require all the GNU mandated files +AUTOMAKE_OPTIONS = 1.7 foreign + +INCLUDES = -I$(builddir)/../include -I$(srcdir)/../include -I$(srcdir)/../src \ + -I$(top_builddir)/include + +check_PROGRAMS = fast_float_testbed + +fast_float_testbed_LDADD = $(top_builddir)/src/liblcms2mt.la $(srcdir)/../src/liblcms2mt_fast_float.la +fast_float_testbed_LDFLAGS = @LDFLAGS@ +fast_float_testbed_SOURCES = fast_float_testbed.c + +EXTRA_DIST = test0.icc test1.icc test2.icc test3.icc test5.icc + +check: + ./fast_float_testbed + + diff --git a/lcms2mt/plugins/fast_float/testbed/fast_float_testbed.c b/lcms2mt/plugins/fast_float/testbed/fast_float_testbed.c new file mode 100644 index 00000000..650454bc --- /dev/null +++ b/lcms2mt/plugins/fast_float/testbed/fast_float_testbed.c @@ -0,0 +1,1782 @@ +//--------------------------------------------------------------------------------- +// +// Little Color Management System, fast floating point extensions +// Copyright (c) 1998-2020 Marti Maria Saguer, all rights reserved +// +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +//--------------------------------------------------------------------------------- + +#include "fast_float_internal.h" + +#include <stdlib.h> +#include <memory.h> + + +// Some pixel representations +typedef struct { cmsUInt8Number r, g, b; } Scanline_rgb8bits; +typedef struct { cmsUInt8Number r, g, b, a; } Scanline_rgba8bits; +typedef struct { cmsUInt16Number r, g, b; } Scanline_rgb16bits; +typedef struct { cmsUInt16Number r, g, b, a; } Scanline_rgba16bits; +typedef struct { cmsUInt16Number r, g, b; } Scanline_rgb15bits; +typedef struct { cmsUInt16Number r, g, b, a; } Scanline_rgba15bits; +typedef struct { cmsUInt16Number r, g, b, a; } Scanline_cmyk15bits; +typedef struct { cmsFloat32Number r, g, b; } Scanline_rgbFloat; +typedef struct { cmsFloat32Number r, g, b, a; } Scanline_rgbaFloat; + +// 15 bit mode. <=> 8 bits mode +#define FROM_8_TO_15(x8) (cmsUInt16Number) ((((cmsUInt64Number)x8 << 15)) / 0xFF) +#define FROM_15_TO_8(x15) (cmsUInt8Number) (((cmsUInt64Number) x15 * 0xFF + 0x4000) >> 15) + + +// Floating point acuracy for tests +#define EPSILON_FLOAT_TESTS 0.005 + + +// The callback function used by cmsSetLogErrorHandler() +static +void FatalErrorQuit(cmsContext ContextID, cmsUInt32Number ErrorCode, const char *Text) +{ + UNUSED_PARAMETER(ContextID); + UNUSED_PARAMETER(ErrorCode); + + printf("** Fatal error: %s\n", Text); + exit(1); +} + +// Rise an error and exit +static +void Fail(const char* frm, ...) +{ + char ReasonToFailBuffer[1024]; + va_list args; + + va_start(args, frm); + vsprintf(ReasonToFailBuffer, frm, args); + FatalErrorQuit(0, 0, ReasonToFailBuffer); + + // unreacheable va_end(args); +} + + +// Creates a fake profile that only has a curve. Used in several places +static +cmsHPROFILE CreateCurves(cmsContext ContextID) +{ + cmsToneCurve* Gamma = cmsBuildGamma(ContextID, 1.1); + cmsToneCurve* Transfer[3]; + cmsHPROFILE h; + + Transfer[0] = Transfer[1] = Transfer[2] = Gamma; + h = cmsCreateLinearizationDeviceLink(ContextID, cmsSigRgbData, Transfer); + + cmsFreeToneCurve(ContextID, Gamma); + + return h; +} + + +// Check for a single 15 bit Photoshop-like formatter +static +void CheckSingleFormatter15(cmsContext id, cmsUInt32Number Type, const char* Text) +{ + cmsUInt16Number Values[cmsMAXCHANNELS]; + cmsUInt8Number Buffer[1024]; + cmsFormatter f, b; + cmsInt32Number i, j, nChannels, bytes; + _xform_head info; + + UNUSED_PARAMETER(id); + + memset(&info, 0, sizeof(info)); + info.OutputFormat = info.InputFormat = Type; + + // Get functions to go forth and back + f = Formatter_15Bit_Factory(id, Type, cmsFormatterInput, CMS_PACK_FLAGS_16BITS); + b = Formatter_15Bit_Factory(id, Type, cmsFormatterOutput, CMS_PACK_FLAGS_16BITS); + + if (f.Fmt16 == NULL || b.Fmt16 == NULL) { + + Fail("no formatter for %s", Text); + return; + } + + nChannels = T_CHANNELS(Type); + bytes = T_BYTES(Type); + + for (j = 0; j < 5; j++) { + + for (i = 0; i < nChannels; i++) { + + Values[i] = (cmsUInt16Number)(i + j) << 1; + } + + b.Fmt16(id, (struct _cmstransform_struct*) &info, Values, Buffer, 1); + memset(Values, 0, sizeof(Values)); + f.Fmt16(id, (struct _cmstransform_struct*) &info, Values, Buffer, 1); + + for (i = 0; i < nChannels; i++) { + + if (Values[i] != ((i + j) << 1)) { + + Fail("%s failed", Text); + return; + } + } + } +} + +#define C(a) CheckSingleFormatter15(0, a, #a) + +// Check for all 15 bits formatters +static +void CheckFormatters15(void) +{ + C(TYPE_GRAY_15); + C(TYPE_GRAY_15_REV); + C(TYPE_GRAY_15_SE); + C(TYPE_GRAYA_15); + C(TYPE_GRAYA_15_SE); + C(TYPE_GRAYA_15_PLANAR); + C(TYPE_RGB_15); + C(TYPE_RGB_15_PLANAR); + C(TYPE_RGB_15_SE); + C(TYPE_BGR_15); + C(TYPE_BGR_15_PLANAR); + C(TYPE_BGR_15_SE); + C(TYPE_RGBA_15); + C(TYPE_RGBA_15_PLANAR); + C(TYPE_RGBA_15_SE); + C(TYPE_ARGB_15); + C(TYPE_ABGR_15); + C(TYPE_ABGR_15_PLANAR); + C(TYPE_ABGR_15_SE); + C(TYPE_BGRA_15); + C(TYPE_BGRA_15_SE); + C(TYPE_YMC_15), + C(TYPE_CMY_15); + C(TYPE_CMY_15_PLANAR); + C(TYPE_CMY_15_SE); + C(TYPE_CMYK_15); + C(TYPE_CMYK_15_REV); + C(TYPE_CMYK_15_PLANAR); + C(TYPE_CMYK_15_SE); + C(TYPE_KYMC_15); + C(TYPE_KYMC_15_SE); + C(TYPE_KCMY_15); + C(TYPE_KCMY_15_REV); + C(TYPE_KCMY_15_SE); +} +#undef C + + +static +cmsInt32Number checkSingleComputeIncrements(cmsUInt32Number Format, cmsUInt32Number planeStride, cmsUInt32Number ExpectedChannels, cmsUInt32Number ExpectedAlpha, ...) +{ + cmsUInt32Number nChannels, nAlpha, nTotal, i, rc = 0 ; + cmsUInt32Number ComponentStartingOrder[cmsMAXCHANNELS], ComponentPointerIncrements[cmsMAXCHANNELS]; + va_list args; + + + va_start(args, ExpectedAlpha); + + _cmsComputeComponentIncrements(Format, planeStride, &nChannels, &nAlpha, ComponentStartingOrder, ComponentPointerIncrements); + + if (nChannels != ExpectedChannels) + return 0; + + if (nAlpha != ExpectedAlpha) + return 0; + + nTotal = nAlpha + nChannels; + + + + for (i = 0; i < nTotal; i++) + { + cmsUInt32Number so = va_arg(args, cmsUInt32Number); + if (so != ComponentStartingOrder[i]) + goto Error; + } + + for (i = 0; i < nTotal; i++) + { + cmsUInt32Number so = va_arg(args, cmsUInt32Number); + if (so != ComponentPointerIncrements[i]) + goto Error; + } + + // Success + rc = 1; + +Error: + va_end(args); + + return rc; +} + +#define CHECK(frm, plane, chans, alpha, ...) if (!checkSingleComputeIncrements(frm, plane, chans, alpha, __VA_ARGS__)) { printf("Format failed!\n"); return 0; } + + + +// Validate the compute increments function +cmsInt32Number CheckComputeIncrements(void) +{ + CHECK(TYPE_GRAY_8, 0, 1, 0, /**/ 0, /**/ 1); + CHECK(TYPE_GRAYA_8, 0, 1, 1, /**/ 0, 1, /**/ 2, 2); + CHECK(TYPE_AGRAY_8, 0, 1, 1, /**/ 1, 0, /**/ 2, 2); + CHECK(TYPE_GRAY_16, 0, 1, 0, /**/ 0, /**/ 2); + CHECK(TYPE_GRAYA_16, 0, 1, 1, /**/ 0, 2, /**/ 4, 4); + CHECK(TYPE_AGRAY_16, 0, 1, 1, /**/ 2, 0, /**/ 4, 4); + + CHECK(TYPE_GRAY_FLT, 0, 1, 0, /**/ 0, /**/ 4); + CHECK(TYPE_GRAYA_FLT, 0, 1, 1, /**/ 0, 4, /**/ 8, 8); + CHECK(TYPE_AGRAY_FLT, 0, 1, 1, /**/ 4, 0, /**/ 8, 8); + + CHECK(TYPE_GRAY_DBL, 0, 1, 0, /**/ 0, /**/ 8); + CHECK(TYPE_AGRAY_DBL, 0, 1, 1, /**/ 8, 0, /**/ 16, 16); + + CHECK(TYPE_RGB_8, 0, 3, 0, /**/ 0, 1, 2, /**/ 3, 3, 3); + CHECK(TYPE_RGBA_8, 0, 3, 1, /**/ 0, 1, 2, 3, /**/ 4, 4, 4, 4); + CHECK(TYPE_ARGB_8, 0, 3, 1, /**/ 1, 2, 3, 0, /**/ 4, 4, 4, 4); + + CHECK(TYPE_RGB_16, 0, 3, 0, /**/ 0, 2, 4, /**/ 6, 6, 6); + CHECK(TYPE_RGBA_16, 0, 3, 1, /**/ 0, 2, 4, 6, /**/ 8, 8, 8, 8); + CHECK(TYPE_ARGB_16, 0, 3, 1, /**/ 2, 4, 6, 0, /**/ 8, 8, 8, 8); + + CHECK(TYPE_RGB_FLT, 0, 3, 0, /**/ 0, 4, 8, /**/ 12, 12, 12); + CHECK(TYPE_RGBA_FLT, 0, 3, 1, /**/ 0, 4, 8, 12, /**/ 16, 16, 16, 16); + CHECK(TYPE_ARGB_FLT, 0, 3, 1, /**/ 4, 8, 12, 0, /**/ 16, 16, 16, 16); + + CHECK(TYPE_BGR_8, 0, 3, 0, /**/ 2, 1, 0, /**/ 3, 3, 3); + CHECK(TYPE_BGRA_8, 0, 3, 1, /**/ 2, 1, 0, 3, /**/ 4, 4, 4, 4); + CHECK(TYPE_ABGR_8, 0, 3, 1, /**/ 3, 2, 1, 0, /**/ 4, 4, 4, 4); + + CHECK(TYPE_BGR_16, 0, 3, 0, /**/ 4, 2, 0, /**/ 6, 6, 6); + CHECK(TYPE_BGRA_16, 0, 3, 1, /**/ 4, 2, 0, 6, /**/ 8, 8, 8, 8); + CHECK(TYPE_ABGR_16, 0, 3, 1, /**/ 6, 4, 2, 0, /**/ 8, 8, 8, 8); + + CHECK(TYPE_BGR_FLT, 0, 3, 0, /**/ 8, 4, 0, /**/ 12, 12, 12); + CHECK(TYPE_BGRA_FLT, 0, 3, 1, /**/ 8, 4, 0, 12, /**/ 16, 16, 16, 16); + CHECK(TYPE_ABGR_FLT, 0, 3, 1, /**/ 12, 8, 4, 0, /**/ 16, 16, 16, 16); + + + CHECK(TYPE_CMYK_8, 0, 4, 0, /**/ 0, 1, 2, 3, /**/ 4, 4, 4, 4); + CHECK(TYPE_CMYKA_8, 0, 4, 1, /**/ 0, 1, 2, 3, 4, /**/ 5, 5, 5, 5, 5); + CHECK(TYPE_ACMYK_8, 0, 4, 1, /**/ 1, 2, 3, 4, 0, /**/ 5, 5, 5, 5, 5); + + CHECK(TYPE_KYMC_8, 0, 4, 0, /**/ 3, 2, 1, 0, /**/ 4, 4, 4, 4); + CHECK(TYPE_KYMCA_8, 0, 4, 1, /**/ 3, 2, 1, 0, 4, /**/ 5, 5, 5, 5, 5); + CHECK(TYPE_AKYMC_8, 0, 4, 1, /**/ 4, 3, 2, 1, 0, /**/ 5, 5, 5, 5, 5); + + CHECK(TYPE_KCMY_8, 0, 4, 0, /**/ 1, 2, 3, 0, /**/ 4, 4, 4, 4); + + CHECK(TYPE_CMYK_16, 0, 4, 0, /**/ 0, 2, 4, 6, /**/ 8, 8, 8, 8); + CHECK(TYPE_CMYKA_16, 0, 4, 1, /**/ 0, 2, 4, 6, 8, /**/ 10, 10, 10, 10, 10); + CHECK(TYPE_ACMYK_16, 0, 4, 1, /**/ 2, 4, 6, 8, 0, /**/ 10, 10, 10, 10, 10); + + CHECK(TYPE_KYMC_16, 0, 4, 0, /**/ 6, 4, 2, 0, /**/ 8, 8, 8, 8); + CHECK(TYPE_KYMCA_16, 0, 4, 1, /**/ 6, 4, 2, 0, 8, /**/ 10, 10, 10, 10, 10); + CHECK(TYPE_AKYMC_16, 0, 4, 1, /**/ 8, 6, 4, 2, 0, /**/ 10, 10, 10, 10, 10); + + CHECK(TYPE_KCMY_16, 0, 4, 0, /**/ 2, 4, 6, 0, /**/ 8, 8, 8, 8); + + // Planar + + CHECK(TYPE_GRAYA_8_PLANAR, 100, 1, 1, /**/ 0, 100, /**/ 1, 1); + CHECK(TYPE_AGRAY_8_PLANAR, 100, 1, 1, /**/ 100, 0, /**/ 1, 1); + + CHECK(TYPE_GRAYA_16_PLANAR, 100, 1, 1, /**/ 0, 100, /**/ 2, 2); + CHECK(TYPE_AGRAY_16_PLANAR, 100, 1, 1, /**/ 100, 0, /**/ 2, 2); + + CHECK(TYPE_GRAYA_FLT_PLANAR, 100, 1, 1, /**/ 0, 100, /**/ 4, 4); + CHECK(TYPE_AGRAY_FLT_PLANAR, 100, 1, 1, /**/ 100, 0, /**/ 4, 4); + + CHECK(TYPE_GRAYA_DBL_PLANAR, 100, 1, 1, /**/ 0, 100, /**/ 8, 8); + CHECK(TYPE_AGRAY_DBL_PLANAR, 100, 1, 1, /**/ 100, 0, /**/ 8, 8); + + CHECK(TYPE_RGB_8_PLANAR, 100, 3, 0, /**/ 0, 100, 200, /**/ 1, 1, 1); + CHECK(TYPE_RGBA_8_PLANAR, 100, 3, 1, /**/ 0, 100, 200, 300, /**/ 1, 1, 1, 1); + CHECK(TYPE_ARGB_8_PLANAR, 100, 3, 1, /**/ 100, 200, 300, 0, /**/ 1, 1, 1, 1); + + CHECK(TYPE_BGR_8_PLANAR, 100, 3, 0, /**/ 200, 100, 0, /**/ 1, 1, 1); + CHECK(TYPE_BGRA_8_PLANAR, 100, 3, 1, /**/ 200, 100, 0, 300, /**/ 1, 1, 1, 1); + CHECK(TYPE_ABGR_8_PLANAR, 100, 3, 1, /**/ 300, 200, 100, 0, /**/ 1, 1, 1, 1); + + CHECK(TYPE_RGB_16_PLANAR, 100, 3, 0, /**/ 0, 100, 200, /**/ 2, 2, 2); + CHECK(TYPE_RGBA_16_PLANAR, 100, 3, 1, /**/ 0, 100, 200, 300, /**/ 2, 2, 2, 2); + CHECK(TYPE_ARGB_16_PLANAR, 100, 3, 1, /**/ 100, 200, 300, 0, /**/ 2, 2, 2, 2); + + CHECK(TYPE_BGR_16_PLANAR, 100, 3, 0, /**/ 200, 100, 0, /**/ 2, 2, 2); + CHECK(TYPE_BGRA_16_PLANAR, 100, 3, 1, /**/ 200, 100, 0, 300, /**/ 2, 2, 2, 2); + CHECK(TYPE_ABGR_16_PLANAR, 100, 3, 1, /**/ 300, 200, 100, 0, /**/ 2, 2, 2, 2); + + return 1; +} + + + +// Check 15 bit mode accuracy +static +cmsBool Valid15(cmsUInt16Number a, cmsUInt8Number b) +{ + return abs(FROM_15_TO_8(a) - b) <= 2; +} + +// Check the test macros itselves +static +void Check15bitMacros(void) +{ + int i; + + printf("Checking 15 bit <=> 8 bit macros..."); + + for (i = 0; i < 256; i++) + { + cmsUInt16Number n = FROM_8_TO_15(i); + cmsUInt8Number m = FROM_15_TO_8(n); + + if (m != i) + Fail("Failed on %d (->%d->%d)", i, n, m); + } + printf("ok\n"); +} + +// Do an in-depth test by checking all RGB cube of 8 bits, going from profilein to profileout. +// Results should be same except for 2 contone levels allowed for roundoff. Note 15 bits is more +// precise than 8 bits and this is a source of discrepancies. Cache is disabled +static +void TryAllValues15(cmsContext ContextID, cmsHPROFILE hlcmsProfileIn, cmsHPROFILE hlcmsProfileOut, cmsInt32Number Intent) +{ + Scanline_rgb8bits* buffer8in; + Scanline_rgb15bits* buffer15in; + Scanline_rgb8bits* buffer8out; + Scanline_rgb15bits* buffer15out; + int r, g, b, j; + cmsUInt32Number npixels = 256 * 256 * 256; // All RGB cube in 8 bits + + cmsHTRANSFORM xform15 = cmsCreateTransform(ContextID, hlcmsProfileIn, TYPE_RGB_15, hlcmsProfileOut, TYPE_RGB_15, Intent, cmsFLAGS_NOCACHE); + cmsHTRANSFORM xform8 = cmsCreateTransform(ContextID, hlcmsProfileIn, TYPE_RGB_8, hlcmsProfileOut, TYPE_RGB_8, Intent, cmsFLAGS_NOCACHE); // Transforms already created + + cmsCloseProfile(ContextID, hlcmsProfileIn); + cmsCloseProfile(ContextID, hlcmsProfileOut); + + if (xform15 == NULL || xform8 == NULL) { + + Fail("NULL transforms on check for 15 bit conversions"); + } + + // Since this is just a test, I will not check memory allocation... + buffer8in = (Scanline_rgb8bits*)malloc(npixels * sizeof(Scanline_rgb8bits)); + buffer15in = (Scanline_rgb15bits*)malloc(npixels * sizeof(Scanline_rgb15bits)); + buffer8out = (Scanline_rgb8bits*)malloc(npixels * sizeof(Scanline_rgb8bits)); + buffer15out = (Scanline_rgb15bits*)malloc(npixels * sizeof(Scanline_rgb15bits)); + + // Fill input values for 8 and 15 bits + j = 0; + for (r = 0; r < 256; r++) + for (g = 0; g < 256; g++) + for (b = 0; b < 256; b++) { + + buffer8in[j].r = (cmsUInt8Number)r; + buffer8in[j].g = (cmsUInt8Number)g; + buffer8in[j].b = (cmsUInt8Number)b; + + buffer15in[j].r = FROM_8_TO_15(r); + buffer15in[j].g = FROM_8_TO_15(g); + buffer15in[j].b = FROM_8_TO_15(b); + + j++; + } + + cmsDoTransform(ContextID, xform15, buffer15in, buffer15out, npixels); + cmsDoTransform(ContextID, xform8, buffer8in, buffer8out, npixels); + + j = 0; + for (r = 0; r < 256; r++) + for (g = 0; g < 256; g++) + for (b = 0; b < 256; b++) { + + // Check the results + if (!Valid15(buffer15out[j].r, buffer8out[j].r) || + !Valid15(buffer15out[j].g, buffer8out[j].g) || + !Valid15(buffer15out[j].b, buffer8out[j].b)) + Fail("Conversion failed at (%d %d %d) != (%d %d %d)", buffer8out[j].r, buffer8out[j].g, buffer8out[j].b, + FROM_15_TO_8(buffer15out[j].r), FROM_15_TO_8(buffer15out[j].g), FROM_15_TO_8(buffer15out[j].b)); + + j++; + } + + free(buffer8in); free(buffer15in); + free(buffer8out); free(buffer15out); + cmsDeleteTransform(ContextID, xform15); + cmsDeleteTransform(ContextID, xform8); +} + +// Convert some known values +static +void Check15bitsConversions(cmsContext ContextID) +{ + Check15bitMacros(); + + printf("Checking accuracy of 15 bits on CLUT..."); + TryAllValues15(ContextID, cmsOpenProfileFromFile(ContextID, "test5.icc", "r"), cmsOpenProfileFromFile(ContextID, "test3.icc", "r"), INTENT_PERCEPTUAL); + printf("Ok\n"); + + printf("Checking accuracy of 15 bits on same profile ..."); + TryAllValues15(ContextID, cmsOpenProfileFromFile(ContextID, "test0.icc", "r"), cmsOpenProfileFromFile(ContextID, "test0.icc", "r"), INTENT_PERCEPTUAL); + printf("Ok\n"); + + printf("Checking accuracy of 15 bits on Matrix..."); + TryAllValues15(ContextID, cmsOpenProfileFromFile(ContextID, "test5.icc", "r"), cmsOpenProfileFromFile(ContextID, "test0.icc", "r"), INTENT_PERCEPTUAL); + printf("Ok\n"); + + printf("All 15 bits tests passed OK\n\n"); +} + +// Next test checks results of optimized 16 bits versus raw 16 bits. +static +void TryAllValues16bits(cmsContext Raw, cmsContext Plugin, cmsHPROFILE hlcmsProfileIn, cmsHPROFILE hlcmsProfileOut, cmsInt32Number Intent) +{ + Scanline_rgba16bits* bufferIn; + Scanline_rgba16bits* bufferRawOut; + Scanline_rgba16bits* bufferPluginOut; + int r, g, b; + + int j; + cmsUInt32Number npixels = 256 * 256 * 256; + + cmsHTRANSFORM xformRaw = cmsCreateTransform(Raw, hlcmsProfileIn, TYPE_RGBA_16, hlcmsProfileOut, TYPE_RGBA_16, Intent, cmsFLAGS_NOCACHE| cmsFLAGS_COPY_ALPHA); + cmsHTRANSFORM xformPlugin = cmsCreateTransform(Plugin, hlcmsProfileIn, TYPE_RGBA_16, hlcmsProfileOut, TYPE_RGBA_16, Intent, cmsFLAGS_NOCACHE| cmsFLAGS_COPY_ALPHA); + + cmsCloseProfile(Raw, hlcmsProfileIn); + cmsCloseProfile(Raw, hlcmsProfileOut); + + if (xformRaw == NULL || xformPlugin == NULL) { + + Fail("NULL transforms on check float conversions"); + } + + // Again, no checking on mem alloc because this is just a test + bufferIn = (Scanline_rgba16bits*)malloc(npixels * sizeof(Scanline_rgba16bits)); + bufferRawOut = (Scanline_rgba16bits*)malloc(npixels * sizeof(Scanline_rgba16bits)); + bufferPluginOut = (Scanline_rgba16bits*)malloc(npixels * sizeof(Scanline_rgba16bits)); + + // Same input to both transforms + j = 0; + for (r = 0; r < 256; r++) + for (g = 0; g < 256; g++) + for (b = 0; b < 256; b++) { + + bufferIn[j].r = FROM_8_TO_16(0xf8); + bufferIn[j].g = FROM_8_TO_16(0xf8); + bufferIn[j].b = FROM_8_TO_16(0xf8); + bufferIn[j].a = 0xffff; + + j++; + } + + // Different transforms, different output buffers + cmsDoTransform(Raw, xformRaw, bufferIn, bufferRawOut, npixels); + cmsDoTransform(Plugin, xformPlugin, bufferIn, bufferPluginOut, npixels); + +#if 1 + // Lets compare results + j = 0; + for (r = 0; r < 256; r++) + for (g = 0; g < 256; g++) + for (b = 0; b < 256; b++) { + + if (bufferRawOut[j].r != bufferPluginOut[j].r || + bufferRawOut[j].g != bufferPluginOut[j].g || + bufferRawOut[j].b != bufferPluginOut[j].b || + bufferRawOut[j].a != bufferPluginOut[j].a) + Fail( + "Conversion failed at [%x %x %x %x] (%x %x %x %x) != (%x %x %x %x)", + bufferIn[j].r, bufferIn[j].g, bufferIn[j].b, bufferIn[j].a, + bufferRawOut[j].r, bufferRawOut[j].g, bufferRawOut[j].b, bufferRawOut[j].a, + bufferPluginOut[j].r, bufferPluginOut[j].g, bufferPluginOut[j].b, bufferPluginOut[j].a); + + j++; + } +#endif + + free(bufferIn); free(bufferRawOut); + free(bufferPluginOut); + + cmsDeleteTransform(Raw, xformRaw); + cmsDeleteTransform(Plugin, xformPlugin); +} + +static +void CheckAccuracy16Bits(cmsContext Raw, cmsContext Plugin) +{ + // CLUT should be as 16 bits or better + printf("Checking accuracy of 16 bits CLUT..."); + TryAllValues16bits(Raw, Plugin, cmsOpenProfileFromFile(Raw, "test5.icc", "r"), cmsOpenProfileFromFile(Raw, "test3.icc", "r"), INTENT_PERCEPTUAL); + printf("All 16 bits tests passed OK\n\n"); +} + +// -------------------------------------------------------------------------------------------------- +// A C C U R A C Y C H E C K S +// -------------------------------------------------------------------------------------------------- + + +// Check result accuracy +static +cmsBool ValidFloat(cmsFloat32Number a, cmsFloat32Number b) +{ + return fabsf(a-b) < EPSILON_FLOAT_TESTS; +} + +// Do an in-depth test by checking all RGB cube of 8 bits, going from profilein to profileout. +// Values with and without optimization are checked (different contexts, one with the plugin and another without) +// Results should be same except for EPSILON_FLOAT_TESTS allowed for accuracy/speed tradeoff. Cache is disabled +static +void TryAllValuesFloat(cmsContext Raw, cmsContext Plugin, cmsHPROFILE hlcmsProfileIn, cmsHPROFILE hlcmsProfileOut, cmsInt32Number Intent) +{ + Scanline_rgbFloat* bufferIn; + Scanline_rgbFloat* bufferRawOut; + Scanline_rgbFloat* bufferPluginOut; + int r, g, b; + + int j; + cmsUInt32Number npixels = 256 * 256 * 256; + + cmsHTRANSFORM xformRaw = cmsCreateTransform(Raw, hlcmsProfileIn, TYPE_RGB_FLT, hlcmsProfileOut, TYPE_RGB_FLT, Intent, cmsFLAGS_NOCACHE); + cmsHTRANSFORM xformPlugin = cmsCreateTransform(Plugin, hlcmsProfileIn, TYPE_RGB_FLT, hlcmsProfileOut, TYPE_RGB_FLT, Intent, cmsFLAGS_NOCACHE); + + cmsCloseProfile(Raw, hlcmsProfileIn); + cmsCloseProfile(Raw, hlcmsProfileOut); + + if (xformRaw == NULL || xformPlugin == NULL) { + + Fail("NULL transforms on check float conversions"); + } + + // Again, no checking on mem alloc because this is just a test + bufferIn = (Scanline_rgbFloat*)malloc(npixels * sizeof(Scanline_rgbFloat)); + bufferRawOut = (Scanline_rgbFloat*)malloc(npixels * sizeof(Scanline_rgbFloat)); + bufferPluginOut = (Scanline_rgbFloat*)malloc(npixels * sizeof(Scanline_rgbFloat)); + + // Same input to both transforms + j = 0; + for (r = 0; r < 256; r++) + for (g = 0; g < 256; g++) + for (b = 0; b < 256; b++) { + + bufferIn[j].r = (cmsFloat32Number)r / 255.0f; + bufferIn[j].g = (cmsFloat32Number)g / 255.0f; + bufferIn[j].b = (cmsFloat32Number)b / 255.0f; + + j++; + } + + // Different transforms, different output buffers + cmsDoTransform(Raw, xformRaw, bufferIn, bufferRawOut, npixels); + cmsDoTransform(Plugin, xformPlugin, bufferIn, bufferPluginOut, npixels); + + // Lets compare results + j = 0; + for (r = 0; r < 256; r++) + for (g = 0; g < 256; g++) + for (b = 0; b < 256; b++) { + + if (!ValidFloat(bufferRawOut[j].r, bufferPluginOut[j].r) || + !ValidFloat(bufferRawOut[j].g, bufferPluginOut[j].g) || + !ValidFloat(bufferRawOut[j].b, bufferPluginOut[j].b)) + Fail("Conversion failed at (%f %f %f) != (%f %f %f)", bufferRawOut[j].r, bufferRawOut[j].g, bufferRawOut[j].b, + bufferPluginOut[j].r, bufferPluginOut[j].g, bufferPluginOut[j].b); + + j++; + } + + free(bufferIn); free(bufferRawOut); + free(bufferPluginOut); + + cmsDeleteTransform(Raw, xformRaw); + cmsDeleteTransform(Plugin, xformPlugin); +} + +static +void TryAllValuesFloatAlpha(cmsContext Raw, cmsContext Plugin, cmsHPROFILE hlcmsProfileIn, cmsHPROFILE hlcmsProfileOut, cmsInt32Number Intent) +{ + Scanline_rgbaFloat* bufferIn; + Scanline_rgbaFloat* bufferRawOut; + Scanline_rgbaFloat* bufferPluginOut; + int r, g, b; + + int j; + cmsUInt32Number npixels = 256 * 256 * 256; + + cmsHTRANSFORM xformRaw = cmsCreateTransform(Raw, hlcmsProfileIn, TYPE_RGBA_FLT, hlcmsProfileOut, TYPE_RGBA_FLT, Intent, cmsFLAGS_NOCACHE); + cmsHTRANSFORM xformPlugin = cmsCreateTransform(Plugin, hlcmsProfileIn, TYPE_RGBA_FLT, hlcmsProfileOut, TYPE_RGBA_FLT, Intent, cmsFLAGS_NOCACHE); + + cmsCloseProfile(Raw, hlcmsProfileIn); + cmsCloseProfile(Plugin, hlcmsProfileOut); + + if (xformRaw == NULL || xformPlugin == NULL) { + + Fail("NULL transforms on check float conversions"); + } + + // Again, no checking on mem alloc because this is just a test + bufferIn = (Scanline_rgbaFloat*)malloc(npixels * sizeof(Scanline_rgbaFloat)); + bufferRawOut = (Scanline_rgbaFloat*)malloc(npixels * sizeof(Scanline_rgbaFloat)); + bufferPluginOut = (Scanline_rgbaFloat*)malloc(npixels * sizeof(Scanline_rgbaFloat)); + + // Same input to both transforms + j = 0; + for (r = 0; r < 256; r++) + for (g = 0; g < 256; g++) + for (b = 0; b < 256; b++) { + + bufferIn[j].r = (cmsFloat32Number)r / 255.0f; + bufferIn[j].g = (cmsFloat32Number)g / 255.0f; + bufferIn[j].b = (cmsFloat32Number)b / 255.0f; + bufferIn[j].a = (cmsFloat32Number) 1.0f; + + j++; + } + + // Different transforms, different output buffers + cmsDoTransform(Raw, xformRaw, bufferIn, bufferRawOut, npixels); + cmsDoTransform(Plugin, xformPlugin, bufferIn, bufferPluginOut, npixels); + +#if 1 + // Lets compare results + j = 0; + for (r = 0; r < 256; r++) + for (g = 0; g < 256; g++) + for (b = 0; b < 256; b++) { + + if (!ValidFloat(bufferRawOut[j].r, bufferPluginOut[j].r) || + !ValidFloat(bufferRawOut[j].g, bufferPluginOut[j].g) || + !ValidFloat(bufferRawOut[j].b, bufferPluginOut[j].b) || + !ValidFloat(bufferRawOut[j].a, bufferPluginOut[j].a)) + Fail("Conversion failed at (%f %f %f %f) != (%f %f %f %f)", bufferRawOut[j].r, bufferRawOut[j].g, bufferRawOut[j].b, bufferRawOut[j].a, + bufferPluginOut[j].r, bufferPluginOut[j].g, bufferPluginOut[j].b, bufferPluginOut[j].a); + + j++; + } +#endif + + free(bufferIn); free(bufferRawOut); + free(bufferPluginOut); + + cmsDeleteTransform(Raw, xformRaw); + cmsDeleteTransform(Plugin, xformPlugin); +} + + + +// Next test checks results of optimized floating point versus 16 bits. That is, converting the float to 16 bits, operating +// in 16 bits and back to float. Results again should be in range of epsilon +static +cmsBool Valid16Float(cmsUInt16Number a, cmsFloat32Number b) +{ + return fabs(((cmsFloat32Number)a / (cmsFloat32Number) 0xFFFF) - b) < EPSILON_FLOAT_TESTS; +} + +// Do an in-depth test by checking all RGB cube of 8 bits, going from profilein to profileout. 16 bits temporary is used as reference +static +void TryAllValuesFloatVs16(cmsContext Raw, cmsContext Plugin, cmsHPROFILE hlcmsProfileIn, cmsHPROFILE hlcmsProfileOut, cmsInt32Number Intent) +{ + Scanline_rgbFloat* bufferIn; + Scanline_rgb16bits* bufferIn16; + + Scanline_rgbFloat* bufferFloatOut; + Scanline_rgb16bits* buffer16Out; + int r, g, b; + + int j; + cmsUInt32Number npixels = 256 * 256 * 256; + + cmsHTRANSFORM xformRaw = cmsCreateTransform(Raw, hlcmsProfileIn, TYPE_RGB_16, hlcmsProfileOut, TYPE_RGB_16, Intent, cmsFLAGS_NOCACHE); + cmsHTRANSFORM xformPlugin = cmsCreateTransform(Plugin, hlcmsProfileIn, TYPE_RGB_FLT, hlcmsProfileOut, TYPE_RGB_FLT, Intent, cmsFLAGS_NOCACHE); + + cmsCloseProfile(Raw, hlcmsProfileIn); + cmsCloseProfile(Raw, hlcmsProfileOut); + + if (xformRaw == NULL || xformPlugin == NULL) { + + Fail("NULL transforms on check float vs 16 conversions"); + } + + // Again, no checking on mem alloc because this is just a test + bufferIn = (Scanline_rgbFloat*)malloc(npixels * sizeof(Scanline_rgbFloat)); + bufferIn16 = (Scanline_rgb16bits*)malloc(npixels * sizeof(Scanline_rgb16bits)); + bufferFloatOut = (Scanline_rgbFloat*)malloc(npixels * sizeof(Scanline_rgbFloat)); + buffer16Out = (Scanline_rgb16bits*)malloc(npixels * sizeof(Scanline_rgb16bits)); + + + // Fill two equivalent input buffers + j = 0; + for (r = 0; r < 256; r++) + for (g = 0; g < 256; g++) + for (b = 0; b < 256; b++) { + + bufferIn[j].r = (cmsFloat32Number)r / 255.0f; + bufferIn[j].g = (cmsFloat32Number)g / 255.0f; + bufferIn[j].b = (cmsFloat32Number)b / 255.0f; + + bufferIn16[j].r = FROM_8_TO_16(r); + bufferIn16[j].g = FROM_8_TO_16(g); + bufferIn16[j].b = FROM_8_TO_16(b); + + j++; + } + + // Convert + cmsDoTransform(Raw, xformRaw, bufferIn16, buffer16Out, npixels); + cmsDoTransform(Plugin, xformPlugin, bufferIn, bufferFloatOut, npixels); + + + j = 0; + for (r = 0; r < 256; r++) + for (g = 0; g < 256; g++) + for (b = 0; b < 256; b++) { + + // Check for same values + if (!Valid16Float(buffer16Out[j].r, bufferFloatOut[j].r) || + !Valid16Float(buffer16Out[j].g, bufferFloatOut[j].g) || + !Valid16Float(buffer16Out[j].b, bufferFloatOut[j].b)) + Fail("Conversion failed at (%f %f %f) != (%f %f %f)", buffer16Out[j].r / 65535.0, buffer16Out[j].g / 65535.0, buffer16Out[j].b / 65535.0, + bufferFloatOut[j].r, bufferFloatOut[j].g, bufferFloatOut[j].b); + + j++; + } + + free(bufferIn16); free(buffer16Out); + free(bufferIn); free(bufferFloatOut); + cmsDeleteTransform(Raw, xformRaw); + cmsDeleteTransform(Plugin, xformPlugin); +} + + +// Check change format feature +static +void CheckChangeFormat(cmsContext ContextID) +{ + cmsHPROFILE hsRGB, hLab; + cmsHTRANSFORM xform, xform2; + cmsUInt8Number rgb8[3] = { 10, 120, 40 }; + cmsUInt16Number rgb16[3] = { 10* 257, 120*257, 40*257 }; + cmsUInt16Number lab16_1[3], lab16_2[3]; + + printf("Checking change format feature..."); + + hsRGB = cmsCreate_sRGBProfile(ContextID); + hLab = cmsCreateLab4Profile(ContextID, NULL); + + xform = cmsCreateTransform(ContextID, hsRGB, TYPE_RGB_16, hLab, TYPE_Lab_16, INTENT_PERCEPTUAL, 0); + + cmsCloseProfile(ContextID, hsRGB); + cmsCloseProfile(ContextID, hLab); + + cmsDoTransform(ContextID, xform, rgb16, lab16_1, 1); + + xform2 = cmsCloneTransformChangingFormats(ContextID, xform, TYPE_RGB_8, TYPE_Lab_16); + + cmsDoTransform(ContextID, xform2, rgb8, lab16_2, 1); + cmsDeleteTransform(ContextID, xform); + cmsDeleteTransform(ContextID, xform2); + + if (memcmp(lab16_1, lab16_2, sizeof(lab16_1)) != 0) + Fail("Change format failed!"); + + printf("Ok\n"); + +} + +static +cmsBool ValidInt(cmsUInt16Number a, cmsUInt16Number b) +{ + return abs(a - b) <= 32; +} + +static +void CheckLab2Roundtrip(cmsContext ContextID) +{ + cmsHPROFILE hsRGB, hLab; + cmsHTRANSFORM xform, xform2; + cmsInt8Number* lab; + cmsInt32Number Mb, j; + cmsInt32Number r, g, b; + Scanline_rgb8bits* In; + Scanline_rgb8bits* Out; + + printf("Checking lab2 roundtrip..."); + + hsRGB = cmsCreate_sRGBProfile(ContextID); + hLab = cmsCreateLab2Profile(ContextID, NULL); + + + xform = cmsCreateTransform(ContextID, hsRGB, TYPE_RGB_8, hLab, TYPE_Lab_8, INTENT_RELATIVE_COLORIMETRIC, cmsFLAGS_NOOPTIMIZE|cmsFLAGS_BLACKPOINTCOMPENSATION); + xform2 = cmsCreateTransform(ContextID, hLab, TYPE_Lab_8, hsRGB, TYPE_RGB_8, INTENT_RELATIVE_COLORIMETRIC, cmsFLAGS_NOOPTIMIZE | cmsFLAGS_BLACKPOINTCOMPENSATION); + + cmsCloseProfile(ContextID, hsRGB); + cmsCloseProfile(ContextID, hLab); + + + Mb = 256 * 256 * 256 * sizeof(Scanline_rgb8bits); + In = (Scanline_rgb8bits*)malloc(Mb); + Out = (Scanline_rgb8bits*)malloc(Mb); + lab = (cmsInt8Number*)malloc(256 * 256 * 256 * 3 * sizeof(cmsInt8Number)); + + j = 0; + for (r = 0; r < 256; r++) + for (g = 0; g < 256; g++) + for (b = 0; b < 256; b++) + { + + In[j].r = (cmsUInt8Number)r; + In[j].g = (cmsUInt8Number)g; + In[j].b = (cmsUInt8Number)b; + j++; + } + + + cmsDoTransform(ContextID, xform, In, lab, 256 * 256 * 256); + cmsDoTransform(ContextID, xform2, lab, Out, 256 * 256 * 256); + + cmsDeleteTransform(ContextID, xform); + cmsDeleteTransform(ContextID, xform2); + + + j = 0; + for (r = 0; r < 256; r++) + for (g = 0; g < 256; g++) + for (b = 0; b < 256; b++) { + + // Check for same values + if (!ValidInt(In[j].r, Out[j].r) || + !ValidInt(In[j].g, Out[j].g) || + !ValidInt(In[j].b, Out[j].b)) + Fail("Conversion failed at (%d %d %d) != (%d %d %d)", In[j].r, In[j].g, In[j].b, + Out[j].r, Out[j].g, Out[j].b); + + j++; + } + + + free(In); + free(Out); + free(lab); + printf("Ok\n"); + +} + +// Convert some known values +static +void CheckConversionFloat(cmsContext Raw, cmsContext Plugin) +{ + printf("Crash test..."); + TryAllValuesFloatAlpha(Raw, Plugin, cmsOpenProfileFromFile(Raw, "test5.icc", "r"), cmsOpenProfileFromFile(Raw, "test0.icc", "r"), INTENT_PERCEPTUAL); + printf("Ok\n"); + + printf("Crash (II) test..."); + TryAllValuesFloatAlpha(Raw, Plugin, cmsOpenProfileFromFile(Raw, "test0.icc", "r"), cmsOpenProfileFromFile(Raw, "test0.icc", "r"), INTENT_PERCEPTUAL); + printf("Ok\n"); + + // Matrix-shaper should be accurate + printf("Checking accuracy on Matrix-shaper..."); + TryAllValuesFloat(Raw, Plugin, cmsOpenProfileFromFile(Raw, "test5.icc", "r"), cmsOpenProfileFromFile(Raw, "test0.icc", "r"), INTENT_PERCEPTUAL); + printf("Ok\n"); + + // CLUT should be as 16 bits or better + printf("Checking accuracy of CLUT..."); + TryAllValuesFloatVs16(Raw, Plugin, cmsOpenProfileFromFile(Raw, "test5.icc", "r"), cmsOpenProfileFromFile(Raw, "test3.icc", "r"), INTENT_PERCEPTUAL); + printf("Ok\n"); + + // Same profile should give same values (we test both methods) + printf("Checking accuracy on same profile ..."); + TryAllValuesFloatVs16(Raw, Plugin, cmsOpenProfileFromFile(Raw, "test0.icc", "r"), cmsOpenProfileFromFile(Raw, "test0.icc", "r"), INTENT_PERCEPTUAL); + TryAllValuesFloat(Raw, Plugin, cmsOpenProfileFromFile(Raw, "test0.icc", "r"), cmsOpenProfileFromFile(Raw, "test0.icc", "r"), INTENT_PERCEPTUAL); + printf("Ok\n"); +} + + + +// -------------------------------------------------------------------------------------------------- +// P E R F O R M A N C E C H E C K S +// -------------------------------------------------------------------------------------------------- + + +static +cmsFloat64Number MPixSec(cmsFloat64Number diff) +{ + cmsFloat64Number seconds = (cmsFloat64Number)diff / (cmsFloat64Number)CLOCKS_PER_SEC; + return (256.0 * 256.0 * 256.0) / (1024.0*1024.0*seconds); +} + +typedef cmsFloat64Number(*perf_fn)(cmsContext ct, cmsHPROFILE hlcmsProfileIn, cmsHPROFILE hlcmsProfileOut); + + +static +void PerformanceHeader(void) +{ + printf(" MPixel/sec. MByte/sec.\n"); +} + +static +cmsFloat64Number Performance(const char* Title, perf_fn fn, cmsContext ct, const char* inICC, const char* outICC, size_t sz, cmsFloat64Number prev) +{ + cmsHPROFILE hlcmsProfileIn; + cmsHPROFILE hlcmsProfileOut; + + if (inICC == NULL) + hlcmsProfileIn = CreateCurves(ct); + else + hlcmsProfileIn = cmsOpenProfileFromFile(ct, inICC, "r"); + + if (outICC == NULL) + hlcmsProfileOut = CreateCurves(ct); + else + hlcmsProfileOut = cmsOpenProfileFromFile(ct, outICC, "r"); + + + cmsFloat64Number n = fn(ct, hlcmsProfileIn, hlcmsProfileOut); + + printf("%-30s: ", Title); fflush(stdout); + printf("%-12.2f %-12.2f", n, n * sz); + + if (prev > 0.0) { + + cmsFloat64Number imp = n / prev; + if (imp > 1) + printf(" (x %-2.1f)", imp); + } + + printf("\n"); fflush(stdout); + return n; +} + + +static +void ComparativeCt(cmsContext ct1, cmsContext ct2, const char* Title, perf_fn fn1, perf_fn fn2, const char* inICC, const char* outICC) +{ + cmsHPROFILE hlcmsProfileIn; + cmsHPROFILE hlcmsProfileOut; + + if (inICC == NULL) + hlcmsProfileIn = CreateCurves(ct1); + else + hlcmsProfileIn = cmsOpenProfileFromFile(ct1, inICC, "r"); + + if (outICC == NULL) + hlcmsProfileOut = CreateCurves(ct1); + else + hlcmsProfileOut = cmsOpenProfileFromFile(ct1, outICC, "r"); + + + cmsFloat64Number n1 = fn1(ct1, hlcmsProfileIn, hlcmsProfileOut); + + if (inICC == NULL) + hlcmsProfileIn = CreateCurves(ct2); + else + hlcmsProfileIn = cmsOpenProfileFromFile(ct2, inICC, "r"); + + if (outICC == NULL) + hlcmsProfileOut = CreateCurves(ct2); + else + hlcmsProfileOut = cmsOpenProfileFromFile(ct2, outICC, "r"); + + cmsFloat64Number n2 = fn2(ct2, hlcmsProfileIn, hlcmsProfileOut); + + + printf("%-30s: ", Title); fflush(stdout); + printf("%-12.2f %-12.2f\n", n1, n2); +} + +static +void Comparative(cmsContext Raw, cmsContext Plugin, const char* Title, perf_fn fn1, perf_fn fn2, const char* inICC, const char* outICC) +{ + ComparativeCt(Raw, Plugin, Title, fn1, fn2, inICC, outICC); +} + +// The worst case is used, no cache and all rgb combinations +static +cmsFloat64Number SpeedTest8bitsRGB(cmsContext ct, cmsHPROFILE hlcmsProfileIn, cmsHPROFILE hlcmsProfileOut) +{ + cmsInt32Number r, g, b, j; + clock_t atime; + cmsFloat64Number diff; + cmsHTRANSFORM hlcmsxform; + Scanline_rgb8bits *In; + cmsUInt32Number Mb; + + if (hlcmsProfileIn == NULL || hlcmsProfileOut == NULL) + Fail("Unable to open profiles"); + + hlcmsxform = cmsCreateTransform(ct, hlcmsProfileIn, TYPE_RGB_8, hlcmsProfileOut, TYPE_RGB_8, INTENT_PERCEPTUAL, cmsFLAGS_NOCACHE); + cmsCloseProfile(ct, hlcmsProfileIn); + cmsCloseProfile(ct, hlcmsProfileOut); + + Mb = 256 * 256 * 256 * sizeof(Scanline_rgb8bits); + In = (Scanline_rgb8bits*)malloc(Mb); + + j = 0; + for (r = 0; r < 256; r++) + for (g = 0; g < 256; g++) + for (b = 0; b < 256; b++) { + + In[j].r = (cmsUInt8Number)r; + In[j].g = (cmsUInt8Number)g; + In[j].b = (cmsUInt8Number)b; + + j++; + } + + atime = clock(); + + cmsDoTransform(ct, hlcmsxform, In, In, 256 * 256 * 256); + + diff = clock() - atime; + free(In); + + cmsDeleteTransform(ct, hlcmsxform); + + return MPixSec(diff); +} + +static +cmsFloat64Number SpeedTest8bitsRGBA(cmsContext ct, cmsHPROFILE hlcmsProfileIn, cmsHPROFILE hlcmsProfileOut) +{ + cmsInt32Number r, g, b, j; + clock_t atime; + cmsFloat64Number diff; + cmsHTRANSFORM hlcmsxform; + Scanline_rgba8bits *In; + cmsUInt32Number Mb; + + if (hlcmsProfileIn == NULL || hlcmsProfileOut == NULL) + Fail("Unable to open profiles"); + + hlcmsxform = cmsCreateTransform(ct, hlcmsProfileIn, TYPE_RGBA_8, hlcmsProfileOut, TYPE_RGBA_8, INTENT_PERCEPTUAL, cmsFLAGS_NOCACHE); + cmsCloseProfile(ct, hlcmsProfileIn); + cmsCloseProfile(ct, hlcmsProfileOut); + + Mb = 256 * 256 * 256 * sizeof(Scanline_rgba8bits); + In = (Scanline_rgba8bits*)malloc(Mb); + + j = 0; + for (r = 0; r < 256; r++) + for (g = 0; g < 256; g++) + for (b = 0; b < 256; b++) { + + In[j].r = (cmsUInt8Number)r; + In[j].g = (cmsUInt8Number)g; + In[j].b = (cmsUInt8Number)b; + In[j].a = 0; + + j++; + } + + atime = clock(); + + cmsDoTransform(ct, hlcmsxform, In, In, 256 * 256 * 256); + + diff = clock() - atime; + free(In); + + cmsDeleteTransform(ct, hlcmsxform); + return MPixSec(diff); + +} + + +// The worst case is used, no cache and all rgb combinations +static +cmsFloat64Number SpeedTest15bitsRGB(cmsContext ct, cmsHPROFILE hlcmsProfileIn, cmsHPROFILE hlcmsProfileOut) +{ + cmsInt32Number r, g, b, j; + clock_t atime; + cmsFloat64Number diff; + cmsHTRANSFORM hlcmsxform; + Scanline_rgb15bits *In; + cmsUInt32Number Mb; + + if (hlcmsProfileIn == NULL || hlcmsProfileOut == NULL) + Fail("Unable to open profiles"); + + hlcmsxform = cmsCreateTransform(ct, hlcmsProfileIn, TYPE_RGB_15, hlcmsProfileOut, TYPE_RGB_15, INTENT_PERCEPTUAL, cmsFLAGS_NOCACHE); + cmsCloseProfile(ct, hlcmsProfileIn); + cmsCloseProfile(ct, hlcmsProfileOut); + + Mb = 256 * 256 * 256 * sizeof(Scanline_rgb15bits); + In = (Scanline_rgb15bits*)malloc(Mb); + + j = 0; + for (r = 0; r < 256; r++) + for (g = 0; g < 256; g++) + for (b = 0; b < 256; b++) { + + In[j].r = (cmsUInt16Number)r; + In[j].g = (cmsUInt16Number)g; + In[j].b = (cmsUInt16Number)b; + + j++; + } + + atime = clock(); + + cmsDoTransform(ct, hlcmsxform, In, In, 256 * 256 * 256); + + diff = clock() - atime; + free(In); + + cmsDeleteTransform(ct, hlcmsxform); + + return MPixSec(diff); +} + +static +cmsFloat64Number SpeedTest15bitsRGBA(cmsContext ct, cmsHPROFILE hlcmsProfileIn, cmsHPROFILE hlcmsProfileOut) +{ + cmsInt32Number r, g, b, j; + clock_t atime; + cmsFloat64Number diff; + cmsHTRANSFORM hlcmsxform; + Scanline_rgba15bits *In; + cmsUInt32Number Mb; + + if (hlcmsProfileIn == NULL || hlcmsProfileOut == NULL) + Fail("Unable to open profiles"); + + hlcmsxform = cmsCreateTransform(ct, hlcmsProfileIn, TYPE_RGBA_15, hlcmsProfileOut, TYPE_RGBA_15, INTENT_PERCEPTUAL, cmsFLAGS_NOCACHE); + cmsCloseProfile(ct, hlcmsProfileIn); + cmsCloseProfile(ct, hlcmsProfileOut); + + Mb = 256 * 256 * 256 * sizeof(Scanline_rgba15bits); + In = (Scanline_rgba15bits*)malloc(Mb); + + j = 0; + for (r = 0; r < 256; r++) + for (g = 0; g < 256; g++) + for (b = 0; b < 256; b++) { + + In[j].r = (cmsUInt16Number)r; + In[j].g = (cmsUInt16Number)g; + In[j].b = (cmsUInt16Number)b; + In[j].a = 0; + + j++; + } + + atime = clock(); + + cmsDoTransform(ct, hlcmsxform, In, In, 256 * 256 * 256); + + diff = clock() - atime; + free(In); + + cmsDeleteTransform(ct, hlcmsxform); + return MPixSec(diff); + +} + +static +cmsFloat64Number SpeedTest15bitsCMYK(cmsContext ct, cmsHPROFILE hlcmsProfileIn, cmsHPROFILE hlcmsProfileOut) +{ + + cmsInt32Number r, g, b, j; + clock_t atime; + cmsFloat64Number diff; + cmsHTRANSFORM hlcmsxform; + Scanline_cmyk15bits *In; + cmsUInt32Number Mb; + + if (hlcmsProfileIn == NULL || hlcmsProfileOut == NULL) + Fail("Unable to open profiles"); + + hlcmsxform = cmsCreateTransform(ct, hlcmsProfileIn, TYPE_CMYK_15, hlcmsProfileOut, TYPE_CMYK_15, INTENT_PERCEPTUAL, cmsFLAGS_NOCACHE); + cmsCloseProfile(ct, hlcmsProfileIn); + cmsCloseProfile(ct, hlcmsProfileOut); + + Mb = 256 * 256 * 256 * sizeof(Scanline_cmyk15bits); + In = (Scanline_cmyk15bits*)malloc(Mb); + + j = 0; + for (r = 0; r < 256; r++) + for (g = 0; g < 256; g++) + for (b = 0; b < 256; b++) { + + In[j].r = (cmsUInt16Number)r; + In[j].g = (cmsUInt16Number)g; + In[j].b = (cmsUInt16Number)b; + In[j].a = (cmsUInt16Number)0; + + j++; + } + + atime = clock(); + + cmsDoTransform(ct, hlcmsxform, In, In, 256 * 256 * 256); + + diff = clock() - atime; + free(In); + + cmsDeleteTransform(ct, hlcmsxform); + return MPixSec(diff); +} + +// The worst case is used, no cache and all rgb combinations +static +cmsFloat64Number SpeedTest16bitsRGB(cmsContext ct, cmsHPROFILE hlcmsProfileIn, cmsHPROFILE hlcmsProfileOut) +{ + cmsInt32Number r, g, b, j; + clock_t atime; + cmsFloat64Number diff; + cmsHTRANSFORM hlcmsxform; + Scanline_rgb16bits *In; + cmsUInt32Number Mb; + + if (hlcmsProfileIn == NULL || hlcmsProfileOut == NULL) + Fail("Unable to open profiles"); + + hlcmsxform = cmsCreateTransform(ct, hlcmsProfileIn, TYPE_RGB_16, hlcmsProfileOut, TYPE_RGB_16, INTENT_PERCEPTUAL, cmsFLAGS_NOCACHE); + cmsCloseProfile(ct, hlcmsProfileIn); + cmsCloseProfile(ct, hlcmsProfileOut); + + Mb = 256 * 256 * 256 * sizeof(Scanline_rgb16bits); + In = (Scanline_rgb16bits*)malloc(Mb); + + j = 0; + for (r = 0; r < 256; r++) + for (g = 0; g < 256; g++) + for (b = 0; b < 256; b++) { + + In[j].r = (cmsUInt16Number)FROM_8_TO_16(r); + In[j].g = (cmsUInt16Number)FROM_8_TO_16(g); + In[j].b = (cmsUInt16Number)FROM_8_TO_16(b); + + j++; + } + + atime = clock(); + + cmsDoTransform(ct, hlcmsxform, In, In, 256 * 256 * 256); + + diff = clock() - atime; + free(In); + + cmsDeleteTransform(ct, hlcmsxform); + + return MPixSec(diff); +} + + +static +void SpeedTest8(cmsContext ct) +{ + printf("\n\nP E R F O R M A N C E T E S T S 8 B I T S\n"); + printf( "==============================================\n\n"); + + PerformanceHeader(); + Performance("8 bits on CLUT profiles ", SpeedTest8bitsRGB, ct, "test5.icc", "test3.icc", sizeof(Scanline_rgb8bits), 0); + Performance("8 bits on Matrix-Shaper profiles", SpeedTest8bitsRGB, ct, "test5.icc", "test0.icc", sizeof(Scanline_rgb8bits), 0); + Performance("8 bits on same Matrix-Shaper ", SpeedTest8bitsRGB, ct, "test0.icc", "test0.icc", sizeof(Scanline_rgb8bits), 0); + Performance("8 bits on curves ", SpeedTest8bitsRGB, ct, NULL, NULL, sizeof(Scanline_rgb8bits), 0); + // Performance("8 bits on CMYK CLUT profiles ", SpeedTest8bitsCMYK, ct, "test1.icc", "test2.icc", sizeof(Scanline_rgba15bits), 0); +} + + +static +void SpeedTest15(cmsContext ct) +{ + printf("\n\nP E R F O R M A N C E T E S T S 1 5 B I T S\n"); + printf( "================================================\n\n"); + + PerformanceHeader(); + Performance("15 bits on CLUT profiles ", SpeedTest15bitsRGB, ct, "test5.icc", "test3.icc", sizeof(Scanline_rgb15bits), 0); + Performance("15 bits on Matrix-Shaper profiles", SpeedTest15bitsRGB, ct, "test5.icc", "test0.icc", sizeof(Scanline_rgb15bits), 0); + Performance("15 bits on same Matrix-Shaper ", SpeedTest15bitsRGB, ct, "test0.icc", "test0.icc", sizeof(Scanline_rgb15bits), 0); + Performance("15 bits on curves ", SpeedTest15bitsRGB, ct, NULL, NULL, sizeof(Scanline_rgb15bits), 0); + Performance("15 bits on CMYK CLUT profiles ", SpeedTest15bitsCMYK, ct, "test1.icc", "test2.icc", sizeof(Scanline_rgba15bits), 0); +} + +static +void SpeedTest16(cmsContext ct) +{ + printf("\n\nP E R F O R M A N C E T E S T S 1 6 B I T S\n"); + printf("================================================\n\n"); + + PerformanceHeader(); + Performance("16 bits on CLUT profiles ", SpeedTest16bitsRGB, ct, "test5.icc", "test3.icc", sizeof(Scanline_rgb15bits), 0); + +} + +// The worst case is used, no cache and all rgb combinations +static +cmsFloat64Number SpeedTestFloatRGB(cmsContext ct, cmsHPROFILE hlcmsProfileIn, cmsHPROFILE hlcmsProfileOut) +{ + cmsInt32Number r, g, b, j; + clock_t atime; + cmsFloat64Number diff; + cmsHTRANSFORM hlcmsxform; + Scanline_rgbFloat *In; + cmsUInt32Number Mb; + + if (hlcmsProfileIn == NULL || hlcmsProfileOut == NULL) + Fail("Unable to open profiles"); + + hlcmsxform = cmsCreateTransform(ct, hlcmsProfileIn, TYPE_RGB_FLT, hlcmsProfileOut, TYPE_RGB_FLT, INTENT_PERCEPTUAL, cmsFLAGS_NOCACHE); + cmsCloseProfile(ct, hlcmsProfileIn); + cmsCloseProfile(ct, hlcmsProfileOut); + + Mb = 256 * 256 * 256 * sizeof(Scanline_rgbFloat); + In = (Scanline_rgbFloat*)malloc(Mb); + + j = 0; + for (r = 0; r < 256; r++) + for (g = 0; g < 256; g++) + for (b = 0; b < 256; b++) { + + In[j].r = (cmsFloat32Number)r / 255.0f; + In[j].g = (cmsFloat32Number)g / 255.0f; + In[j].b = (cmsFloat32Number)b / 255.0f; + + j++; + } + + atime = clock(); + + cmsDoTransform(ct, hlcmsxform, In, In, 256 * 256 * 256); + + diff = clock() - atime; + free(In); + + cmsDeleteTransform(ct, hlcmsxform); + return MPixSec(diff); +} + + + + +static +void SpeedTestFloat(cmsContext noPlugin, cmsContext plugin) +{ + cmsFloat64Number t[10]; + + printf("\n\n"); + printf("P E R F O R M A N C E T E S T S F L O A T (D E F A U L T)\n"); + printf("==============================================================\n\n"); + fflush(stdout); + + PerformanceHeader(); + t[0] = Performance("Floating point on CLUT profiles ", SpeedTestFloatRGB, noPlugin, "test5.icc", "test3.icc", sizeof(Scanline_rgbFloat), 0); + t[1] = Performance("Floating point on Matrix-Shaper ", SpeedTestFloatRGB, noPlugin, "test5.icc", "test0.icc", sizeof(Scanline_rgbFloat), 0); + t[2] = Performance("Floating point on same MatrixSh ", SpeedTestFloatRGB, noPlugin, "test0.icc", "test0.icc", sizeof(Scanline_rgbFloat), 0); + t[3] = Performance("Floating point on curves ", SpeedTestFloatRGB, noPlugin, NULL, NULL, sizeof(Scanline_rgbFloat), 0); + + // Note that context 0 has the plug-in installed + + printf("\n\n"); + printf("P E R F O R M A N C E T E S T S F L O A T (P L U G I N)\n"); + printf("===========================================================\n\n"); + fflush(stdout); + + PerformanceHeader(); + Performance("Floating point on CLUT profiles ", SpeedTestFloatRGB, plugin, "test5.icc", "test3.icc", sizeof(Scanline_rgbFloat), t[0]); + Performance("Floating point on Matrix-Shaper ", SpeedTestFloatRGB, plugin, "test5.icc", "test0.icc", sizeof(Scanline_rgbFloat), t[1]); + Performance("Floating point on same MatrixSh ", SpeedTestFloatRGB, plugin, "test0.icc", "test0.icc", sizeof(Scanline_rgbFloat), t[2]); + Performance("Floating point on curves ", SpeedTestFloatRGB, plugin, NULL, NULL, sizeof(Scanline_rgbFloat), t[3]); +} + + +static +cmsFloat64Number SpeedTestFloatByUsing16BitsRGB(cmsContext ct, cmsHPROFILE hlcmsProfileIn, cmsHPROFILE hlcmsProfileOut) +{ + cmsInt32Number r, g, b, j; + clock_t atime; + cmsFloat64Number diff; + cmsHTRANSFORM xform16; + Scanline_rgbFloat *In; + Scanline_rgb16bits *tmp16; + cmsUInt32Number MbFloat, Mb16; + + UNUSED_PARAMETER(ct); + + if (hlcmsProfileIn == NULL || hlcmsProfileOut == NULL) + Fail("Unable to open profiles"); + + xform16 = cmsCreateTransform(ct, hlcmsProfileIn, TYPE_RGB_16, hlcmsProfileOut, TYPE_RGB_16, INTENT_PERCEPTUAL, cmsFLAGS_NOCACHE); + + cmsCloseProfile(ct, hlcmsProfileIn); + cmsCloseProfile(ct, hlcmsProfileOut); + + MbFloat = 256 * 256 * 256 * sizeof(Scanline_rgbFloat); + Mb16 = 256 * 256 * 256 * sizeof(Scanline_rgb16bits); + + In = (Scanline_rgbFloat*)malloc(MbFloat); + tmp16 = (Scanline_rgb16bits*)malloc(Mb16); + + + j = 0; + for (r = 0; r < 256; r++) + for (g = 0; g < 256; g++) + for (b = 0; b < 256; b++) { + + In[j].r = (cmsFloat32Number)r / 255.0f; + In[j].g = (cmsFloat32Number)g / 255.0f; + In[j].b = (cmsFloat32Number)b / 255.0f; + + j++; + } + + + atime = clock(); + + + for (j = 0; j < 256 * 256 * 256; j++) { + + tmp16[j].r = (cmsUInt16Number)floor(In[j].r * 65535.0 + 0.5); + tmp16[j].g = (cmsUInt16Number)floor(In[j].g * 65535.0 + 0.5); + tmp16[j].b = (cmsUInt16Number)floor(In[j].b * 65535.0 + 0.5); + + j++; + } + + cmsDoTransform(ct, xform16, tmp16, tmp16, 256 * 256 * 256); + + for (j = 0; j < 256 * 256 * 256; j++) { + + In[j].r = (cmsFloat32Number) (tmp16[j].r / 65535.0 ); + In[j].g = (cmsFloat32Number) (tmp16[j].g / 65535.0); + In[j].b = (cmsFloat32Number) (tmp16[j].b / 65535.0); + + j++; + } + + diff = clock() - atime; + free(In); + + cmsDeleteTransform(ct, xform16); + return MPixSec(diff); +} + + + + + +static +void ComparativeFloatVs16bits(cmsContext Raw, cmsContext Plugin) +{ + printf("\n\n"); + printf("C O M P A R A T I V E converting to 16 bit vs. using float plug-in.\n"); + printf(" values given in MegaPixels per second.\n"); + printf("====================================================================\n"); + printf(" 16 bits tmp. Float plugin\n"); + fflush(stdout); + + Comparative(Raw, Plugin, "Floating point on CLUT profiles ", SpeedTestFloatByUsing16BitsRGB, SpeedTestFloatRGB, "test5.icc", "test3.icc"); + Comparative(Raw, Plugin, "Floating point on Matrix-Shaper ", SpeedTestFloatByUsing16BitsRGB, SpeedTestFloatRGB, "test5.icc", "test0.icc"); + Comparative(Raw, Plugin, "Floating point on same MatrixSh ", SpeedTestFloatByUsing16BitsRGB, SpeedTestFloatRGB, "test0.icc", "test0.icc"); + Comparative(Raw, Plugin, "Floating point on curves ", SpeedTestFloatByUsing16BitsRGB, SpeedTestFloatRGB, NULL, NULL); +} + + + + + + + +typedef struct +{ + Scanline_rgba8bits pixels[256][256]; + cmsUInt8Number padding[4]; + +} padded_line; + +typedef struct +{ + padded_line line[256]; +} big_bitmap; + + +static +cmsFloat64Number SpeedTest8bitDoTransform(cmsContext ct, cmsHPROFILE hlcmsProfileIn, cmsHPROFILE hlcmsProfileOut) +{ + cmsInt32Number r, g, b, j; + clock_t atime; + cmsFloat64Number diff; + cmsHTRANSFORM hlcmsxform; + big_bitmap* In; + big_bitmap* Out; + cmsUInt32Number Mb; + + if (hlcmsProfileIn == NULL || hlcmsProfileOut == NULL) + Fail("Unable to open profiles"); + + hlcmsxform = cmsCreateTransform(ct, hlcmsProfileIn, TYPE_RGBA_8, hlcmsProfileOut, TYPE_RGBA_8, INTENT_PERCEPTUAL, cmsFLAGS_NOCACHE); + cmsCloseProfile(ct, hlcmsProfileIn); + cmsCloseProfile(ct, hlcmsProfileOut); + + + // Our test bitmap is 256 x 256 padded lines + Mb = sizeof(big_bitmap); + + In = (big_bitmap*)malloc(Mb); + Out = (big_bitmap*)malloc(Mb); + + for (r = 0; r < 256; r++) + for (g = 0; g < 256; g++) + for (b = 0; b < 256; b++) { + + In->line[r].pixels[g][b].r = (cmsUInt8Number)r; + In->line[r].pixels[g][b].g = (cmsUInt8Number)g; + In->line[r].pixels[g][b].b = (cmsUInt8Number)b; + In->line[r].pixels[g][b].a = 0; + } + + atime = clock(); + + for (j = 0; j < 256; j++) { + + cmsDoTransform(ct, hlcmsxform, In->line[j].pixels, Out->line[j].pixels, 256 * 256); + } + + diff = clock() - atime; + free(In); free(Out); + + cmsDeleteTransform(ct, hlcmsxform); + return MPixSec(diff); + +} + + +static +cmsFloat64Number SpeedTest8bitLineStride(cmsContext ct, cmsHPROFILE hlcmsProfileIn, cmsHPROFILE hlcmsProfileOut) +{ + cmsInt32Number r, g, b; + clock_t atime; + cmsFloat64Number diff; + cmsHTRANSFORM hlcmsxform; + big_bitmap* In; + big_bitmap* Out; + cmsUInt32Number Mb; + + if (hlcmsProfileIn == NULL || hlcmsProfileOut == NULL) + Fail("Unable to open profiles"); + + hlcmsxform = cmsCreateTransform(ct, hlcmsProfileIn, TYPE_RGBA_8, hlcmsProfileOut, TYPE_RGBA_8, INTENT_PERCEPTUAL, cmsFLAGS_NOCACHE); + cmsCloseProfile(ct, hlcmsProfileIn); + cmsCloseProfile(ct, hlcmsProfileOut); + + + // Our test bitmap is 256 x 256 padded lines + Mb = sizeof(big_bitmap); + + In = (big_bitmap*)malloc(Mb); + Out = (big_bitmap*)malloc(Mb); + + for (r = 0; r < 256; r++) + for (g = 0; g < 256; g++) + for (b = 0; b < 256; b++) { + + In->line[r].pixels[g][b].r = (cmsUInt8Number)r; + In->line[r].pixels[g][b].g = (cmsUInt8Number)g; + In->line[r].pixels[g][b].b = (cmsUInt8Number)b; + In->line[r].pixels[g][b].a = 0; + } + + atime = clock(); + + cmsDoTransformLineStride(ct, hlcmsxform, In, Out, 256*256, 256, sizeof(padded_line), sizeof(padded_line), 0, 0); + + diff = clock() - atime; + free(In); free(Out); + + cmsDeleteTransform(ct, hlcmsxform); + return MPixSec(diff); + +} + +static +void ComparativeLineStride8bits(cmsContext NoPlugin, cmsContext Plugin) +{ + printf("\n\n"); + printf("C O M P A R A T I V E cmsDoTransform() vs. cmsDoTransformLineStride()\n"); + printf(" values given in MegaPixels per second.\n"); + printf("====================================================================\n"); + + fflush(stdout); + + ComparativeCt(NoPlugin, Plugin, "CLUT profiles ", SpeedTest8bitDoTransform, SpeedTest8bitLineStride, "test5.icc", "test3.icc"); + ComparativeCt(NoPlugin, Plugin, "CLUT 16 bits ", SpeedTest16bitsRGB, SpeedTest16bitsRGB, "test5.icc", "test3.icc"); + ComparativeCt(NoPlugin, Plugin, "Matrix-Shaper ", SpeedTest8bitDoTransform, SpeedTest8bitLineStride, "test5.icc", "test0.icc"); + ComparativeCt(NoPlugin, Plugin, "same MatrixSh ", SpeedTest8bitDoTransform, SpeedTest8bitLineStride, "test0.icc", "test0.icc"); + ComparativeCt(NoPlugin, Plugin, "curves ", SpeedTest8bitDoTransform, SpeedTest8bitLineStride, NULL, NULL); +} + + + +static +void TestGrayTransformPerformance(cmsContext ct) +{ + cmsInt32Number j; + clock_t atime; + cmsFloat64Number diff; + cmsHTRANSFORM hlcmsxform; + float *In; + + cmsInt32Number pixels; + cmsUInt32Number Mb; + cmsToneCurve* gamma18; + cmsToneCurve* gamma22; + + cmsHPROFILE hlcmsProfileIn; + cmsHPROFILE hlcmsProfileOut; + + gamma18 = cmsBuildGamma(ct, 1.8); + gamma22 = cmsBuildGamma(ct, 2.2); + + hlcmsProfileIn = cmsCreateGrayProfile(ct, NULL, gamma18); + hlcmsProfileOut = cmsCreateGrayProfile(ct, NULL, gamma22); + + + cmsFreeToneCurve(ct, gamma18); + cmsFreeToneCurve(ct, gamma22); + + hlcmsxform = cmsCreateTransform(ct, hlcmsProfileIn, TYPE_GRAY_FLT | EXTRA_SH(1), hlcmsProfileOut, TYPE_GRAY_FLT|EXTRA_SH(1), INTENT_PERCEPTUAL, 0); + cmsCloseProfile(ct, hlcmsProfileIn); + cmsCloseProfile(ct, hlcmsProfileOut); + + pixels = 256 * 256 * 256; + Mb = pixels* 2*sizeof(float); + In = malloc(Mb); + + for (j = 0; j < pixels*2; j++) + In[j] = (j % 256) / 255.0f; + + atime = clock(); + + cmsDoTransform(ct, hlcmsxform, In, In, pixels); + + diff = clock() - atime; + free(In); + + cmsDeleteTransform(ct, hlcmsxform); + printf("Gray conversion using two gray profiles\t %-12.2f MPixels/Sec.\n", MPixSec(diff)); +} + +static +void TestGrayTransformPerformance1(cmsContext ct) +{ + cmsInt32Number j; + clock_t atime; + cmsFloat64Number diff; + cmsHTRANSFORM hlcmsxform; + float *In; + + cmsInt32Number pixels; + cmsUInt32Number Mb; + cmsToneCurve* gamma18; + cmsToneCurve* gamma22; + + cmsHPROFILE hlcmsProfileIn; + cmsHPROFILE hlcmsProfileOut; + + gamma18 = cmsBuildGamma(ct, 1.8); + gamma22 = cmsBuildGamma(ct, 1./2.2); + + hlcmsProfileIn = cmsCreateLinearizationDeviceLink(ct, cmsSigGrayData, &gamma18); + hlcmsProfileOut = cmsCreateLinearizationDeviceLink(ct, cmsSigGrayData, &gamma22); + + + cmsFreeToneCurve(ct, gamma18); + cmsFreeToneCurve(ct, gamma22); + + hlcmsxform = cmsCreateTransform(ct, hlcmsProfileIn, TYPE_GRAY_FLT, hlcmsProfileOut, TYPE_GRAY_FLT, INTENT_PERCEPTUAL, 0); + cmsCloseProfile(ct, hlcmsProfileIn); + cmsCloseProfile(ct, hlcmsProfileOut); + + pixels = 256 * 256 * 256; + Mb = pixels* sizeof(float); + In = malloc(Mb); + + for (j = 0; j < pixels; j++) + In[j] = (j % 256) / 255.0f; + + atime = clock(); + + cmsDoTransform(ct, hlcmsxform, In, In, pixels); + + diff = clock() - atime; + free(In); + + cmsDeleteTransform(ct, hlcmsxform); + printf("Gray conversion using two devicelinks\t %-12.2f MPixels/Sec.\n", MPixSec(diff)); +} + + +// The harness test +int main() +{ + cmsContext raw = cmsCreateContext(NULL, NULL); + cmsContext plugin = cmsCreateContext(NULL, NULL); + + printf("FastFloating point extensions testbed - 1.2\n"); + printf("Copyright (c) 1998-2020 Marti Maria Saguer, all rights reserved\n"); + + printf("\nInstalling error logger ... "); + cmsSetLogErrorHandler(raw, FatalErrorQuit); + cmsSetLogErrorHandler(plugin, FatalErrorQuit); + printf("done.\n"); + + printf("Installing plug-in ... "); + cmsPlugin(plugin, cmsFastFloatExtensions()); + printf("done.\n\n"); + + CheckLab2Roundtrip(plugin); + + CheckComputeIncrements(); + + // 15 bit functionality + CheckFormatters15(); + Check15bitsConversions(plugin); + + // 16 bits functionality + CheckAccuracy16Bits(raw, plugin); + + // Change format + CheckChangeFormat(plugin); + + // Floating point functionality + CheckConversionFloat(raw, plugin); + printf("All floating point tests passed OK\n"); + + SpeedTest8(plugin); + SpeedTest16(plugin); + SpeedTest15(plugin); + SpeedTestFloat(raw, plugin); + + + ComparativeFloatVs16bits(raw, plugin); + ComparativeLineStride8bits(raw, plugin); + + // Test gray performance + printf("\n\n"); + printf("F L O A T G R A Y conversions performance.\n"); + printf("====================================================================\n"); + TestGrayTransformPerformance(plugin); + TestGrayTransformPerformance1(plugin); + + printf("\nAll tests passed OK\n"); + + + return 0; +} diff --git a/lcms2mt/plugins/fast_float/testbed/test0.icc b/lcms2mt/plugins/fast_float/testbed/test0.icc Binary files differnew file mode 100644 index 00000000..a79f576b --- /dev/null +++ b/lcms2mt/plugins/fast_float/testbed/test0.icc diff --git a/lcms2mt/plugins/fast_float/testbed/test1.icc b/lcms2mt/plugins/fast_float/testbed/test1.icc Binary files differnew file mode 100644 index 00000000..d0245c81 --- /dev/null +++ b/lcms2mt/plugins/fast_float/testbed/test1.icc diff --git a/lcms2mt/plugins/fast_float/testbed/test2.icc b/lcms2mt/plugins/fast_float/testbed/test2.icc Binary files differnew file mode 100644 index 00000000..73f1b5aa --- /dev/null +++ b/lcms2mt/plugins/fast_float/testbed/test2.icc diff --git a/lcms2mt/plugins/fast_float/testbed/test3.icc b/lcms2mt/plugins/fast_float/testbed/test3.icc Binary files differnew file mode 100644 index 00000000..d0e79301 --- /dev/null +++ b/lcms2mt/plugins/fast_float/testbed/test3.icc diff --git a/lcms2mt/plugins/fast_float/testbed/test5.icc b/lcms2mt/plugins/fast_float/testbed/test5.icc Binary files differnew file mode 100644 index 00000000..34583ab1 --- /dev/null +++ b/lcms2mt/plugins/fast_float/testbed/test5.icc diff --git a/lcms2mt/src/Makefile.am b/lcms2mt/src/Makefile.am index 227d79d8..47cee978 100644 --- a/lcms2mt/src/Makefile.am +++ b/lcms2mt/src/Makefile.am @@ -10,7 +10,7 @@ AUTOMAKE_OPTIONS = 1.7 foreign includedir = ${prefix}/include # Shared libraries built in this directory -lib_LTLIBRARIES = liblcms2.la +lib_LTLIBRARIES = liblcms2mt.la LIBRARY_CURRENT = @LIBRARY_CURRENT@ LIBRARY_REVISION = @LIBRARY_REVISION@ @@ -18,12 +18,12 @@ LIBRARY_AGE = @LIBRARY_AGE@ AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include -liblcms2_la_LDFLAGS = -no-undefined \ +liblcms2mt_la_LDFLAGS = -no-undefined \ -version-info $(LIBRARY_CURRENT):$(LIBRARY_REVISION):$(LIBRARY_AGE) -liblcms2_la_LIBADD = $(LCMS_LIB_DEPLIBS) +liblcms2mt_la_LIBADD = $(LCMS_LIB_DEPLIBS) -liblcms2_la_SOURCES = \ +liblcms2mt_la_SOURCES = \ cmscnvrt.c cmserr.c cmsgamma.c cmsgmt.c cmsintrp.c cmsio0.c cmsio1.c cmslut.c \ cmsplugin.c cmssm.c cmsmd5.c cmsmtrx.c cmspack.c cmspcs.c cmswtpnt.c cmsxform.c \ cmssamp.c cmsnamed.c cmscam02.c cmsvirt.c cmstypes.c cmscgats.c cmsps2.c cmsopt.c \ diff --git a/lcms2mt/src/Makefile.in b/lcms2mt/src/Makefile.in index 1a606e44..f161d9d6 100644 --- a/lcms2mt/src/Makefile.in +++ b/lcms2mt/src/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -139,21 +139,21 @@ am__uninstall_files_from_dir = { \ am__installdirs = "$(DESTDIR)$(libdir)" LTLIBRARIES = $(lib_LTLIBRARIES) am__DEPENDENCIES_1 = -liblcms2_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am_liblcms2_la_OBJECTS = cmscnvrt.lo cmserr.lo cmsgamma.lo cmsgmt.lo \ +liblcms2mt_la_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_liblcms2mt_la_OBJECTS = cmscnvrt.lo cmserr.lo cmsgamma.lo cmsgmt.lo \ cmsintrp.lo cmsio0.lo cmsio1.lo cmslut.lo cmsplugin.lo \ cmssm.lo cmsmd5.lo cmsmtrx.lo cmspack.lo cmspcs.lo cmswtpnt.lo \ cmsxform.lo cmssamp.lo cmsnamed.lo cmscam02.lo cmsvirt.lo \ cmstypes.lo cmscgats.lo cmsps2.lo cmsopt.lo cmshalf.lo \ cmsalpha.lo -liblcms2_la_OBJECTS = $(am_liblcms2_la_OBJECTS) +liblcms2mt_la_OBJECTS = $(am_liblcms2mt_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = -liblcms2_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ +liblcms2mt_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(liblcms2_la_LDFLAGS) $(LDFLAGS) -o $@ + $(liblcms2mt_la_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false @@ -168,7 +168,21 @@ am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/cmsalpha.Plo \ + ./$(DEPDIR)/cmscam02.Plo ./$(DEPDIR)/cmscgats.Plo \ + ./$(DEPDIR)/cmscnvrt.Plo ./$(DEPDIR)/cmserr.Plo \ + ./$(DEPDIR)/cmsgamma.Plo ./$(DEPDIR)/cmsgmt.Plo \ + ./$(DEPDIR)/cmshalf.Plo ./$(DEPDIR)/cmsintrp.Plo \ + ./$(DEPDIR)/cmsio0.Plo ./$(DEPDIR)/cmsio1.Plo \ + ./$(DEPDIR)/cmslut.Plo ./$(DEPDIR)/cmsmd5.Plo \ + ./$(DEPDIR)/cmsmtrx.Plo ./$(DEPDIR)/cmsnamed.Plo \ + ./$(DEPDIR)/cmsopt.Plo ./$(DEPDIR)/cmspack.Plo \ + ./$(DEPDIR)/cmspcs.Plo ./$(DEPDIR)/cmsplugin.Plo \ + ./$(DEPDIR)/cmsps2.Plo ./$(DEPDIR)/cmssamp.Plo \ + ./$(DEPDIR)/cmssm.Plo ./$(DEPDIR)/cmstypes.Plo \ + ./$(DEPDIR)/cmsvirt.Plo ./$(DEPDIR)/cmswtpnt.Plo \ + ./$(DEPDIR)/cmsxform.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -188,8 +202,8 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = -SOURCES = $(liblcms2_la_SOURCES) -DIST_SOURCES = $(liblcms2_la_SOURCES) +SOURCES = $(liblcms2mt_la_SOURCES) +DIST_SOURCES = $(liblcms2mt_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -363,13 +377,13 @@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = 1.7 foreign # Shared libraries built in this directory -lib_LTLIBRARIES = liblcms2.la +lib_LTLIBRARIES = liblcms2mt.la AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include -liblcms2_la_LDFLAGS = -no-undefined \ +liblcms2mt_la_LDFLAGS = -no-undefined \ -version-info $(LIBRARY_CURRENT):$(LIBRARY_REVISION):$(LIBRARY_AGE) -liblcms2_la_LIBADD = $(LCMS_LIB_DEPLIBS) -liblcms2_la_SOURCES = \ +liblcms2mt_la_LIBADD = $(LCMS_LIB_DEPLIBS) +liblcms2mt_la_SOURCES = \ cmscnvrt.c cmserr.c cmsgamma.c cmsgmt.c cmsintrp.c cmsio0.c cmsio1.c cmslut.c \ cmsplugin.c cmssm.c cmsmd5.c cmsmtrx.c cmspack.c cmspcs.c cmswtpnt.c cmsxform.c \ cmssamp.c cmsnamed.c cmscam02.c cmsvirt.c cmstypes.c cmscgats.c cmsps2.c cmsopt.c \ @@ -396,8 +410,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -444,8 +458,8 @@ clean-libLTLIBRARIES: rm -f $${locs}; \ } -liblcms2.la: $(liblcms2_la_OBJECTS) $(liblcms2_la_DEPENDENCIES) $(EXTRA_liblcms2_la_DEPENDENCIES) - $(AM_V_CCLD)$(liblcms2_la_LINK) -rpath $(libdir) $(liblcms2_la_OBJECTS) $(liblcms2_la_LIBADD) $(LIBS) +liblcms2mt.la: $(liblcms2mt_la_OBJECTS) $(liblcms2mt_la_DEPENDENCIES) $(EXTRA_liblcms2mt_la_DEPENDENCIES) + $(AM_V_CCLD)$(liblcms2mt_la_LINK) -rpath $(libdir) $(liblcms2mt_la_OBJECTS) $(liblcms2mt_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -453,32 +467,38 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmsalpha.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmscam02.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmscgats.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmscnvrt.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmserr.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmsgamma.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmsgmt.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmshalf.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmsintrp.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmsio0.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmsio1.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmslut.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmsmd5.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmsmtrx.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmsnamed.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmsopt.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmspack.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmspcs.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmsplugin.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmsps2.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmssamp.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmssm.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmstypes.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmsvirt.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmswtpnt.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmsxform.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmsalpha.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmscam02.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmscgats.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmscnvrt.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmserr.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmsgamma.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmsgmt.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmshalf.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmsintrp.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmsio0.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmsio1.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmslut.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmsmd5.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmsmtrx.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmsnamed.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmsopt.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmspack.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmspcs.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmsplugin.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmsps2.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmssamp.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmssm.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmstypes.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmsvirt.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmswtpnt.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmsxform.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @@ -562,7 +582,10 @@ cscopelist-am: $(am__tagged_files) distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -635,7 +658,32 @@ clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ mostlyclean-am distclean: distclean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/cmsalpha.Plo + -rm -f ./$(DEPDIR)/cmscam02.Plo + -rm -f ./$(DEPDIR)/cmscgats.Plo + -rm -f ./$(DEPDIR)/cmscnvrt.Plo + -rm -f ./$(DEPDIR)/cmserr.Plo + -rm -f ./$(DEPDIR)/cmsgamma.Plo + -rm -f ./$(DEPDIR)/cmsgmt.Plo + -rm -f ./$(DEPDIR)/cmshalf.Plo + -rm -f ./$(DEPDIR)/cmsintrp.Plo + -rm -f ./$(DEPDIR)/cmsio0.Plo + -rm -f ./$(DEPDIR)/cmsio1.Plo + -rm -f ./$(DEPDIR)/cmslut.Plo + -rm -f ./$(DEPDIR)/cmsmd5.Plo + -rm -f ./$(DEPDIR)/cmsmtrx.Plo + -rm -f ./$(DEPDIR)/cmsnamed.Plo + -rm -f ./$(DEPDIR)/cmsopt.Plo + -rm -f ./$(DEPDIR)/cmspack.Plo + -rm -f ./$(DEPDIR)/cmspcs.Plo + -rm -f ./$(DEPDIR)/cmsplugin.Plo + -rm -f ./$(DEPDIR)/cmsps2.Plo + -rm -f ./$(DEPDIR)/cmssamp.Plo + -rm -f ./$(DEPDIR)/cmssm.Plo + -rm -f ./$(DEPDIR)/cmstypes.Plo + -rm -f ./$(DEPDIR)/cmsvirt.Plo + -rm -f ./$(DEPDIR)/cmswtpnt.Plo + -rm -f ./$(DEPDIR)/cmsxform.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags @@ -681,7 +729,32 @@ install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/cmsalpha.Plo + -rm -f ./$(DEPDIR)/cmscam02.Plo + -rm -f ./$(DEPDIR)/cmscgats.Plo + -rm -f ./$(DEPDIR)/cmscnvrt.Plo + -rm -f ./$(DEPDIR)/cmserr.Plo + -rm -f ./$(DEPDIR)/cmsgamma.Plo + -rm -f ./$(DEPDIR)/cmsgmt.Plo + -rm -f ./$(DEPDIR)/cmshalf.Plo + -rm -f ./$(DEPDIR)/cmsintrp.Plo + -rm -f ./$(DEPDIR)/cmsio0.Plo + -rm -f ./$(DEPDIR)/cmsio1.Plo + -rm -f ./$(DEPDIR)/cmslut.Plo + -rm -f ./$(DEPDIR)/cmsmd5.Plo + -rm -f ./$(DEPDIR)/cmsmtrx.Plo + -rm -f ./$(DEPDIR)/cmsnamed.Plo + -rm -f ./$(DEPDIR)/cmsopt.Plo + -rm -f ./$(DEPDIR)/cmspack.Plo + -rm -f ./$(DEPDIR)/cmspcs.Plo + -rm -f ./$(DEPDIR)/cmsplugin.Plo + -rm -f ./$(DEPDIR)/cmsps2.Plo + -rm -f ./$(DEPDIR)/cmssamp.Plo + -rm -f ./$(DEPDIR)/cmssm.Plo + -rm -f ./$(DEPDIR)/cmstypes.Plo + -rm -f ./$(DEPDIR)/cmsvirt.Plo + -rm -f ./$(DEPDIR)/cmswtpnt.Plo + -rm -f ./$(DEPDIR)/cmsxform.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -702,9 +775,9 @@ uninstall-am: uninstall-libLTLIBRARIES .MAKE: install-am install-strip -.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ - clean-libLTLIBRARIES clean-libtool cscopelist-am ctags \ - ctags-am distclean distclean-compile distclean-generic \ +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libLTLIBRARIES clean-libtool cscopelist-am \ + ctags ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ diff --git a/lcms2mt/src/cmsalpha.c b/lcms2mt/src/cmsalpha.c index e64f9497..697161cc 100644 --- a/lcms2mt/src/cmsalpha.c +++ b/lcms2mt/src/cmsalpha.c @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2017 Marti Maria Saguer +// Copyright (c) 1998-2020 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -359,16 +359,18 @@ int FormatterPos(cmsUInt32Number frm) #endif if (b == 4 && T_FLOAT(frm)) return 4; // FLT - if (b == 2 && !T_FLOAT(frm)) - return 1; // 16 + if (b == 2 && !T_FLOAT(frm)) { + if (T_ENDIAN16(frm)) + return 2; // 16SE + else + return 1; // 16 + } if (b == 1 && !T_FLOAT(frm)) return 0; // 8 - if (b == 2 && T_ENDIAN16(frm)) - return 3; return -1; // not recognized } -// Obtains a alpha-to-alpha funmction formatter +// Obtains an alpha-to-alpha function formatter static cmsFormatterAlphaFn _cmsGetFormatterAlpha(cmsContext id, cmsUInt32Number in, cmsUInt32Number out) { diff --git a/lcms2mt/src/cmscam02.c b/lcms2mt/src/cmscam02.c index d741ee83..76aeb0ea 100644 --- a/lcms2mt/src/cmscam02.c +++ b/lcms2mt/src/cmscam02.c @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2017 Marti Maria Saguer +// Copyright (c) 1998-2020 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), diff --git a/lcms2mt/src/cmscgats.c b/lcms2mt/src/cmscgats.c index 50f7fb8f..3657177d 100644 --- a/lcms2mt/src/cmscgats.c +++ b/lcms2mt/src/cmscgats.c @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2018 Marti Maria Saguer +// Copyright (c) 1998-2020 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -681,8 +681,8 @@ cmsFloat64Number ParseFloatNumber(const char *Buffer) static void InSymbol(cmsContext ContextID, cmsIT8* it8) { - register char *idptr; - register int k; + CMSREGISTER char *idptr; + CMSREGISTER int k; SYMBOL key; int sng; @@ -2166,65 +2166,47 @@ void CookPointers(cmsContext ContextID, cmsIT8* it8) if (cmsstrcasecmp(Fld, "SAMPLE_ID") == 0) { t -> SampleID = idField; - - for (i=0; i < t -> nPatches; i++) { - - char *Data = GetData(ContextID, it8, i, idField); - if (Data) { - char Buffer[256]; - - strncpy(Buffer, Data, 255); - Buffer[255] = 0; - - if (strlen(Buffer) <= strlen(Data)) - strcpy(Data, Buffer); - else - SetData(ContextID, it8, i, idField, Buffer); - - } - } - } // "LABEL" is an extension. It keeps references to forward tables - if ((cmsstrcasecmp(Fld, "LABEL") == 0) || Fld[0] == '$' ) { + if ((cmsstrcasecmp(Fld, "LABEL") == 0) || Fld[0] == '$') { - // Search for table references... - for (i=0; i < t -> nPatches; i++) { + // Search for table references... + for (i = 0; i < t->nPatches; i++) { - char *Label = GetData(ContextID, it8, i, idField); + char *Label = GetData(ContextID, it8, i, idField); - if (Label) { + if (Label) { - cmsUInt32Number k; + cmsUInt32Number k; - // This is the label, search for a table containing - // this property + // This is the label, search for a table containing + // this property - for (k=0; k < it8 ->TablesCount; k++) { + for (k = 0; k < it8->TablesCount; k++) { - TABLE* Table = it8 ->Tab + k; - KEYVALUE* p; + TABLE* Table = it8->Tab + k; + KEYVALUE* p; - if (IsAvailableOnList(ContextID, Table->HeaderList, Label, NULL, &p)) { + if (IsAvailableOnList(ContextID, Table->HeaderList, Label, NULL, &p)) { - // Available, keep type and table - char Buffer[256]; + // Available, keep type and table + char Buffer[256]; - char *Type = p ->Value; - int nTable = (int) k; + char* Type = p->Value; + int nTable = (int)k; - snprintf(Buffer, 255, "%s %d %s", Label, nTable, Type ); + snprintf(Buffer, 255, "%s %d %s", Label, nTable, Type); - SetData(ContextID, it8, i, idField, Buffer); - } - } + SetData(ContextID, it8, i, idField, Buffer); + } + } - } + } - } + } } diff --git a/lcms2mt/src/cmscnvrt.c b/lcms2mt/src/cmscnvrt.c index f29ab5ba..e3a2ddbc 100644 --- a/lcms2mt/src/cmscnvrt.c +++ b/lcms2mt/src/cmscnvrt.c @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2017 Marti Maria Saguer +// Copyright (c) 1998-2020 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -27,19 +27,6 @@ #include "lcms2_internal.h" -// Link several profiles to obtain a single LUT modelling the whole color transform. Intents, Black point -// compensation and Adaptation parameters may vary across profiles. BPC and Adaptation refers to the PCS -// after the profile. I.e, BPC[0] refers to connexion between profile(0) and profile(1) -cmsPipeline* _cmsLinkProfiles(cmsContext ContextID, - cmsUInt32Number nProfiles, - cmsUInt32Number Intents[], - cmsHPROFILE hProfiles[], - cmsBool BPC[], - cmsFloat64Number AdaptationStates[], - cmsUInt32Number dwFlags); - -//--------------------------------------------------------------------------------- - // This is the default routine for ICC-style intents. A user may decide to override it by using a plugin. // Supported intents are perceptual, relative colorimetric, saturation and ICC-absolute colorimetric static @@ -546,8 +533,6 @@ cmsPipeline* DefaultICCintents(cmsContext ContextID, Result = cmsPipelineAlloc(ContextID, 0, 0); if (Result == NULL) return NULL; - ContextID->dwFlags = dwFlags; - CurrentColorSpace = cmsGetColorSpace(ContextID, hProfiles[0]); for (i=0; i < nProfiles; i++) { @@ -655,14 +640,10 @@ cmsPipeline* DefaultICCintents(cmsContext ContextID, } - ContextID->dwFlags = 0; - return Result; Error: - ContextID->dwFlags = 0; - if (Lut != NULL) cmsPipelineFree(ContextID, Lut); if (Result != NULL) cmsPipelineFree(ContextID, Result); return NULL; @@ -717,7 +698,7 @@ typedef struct { // Preserve black only if that is the only ink used static -int BlackPreservingGrayOnlySampler(cmsContext ContextID, register const cmsUInt16Number In[], register cmsUInt16Number Out[], register void* Cargo) +int BlackPreservingGrayOnlySampler(cmsContext ContextID, CMSREGISTER const cmsUInt16Number In[], CMSREGISTER cmsUInt16Number Out[], CMSREGISTER void* Cargo) { GrayOnlyParams* bp = (GrayOnlyParams*) Cargo; @@ -844,7 +825,7 @@ typedef struct { // The CLUT will be stored at 16 bits, but calculations are performed at cmsFloat32Number precision static -int BlackPreservingSampler(cmsContext ContextID, register const cmsUInt16Number In[], register cmsUInt16Number Out[], register void* Cargo) +int BlackPreservingSampler(cmsContext ContextID, CMSREGISTER const cmsUInt16Number In[], CMSREGISTER cmsUInt16Number Out[], CMSREGISTER void* Cargo) { int i; cmsFloat32Number Inf[4], Outf[4]; @@ -869,14 +850,14 @@ int BlackPreservingSampler(cmsContext ContextID, register const cmsUInt16Number } // Try the original transform, - cmsPipelineEvalFloat(ContextID, Inf, Outf, bp ->cmyk2cmyk); + cmsPipelineEvalFloat(ContextID, Inf, Outf, bp ->cmyk2cmyk); // Store a copy of the floating point result into 16-bit for (i=0; i < 4; i++) Out[i] = _cmsQuickSaturateWord(Outf[i] * 65535.0); // Maybe K is already ok (mostly on K=0) - if ( fabs(Outf[3] - LabK[3]) < (3.0 / 65535.0) ) { + if (fabsf(Outf[3] - LabK[3]) < (3.0 / 65535.0)) { return TRUE; } @@ -901,7 +882,7 @@ int BlackPreservingSampler(cmsContext ContextID, register const cmsUInt16Number Outf[3] = LabK[3]; // Apply TAC if needed - SumCMY = Outf[0] + Outf[1] + Outf[2]; + SumCMY = (cmsFloat64Number) Outf[0] + Outf[1] + Outf[2]; SumCMYK = SumCMY + Outf[3]; if (SumCMYK > bp ->MaxTAC) { diff --git a/lcms2mt/src/cmserr.c b/lcms2mt/src/cmserr.c index 3165a805..82e2486c 100644 --- a/lcms2mt/src/cmserr.c +++ b/lcms2mt/src/cmserr.c @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2017 Marti Maria Saguer +// Copyright (c) 1998-2020 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -38,7 +38,7 @@ int CMSEXPORT cmsGetEncodedCMMversion(void) // compare two strings ignoring case int CMSEXPORT cmsstrcasecmp(const char* s1, const char* s2) { - register const unsigned char *us1 = (const unsigned char *)s1, + CMSREGISTER const unsigned char *us1 = (const unsigned char *)s1, *us2 = (const unsigned char *)s2; while (toupper(*us1) == toupper(*us2++)) diff --git a/lcms2mt/src/cmsgamma.c b/lcms2mt/src/cmsgamma.c index 09e817ce..ad00b129 100644 --- a/lcms2mt/src/cmsgamma.c +++ b/lcms2mt/src/cmsgamma.c @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2013 Marti Maria Saguer +// Copyright (c) 1998-2020 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -888,7 +888,7 @@ void CMSEXPORT cmsFreeToneCurve(cmsContext ContextID, cmsToneCurve* Curve) if (Curve -> Evals) _cmsFree(ContextID, Curve -> Evals); - if (Curve) _cmsFree(ContextID, Curve); + _cmsFree(ContextID, Curve); } // Utility function, free 3 gamma tables diff --git a/lcms2mt/src/cmsgmt.c b/lcms2mt/src/cmsgmt.c index e969876d..e255ab9d 100644 --- a/lcms2mt/src/cmsgmt.c +++ b/lcms2mt/src/cmsgmt.c @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2017 Marti Maria Saguer +// Copyright (c) 1998-2020 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -211,7 +211,7 @@ typedef struct { static -int GamutSampler(cmsContext ContextID, register const cmsUInt16Number In[], register cmsUInt16Number Out[], register void* Cargo) +int GamutSampler(cmsContext ContextID, CMSREGISTER const cmsUInt16Number In[], CMSREGISTER cmsUInt16Number Out[], CMSREGISTER void* Cargo) { GAMUTCHAIN* t = (GAMUTCHAIN* ) Cargo; cmsCIELab LabIn1, LabOut1; @@ -424,7 +424,7 @@ typedef struct { // This callback just accounts the maximum ink dropped in the given node. It does not populate any // memory, as the destination table is NULL. Its only purpose it to know the global maximum. static -int EstimateTAC(cmsContext ContextID, register const cmsUInt16Number In[], register cmsUInt16Number Out[], register void * Cargo) +int EstimateTAC(cmsContext ContextID, CMSREGISTER const cmsUInt16Number In[], CMSREGISTER cmsUInt16Number Out[], CMSREGISTER void * Cargo) { cmsTACestimator* bp = (cmsTACestimator*) Cargo; cmsFloat32Number RoundTrip[cmsMAXCHANNELS]; diff --git a/lcms2mt/src/cmshalf.c b/lcms2mt/src/cmshalf.c index 66c27011..292b6fdf 100644 --- a/lcms2mt/src/cmshalf.c +++ b/lcms2mt/src/cmshalf.c @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2017 Marti Maria Saguer +// Copyright (c) 1998-2020 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -31,7 +31,7 @@ // This code is inspired in the paper "Fast Half Float Conversions" // by Jeroen van der Zijp -static cmsUInt32Number Mantissa[2048] = { +static const cmsUInt32Number Mantissa[2048] = { 0x00000000, 0x33800000, 0x34000000, 0x34400000, 0x34800000, 0x34a00000, 0x34c00000, 0x34e00000, 0x35000000, 0x35100000, 0x35200000, 0x35300000, @@ -391,7 +391,7 @@ static cmsUInt16Number Offset[64] = { 0x0400, 0x0400, 0x0400, 0x0400 }; -static cmsUInt32Number Exponent[64] = { +static const cmsUInt32Number Exponent[64] = { 0x00000000, 0x00800000, 0x01000000, 0x01800000, 0x02000000, 0x02800000, 0x03000000, 0x03800000, 0x04000000, 0x04800000, 0x05000000, 0x05800000, 0x06000000, 0x06800000, 0x07000000, 0x07800000, 0x08000000, 0x08800000, @@ -405,7 +405,7 @@ static cmsUInt32Number Exponent[64] = { 0x8e000000, 0x8e800000, 0x8f000000, 0xc7800000 }; -static cmsUInt16Number Base[512] = { +static const cmsUInt16Number Base[512] = { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, @@ -460,7 +460,7 @@ static cmsUInt16Number Base[512] = { 0xfc00, 0xfc00 }; -static cmsUInt8Number Shift[512] = { +static const cmsUInt8Number Shift[512] = { 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, diff --git a/lcms2mt/src/cmsintrp.c b/lcms2mt/src/cmsintrp.c index 555125e3..590328aa 100644 --- a/lcms2mt/src/cmsintrp.c +++ b/lcms2mt/src/cmsintrp.c @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2017 Marti Maria Saguer +// Copyright (c) 1998-2020 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -85,10 +85,6 @@ cmsBool _cmsRegisterInterpPlugin(cmsContext ContextID, cmsPluginBase* Data) cmsBool _cmsSetInterpolationRoutine(cmsContext ContextID, cmsInterpParams* p) { _cmsInterpPluginChunkType* ptr = (_cmsInterpPluginChunkType*) _cmsContextGetClientChunk(ContextID, InterpPlugin); - cmsUInt32Number flags = 0; - - if (ContextID->dwFlags & cmsFLAGS_FORCE_LINEARINTERP) - flags = CMS_LERP_FLAGS_TRILINEAR; p ->Interpolation.Lerp16 = NULL; @@ -99,7 +95,7 @@ cmsBool _cmsSetInterpolationRoutine(cmsContext ContextID, cmsInterpParams* p) // If unsupported by the plug-in, go for the LittleCMS default. // If happens only if an extern plug-in is being used if (p ->Interpolation.Lerp16 == NULL) - p ->Interpolation = DefaultInterpolatorsFactory(p ->nInputs, p ->nOutputs, p ->dwFlags | flags); + p ->Interpolation = DefaultInterpolatorsFactory(p ->nInputs, p ->nOutputs, p ->dwFlags); // Check for valid interpolator (we just check one member of the union) if (p ->Interpolation.Lerp16 == NULL) { @@ -194,9 +190,10 @@ cmsINLINE CMS_NO_SANITIZE cmsUInt16Number LinearInterp(cmsS15Fixed16Number a, cm // Linear interpolation (Fixed-point optimized) static -void LinLerp1D(cmsContext ContextID, register const cmsUInt16Number Value[], - register cmsUInt16Number Output[], - register const cmsInterpParams* p) +void LinLerp1D(cmsContext ContextID, + CMSREGISTER const cmsUInt16Number Value[], + CMSREGISTER cmsUInt16Number Output[], + CMSREGISTER const cmsInterpParams* p) { cmsUInt16Number y1, y0; int cell0, rest; @@ -269,9 +266,10 @@ void LinLerp1Dfloat(cmsContext ContextID, const cmsFloat32Number Value[], // Eval gray LUT having only one input channel static CMS_NO_SANITIZE -void Eval1Input(cmsContext ContextID, register const cmsUInt16Number Input[], - register cmsUInt16Number Output[], - register const cmsInterpParams* p16) +void Eval1Input(cmsContext ContextID, + CMSREGISTER const cmsUInt16Number Input[], + CMSREGISTER cmsUInt16Number Output[], + CMSREGISTER const cmsInterpParams* p16) { cmsS15Fixed16Number fk; cmsS15Fixed16Number k0, k1, rk, K0, K1; @@ -402,9 +400,10 @@ void BilinearInterpFloat(cmsContext ContextID, const cmsFloat32Number Input[], // Bilinear interpolation (16 bits) - optimized version static CMS_NO_SANITIZE -void BilinearInterp16(cmsContext ContextID, register const cmsUInt16Number Input[], - register cmsUInt16Number Output[], - register const cmsInterpParams* p) +void BilinearInterp16(cmsContext ContextID, + CMSREGISTER const cmsUInt16Number Input[], + CMSREGISTER cmsUInt16Number Output[], + CMSREGISTER const cmsInterpParams* p) { #define DENS(i,j) (LutTable[(i)+(j)+OutChan]) @@ -413,9 +412,9 @@ void BilinearInterp16(cmsContext ContextID, register const cmsUInt16Number Input const cmsUInt16Number* LutTable = (cmsUInt16Number*) p ->Table; int OutChan, TotalOut; cmsS15Fixed16Number fx, fy; - register int rx, ry; + CMSREGISTER int rx, ry; int x0, y0; - register int X0, X1, Y0, Y1; + CMSREGISTER int X0, X1, Y0, Y1; int d00, d01, d10, d11, dx0, dx1, dxy; @@ -535,9 +534,10 @@ void TrilinearInterpFloat(cmsContext ContextID, const cmsFloat32Number Input[], // Trilinear interpolation (16 bits) - optimized version static CMS_NO_SANITIZE -void TrilinearInterp16(cmsContext ContextID, register const cmsUInt16Number Input[], - register cmsUInt16Number Output[], - register const cmsInterpParams* p) +void TrilinearInterp16(cmsContext ContextID, + CMSREGISTER const cmsUInt16Number Input[], + CMSREGISTER cmsUInt16Number Output[], + CMSREGISTER const cmsInterpParams* p) { #define DENS(i,j,k) (LutTable[(i)+(j)+(k)+OutChan]) @@ -546,9 +546,9 @@ void TrilinearInterp16(cmsContext ContextID, register const cmsUInt16Number Inpu const cmsUInt16Number* LutTable = (cmsUInt16Number*) p ->Table; int OutChan, TotalOut; cmsS15Fixed16Number fx, fy, fz; - register int rx, ry, rz; + CMSREGISTER int rx, ry, rz; int x0, y0, z0; - register int X0, X1, Y0, Y1, Z0, Z1; + CMSREGISTER int X0, X1, Y0, Y1, Z0, Z1; int d000, d001, d010, d011, d100, d101, d110, d111, dx00, dx01, dx10, dx11, @@ -611,149 +611,6 @@ void TrilinearInterp16(cmsContext ContextID, register const cmsUInt16Number Inpu # undef DENS } -static -void QuadrilinearInterpFloat(cmsContext ContextID, - const cmsFloat32Number Input[], - cmsFloat32Number Output[], - const cmsInterpParams *p) - -{ - cmsFloat32Number rest; - cmsFloat32Number pk; - int k0; - cmsUInt32Number i, n; - cmsFloat32Number Tmp[MAX_STAGE_CHANNELS]; - cmsInterpParams p1 = *p; - cmsFloat32Number i0 = fclamp(Input[0]); - - pk = i0 * p->Domain[0]; - k0 = _cmsQuickFloor(pk); - rest = pk - (cmsFloat32Number) k0; - - memmove(&p1.Domain[0], &p ->Domain[1], 3*sizeof(cmsUInt32Number)); - p1.Table = ((cmsFloat32Number*) p -> Table) + p -> opta[3] * k0; - - TrilinearInterpFloat(ContextID, Input + 1, Output, &p1); - - if (i0 == 1.0) - return; - - p1.Table = ((cmsFloat32Number*) p1.Table) + p->opta[3]; - TrilinearInterpFloat(ContextID, Input + 1, Tmp, &p1); - - n = p -> nOutputs; - for (i=0; i < n; i++) { - cmsFloat32Number y0 = Output[i]; - cmsFloat32Number y1 = Tmp[i]; - - Output[i] = y0 + (y1 - y0) * rest; - } -} - -static CMS_NO_SANITIZE -void QuadrilinearInterp16(cmsContext ContextID, - register const cmsUInt16Number Input[], - register cmsUInt16Number Output[], - register const cmsInterpParams *p) - -{ -#define DENS(i,j,k,l) (LutTable[(i)+(j)+(k)+(l)+OutChan]) -#define LERP(a,l,h) (cmsUInt16Number) (l + ROUND_FIXED_TO_INT(((h-l)*a))) - - const cmsUInt16Number* LutTable = (cmsUInt16Number*) p ->Table; - int OutChan, TotalOut; - cmsS15Fixed16Number fx, fy, fz, fk; - register int rx, ry, rz, rk; - int x0, y0, z0, k0; - register int X0, X1, Y0, Y1, Z0, Z1, K0, K1; - int d0000, d0001, d0010, d0011, - d0100, d0101, d0110, d0111, - d1000, d1001, d1010, d1011, - d1100, d1101, d1110, d1111, - d000, d001, d010, d011, - d100, d101, d110, d111, - dx00, dx01, dx10, dx11, - dxy0, dxy1, dxyz; - cmsUNUSED_PARAMETER(ContextID); - - TotalOut = p -> nOutputs; - - fx = _cmsToFixedDomain((int) Input[0] * p -> Domain[0]); - x0 = FIXED_TO_INT(fx); - rx = FIXED_REST_TO_INT(fx); // Rest in 0..1.0 domain - - - fy = _cmsToFixedDomain((int) Input[1] * p -> Domain[1]); - y0 = FIXED_TO_INT(fy); - ry = FIXED_REST_TO_INT(fy); - - fz = _cmsToFixedDomain((int) Input[2] * p -> Domain[2]); - z0 = FIXED_TO_INT(fz); - rz = FIXED_REST_TO_INT(fz); - - fk = _cmsToFixedDomain((int) Input[3] * p -> Domain[3]); - k0 = FIXED_TO_INT(fk); - rk = FIXED_REST_TO_INT(fk); - - - X0 = p -> opta[3] * x0; - X1 = X0 + (Input[0] == 0xFFFFU ? 0 : p->opta[3]); - - Y0 = p -> opta[2] * y0; - Y1 = Y0 + (Input[1] == 0xFFFFU ? 0 : p->opta[2]); - - Z0 = p -> opta[1] * z0; - Z1 = Z0 + (Input[2] == 0xFFFFU ? 0 : p->opta[1]); - - K0 = p -> opta[0] * k0; - K1 = K0 + (Input[3] == 0xFFFFU ? 0 : p->opta[0]); - - for (OutChan = 0; OutChan < TotalOut; OutChan++) { - - d0000 = DENS(X0, Y0, Z0, K0); - d0001 = DENS(X0, Y0, Z0, K1); - d000 = LERP(rk, d0000, d0001); - d0010 = DENS(X0, Y0, Z1, K0); - d0011 = DENS(X0, Y0, Z1, K1); - d001 = LERP(rk, d0010, d0011); - d0100 = DENS(X0, Y1, Z0, K0); - d0101 = DENS(X0, Y1, Z0, K1); - d010 = LERP(rk, d0100, d0101); - d0110 = DENS(X0, Y1, Z1, K0); - d0111 = DENS(X0, Y1, Z1, K1); - d011 = LERP(rk, d0110, d0111); - - d1000 = DENS(X1, Y0, Z0, K0); - d1001 = DENS(X1, Y0, Z0, K1); - d100 = LERP(rk, d1000, d1001); - d1010 = DENS(X1, Y0, Z1, K0); - d1011 = DENS(X1, Y0, Z1, K1); - d101 = LERP(rk, d1010, d1011); - d1100 = DENS(X1, Y1, Z0, K0); - d1101 = DENS(X1, Y1, Z0, K1); - d110 = LERP(rk, d1100, d1101); - d1110 = DENS(X1, Y1, Z1, K0); - d1111 = DENS(X1, Y1, Z1, K1); - d111 = LERP(rk, d1110, d1111); - - dx00 = LERP(rx, d000, d100); - dx01 = LERP(rx, d001, d101); - dx10 = LERP(rx, d010, d110); - dx11 = LERP(rx, d011, d111); - - dxy0 = LERP(ry, dx00, dx10); - dxy1 = LERP(ry, dx01, dx11); - - dxyz = LERP(rz, dxy0, dxy1); - - Output[OutChan] = (cmsUInt16Number) dxyz; - } - - -# undef LERP -# undef DENS -} - // Tetrahedral interpolation, using Sakamoto algorithm. #define DENS(i,j,k) (LutTable[(i)+(j)+(k)+OutChan]) @@ -860,9 +717,10 @@ void TetrahedralInterpFloat(cmsContext ContextID, const cmsFloat32Number Input[] static CMS_NO_SANITIZE -void TetrahedralInterp16(cmsContext ContextID, register const cmsUInt16Number Input[], - register cmsUInt16Number Output[], - register const cmsInterpParams* p) +void TetrahedralInterp16(cmsContext ContextID, + CMSREGISTER const cmsUInt16Number Input[], + CMSREGISTER cmsUInt16Number Output[], + CMSREGISTER const cmsInterpParams* p) { const cmsUInt16Number* LutTable = (cmsUInt16Number*) p -> Table; cmsS15Fixed16Number fx, fy, fz; @@ -993,25 +851,28 @@ void TetrahedralInterp16(cmsContext ContextID, register const cmsUInt16Number In } -/* Pentachoronal Interpolation */ +#define DENS(i,j,k) (LutTable[(i)+(j)+(k)+OutChan]) static CMS_NO_SANITIZE -void Eval4Inputs(cmsContext ContextID, register const cmsUInt16Number Input[], - register cmsUInt16Number Output[], - register const cmsInterpParams* p16) +void Eval4Inputs(cmsContext ContextID, + CMSREGISTER const cmsUInt16Number Input[], + CMSREGISTER cmsUInt16Number Output[], + CMSREGISTER const cmsInterpParams* p16) { - const cmsUInt16Number *LutTable; - cmsS15Fixed16Number fx, fy, fz, fk; - cmsS15Fixed16Number rx, ry, rz, rk; - cmsS15Fixed16Number m1, m2, m3, m4; - int x0, y0, z0, k0; - cmsS15Fixed16Number X0, X1, Y0, Y1, Z0, Z1, K0, K1; - cmsS15Fixed16Number o1, o2, o3, o4; - cmsS15Fixed16Number c0, c1, c2, c3, c4, Rest; + const cmsUInt16Number* LutTable; + cmsS15Fixed16Number fk; + cmsS15Fixed16Number k0, rk; + int K0, K1; + cmsS15Fixed16Number fx, fy, fz; + cmsS15Fixed16Number rx, ry, rz; + int x0, y0, z0; + cmsS15Fixed16Number X0, X1, Y0, Y1, Z0, Z1; + cmsUInt32Number i; + cmsS15Fixed16Number c0, c1, c2, c3, Rest; cmsUInt32Number OutChan; - cmsUInt16Number *Out = Output; - int which; + cmsUInt16Number Tmp1[MAX_STAGE_CHANNELS], Tmp2[MAX_STAGE_CHANNELS]; cmsUNUSED_PARAMETER(ContextID); + fk = _cmsToFixedDomain((int) Input[0] * p16 -> Domain[0]); fx = _cmsToFixedDomain((int) Input[1] * p16 -> Domain[1]); fy = _cmsToFixedDomain((int) Input[2] * p16 -> Domain[2]); @@ -1028,326 +889,241 @@ void Eval4Inputs(cmsContext ContextID, register const cmsUInt16Number Input[], rz = FIXED_REST_TO_INT(fz); K0 = p16 -> opta[3] * k0; - K1 = (Input[0] == 0xFFFFU ? 0 : p16->opta[3]); + K1 = K0 + (Input[0] == 0xFFFFU ? 0 : p16->opta[3]); X0 = p16 -> opta[2] * x0; - X1 = (Input[1] == 0xFFFFU ? 0 : p16->opta[2]); + X1 = X0 + (Input[1] == 0xFFFFU ? 0 : p16->opta[2]); Y0 = p16 -> opta[1] * y0; - Y1 = (Input[2] == 0xFFFFU ? 0 : p16->opta[1]); + Y1 = Y0 + (Input[2] == 0xFFFFU ? 0 : p16->opta[1]); Z0 = p16 -> opta[0] * z0; - Z1 = (Input[3] == 0xFFFFU ? 0 : p16->opta[0]); + Z1 = Z0 + (Input[3] == 0xFFFFU ? 0 : p16->opta[0]); LutTable = (cmsUInt16Number*) p16 -> Table; - LutTable += K0 + X0 + Y0 + Z0; - - /* We carefully choose the following tests, a) cos these - * work nicely in SSE (see CAL), and b) because, as well - * as the standard 24 pentachorons, we get some useful - * special cases. */ - which = (rx > ry ? 1 : 0) + - (ry > rz ? 2 : 0) + - (rz > rk ? 4 : 0) + - (rk > rx ? 8 : 0) + - (rz > rx ? 16 : 0) + - (rk > ry ? 32 : 0); - - o4 = X1+Y1+Z1+K1; - switch(which) - { - default: /* Never happens, but stops the compiler complaining of uninitialised vars */ - case 0x00: /* x == y == z == k - special case */ - m1 = rx; goto one_lerp; - case 0x01: /* x > k == z == y - special case */ - o1 = X1; m1 = rx; m2 = ry; goto two_lerps; - case 0x18: /* y == z == k > x - special case */ - o1 = Y1+Z1+K1; m1 = ry; m2 = rx; goto two_lerps; - case 0x04: /* z == y == x > k - special case */ - o1 = X1+Y1+Z1; m1 = ry; m2 = rk; goto two_lerps; - case 0x28: /* k > z == y == x - special case */ - o1 = K1; m1 = rk; m2 = ry; goto two_lerps; - case 0x02: /* y >= x >= k >= z */ - o1 = Y1; o2 = X1; o3 = K1; m1 = ry; m2 = rx; m3 = rk; m4 = rz; break; - case 0x03: /* x > y >= k >= z */ - o1 = X1; o2 = Y1; o3 = K1; m1 = rx; m2 = ry; m3 = rk; m4 = rz; break; - case 0x05: /* x >= z >= y >= k */ - o1 = X1; o2 = Z1; o3 = Y1; m1 = rx; m2 = rz; m3 = ry; m4 = rk; break; - case 0x06: /* y >= x >= z > k */ - o1 = Y1; o2 = X1; o3 = Z1; m1 = ry; m2 = rx; m3 = rz; m4 = rk; break; - case 0x07: /* x > y > z > k */ - o1 = X1; o2 = Y1; o3 = Z1; m1 = rx; m2 = ry; m3 = rz; m4 = rk; break; - case 0x0a: /* y >= k > x >= z */ - o1 = Y1; o2 = K1; o3 = X1; m1 = ry; m2 = rk; m3 = rx; m4 = rz; break; - case 0x14: /* z >= y >= x >= k */ - o1 = Z1; o2 = Y1; o3 = X1; m1 = rz; m2 = ry; m3 = rx; m4 = rk; break; - case 0x15: /* z > x >= y >= k */ - o1 = Z1; o2 = X1; o3 = Y1; m1 = rz; m2 = rx; m3 = ry; m4 = rk; break; - case 0x16: /* y >= z > x >= k */ - o1 = Y1; o2 = Z1; o3 = X1; m1 = ry; m2 = rz; m3 = rx; m4 = rk; break; - case 0x1a: /* y >= k >= z > x */ - o1 = Y1; o2 = K1; o3 = Z1; m1 = ry; m2 = rk; m3 = rz; m4 = rx; break; - case 0x1c: /* z >= y >= k > x */ - o1 = Z1; o2 = Y1; o3 = K1; m1 = rz; m2 = ry; m3 = rk; m4 = rx; break; - case 0x1e: /* y > z > k > x */ - o1 = Y1; o2 = Z1; o3 = K1; m1 = ry; m2 = rz; m3 = rk; m4 = rx; break; - case 0x21: /* x >= k >= z >= y */ - o1 = X1; o2 = K1; o3 = Z1; m1 = rx; m2 = rk; m3 = rz; m4 = ry; break; - case 0x23: /* x >= k > y > z */ - o1 = X1; o2 = K1; o3 = Y1; m1 = rx; m2 = rk; m3 = ry; m4 = rz; break; - case 0x25: /* x >= z > k > y */ - o1 = X1; o2 = Z1; o3 = K1; m1 = rx; m2 = rz; m3 = rk; m4 = ry; break; - case 0x29: /* k > x >= z >= y */ - o1 = K1; o2 = X1; o3 = Z1; m1 = rk; m2 = rx; m3 = rz; m4 = ry; break; - case 0x2a: /* k > y >= x >= z */ - o1 = K1; o2 = Y1; o3 = X1; m1 = rk; m2 = ry; m3 = rx; m4 = rz; break; - case 0x2b: /* k > x > y > z */ - o1 = K1; o2 = X1; o3 = Y1; m1 = rk; m2 = rx; m3 = ry; m4 = rz; break; - case 0x35: /* z > x >= k > y */ - o1 = Z1; o2 = X1; o3 = K1; m1 = rz; m2 = rx; m3 = rk; m4 = ry; break; - case 0x38: /* k >= z >= y >= x */ - o1 = K1; o2 = Z1; o3 = Y1; m1 = rk; m2 = rz; m3 = ry; m4 = rx; break; - case 0x39: /* k >= z > x > y */ - o1 = K1; o2 = Z1; o3 = X1; m1 = rk; m2 = rz; m3 = rx; m4 = ry; break; - case 0x3a: /* k > y > z > x */ - o1 = K1; o2 = Y1; o3 = Z1; m1 = rk; m2 = ry; m3 = rz; m4 = rx; break; - case 0x3c: /* z > k > y >= x */ - o1 = Z1; o2 = K1; o3 = Y1; m1 = rz; m2 = rk; m3 = ry; m4 = rx; break; - case 0x3d: /* z > k > x > y */ - o1 = Z1; o2 = K1; o3 = X1; m1 = rz; m2 = rk; m3 = rx; m4 = ry; break; - } - assert(m1 >= m2 && m2 >= m3 && m3 >= m4); - o2 += o1; - o3 += o2; - for (OutChan=p16 -> nOutputs; OutChan != 0; OutChan--) { - c1 = LutTable[o1]; - c2 = LutTable[o2]; - c3 = LutTable[o3]; - c4 = LutTable[o4] - c3; - c0 = *LutTable++; - c3 -= c2; - c2 -= c1; - c1 -= c0; - - Rest = c1 * m1 + c2 * m2 + c3 * m3 + c4 * m4; - - *Out++ = (cmsUInt16Number)(c0 + ROUND_FIXED_TO_INT(_cmsToFixedDomain(Rest))); + LutTable += K0; + + for (OutChan=0; OutChan < p16 -> nOutputs; OutChan++) { + + c0 = DENS(X0, Y0, Z0); + + if (rx >= ry && ry >= rz) { + + c1 = DENS(X1, Y0, Z0) - c0; + c2 = DENS(X1, Y1, Z0) - DENS(X1, Y0, Z0); + c3 = DENS(X1, Y1, Z1) - DENS(X1, Y1, Z0); + + } + else + if (rx >= rz && rz >= ry) { + + c1 = DENS(X1, Y0, Z0) - c0; + c2 = DENS(X1, Y1, Z1) - DENS(X1, Y0, Z1); + c3 = DENS(X1, Y0, Z1) - DENS(X1, Y0, Z0); + + } + else + if (rz >= rx && rx >= ry) { + + c1 = DENS(X1, Y0, Z1) - DENS(X0, Y0, Z1); + c2 = DENS(X1, Y1, Z1) - DENS(X1, Y0, Z1); + c3 = DENS(X0, Y0, Z1) - c0; + + } + else + if (ry >= rx && rx >= rz) { + + c1 = DENS(X1, Y1, Z0) - DENS(X0, Y1, Z0); + c2 = DENS(X0, Y1, Z0) - c0; + c3 = DENS(X1, Y1, Z1) - DENS(X1, Y1, Z0); + + } + else + if (ry >= rz && rz >= rx) { + + c1 = DENS(X1, Y1, Z1) - DENS(X0, Y1, Z1); + c2 = DENS(X0, Y1, Z0) - c0; + c3 = DENS(X0, Y1, Z1) - DENS(X0, Y1, Z0); + + } + else + if (rz >= ry && ry >= rx) { + + c1 = DENS(X1, Y1, Z1) - DENS(X0, Y1, Z1); + c2 = DENS(X0, Y1, Z1) - DENS(X0, Y0, Z1); + c3 = DENS(X0, Y0, Z1) - c0; + + } + else { + c1 = c2 = c3 = 0; + } + + Rest = c1 * rx + c2 * ry + c3 * rz; + + Tmp1[OutChan] = (cmsUInt16Number)(c0 + ROUND_FIXED_TO_INT(_cmsToFixedDomain(Rest))); } - return; -two_lerps: - assert(m1 >= m2); - for (OutChan=p16 -> nOutputs; OutChan != 0; OutChan--) { - c1 = LutTable[o1]; - c2 = LutTable[o4] - c1; - c0 = *LutTable++; - c1 -= c0; - Rest = c1 * m1 + c2 * m2; + LutTable = (cmsUInt16Number*) p16 -> Table; + LutTable += K1; + + for (OutChan=0; OutChan < p16 -> nOutputs; OutChan++) { + + c0 = DENS(X0, Y0, Z0); - *Out++ = (cmsUInt16Number)(c0 + ROUND_FIXED_TO_INT(_cmsToFixedDomain(Rest))); + if (rx >= ry && ry >= rz) { + + c1 = DENS(X1, Y0, Z0) - c0; + c2 = DENS(X1, Y1, Z0) - DENS(X1, Y0, Z0); + c3 = DENS(X1, Y1, Z1) - DENS(X1, Y1, Z0); + + } + else + if (rx >= rz && rz >= ry) { + + c1 = DENS(X1, Y0, Z0) - c0; + c2 = DENS(X1, Y1, Z1) - DENS(X1, Y0, Z1); + c3 = DENS(X1, Y0, Z1) - DENS(X1, Y0, Z0); + + } + else + if (rz >= rx && rx >= ry) { + + c1 = DENS(X1, Y0, Z1) - DENS(X0, Y0, Z1); + c2 = DENS(X1, Y1, Z1) - DENS(X1, Y0, Z1); + c3 = DENS(X0, Y0, Z1) - c0; + + } + else + if (ry >= rx && rx >= rz) { + + c1 = DENS(X1, Y1, Z0) - DENS(X0, Y1, Z0); + c2 = DENS(X0, Y1, Z0) - c0; + c3 = DENS(X1, Y1, Z1) - DENS(X1, Y1, Z0); + + } + else + if (ry >= rz && rz >= rx) { + + c1 = DENS(X1, Y1, Z1) - DENS(X0, Y1, Z1); + c2 = DENS(X0, Y1, Z0) - c0; + c3 = DENS(X0, Y1, Z1) - DENS(X0, Y1, Z0); + + } + else + if (rz >= ry && ry >= rx) { + + c1 = DENS(X1, Y1, Z1) - DENS(X0, Y1, Z1); + c2 = DENS(X0, Y1, Z1) - DENS(X0, Y0, Z1); + c3 = DENS(X0, Y0, Z1) - c0; + + } + else { + c1 = c2 = c3 = 0; + } + + Rest = c1 * rx + c2 * ry + c3 * rz; + + Tmp2[OutChan] = (cmsUInt16Number) (c0 + ROUND_FIXED_TO_INT(_cmsToFixedDomain(Rest))); } - return; -one_lerp: - for (OutChan=p16 -> nOutputs; OutChan != 0; OutChan--) { - c1 = LutTable[o4]; - c0 = *LutTable++; - c1 -= c0; - Rest = c1 * m1; - *Out++ = (cmsUInt16Number)(c0 + ROUND_FIXED_TO_INT(_cmsToFixedDomain(Rest))); + for (i=0; i < p16 -> nOutputs; i++) { + Output[i] = LinearInterp(rk, Tmp1[i], Tmp2[i]); } - return; } +#undef DENS + + +// For more that 3 inputs (i.e., CMYK) +// evaluate two 3-dimensional interpolations and then linearly interpolate between them. + static void Eval4InputsFloat(cmsContext ContextID, const cmsFloat32Number Input[], cmsFloat32Number Output[], const cmsInterpParams* p) { - const cmsFloat32Number* LutTable = (cmsFloat32Number*) p -> Table; - cmsFloat32Number px, py, pz, pk; - int x0, y0, z0, k0; - int X0, Y0, Z0, K0, X1, Y1, Z1, K1; - cmsFloat32Number rx, ry, rz, rk; - cmsFloat32Number m1, m2, m3, m4; - cmsFloat32Number c0, c1, c2, c3, c4; - int o1, o2, o3, o4; - int OutChan, TotalOut; - cmsFloat32Number *Out = Output; - int which; - cmsUNUSED_PARAMETER(ContextID); + const cmsFloat32Number* LutTable = (cmsFloat32Number*) p -> Table; + cmsFloat32Number rest; + cmsFloat32Number pk; + int k0, K0, K1; + const cmsFloat32Number* T; + cmsUInt32Number i; + cmsFloat32Number Tmp1[MAX_STAGE_CHANNELS], Tmp2[MAX_STAGE_CHANNELS]; + cmsInterpParams p1; - TotalOut = p -> nOutputs; + pk = fclamp(Input[0]) * p->Domain[0]; + k0 = _cmsQuickFloor(pk); + rest = pk - (cmsFloat32Number) k0; - // We need some clipping here - pk = fclamp(Input[0]) * p->Domain[0]; - px = fclamp(Input[1]) * p->Domain[1]; - py = fclamp(Input[2]) * p->Domain[2]; - pz = fclamp(Input[3]) * p->Domain[3]; + K0 = p -> opta[3] * k0; + K1 = K0 + (fclamp(Input[0]) >= 1.0 ? 0 : p->opta[3]); - k0 = (int) floor(pk); rk = (pk - (cmsFloat32Number) k0); - x0 = (int) floor(px); rx = (px - (cmsFloat32Number) x0); // We need full floor functionality here - y0 = (int) floor(py); ry = (py - (cmsFloat32Number) y0); - z0 = (int) floor(pz); rz = (pz - (cmsFloat32Number) z0); + p1 = *p; + memmove(&p1.Domain[0], &p ->Domain[1], 3*sizeof(cmsUInt32Number)); - K0 = p -> opta[3] * k0; - K1 = (fclamp(Input[0]) >= 1.0 ? 0 : p->opta[3]); + T = LutTable + K0; + p1.Table = T; - X0 = p -> opta[2] * x0; - X1 = (fclamp(Input[1]) >= 1.0 ? 0 : p->opta[2]); + TetrahedralInterpFloat(ContextID, Input + 1, Tmp1, &p1); - Y0 = p -> opta[1] * y0; - Y1 = (fclamp(Input[2]) >= 1.0 ? 0 : p->opta[1]); + T = LutTable + K1; + p1.Table = T; + TetrahedralInterpFloat(ContextID, Input + 1, Tmp2, &p1); - Z0 = p -> opta[0] * z0; - Z1 = (fclamp(Input[3]) >= 1.0 ? 0 : p->opta[0]); - - LutTable = (cmsFloat32Number*) p -> Table; - LutTable += K0 + X0 + Y0 + Z0; - - /* We carefully choose the following tests, a) cos these - * work nicely in SSE (see CAL), and b) because, as well - * as the standard 24 pentachorons, we get some useful - * special cases. */ - which = (rx > ry ? 1 : 0) + - (ry > rz ? 2 : 0) + - (rz > rk ? 4 : 0) + - (rk > rx ? 8 : 0) + - (rz > rx ? 16 : 0) + - (rk > ry ? 32 : 0); - - o4 = X1+Y1+Z1+K1; - switch(which) - { - default: /* Never happens, but stops the compiler complaining of uninitialised vars */ - case 0x00: /* x == y == z == k - special case */ - m1 = rx; goto one_lerp; - case 0x01: /* x > k == z == y - special case */ - o1 = X1; m1 = rx; m2 = ry; goto two_lerps; - case 0x18: /* y == z == k > x - special case */ - o1 = Y1+Z1+K1; m1 = ry; m2 = rx; goto two_lerps; - case 0x04: /* z == y == x > k - special case */ - o1 = X1+Y1+Z1; m1 = ry; m2 = rk; goto two_lerps; - case 0x28: /* k > z == y == x - special case */ - o1 = K1; m1 = rk; m2 = ry; goto two_lerps; - case 0x02: /* y >= x >= k >= z */ - o1 = Y1; o2 = X1; o3 = K1; m1 = ry; m2 = rx; m3 = rk; m4 = rz; break; - case 0x03: /* x > y >= k >= z */ - o1 = X1; o2 = Y1; o3 = K1; m1 = rx; m2 = ry; m3 = rk; m4 = rz; break; - case 0x05: /* x >= z >= y >= k */ - o1 = X1; o2 = Z1; o3 = Y1; m1 = rx; m2 = rz; m3 = ry; m4 = rk; break; - case 0x06: /* y >= x >= z > k */ - o1 = Y1; o2 = X1; o3 = Z1; m1 = ry; m2 = rx; m3 = rz; m4 = rk; break; - case 0x07: /* x > y > z > k */ - o1 = X1; o2 = Y1; o3 = Z1; m1 = rx; m2 = ry; m3 = rz; m4 = rk; break; - case 0x0a: /* y >= k > x >= z */ - o1 = Y1; o2 = K1; o3 = X1; m1 = ry; m2 = rk; m3 = rx; m4 = rz; break; - case 0x14: /* z >= y >= x >= k */ - o1 = Z1; o2 = Y1; o3 = X1; m1 = rz; m2 = ry; m3 = rx; m4 = rk; break; - case 0x15: /* z > x >= y >= k */ - o1 = Z1; o2 = X1; o3 = Y1; m1 = rz; m2 = rx; m3 = ry; m4 = rk; break; - case 0x16: /* y >= z > x >= k */ - o1 = Y1; o2 = Z1; o3 = X1; m1 = ry; m2 = rz; m3 = rx; m4 = rk; break; - case 0x1a: /* y >= k >= z > x */ - o1 = Y1; o2 = K1; o3 = Z1; m1 = ry; m2 = rk; m3 = rz; m4 = rx; break; - case 0x1c: /* z >= y >= k > x */ - o1 = Z1; o2 = Y1; o3 = K1; m1 = rz; m2 = ry; m3 = rk; m4 = rx; break; - case 0x1e: /* y > z > k > x */ - o1 = Y1; o2 = Z1; o3 = K1; m1 = ry; m2 = rz; m3 = rk; m4 = rx; break; - case 0x21: /* x >= k >= z >= y */ - o1 = X1; o2 = K1; o3 = Z1; m1 = rx; m2 = rk; m3 = rz; m4 = ry; break; - case 0x23: /* x >= k > y > z */ - o1 = X1; o2 = K1; o3 = Y1; m1 = rx; m2 = rk; m3 = ry; m4 = rz; break; - case 0x25: /* x >= z > k > y */ - o1 = X1; o2 = Z1; o3 = K1; m1 = rx; m2 = rz; m3 = rk; m4 = ry; break; - case 0x29: /* k > x >= z >= y */ - o1 = K1; o2 = X1; o3 = Z1; m1 = rk; m2 = rx; m3 = rz; m4 = ry; break; - case 0x2a: /* k > y >= x >= z */ - o1 = K1; o2 = Y1; o3 = X1; m1 = rk; m2 = ry; m3 = rx; m4 = rz; break; - case 0x2b: /* k > x > y > z */ - o1 = K1; o2 = X1; o3 = Y1; m1 = rk; m2 = rx; m3 = ry; m4 = rz; break; - case 0x35: /* z > x >= k > y */ - o1 = Z1; o2 = X1; o3 = K1; m1 = rz; m2 = rx; m3 = rk; m4 = ry; break; - case 0x38: /* k >= z >= y >= x */ - o1 = K1; o2 = Z1; o3 = Y1; m1 = rk; m2 = rz; m3 = ry; m4 = rx; break; - case 0x39: /* k >= z > x > y */ - o1 = K1; o2 = Z1; o3 = X1; m1 = rk; m2 = rz; m3 = rx; m4 = ry; break; - case 0x3a: /* k > y > z > x */ - o1 = K1; o2 = Y1; o3 = Z1; m1 = rk; m2 = ry; m3 = rz; m4 = rx; break; - case 0x3c: /* z > k > y >= x */ - o1 = Z1; o2 = K1; o3 = Y1; m1 = rz; m2 = rk; m3 = ry; m4 = rx; break; - case 0x3d: /* z > k > x > y */ - o1 = Z1; o2 = K1; o3 = X1; m1 = rz; m2 = rk; m3 = rx; m4 = ry; break; - } - assert(m1 >= m2 && m2 >= m3 && m3 >= m4); - o2 += o1; - o3 += o2; - for (OutChan=TotalOut; OutChan != 0; OutChan--) { - c1 = LutTable[o1]; - c2 = LutTable[o2]; - c3 = LutTable[o3]; - c4 = LutTable[o4] - c3; - c0 = *LutTable++; - c3 -= c2; - c2 -= c1; - c1 -= c0; - - *Out++ = c0 + c1 * m1 + c2 * m2 + c3 * m3 + c4 * m4; - } - return; - -two_lerps: - assert(m1 >= m2); - for (OutChan=TotalOut; OutChan != 0; OutChan--) { - c1 = LutTable[o1]; - c2 = LutTable[o4] - c1; - c0 = *LutTable++; - c1 -= c0; - - *Out++ = c0 + c1 * m1 + c2 * m2; - } - return; - -one_lerp: - for (OutChan=TotalOut; OutChan != 0; OutChan--) { - c1 = LutTable[o4]; - c0 = *LutTable++; - c1 -= c0; + for (i=0; i < p -> nOutputs; i++) + { + cmsFloat32Number y0 = Tmp1[i]; + cmsFloat32Number y1 = Tmp2[i]; - *Out++ = c0 + c1 * m1; - } - return; + Output[i] = y0 + (y1 - y0) * rest; + } } + static CMS_NO_SANITIZE -void Eval5Inputs(cmsContext ContextID, register const cmsUInt16Number Input[], - register cmsUInt16Number Output[], - register const cmsInterpParams* p16) +void Eval5Inputs(cmsContext ContextID, + CMSREGISTER const cmsUInt16Number Input[], + CMSREGISTER cmsUInt16Number Output[], + CMSREGISTER const cmsInterpParams* p16) { - cmsS15Fixed16Number fk; - cmsUInt32Number i, n; - cmsUInt16Number Tmp[MAX_STAGE_CHANNELS]; - cmsInterpParams p1 = *p16; + const cmsUInt16Number* LutTable = (cmsUInt16Number*) p16 -> Table; + cmsS15Fixed16Number fk; + cmsS15Fixed16Number k0, rk; + int K0, K1; + const cmsUInt16Number* T; + cmsUInt32Number i; + cmsUInt16Number Tmp1[MAX_STAGE_CHANNELS], Tmp2[MAX_STAGE_CHANNELS]; + cmsInterpParams p1; + + + fk = _cmsToFixedDomain((cmsS15Fixed16Number) Input[0] * p16 -> Domain[0]); + k0 = FIXED_TO_INT(fk); + rk = FIXED_REST_TO_INT(fk); + + K0 = p16 -> opta[4] * k0; + K1 = p16 -> opta[4] * (k0 + (Input[0] != 0xFFFFU ? 1 : 0)); - memmove(&p1.Domain[0], &p16 ->Domain[1], 4*sizeof(cmsUInt32Number)); - fk = _cmsToFixedDomain((cmsS15Fixed16Number) Input[0] * p16 -> Domain[0]); - p1.Table = ((cmsUInt16Number*)p16 -> Table) + p16 -> opta[4] * FIXED_TO_INT(fk); + p1 = *p16; + memmove(&p1.Domain[0], &p16 ->Domain[1], 4*sizeof(cmsUInt32Number)); - Eval4Inputs(ContextID, Input + 1, Output, &p1); + T = LutTable + K0; + p1.Table = T; - if (Input[0] == 0xFFFFU) - return; + Eval4Inputs(ContextID, Input + 1, Tmp1, &p1); - p1.Table = ((cmsUInt16Number*)p1.Table) + p16 -> opta[4]; - Eval4Inputs(ContextID, Input + 1, Tmp, &p1); + T = LutTable + K1; + p1.Table = T; + + Eval4Inputs(ContextID, Input + 1, Tmp2, &p1); + + for (i=0; i < p16 -> nOutputs; i++) { + + Output[i] = LinearInterp(rk, Tmp1[i], Tmp2[i]); + } - fk = FIXED_REST_TO_INT(fk); - n = p16 -> nOutputs; - for (i=0; i < n; i++) - Output[i] = LinearInterp(fk, Output[i], Tmp[i]); } @@ -1356,66 +1132,86 @@ void Eval5InputsFloat(cmsContext ContextID, const cmsFloat32Number Input[], cmsFloat32Number Output[], const cmsInterpParams* p) { - cmsFloat32Number rest; - cmsFloat32Number pk; - int k0; - cmsUInt32Number i, n; - cmsFloat32Number Tmp[MAX_STAGE_CHANNELS]; - cmsInterpParams p1 = *p; - cmsFloat32Number i0 = fclamp(Input[0]); + const cmsFloat32Number* LutTable = (cmsFloat32Number*) p -> Table; + cmsFloat32Number rest; + cmsFloat32Number pk; + int k0, K0, K1; + const cmsFloat32Number* T; + cmsUInt32Number i; + cmsFloat32Number Tmp1[MAX_STAGE_CHANNELS], Tmp2[MAX_STAGE_CHANNELS]; + cmsInterpParams p1; - pk = i0 * p->Domain[0]; - k0 = _cmsQuickFloor(pk); - rest = pk - (cmsFloat32Number) k0; + pk = fclamp(Input[0]) * p->Domain[0]; + k0 = _cmsQuickFloor(pk); + rest = pk - (cmsFloat32Number) k0; - memmove(&p1.Domain[0], &p ->Domain[1], 4*sizeof(cmsUInt32Number)); - p1.Table = ((cmsFloat32Number*) p -> Table) + p -> opta[4] * k0; + K0 = p -> opta[4] * k0; + K1 = K0 + (fclamp(Input[0]) >= 1.0 ? 0 : p->opta[4]); - Eval4InputsFloat(ContextID, Input + 1, Output, &p1); + p1 = *p; + memmove(&p1.Domain[0], &p ->Domain[1], 4*sizeof(cmsUInt32Number)); - if (i0 == 1.0) - return; + T = LutTable + K0; + p1.Table = T; - p1.Table = ((cmsFloat32Number*) p1.Table) + p->opta[4]; - Eval4InputsFloat(ContextID, Input + 1, Tmp, &p1); + Eval4InputsFloat(ContextID, Input + 1, Tmp1, &p1); - n = p -> nOutputs; - for (i=0; i < n; i++) { - cmsFloat32Number y0 = Output[i]; - cmsFloat32Number y1 = Tmp[i]; + T = LutTable + K1; + p1.Table = T; - Output[i] = y0 + (y1 - y0) * rest; - } + Eval4InputsFloat(ContextID, Input + 1, Tmp2, &p1); + + for (i=0; i < p -> nOutputs; i++) { + + cmsFloat32Number y0 = Tmp1[i]; + cmsFloat32Number y1 = Tmp2[i]; + + Output[i] = y0 + (y1 - y0) * rest; + } } static CMS_NO_SANITIZE -void Eval6Inputs(cmsContext ContextID, register const cmsUInt16Number Input[], - register cmsUInt16Number Output[], - register const cmsInterpParams* p16) +void Eval6Inputs(cmsContext ContextID, + CMSREGISTER const cmsUInt16Number Input[], + CMSREGISTER cmsUInt16Number Output[], + CMSREGISTER const cmsInterpParams* p16) { - cmsS15Fixed16Number fk; - cmsUInt32Number i, n; - cmsUInt16Number Tmp[MAX_STAGE_CHANNELS]; - cmsInterpParams p1 = *p16; + const cmsUInt16Number* LutTable = (cmsUInt16Number*) p16 -> Table; + cmsS15Fixed16Number fk; + cmsS15Fixed16Number k0, rk; + int K0, K1; + const cmsUInt16Number* T; + cmsUInt32Number i; + cmsUInt16Number Tmp1[MAX_STAGE_CHANNELS], Tmp2[MAX_STAGE_CHANNELS]; + cmsInterpParams p1; + + fk = _cmsToFixedDomain((cmsS15Fixed16Number) Input[0] * p16 -> Domain[0]); + k0 = FIXED_TO_INT(fk); + rk = FIXED_REST_TO_INT(fk); - memmove(&p1.Domain[0], &p16 ->Domain[1], 5*sizeof(cmsUInt32Number)); - fk = _cmsToFixedDomain((cmsS15Fixed16Number) Input[0] * p16 -> Domain[0]); - p1.Table = ((cmsUInt16Number*)p16 -> Table) + p16 -> opta[5] * FIXED_TO_INT(fk); + K0 = p16 -> opta[5] * k0; + K1 = p16 -> opta[5] * (k0 + (Input[0] != 0xFFFFU ? 1 : 0)); - Eval5Inputs(ContextID, Input + 1, Output, &p1); + p1 = *p16; + memmove(&p1.Domain[0], &p16 ->Domain[1], 5*sizeof(cmsUInt32Number)); - if (Input[0] == 0xFFFFU) - return; + T = LutTable + K0; + p1.Table = T; - p1.Table = ((cmsUInt16Number*)p1.Table) + p16 -> opta[5]; - Eval5Inputs(ContextID, Input + 1, Tmp, &p1); + Eval5Inputs(ContextID, Input + 1, Tmp1, &p1); + + T = LutTable + K1; + p1.Table = T; + + Eval5Inputs(ContextID, Input + 1, Tmp2, &p1); + + for (i=0; i < p16 -> nOutputs; i++) { + + Output[i] = LinearInterp(rk, Tmp1[i], Tmp2[i]); + } - fk = FIXED_REST_TO_INT(fk); - n = p16 -> nOutputs; - for (i=0; i < n; i++) - Output[i] = LinearInterp(fk, Output[i], Tmp[i]); } @@ -1424,65 +1220,84 @@ void Eval6InputsFloat(cmsContext ContextID, const cmsFloat32Number Input[], cmsFloat32Number Output[], const cmsInterpParams* p) { - cmsFloat32Number rest; - cmsFloat32Number pk; - int k0; - cmsUInt32Number i, n; - cmsFloat32Number Tmp[MAX_STAGE_CHANNELS]; - cmsInterpParams p1 = *p; - cmsFloat32Number i0 = fclamp(Input[0]); + const cmsFloat32Number* LutTable = (cmsFloat32Number*) p -> Table; + cmsFloat32Number rest; + cmsFloat32Number pk; + int k0, K0, K1; + const cmsFloat32Number* T; + cmsUInt32Number i; + cmsFloat32Number Tmp1[MAX_STAGE_CHANNELS], Tmp2[MAX_STAGE_CHANNELS]; + cmsInterpParams p1; - pk = i0 * p->Domain[0]; - k0 = _cmsQuickFloor(pk); - rest = pk - (cmsFloat32Number) k0; + pk = fclamp(Input[0]) * p->Domain[0]; + k0 = _cmsQuickFloor(pk); + rest = pk - (cmsFloat32Number) k0; - memmove(&p1.Domain[0], &p ->Domain[1], 5*sizeof(cmsUInt32Number)); - p1.Table = ((cmsFloat32Number*) p -> Table) + p -> opta[5] * k0; + K0 = p -> opta[5] * k0; + K1 = K0 + (fclamp(Input[0]) >= 1.0 ? 0 : p->opta[5]); - Eval5InputsFloat(ContextID, Input + 1, Output, &p1); + p1 = *p; + memmove(&p1.Domain[0], &p ->Domain[1], 5*sizeof(cmsUInt32Number)); - if (i0 == 1.0) - return; + T = LutTable + K0; + p1.Table = T; - p1.Table = ((cmsFloat32Number*) p1.Table) + p->opta[5]; - Eval5InputsFloat(ContextID, Input + 1, Tmp, &p1); + Eval5InputsFloat(ContextID, Input + 1, Tmp1, &p1); - n = p -> nOutputs; - for (i=0; i < n; i++) { - cmsFloat32Number y0 = Output[i]; - cmsFloat32Number y1 = Tmp[i]; + T = LutTable + K1; + p1.Table = T; - Output[i] = y0 + (y1 - y0) * rest; - } + Eval5InputsFloat(ContextID, Input + 1, Tmp2, &p1); + + for (i=0; i < p -> nOutputs; i++) { + + cmsFloat32Number y0 = Tmp1[i]; + cmsFloat32Number y1 = Tmp2[i]; + + Output[i] = y0 + (y1 - y0) * rest; + } } static CMS_NO_SANITIZE -void Eval7Inputs(cmsContext ContextID, register const cmsUInt16Number Input[], - register cmsUInt16Number Output[], - register const cmsInterpParams* p16) +void Eval7Inputs(cmsContext ContextID, + CMSREGISTER const cmsUInt16Number Input[], + CMSREGISTER cmsUInt16Number Output[], + CMSREGISTER const cmsInterpParams* p16) { - cmsS15Fixed16Number fk; - cmsUInt32Number i, n; - cmsUInt16Number Tmp[MAX_STAGE_CHANNELS]; - cmsInterpParams p1 = *p16; + const cmsUInt16Number* LutTable = (cmsUInt16Number*) p16 -> Table; + cmsS15Fixed16Number fk; + cmsS15Fixed16Number k0, rk; + int K0, K1; + const cmsUInt16Number* T; + cmsUInt32Number i; + cmsUInt16Number Tmp1[MAX_STAGE_CHANNELS], Tmp2[MAX_STAGE_CHANNELS]; + cmsInterpParams p1; + + + fk = _cmsToFixedDomain((cmsS15Fixed16Number) Input[0] * p16 -> Domain[0]); + k0 = FIXED_TO_INT(fk); + rk = FIXED_REST_TO_INT(fk); + + K0 = p16 -> opta[6] * k0; + K1 = p16 -> opta[6] * (k0 + (Input[0] != 0xFFFFU ? 1 : 0)); - memmove(&p1.Domain[0], &p16 ->Domain[1], 6*sizeof(cmsUInt32Number)); - fk = _cmsToFixedDomain((cmsS15Fixed16Number) Input[0] * p16 -> Domain[0]); - p1.Table = ((cmsUInt16Number*)p16 -> Table) + p16 -> opta[6] * FIXED_TO_INT(fk); + p1 = *p16; + memmove(&p1.Domain[0], &p16 ->Domain[1], 6*sizeof(cmsUInt32Number)); - Eval6Inputs(ContextID, Input + 1, Output, &p1); + T = LutTable + K0; + p1.Table = T; - if (Input[0] == 0xFFFFU) - return; + Eval6Inputs(ContextID, Input + 1, Tmp1, &p1); - p1.Table = ((cmsUInt16Number*)p1.Table) + p16 -> opta[6]; - Eval6Inputs(ContextID, Input + 1, Tmp, &p1); + T = LutTable + K1; + p1.Table = T; - fk = FIXED_REST_TO_INT(fk); - n = p16 -> nOutputs; - for (i=0; i < n; i++) - Output[i] = LinearInterp(fk, Output[i], Tmp[i]); + Eval6Inputs(ContextID, Input + 1, Tmp2, &p1); + + for (i=0; i < p16 -> nOutputs; i++) { + Output[i] = LinearInterp(rk, Tmp1[i], Tmp2[i]); + } } @@ -1491,64 +1306,83 @@ void Eval7InputsFloat(cmsContext ContextID, const cmsFloat32Number Input[], cmsFloat32Number Output[], const cmsInterpParams* p) { - cmsFloat32Number rest; - cmsFloat32Number pk; - int k0; - cmsUInt32Number i, n; - cmsFloat32Number Tmp[MAX_STAGE_CHANNELS]; - cmsInterpParams p1 = *p; - cmsFloat32Number i0 = fclamp(Input[0]); + const cmsFloat32Number* LutTable = (cmsFloat32Number*) p -> Table; + cmsFloat32Number rest; + cmsFloat32Number pk; + int k0, K0, K1; + const cmsFloat32Number* T; + cmsUInt32Number i; + cmsFloat32Number Tmp1[MAX_STAGE_CHANNELS], Tmp2[MAX_STAGE_CHANNELS]; + cmsInterpParams p1; - pk = i0 * p->Domain[0]; - k0 = _cmsQuickFloor(pk); - rest = pk - (cmsFloat32Number) k0; + pk = fclamp(Input[0]) * p->Domain[0]; + k0 = _cmsQuickFloor(pk); + rest = pk - (cmsFloat32Number) k0; - memmove(&p1.Domain[0], &p ->Domain[1], 6*sizeof(cmsUInt32Number)); - p1.Table = ((cmsFloat32Number*) p -> Table) + p -> opta[6] * k0; + K0 = p -> opta[6] * k0; + K1 = K0 + (fclamp(Input[0]) >= 1.0 ? 0 : p->opta[6]); - Eval6InputsFloat(ContextID, Input + 1, Output, &p1); + p1 = *p; + memmove(&p1.Domain[0], &p ->Domain[1], 6*sizeof(cmsUInt32Number)); - if (i0 == 1.0) - return; + T = LutTable + K0; + p1.Table = T; - p1.Table = ((cmsFloat32Number*) p1.Table) + p->opta[6]; - Eval6InputsFloat(ContextID, Input + 1, Tmp, &p1); + Eval6InputsFloat(ContextID, Input + 1, Tmp1, &p1); - n = p -> nOutputs; - for (i=0; i < n; i++) { - cmsFloat32Number y0 = Output[i]; - cmsFloat32Number y1 = Tmp[i]; + T = LutTable + K1; + p1.Table = T; - Output[i] = y0 + (y1 - y0) * rest; - } + Eval6InputsFloat(ContextID, Input + 1, Tmp2, &p1); + + + for (i=0; i < p -> nOutputs; i++) { + + cmsFloat32Number y0 = Tmp1[i]; + cmsFloat32Number y1 = Tmp2[i]; + + Output[i] = y0 + (y1 - y0) * rest; + + } } static CMS_NO_SANITIZE -void Eval8Inputs(cmsContext ContextID, register const cmsUInt16Number Input[], - register cmsUInt16Number Output[], - register const cmsInterpParams* p16) +void Eval8Inputs(cmsContext ContextID, + CMSREGISTER const cmsUInt16Number Input[], + CMSREGISTER cmsUInt16Number Output[], + CMSREGISTER const cmsInterpParams* p16) { - cmsS15Fixed16Number fk; - cmsUInt32Number i, n; - cmsUInt16Number Tmp[MAX_STAGE_CHANNELS]; - cmsInterpParams p1 = *p16; + const cmsUInt16Number* LutTable = (cmsUInt16Number*) p16 -> Table; + cmsS15Fixed16Number fk; + cmsS15Fixed16Number k0, rk; + int K0, K1; + const cmsUInt16Number* T; + cmsUInt32Number i; + cmsUInt16Number Tmp1[MAX_STAGE_CHANNELS], Tmp2[MAX_STAGE_CHANNELS]; + cmsInterpParams p1; + + fk = _cmsToFixedDomain((cmsS15Fixed16Number) Input[0] * p16 -> Domain[0]); + k0 = FIXED_TO_INT(fk); + rk = FIXED_REST_TO_INT(fk); + + K0 = p16 -> opta[7] * k0; + K1 = p16 -> opta[7] * (k0 + (Input[0] != 0xFFFFU ? 1 : 0)); - memmove(&p1.Domain[0], &p16 ->Domain[1], 7*sizeof(cmsUInt32Number)); - fk = _cmsToFixedDomain((cmsS15Fixed16Number) Input[0] * p16 -> Domain[0]); - p1.Table = ((cmsUInt16Number*)p16 -> Table) + p16 -> opta[7] * FIXED_TO_INT(fk); + p1 = *p16; + memmove(&p1.Domain[0], &p16 ->Domain[1], 7*sizeof(cmsUInt32Number)); - Eval7Inputs(ContextID, Input + 1, Output, &p1); + T = LutTable + K0; + p1.Table = T; - if (Input[0] == 0xFFFFU) - return; + Eval7Inputs(ContextID, Input + 1, Tmp1, &p1); - p1.Table = ((cmsUInt16Number*)p1.Table) + p16 -> opta[7]; - Eval7Inputs(ContextID, Input + 1, Tmp, &p1); + T = LutTable + K1; + p1.Table = T; + Eval7Inputs(ContextID, Input + 1, Tmp2, &p1); - fk = FIXED_REST_TO_INT(fk); - n = p16 -> nOutputs; - for (i=0; i < n; i++) - Output[i] = LinearInterp(fk, Output[i], Tmp[i]); + for (i=0; i < p16 -> nOutputs; i++) { + Output[i] = LinearInterp(rk, Tmp1[i], Tmp2[i]); + } } @@ -1558,36 +1392,43 @@ void Eval8InputsFloat(cmsContext ContextID, const cmsFloat32Number Input[], cmsFloat32Number Output[], const cmsInterpParams* p) { - cmsFloat32Number rest; - cmsFloat32Number pk; - int k0; - cmsUInt32Number i, n; - cmsFloat32Number Tmp[MAX_STAGE_CHANNELS]; - cmsInterpParams p1 = *p; - cmsFloat32Number i0 = fclamp(Input[0]); + const cmsFloat32Number* LutTable = (cmsFloat32Number*) p -> Table; + cmsFloat32Number rest; + cmsFloat32Number pk; + int k0, K0, K1; + const cmsFloat32Number* T; + cmsUInt32Number i; + cmsFloat32Number Tmp1[MAX_STAGE_CHANNELS], Tmp2[MAX_STAGE_CHANNELS]; + cmsInterpParams p1; - pk = i0 * p->Domain[0]; - k0 = _cmsQuickFloor(pk); - rest = pk - (cmsFloat32Number) k0; + pk = fclamp(Input[0]) * p->Domain[0]; + k0 = _cmsQuickFloor(pk); + rest = pk - (cmsFloat32Number) k0; - memmove(&p1.Domain[0], &p ->Domain[1], 7*sizeof(cmsUInt32Number)); - p1.Table = ((cmsFloat32Number*) p -> Table) + p -> opta[7] * k0; + K0 = p -> opta[7] * k0; + K1 = K0 + (fclamp(Input[0]) >= 1.0 ? 0 : p->opta[7]); - Eval7InputsFloat(ContextID, Input + 1, Output, &p1); + p1 = *p; + memmove(&p1.Domain[0], &p ->Domain[1], 7*sizeof(cmsUInt32Number)); - if (i0 == 1.0) - return; + T = LutTable + K0; + p1.Table = T; - p1.Table = ((cmsFloat32Number*) p1.Table) + p->opta[7]; - Eval7InputsFloat(ContextID, Input + 1, Tmp, &p1); + Eval7InputsFloat(ContextID, Input + 1, Tmp1, &p1); - n = p -> nOutputs; - for (i=0; i < n; i++) { - cmsFloat32Number y0 = Output[i]; - cmsFloat32Number y1 = Tmp[i]; + T = LutTable + K1; + p1.Table = T; - Output[i] = y0 + (y1 - y0) * rest; - } + Eval7InputsFloat(ContextID, Input + 1, Tmp2, &p1); + + + for (i=0; i < p -> nOutputs; i++) { + + cmsFloat32Number y0 = Tmp1[i]; + cmsFloat32Number y1 = Tmp2[i]; + + Output[i] = y0 + (y1 - y0) * rest; + } } // The default factory @@ -1655,17 +1496,10 @@ cmsInterpFunction DefaultInterpolatorsFactory(cmsUInt32Number nInputChannels, cm case 4: // CMYK lut - if (IsTrilinear) { - if (IsFloat) - Interpolation.LerpFloat = QuadrilinearInterpFloat; - else - Interpolation.Lerp16 = QuadrilinearInterp16; - } else { - if (IsFloat) - Interpolation.LerpFloat = Eval4InputsFloat; - else - Interpolation.Lerp16 = Eval4Inputs; - } + if (IsFloat) + Interpolation.LerpFloat = Eval4InputsFloat; + else + Interpolation.Lerp16 = Eval4Inputs; break; case 5: // 5 Inks diff --git a/lcms2mt/src/cmsio0.c b/lcms2mt/src/cmsio0.c index 03b35e49..0dd6ca12 100644 --- a/lcms2mt/src/cmsio0.c +++ b/lcms2mt/src/cmsio0.c @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2017 Marti Maria Saguer +// Copyright (c) 1998-2020 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), diff --git a/lcms2mt/src/cmsio1.c b/lcms2mt/src/cmsio1.c index 627f8598..5c3d3fa2 100644 --- a/lcms2mt/src/cmsio1.c +++ b/lcms2mt/src/cmsio1.c @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2017 Marti Maria Saguer +// Copyright (c) 1998-2020 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -308,7 +308,6 @@ cmsPipeline* CMSEXPORT _cmsReadInputLUT(cmsContext ContextID, cmsHPROFILE hProfi cmsTagTypeSignature OriginalType; cmsTagSignature tag16; cmsTagSignature tagFloat; - int k; // On named color, take the appropriate tag if (cmsGetDeviceClass(ContextID, hProfile) == cmsSigNamedColorClass) { @@ -346,17 +345,9 @@ cmsPipeline* CMSEXPORT _cmsReadInputLUT(cmsContext ContextID, cmsHPROFILE hProfi return _cmsReadFloatInputTag(ContextID, hProfile, tagFloat); } - /* There are profiles out there (not legal) that may only have a - colorimetric or saturation tag and no perceptual tag. If we - can't find the specified intent be a bit robust and not give - up until we can't find any table, starting with perceptual */ + // Revert to perceptual if no tag is found if (!cmsIsTag(ContextID, hProfile, tag16)) { - for (k = 0; k < 3; k++) { - if (cmsIsTag(ContextID, hProfile, Device2PCS16[k])) { - tag16 = Device2PCS16[k]; - break; - } - } + tag16 = Device2PCS16[0]; } if (cmsIsTag(ContextID, hProfile, tag16)) { // Is there any LUT-Based table? diff --git a/lcms2mt/src/cmslut.c b/lcms2mt/src/cmslut.c index ae4d57d8..241b6ae8 100644 --- a/lcms2mt/src/cmslut.c +++ b/lcms2mt/src/cmslut.c @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2017 Marti Maria Saguer +// Copyright (c) 1998-2020 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -696,7 +696,7 @@ cmsStage* CMSEXPORT cmsStageAllocCLutFloatGranular(cmsContext ContextID, const c static -int IdentitySampler(cmsContext ContextID, register const cmsUInt16Number In[], register cmsUInt16Number Out[], register void * Cargo) +int IdentitySampler(cmsContext ContextID, CMSREGISTER const cmsUInt16Number In[], CMSREGISTER cmsUInt16Number Out[], CMSREGISTER void * Cargo) { int nChan = *(int*) Cargo; int i; @@ -1320,7 +1320,7 @@ cmsBool BlessLUT(cmsContext ContextID, cmsPipeline* lut) // Default to evaluate the LUT on 16 bit-basis. Precision is retained. static -void _LUTeval16(cmsContext ContextID, register const cmsUInt16Number In[], register cmsUInt16Number Out[], register const void* D) +void _LUTeval16(cmsContext ContextID, CMSREGISTER const cmsUInt16Number In[], CMSREGISTER cmsUInt16Number Out[], CMSREGISTER const void* D) { cmsPipeline* lut = (cmsPipeline*) D; cmsStage *mpe; @@ -1346,7 +1346,7 @@ void _LUTeval16(cmsContext ContextID, register const cmsUInt16Number In[], regis // Does evaluate the LUT on cmsFloat32Number-basis. static -void _LUTevalFloat(cmsContext ContextID, register const cmsFloat32Number In[], register cmsFloat32Number Out[], const void* D) +void _LUTevalFloat(cmsContext ContextID, CMSREGISTER const cmsFloat32Number In[], CMSREGISTER cmsFloat32Number Out[], const void* D) { cmsPipeline* lut = (cmsPipeline*) D; cmsStage *mpe; @@ -1841,5 +1841,3 @@ cmsBool CMSEXPORT cmsPipelineEvalReverseFloat(cmsContext ContextID, return TRUE; } - - diff --git a/lcms2mt/src/cmsmd5.c b/lcms2mt/src/cmsmd5.c index d3017ab3..61043040 100644 --- a/lcms2mt/src/cmsmd5.c +++ b/lcms2mt/src/cmsmd5.c @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2017 Marti Maria Saguer +// Copyright (c) 1998-2020 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -64,10 +64,9 @@ typedef struct { static -void MD5_Transform(cmsUInt32Number buf[4], cmsUInt32Number in[16]) - +void cmsMD5_Transform(cmsUInt32Number buf[4], cmsUInt32Number in[16]) { - register cmsUInt32Number a, b, c, d; + CMSREGISTER cmsUInt32Number a, b, c, d; a = buf[0]; b = buf[1]; @@ -150,8 +149,8 @@ void MD5_Transform(cmsUInt32Number buf[4], cmsUInt32Number in[16]) // Create a MD5 object -static -cmsHANDLE MD5alloc(cmsContext ContextID) + +cmsHANDLE CMSEXPORT cmsMD5alloc(cmsContext ContextID) { _cmsMD5* ctx = (_cmsMD5*) _cmsMallocZero(ContextID, sizeof(_cmsMD5)); if (ctx == NULL) return NULL; @@ -167,9 +166,7 @@ cmsHANDLE MD5alloc(cmsContext ContextID) return (cmsHANDLE) ctx; } - -static -void MD5add(cmsHANDLE Handle, cmsUInt8Number* buf, cmsUInt32Number len) +void CMSEXPORT cmsMD5add(cmsHANDLE Handle, const cmsUInt8Number* buf, cmsUInt32Number len) { _cmsMD5* ctx = (_cmsMD5*) Handle; cmsUInt32Number t; @@ -195,7 +192,7 @@ void MD5add(cmsHANDLE Handle, cmsUInt8Number* buf, cmsUInt32Number len) memmove(p, buf, t); byteReverse(ctx->in, 16); - MD5_Transform(ctx->buf, (cmsUInt32Number *) ctx->in); + cmsMD5_Transform(ctx->buf, (cmsUInt32Number *) ctx->in); buf += t; len -= t; } @@ -203,7 +200,7 @@ void MD5add(cmsHANDLE Handle, cmsUInt8Number* buf, cmsUInt32Number len) while (len >= 64) { memmove(ctx->in, buf, 64); byteReverse(ctx->in, 16); - MD5_Transform(ctx->buf, (cmsUInt32Number *) ctx->in); + cmsMD5_Transform(ctx->buf, (cmsUInt32Number *) ctx->in); buf += 64; len -= 64; } @@ -212,8 +209,7 @@ void MD5add(cmsHANDLE Handle, cmsUInt8Number* buf, cmsUInt32Number len) } // Destroy the object and return the checksum -static -void MD5finish(cmsContext ContextID, cmsProfileID* ProfileID, cmsHANDLE Handle) +void CMSEXPORT cmsMD5finish(cmsContext ContextID, cmsProfileID* ProfileID, cmsHANDLE Handle) { _cmsMD5* ctx = (_cmsMD5*) Handle; cmsUInt32Number count; @@ -230,7 +226,7 @@ void MD5finish(cmsContext ContextID, cmsProfileID* ProfileID, cmsHANDLE Handle) memset(p, 0, count); byteReverse(ctx->in, 16); - MD5_Transform(ctx->buf, (cmsUInt32Number *) ctx->in); + cmsMD5_Transform(ctx->buf, (cmsUInt32Number *) ctx->in); memset(ctx->in, 0, 56); } else { @@ -241,7 +237,7 @@ void MD5finish(cmsContext ContextID, cmsProfileID* ProfileID, cmsHANDLE Handle) ((cmsUInt32Number *) ctx->in)[14] = ctx->bits[0]; ((cmsUInt32Number *) ctx->in)[15] = ctx->bits[1]; - MD5_Transform(ctx->buf, (cmsUInt32Number *) ctx->in); + cmsMD5_Transform(ctx->buf, (cmsUInt32Number *) ctx->in); byteReverse((cmsUInt8Number *) ctx->buf, 4); memmove(ProfileID ->ID8, ctx->buf, 16); @@ -284,11 +280,11 @@ cmsBool CMSEXPORT cmsMD5computeID(cmsContext ContextID, cmsHPROFILE hProfile) if (!cmsSaveProfileToMem(ContextID, hProfile, Mem, &BytesNeeded)) goto Error; // Create MD5 object - MD5 = MD5alloc(ContextID); + MD5 = cmsMD5alloc(ContextID); if (MD5 == NULL) goto Error; // Add all bytes - MD5add(MD5, Mem, BytesNeeded); + cmsMD5add(MD5, Mem, BytesNeeded); // Temp storage is no longer needed _cmsFree(ContextID, Mem); @@ -297,7 +293,7 @@ cmsBool CMSEXPORT cmsMD5computeID(cmsContext ContextID, cmsHPROFILE hProfile) memmove(Icc, &Keep, sizeof(_cmsICCPROFILE)); // And store the ID - MD5finish(ContextID, &Icc ->ProfileID, MD5); + cmsMD5finish(ContextID, &Icc ->ProfileID, MD5); return TRUE; Error: @@ -308,4 +304,3 @@ Error: memmove(Icc, &Keep, sizeof(_cmsICCPROFILE)); return FALSE; } - diff --git a/lcms2mt/src/cmsmtrx.c b/lcms2mt/src/cmsmtrx.c index b6766947..490ec586 100644 --- a/lcms2mt/src/cmsmtrx.c +++ b/lcms2mt/src/cmsmtrx.c @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2017 Marti Maria Saguer +// Copyright (c) 1998-2020 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), diff --git a/lcms2mt/src/cmsnamed.c b/lcms2mt/src/cmsnamed.c index aac045b2..cd751b47 100644 --- a/lcms2mt/src/cmsnamed.c +++ b/lcms2mt/src/cmsnamed.c @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2017 Marti Maria Saguer +// Copyright (c) 1998-2020 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -541,7 +541,7 @@ cmsNAMEDCOLORLIST* CMSEXPORT cmsAllocNamedColorList(cmsContext ContextID, cmsUIn while (v -> Allocated < n) { if (!GrowNamedColorList(ContextID, v)) { - _cmsFree(ContextID, (void*) v); + cmsFreeNamedColorList(ContextID, v); return NULL; } } @@ -574,7 +574,11 @@ cmsNAMEDCOLORLIST* CMSEXPORT cmsDupNamedColorList(cmsContext ContextID, const cm // For really large tables we need this while (NewNC ->Allocated < v ->Allocated){ - if (!GrowNamedColorList(ContextID, NewNC)) return NULL; + if (!GrowNamedColorList(ContextID, NewNC)) + { + cmsFreeNamedColorList(ContextID, NewNC); + return NULL; + } } memmove(NewNC ->Prefix, v ->Prefix, sizeof(v ->Prefix)); diff --git a/lcms2mt/src/cmsopt.c b/lcms2mt/src/cmsopt.c index fedb5043..7fb5e029 100644 --- a/lcms2mt/src/cmsopt.c +++ b/lcms2mt/src/cmsopt.c @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2017 Marti Maria Saguer +// Copyright (c) 1998-2020 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -285,9 +285,10 @@ cmsBool PreOptimize(cmsContext ContextID, cmsPipeline* Lut) } static -void Eval16nop1D(cmsContext ContextID, register const cmsUInt16Number Input[], - register cmsUInt16Number Output[], - register const struct _cms_interp_struc* p) +void Eval16nop1D(cmsContext ContextID, + CMSREGISTER const cmsUInt16Number Input[], + CMSREGISTER cmsUInt16Number Output[], + CMSREGISTER const struct _cms_interp_struc* p) { cmsUNUSED_PARAMETER(ContextID); Output[0] = Input[0]; @@ -296,9 +297,10 @@ void Eval16nop1D(cmsContext ContextID, register const cmsUInt16Number Input[], } static -void PrelinEval16(cmsContext ContextID, register const cmsUInt16Number Input[], - register cmsUInt16Number Output[], - register const void* D) +void PrelinEval16(cmsContext ContextID, + CMSREGISTER const cmsUInt16Number Input[], + CMSREGISTER cmsUInt16Number Output[], + CMSREGISTER const void* D) { Prelin16Data* p16 = (Prelin16Data*) D; cmsUInt16Number StageABC[MAX_INPUT_DIMENSIONS]; @@ -404,7 +406,7 @@ Prelin16Data* PrelinOpt16alloc(cmsContext ContextID, // Sampler implemented by another LUT. This is a clean way to precalculate the devicelink 3D CLUT for // almost any transform. We use floating point precision and then convert from floating point to 16 bits. static -cmsInt32Number XFormSampler16(cmsContext ContextID, register const cmsUInt16Number In[], register cmsUInt16Number Out[], register void* Cargo) +cmsInt32Number XFormSampler16(cmsContext ContextID, CMSREGISTER const cmsUInt16Number In[], CMSREGISTER cmsUInt16Number Out[], CMSREGISTER void* Cargo) { cmsPipeline* Lut = (cmsPipeline*) Cargo; cmsFloat32Number InFloat[cmsMAXCHANNELS], OutFloat[cmsMAXCHANNELS]; @@ -695,10 +697,8 @@ cmsBool OptimizeByResampling(cmsContext ContextID, cmsPipeline** Lut, cmsUInt32N } } - ContextID->dwFlags = *dwFlags; // Allocate the CLUT CLUT = cmsStageAllocCLut16bit(ContextID, nGridPoints, Src ->InputChannels, Src->OutputChannels, NULL); - ContextID->dwFlags = 0; if (CLUT == NULL) goto Error; // Add the CLUT to the destination LUT @@ -909,17 +909,18 @@ void* Prelin8dup(cmsContext ContextID, const void* ptr) // A optimized interpolation for 8-bit input. #define DENS(i,j,k) (LutTable[(i)+(j)+(k)+OutChan]) static CMS_NO_SANITIZE -void PrelinEval8(cmsContext ContextID, register const cmsUInt16Number Input[], - register cmsUInt16Number Output[], - register const void* D) +void PrelinEval8(cmsContext ContextID, + CMSREGISTER const cmsUInt16Number Input[], + CMSREGISTER cmsUInt16Number Output[], + CMSREGISTER const void* D) { cmsUInt8Number r, g, b; cmsS15Fixed16Number rx, ry, rz; cmsS15Fixed16Number c0, c1, c2, c3, Rest; int OutChan; - register cmsS15Fixed16Number X0, X1, Y0, Y1, Z0, Z1; + CMSREGISTER cmsS15Fixed16Number X0, X1, Y0, Y1, Z0, Z1; Prelin8Data* p8 = (Prelin8Data*) D; - register const cmsInterpParams* p = p8 ->p; + CMSREGISTER const cmsInterpParams* p = p8 ->p; int TotalOut = (int) p -> nOutputs; const cmsUInt16Number* LutTable = (const cmsUInt16Number*) p->Table; cmsUNUSED_PARAMETER(ContextID); @@ -1084,6 +1085,7 @@ cmsBool OptimizeByComputingLinearization(cmsContext ContextID, cmsPipeline** Lut { cmsStage* last = cmsPipelineGetPtrToLastStage(ContextID, OriginalLut); + if (last == NULL) goto Error; if (cmsStageType(ContextID, last) == cmsSigCurveSetElemType) { _cmsStageToneCurvesData* Data = (_cmsStageToneCurvesData*)cmsStageData(ContextID, last); @@ -1330,9 +1332,10 @@ Curves16Data* CurvesAlloc(cmsContext ContextID, cmsUInt32Number nCurves, cmsUInt } static -void FastEvaluateCurves8(cmsContext ContextID, register const cmsUInt16Number In[], - register cmsUInt16Number Out[], - register const void* D) +void FastEvaluateCurves8(cmsContext ContextID, + CMSREGISTER const cmsUInt16Number In[], + CMSREGISTER cmsUInt16Number Out[], + CMSREGISTER const void* D) { Curves16Data* Data = (Curves16Data*) D; int x; @@ -1348,9 +1351,10 @@ void FastEvaluateCurves8(cmsContext ContextID, register const cmsUInt16Number In static -void FastEvaluateCurves16(cmsContext ContextID, register const cmsUInt16Number In[], - register cmsUInt16Number Out[], - register const void* D) +void FastEvaluateCurves16(cmsContext ContextID, + CMSREGISTER const cmsUInt16Number In[], + CMSREGISTER cmsUInt16Number Out[], + CMSREGISTER const void* D) { Curves16Data* Data = (Curves16Data*) D; cmsUInt32Number i; @@ -1363,9 +1367,10 @@ void FastEvaluateCurves16(cmsContext ContextID, register const cmsUInt16Number I static -void FastIdentity16(cmsContext ContextID, register const cmsUInt16Number In[], - register cmsUInt16Number Out[], - register const void* D) +void FastIdentity16(cmsContext ContextID, + CMSREGISTER const cmsUInt16Number In[], + CMSREGISTER cmsUInt16Number Out[], + CMSREGISTER const void* D) { cmsPipeline* Lut = (cmsPipeline*) D; cmsUInt32Number i; @@ -1524,9 +1529,10 @@ void* DupMatShaper(cmsContext ContextID, const void* Data) // to accomplish some performance. Actually it takes 256x3 16 bits tables and 16385 x 3 tables of 8 bits, // in total about 50K, and the performance boost is huge! static -void MatShaperEval16(cmsContext ContextID, register const cmsUInt16Number In[], - register cmsUInt16Number Out[], - register const void* D) +void MatShaperEval16(cmsContext ContextID, + CMSREGISTER const cmsUInt16Number In[], + CMSREGISTER cmsUInt16Number Out[], + CMSREGISTER const void* D) { MatShaper8Data* p = (MatShaper8Data*) D; cmsS1Fixed14Number l1, l2, l3, r, g, b; diff --git a/lcms2mt/src/cmspack.c b/lcms2mt/src/cmspack.c index c9ded389..150c081d 100644 --- a/lcms2mt/src/cmspack.c +++ b/lcms2mt/src/cmspack.c @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2017 Marti Maria Saguer +// Copyright (c) 1998-2020 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -92,10 +92,11 @@ typedef struct { // Does almost everything but is slow static -cmsUInt8Number* UnrollChunkyBytes(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wIn[], - register cmsUInt8Number* accum, - register cmsUInt32Number Stride) +cmsUInt8Number* UnrollChunkyBytes(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wIn[], + CMSREGISTER cmsUInt8Number* accum, + CMSREGISTER cmsUInt32Number Stride) { cmsUInt32Number nChan = T_CHANNELS(info -> InputFormat); cmsUInt32Number DoSwap = T_DOSWAP(info ->InputFormat); @@ -139,10 +140,11 @@ cmsUInt8Number* UnrollChunkyBytes(cmsContext ContextID, register _cmsTRANSFORM* // Extra channels are just ignored because come in the next planes static -cmsUInt8Number* UnrollPlanarBytes(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wIn[], - register cmsUInt8Number* accum, - register cmsUInt32Number Stride) +cmsUInt8Number* UnrollPlanarBytes(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wIn[], + CMSREGISTER cmsUInt8Number* accum, + CMSREGISTER cmsUInt32Number Stride) { cmsUInt32Number nChan = T_CHANNELS(info -> InputFormat); cmsUInt32Number DoSwap = T_DOSWAP(info ->InputFormat); @@ -169,10 +171,11 @@ cmsUInt8Number* UnrollPlanarBytes(cmsContext ContextID, register _cmsTRANSFORM* // Special cases, provided for performance static -cmsUInt8Number* Unroll4Bytes(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wIn[], - register cmsUInt8Number* accum, - register cmsUInt32Number Stride) +cmsUInt8Number* Unroll4Bytes(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wIn[], + CMSREGISTER cmsUInt8Number* accum, + CMSREGISTER cmsUInt32Number Stride) { wIn[0] = FROM_8_TO_16(*accum); accum++; // C wIn[1] = FROM_8_TO_16(*accum); accum++; // M @@ -186,10 +189,11 @@ cmsUInt8Number* Unroll4Bytes(cmsContext ContextID, register _cmsTRANSFORM* info, } static -cmsUInt8Number* Unroll4BytesReverse(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wIn[], - register cmsUInt8Number* accum, - register cmsUInt32Number Stride) +cmsUInt8Number* Unroll4BytesReverse(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wIn[], + CMSREGISTER cmsUInt8Number* accum, + CMSREGISTER cmsUInt32Number Stride) { wIn[0] = FROM_8_TO_16(REVERSE_FLAVOR_8(*accum)); accum++; // C wIn[1] = FROM_8_TO_16(REVERSE_FLAVOR_8(*accum)); accum++; // M @@ -203,10 +207,11 @@ cmsUInt8Number* Unroll4BytesReverse(cmsContext ContextID, register _cmsTRANSFORM } static -cmsUInt8Number* Unroll4BytesSwapFirst(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wIn[], - register cmsUInt8Number* accum, - register cmsUInt32Number Stride) +cmsUInt8Number* Unroll4BytesSwapFirst(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wIn[], + CMSREGISTER cmsUInt8Number* accum, + CMSREGISTER cmsUInt32Number Stride) { wIn[3] = FROM_8_TO_16(*accum); accum++; // K wIn[0] = FROM_8_TO_16(*accum); accum++; // C @@ -221,10 +226,11 @@ cmsUInt8Number* Unroll4BytesSwapFirst(cmsContext ContextID, register _cmsTRANSFO // KYMC static -cmsUInt8Number* Unroll4BytesSwap(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wIn[], - register cmsUInt8Number* accum, - register cmsUInt32Number Stride) +cmsUInt8Number* Unroll4BytesSwap(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wIn[], + CMSREGISTER cmsUInt8Number* accum, + CMSREGISTER cmsUInt32Number Stride) { wIn[3] = FROM_8_TO_16(*accum); accum++; // K wIn[2] = FROM_8_TO_16(*accum); accum++; // Y @@ -238,10 +244,11 @@ cmsUInt8Number* Unroll4BytesSwap(cmsContext ContextID, register _cmsTRANSFORM* i } static -cmsUInt8Number* Unroll4BytesSwapSwapFirst(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wIn[], - register cmsUInt8Number* accum, - register cmsUInt32Number Stride) +cmsUInt8Number* Unroll4BytesSwapSwapFirst(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wIn[], + CMSREGISTER cmsUInt8Number* accum, + CMSREGISTER cmsUInt32Number Stride) { wIn[2] = FROM_8_TO_16(*accum); accum++; // K wIn[1] = FROM_8_TO_16(*accum); accum++; // Y @@ -255,10 +262,11 @@ cmsUInt8Number* Unroll4BytesSwapSwapFirst(cmsContext ContextID, register _cmsTRA } static -cmsUInt8Number* Unroll3Bytes(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wIn[], - register cmsUInt8Number* accum, - register cmsUInt32Number Stride) +cmsUInt8Number* Unroll3Bytes(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wIn[], + CMSREGISTER cmsUInt8Number* accum, + CMSREGISTER cmsUInt32Number Stride) { wIn[0] = FROM_8_TO_16(*accum); accum++; // R wIn[1] = FROM_8_TO_16(*accum); accum++; // G @@ -271,10 +279,11 @@ cmsUInt8Number* Unroll3Bytes(cmsContext ContextID, register _cmsTRANSFORM* info, } static -cmsUInt8Number* Unroll3BytesSkip1Swap(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wIn[], - register cmsUInt8Number* accum, - register cmsUInt32Number Stride) +cmsUInt8Number* Unroll3BytesSkip1Swap(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wIn[], + CMSREGISTER cmsUInt8Number* accum, + CMSREGISTER cmsUInt32Number Stride) { accum++; // A wIn[2] = FROM_8_TO_16(*accum); accum++; // B @@ -288,10 +297,11 @@ cmsUInt8Number* Unroll3BytesSkip1Swap(cmsContext ContextID, register _cmsTRANSFO } static -cmsUInt8Number* Unroll3BytesSkip1SwapSwapFirst(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wIn[], - register cmsUInt8Number* accum, - register cmsUInt32Number Stride) +cmsUInt8Number* Unroll3BytesSkip1SwapSwapFirst(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wIn[], + CMSREGISTER cmsUInt8Number* accum, + CMSREGISTER cmsUInt32Number Stride) { wIn[2] = FROM_8_TO_16(*accum); accum++; // B wIn[1] = FROM_8_TO_16(*accum); accum++; // G @@ -305,10 +315,11 @@ cmsUInt8Number* Unroll3BytesSkip1SwapSwapFirst(cmsContext ContextID, register _c } static -cmsUInt8Number* Unroll3BytesSkip1SwapFirst(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wIn[], - register cmsUInt8Number* accum, - register cmsUInt32Number Stride) +cmsUInt8Number* Unroll3BytesSkip1SwapFirst(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wIn[], + CMSREGISTER cmsUInt8Number* accum, + CMSREGISTER cmsUInt32Number Stride) { accum++; // A wIn[0] = FROM_8_TO_16(*accum); accum++; // R @@ -324,10 +335,11 @@ cmsUInt8Number* Unroll3BytesSkip1SwapFirst(cmsContext ContextID, register _cmsTR // BRG static -cmsUInt8Number* Unroll3BytesSwap(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wIn[], - register cmsUInt8Number* accum, - register cmsUInt32Number Stride) +cmsUInt8Number* Unroll3BytesSwap(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wIn[], + CMSREGISTER cmsUInt8Number* accum, + CMSREGISTER cmsUInt32Number Stride) { wIn[2] = FROM_8_TO_16(*accum); accum++; // B wIn[1] = FROM_8_TO_16(*accum); accum++; // G @@ -340,10 +352,11 @@ cmsUInt8Number* Unroll3BytesSwap(cmsContext ContextID, register _cmsTRANSFORM* i } static -cmsUInt8Number* UnrollLabV2_8(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wIn[], - register cmsUInt8Number* accum, - register cmsUInt32Number Stride) +cmsUInt8Number* UnrollLabV2_8(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wIn[], + CMSREGISTER cmsUInt8Number* accum, + CMSREGISTER cmsUInt32Number Stride) { wIn[0] = FomLabV2ToLabV4(FROM_8_TO_16(*accum)); accum++; // L wIn[1] = FomLabV2ToLabV4(FROM_8_TO_16(*accum)); accum++; // a @@ -356,10 +369,11 @@ cmsUInt8Number* UnrollLabV2_8(cmsContext ContextID, register _cmsTRANSFORM* info } static -cmsUInt8Number* UnrollALabV2_8(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wIn[], - register cmsUInt8Number* accum, - register cmsUInt32Number Stride) +cmsUInt8Number* UnrollALabV2_8(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wIn[], + CMSREGISTER cmsUInt8Number* accum, + CMSREGISTER cmsUInt32Number Stride) { accum++; // A wIn[0] = FomLabV2ToLabV4(FROM_8_TO_16(*accum)); accum++; // L @@ -373,10 +387,11 @@ cmsUInt8Number* UnrollALabV2_8(cmsContext ContextID, register _cmsTRANSFORM* inf } static -cmsUInt8Number* UnrollLabV2_16(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wIn[], - register cmsUInt8Number* accum, - register cmsUInt32Number Stride) +cmsUInt8Number* UnrollLabV2_16(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wIn[], + CMSREGISTER cmsUInt8Number* accum, + CMSREGISTER cmsUInt32Number Stride) { wIn[0] = FomLabV2ToLabV4(*(cmsUInt16Number*) accum); accum += 2; // L wIn[1] = FomLabV2ToLabV4(*(cmsUInt16Number*) accum); accum += 2; // a @@ -390,10 +405,11 @@ cmsUInt8Number* UnrollLabV2_16(cmsContext ContextID, register _cmsTRANSFORM* inf // for duplex static -cmsUInt8Number* Unroll2Bytes(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wIn[], - register cmsUInt8Number* accum, - register cmsUInt32Number Stride) +cmsUInt8Number* Unroll2Bytes(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wIn[], + CMSREGISTER cmsUInt8Number* accum, + CMSREGISTER cmsUInt32Number Stride) { wIn[0] = FROM_8_TO_16(*accum); accum++; // ch1 wIn[1] = FROM_8_TO_16(*accum); accum++; // ch2 @@ -409,10 +425,11 @@ cmsUInt8Number* Unroll2Bytes(cmsContext ContextID, register _cmsTRANSFORM* info, // Monochrome duplicates L into RGB for null-transforms static -cmsUInt8Number* Unroll1Byte(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wIn[], - register cmsUInt8Number* accum, - register cmsUInt32Number Stride) +cmsUInt8Number* Unroll1Byte(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wIn[], + CMSREGISTER cmsUInt8Number* accum, + CMSREGISTER cmsUInt32Number Stride) { wIn[0] = wIn[1] = wIn[2] = FROM_8_TO_16(*accum); accum++; // L @@ -424,10 +441,11 @@ cmsUInt8Number* Unroll1Byte(cmsContext ContextID, register _cmsTRANSFORM* info, static -cmsUInt8Number* Unroll1ByteSkip1(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wIn[], - register cmsUInt8Number* accum, - register cmsUInt32Number Stride) +cmsUInt8Number* Unroll1ByteSkip1(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wIn[], + CMSREGISTER cmsUInt8Number* accum, + CMSREGISTER cmsUInt32Number Stride) { wIn[0] = wIn[1] = wIn[2] = FROM_8_TO_16(*accum); accum++; // L accum += 1; @@ -439,10 +457,11 @@ cmsUInt8Number* Unroll1ByteSkip1(cmsContext ContextID, register _cmsTRANSFORM* i } static -cmsUInt8Number* Unroll1ByteSkip2(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wIn[], - register cmsUInt8Number* accum, - register cmsUInt32Number Stride) +cmsUInt8Number* Unroll1ByteSkip2(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wIn[], + CMSREGISTER cmsUInt8Number* accum, + CMSREGISTER cmsUInt32Number Stride) { wIn[0] = wIn[1] = wIn[2] = FROM_8_TO_16(*accum); accum++; // L accum += 2; @@ -454,10 +473,11 @@ cmsUInt8Number* Unroll1ByteSkip2(cmsContext ContextID, register _cmsTRANSFORM* i } static -cmsUInt8Number* Unroll1ByteReversed(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wIn[], - register cmsUInt8Number* accum, - register cmsUInt32Number Stride) +cmsUInt8Number* Unroll1ByteReversed(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wIn[], + CMSREGISTER cmsUInt8Number* accum, + CMSREGISTER cmsUInt32Number Stride) { wIn[0] = wIn[1] = wIn[2] = REVERSE_FLAVOR_16(FROM_8_TO_16(*accum)); accum++; // L @@ -469,10 +489,11 @@ cmsUInt8Number* Unroll1ByteReversed(cmsContext ContextID, register _cmsTRANSFORM static -cmsUInt8Number* UnrollAnyWords(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wIn[], - register cmsUInt8Number* accum, - register cmsUInt32Number Stride) +cmsUInt8Number* UnrollAnyWords(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wIn[], + CMSREGISTER cmsUInt8Number* accum, + CMSREGISTER cmsUInt32Number Stride) { cmsUInt32Number nChan = T_CHANNELS(info -> InputFormat); cmsUInt32Number SwapEndian = T_ENDIAN16(info -> InputFormat); @@ -518,10 +539,11 @@ cmsUInt8Number* UnrollAnyWords(cmsContext ContextID, register _cmsTRANSFORM* inf } static -cmsUInt8Number* UnrollPlanarWords(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wIn[], - register cmsUInt8Number* accum, - register cmsUInt32Number Stride) +cmsUInt8Number* UnrollPlanarWords(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wIn[], + CMSREGISTER cmsUInt8Number* accum, + CMSREGISTER cmsUInt32Number Stride) { cmsUInt32Number nChan = T_CHANNELS(info -> InputFormat); cmsUInt32Number DoSwap= T_DOSWAP(info ->InputFormat); @@ -552,10 +574,11 @@ cmsUInt8Number* UnrollPlanarWords(cmsContext ContextID, register _cmsTRANSFORM* static -cmsUInt8Number* Unroll4Words(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wIn[], - register cmsUInt8Number* accum, - register cmsUInt32Number Stride) +cmsUInt8Number* Unroll4Words(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wIn[], + CMSREGISTER cmsUInt8Number* accum, + CMSREGISTER cmsUInt32Number Stride) { wIn[0] = *(cmsUInt16Number*) accum; accum+= 2; // C wIn[1] = *(cmsUInt16Number*) accum; accum+= 2; // M @@ -569,10 +592,11 @@ cmsUInt8Number* Unroll4Words(cmsContext ContextID, register _cmsTRANSFORM* info, } static -cmsUInt8Number* Unroll4WordsReverse(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wIn[], - register cmsUInt8Number* accum, - register cmsUInt32Number Stride) +cmsUInt8Number* Unroll4WordsReverse(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wIn[], + CMSREGISTER cmsUInt8Number* accum, + CMSREGISTER cmsUInt32Number Stride) { wIn[0] = REVERSE_FLAVOR_16(*(cmsUInt16Number*) accum); accum+= 2; // C wIn[1] = REVERSE_FLAVOR_16(*(cmsUInt16Number*) accum); accum+= 2; // M @@ -586,10 +610,11 @@ cmsUInt8Number* Unroll4WordsReverse(cmsContext ContextID, register _cmsTRANSFORM } static -cmsUInt8Number* Unroll4WordsSwapFirst(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wIn[], - register cmsUInt8Number* accum, - register cmsUInt32Number Stride) +cmsUInt8Number* Unroll4WordsSwapFirst(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wIn[], + CMSREGISTER cmsUInt8Number* accum, + CMSREGISTER cmsUInt32Number Stride) { wIn[3] = *(cmsUInt16Number*) accum; accum+= 2; // K wIn[0] = *(cmsUInt16Number*) accum; accum+= 2; // C @@ -604,10 +629,11 @@ cmsUInt8Number* Unroll4WordsSwapFirst(cmsContext ContextID, register _cmsTRANSFO // KYMC static -cmsUInt8Number* Unroll4WordsSwap(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wIn[], - register cmsUInt8Number* accum, - register cmsUInt32Number Stride) +cmsUInt8Number* Unroll4WordsSwap(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wIn[], + CMSREGISTER cmsUInt8Number* accum, + CMSREGISTER cmsUInt32Number Stride) { wIn[3] = *(cmsUInt16Number*) accum; accum+= 2; // K wIn[2] = *(cmsUInt16Number*) accum; accum+= 2; // Y @@ -621,10 +647,11 @@ cmsUInt8Number* Unroll4WordsSwap(cmsContext ContextID, register _cmsTRANSFORM* i } static -cmsUInt8Number* Unroll4WordsSwapSwapFirst(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wIn[], - register cmsUInt8Number* accum, - register cmsUInt32Number Stride) +cmsUInt8Number* Unroll4WordsSwapSwapFirst(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wIn[], + CMSREGISTER cmsUInt8Number* accum, + CMSREGISTER cmsUInt32Number Stride) { wIn[2] = *(cmsUInt16Number*) accum; accum+= 2; // K wIn[1] = *(cmsUInt16Number*) accum; accum+= 2; // Y @@ -638,10 +665,11 @@ cmsUInt8Number* Unroll4WordsSwapSwapFirst(cmsContext ContextID, register _cmsTRA } static -cmsUInt8Number* Unroll3Words(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wIn[], - register cmsUInt8Number* accum, - register cmsUInt32Number Stride) +cmsUInt8Number* Unroll3Words(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wIn[], + CMSREGISTER cmsUInt8Number* accum, + CMSREGISTER cmsUInt32Number Stride) { wIn[0] = *(cmsUInt16Number*) accum; accum+= 2; // C R wIn[1] = *(cmsUInt16Number*) accum; accum+= 2; // M G @@ -654,10 +682,11 @@ cmsUInt8Number* Unroll3Words(cmsContext ContextID, register _cmsTRANSFORM* info, } static -cmsUInt8Number* Unroll3WordsSwap(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wIn[], - register cmsUInt8Number* accum, - register cmsUInt32Number Stride) +cmsUInt8Number* Unroll3WordsSwap(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wIn[], + CMSREGISTER cmsUInt8Number* accum, + CMSREGISTER cmsUInt32Number Stride) { wIn[2] = *(cmsUInt16Number*) accum; accum+= 2; // C R wIn[1] = *(cmsUInt16Number*) accum; accum+= 2; // M G @@ -670,10 +699,11 @@ cmsUInt8Number* Unroll3WordsSwap(cmsContext ContextID, register _cmsTRANSFORM* i } static -cmsUInt8Number* Unroll3WordsSkip1Swap(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wIn[], - register cmsUInt8Number* accum, - register cmsUInt32Number Stride) +cmsUInt8Number* Unroll3WordsSkip1Swap(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wIn[], + CMSREGISTER cmsUInt8Number* accum, + CMSREGISTER cmsUInt32Number Stride) { accum += 2; // A wIn[2] = *(cmsUInt16Number*) accum; accum += 2; // R @@ -687,10 +717,11 @@ cmsUInt8Number* Unroll3WordsSkip1Swap(cmsContext ContextID, register _cmsTRANSFO } static -cmsUInt8Number* Unroll3WordsSkip1SwapFirst(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wIn[], - register cmsUInt8Number* accum, - register cmsUInt32Number Stride) +cmsUInt8Number* Unroll3WordsSkip1SwapFirst(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wIn[], + CMSREGISTER cmsUInt8Number* accum, + CMSREGISTER cmsUInt32Number Stride) { accum += 2; // A wIn[0] = *(cmsUInt16Number*) accum; accum += 2; // R @@ -704,10 +735,11 @@ cmsUInt8Number* Unroll3WordsSkip1SwapFirst(cmsContext ContextID, register _cmsTR } static -cmsUInt8Number* Unroll1Word(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wIn[], - register cmsUInt8Number* accum, - register cmsUInt32Number Stride) +cmsUInt8Number* Unroll1Word(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wIn[], + CMSREGISTER cmsUInt8Number* accum, + CMSREGISTER cmsUInt32Number Stride) { wIn[0] = wIn[1] = wIn[2] = *(cmsUInt16Number*) accum; accum+= 2; // L @@ -718,10 +750,11 @@ cmsUInt8Number* Unroll1Word(cmsContext ContextID, register _cmsTRANSFORM* info, } static -cmsUInt8Number* Unroll1WordReversed(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wIn[], - register cmsUInt8Number* accum, - register cmsUInt32Number Stride) +cmsUInt8Number* Unroll1WordReversed(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wIn[], + CMSREGISTER cmsUInt8Number* accum, + CMSREGISTER cmsUInt32Number Stride) { wIn[0] = wIn[1] = wIn[2] = REVERSE_FLAVOR_16(*(cmsUInt16Number*) accum); accum+= 2; @@ -732,10 +765,11 @@ cmsUInt8Number* Unroll1WordReversed(cmsContext ContextID, register _cmsTRANSFORM } static -cmsUInt8Number* Unroll1WordSkip3(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wIn[], - register cmsUInt8Number* accum, - register cmsUInt32Number Stride) +cmsUInt8Number* Unroll1WordSkip3(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wIn[], + CMSREGISTER cmsUInt8Number* accum, + CMSREGISTER cmsUInt32Number Stride) { wIn[0] = wIn[1] = wIn[2] = *(cmsUInt16Number*) accum; @@ -748,10 +782,11 @@ cmsUInt8Number* Unroll1WordSkip3(cmsContext ContextID, register _cmsTRANSFORM* i } static -cmsUInt8Number* Unroll2Words(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wIn[], - register cmsUInt8Number* accum, - register cmsUInt32Number Stride) +cmsUInt8Number* Unroll2Words(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wIn[], + CMSREGISTER cmsUInt8Number* accum, + CMSREGISTER cmsUInt32Number Stride) { wIn[0] = *(cmsUInt16Number*) accum; accum += 2; // ch1 wIn[1] = *(cmsUInt16Number*) accum; accum += 2; // ch2 @@ -765,10 +800,11 @@ cmsUInt8Number* Unroll2Words(cmsContext ContextID, register _cmsTRANSFORM* info, // This is a conversion of Lab double to 16 bits static -cmsUInt8Number* UnrollLabDoubleTo16(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wIn[], - register cmsUInt8Number* accum, - register cmsUInt32Number Stride) +cmsUInt8Number* UnrollLabDoubleTo16(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wIn[], + CMSREGISTER cmsUInt8Number* accum, + CMSREGISTER cmsUInt32Number Stride) { if (T_PLANAR(info -> InputFormat)) { @@ -799,10 +835,11 @@ cmsUInt8Number* UnrollLabDoubleTo16(cmsContext ContextID, register _cmsTRANSFORM // This is a conversion of Lab float to 16 bits static -cmsUInt8Number* UnrollLabFloatTo16(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wIn[], - register cmsUInt8Number* accum, - register cmsUInt32Number Stride) +cmsUInt8Number* UnrollLabFloatTo16(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wIn[], + CMSREGISTER cmsUInt8Number* accum, + CMSREGISTER cmsUInt32Number Stride) { cmsCIELab Lab; @@ -837,10 +874,11 @@ cmsUInt8Number* UnrollLabFloatTo16(cmsContext ContextID, register _cmsTRANSFORM* // This is a conversion of XYZ double to 16 bits static -cmsUInt8Number* UnrollXYZDoubleTo16(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wIn[], - register cmsUInt8Number* accum, - register cmsUInt32Number Stride) +cmsUInt8Number* UnrollXYZDoubleTo16(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wIn[], + CMSREGISTER cmsUInt8Number* accum, + CMSREGISTER cmsUInt32Number Stride) { if (T_PLANAR(info -> InputFormat)) { @@ -873,10 +911,11 @@ cmsUInt8Number* UnrollXYZDoubleTo16(cmsContext ContextID, register _cmsTRANSFORM // This is a conversion of XYZ float to 16 bits static -cmsUInt8Number* UnrollXYZFloatTo16(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wIn[], - register cmsUInt8Number* accum, - register cmsUInt32Number Stride) +cmsUInt8Number* UnrollXYZFloatTo16(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wIn[], + CMSREGISTER cmsUInt8Number* accum, + CMSREGISTER cmsUInt32Number Stride) { if (T_PLANAR(info -> InputFormat)) { @@ -953,10 +992,11 @@ cmsUInt32Number PixelSize(cmsUInt32Number Format) // Inks does come in percentage, remaining cases are between 0..1.0, again to 16 bits static -cmsUInt8Number* UnrollDoubleTo16(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wIn[], - register cmsUInt8Number* accum, - register cmsUInt32Number Stride) +cmsUInt8Number* UnrollDoubleTo16(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wIn[], + CMSREGISTER cmsUInt8Number* accum, + CMSREGISTER cmsUInt32Number Stride) { cmsUInt32Number nChan = T_CHANNELS(info -> InputFormat); @@ -1011,10 +1051,11 @@ cmsUInt8Number* UnrollDoubleTo16(cmsContext ContextID, register _cmsTRANSFORM* i static -cmsUInt8Number* UnrollFloatTo16(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wIn[], - register cmsUInt8Number* accum, - register cmsUInt32Number Stride) +cmsUInt8Number* UnrollFloatTo16(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wIn[], + CMSREGISTER cmsUInt8Number* accum, + CMSREGISTER cmsUInt32Number Stride) { cmsUInt32Number nChan = T_CHANNELS(info -> InputFormat); @@ -1070,10 +1111,11 @@ cmsUInt8Number* UnrollFloatTo16(cmsContext ContextID, register _cmsTRANSFORM* in // For 1 channel, we need to duplicate data (it comes in 0..1.0 range) static -cmsUInt8Number* UnrollDouble1Chan(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wIn[], - register cmsUInt8Number* accum, - register cmsUInt32Number Stride) +cmsUInt8Number* UnrollDouble1Chan(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wIn[], + CMSREGISTER cmsUInt8Number* accum, + CMSREGISTER cmsUInt32Number Stride) { cmsFloat64Number* Inks = (cmsFloat64Number*) accum; @@ -1323,10 +1365,11 @@ cmsUInt8Number* UnrollXYZFloatToFloat(cmsContext ContextID, _cmsTRANSFORM* info, // Generic chunky for byte static -cmsUInt8Number* PackAnyBytes(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* PackAnyBytes(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { cmsUInt32Number nChan = T_CHANNELS(info -> OutputFormat); cmsUInt32Number DoSwap = T_DOSWAP(info ->OutputFormat); @@ -1375,10 +1418,11 @@ cmsUInt8Number* PackAnyBytes(cmsContext ContextID, register _cmsTRANSFORM* info, static -cmsUInt8Number* PackAnyWords(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* PackAnyWords(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { cmsUInt32Number nChan = T_CHANNELS(info -> OutputFormat); cmsUInt32Number SwapEndian = T_ENDIAN16(info -> OutputFormat); @@ -1432,10 +1476,11 @@ cmsUInt8Number* PackAnyWords(cmsContext ContextID, register _cmsTRANSFORM* info, static -cmsUInt8Number* PackPlanarBytes(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* PackPlanarBytes(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { cmsUInt32Number nChan = T_CHANNELS(info -> OutputFormat); cmsUInt32Number DoSwap = T_DOSWAP(info ->OutputFormat); @@ -1466,10 +1511,11 @@ cmsUInt8Number* PackPlanarBytes(cmsContext ContextID, register _cmsTRANSFORM* in static -cmsUInt8Number* PackPlanarWords(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* PackPlanarWords(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { cmsUInt32Number nChan = T_CHANNELS(info -> OutputFormat); cmsUInt32Number DoSwap = T_DOSWAP(info ->OutputFormat); @@ -1505,10 +1551,11 @@ cmsUInt8Number* PackPlanarWords(cmsContext ContextID, register _cmsTRANSFORM* in // CMYKcm (unrolled for speed) static -cmsUInt8Number* Pack6Bytes(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* Pack6Bytes(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { *output++ = FROM_16_TO_8(wOut[0]); *output++ = FROM_16_TO_8(wOut[1]); @@ -1526,10 +1573,11 @@ cmsUInt8Number* Pack6Bytes(cmsContext ContextID, register _cmsTRANSFORM* info, // KCMYcm static -cmsUInt8Number* Pack6BytesSwap(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* Pack6BytesSwap(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { *output++ = FROM_16_TO_8(wOut[5]); *output++ = FROM_16_TO_8(wOut[4]); @@ -1546,10 +1594,11 @@ cmsUInt8Number* Pack6BytesSwap(cmsContext ContextID, register _cmsTRANSFORM* inf // CMYKcm static -cmsUInt8Number* Pack6Words(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* Pack6Words(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { *(cmsUInt16Number*) output = wOut[0]; output+= 2; @@ -1572,10 +1621,11 @@ cmsUInt8Number* Pack6Words(cmsContext ContextID, register _cmsTRANSFORM* info, // KCMYcm static -cmsUInt8Number* Pack6WordsSwap(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* Pack6WordsSwap(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { *(cmsUInt16Number*) output = wOut[5]; output+= 2; @@ -1598,10 +1648,11 @@ cmsUInt8Number* Pack6WordsSwap(cmsContext ContextID, register _cmsTRANSFORM* inf static -cmsUInt8Number* Pack4Bytes(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* Pack4Bytes(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { *output++ = FROM_16_TO_8(wOut[0]); *output++ = FROM_16_TO_8(wOut[1]); @@ -1615,10 +1666,11 @@ cmsUInt8Number* Pack4Bytes(cmsContext ContextID, register _cmsTRANSFORM* info, } static -cmsUInt8Number* Pack4BytesReverse(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* Pack4BytesReverse(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { *output++ = REVERSE_FLAVOR_8(FROM_16_TO_8(wOut[0])); *output++ = REVERSE_FLAVOR_8(FROM_16_TO_8(wOut[1])); @@ -1633,10 +1685,11 @@ cmsUInt8Number* Pack4BytesReverse(cmsContext ContextID, register _cmsTRANSFORM* static -cmsUInt8Number* Pack4BytesSwapFirst(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* Pack4BytesSwapFirst(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { *output++ = FROM_16_TO_8(wOut[3]); *output++ = FROM_16_TO_8(wOut[0]); @@ -1651,10 +1704,11 @@ cmsUInt8Number* Pack4BytesSwapFirst(cmsContext ContextID, register _cmsTRANSFORM // ABGR static -cmsUInt8Number* Pack4BytesSwap(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* Pack4BytesSwap(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { *output++ = FROM_16_TO_8(wOut[3]); *output++ = FROM_16_TO_8(wOut[2]); @@ -1668,10 +1722,11 @@ cmsUInt8Number* Pack4BytesSwap(cmsContext ContextID, register _cmsTRANSFORM* inf } static -cmsUInt8Number* Pack4BytesSwapSwapFirst(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* Pack4BytesSwapSwapFirst(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { *output++ = FROM_16_TO_8(wOut[2]); *output++ = FROM_16_TO_8(wOut[1]); @@ -1685,10 +1740,11 @@ cmsUInt8Number* Pack4BytesSwapSwapFirst(cmsContext ContextID, register _cmsTRANS } static -cmsUInt8Number* Pack4Words(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* Pack4Words(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { *(cmsUInt16Number*) output = wOut[0]; output+= 2; @@ -1706,10 +1762,11 @@ cmsUInt8Number* Pack4Words(cmsContext ContextID, register _cmsTRANSFORM* info, } static -cmsUInt8Number* Pack4WordsReverse(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* Pack4WordsReverse(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { *(cmsUInt16Number*) output = REVERSE_FLAVOR_16(wOut[0]); output+= 2; @@ -1728,10 +1785,11 @@ cmsUInt8Number* Pack4WordsReverse(cmsContext ContextID, register _cmsTRANSFORM* // ABGR static -cmsUInt8Number* Pack4WordsSwap(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* Pack4WordsSwap(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { *(cmsUInt16Number*) output = wOut[3]; output+= 2; @@ -1750,10 +1808,11 @@ cmsUInt8Number* Pack4WordsSwap(cmsContext ContextID, register _cmsTRANSFORM* inf // CMYK static -cmsUInt8Number* Pack4WordsBigEndian(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* Pack4WordsBigEndian(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { *(cmsUInt16Number*) output = CHANGE_ENDIAN(wOut[0]); output+= 2; @@ -1772,10 +1831,11 @@ cmsUInt8Number* Pack4WordsBigEndian(cmsContext ContextID, register _cmsTRANSFORM static -cmsUInt8Number* PackLabV2_8(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* PackLabV2_8(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { *output++ = FROM_16_TO_8(FomLabV4ToLabV2(wOut[0])); *output++ = FROM_16_TO_8(FomLabV4ToLabV2(wOut[1])); @@ -1788,10 +1848,11 @@ cmsUInt8Number* PackLabV2_8(cmsContext ContextID, register _cmsTRANSFORM* info, } static -cmsUInt8Number* PackALabV2_8(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* PackALabV2_8(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { output++; *output++ = FROM_16_TO_8(FomLabV4ToLabV2(wOut[0])); @@ -1805,10 +1866,11 @@ cmsUInt8Number* PackALabV2_8(cmsContext ContextID, register _cmsTRANSFORM* info, } static -cmsUInt8Number* PackLabV2_16(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* PackLabV2_16(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { *(cmsUInt16Number*) output = FomLabV4ToLabV2(wOut[0]); output += 2; @@ -1824,10 +1886,11 @@ cmsUInt8Number* PackLabV2_16(cmsContext ContextID, register _cmsTRANSFORM* info, } static -cmsUInt8Number* Pack3Bytes(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* Pack3Bytes(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { *output++ = FROM_16_TO_8(wOut[0]); *output++ = FROM_16_TO_8(wOut[1]); @@ -1840,10 +1903,11 @@ cmsUInt8Number* Pack3Bytes(cmsContext ContextID, register _cmsTRANSFORM* info, } static -cmsUInt8Number* Pack3BytesOptimized(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* Pack3BytesOptimized(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { *output++ = (wOut[0] & 0xFFU); *output++ = (wOut[1] & 0xFFU); @@ -1856,10 +1920,11 @@ cmsUInt8Number* Pack3BytesOptimized(cmsContext ContextID, register _cmsTRANSFORM } static -cmsUInt8Number* Pack3BytesSwap(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* Pack3BytesSwap(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { *output++ = FROM_16_TO_8(wOut[2]); *output++ = FROM_16_TO_8(wOut[1]); @@ -1872,10 +1937,11 @@ cmsUInt8Number* Pack3BytesSwap(cmsContext ContextID, register _cmsTRANSFORM* inf } static -cmsUInt8Number* Pack3BytesSwapOptimized(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* Pack3BytesSwapOptimized(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { *output++ = (wOut[2] & 0xFFU); *output++ = (wOut[1] & 0xFFU); @@ -1889,10 +1955,11 @@ cmsUInt8Number* Pack3BytesSwapOptimized(cmsContext ContextID, register _cmsTRANS static -cmsUInt8Number* Pack3Words(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* Pack3Words(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { *(cmsUInt16Number*) output = wOut[0]; output+= 2; @@ -1908,10 +1975,11 @@ cmsUInt8Number* Pack3Words(cmsContext ContextID, register _cmsTRANSFORM* info, } static -cmsUInt8Number* Pack3WordsSwap(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* Pack3WordsSwap(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { *(cmsUInt16Number*) output = wOut[2]; output+= 2; @@ -1927,10 +1995,11 @@ cmsUInt8Number* Pack3WordsSwap(cmsContext ContextID, register _cmsTRANSFORM* inf } static -cmsUInt8Number* Pack3WordsBigEndian(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* Pack3WordsBigEndian(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { *(cmsUInt16Number*) output = CHANGE_ENDIAN(wOut[0]); output+= 2; @@ -1946,10 +2015,11 @@ cmsUInt8Number* Pack3WordsBigEndian(cmsContext ContextID, register _cmsTRANSFORM } static -cmsUInt8Number* Pack3BytesAndSkip1(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* Pack3BytesAndSkip1(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { *output++ = FROM_16_TO_8(wOut[0]); *output++ = FROM_16_TO_8(wOut[1]); @@ -1963,10 +2033,11 @@ cmsUInt8Number* Pack3BytesAndSkip1(cmsContext ContextID, register _cmsTRANSFORM* } static -cmsUInt8Number* Pack3BytesAndSkip1Optimized(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* Pack3BytesAndSkip1Optimized(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { *output++ = (wOut[0] & 0xFFU); *output++ = (wOut[1] & 0xFFU); @@ -1981,10 +2052,11 @@ cmsUInt8Number* Pack3BytesAndSkip1Optimized(cmsContext ContextID, register _cmsT static -cmsUInt8Number* Pack3BytesAndSkip1SwapFirst(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* Pack3BytesAndSkip1SwapFirst(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { output++; *output++ = FROM_16_TO_8(wOut[0]); @@ -1998,10 +2070,11 @@ cmsUInt8Number* Pack3BytesAndSkip1SwapFirst(cmsContext ContextID, register _cmsT } static -cmsUInt8Number* Pack3BytesAndSkip1SwapFirstOptimized(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* Pack3BytesAndSkip1SwapFirstOptimized(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { output++; *output++ = (wOut[0] & 0xFFU); @@ -2015,10 +2088,11 @@ cmsUInt8Number* Pack3BytesAndSkip1SwapFirstOptimized(cmsContext ContextID, regis } static -cmsUInt8Number* Pack3BytesAndSkip1Swap(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* Pack3BytesAndSkip1Swap(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { output++; *output++ = FROM_16_TO_8(wOut[2]); @@ -2032,10 +2106,11 @@ cmsUInt8Number* Pack3BytesAndSkip1Swap(cmsContext ContextID, register _cmsTRANSF } static -cmsUInt8Number* Pack3BytesAndSkip1SwapOptimized(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* Pack3BytesAndSkip1SwapOptimized(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { output++; *output++ = (wOut[2] & 0xFFU); @@ -2050,10 +2125,11 @@ cmsUInt8Number* Pack3BytesAndSkip1SwapOptimized(cmsContext ContextID, register _ static -cmsUInt8Number* Pack3BytesAndSkip1SwapSwapFirst(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* Pack3BytesAndSkip1SwapSwapFirst(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { *output++ = FROM_16_TO_8(wOut[2]); *output++ = FROM_16_TO_8(wOut[1]); @@ -2067,10 +2143,11 @@ cmsUInt8Number* Pack3BytesAndSkip1SwapSwapFirst(cmsContext ContextID, register _ } static -cmsUInt8Number* Pack3BytesAndSkip1SwapSwapFirstOptimized(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* Pack3BytesAndSkip1SwapSwapFirstOptimized(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { *output++ = (wOut[2] & 0xFFU); *output++ = (wOut[1] & 0xFFU); @@ -2084,10 +2161,11 @@ cmsUInt8Number* Pack3BytesAndSkip1SwapSwapFirstOptimized(cmsContext ContextID, r } static -cmsUInt8Number* Pack3WordsAndSkip1(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* Pack3WordsAndSkip1(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { *(cmsUInt16Number*) output = wOut[0]; output+= 2; @@ -2104,10 +2182,11 @@ cmsUInt8Number* Pack3WordsAndSkip1(cmsContext ContextID, register _cmsTRANSFORM* } static -cmsUInt8Number* Pack3WordsAndSkip1Swap(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* Pack3WordsAndSkip1Swap(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { output+= 2; *(cmsUInt16Number*) output = wOut[2]; @@ -2125,10 +2204,11 @@ cmsUInt8Number* Pack3WordsAndSkip1Swap(cmsContext ContextID, register _cmsTRANSF static -cmsUInt8Number* Pack3WordsAndSkip1SwapFirst(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* Pack3WordsAndSkip1SwapFirst(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { output+= 2; *(cmsUInt16Number*) output = wOut[0]; @@ -2146,10 +2226,11 @@ cmsUInt8Number* Pack3WordsAndSkip1SwapFirst(cmsContext ContextID, register _cmsT static -cmsUInt8Number* Pack3WordsAndSkip1SwapSwapFirst(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* Pack3WordsAndSkip1SwapSwapFirst(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { *(cmsUInt16Number*) output = wOut[2]; output+= 2; @@ -2168,10 +2249,11 @@ cmsUInt8Number* Pack3WordsAndSkip1SwapSwapFirst(cmsContext ContextID, register _ static -cmsUInt8Number* Pack1Byte(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* Pack1Byte(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { *output++ = FROM_16_TO_8(wOut[0]); @@ -2183,10 +2265,11 @@ cmsUInt8Number* Pack1Byte(cmsContext ContextID, register _cmsTRANSFORM* info, static -cmsUInt8Number* Pack1ByteReversed(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* Pack1ByteReversed(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { *output++ = FROM_16_TO_8(REVERSE_FLAVOR_16(wOut[0])); @@ -2198,10 +2281,11 @@ cmsUInt8Number* Pack1ByteReversed(cmsContext ContextID, register _cmsTRANSFORM* static -cmsUInt8Number* Pack1ByteSkip1(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* Pack1ByteSkip1(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { *output++ = FROM_16_TO_8(wOut[0]); output++; @@ -2214,10 +2298,11 @@ cmsUInt8Number* Pack1ByteSkip1(cmsContext ContextID, register _cmsTRANSFORM* inf static -cmsUInt8Number* Pack1ByteSkip1SwapFirst(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* Pack1ByteSkip1SwapFirst(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { output++; *output++ = FROM_16_TO_8(wOut[0]); @@ -2229,10 +2314,11 @@ cmsUInt8Number* Pack1ByteSkip1SwapFirst(cmsContext ContextID, register _cmsTRANS } static -cmsUInt8Number* Pack1Word(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* Pack1Word(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { *(cmsUInt16Number*) output = wOut[0]; output+= 2; @@ -2245,10 +2331,11 @@ cmsUInt8Number* Pack1Word(cmsContext ContextID, register _cmsTRANSFORM* info, static -cmsUInt8Number* Pack1WordReversed(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* Pack1WordReversed(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { *(cmsUInt16Number*) output = REVERSE_FLAVOR_16(wOut[0]); output+= 2; @@ -2260,10 +2347,11 @@ cmsUInt8Number* Pack1WordReversed(cmsContext ContextID, register _cmsTRANSFORM* } static -cmsUInt8Number* Pack1WordBigEndian(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* Pack1WordBigEndian(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { *(cmsUInt16Number*) output = CHANGE_ENDIAN(wOut[0]); output+= 2; @@ -2276,10 +2364,11 @@ cmsUInt8Number* Pack1WordBigEndian(cmsContext ContextID, register _cmsTRANSFORM* static -cmsUInt8Number* Pack1WordSkip1(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* Pack1WordSkip1(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { *(cmsUInt16Number*) output = wOut[0]; output+= 4; @@ -2291,10 +2380,11 @@ cmsUInt8Number* Pack1WordSkip1(cmsContext ContextID, register _cmsTRANSFORM* inf } static -cmsUInt8Number* Pack1WordSkip1SwapFirst(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* Pack1WordSkip1SwapFirst(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { output += 2; *(cmsUInt16Number*) output = wOut[0]; @@ -2309,10 +2399,11 @@ cmsUInt8Number* Pack1WordSkip1SwapFirst(cmsContext ContextID, register _cmsTRANS // Unencoded Float values -- don't try optimize speed static -cmsUInt8Number* PackLabDoubleFrom16(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* PackLabDoubleFrom16(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { if (T_PLANAR(info -> OutputFormat)) { @@ -2336,10 +2427,11 @@ cmsUInt8Number* PackLabDoubleFrom16(cmsContext ContextID, register _cmsTRANSFORM static -cmsUInt8Number* PackLabFloatFrom16(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* PackLabFloatFrom16(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { cmsCIELab Lab; cmsLabEncoded2Float(ContextID, &Lab, wOut); @@ -2367,10 +2459,11 @@ cmsUInt8Number* PackLabFloatFrom16(cmsContext ContextID, register _cmsTRANSFORM* } static -cmsUInt8Number* PackXYZDoubleFrom16(cmsContext ContextID, register _cmsTRANSFORM* Info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* PackXYZDoubleFrom16(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* Info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { if (T_PLANAR(Info -> OutputFormat)) { @@ -2396,10 +2489,11 @@ cmsUInt8Number* PackXYZDoubleFrom16(cmsContext ContextID, register _cmsTRANSFORM } static -cmsUInt8Number* PackXYZFloatFrom16(cmsContext ContextID, register _cmsTRANSFORM* Info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* PackXYZFloatFrom16(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* Info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { if (T_PLANAR(Info -> OutputFormat)) { @@ -2431,10 +2525,11 @@ cmsUInt8Number* PackXYZFloatFrom16(cmsContext ContextID, register _cmsTRANSFORM* } static -cmsUInt8Number* PackDoubleFrom16(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* PackDoubleFrom16(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { cmsUInt32Number nChan = T_CHANNELS(info -> OutputFormat); cmsUInt32Number DoSwap = T_DOSWAP(info ->OutputFormat); @@ -2484,10 +2579,11 @@ cmsUInt8Number* PackDoubleFrom16(cmsContext ContextID, register _cmsTRANSFORM* i static -cmsUInt8Number* PackFloatFrom16(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* PackFloatFrom16(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { cmsUInt32Number nChan = T_CHANNELS(info->OutputFormat); cmsUInt32Number DoSwap = T_DOSWAP(info->OutputFormat); @@ -2773,10 +2869,11 @@ cmsUInt8Number* PackXYZDoubleFromFloat(cmsContext ContextID, _cmsTRANSFORM* Info // Decodes an stream of half floats to wIn[] described by input format static -cmsUInt8Number* UnrollHalfTo16(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wIn[], - register cmsUInt8Number* accum, - register cmsUInt32Number Stride) +cmsUInt8Number* UnrollHalfTo16(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wIn[], + CMSREGISTER cmsUInt8Number* accum, + CMSREGISTER cmsUInt32Number Stride) { cmsUInt32Number nChan = T_CHANNELS(info -> InputFormat); @@ -2879,10 +2976,11 @@ cmsUInt8Number* UnrollHalfToFloat(cmsContext ContextID, _cmsTRANSFORM* info, static -cmsUInt8Number* PackHalfFrom16(cmsContext ContextID, register _cmsTRANSFORM* info, - register cmsUInt16Number wOut[], - register cmsUInt8Number* output, - register cmsUInt32Number Stride) +cmsUInt8Number* PackHalfFrom16(cmsContext ContextID, + CMSREGISTER _cmsTRANSFORM* info, + CMSREGISTER cmsUInt16Number wOut[], + CMSREGISTER cmsUInt8Number* output, + CMSREGISTER cmsUInt32Number Stride) { cmsUInt32Number nChan = T_CHANNELS(info->OutputFormat); cmsUInt32Number DoSwap = T_DOSWAP(info->OutputFormat); diff --git a/lcms2mt/src/cmspcs.c b/lcms2mt/src/cmspcs.c index 97b552d9..743d479f 100644 --- a/lcms2mt/src/cmspcs.c +++ b/lcms2mt/src/cmspcs.c @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2017 Marti Maria Saguer +// Copyright (c) 1998-2020 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), diff --git a/lcms2mt/src/cmsplugin.c b/lcms2mt/src/cmsplugin.c index abc18ced..206368c4 100644 --- a/lcms2mt/src/cmsplugin.c +++ b/lcms2mt/src/cmsplugin.c @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2017 Marti Maria Saguer +// Copyright (c) 1998-2020 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -772,6 +772,7 @@ cmsContext CMSEXPORT cmsCreateContext(void* Plugin, void* UserData) // See the comments regarding locking in lcms2_internal.h // for an explanation of why we need the following code. +#ifndef CMS_NO_PTHREADS #ifdef CMS_IS_WINDOWS_ #ifndef CMS_RELY_ON_WINDOWS_STATIC_MUTEX_INIT { @@ -793,6 +794,7 @@ cmsContext CMSEXPORT cmsCreateContext(void* Plugin, void* UserData) } #endif #endif +#endif _cmsInstallAllocFunctions(_cmsFindMemoryPlugin(Plugin), &fakeContext.DefaultMemoryManager); diff --git a/lcms2mt/src/cmsps2.c b/lcms2mt/src/cmsps2.c index 179a0467..62558bfc 100644 --- a/lcms2mt/src/cmsps2.c +++ b/lcms2mt/src/cmsps2.c @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2017 Marti Maria Saguer +// Copyright (c) 1998-2020 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -295,21 +295,7 @@ cmsUInt8Number Word2Byte(cmsUInt16Number w) } -// Convert to byte (using ICC2 notation) -/* -static -cmsUInt8Number L2Byte(cmsUInt16Number w) -{ - int ww = w + 0x0080; - - if (ww > 0xFFFF) return 0xFF; - - return (cmsUInt8Number) ((cmsUInt16Number) (ww >> 8) & 0xFF); -} -*/ - // Write a cooked byte - static void WriteByte(cmsContext ContextID, cmsIOHANDLER* m, cmsUInt8Number b) { @@ -326,7 +312,8 @@ void WriteByte(cmsContext ContextID, cmsIOHANDLER* m, cmsUInt8Number b) // ----------------------------------------------------------------- PostScript generation -// Removes offending Carriage returns +// Removes offending carriage returns + static char* RemoveCR(const char* txt) { @@ -424,21 +411,6 @@ void EmitIntent(cmsContext ContextID, cmsIOHANDLER* m, cmsUInt32Number Rendering // = Yn*( L* / 116) / 7.787 if (L*) < 6 / 29 // -/* -static -void EmitL2Y(cmsIOHANDLER* m) -{ - _cmsIOPrintf(ContextID, m, - "{ " - "100 mul 16 add 116 div " // (L * 100 + 16) / 116 - "dup 6 29 div ge " // >= 6 / 29 ? - "{ dup dup mul mul } " // yes, ^3 and done - "{ 4 29 div sub 108 841 div mul } " // no, slope limiting - "ifelse } bind "); -} -*/ - - // Lab -> XYZ, see the discussion above static @@ -459,12 +431,28 @@ void EmitLab2XYZ(cmsContext ContextID, cmsIOHANDLER* m) _cmsIOPrintf(ContextID, m, "]\n"); } +static +void EmitSafeGuardBegin(cmsContext ContextID, cmsIOHANDLER* m, const char* name) +{ + _cmsIOPrintf(ContextID, m, "%%LCMS2: Save previous definition of %s on the operand stack\n", name); + _cmsIOPrintf(ContextID, m, "currentdict /%s known { /%s load } { null } ifelse\n", name, name); +} +static +void EmitSafeGuardEnd(cmsContext ContextID, cmsIOHANDLER* m, const char* name, int depth) +{ + _cmsIOPrintf(ContextID, m, "%%LCMS2: Restore previous definition of %s\n", name); + if (depth > 1) { + // cycle topmost items on the stack to bring the previous definition to the front + _cmsIOPrintf(ContextID, m, "%d -1 roll ", depth); + } + _cmsIOPrintf(ContextID, m, "dup null eq { pop currentdict /%s undef } { /%s exch def } ifelse\n", name, name); +} // Outputs a table of words. It does use 16 bits static -void Emit1Gamma(cmsContext ContextID, cmsIOHANDLER* m, cmsToneCurve* Table) +void Emit1Gamma(cmsContext ContextID, cmsIOHANDLER* m, cmsToneCurve* Table, const char* name) { cmsUInt32Number i; cmsFloat64Number gamma; @@ -479,28 +467,33 @@ void Emit1Gamma(cmsContext ContextID, cmsIOHANDLER* m, cmsToneCurve* Table) // Check if is really an exponential. If so, emit "exp" gamma = cmsEstimateGamma(ContextID, Table, 0.001); if (gamma > 0) { - _cmsIOPrintf(ContextID, m, "{ %g exp } bind ", gamma); + _cmsIOPrintf(ContextID, m, "/%s { %g exp } bind def\n", name, gamma); return; } - _cmsIOPrintf(ContextID, m, "{ "); - - // Bounds check - EmitRangeCheck(ContextID, m); - - // Emit intepolation code - - // PostScript code Stack - // =============== ======================== - // v - _cmsIOPrintf(ContextID, m, " ["); + EmitSafeGuardBegin(ContextID, m, "lcms2gammatable"); + _cmsIOPrintf(ContextID, m, "/lcms2gammatable ["); for (i=0; i < Table->nEntries; i++) { + if (i % 10 == 0) + _cmsIOPrintf(ContextID, m, "\n "); _cmsIOPrintf(ContextID, m, "%d ", Table->Table16[i]); } - _cmsIOPrintf(ContextID, m, "] "); // v tab + _cmsIOPrintf(ContextID, m, "] def\n"); + + + // Emit interpolation code + + // PostScript code Stack + // =============== ======================== + // v + _cmsIOPrintf(ContextID, m, "/%s {\n ", name); + + // Bounds check + EmitRangeCheck(ContextID, m); + _cmsIOPrintf(ContextID, m, "\n //lcms2gammatable "); // v tab _cmsIOPrintf(ContextID, m, "dup "); // v tab tab _cmsIOPrintf(ContextID, m, "length 1 sub "); // v tab dom _cmsIOPrintf(ContextID, m, "3 -1 roll "); // tab dom v @@ -512,7 +505,7 @@ void Emit1Gamma(cmsContext ContextID, cmsIOHANDLER* m, cmsToneCurve* Table) _cmsIOPrintf(ContextID, m, "ceiling cvi "); // tab val2 cell0 cell1 _cmsIOPrintf(ContextID, m, "3 index "); // tab val2 cell0 cell1 tab _cmsIOPrintf(ContextID, m, "exch "); // tab val2 cell0 tab cell1 - _cmsIOPrintf(ContextID, m, "get "); // tab val2 cell0 y1 + _cmsIOPrintf(ContextID, m, "get\n "); // tab val2 cell0 y1 _cmsIOPrintf(ContextID, m, "4 -1 roll "); // val2 cell0 y1 tab _cmsIOPrintf(ContextID, m, "3 -1 roll "); // val2 y1 tab cell0 _cmsIOPrintf(ContextID, m, "get "); // val2 y1 y0 @@ -525,9 +518,11 @@ void Emit1Gamma(cmsContext ContextID, cmsIOHANDLER* m, cmsToneCurve* Table) _cmsIOPrintf(ContextID, m, "sub "); // y0 (y1-y0) rest _cmsIOPrintf(ContextID, m, "mul "); // y0 t1 _cmsIOPrintf(ContextID, m, "add "); // y - _cmsIOPrintf(ContextID, m, "65535 div "); // result + _cmsIOPrintf(ContextID, m, "65535 div\n"); // result + + _cmsIOPrintf(ContextID, m, "} bind def\n"); - _cmsIOPrintf(ContextID, m, " } bind "); + EmitSafeGuardEnd(ContextID, m, "lcms2gammatable", 1); } @@ -543,9 +538,10 @@ cmsBool GammaTableEquals(cmsUInt16Number* g1, cmsUInt16Number* g2, cmsUInt32Numb // Does write a set of gamma curves static -void EmitNGamma(cmsContext ContextID, cmsIOHANDLER* m, cmsUInt32Number n, cmsToneCurve* g[]) +void EmitNGamma(cmsContext ContextID, cmsIOHANDLER* m, cmsUInt32Number n, cmsToneCurve* g[], const char* nameprefix) { cmsUInt32Number i; + static char buffer[2048]; for( i=0; i < n; i++ ) { @@ -553,19 +549,18 @@ void EmitNGamma(cmsContext ContextID, cmsIOHANDLER* m, cmsUInt32Number n, cmsTon if (i > 0 && GammaTableEquals(g[i-1]->Table16, g[i]->Table16, g[i]->nEntries)) { - _cmsIOPrintf(ContextID, m, "dup "); + _cmsIOPrintf(ContextID, m, "/%s%d /%s%d load def\n", nameprefix, i, nameprefix, i-1); } else { - Emit1Gamma(ContextID, m, g[i]); + snprintf(buffer, sizeof(buffer), "%s%d", nameprefix, i); + buffer[sizeof(buffer)-1] = '\0'; + Emit1Gamma(ContextID, m, g[i], buffer); } } } - - - // Following code dumps a LUT onto memory stream @@ -582,7 +577,7 @@ void EmitNGamma(cmsContext ContextID, cmsIOHANDLER* m, cmsUInt32Number n, cmsTon // component. -1 is used to mark beginning of whole block. static -int OutputValueSampler(cmsContext ContextID, register const cmsUInt16Number In[], register cmsUInt16Number Out[], register void* Cargo) +int OutputValueSampler(cmsContext ContextID, CMSREGISTER const cmsUInt16Number In[], CMSREGISTER cmsUInt16Number Out[], CMSREGISTER void* Cargo) { cmsPsSamplerCargo* sc = (cmsPsSamplerCargo*) Cargo; cmsUInt32Number i; @@ -662,11 +657,11 @@ int OutputValueSampler(cmsContext ContextID, register const cmsUInt16Number In[] static void WriteCLUT(cmsContext ContextID, cmsIOHANDLER* m, cmsStage* mpe, const char* PreMaj, - const char* PostMaj, - const char* PreMin, - const char* PostMin, - int FixWhite, - cmsColorSpaceSignature ColorSpace) + const char* PostMaj, + const char* PreMin, + const char* PostMin, + int FixWhite, + cmsColorSpaceSignature ColorSpace) { cmsUInt32Number i; cmsPsSamplerCargo sc; @@ -708,11 +703,11 @@ int EmitCIEBasedA(cmsContext ContextID, cmsIOHANDLER* m, cmsToneCurve* Curve, cm _cmsIOPrintf(ContextID, m, "[ /CIEBasedA\n"); _cmsIOPrintf(ContextID, m, " <<\n"); - _cmsIOPrintf(ContextID, m, "/DecodeA "); - - Emit1Gamma(ContextID, m, Curve); + EmitSafeGuardBegin(ContextID, m, "lcms2gammaproc"); + Emit1Gamma(ContextID, m, Curve, "lcms2gammaproc"); - _cmsIOPrintf(ContextID, m, " \n"); + _cmsIOPrintf(ContextID, m, "/DecodeA /lcms2gammaproc load\n"); + EmitSafeGuardEnd(ContextID, m, "lcms2gammaproc", 3); _cmsIOPrintf(ContextID, m, "/MatrixA [ 0.9642 1.0000 0.8249 ]\n"); _cmsIOPrintf(ContextID, m, "/RangeLMN [ 0.0 0.9642 0.0 1.0000 0.0 0.8249 ]\n"); @@ -736,11 +731,19 @@ int EmitCIEBasedABC(cmsContext ContextID, cmsIOHANDLER* m, cmsFloat64Number* Mat _cmsIOPrintf(ContextID, m, "[ /CIEBasedABC\n"); _cmsIOPrintf(ContextID, m, "<<\n"); - _cmsIOPrintf(ContextID, m, "/DecodeABC [ "); - - EmitNGamma(ContextID, m, 3, CurveSet); + EmitSafeGuardBegin(ContextID, m, "lcms2gammaproc0"); + EmitSafeGuardBegin(ContextID, m, "lcms2gammaproc1"); + EmitSafeGuardBegin(ContextID, m, "lcms2gammaproc2"); + EmitNGamma(ContextID, m, 3, CurveSet, "lcms2gammaproc"); + _cmsIOPrintf(ContextID, m, "/DecodeABC [\n"); + _cmsIOPrintf(ContextID, m, " /lcms2gammaproc0 load\n"); + _cmsIOPrintf(ContextID, m, " /lcms2gammaproc1 load\n"); + _cmsIOPrintf(ContextID, m, " /lcms2gammaproc2 load\n"); _cmsIOPrintf(ContextID, m, "]\n"); + EmitSafeGuardEnd(ContextID, m, "lcms2gammaproc2", 3); + EmitSafeGuardEnd(ContextID, m, "lcms2gammaproc1", 3); + EmitSafeGuardEnd(ContextID, m, "lcms2gammaproc0", 3); _cmsIOPrintf(ContextID, m, "/MatrixABC [ " ); @@ -772,28 +775,31 @@ int EmitCIEBasedDEF(cmsContext ContextID, cmsIOHANDLER* m, cmsPipeline* Pipeline { const char* PreMaj; const char* PostMaj; - const char* PreMin, *PostMin; + const char* PreMin, * PostMin; cmsStage* mpe; + int i, numchans; + static char buffer[2048]; - mpe = Pipeline ->Elements; + mpe = Pipeline->Elements; switch (cmsStageInputChannels(ContextID, mpe)) { case 3: + _cmsIOPrintf(ContextID, m, "[ /CIEBasedDEF\n"); + PreMaj = "<"; + PostMaj = ">\n"; + PreMin = PostMin = ""; + break; - _cmsIOPrintf(ContextID, m, "[ /CIEBasedDEF\n"); - PreMaj ="<"; - PostMaj= ">\n"; - PreMin = PostMin = ""; - break; case 4: - _cmsIOPrintf(ContextID, m, "[ /CIEBasedDEFG\n"); - PreMaj = "["; - PostMaj = "]\n"; - PreMin = "<"; - PostMin = ">\n"; - break; + _cmsIOPrintf(ContextID, m, "[ /CIEBasedDEFG\n"); + PreMaj = "["; + PostMaj = "]\n"; + PreMin = "<"; + PostMin = ">\n"; + break; + default: - return 0; + return 0; } @@ -801,18 +807,34 @@ int EmitCIEBasedDEF(cmsContext ContextID, cmsIOHANDLER* m, cmsPipeline* Pipeline if (cmsStageType(ContextID, mpe) == cmsSigCurveSetElemType) { - _cmsIOPrintf(ContextID, m, "/DecodeDEF [ "); - EmitNGamma(ContextID, m, cmsStageOutputChannels(ContextID, mpe), _cmsStageGetPtrToCurveSet(mpe)); + numchans = cmsStageOutputChannels(ContextID, mpe); + for (i = 0; i < numchans; ++i) { + snprintf(buffer, sizeof(buffer), "lcms2gammaproc%d", i); + buffer[sizeof(buffer) - 1] = '\0'; + EmitSafeGuardBegin(ContextID, m, buffer); + } + EmitNGamma(ContextID, m, cmsStageOutputChannels(ContextID, mpe), _cmsStageGetPtrToCurveSet(mpe), "lcms2gammaproc"); + _cmsIOPrintf(ContextID, m, "/DecodeDEF [\n"); + for (i = 0; i < numchans; ++i) { + snprintf(buffer, sizeof(buffer), " /lcms2gammaproc%d load\n", i); + buffer[sizeof(buffer) - 1] = '\0'; + _cmsIOPrintf(ContextID, m, buffer); + } _cmsIOPrintf(ContextID, m, "]\n"); + for (i = numchans - 1; i >= 0; --i) { + snprintf(buffer, sizeof(buffer), "lcms2gammaproc%d", i); + buffer[sizeof(buffer) - 1] = '\0'; + EmitSafeGuardEnd(ContextID, m, buffer, 3); + } - mpe = mpe ->Next; + mpe = mpe->Next; } if (cmsStageType(ContextID, mpe) == cmsSigCLutElemType) { - _cmsIOPrintf(ContextID, m, "/Table "); - WriteCLUT(ContextID, m, mpe, PreMaj, PostMaj, PreMin, PostMin, FALSE, (cmsColorSpaceSignature) 0); - _cmsIOPrintf(ContextID, m, "]\n"); + _cmsIOPrintf(ContextID, m, "/Table "); + WriteCLUT(ContextID, m, mpe, PreMaj, PostMaj, PreMin, PostMin, FALSE, (cmsColorSpaceSignature)0); + _cmsIOPrintf(ContextID, m, "]\n"); } EmitLab2XYZ(ContextID, m); @@ -923,7 +945,7 @@ int WriteInputLUT(cmsContext ContextID, cmsIOHANDLER* m, cmsHPROFILE hProfile, c default: - cmsSignalError(ContextID, cmsERROR_COLORSPACE_CHECK, "Only 3, 4 channels supported for CSA. This profile has %d channels.", nChannels); + cmsSignalError(ContextID, cmsERROR_COLORSPACE_CHECK, "Only 3, 4 channels are supported for CSA. This profile has %d channels.", nChannels); return 0; } @@ -1239,8 +1261,6 @@ void EmitPQRStage(cmsContext ContextID, cmsIOHANDLER* m, cmsHPROFILE hProfile, i "exch pop exch pop exch pop exch pop } bind\n]\n"); } - - } @@ -1414,7 +1434,7 @@ int WriteNamedColorCRD(cmsContext ContextID, cmsIOHANDLER* m, cmsHPROFILE hNamed cmsUInt32Number i, nColors, nColorant; cmsUInt32Number OutputFormat; char ColorName[cmsMAX_PATH]; - char Colorant[128]; + char Colorant[512]; cmsNAMEDCOLORLIST* NamedColorList; diff --git a/lcms2mt/src/cmssamp.c b/lcms2mt/src/cmssamp.c index b6fbdbe8..c563fac6 100644 --- a/lcms2mt/src/cmssamp.c +++ b/lcms2mt/src/cmssamp.c @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2017 Marti Maria Saguer +// Copyright (c) 1998-2020 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), diff --git a/lcms2mt/src/cmssm.c b/lcms2mt/src/cmssm.c index 2c77587a..387bf823 100644 --- a/lcms2mt/src/cmssm.c +++ b/lcms2mt/src/cmssm.c @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2017 Marti Maria Saguer +// Copyright (c) 1998-2020 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), diff --git a/lcms2mt/src/cmstypes.c b/lcms2mt/src/cmstypes.c index 9b21c39c..85256ef7 100644 --- a/lcms2mt/src/cmstypes.c +++ b/lcms2mt/src/cmstypes.c @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2017 Marti Maria Saguer +// Copyright (c) 1998-2020 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -1893,7 +1893,7 @@ Error: static cmsBool Type_LUT8_Write(cmsContext ContextID, struct _cms_typehandler_struct* self, cmsIOHANDLER* io, void* Ptr, cmsUInt32Number nItems) { - cmsUInt32Number j, nTabSize; + cmsUInt32Number j, nTabSize, i, n; cmsUInt8Number val; cmsPipeline* NewLUT = (cmsPipeline*) Ptr; cmsStage* mpe; @@ -1943,22 +1943,19 @@ cmsBool Type_LUT8_Write(cmsContext ContextID, struct _cms_typehandler_struct* s if (!_cmsWriteUInt8Number(ContextID, io, (cmsUInt8Number) clutPoints)) return FALSE; if (!_cmsWriteUInt8Number(ContextID, io, 0)) return FALSE; // Padding + n = NewLUT->InputChannels * NewLUT->OutputChannels; if (MatMPE != NULL) { - if (!_cmsWrite15Fixed16Number(ContextID, io, MatMPE -> Double[0])) return FALSE; - if (!_cmsWrite15Fixed16Number(ContextID, io, MatMPE -> Double[1])) return FALSE; - if (!_cmsWrite15Fixed16Number(ContextID, io, MatMPE -> Double[2])) return FALSE; - if (!_cmsWrite15Fixed16Number(ContextID, io, MatMPE -> Double[3])) return FALSE; - if (!_cmsWrite15Fixed16Number(ContextID, io, MatMPE -> Double[4])) return FALSE; - if (!_cmsWrite15Fixed16Number(ContextID, io, MatMPE -> Double[5])) return FALSE; - if (!_cmsWrite15Fixed16Number(ContextID, io, MatMPE -> Double[6])) return FALSE; - if (!_cmsWrite15Fixed16Number(ContextID, io, MatMPE -> Double[7])) return FALSE; - if (!_cmsWrite15Fixed16Number(ContextID, io, MatMPE -> Double[8])) return FALSE; - + for (i = 0; i < n; i++) + { + if (!_cmsWrite15Fixed16Number(ContextID, io, MatMPE->Double[i])) return FALSE; + } } else { + if (n != 9) return FALSE; + if (!_cmsWrite15Fixed16Number(ContextID, io, 1)) return FALSE; if (!_cmsWrite15Fixed16Number(ContextID, io, 0)) return FALSE; if (!_cmsWrite15Fixed16Number(ContextID, io, 0)) return FALSE; @@ -2183,7 +2180,7 @@ Error: static cmsBool Type_LUT16_Write(cmsContext ContextID, struct _cms_typehandler_struct* self, cmsIOHANDLER* io, void* Ptr, cmsUInt32Number nItems) { - cmsUInt32Number nTabSize; + cmsUInt32Number nTabSize, n; cmsPipeline* NewLUT = (cmsPipeline*) Ptr; cmsStage* mpe; _cmsStageToneCurvesData* PreMPE = NULL, *PostMPE = NULL; @@ -2235,21 +2232,20 @@ cmsBool Type_LUT16_Write(cmsContext ContextID, struct _cms_typehandler_struct* if (!_cmsWriteUInt8Number(ContextID, io, (cmsUInt8Number) clutPoints)) return FALSE; if (!_cmsWriteUInt8Number(ContextID, io, 0)) return FALSE; // Padding + n = NewLUT->InputChannels * NewLUT->OutputChannels; if (MatMPE != NULL) { - if (!_cmsWrite15Fixed16Number(ContextID, io, MatMPE -> Double[0])) return FALSE; - if (!_cmsWrite15Fixed16Number(ContextID, io, MatMPE -> Double[1])) return FALSE; - if (!_cmsWrite15Fixed16Number(ContextID, io, MatMPE -> Double[2])) return FALSE; - if (!_cmsWrite15Fixed16Number(ContextID, io, MatMPE -> Double[3])) return FALSE; - if (!_cmsWrite15Fixed16Number(ContextID, io, MatMPE -> Double[4])) return FALSE; - if (!_cmsWrite15Fixed16Number(ContextID, io, MatMPE -> Double[5])) return FALSE; - if (!_cmsWrite15Fixed16Number(ContextID, io, MatMPE -> Double[6])) return FALSE; - if (!_cmsWrite15Fixed16Number(ContextID, io, MatMPE -> Double[7])) return FALSE; - if (!_cmsWrite15Fixed16Number(ContextID, io, MatMPE -> Double[8])) return FALSE; + for (i = 0; i < n; i++) + { + if (!_cmsWrite15Fixed16Number(ContextID, io, MatMPE->Double[i])) return FALSE; + } + } else { + if (n != 9) return FALSE; + if (!_cmsWrite15Fixed16Number(ContextID, io, 1)) return FALSE; if (!_cmsWrite15Fixed16Number(ContextID, io, 0)) return FALSE; if (!_cmsWrite15Fixed16Number(ContextID, io, 0)) return FALSE; @@ -2593,31 +2589,31 @@ Error: static cmsBool WriteMatrix(cmsContext ContextID, struct _cms_typehandler_struct* self, cmsIOHANDLER* io, cmsStage* mpe) { - _cmsStageMatrixData* m = (_cmsStageMatrixData*) mpe -> Data; - - // Write the Matrix - if (!_cmsWrite15Fixed16Number(ContextID, io, m -> Double[0])) return FALSE; - if (!_cmsWrite15Fixed16Number(ContextID, io, m -> Double[1])) return FALSE; - if (!_cmsWrite15Fixed16Number(ContextID, io, m -> Double[2])) return FALSE; - if (!_cmsWrite15Fixed16Number(ContextID, io, m -> Double[3])) return FALSE; - if (!_cmsWrite15Fixed16Number(ContextID, io, m -> Double[4])) return FALSE; - if (!_cmsWrite15Fixed16Number(ContextID, io, m -> Double[5])) return FALSE; - if (!_cmsWrite15Fixed16Number(ContextID, io, m -> Double[6])) return FALSE; - if (!_cmsWrite15Fixed16Number(ContextID, io, m -> Double[7])) return FALSE; - if (!_cmsWrite15Fixed16Number(ContextID, io, m -> Double[8])) return FALSE; - - if (m ->Offset != NULL) { + cmsUInt32Number i, n; - if (!_cmsWrite15Fixed16Number(ContextID, io, m -> Offset[0])) return FALSE; - if (!_cmsWrite15Fixed16Number(ContextID, io, m -> Offset[1])) return FALSE; - if (!_cmsWrite15Fixed16Number(ContextID, io, m -> Offset[2])) return FALSE; - } - else { - if (!_cmsWrite15Fixed16Number(ContextID, io, 0)) return FALSE; - if (!_cmsWrite15Fixed16Number(ContextID, io, 0)) return FALSE; - if (!_cmsWrite15Fixed16Number(ContextID, io, 0)) return FALSE; + _cmsStageMatrixData* m = (_cmsStageMatrixData*) mpe -> Data; - } + n = mpe->InputChannels * mpe->OutputChannels; + + // Write the Matrix + for (i = 0; i < n; i++) + { + if (!_cmsWrite15Fixed16Number(ContextID, io, m->Double[i])) return FALSE; + } + + if (m->Offset != NULL) { + + for (i = 0; i < mpe->OutputChannels; i++) + { + if (!_cmsWrite15Fixed16Number(ContextID, io, m->Offset[i])) return FALSE; + } + } + else { + for (i = 0; i < mpe->OutputChannels; i++) + { + if (!_cmsWrite15Fixed16Number(ContextID, io, 0)) return FALSE; + } + } return TRUE; diff --git a/lcms2mt/src/cmsvirt.c b/lcms2mt/src/cmsvirt.c index fbb3756f..6c0890f5 100644 --- a/lcms2mt/src/cmsvirt.c +++ b/lcms2mt/src/cmsvirt.c @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2017 Marti Maria Saguer +// Copyright (c) 1998-2020 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -341,7 +341,7 @@ Error: // K: Does not change static -int InkLimitingSampler(cmsContext ContextID, register const cmsUInt16Number In[], register cmsUInt16Number Out[], register void* Cargo) +int InkLimitingSampler(cmsContext ContextID, CMSREGISTER const cmsUInt16Number In[], CMSREGISTER cmsUInt16Number Out[], CMSREGISTER void* Cargo) { cmsFloat64Number InkLimit = *(cmsFloat64Number *) Cargo; cmsFloat64Number SumCMY, SumCMYK, Ratio; @@ -642,7 +642,7 @@ typedef struct { static -int bchswSampler(cmsContext ContextID, register const cmsUInt16Number In[], register cmsUInt16Number Out[], register void* Cargo) +int bchswSampler(cmsContext ContextID, CMSREGISTER const cmsUInt16Number In[], CMSREGISTER cmsUInt16Number Out[], CMSREGISTER void* Cargo) { cmsCIELab LabIn, LabOut; cmsCIELCh LChIn, LChOut; @@ -1058,9 +1058,10 @@ cmsHPROFILE CMSEXPORT cmsTransform2DeviceLink(cmsContext ContextID, cmsHTRANSFOR goto Error; } - // On the output side too + // On the output side too. Note that due to V2/V4 PCS encoding on lab we cannot fix white misalignments if ((xform ->core->ExitColorSpace) == cmsSigLabData && (Version < 4.0)) { + dwFlags |= cmsFLAGS_NOWHITEONWHITEFIXUP; if (!cmsPipelineInsertStage(ContextID, LUT, cmsAT_END, _cmsStageAllocLabV4ToV2(ContextID))) goto Error; } diff --git a/lcms2mt/src/cmswtpnt.c b/lcms2mt/src/cmswtpnt.c index e6d7c308..aaa57a32 100644 --- a/lcms2mt/src/cmswtpnt.c +++ b/lcms2mt/src/cmswtpnt.c @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2017 Marti Maria Saguer +// Copyright (c) 1998-2020 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), diff --git a/lcms2mt/src/cmsxform.c b/lcms2mt/src/cmsxform.c index 52f4815a..416b1e6d 100644 --- a/lcms2mt/src/cmsxform.c +++ b/lcms2mt/src/cmsxform.c @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2017 Marti Maria Saguer +// Copyright (c) 1998-2020 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -166,6 +166,23 @@ void CMSEXPORT cmsDeleteTransform(cmsContext ContextID, cmsHTRANSFORM hTransform _cmsFree(ContextID, (void *)core); } + +static +cmsUInt32Number PixelSize(cmsUInt32Number Format) +{ + cmsUInt32Number fmt_bytes = T_BYTES(Format); + + // For double, the T_BYTES field is zero + if (fmt_bytes == 0) + return sizeof(cmsUInt64Number); + + // Otherwise, it is already correct for all formats + return fmt_bytes; +} + + + + // Apply transform. void CMSEXPORT cmsDoTransform(cmsContext ContextID, cmsHTRANSFORM Transform, const void* InputBuffer, @@ -178,8 +195,8 @@ void CMSEXPORT cmsDoTransform(cmsContext ContextID, cmsHTRANSFORM Transform, stride.BytesPerLineIn = 0; // Not used stride.BytesPerLineOut = 0; - stride.BytesPerPlaneIn = Size; - stride.BytesPerPlaneOut = Size; + stride.BytesPerPlaneIn = Size * PixelSize(p->InputFormat); + stride.BytesPerPlaneOut = Size * PixelSize(p->OutputFormat); p -> xform(ContextID, p, InputBuffer, OutputBuffer, Size, 1, &stride); } @@ -949,7 +966,7 @@ cmsBool _cmsRegisterTransformPlugin(cmsContext ContextID, cmsPluginBase* Data) if (fl == NULL) return FALSE; // Check for full xform plug-ins previous to 2.8, we would need an adapter in that case - if (Plugin->base.ExpectedVersion < 80) { + if (Plugin->base.ExpectedVersion < 2080-2000) { fl->OldXform = TRUE; } @@ -1059,7 +1076,7 @@ _cmsFindFormatter(_cmsTRANSFORM* p, cmsUInt32Number InputFormat, cmsUInt32Number return; case CHANNELS_SH(3) | BYTES_SH(1) | ((CHANNELS_SH(1) | BYTES_SH(1))<<6): p ->xform = CachedXFORM3to1; - return; + return; case CHANNELS_SH(3) | BYTES_SH(2) | ((CHANNELS_SH(1) | BYTES_SH(2))<<6): p ->xform = CachedXFORM3x2to1x2; return; @@ -1136,13 +1153,8 @@ _cmsTRANSFORM* AllocEmptyTransform(cmsContext ContextID, cmsPipeline* lut, p->core->Lut = lut; // Let's see if any plug-in want to do the transform by itself - if (core->Lut != NULL) { - - // First, optimise the pipeline. This may cause us to recognise that the Luts are - // identity. - _cmsOptimizePipeline(ContextID, &core->Lut, Intent, InputFormat, OutputFormat, dwFlags); + if (core->Lut != NULL && !(*dwFlags & cmsFLAGS_NOOPTIMIZE)) { - if (_cmsLutIsIdentity(core->Lut) == FALSE) { for (Plugin = ctx->TransformCollection; Plugin != NULL; Plugin = Plugin->Next) { @@ -1175,8 +1187,9 @@ _cmsTRANSFORM* AllocEmptyTransform(cmsContext ContextID, cmsPipeline* lut, return p; } } - } + // Not suitable for the transform plug-in, let's check the pipeline plug-in + _cmsOptimizePipeline(ContextID, &core->Lut, Intent, InputFormat, OutputFormat, dwFlags); } // Check whatever this is a true floating point transform @@ -1594,9 +1607,6 @@ cmsHTRANSFORM cmsCloneTransformChangingFormats(cmsContext ContextID, const _cmsTRANSFORM *oldXform = (const _cmsTRANSFORM *)hTransform; _cmsTRANSFORM *xform; cmsFormatter16 FromInput, ToOutput; - _cmsTransformPluginChunkType* ctx = (_cmsTransformPluginChunkType*)_cmsContextGetClientChunk(ContextID, TransformPlugin); - _cmsTransformCollection* Plugin; - _cmsTRANSFORMCORE *core; _cmsAssert(oldXform != NULL && oldXform->core != NULL); @@ -1625,20 +1635,6 @@ cmsHTRANSFORM cmsCloneTransformChangingFormats(cmsContext ContextID, xform ->OutputFormat = OutputFormat; xform ->FromInput = FromInput; xform ->ToOutput = ToOutput; - - /* Transformation plug-in support needed here but only if lcms has determined - that this lut is not the identity transform */ - if (oldXform->core->Lut != NULL && _cmsLutIsIdentity(oldXform->core->Lut) == FALSE) { - for (Plugin = ctx->TransformCollection; Plugin != NULL; Plugin = Plugin->Next) { - core = xform->core; - if (Plugin->Factory(ContextID, &xform->xform, &core->UserData, - &core->FreeUserData, &core->Lut, &InputFormat, &OutputFormat, NULL)) { - (void)_cmsAdjustReferenceCount(&xform->core->refs, 1); - return xform; - } - } - } - _cmsFindFormatter(xform, InputFormat, OutputFormat, xform->core->dwOriginalFlags); (void)_cmsAdjustReferenceCount(&xform->core->refs, 1); diff --git a/lcms2mt/src/lcms2_internal.h b/lcms2mt/src/lcms2_internal.h index 89625592..12993282 100644 --- a/lcms2mt/src/lcms2_internal.h +++ b/lcms2mt/src/lcms2_internal.h @@ -1,7 +1,7 @@ // // Little Color Management System -// Copyright (c) 1998-2017 Marti Maria Saguer +// Copyright (c) 1998-2020 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -47,7 +47,7 @@ #endif // BorlandC 5.5, VC2003 are broken on that -#if defined(__BORLANDC__) || defined(_MSC_VER) && (_MSC_VER < 1400) // 1400 == VC++ 8.0 +#if defined(__BORLANDC__) || (defined(_MSC_VER) && (_MSC_VER < 1400)) // 1400 == VC++ 8.0 #define sinf(x) (float)sin((float)x) #define sqrtf(x) (float)sqrt((float)x) #endif @@ -88,11 +88,11 @@ # define cmsINLINE static inline #endif -// Allow signed overflow, we know this is harmless in this particular context +// Allow signed overflow, we know this is harmless in this particular context #if defined(__clang__) # define CMS_NO_SANITIZE __attribute__((no_sanitize("signed-integer-overflow"))) #else -# define CMS_NO_SANITIZE +# define CMS_NO_SANITIZE #endif // Other replacement functions @@ -517,8 +517,6 @@ struct _cmsContext_struct { // If NULL, then it reverts to global Context0 _cmsMemPluginChunkType DefaultMemoryManager; // The allocators used for creating the context itself. Cannot be overridden - - cmsUInt32Number dwFlags; // Horrid, but safe hack }; // Returns a pointer to a valid context structure, including the global one if id is zero. @@ -940,6 +938,9 @@ cmsBool _cmsReadCHAD(cmsContext ContextID, cmsMAT3* Dest, cmsHPROFILE // Profile linker -------------------------------------------------------------------------------------------------- +// Link several profiles to obtain a single LUT modelling the whole color transform. Intents, Black point +// compensation and Adaptation parameters may vary across profiles. BPC and Adaptation refers to the PCS +// after the profile. I.e, BPC[0] refers to connexion between profile(0) and profile(1) cmsPipeline* _cmsLinkProfiles(cmsContext ContextID, cmsUInt32Number nProfiles, cmsUInt32Number TheIntents[], diff --git a/lcms2mt/src/lcms2mt.def b/lcms2mt/src/lcms2mt.def index f329f596..0703fed8 100644 --- a/lcms2mt/src/lcms2mt.def +++ b/lcms2mt/src/lcms2mt.def @@ -55,6 +55,7 @@ cmsDetectTAC = cmsDetectTAC cmsDesaturateLab = cmsDesaturateLab cmsDoTransform = cmsDoTransform cmsDoTransformStride = cmsDoTransformStride +cmsDoTransformLineStride = cmsDoTransformLineStride _cmsDoubleTo15Fixed16 = _cmsDoubleTo15Fixed16 _cmsDoubleTo8Fixed8 = _cmsDoubleTo8Fixed8 _cmsDupMem = _cmsDupMem @@ -221,6 +222,8 @@ cmsOpenIOhandlerFromMem = cmsOpenIOhandlerFromMem cmsOpenIOhandlerFromNULL = cmsOpenIOhandlerFromNULL cmsOpenIOhandlerFromStream = cmsOpenIOhandlerFromStream cmsOpenProfileFromFile = cmsOpenProfileFromFile +cmsOpenProfileFromIOhandler = cmsOpenProfileFromIOhandler +cmsOpenProfileFromIOhandler2 = cmsOpenProfileFromIOhandler2 cmsOpenProfileFromMem = cmsOpenProfileFromMem cmsOpenProfileFromStream = cmsOpenProfileFromStream cmsPlugin = cmsPlugin @@ -306,6 +309,12 @@ cmsCreateContext = cmsCreateContext cmsDupContext = cmsDupContext cmsDeleteContext = cmsDeleteContext cmsGetContextUserData = cmsGetContextUserData +cmsUnregisterPlugins = cmsUnregisterPlugins +cmsSetAlarmCodes = cmsSetAlarmCodes +cmsGetAlarmCodes = cmsGetAlarmCodes +cmsSetAdaptationState = cmsSetAdaptationState +cmsSetLogErrorHandler = cmsSetLogErrorHandler +cmsGetSupportedIntents = cmsGetSupportedIntents cmsMLUtranslationsCount = cmsMLUtranslationsCount cmsMLUtranslationsCodes = cmsMLUtranslationsCodes _cmsCreateMutex = _cmsCreateMutex @@ -314,3 +323,24 @@ _cmsLockMutex = _cmsLockMutex _cmsUnlockMutex = _cmsUnlockMutex cmsGetProfileIOhandler = cmsGetProfileIOhandler cmsGetEncodedCMMversion = cmsGetEncodedCMMversion +_cmsFloat2Half = _cmsFloat2Half +_cmsHalf2Float = _cmsHalf2Float +_cmsFreeInterpParams = _cmsFreeInterpParams +_cmsGetFormatter = _cmsGetFormatter +_cmsGetTransformFormatters16 = _cmsGetTransformFormatters16 +_cmsGetTransformFormattersFloat = _cmsGetTransformFormattersFloat +_cmsQuantizeVal = _cmsQuantizeVal +_cmsReadDevicelinkLUT = _cmsReadDevicelinkLUT +_cmsReadInputLUT = _cmsReadInputLUT +_cmsReadOutputLUT = _cmsReadOutputLUT +_cmsStageAllocIdentityCLut = _cmsStageAllocIdentityCLut +_cmsStageAllocIdentityCurves = _cmsStageAllocIdentityCurves +_cmsStageAllocLab2XYZ = _cmsStageAllocLab2XYZ +_cmsStageAllocLabV2ToV4 = _cmsStageAllocLabV2ToV4 +_cmsStageAllocLabV4ToV2 = _cmsStageAllocLabV4ToV2 +_cmsStageAllocNamedColor = _cmsStageAllocNamedColor +_cmsStageAllocXYZ2Lab = _cmsStageAllocXYZ2Lab +cmsMD5add = cmsMD5add +cmsMD5alloc = cmsMD5alloc +cmsMD5finish = cmsMD5finish +_cmsComputeInterpParams = _cmsComputeInterpParams diff --git a/lcms2mt/testbed/Makefile.am b/lcms2mt/testbed/Makefile.am index 50e34398..8fd93f93 100644 --- a/lcms2mt/testbed/Makefile.am +++ b/lcms2mt/testbed/Makefile.am @@ -14,7 +14,7 @@ check_PROGRAMS = testcms # The testsuite binary is statically linked. This is necessary as it uses some # of the internal functions that are not necessarily exported by the shared # library. -testcms_LDADD = $(top_builddir)/src/liblcms2.la +testcms_LDADD = $(top_builddir)/src/liblcms2mt.la testcms_LDFLAGS = -static @LDFLAGS@ testcms_SOURCES = testcms2.c testplugin.c zoo_icc.c testcms2.h diff --git a/lcms2mt/testbed/Makefile.in b/lcms2mt/testbed/Makefile.in index efc8c2b8..d8f9416d 100644 --- a/lcms2mt/testbed/Makefile.in +++ b/lcms2mt/testbed/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -112,7 +112,7 @@ CONFIG_CLEAN_VPATH_FILES = am_testcms_OBJECTS = testcms2.$(OBJEXT) testplugin.$(OBJEXT) \ zoo_icc.$(OBJEXT) testcms_OBJECTS = $(am_testcms_OBJECTS) -testcms_DEPENDENCIES = $(top_builddir)/src/liblcms2.la +testcms_DEPENDENCIES = $(top_builddir)/src/liblcms2mt.la AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent @@ -134,7 +134,9 @@ am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/testcms2.Po \ + ./$(DEPDIR)/testplugin.Po ./$(DEPDIR)/zoo_icc.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -332,7 +334,7 @@ AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include -I$(top_srcdir)/ # The testsuite binary is statically linked. This is necessary as it uses some # of the internal functions that are not necessarily exported by the shared # library. -testcms_LDADD = $(top_builddir)/src/liblcms2.la +testcms_LDADD = $(top_builddir)/src/liblcms2mt.la testcms_LDFLAGS = -static @LDFLAGS@ testcms_SOURCES = testcms2.c testplugin.c zoo_icc.c testcms2.h EXTRA_DIST = test1.icc bad.icc toosmall.icc test2.icc \ @@ -360,8 +362,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -392,9 +394,15 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testcms2.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testplugin.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zoo_icc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testcms2.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testplugin.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zoo_icc.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @@ -478,7 +486,10 @@ cscopelist-am: $(am__tagged_files) distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -549,7 +560,9 @@ clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ mostlyclean-am distclean: distclean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/testcms2.Po + -rm -f ./$(DEPDIR)/testplugin.Po + -rm -f ./$(DEPDIR)/zoo_icc.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags @@ -595,7 +608,9 @@ install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/testcms2.Po + -rm -f ./$(DEPDIR)/testplugin.Po + -rm -f ./$(DEPDIR)/zoo_icc.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -616,7 +631,7 @@ uninstall-am: .MAKE: check-am install-am install-strip -.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \ +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-checkPROGRAMS clean-generic clean-libtool cscopelist-am \ ctags ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ diff --git a/lcms2mt/testbed/new.icc b/lcms2mt/testbed/new.icc Binary files differindex 53b3505c..bd90c3dc 100644 --- a/lcms2mt/testbed/new.icc +++ b/lcms2mt/testbed/new.icc diff --git a/lcms2mt/testbed/testcms2.c b/lcms2mt/testbed/testcms2.c index 025c79ab..f633f565 100644 --- a/lcms2mt/testbed/testcms2.c +++ b/lcms2mt/testbed/testcms2.c @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2017 Marti Maria Saguer +// Copyright (c) 1998-2020 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -27,14 +27,8 @@ #include "testcms2.h" -// On Visual Studio, use debug CRT -#ifdef _MSC_VER -# include "crtdbg.h" -# include <io.h> -#endif - // A single check. Returns 1 if success, 0 if failed -typedef cmsInt32Number (*TestFn)(void); +typedef cmsInt32Number (*TestFn)(cmsContext); // A parametric Tone curve test function typedef cmsFloat32Number (* dblfnptr)(cmsFloat32Number x, const cmsFloat64Number Params[]); @@ -101,7 +95,7 @@ cmsContext DbgThread(void) { static cmsUInt32Number n = 1; - return (cmsContext) (void*)(n++ % 0xff0); + return (cmsContext) (void*) ((cmsUInt8Number*) NULL + (n++ % 0xff0)); } // The allocate routine @@ -220,7 +214,7 @@ void TestMemoryLeaks(cmsBool ok) } // Here we go with the plug-in declaration -static cmsPluginMemHandler DebugMemHandler = {{ cmsPluginMagicNumber, 2060, cmsPluginMemHandlerSig, NULL }, +static cmsPluginMemHandler DebugMemHandler = {{ cmsPluginMagicNumber, 2060-2000, cmsPluginMemHandlerSig, NULL }, DebugMalloc, DebugFree, DebugRealloc, NULL, NULL, NULL }; // Returns a pointer to the memhandler plugin @@ -296,8 +290,10 @@ void SubTest(const char* frm, ...) // The check framework static -void Check(const char* Title, TestFn Fn) +void Check(cmsContext ContextID, const char* Title, TestFn Fn) { + cmsContext ctx = DbgThread(); + printf("Checking %s ...", Title); fflush(stdout); @@ -307,7 +303,7 @@ void Check(const char* Title, TestFn Fn) SimultaneousErrors = 0; TotalTests++; - if (Fn() && !TrappedError) { + if (Fn(ctx) && !TrappedError) { // It is a good place to check memory TestMemoryLeaks(TRUE); @@ -330,30 +326,30 @@ void Check(const char* Title, TestFn Fn) } // Dump a tone curve, for easy diagnostic -void DumpToneCurve(cmsToneCurve* gamma, const char* FileName) +void DumpToneCurve(cmsContext ContextID, cmsToneCurve* gamma, const char* FileName) { cmsHANDLE hIT8; cmsUInt32Number i; - hIT8 = cmsIT8Alloc(DbgThread()); + hIT8 = cmsIT8Alloc(ContextID); - cmsIT8SetPropertyDbl(DbgThread(), hIT8, "NUMBER_OF_FIELDS", 2); - cmsIT8SetPropertyDbl(DbgThread(), hIT8, "NUMBER_OF_SETS", gamma ->nEntries); + cmsIT8SetPropertyDbl(ContextID, hIT8, "NUMBER_OF_FIELDS", 2); + cmsIT8SetPropertyDbl(ContextID, hIT8, "NUMBER_OF_SETS", gamma ->nEntries); - cmsIT8SetDataFormat(DbgThread(), hIT8, 0, "SAMPLE_ID"); - cmsIT8SetDataFormat(DbgThread(), hIT8, 1, "VALUE"); + cmsIT8SetDataFormat(ContextID, hIT8, 0, "SAMPLE_ID"); + cmsIT8SetDataFormat(ContextID, hIT8, 1, "VALUE"); for (i=0; i < gamma ->nEntries; i++) { char Val[30]; sprintf(Val, "%u", i); - cmsIT8SetDataRowCol(DbgThread(), hIT8, i, 0, Val); + cmsIT8SetDataRowCol(ContextID, hIT8, i, 0, Val); sprintf(Val, "0x%x", gamma ->Table16[i]); - cmsIT8SetDataRowCol(DbgThread(), hIT8, i, 1, Val); + cmsIT8SetDataRowCol(ContextID, hIT8, i, 1, Val); } - cmsIT8SaveToFile(DbgThread(), hIT8, FileName); - cmsIT8Free(DbgThread(), hIT8); + cmsIT8SaveToFile(ContextID, hIT8, FileName); + cmsIT8Free(ContextID, hIT8); } // ------------------------------------------------------------------------------------------------- @@ -363,7 +359,7 @@ void DumpToneCurve(cmsToneCurve* gamma, const char* FileName) // The space used is a clone of a well-known commercial // color space which I will name "Above RGB" static -cmsHPROFILE Create_AboveRGB(void) +cmsHPROFILE Create_AboveRGB(cmsContext ctx) { cmsToneCurve* Curve[3]; cmsHPROFILE hProfile; @@ -372,65 +368,65 @@ cmsHPROFILE Create_AboveRGB(void) {0.21, 0.71, 1 }, {0.15, 0.06, 1 }}; - Curve[0] = Curve[1] = Curve[2] = cmsBuildGamma(DbgThread(), 2.19921875); + Curve[0] = Curve[1] = Curve[2] = cmsBuildGamma(ctx, 2.19921875); - cmsWhitePointFromTemp(DbgThread(), &D65, 6504); - hProfile = cmsCreateRGBProfile(DbgThread(), &D65, &Primaries, Curve); - cmsFreeToneCurve(DbgThread(), Curve[0]); + cmsWhitePointFromTemp(ctx, &D65, 6504); + hProfile = cmsCreateRGBProfile(ctx, &D65, &Primaries, Curve); + cmsFreeToneCurve(ctx, Curve[0]); return hProfile; } // A gamma-2.2 gray space static -cmsHPROFILE Create_Gray22(void) +cmsHPROFILE Create_Gray22(cmsContext ctx) { cmsHPROFILE hProfile; - cmsToneCurve* Curve = cmsBuildGamma(DbgThread(), 2.2); + cmsToneCurve* Curve = cmsBuildGamma(ctx, 2.2); if (Curve == NULL) return NULL; - hProfile = cmsCreateGrayProfile(DbgThread(), cmsD50_xyY(DbgThread()), Curve); - cmsFreeToneCurve(DbgThread(), Curve); + hProfile = cmsCreateGrayProfile(ctx, cmsD50_xyY(ctx), Curve); + cmsFreeToneCurve(ctx, Curve); return hProfile; } // A gamma-3.0 gray space static -cmsHPROFILE Create_Gray30(void) +cmsHPROFILE Create_Gray30(cmsContext ctx) { cmsHPROFILE hProfile; - cmsToneCurve* Curve = cmsBuildGamma(DbgThread(), 3.0); + cmsToneCurve* Curve = cmsBuildGamma(ctx, 3.0); if (Curve == NULL) return NULL; - hProfile = cmsCreateGrayProfile(DbgThread(), cmsD50_xyY(DbgThread()), Curve); - cmsFreeToneCurve(DbgThread(), Curve); + hProfile = cmsCreateGrayProfile(ctx, cmsD50_xyY(ctx), Curve); + cmsFreeToneCurve(ctx, Curve); return hProfile; } static -cmsHPROFILE Create_GrayLab(void) +cmsHPROFILE Create_GrayLab(cmsContext ctx) { cmsHPROFILE hProfile; - cmsToneCurve* Curve = cmsBuildGamma(DbgThread(), 1.0); + cmsToneCurve* Curve = cmsBuildGamma(ctx, 1.0); if (Curve == NULL) return NULL; - hProfile = cmsCreateGrayProfile(DbgThread(), cmsD50_xyY(DbgThread()), Curve); - cmsFreeToneCurve(DbgThread(), Curve); + hProfile = cmsCreateGrayProfile(ctx, cmsD50_xyY(ctx), Curve); + cmsFreeToneCurve(ctx, Curve); - cmsSetPCS(DbgThread(), hProfile, cmsSigLabData); + cmsSetPCS(ctx, hProfile, cmsSigLabData); return hProfile; } // A CMYK devicelink that adds gamma 3.0 to each channel static -cmsHPROFILE Create_CMYK_DeviceLink(void) +cmsHPROFILE Create_CMYK_DeviceLink(cmsContext ctx) { cmsHPROFILE hProfile; cmsToneCurve* Tab[4]; - cmsToneCurve* Curve = cmsBuildGamma(DbgThread(), 3.0); + cmsToneCurve* Curve = cmsBuildGamma(ctx, 3.0); if (Curve == NULL) return NULL; Tab[0] = Curve; @@ -438,10 +434,10 @@ cmsHPROFILE Create_CMYK_DeviceLink(void) Tab[2] = Curve; Tab[3] = Curve; - hProfile = cmsCreateLinearizationDeviceLink(DbgThread(), cmsSigCmykData, Tab); + hProfile = cmsCreateLinearizationDeviceLink(ctx, cmsSigCmykData, Tab); if (hProfile == NULL) return NULL; - cmsFreeToneCurve(DbgThread(), Curve); + cmsFreeToneCurve(ctx, Curve); return hProfile; } @@ -473,7 +469,7 @@ cmsInt32Number ForwardSampler(cmsContext ContextID, register const cmsUInt16Numb cmsFloat64Number rgb[3], cmyk[4]; cmsFloat64Number c, m, y, k; - cmsDoTransform(DbgThread(), p ->hLab2sRGB, In, rgb, 1); + cmsDoTransform(ContextID, p ->hLab2sRGB, In, rgb, 1); c = 1 - rgb[0]; m = 1 - rgb[1]; @@ -490,7 +486,7 @@ cmsInt32Number ForwardSampler(cmsContext ContextID, register const cmsUInt16Numb cmyk[2] = y; cmyk[3] = k; - cmsDoTransform(DbgThread(), p ->hIlimit, cmyk, Out, 1); + cmsDoTransform(ContextID, p ->hIlimit, cmyk, Out, 1); return 1; } @@ -525,27 +521,24 @@ cmsInt32Number ReverseSampler(cmsContext ContextID, register const cmsUInt16Numb rgb[2] = Clip((1 - y) * (1 - k)); } - cmsDoTransform(DbgThread(), p ->sRGB2Lab, rgb, Out, 1); + cmsDoTransform(ContextID, p ->sRGB2Lab, rgb, Out, 1); return 1; } static -cmsHPROFILE CreateFakeCMYK(cmsFloat64Number InkLimit, cmsBool lUseAboveRGB) +cmsHPROFILE CreateFakeCMYK(cmsContext ContextID, cmsFloat64Number InkLimit, cmsBool lUseAboveRGB) { cmsHPROFILE hICC; cmsPipeline* AToB0, *BToA0; cmsStage* CLUT; - cmsContext ContextID; FakeCMYKParams p; cmsHPROFILE hLab, hsRGB, hLimit; cmsUInt32Number cmykfrm; - ContextID = DbgThread(); - if (lUseAboveRGB) - hsRGB = Create_AboveRGB(); + hsRGB = Create_AboveRGB(ContextID); else hsRGB = cmsCreate_sRGBProfile(ContextID); @@ -610,18 +603,18 @@ cmsHPROFILE CreateFakeCMYK(cmsFloat64Number InkLimit, cmsBool lUseAboveRGB) // Does create several profiles for latter use------------------------------------------------------------------------------------------------ static -cmsInt32Number OneVirtual(cmsHPROFILE h, const char* SubTestTxt, const char* FileName) +cmsInt32Number OneVirtual(cmsContext ctx, cmsHPROFILE h, const char* SubTestTxt, const char* FileName) { SubTest(SubTestTxt); if (h == NULL) return 0; - if (!cmsSaveProfileToFile(DbgThread(), h, FileName)) return 0; - cmsCloseProfile(DbgThread(), h); + if (!cmsSaveProfileToFile(ctx, h, FileName)) return 0; + cmsCloseProfile(ctx, h); - h = cmsOpenProfileFromFile(DbgThread(), FileName, "r"); + h = cmsOpenProfileFromFile(ctx, FileName, "r"); if (h == NULL) return 0; - cmsCloseProfile(DbgThread(), h); + cmsCloseProfile(ctx, h); return 1; } @@ -630,77 +623,77 @@ cmsInt32Number OneVirtual(cmsHPROFILE h, const char* SubTestTxt, const char* Fil // This test checks the ability of lcms2 to save its built-ins as valid profiles. // It does not check the functionality of such profiles static -cmsInt32Number CreateTestProfiles(void) +cmsInt32Number CreateTestProfiles(cmsContext ctx) { cmsHPROFILE h; - h = cmsCreate_sRGBProfile(DbgThread()); - if (!OneVirtual(h, "sRGB profile", "sRGBlcms2.icc")) return 0; + h = cmsCreate_sRGBProfile(ctx); + if (!OneVirtual(ctx, h, "sRGB profile", "sRGBlcms2.icc")) return 0; // ---- - h = Create_AboveRGB(); - if (!OneVirtual(h, "aRGB profile", "aRGBlcms2.icc")) return 0; + h = Create_AboveRGB(ctx); + if (!OneVirtual(ctx, h, "aRGB profile", "aRGBlcms2.icc")) return 0; // ---- - h = Create_Gray22(); - if (!OneVirtual(h, "Gray profile", "graylcms2.icc")) return 0; + h = Create_Gray22(ctx); + if (!OneVirtual(ctx, h, "Gray profile", "graylcms2.icc")) return 0; // ---- - h = Create_Gray30(); - if (!OneVirtual(h, "Gray 3.0 profile", "gray3lcms2.icc")) return 0; + h = Create_Gray30(ctx); + if (!OneVirtual(ctx, h, "Gray 3.0 profile", "gray3lcms2.icc")) return 0; // ---- - h = Create_GrayLab(); - if (!OneVirtual(h, "Gray Lab profile", "glablcms2.icc")) return 0; + h = Create_GrayLab(ctx); + if (!OneVirtual(ctx, h, "Gray Lab profile", "glablcms2.icc")) return 0; // ---- - h = Create_CMYK_DeviceLink(); - if (!OneVirtual(h, "Linearization profile", "linlcms2.icc")) return 0; + h = Create_CMYK_DeviceLink(ctx); + if (!OneVirtual(ctx, h, "Linearization profile", "linlcms2.icc")) return 0; // ------- - h = cmsCreateInkLimitingDeviceLink(DbgThread(), cmsSigCmykData, 150); + h = cmsCreateInkLimitingDeviceLink(ctx, cmsSigCmykData, 150); if (h == NULL) return 0; - if (!OneVirtual(h, "Ink-limiting profile", "limitlcms2.icc")) return 0; + if (!OneVirtual(ctx, h, "Ink-limiting profile", "limitlcms2.icc")) return 0; // ------ - h = cmsCreateLab2Profile(DbgThread(), NULL); - if (!OneVirtual(h, "Lab 2 identity profile", "labv2lcms2.icc")) return 0; + h = cmsCreateLab2Profile(ctx, NULL); + if (!OneVirtual(ctx, h, "Lab 2 identity profile", "labv2lcms2.icc")) return 0; // ---- - h = cmsCreateLab4Profile(DbgThread(), NULL); - if (!OneVirtual(h, "Lab 4 identity profile", "labv4lcms2.icc")) return 0; + h = cmsCreateLab4Profile(ctx, NULL); + if (!OneVirtual(ctx, h, "Lab 4 identity profile", "labv4lcms2.icc")) return 0; // ---- - h = cmsCreateXYZProfile(DbgThread()); - if (!OneVirtual(h, "XYZ identity profile", "xyzlcms2.icc")) return 0; + h = cmsCreateXYZProfile(ctx); + if (!OneVirtual(ctx, h, "XYZ identity profile", "xyzlcms2.icc")) return 0; // ---- - h = cmsCreateNULLProfile(DbgThread()); - if (!OneVirtual(h, "NULL profile", "nullcms2.icc")) return 0; + h = cmsCreateNULLProfile(ctx); + if (!OneVirtual(ctx, h, "NULL profile", "nullcms2.icc")) return 0; // --- - h = cmsCreateBCHSWabstractProfile(DbgThread(), 17, 0, 0, 0, 0, 5000, 6000); - if (!OneVirtual(h, "BCHS profile", "bchslcms2.icc")) return 0; + h = cmsCreateBCHSWabstractProfile(ctx, 17, 0, 0, 0, 0, 5000, 6000); + if (!OneVirtual(ctx, h, "BCHS profile", "bchslcms2.icc")) return 0; // --- - h = CreateFakeCMYK(300, FALSE); - if (!OneVirtual(h, "Fake CMYK profile", "lcms2cmyk.icc")) return 0; + h = CreateFakeCMYK(ctx, 300, FALSE); + if (!OneVirtual(ctx, h, "Fake CMYK profile", "lcms2cmyk.icc")) return 0; // --- - h = cmsCreateBCHSWabstractProfile(DbgThread(), 17, 0, 1.2, 0, 3, 5000, 5000); - if (!OneVirtual(h, "Brightness", "brightness.icc")) return 0; + h = cmsCreateBCHSWabstractProfile(ctx, 17, 0, 1.2, 0, 3, 5000, 5000); + if (!OneVirtual(ctx, h, "Brightness", "brightness.icc")) return 0; return 1; } @@ -729,7 +722,7 @@ void RemoveTestProfiles(void) // Check the size of basic types. If this test fails, nothing is going to work anyway static -cmsInt32Number CheckBaseTypes(void) +cmsInt32Number CheckBaseTypes(cmsContext ContextID) { // Ignore warnings about conditional expression #ifdef _MSC_VER @@ -759,7 +752,7 @@ cmsInt32Number CheckBaseTypes(void) // Are we little or big endian? From Harbison&Steele. static -cmsInt32Number CheckEndianness(void) +cmsInt32Number CheckEndianness(cmsContext ContextID) { cmsInt32Number BigEndian, IsOk; union { @@ -787,7 +780,7 @@ cmsInt32Number CheckEndianness(void) // Check quick floor static -cmsInt32Number CheckQuickFloor(void) +cmsInt32Number CheckQuickFloor(cmsContext ContextID) { if ((_cmsQuickFloor(1.234) != 1) || (_cmsQuickFloor(32767.234) != 32767) || @@ -805,7 +798,7 @@ cmsInt32Number CheckQuickFloor(void) // Quick floor restricted to word static -cmsInt32Number CheckQuickFloorWord(void) +cmsInt32Number CheckQuickFloorWord(cmsContext ContextID) { cmsUInt32Number i; @@ -890,51 +883,51 @@ cmsBool IsGoodWordPrec(const char *title, cmsUInt16Number in, cmsUInt16Number o // Fixed point ---------------------------------------------------------------------------------------------- static -cmsInt32Number TestSingleFixed15_16(cmsFloat64Number d) +cmsInt32Number TestSingleFixed15_16(cmsContext ContextID, cmsFloat64Number d) { - cmsS15Fixed16Number f = _cmsDoubleTo15Fixed16(DbgThread(), d); - cmsFloat64Number RoundTrip = _cms15Fixed16toDouble(DbgThread(), f); + cmsS15Fixed16Number f = _cmsDoubleTo15Fixed16(ContextID, d); + cmsFloat64Number RoundTrip = _cms15Fixed16toDouble(ContextID, f); cmsFloat64Number Error = fabs(d - RoundTrip); return ( Error <= FIXED_PRECISION_15_16); } static -cmsInt32Number CheckFixedPoint15_16(void) +cmsInt32Number CheckFixedPoint15_16(cmsContext ContextID) { - if (!TestSingleFixed15_16(1.0)) return 0; - if (!TestSingleFixed15_16(2.0)) return 0; - if (!TestSingleFixed15_16(1.23456)) return 0; - if (!TestSingleFixed15_16(0.99999)) return 0; - if (!TestSingleFixed15_16(0.1234567890123456789099999)) return 0; - if (!TestSingleFixed15_16(-1.0)) return 0; - if (!TestSingleFixed15_16(-2.0)) return 0; - if (!TestSingleFixed15_16(-1.23456)) return 0; - if (!TestSingleFixed15_16(-1.1234567890123456789099999)) return 0; - if (!TestSingleFixed15_16(+32767.1234567890123456789099999)) return 0; - if (!TestSingleFixed15_16(-32767.1234567890123456789099999)) return 0; + if (!TestSingleFixed15_16(ContextID, 1.0)) return 0; + if (!TestSingleFixed15_16(ContextID, 2.0)) return 0; + if (!TestSingleFixed15_16(ContextID, 1.23456)) return 0; + if (!TestSingleFixed15_16(ContextID, 0.99999)) return 0; + if (!TestSingleFixed15_16(ContextID, 0.1234567890123456789099999)) return 0; + if (!TestSingleFixed15_16(ContextID, -1.0)) return 0; + if (!TestSingleFixed15_16(ContextID, -2.0)) return 0; + if (!TestSingleFixed15_16(ContextID, -1.23456)) return 0; + if (!TestSingleFixed15_16(ContextID, -1.1234567890123456789099999)) return 0; + if (!TestSingleFixed15_16(ContextID, +32767.1234567890123456789099999)) return 0; + if (!TestSingleFixed15_16(ContextID, -32767.1234567890123456789099999)) return 0; return 1; } static -cmsInt32Number TestSingleFixed8_8(cmsFloat64Number d) +cmsInt32Number TestSingleFixed8_8(cmsContext ContextID, cmsFloat64Number d) { - cmsS15Fixed16Number f = _cmsDoubleTo8Fixed8(DbgThread(), d); - cmsFloat64Number RoundTrip = _cms8Fixed8toDouble(DbgThread(), (cmsUInt16Number) f); + cmsS15Fixed16Number f = _cmsDoubleTo8Fixed8(ContextID, d); + cmsFloat64Number RoundTrip = _cms8Fixed8toDouble(ContextID, (cmsUInt16Number) f); cmsFloat64Number Error = fabs(d - RoundTrip); return ( Error <= FIXED_PRECISION_8_8); } static -cmsInt32Number CheckFixedPoint8_8(void) +cmsInt32Number CheckFixedPoint8_8(cmsContext ContextID) { - if (!TestSingleFixed8_8(1.0)) return 0; - if (!TestSingleFixed8_8(2.0)) return 0; - if (!TestSingleFixed8_8(1.23456)) return 0; - if (!TestSingleFixed8_8(0.99999)) return 0; - if (!TestSingleFixed8_8(0.1234567890123456789099999)) return 0; - if (!TestSingleFixed8_8(+255.1234567890123456789099999)) return 0; + if (!TestSingleFixed8_8(ContextID, 1.0)) return 0; + if (!TestSingleFixed8_8(ContextID, 2.0)) return 0; + if (!TestSingleFixed8_8(ContextID, 1.23456)) return 0; + if (!TestSingleFixed8_8(ContextID, 0.99999)) return 0; + if (!TestSingleFixed8_8(ContextID, 0.1234567890123456789099999)) return 0; + if (!TestSingleFixed8_8(ContextID, +255.1234567890123456789099999)) return 0; return 1; } @@ -942,19 +935,19 @@ cmsInt32Number CheckFixedPoint8_8(void) // D50 constant -------------------------------------------------------------------------------------------- static -cmsInt32Number CheckD50Roundtrip(void) +cmsInt32Number CheckD50Roundtrip(cmsContext ContextID) { cmsFloat64Number cmsD50X_2 = 0.96420288; cmsFloat64Number cmsD50Y_2 = 1.0; cmsFloat64Number cmsD50Z_2 = 0.82490540; - cmsS15Fixed16Number xe = _cmsDoubleTo15Fixed16(DbgThread(), cmsD50X); - cmsS15Fixed16Number ye = _cmsDoubleTo15Fixed16(DbgThread(), cmsD50Y); - cmsS15Fixed16Number ze = _cmsDoubleTo15Fixed16(DbgThread(), cmsD50Z); + cmsS15Fixed16Number xe = _cmsDoubleTo15Fixed16(ContextID, cmsD50X); + cmsS15Fixed16Number ye = _cmsDoubleTo15Fixed16(ContextID, cmsD50Y); + cmsS15Fixed16Number ze = _cmsDoubleTo15Fixed16(ContextID, cmsD50Z); - cmsFloat64Number x = _cms15Fixed16toDouble(DbgThread(), xe); - cmsFloat64Number y = _cms15Fixed16toDouble(DbgThread(), ye); - cmsFloat64Number z = _cms15Fixed16toDouble(DbgThread(), ze); + cmsFloat64Number x = _cms15Fixed16toDouble(ContextID, xe); + cmsFloat64Number y = _cms15Fixed16toDouble(ContextID, ye); + cmsFloat64Number z = _cms15Fixed16toDouble(ContextID, ze); double dx = fabs(cmsD50X - x); double dy = fabs(cmsD50Y - y); @@ -968,13 +961,13 @@ cmsInt32Number CheckD50Roundtrip(void) return 0; } - xe = _cmsDoubleTo15Fixed16(DbgThread(), cmsD50X_2); - ye = _cmsDoubleTo15Fixed16(DbgThread(), cmsD50Y_2); - ze = _cmsDoubleTo15Fixed16(DbgThread(), cmsD50Z_2); + xe = _cmsDoubleTo15Fixed16(ContextID, cmsD50X_2); + ye = _cmsDoubleTo15Fixed16(ContextID, cmsD50Y_2); + ze = _cmsDoubleTo15Fixed16(ContextID, cmsD50Z_2); - x = _cms15Fixed16toDouble(DbgThread(), xe); - y = _cms15Fixed16toDouble(DbgThread(), ye); - z = _cms15Fixed16toDouble(DbgThread(), ze); + x = _cms15Fixed16toDouble(ContextID, xe); + y = _cms15Fixed16toDouble(ContextID, ye); + z = _cms15Fixed16toDouble(ContextID, ze); dx = fabs(cmsD50X_2 - x); dy = fabs(cmsD50Y_2 - y); @@ -1019,7 +1012,7 @@ void BuildTable(cmsInt32Number n, cmsUInt16Number Tab[], cmsBool Descending) // max_err = max allowed error static -cmsInt32Number Check1D(cmsInt32Number nNodesToCheck, cmsBool Down, cmsInt32Number max_err) +cmsInt32Number Check1D(cmsContext ContextID, cmsInt32Number nNodesToCheck, cmsBool Down, cmsInt32Number max_err) { cmsUInt32Number i; cmsUInt16Number in, out; @@ -1029,7 +1022,7 @@ cmsInt32Number Check1D(cmsInt32Number nNodesToCheck, cmsBool Down, cmsInt32Numb Tab = (cmsUInt16Number*) malloc(sizeof(cmsUInt16Number)* nNodesToCheck); if (Tab == NULL) return 0; - p = _cmsComputeInterpParams(DbgThread(), nNodesToCheck, 1, 1, Tab, CMS_LERP_FLAGS_16BITS); + p = _cmsComputeInterpParams(ContextID, nNodesToCheck, 1, 1, Tab, CMS_LERP_FLAGS_16BITS); if (p == NULL) return 0; BuildTable(nNodesToCheck, Tab, Down); @@ -1039,85 +1032,85 @@ cmsInt32Number Check1D(cmsInt32Number nNodesToCheck, cmsBool Down, cmsInt32Numb in = (cmsUInt16Number) i; out = 0; - p ->Interpolation.Lerp16(DbgThread(), &in, &out, p); + p ->Interpolation.Lerp16(ContextID, &in, &out, p); if (Down) out = 0xffff - out; if (abs(out - in) > max_err) { Fail("(%dp): Must be %x, But is %x : ", nNodesToCheck, in, out); - _cmsFreeInterpParams(DbgThread(), p); + _cmsFreeInterpParams(ContextID, p); free(Tab); return 0; } } - _cmsFreeInterpParams(DbgThread(), p); + _cmsFreeInterpParams(ContextID, p); free(Tab); return 1; } static -cmsInt32Number Check1DLERP2(void) +cmsInt32Number Check1DLERP2(cmsContext ContextID) { - return Check1D(2, FALSE, 0); + return Check1D(ContextID, 2, FALSE, 0); } static -cmsInt32Number Check1DLERP3(void) +cmsInt32Number Check1DLERP3(cmsContext ContextID) { - return Check1D(3, FALSE, 1); + return Check1D(ContextID, 3, FALSE, 1); } static -cmsInt32Number Check1DLERP4(void) +cmsInt32Number Check1DLERP4(cmsContext ContextID) { - return Check1D(4, FALSE, 0); + return Check1D(ContextID, 4, FALSE, 0); } static -cmsInt32Number Check1DLERP6(void) +cmsInt32Number Check1DLERP6(cmsContext ContextID) { - return Check1D(6, FALSE, 0); + return Check1D(ContextID, 6, FALSE, 0); } static -cmsInt32Number Check1DLERP18(void) +cmsInt32Number Check1DLERP18(cmsContext ContextID) { - return Check1D(18, FALSE, 0); + return Check1D(ContextID, 18, FALSE, 0); } static -cmsInt32Number Check1DLERP2Down(void) +cmsInt32Number Check1DLERP2Down(cmsContext ContextID) { - return Check1D(2, TRUE, 0); + return Check1D(ContextID, 2, TRUE, 0); } static -cmsInt32Number Check1DLERP3Down(void) +cmsInt32Number Check1DLERP3Down(cmsContext ContextID) { - return Check1D(3, TRUE, 1); + return Check1D(ContextID, 3, TRUE, 1); } static -cmsInt32Number Check1DLERP6Down(void) +cmsInt32Number Check1DLERP6Down(cmsContext ContextID) { - return Check1D(6, TRUE, 0); + return Check1D(ContextID, 6, TRUE, 0); } static -cmsInt32Number Check1DLERP18Down(void) +cmsInt32Number Check1DLERP18Down(cmsContext ContextID) { - return Check1D(18, TRUE, 0); + return Check1D(ContextID, 18, TRUE, 0); } static -cmsInt32Number ExhaustiveCheck1DLERP(void) +cmsInt32Number ExhaustiveCheck1DLERP(cmsContext ContextID) { cmsUInt32Number j; @@ -1126,7 +1119,7 @@ cmsInt32Number ExhaustiveCheck1DLERP(void) if ((j % 10) == 0) printf("%u \r", j); - if (!Check1D(j, FALSE, 1)) return 0; + if (!Check1D(ContextID, j, FALSE, 1)) return 0; } printf("\rResult is "); @@ -1134,7 +1127,7 @@ cmsInt32Number ExhaustiveCheck1DLERP(void) } static -cmsInt32Number ExhaustiveCheck1DLERPDown(void) +cmsInt32Number ExhaustiveCheck1DLERPDown(cmsContext ContextID) { cmsUInt32Number j; @@ -1143,7 +1136,7 @@ cmsInt32Number ExhaustiveCheck1DLERPDown(void) if ((j % 10) == 0) printf("%u \r", j); - if (!Check1D(j, TRUE, 1)) return 0; + if (!Check1D(ContextID, j, TRUE, 1)) return 0; } @@ -1156,7 +1149,7 @@ cmsInt32Number ExhaustiveCheck1DLERPDown(void) // 3D interpolation ------------------------------------------------------------------------------------------------- static -cmsInt32Number Check3DinterpolationFloatTetrahedral(void) +cmsInt32Number Check3DinterpolationFloatTetrahedral(cmsContext ContextID) { cmsInterpParams* p; cmsInt32Number i; @@ -1177,7 +1170,7 @@ cmsInt32Number Check3DinterpolationFloatTetrahedral(void) }; - p = _cmsComputeInterpParams(DbgThread(), 2, 3, 3, FloatTable, CMS_LERP_FLAGS_FLOAT); + p = _cmsComputeInterpParams(ContextID, 2, 3, 3, FloatTable, CMS_LERP_FLAGS_FLOAT); MaxErr = 0.0; @@ -1185,7 +1178,7 @@ cmsInt32Number Check3DinterpolationFloatTetrahedral(void) In[0] = In[1] = In[2] = (cmsFloat32Number) ( (cmsFloat32Number) i / 65535.0F); - p ->Interpolation.LerpFloat(DbgThread(), In, Out, p); + p ->Interpolation.LerpFloat(ContextID, In, Out, p); if (!IsGoodFixed15_16("Channel 1", Out[0], In[0])) goto Error; if (!IsGoodFixed15_16("Channel 2", Out[1], (cmsFloat32Number) In[1] / 2.F)) goto Error; @@ -1193,16 +1186,16 @@ cmsInt32Number Check3DinterpolationFloatTetrahedral(void) } if (MaxErr > 0) printf("|Err|<%lf ", MaxErr); - _cmsFreeInterpParams(DbgThread(), p); + _cmsFreeInterpParams(ContextID, p); return 1; Error: - _cmsFreeInterpParams(DbgThread(), p); + _cmsFreeInterpParams(ContextID, p); return 0; } static -cmsInt32Number Check3DinterpolationFloatTrilinear(void) +cmsInt32Number Check3DinterpolationFloatTrilinear(cmsContext ContextID) { cmsInterpParams* p; cmsInt32Number i; @@ -1223,14 +1216,14 @@ cmsInt32Number Check3DinterpolationFloatTrilinear(void) }; - p = _cmsComputeInterpParams(DbgThread(), 2, 3, 3, FloatTable, CMS_LERP_FLAGS_FLOAT|CMS_LERP_FLAGS_TRILINEAR); + p = _cmsComputeInterpParams(ContextID, 2, 3, 3, FloatTable, CMS_LERP_FLAGS_FLOAT|CMS_LERP_FLAGS_TRILINEAR); MaxErr = 0.0; for (i=0; i < 0xffff; i++) { In[0] = In[1] = In[2] = (cmsFloat32Number) ( (cmsFloat32Number) i / 65535.0F); - p ->Interpolation.LerpFloat(DbgThread(), In, Out, p); + p ->Interpolation.LerpFloat(ContextID, In, Out, p); if (!IsGoodFixed15_16("Channel 1", Out[0], In[0])) goto Error; if (!IsGoodFixed15_16("Channel 2", Out[1], (cmsFloat32Number) In[1] / 2.F)) goto Error; @@ -1238,17 +1231,17 @@ cmsInt32Number Check3DinterpolationFloatTrilinear(void) } if (MaxErr > 0) printf("|Err|<%lf ", MaxErr); - _cmsFreeInterpParams(DbgThread(), p); + _cmsFreeInterpParams(ContextID, p); return 1; Error: - _cmsFreeInterpParams(DbgThread(), p); + _cmsFreeInterpParams(ContextID, p); return 0; } static -cmsInt32Number Check3DinterpolationTetrahedral16(void) +cmsInt32Number Check3DinterpolationTetrahedral16(cmsContext ContextID) { cmsInterpParams* p; cmsInt32Number i; @@ -1268,14 +1261,14 @@ cmsInt32Number Check3DinterpolationTetrahedral16(void) 0xffff, 0xffff, 0xffff }; - p = _cmsComputeInterpParams(DbgThread(), 2, 3, 3, Table, CMS_LERP_FLAGS_16BITS); + p = _cmsComputeInterpParams(ContextID, 2, 3, 3, Table, CMS_LERP_FLAGS_16BITS); MaxErr = 0.0; for (i=0; i < 0xffff; i++) { In[0] = In[1] = In[2] = (cmsUInt16Number) i; - p ->Interpolation.Lerp16(DbgThread(), In, Out, p); + p ->Interpolation.Lerp16(ContextID, In, Out, p); if (!IsGoodWord("Channel 1", Out[0], In[0])) goto Error; if (!IsGoodWord("Channel 2", Out[1], In[1])) goto Error; @@ -1283,16 +1276,16 @@ cmsInt32Number Check3DinterpolationTetrahedral16(void) } if (MaxErr > 0) printf("|Err|<%lf ", MaxErr); - _cmsFreeInterpParams(DbgThread(), p); + _cmsFreeInterpParams(ContextID, p); return 1; Error: - _cmsFreeInterpParams(DbgThread(), p); + _cmsFreeInterpParams(ContextID, p); return 0; } static -cmsInt32Number Check3DinterpolationTrilinear16(void) +cmsInt32Number Check3DinterpolationTrilinear16(cmsContext ContextID) { cmsInterpParams* p; cmsInt32Number i; @@ -1312,14 +1305,14 @@ cmsInt32Number Check3DinterpolationTrilinear16(void) 0xffff, 0xffff, 0xffff }; - p = _cmsComputeInterpParams(DbgThread(), 2, 3, 3, Table, CMS_LERP_FLAGS_TRILINEAR); + p = _cmsComputeInterpParams(ContextID, 2, 3, 3, Table, CMS_LERP_FLAGS_TRILINEAR); MaxErr = 0.0; for (i=0; i < 0xffff; i++) { In[0] = In[1] = In[2] = (cmsUInt16Number) i; - p ->Interpolation.Lerp16(DbgThread(), In, Out, p); + p ->Interpolation.Lerp16(ContextID, In, Out, p); if (!IsGoodWord("Channel 1", Out[0], In[0])) goto Error; if (!IsGoodWord("Channel 2", Out[1], In[1])) goto Error; @@ -1327,17 +1320,17 @@ cmsInt32Number Check3DinterpolationTrilinear16(void) } if (MaxErr > 0) printf("|Err|<%lf ", MaxErr); - _cmsFreeInterpParams(DbgThread(), p); + _cmsFreeInterpParams(ContextID, p); return 1; Error: - _cmsFreeInterpParams(DbgThread(), p); + _cmsFreeInterpParams(ContextID, p); return 0; } static -cmsInt32Number ExaustiveCheck3DinterpolationFloatTetrahedral(void) +cmsInt32Number ExaustiveCheck3DinterpolationFloatTetrahedral(cmsContext ContextID) { cmsInterpParams* p; cmsInt32Number r, g, b; @@ -1358,7 +1351,7 @@ cmsInt32Number ExaustiveCheck3DinterpolationFloatTetrahedral(void) }; - p = _cmsComputeInterpParams(DbgThread(), 2, 3, 3, FloatTable, CMS_LERP_FLAGS_FLOAT); + p = _cmsComputeInterpParams(ContextID, 2, 3, 3, FloatTable, CMS_LERP_FLAGS_FLOAT); MaxErr = 0.0; for (r=0; r < 0xff; r++) @@ -1371,7 +1364,7 @@ cmsInt32Number ExaustiveCheck3DinterpolationFloatTetrahedral(void) In[2] = (cmsFloat32Number) b / 255.0F; - p ->Interpolation.LerpFloat(DbgThread(), In, Out, p); + p ->Interpolation.LerpFloat(ContextID, In, Out, p); if (!IsGoodFixed15_16("Channel 1", Out[0], In[0])) goto Error; if (!IsGoodFixed15_16("Channel 2", Out[1], (cmsFloat32Number) In[1] / 2.F)) goto Error; @@ -1379,16 +1372,16 @@ cmsInt32Number ExaustiveCheck3DinterpolationFloatTetrahedral(void) } if (MaxErr > 0) printf("|Err|<%lf ", MaxErr); - _cmsFreeInterpParams(DbgThread(), p); + _cmsFreeInterpParams(ContextID, p); return 1; Error: - _cmsFreeInterpParams(DbgThread(), p); + _cmsFreeInterpParams(ContextID, p); return 0; } static -cmsInt32Number ExaustiveCheck3DinterpolationFloatTrilinear(void) +cmsInt32Number ExaustiveCheck3DinterpolationFloatTrilinear(cmsContext ContextID) { cmsInterpParams* p; cmsInt32Number r, g, b; @@ -1409,7 +1402,7 @@ cmsInt32Number ExaustiveCheck3DinterpolationFloatTrilinear(void) }; - p = _cmsComputeInterpParams(DbgThread(), 2, 3, 3, FloatTable, CMS_LERP_FLAGS_FLOAT|CMS_LERP_FLAGS_TRILINEAR); + p = _cmsComputeInterpParams(ContextID, 2, 3, 3, FloatTable, CMS_LERP_FLAGS_FLOAT|CMS_LERP_FLAGS_TRILINEAR); MaxErr = 0.0; for (r=0; r < 0xff; r++) @@ -1422,7 +1415,7 @@ cmsInt32Number ExaustiveCheck3DinterpolationFloatTrilinear(void) In[2] = (cmsFloat32Number) b / 255.0F; - p ->Interpolation.LerpFloat(DbgThread(), In, Out, p); + p ->Interpolation.LerpFloat(ContextID, In, Out, p); if (!IsGoodFixed15_16("Channel 1", Out[0], In[0])) goto Error; if (!IsGoodFixed15_16("Channel 2", Out[1], (cmsFloat32Number) In[1] / 2.F)) goto Error; @@ -1430,17 +1423,17 @@ cmsInt32Number ExaustiveCheck3DinterpolationFloatTrilinear(void) } if (MaxErr > 0) printf("|Err|<%lf ", MaxErr); - _cmsFreeInterpParams(DbgThread(), p); + _cmsFreeInterpParams(ContextID, p); return 1; Error: - _cmsFreeInterpParams(DbgThread(), p); + _cmsFreeInterpParams(ContextID, p); return 0; } static -cmsInt32Number ExhaustiveCheck3DinterpolationTetrahedral16(void) +cmsInt32Number ExhaustiveCheck3DinterpolationTetrahedral16(cmsContext ContextID) { cmsInterpParams* p; cmsInt32Number r, g, b; @@ -1460,7 +1453,7 @@ cmsInt32Number ExhaustiveCheck3DinterpolationTetrahedral16(void) 0xffff, 0xffff, 0xffff }; - p = _cmsComputeInterpParams(DbgThread(), 2, 3, 3, Table, CMS_LERP_FLAGS_16BITS); + p = _cmsComputeInterpParams(ContextID, 2, 3, 3, Table, CMS_LERP_FLAGS_16BITS); for (r=0; r < 0xff; r++) for (g=0; g < 0xff; g++) @@ -1471,23 +1464,23 @@ cmsInt32Number ExhaustiveCheck3DinterpolationTetrahedral16(void) In[2] = (cmsUInt16Number) b ; - p ->Interpolation.Lerp16(DbgThread(), In, Out, p); + p ->Interpolation.Lerp16(ContextID, In, Out, p); if (!IsGoodWord("Channel 1", Out[0], In[0])) goto Error; if (!IsGoodWord("Channel 2", Out[1], In[1])) goto Error; if (!IsGoodWord("Channel 3", Out[2], In[2])) goto Error; } - _cmsFreeInterpParams(DbgThread(), p); + _cmsFreeInterpParams(ContextID, p); return 1; Error: - _cmsFreeInterpParams(DbgThread(), p); + _cmsFreeInterpParams(ContextID, p); return 0; } static -cmsInt32Number ExhaustiveCheck3DinterpolationTrilinear16(void) +cmsInt32Number ExhaustiveCheck3DinterpolationTrilinear16(cmsContext ContextID) { cmsInterpParams* p; cmsInt32Number r, g, b; @@ -1507,7 +1500,7 @@ cmsInt32Number ExhaustiveCheck3DinterpolationTrilinear16(void) 0xffff, 0xffff, 0xffff }; - p = _cmsComputeInterpParams(DbgThread(), 2, 3, 3, Table, CMS_LERP_FLAGS_TRILINEAR); + p = _cmsComputeInterpParams(ContextID, 2, 3, 3, Table, CMS_LERP_FLAGS_TRILINEAR); for (r=0; r < 0xff; r++) for (g=0; g < 0xff; g++) @@ -1518,7 +1511,7 @@ cmsInt32Number ExhaustiveCheck3DinterpolationTrilinear16(void) In[2] = (cmsUInt16Number)b ; - p ->Interpolation.Lerp16(DbgThread(), In, Out, p); + p ->Interpolation.Lerp16(ContextID, In, Out, p); if (!IsGoodWord("Channel 1", Out[0], In[0])) goto Error; if (!IsGoodWord("Channel 2", Out[1], In[1])) goto Error; @@ -1526,17 +1519,17 @@ cmsInt32Number ExhaustiveCheck3DinterpolationTrilinear16(void) } - _cmsFreeInterpParams(DbgThread(), p); + _cmsFreeInterpParams(ContextID, p); return 1; Error: - _cmsFreeInterpParams(DbgThread(), p); + _cmsFreeInterpParams(ContextID, p); return 0; } // Check reverse interpolation on LUTS. This is right now exclusively used by K preservation algorithm static -cmsInt32Number CheckReverseInterpolation3x3(void) +cmsInt32Number CheckReverseInterpolation3x3(cmsContext ContextID) { cmsPipeline* Lut; cmsStage* clut; @@ -1560,14 +1553,14 @@ cmsInt32Number CheckReverseInterpolation3x3(void) - Lut = cmsPipelineAlloc(DbgThread(), 3, 3); + Lut = cmsPipelineAlloc(ContextID, 3, 3); - clut = cmsStageAllocCLut16bit(DbgThread(), 2, 3, 3, Table); - cmsPipelineInsertStage(DbgThread(), Lut, cmsAT_BEGIN, clut); + clut = cmsStageAllocCLut16bit(ContextID, 2, 3, 3, Table); + cmsPipelineInsertStage(ContextID, Lut, cmsAT_BEGIN, clut); Target[0] = 0; Target[1] = 0; Target[2] = 0; Hint[0] = 0; Hint[1] = 0; Hint[2] = 0; - cmsPipelineEvalReverseFloat(DbgThread(), Target, Result, NULL, Lut); + cmsPipelineEvalReverseFloat(ContextID, Target, Result, NULL, Lut); if (Result[0] != 0 || Result[1] != 0 || Result[2] != 0){ Fail("Reverse interpolation didn't find zero"); @@ -1581,7 +1574,7 @@ cmsInt32Number CheckReverseInterpolation3x3(void) cmsFloat32Number in = i / 100.0F; Target[0] = in; Target[1] = 0; Target[2] = 0; - cmsPipelineEvalReverseFloat(DbgThread(), Target, Result, Hint, Lut); + cmsPipelineEvalReverseFloat(ContextID, Target, Result, Hint, Lut); err = fabsf(in - Result[0]); if (err > max) max = err; @@ -1589,17 +1582,17 @@ cmsInt32Number CheckReverseInterpolation3x3(void) memcpy(Hint, Result, sizeof(Hint)); } - cmsPipelineFree(DbgThread(), Lut); + cmsPipelineFree(ContextID, Lut); return (max <= FLOAT_PRECISSION); Error: - cmsPipelineFree(DbgThread(), Lut); + cmsPipelineFree(ContextID, Lut); return 0; } static -cmsInt32Number CheckReverseInterpolation4x3(void) +cmsInt32Number CheckReverseInterpolation4x3(cmsContext ContextID) { cmsPipeline* Lut; cmsStage* clut; @@ -1636,10 +1629,10 @@ cmsInt32Number CheckReverseInterpolation4x3(void) }; - Lut = cmsPipelineAlloc(DbgThread(), 4, 3); + Lut = cmsPipelineAlloc(ContextID, 4, 3); - clut = cmsStageAllocCLut16bit(DbgThread(), 2, 4, 3, Table); - cmsPipelineInsertStage(DbgThread(), Lut, cmsAT_BEGIN, clut); + clut = cmsStageAllocCLut16bit(ContextID, 2, 4, 3, Table); + cmsPipelineInsertStage(ContextID, Lut, cmsAT_BEGIN, clut); // Check if the LUT is behaving as expected SubTest("4->3 feasibility"); @@ -1650,7 +1643,7 @@ cmsInt32Number CheckReverseInterpolation4x3(void) Target[2] = 0; Target[3] = 12; - cmsPipelineEvalFloat(DbgThread(), Target, Result, Lut); + cmsPipelineEvalFloat(ContextID, Target, Result, Lut); if (!IsGoodFixed15_16("0", Target[0], Result[0])) goto Error; if (!IsGoodFixed15_16("1", Target[1], Result[1])) goto Error; @@ -1668,7 +1661,7 @@ cmsInt32Number CheckReverseInterpolation4x3(void) // This is our hint (which is a big lie in this case) Hint[0] = 0.1F; Hint[1] = 0.1F; Hint[2] = 0.1F; - cmsPipelineEvalReverseFloat(DbgThread(), Target, Result, Hint, Lut); + cmsPipelineEvalReverseFloat(ContextID, Target, Result, Hint, Lut); if (Result[0] != 0 || Result[1] != 0 || Result[2] != 0 || Result[3] != 0){ @@ -1683,7 +1676,7 @@ cmsInt32Number CheckReverseInterpolation4x3(void) cmsFloat32Number in = i / 100.0F; Target[0] = in; Target[1] = 0; Target[2] = 0; - cmsPipelineEvalReverseFloat(DbgThread(), Target, Result, Hint, Lut); + cmsPipelineEvalReverseFloat(ContextID, Target, Result, Hint, Lut); err = fabsf(in - Result[0]); if (err > max) max = err; @@ -1691,11 +1684,11 @@ cmsInt32Number CheckReverseInterpolation4x3(void) memcpy(Hint, Result, sizeof(Hint)); } - cmsPipelineFree(DbgThread(), Lut); + cmsPipelineFree(ContextID, Lut); return (max <= FLOAT_PRECISSION); Error: - cmsPipelineFree(DbgThread(), Lut); + cmsPipelineFree(ContextID, Lut); return 0; } @@ -1824,17 +1817,17 @@ cmsInt32Number Sampler8D(cmsContext ContextID, register const cmsUInt16Number In } static -cmsBool CheckOne3D(cmsPipeline* lut, cmsUInt16Number a1, cmsUInt16Number a2, cmsUInt16Number a3) +cmsBool CheckOne3D(cmsContext ContextID, cmsPipeline* lut, cmsUInt16Number a1, cmsUInt16Number a2, cmsUInt16Number a3) { cmsUInt16Number In[3], Out1[3], Out2[3]; In[0] = a1; In[1] = a2; In[2] = a3; // This is the interpolated value - cmsPipelineEval16(DbgThread(), In, Out1, lut); + cmsPipelineEval16(ContextID, In, Out1, lut); // This is the real value - Sampler3D(DbgThread(), In, Out2, NULL); + Sampler3D(ContextID, In, Out2, NULL); // Let's see the difference @@ -1846,17 +1839,17 @@ cmsBool CheckOne3D(cmsPipeline* lut, cmsUInt16Number a1, cmsUInt16Number a2, cms } static -cmsBool CheckOne4D(cmsPipeline* lut, cmsUInt16Number a1, cmsUInt16Number a2, cmsUInt16Number a3, cmsUInt16Number a4) +cmsBool CheckOne4D(cmsContext ContextID, cmsPipeline* lut, cmsUInt16Number a1, cmsUInt16Number a2, cmsUInt16Number a3, cmsUInt16Number a4) { cmsUInt16Number In[4], Out1[3], Out2[3]; In[0] = a1; In[1] = a2; In[2] = a3; In[3] = a4; // This is the interpolated value - cmsPipelineEval16(DbgThread(), In, Out1, lut); + cmsPipelineEval16(ContextID, In, Out1, lut); // This is the real value - Sampler4D(DbgThread(), In, Out2, NULL); + Sampler4D(ContextID, In, Out2, NULL); // Let's see the difference @@ -1868,7 +1861,7 @@ cmsBool CheckOne4D(cmsPipeline* lut, cmsUInt16Number a1, cmsUInt16Number a2, cms } static -cmsBool CheckOne5D(cmsPipeline* lut, cmsUInt16Number a1, cmsUInt16Number a2, +cmsBool CheckOne5D(cmsContext ContextID, cmsPipeline* lut, cmsUInt16Number a1, cmsUInt16Number a2, cmsUInt16Number a3, cmsUInt16Number a4, cmsUInt16Number a5) { cmsUInt16Number In[5], Out1[3], Out2[3]; @@ -1876,10 +1869,10 @@ cmsBool CheckOne5D(cmsPipeline* lut, cmsUInt16Number a1, cmsUInt16Number a2, In[0] = a1; In[1] = a2; In[2] = a3; In[3] = a4; In[4] = a5; // This is the interpolated value - cmsPipelineEval16(DbgThread(), In, Out1, lut); + cmsPipelineEval16(ContextID, In, Out1, lut); // This is the real value - Sampler5D(DbgThread(), In, Out2, NULL); + Sampler5D(ContextID, In, Out2, NULL); // Let's see the difference @@ -1891,7 +1884,7 @@ cmsBool CheckOne5D(cmsPipeline* lut, cmsUInt16Number a1, cmsUInt16Number a2, } static -cmsBool CheckOne6D(cmsPipeline* lut, cmsUInt16Number a1, cmsUInt16Number a2, +cmsBool CheckOne6D(cmsContext ContextID, cmsPipeline* lut, cmsUInt16Number a1, cmsUInt16Number a2, cmsUInt16Number a3, cmsUInt16Number a4, cmsUInt16Number a5, cmsUInt16Number a6) { @@ -1900,10 +1893,10 @@ cmsBool CheckOne6D(cmsPipeline* lut, cmsUInt16Number a1, cmsUInt16Number a2, In[0] = a1; In[1] = a2; In[2] = a3; In[3] = a4; In[4] = a5; In[5] = a6; // This is the interpolated value - cmsPipelineEval16(DbgThread(), In, Out1, lut); + cmsPipelineEval16(ContextID, In, Out1, lut); // This is the real value - Sampler6D(DbgThread(), In, Out2, NULL); + Sampler6D(ContextID, In, Out2, NULL); // Let's see the difference @@ -1916,7 +1909,7 @@ cmsBool CheckOne6D(cmsPipeline* lut, cmsUInt16Number a1, cmsUInt16Number a2, static -cmsBool CheckOne7D(cmsPipeline* lut, cmsUInt16Number a1, cmsUInt16Number a2, +cmsBool CheckOne7D(cmsContext ContextID, cmsPipeline* lut, cmsUInt16Number a1, cmsUInt16Number a2, cmsUInt16Number a3, cmsUInt16Number a4, cmsUInt16Number a5, cmsUInt16Number a6, cmsUInt16Number a7) @@ -1926,10 +1919,10 @@ cmsBool CheckOne7D(cmsPipeline* lut, cmsUInt16Number a1, cmsUInt16Number a2, In[0] = a1; In[1] = a2; In[2] = a3; In[3] = a4; In[4] = a5; In[5] = a6; In[6] = a7; // This is the interpolated value - cmsPipelineEval16(DbgThread(), In, Out1, lut); + cmsPipelineEval16(ContextID, In, Out1, lut); // This is the real value - Sampler7D(DbgThread(), In, Out2, NULL); + Sampler7D(ContextID, In, Out2, NULL); // Let's see the difference @@ -1942,7 +1935,7 @@ cmsBool CheckOne7D(cmsPipeline* lut, cmsUInt16Number a1, cmsUInt16Number a2, static -cmsBool CheckOne8D(cmsPipeline* lut, cmsUInt16Number a1, cmsUInt16Number a2, +cmsBool CheckOne8D(cmsContext ContextID, cmsPipeline* lut, cmsUInt16Number a1, cmsUInt16Number a2, cmsUInt16Number a3, cmsUInt16Number a4, cmsUInt16Number a5, cmsUInt16Number a6, cmsUInt16Number a7, cmsUInt16Number a8) @@ -1952,10 +1945,10 @@ cmsBool CheckOne8D(cmsPipeline* lut, cmsUInt16Number a1, cmsUInt16Number a2, In[0] = a1; In[1] = a2; In[2] = a3; In[3] = a4; In[4] = a5; In[5] = a6; In[6] = a7; In[7] = a8; // This is the interpolated value - cmsPipelineEval16(DbgThread(), In, Out1, lut); + cmsPipelineEval16(ContextID, In, Out1, lut); // This is the real value - Sampler8D(DbgThread(), In, Out2, NULL); + Sampler8D(ContextID, In, Out2, NULL); // Let's see the difference @@ -1968,87 +1961,87 @@ cmsBool CheckOne8D(cmsPipeline* lut, cmsUInt16Number a1, cmsUInt16Number a2, static -cmsInt32Number Check3Dinterp(void) +cmsInt32Number Check3Dinterp(cmsContext ContextID) { cmsPipeline* lut; cmsStage* mpe; - lut = cmsPipelineAlloc(DbgThread(), 3, 3); - mpe = cmsStageAllocCLut16bit(DbgThread(), 9, 3, 3, NULL); - cmsStageSampleCLut16bit(DbgThread(), mpe, Sampler3D, NULL, 0); - cmsPipelineInsertStage(DbgThread(), lut, cmsAT_BEGIN, mpe); + lut = cmsPipelineAlloc(ContextID, 3, 3); + mpe = cmsStageAllocCLut16bit(ContextID, 9, 3, 3, NULL); + cmsStageSampleCLut16bit(ContextID, mpe, Sampler3D, NULL, 0); + cmsPipelineInsertStage(ContextID, lut, cmsAT_BEGIN, mpe); // Check accuracy - if (!CheckOne3D(lut, 0, 0, 0)) return 0; - if (!CheckOne3D(lut, 0xffff, 0xffff, 0xffff)) return 0; + if (!CheckOne3D(ContextID, lut, 0, 0, 0)) return 0; + if (!CheckOne3D(ContextID, lut, 0xffff, 0xffff, 0xffff)) return 0; - if (!CheckOne3D(lut, 0x8080, 0x8080, 0x8080)) return 0; - if (!CheckOne3D(lut, 0x0000, 0xFE00, 0x80FF)) return 0; - if (!CheckOne3D(lut, 0x1111, 0x2222, 0x3333)) return 0; - if (!CheckOne3D(lut, 0x0000, 0x0012, 0x0013)) return 0; - if (!CheckOne3D(lut, 0x3141, 0x1415, 0x1592)) return 0; - if (!CheckOne3D(lut, 0xFF00, 0xFF01, 0xFF12)) return 0; + if (!CheckOne3D(ContextID, lut, 0x8080, 0x8080, 0x8080)) return 0; + if (!CheckOne3D(ContextID, lut, 0x0000, 0xFE00, 0x80FF)) return 0; + if (!CheckOne3D(ContextID, lut, 0x1111, 0x2222, 0x3333)) return 0; + if (!CheckOne3D(ContextID, lut, 0x0000, 0x0012, 0x0013)) return 0; + if (!CheckOne3D(ContextID, lut, 0x3141, 0x1415, 0x1592)) return 0; + if (!CheckOne3D(ContextID, lut, 0xFF00, 0xFF01, 0xFF12)) return 0; - cmsPipelineFree(DbgThread(), lut); + cmsPipelineFree(ContextID, lut); return 1; } static -cmsInt32Number Check3DinterpGranular(void) +cmsInt32Number Check3DinterpGranular(cmsContext ContextID) { cmsPipeline* lut; cmsStage* mpe; cmsUInt32Number Dimensions[] = { 7, 8, 9 }; - lut = cmsPipelineAlloc(DbgThread(), 3, 3); - mpe = cmsStageAllocCLut16bitGranular(DbgThread(), Dimensions, 3, 3, NULL); - cmsStageSampleCLut16bit(DbgThread(), mpe, Sampler3D, NULL, 0); - cmsPipelineInsertStage(DbgThread(), lut, cmsAT_BEGIN, mpe); + lut = cmsPipelineAlloc(ContextID, 3, 3); + mpe = cmsStageAllocCLut16bitGranular(ContextID, Dimensions, 3, 3, NULL); + cmsStageSampleCLut16bit(ContextID, mpe, Sampler3D, NULL, 0); + cmsPipelineInsertStage(ContextID, lut, cmsAT_BEGIN, mpe); // Check accuracy - if (!CheckOne3D(lut, 0, 0, 0)) return 0; - if (!CheckOne3D(lut, 0xffff, 0xffff, 0xffff)) return 0; + if (!CheckOne3D(ContextID, lut, 0, 0, 0)) return 0; + if (!CheckOne3D(ContextID, lut, 0xffff, 0xffff, 0xffff)) return 0; - if (!CheckOne3D(lut, 0x8080, 0x8080, 0x8080)) return 0; - if (!CheckOne3D(lut, 0x0000, 0xFE00, 0x80FF)) return 0; - if (!CheckOne3D(lut, 0x1111, 0x2222, 0x3333)) return 0; - if (!CheckOne3D(lut, 0x0000, 0x0012, 0x0013)) return 0; - if (!CheckOne3D(lut, 0x3141, 0x1415, 0x1592)) return 0; - if (!CheckOne3D(lut, 0xFF00, 0xFF01, 0xFF12)) return 0; + if (!CheckOne3D(ContextID, lut, 0x8080, 0x8080, 0x8080)) return 0; + if (!CheckOne3D(ContextID, lut, 0x0000, 0xFE00, 0x80FF)) return 0; + if (!CheckOne3D(ContextID, lut, 0x1111, 0x2222, 0x3333)) return 0; + if (!CheckOne3D(ContextID, lut, 0x0000, 0x0012, 0x0013)) return 0; + if (!CheckOne3D(ContextID, lut, 0x3141, 0x1415, 0x1592)) return 0; + if (!CheckOne3D(ContextID, lut, 0xFF00, 0xFF01, 0xFF12)) return 0; - cmsPipelineFree(DbgThread(), lut); + cmsPipelineFree(ContextID, lut); return 1; } static -cmsInt32Number Check4Dinterp(void) +cmsInt32Number Check4Dinterp(cmsContext ContextID) { cmsPipeline* lut; cmsStage* mpe; - lut = cmsPipelineAlloc(DbgThread(), 4, 3); - mpe = cmsStageAllocCLut16bit(DbgThread(), 9, 4, 3, NULL); - cmsStageSampleCLut16bit(DbgThread(), mpe, Sampler4D, NULL, 0); - cmsPipelineInsertStage(DbgThread(), lut, cmsAT_BEGIN, mpe); + lut = cmsPipelineAlloc(ContextID, 4, 3); + mpe = cmsStageAllocCLut16bit(ContextID, 9, 4, 3, NULL); + cmsStageSampleCLut16bit(ContextID, mpe, Sampler4D, NULL, 0); + cmsPipelineInsertStage(ContextID, lut, cmsAT_BEGIN, mpe); // Check accuracy - if (!CheckOne4D(lut, 0, 0, 0, 0)) return 0; - if (!CheckOne4D(lut, 0xffff, 0xffff, 0xffff, 0xffff)) return 0; + if (!CheckOne4D(ContextID, lut, 0, 0, 0, 0)) return 0; + if (!CheckOne4D(ContextID, lut, 0xffff, 0xffff, 0xffff, 0xffff)) return 0; - if (!CheckOne4D(lut, 0x8080, 0x8080, 0x8080, 0x8080)) return 0; - if (!CheckOne4D(lut, 0x0000, 0xFE00, 0x80FF, 0x8888)) return 0; - if (!CheckOne4D(lut, 0x1111, 0x2222, 0x3333, 0x4444)) return 0; - if (!CheckOne4D(lut, 0x0000, 0x0012, 0x0013, 0x0014)) return 0; - if (!CheckOne4D(lut, 0x3141, 0x1415, 0x1592, 0x9261)) return 0; - if (!CheckOne4D(lut, 0xFF00, 0xFF01, 0xFF12, 0xFF13)) return 0; + if (!CheckOne4D(ContextID, lut, 0x8080, 0x8080, 0x8080, 0x8080)) return 0; + if (!CheckOne4D(ContextID, lut, 0x0000, 0xFE00, 0x80FF, 0x8888)) return 0; + if (!CheckOne4D(ContextID, lut, 0x1111, 0x2222, 0x3333, 0x4444)) return 0; + if (!CheckOne4D(ContextID, lut, 0x0000, 0x0012, 0x0013, 0x0014)) return 0; + if (!CheckOne4D(ContextID, lut, 0x3141, 0x1415, 0x1592, 0x9261)) return 0; + if (!CheckOne4D(ContextID, lut, 0xFF00, 0xFF01, 0xFF12, 0xFF13)) return 0; - cmsPipelineFree(DbgThread(), lut); + cmsPipelineFree(ContextID, lut); return 1; } @@ -2056,148 +2049,148 @@ cmsInt32Number Check4Dinterp(void) static -cmsInt32Number Check4DinterpGranular(void) +cmsInt32Number Check4DinterpGranular(cmsContext ContextID) { cmsPipeline* lut; cmsStage* mpe; cmsUInt32Number Dimensions[] = { 9, 8, 7, 6 }; - lut = cmsPipelineAlloc(DbgThread(), 4, 3); - mpe = cmsStageAllocCLut16bitGranular(DbgThread(), Dimensions, 4, 3, NULL); - cmsStageSampleCLut16bit(DbgThread(), mpe, Sampler4D, NULL, 0); - cmsPipelineInsertStage(DbgThread(), lut, cmsAT_BEGIN, mpe); + lut = cmsPipelineAlloc(ContextID, 4, 3); + mpe = cmsStageAllocCLut16bitGranular(ContextID, Dimensions, 4, 3, NULL); + cmsStageSampleCLut16bit(ContextID, mpe, Sampler4D, NULL, 0); + cmsPipelineInsertStage(ContextID, lut, cmsAT_BEGIN, mpe); // Check accuracy - if (!CheckOne4D(lut, 0, 0, 0, 0)) return 0; - if (!CheckOne4D(lut, 0xffff, 0xffff, 0xffff, 0xffff)) return 0; + if (!CheckOne4D(ContextID, lut, 0, 0, 0, 0)) return 0; + if (!CheckOne4D(ContextID, lut, 0xffff, 0xffff, 0xffff, 0xffff)) return 0; - if (!CheckOne4D(lut, 0x8080, 0x8080, 0x8080, 0x8080)) return 0; - if (!CheckOne4D(lut, 0x0000, 0xFE00, 0x80FF, 0x8888)) return 0; - if (!CheckOne4D(lut, 0x1111, 0x2222, 0x3333, 0x4444)) return 0; - if (!CheckOne4D(lut, 0x0000, 0x0012, 0x0013, 0x0014)) return 0; - if (!CheckOne4D(lut, 0x3141, 0x1415, 0x1592, 0x9261)) return 0; - if (!CheckOne4D(lut, 0xFF00, 0xFF01, 0xFF12, 0xFF13)) return 0; + if (!CheckOne4D(ContextID, lut, 0x8080, 0x8080, 0x8080, 0x8080)) return 0; + if (!CheckOne4D(ContextID, lut, 0x0000, 0xFE00, 0x80FF, 0x8888)) return 0; + if (!CheckOne4D(ContextID, lut, 0x1111, 0x2222, 0x3333, 0x4444)) return 0; + if (!CheckOne4D(ContextID, lut, 0x0000, 0x0012, 0x0013, 0x0014)) return 0; + if (!CheckOne4D(ContextID, lut, 0x3141, 0x1415, 0x1592, 0x9261)) return 0; + if (!CheckOne4D(ContextID, lut, 0xFF00, 0xFF01, 0xFF12, 0xFF13)) return 0; - cmsPipelineFree(DbgThread(), lut); + cmsPipelineFree(ContextID, lut); return 1; } static -cmsInt32Number Check5DinterpGranular(void) +cmsInt32Number Check5DinterpGranular(cmsContext ContextID) { cmsPipeline* lut; cmsStage* mpe; cmsUInt32Number Dimensions[] = { 3, 2, 2, 2, 2 }; - lut = cmsPipelineAlloc(DbgThread(), 5, 3); - mpe = cmsStageAllocCLut16bitGranular(DbgThread(), Dimensions, 5, 3, NULL); - cmsStageSampleCLut16bit(DbgThread(), mpe, Sampler5D, NULL, 0); - cmsPipelineInsertStage(DbgThread(), lut, cmsAT_BEGIN, mpe); + lut = cmsPipelineAlloc(ContextID, 5, 3); + mpe = cmsStageAllocCLut16bitGranular(ContextID, Dimensions, 5, 3, NULL); + cmsStageSampleCLut16bit(ContextID, mpe, Sampler5D, NULL, 0); + cmsPipelineInsertStage(ContextID, lut, cmsAT_BEGIN, mpe); // Check accuracy - if (!CheckOne5D(lut, 0, 0, 0, 0, 0)) return 0; - if (!CheckOne5D(lut, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff)) return 0; + if (!CheckOne5D(ContextID, lut, 0, 0, 0, 0, 0)) return 0; + if (!CheckOne5D(ContextID, lut, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff)) return 0; - if (!CheckOne5D(lut, 0x8080, 0x8080, 0x8080, 0x8080, 0x1234)) return 0; - if (!CheckOne5D(lut, 0x0000, 0xFE00, 0x80FF, 0x8888, 0x8078)) return 0; - if (!CheckOne5D(lut, 0x1111, 0x2222, 0x3333, 0x4444, 0x1455)) return 0; - if (!CheckOne5D(lut, 0x0000, 0x0012, 0x0013, 0x0014, 0x2333)) return 0; - if (!CheckOne5D(lut, 0x3141, 0x1415, 0x1592, 0x9261, 0x4567)) return 0; - if (!CheckOne5D(lut, 0xFF00, 0xFF01, 0xFF12, 0xFF13, 0xF344)) return 0; + if (!CheckOne5D(ContextID, lut, 0x8080, 0x8080, 0x8080, 0x8080, 0x1234)) return 0; + if (!CheckOne5D(ContextID, lut, 0x0000, 0xFE00, 0x80FF, 0x8888, 0x8078)) return 0; + if (!CheckOne5D(ContextID, lut, 0x1111, 0x2222, 0x3333, 0x4444, 0x1455)) return 0; + if (!CheckOne5D(ContextID, lut, 0x0000, 0x0012, 0x0013, 0x0014, 0x2333)) return 0; + if (!CheckOne5D(ContextID, lut, 0x3141, 0x1415, 0x1592, 0x9261, 0x4567)) return 0; + if (!CheckOne5D(ContextID, lut, 0xFF00, 0xFF01, 0xFF12, 0xFF13, 0xF344)) return 0; - cmsPipelineFree(DbgThread(), lut); + cmsPipelineFree(ContextID, lut); return 1; } static -cmsInt32Number Check6DinterpGranular(void) +cmsInt32Number Check6DinterpGranular(cmsContext ContextID) { cmsPipeline* lut; cmsStage* mpe; cmsUInt32Number Dimensions[] = { 4, 3, 3, 2, 2, 2 }; - lut = cmsPipelineAlloc(DbgThread(), 6, 3); - mpe = cmsStageAllocCLut16bitGranular(DbgThread(), Dimensions, 6, 3, NULL); - cmsStageSampleCLut16bit(DbgThread(), mpe, Sampler6D, NULL, 0); - cmsPipelineInsertStage(DbgThread(), lut, cmsAT_BEGIN, mpe); + lut = cmsPipelineAlloc(ContextID, 6, 3); + mpe = cmsStageAllocCLut16bitGranular(ContextID, Dimensions, 6, 3, NULL); + cmsStageSampleCLut16bit(ContextID, mpe, Sampler6D, NULL, 0); + cmsPipelineInsertStage(ContextID, lut, cmsAT_BEGIN, mpe); // Check accuracy - if (!CheckOne6D(lut, 0, 0, 0, 0, 0, 0)) return 0; - if (!CheckOne6D(lut, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff)) return 0; + if (!CheckOne6D(ContextID, lut, 0, 0, 0, 0, 0, 0)) return 0; + if (!CheckOne6D(ContextID, lut, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff)) return 0; - if (!CheckOne6D(lut, 0x8080, 0x8080, 0x8080, 0x8080, 0x1234, 0x1122)) return 0; - if (!CheckOne6D(lut, 0x0000, 0xFE00, 0x80FF, 0x8888, 0x8078, 0x2233)) return 0; - if (!CheckOne6D(lut, 0x1111, 0x2222, 0x3333, 0x4444, 0x1455, 0x3344)) return 0; - if (!CheckOne6D(lut, 0x0000, 0x0012, 0x0013, 0x0014, 0x2333, 0x4455)) return 0; - if (!CheckOne6D(lut, 0x3141, 0x1415, 0x1592, 0x9261, 0x4567, 0x5566)) return 0; - if (!CheckOne6D(lut, 0xFF00, 0xFF01, 0xFF12, 0xFF13, 0xF344, 0x6677)) return 0; + if (!CheckOne6D(ContextID, lut, 0x8080, 0x8080, 0x8080, 0x8080, 0x1234, 0x1122)) return 0; + if (!CheckOne6D(ContextID, lut, 0x0000, 0xFE00, 0x80FF, 0x8888, 0x8078, 0x2233)) return 0; + if (!CheckOne6D(ContextID, lut, 0x1111, 0x2222, 0x3333, 0x4444, 0x1455, 0x3344)) return 0; + if (!CheckOne6D(ContextID, lut, 0x0000, 0x0012, 0x0013, 0x0014, 0x2333, 0x4455)) return 0; + if (!CheckOne6D(ContextID, lut, 0x3141, 0x1415, 0x1592, 0x9261, 0x4567, 0x5566)) return 0; + if (!CheckOne6D(ContextID, lut, 0xFF00, 0xFF01, 0xFF12, 0xFF13, 0xF344, 0x6677)) return 0; - cmsPipelineFree(DbgThread(), lut); + cmsPipelineFree(ContextID, lut); return 1; } static -cmsInt32Number Check7DinterpGranular(void) +cmsInt32Number Check7DinterpGranular(cmsContext ContextID) { cmsPipeline* lut; cmsStage* mpe; cmsUInt32Number Dimensions[] = { 4, 3, 3, 2, 2, 2, 2 }; - lut = cmsPipelineAlloc(DbgThread(), 7, 3); - mpe = cmsStageAllocCLut16bitGranular(DbgThread(), Dimensions, 7, 3, NULL); - cmsStageSampleCLut16bit(DbgThread(), mpe, Sampler7D, NULL, 0); - cmsPipelineInsertStage(DbgThread(), lut, cmsAT_BEGIN, mpe); + lut = cmsPipelineAlloc(ContextID, 7, 3); + mpe = cmsStageAllocCLut16bitGranular(ContextID, Dimensions, 7, 3, NULL); + cmsStageSampleCLut16bit(ContextID, mpe, Sampler7D, NULL, 0); + cmsPipelineInsertStage(ContextID, lut, cmsAT_BEGIN, mpe); // Check accuracy - if (!CheckOne7D(lut, 0, 0, 0, 0, 0, 0, 0)) return 0; - if (!CheckOne7D(lut, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff)) return 0; + if (!CheckOne7D(ContextID, lut, 0, 0, 0, 0, 0, 0, 0)) return 0; + if (!CheckOne7D(ContextID, lut, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff)) return 0; - if (!CheckOne7D(lut, 0x8080, 0x8080, 0x8080, 0x8080, 0x1234, 0x1122, 0x0056)) return 0; - if (!CheckOne7D(lut, 0x0000, 0xFE00, 0x80FF, 0x8888, 0x8078, 0x2233, 0x0088)) return 0; - if (!CheckOne7D(lut, 0x1111, 0x2222, 0x3333, 0x4444, 0x1455, 0x3344, 0x1987)) return 0; - if (!CheckOne7D(lut, 0x0000, 0x0012, 0x0013, 0x0014, 0x2333, 0x4455, 0x9988)) return 0; - if (!CheckOne7D(lut, 0x3141, 0x1415, 0x1592, 0x9261, 0x4567, 0x5566, 0xfe56)) return 0; - if (!CheckOne7D(lut, 0xFF00, 0xFF01, 0xFF12, 0xFF13, 0xF344, 0x6677, 0xbabe)) return 0; + if (!CheckOne7D(ContextID, lut, 0x8080, 0x8080, 0x8080, 0x8080, 0x1234, 0x1122, 0x0056)) return 0; + if (!CheckOne7D(ContextID, lut, 0x0000, 0xFE00, 0x80FF, 0x8888, 0x8078, 0x2233, 0x0088)) return 0; + if (!CheckOne7D(ContextID, lut, 0x1111, 0x2222, 0x3333, 0x4444, 0x1455, 0x3344, 0x1987)) return 0; + if (!CheckOne7D(ContextID, lut, 0x0000, 0x0012, 0x0013, 0x0014, 0x2333, 0x4455, 0x9988)) return 0; + if (!CheckOne7D(ContextID, lut, 0x3141, 0x1415, 0x1592, 0x9261, 0x4567, 0x5566, 0xfe56)) return 0; + if (!CheckOne7D(ContextID, lut, 0xFF00, 0xFF01, 0xFF12, 0xFF13, 0xF344, 0x6677, 0xbabe)) return 0; - cmsPipelineFree(DbgThread(), lut); + cmsPipelineFree(ContextID, lut); return 1; } static -cmsInt32Number Check8DinterpGranular(void) +cmsInt32Number Check8DinterpGranular(cmsContext ContextID) { cmsPipeline* lut; cmsStage* mpe; cmsUInt32Number Dimensions[] = { 4, 3, 3, 2, 2, 2, 2, 2 }; - lut = cmsPipelineAlloc(DbgThread(), 8, 3); - mpe = cmsStageAllocCLut16bitGranular(DbgThread(), Dimensions, 8, 3, NULL); - cmsStageSampleCLut16bit(DbgThread(), mpe, Sampler8D, NULL, 0); - cmsPipelineInsertStage(DbgThread(), lut, cmsAT_BEGIN, mpe); + lut = cmsPipelineAlloc(ContextID, 8, 3); + mpe = cmsStageAllocCLut16bitGranular(ContextID, Dimensions, 8, 3, NULL); + cmsStageSampleCLut16bit(ContextID, mpe, Sampler8D, NULL, 0); + cmsPipelineInsertStage(ContextID, lut, cmsAT_BEGIN, mpe); // Check accuracy - if (!CheckOne8D(lut, 0, 0, 0, 0, 0, 0, 0, 0)) return 0; - if (!CheckOne8D(lut, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff)) return 0; + if (!CheckOne8D(ContextID, lut, 0, 0, 0, 0, 0, 0, 0, 0)) return 0; + if (!CheckOne8D(ContextID, lut, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff)) return 0; - if (!CheckOne8D(lut, 0x8080, 0x8080, 0x8080, 0x8080, 0x1234, 0x1122, 0x0056, 0x0011)) return 0; - if (!CheckOne8D(lut, 0x0000, 0xFE00, 0x80FF, 0x8888, 0x8078, 0x2233, 0x0088, 0x2020)) return 0; - if (!CheckOne8D(lut, 0x1111, 0x2222, 0x3333, 0x4444, 0x1455, 0x3344, 0x1987, 0x4532)) return 0; - if (!CheckOne8D(lut, 0x0000, 0x0012, 0x0013, 0x0014, 0x2333, 0x4455, 0x9988, 0x1200)) return 0; - if (!CheckOne8D(lut, 0x3141, 0x1415, 0x1592, 0x9261, 0x4567, 0x5566, 0xfe56, 0x6666)) return 0; - if (!CheckOne8D(lut, 0xFF00, 0xFF01, 0xFF12, 0xFF13, 0xF344, 0x6677, 0xbabe, 0xface)) return 0; + if (!CheckOne8D(ContextID, lut, 0x8080, 0x8080, 0x8080, 0x8080, 0x1234, 0x1122, 0x0056, 0x0011)) return 0; + if (!CheckOne8D(ContextID, lut, 0x0000, 0xFE00, 0x80FF, 0x8888, 0x8078, 0x2233, 0x0088, 0x2020)) return 0; + if (!CheckOne8D(ContextID, lut, 0x1111, 0x2222, 0x3333, 0x4444, 0x1455, 0x3344, 0x1987, 0x4532)) return 0; + if (!CheckOne8D(ContextID, lut, 0x0000, 0x0012, 0x0013, 0x0014, 0x2333, 0x4455, 0x9988, 0x1200)) return 0; + if (!CheckOne8D(ContextID, lut, 0x3141, 0x1415, 0x1592, 0x9261, 0x4567, 0x5566, 0xfe56, 0x6666)) return 0; + if (!CheckOne8D(ContextID, lut, 0xFF00, 0xFF01, 0xFF12, 0xFF13, 0xF344, 0x6677, 0xbabe, 0xface)) return 0; - cmsPipelineFree(DbgThread(), lut); + cmsPipelineFree(ContextID, lut); return 1; } @@ -2206,7 +2199,7 @@ cmsInt32Number Check8DinterpGranular(void) // Lab to LCh and back should be performed at 1E-12 accuracy at least static -cmsInt32Number CheckLab2LCh(void) +cmsInt32Number CheckLab2LCh(cmsContext ContextID) { cmsInt32Number l, a, b; cmsFloat64Number dist, Max = 0; @@ -2223,10 +2216,10 @@ cmsInt32Number CheckLab2LCh(void) Lab.a = a; Lab.b = b; - cmsLab2LCh(DbgThread(), &LCh, &Lab); - cmsLCh2Lab(DbgThread(), &Lab2, &LCh); + cmsLab2LCh(ContextID, &LCh, &Lab); + cmsLCh2Lab(ContextID, &Lab2, &LCh); - dist = cmsDeltaE(DbgThread(), &Lab, &Lab2); + dist = cmsDeltaE(ContextID, &Lab, &Lab2); if (dist > Max) Max = dist; } } @@ -2237,7 +2230,7 @@ cmsInt32Number CheckLab2LCh(void) // Lab to LCh and back should be performed at 1E-12 accuracy at least static -cmsInt32Number CheckLab2XYZ(void) +cmsInt32Number CheckLab2XYZ(cmsContext ContextID) { cmsInt32Number l, a, b; cmsFloat64Number dist, Max = 0; @@ -2254,10 +2247,10 @@ cmsInt32Number CheckLab2XYZ(void) Lab.a = a; Lab.b = b; - cmsLab2XYZ(DbgThread(), NULL, &XYZ, &Lab); - cmsXYZ2Lab(DbgThread(), NULL, &Lab2, &XYZ); + cmsLab2XYZ(ContextID, NULL, &XYZ, &Lab); + cmsXYZ2Lab(ContextID, NULL, &Lab2, &XYZ); - dist = cmsDeltaE(DbgThread(), &Lab, &Lab2); + dist = cmsDeltaE(ContextID, &Lab, &Lab2); if (dist > Max) Max = dist; } @@ -2269,7 +2262,7 @@ cmsInt32Number CheckLab2XYZ(void) // Lab to xyY and back should be performed at 1E-12 accuracy at least static -cmsInt32Number CheckLab2xyY(void) +cmsInt32Number CheckLab2xyY(cmsContext ContextID) { cmsInt32Number l, a, b; cmsFloat64Number dist, Max = 0; @@ -2287,12 +2280,12 @@ cmsInt32Number CheckLab2xyY(void) Lab.a = a; Lab.b = b; - cmsLab2XYZ(DbgThread(), NULL, &XYZ, &Lab); - cmsXYZ2xyY(DbgThread(), &xyY, &XYZ); - cmsxyY2XYZ(DbgThread(), &XYZ, &xyY); - cmsXYZ2Lab(DbgThread(), NULL, &Lab2, &XYZ); + cmsLab2XYZ(ContextID, NULL, &XYZ, &Lab); + cmsXYZ2xyY(ContextID, &xyY, &XYZ); + cmsxyY2XYZ(ContextID, &XYZ, &xyY); + cmsXYZ2Lab(ContextID, NULL, &Lab2, &XYZ); - dist = cmsDeltaE(DbgThread(), &Lab, &Lab2); + dist = cmsDeltaE(ContextID, &Lab, &Lab2); if (dist > Max) Max = dist; } @@ -2304,7 +2297,7 @@ cmsInt32Number CheckLab2xyY(void) static -cmsInt32Number CheckLabV2encoding(void) +cmsInt32Number CheckLabV2encoding(cmsContext ContextID) { cmsInt32Number n2, i, j; cmsUInt16Number Inw[3], aw[3]; @@ -2316,8 +2309,8 @@ cmsInt32Number CheckLabV2encoding(void) Inw[0] = Inw[1] = Inw[2] = (cmsUInt16Number) j; - cmsLabEncoded2FloatV2(DbgThread(), &Lab, Inw); - cmsFloat2LabEncodedV2(DbgThread(), aw, &Lab); + cmsLabEncoded2FloatV2(ContextID, &Lab, Inw); + cmsFloat2LabEncodedV2(ContextID, aw, &Lab); for (i=0; i < 3; i++) { @@ -2332,7 +2325,7 @@ cmsInt32Number CheckLabV2encoding(void) } static -cmsInt32Number CheckLabV4encoding(void) +cmsInt32Number CheckLabV4encoding(cmsContext ContextID) { cmsInt32Number n2, i, j; cmsUInt16Number Inw[3], aw[3]; @@ -2344,8 +2337,8 @@ cmsInt32Number CheckLabV4encoding(void) Inw[0] = Inw[1] = Inw[2] = (cmsUInt16Number) j; - cmsLabEncoded2Float(DbgThread(), &Lab, Inw); - cmsFloat2LabEncoded(DbgThread(), aw, &Lab); + cmsLabEncoded2Float(ContextID, &Lab, Inw); + cmsFloat2LabEncoded(ContextID, aw, &Lab); for (i=0; i < 3; i++) { @@ -2363,7 +2356,7 @@ cmsInt32Number CheckLabV4encoding(void) // BlackBody ----------------------------------------------------------------------------------------------------- static -cmsInt32Number CheckTemp2CHRM(void) +cmsInt32Number CheckTemp2CHRM(cmsContext ContextID) { cmsInt32Number j; cmsFloat64Number d, v, Max = 0; @@ -2371,8 +2364,8 @@ cmsInt32Number CheckTemp2CHRM(void) for (j=4000; j < 25000; j++) { - cmsWhitePointFromTemp(DbgThread(), &White, j); - if (!cmsTempFromWhitePoint(DbgThread(), &v, &White)) return 0; + cmsWhitePointFromTemp(ContextID, &White, j); + if (!cmsTempFromWhitePoint(ContextID, &v, &White)) return 0; d = fabs(v - j); if (d > Max) Max = d; @@ -2387,9 +2380,9 @@ cmsInt32Number CheckTemp2CHRM(void) // Tone curves ----------------------------------------------------------------------------------------------------- static -cmsInt32Number CheckGammaEstimation(cmsToneCurve* c, cmsFloat64Number g) +cmsInt32Number CheckGammaEstimation(cmsContext ContextID, cmsToneCurve* c, cmsFloat64Number g) { - cmsFloat64Number est = cmsEstimateGamma(DbgThread(), c, 0.001); + cmsFloat64Number est = cmsEstimateGamma(ContextID, c, 0.001); SubTest("Gamma estimation"); if (fabs(est - g) > 0.001) return 0; @@ -2397,59 +2390,59 @@ cmsInt32Number CheckGammaEstimation(cmsToneCurve* c, cmsFloat64Number g) } static -cmsInt32Number CheckGammaCreation16(void) +cmsInt32Number CheckGammaCreation16(cmsContext ContextID) { - cmsToneCurve* LinGamma = cmsBuildGamma(DbgThread(), 1.0); + cmsToneCurve* LinGamma = cmsBuildGamma(ContextID, 1.0); cmsInt32Number i; cmsUInt16Number in, out; for (i=0; i < 0xffff; i++) { in = (cmsUInt16Number) i; - out = cmsEvalToneCurve16(DbgThread(), LinGamma, in); + out = cmsEvalToneCurve16(ContextID, LinGamma, in); if (in != out) { Fail("(lin gamma): Must be %x, But is %x : ", in, out); - cmsFreeToneCurve(DbgThread(), LinGamma); + cmsFreeToneCurve(ContextID, LinGamma); return 0; } } - if (!CheckGammaEstimation(LinGamma, 1.0)) return 0; + if (!CheckGammaEstimation(ContextID, LinGamma, 1.0)) return 0; - cmsFreeToneCurve(DbgThread(), LinGamma); + cmsFreeToneCurve(ContextID, LinGamma); return 1; } static -cmsInt32Number CheckGammaCreationFlt(void) +cmsInt32Number CheckGammaCreationFlt(cmsContext ContextID) { - cmsToneCurve* LinGamma = cmsBuildGamma(DbgThread(), 1.0); + cmsToneCurve* LinGamma = cmsBuildGamma(ContextID, 1.0); cmsInt32Number i; cmsFloat32Number in, out; for (i=0; i < 0xffff; i++) { in = (cmsFloat32Number) (i / 65535.0); - out = cmsEvalToneCurveFloat(DbgThread(), LinGamma, in); + out = cmsEvalToneCurveFloat(ContextID, LinGamma, in); if (fabs(in - out) > (1/65535.0)) { Fail("(lin gamma): Must be %f, But is %f : ", in, out); - cmsFreeToneCurve(DbgThread(), LinGamma); + cmsFreeToneCurve(ContextID, LinGamma); return 0; } } - if (!CheckGammaEstimation(LinGamma, 1.0)) return 0; - cmsFreeToneCurve(DbgThread(), LinGamma); + if (!CheckGammaEstimation(ContextID, LinGamma, 1.0)) return 0; + cmsFreeToneCurve(ContextID, LinGamma); return 1; } // Curve curves using a single power function // Error is given in 0..ffff counts static -cmsInt32Number CheckGammaFloat(cmsFloat64Number g) +cmsInt32Number CheckGammaFloat(cmsContext ContextID, cmsFloat64Number g) { - cmsToneCurve* Curve = cmsBuildGamma(DbgThread(), g); + cmsToneCurve* Curve = cmsBuildGamma(ContextID, g); cmsInt32Number i; cmsFloat32Number in, out; cmsFloat64Number val, Err; @@ -2458,7 +2451,7 @@ cmsInt32Number CheckGammaFloat(cmsFloat64Number g) for (i=0; i < 0xffff; i++) { in = (cmsFloat32Number) (i / 65535.0); - out = cmsEvalToneCurveFloat(DbgThread(), Curve, in); + out = cmsEvalToneCurveFloat(ContextID, Curve, in); val = pow((cmsFloat64Number) in, g); Err = fabs( val - out); @@ -2467,31 +2460,31 @@ cmsInt32Number CheckGammaFloat(cmsFloat64Number g) if (MaxErr > 0) printf("|Err|<%lf ", MaxErr * 65535.0); - if (!CheckGammaEstimation(Curve, g)) return 0; + if (!CheckGammaEstimation(ContextID, Curve, g)) return 0; - cmsFreeToneCurve(DbgThread(), Curve); + cmsFreeToneCurve(ContextID, Curve); return 1; } -static cmsInt32Number CheckGamma18(void) +static cmsInt32Number CheckGamma18(cmsContext ContextID) { - return CheckGammaFloat(1.8); + return CheckGammaFloat(ContextID, 1.8); } -static cmsInt32Number CheckGamma22(void) +static cmsInt32Number CheckGamma22(cmsContext ContextID) { - return CheckGammaFloat(2.2); + return CheckGammaFloat(ContextID, 2.2); } -static cmsInt32Number CheckGamma30(void) +static cmsInt32Number CheckGamma30(cmsContext ContextID) { - return CheckGammaFloat(3.0); + return CheckGammaFloat(ContextID, 3.0); } // Check table-based gamma functions static -cmsInt32Number CheckGammaFloatTable(cmsFloat64Number g) +cmsInt32Number CheckGammaFloatTable(cmsContext ContextID, cmsFloat64Number g) { cmsFloat32Number Values[1025]; cmsToneCurve* Curve; @@ -2505,13 +2498,13 @@ cmsInt32Number CheckGammaFloatTable(cmsFloat64Number g) Values[i] = powf(in, (float) g); } - Curve = cmsBuildTabulatedToneCurveFloat(DbgThread(), 1025, Values); + Curve = cmsBuildTabulatedToneCurveFloat(ContextID, 1025, Values); MaxErr = 0.0; for (i=0; i <= 0xffff; i++) { in = (cmsFloat32Number) (i / 65535.0); - out = cmsEvalToneCurveFloat(DbgThread(), Curve, in); + out = cmsEvalToneCurveFloat(ContextID, Curve, in); val = pow(in, g); Err = fabs(val - out); @@ -2520,31 +2513,31 @@ cmsInt32Number CheckGammaFloatTable(cmsFloat64Number g) if (MaxErr > 0) printf("|Err|<%lf ", MaxErr * 65535.0); - if (!CheckGammaEstimation(Curve, g)) return 0; + if (!CheckGammaEstimation(ContextID, Curve, g)) return 0; - cmsFreeToneCurve(DbgThread(), Curve); + cmsFreeToneCurve(ContextID, Curve); return 1; } -static cmsInt32Number CheckGamma18Table(void) +static cmsInt32Number CheckGamma18Table(cmsContext ContextID) { - return CheckGammaFloatTable(1.8); + return CheckGammaFloatTable(ContextID, 1.8); } -static cmsInt32Number CheckGamma22Table(void) +static cmsInt32Number CheckGamma22Table(cmsContext ContextID) { - return CheckGammaFloatTable(2.2); + return CheckGammaFloatTable(ContextID, 2.2); } -static cmsInt32Number CheckGamma30Table(void) +static cmsInt32Number CheckGamma30Table(cmsContext ContextID) { - return CheckGammaFloatTable(3.0); + return CheckGammaFloatTable(ContextID, 3.0); } // Create a curve from a table (which is a pure gamma function) and check it against the pow function. static -cmsInt32Number CheckGammaWordTable(cmsFloat64Number g) +cmsInt32Number CheckGammaWordTable(cmsContext ContextID, cmsFloat64Number g) { cmsUInt16Number Values[1025]; cmsToneCurve* Curve; @@ -2558,13 +2551,13 @@ cmsInt32Number CheckGammaWordTable(cmsFloat64Number g) Values[i] = (cmsUInt16Number) floor(pow(in, g) * 65535.0 + 0.5); } - Curve = cmsBuildTabulatedToneCurve16(DbgThread(), 1025, Values); + Curve = cmsBuildTabulatedToneCurve16(ContextID, 1025, Values); MaxErr = 0.0; for (i=0; i <= 0xffff; i++) { in = (cmsFloat32Number) (i / 65535.0); - out = cmsEvalToneCurveFloat(DbgThread(), Curve, in); + out = cmsEvalToneCurveFloat(ContextID, Curve, in); val = pow(in, g); Err = fabs(val - out); @@ -2573,45 +2566,45 @@ cmsInt32Number CheckGammaWordTable(cmsFloat64Number g) if (MaxErr > 0) printf("|Err|<%lf ", MaxErr * 65535.0); - if (!CheckGammaEstimation(Curve, g)) return 0; + if (!CheckGammaEstimation(ContextID, Curve, g)) return 0; - cmsFreeToneCurve(DbgThread(), Curve); + cmsFreeToneCurve(ContextID, Curve); return 1; } -static cmsInt32Number CheckGamma18TableWord(void) +static cmsInt32Number CheckGamma18TableWord(cmsContext ContextID) { - return CheckGammaWordTable(1.8); + return CheckGammaWordTable(ContextID, 1.8); } -static cmsInt32Number CheckGamma22TableWord(void) +static cmsInt32Number CheckGamma22TableWord(cmsContext ContextID) { - return CheckGammaWordTable(2.2); + return CheckGammaWordTable(ContextID, 2.2); } -static cmsInt32Number CheckGamma30TableWord(void) +static cmsInt32Number CheckGamma30TableWord(cmsContext ContextID) { - return CheckGammaWordTable(3.0); + return CheckGammaWordTable(ContextID, 3.0); } // Curve joining test. Joining two high-gamma of 3.0 curves should // give something like linear static -cmsInt32Number CheckJointCurves(void) +cmsInt32Number CheckJointCurves(cmsContext ContextID) { cmsToneCurve *Forward, *Reverse, *Result; cmsBool rc; - Forward = cmsBuildGamma(DbgThread(), 3.0); - Reverse = cmsBuildGamma(DbgThread(), 3.0); + Forward = cmsBuildGamma(ContextID, 3.0); + Reverse = cmsBuildGamma(ContextID, 3.0); - Result = cmsJoinToneCurve(DbgThread(), Forward, Reverse, 256); + Result = cmsJoinToneCurve(ContextID, Forward, Reverse, 256); - cmsFreeToneCurve(DbgThread(), Forward); cmsFreeToneCurve(DbgThread(), Reverse); + cmsFreeToneCurve(ContextID, Forward); cmsFreeToneCurve(ContextID, Reverse); - rc = cmsIsToneCurveLinear(DbgThread(), Result); - cmsFreeToneCurve(DbgThread(), Result); + rc = cmsIsToneCurveLinear(ContextID, Result); + cmsFreeToneCurve(ContextID, Result); if (!rc) Fail("Joining same curve twice does not result in a linear ramp"); @@ -2622,10 +2615,10 @@ cmsInt32Number CheckJointCurves(void) // Create a gamma curve by cheating the table static -cmsToneCurve* GammaTableLinear(cmsInt32Number nEntries, cmsBool Dir) +cmsToneCurve* GammaTableLinear(cmsContext ContextID, cmsInt32Number nEntries, cmsBool Dir) { cmsInt32Number i; - cmsToneCurve* g = cmsBuildTabulatedToneCurve16(DbgThread(), nEntries, NULL); + cmsToneCurve* g = cmsBuildTabulatedToneCurve16(ContextID, nEntries, NULL); for (i=0; i < nEntries; i++) { @@ -2642,12 +2635,12 @@ cmsToneCurve* GammaTableLinear(cmsInt32Number nEntries, cmsBool Dir) static -cmsInt32Number CheckJointCurvesDescending(void) +cmsInt32Number CheckJointCurvesDescending(cmsContext ContextID) { cmsToneCurve *Forward, *Reverse, *Result; cmsInt32Number i, rc; - Forward = cmsBuildGamma(DbgThread(), 2.2); + Forward = cmsBuildGamma(ContextID, 2.2); // Fake the curve to be table-based @@ -2655,32 +2648,32 @@ cmsInt32Number CheckJointCurvesDescending(void) Forward ->Table16[i] = 0xffff - Forward->Table16[i]; Forward ->Segments[0].Type = 0; - Reverse = cmsReverseToneCurve(DbgThread(), Forward); + Reverse = cmsReverseToneCurve(ContextID, Forward); - Result = cmsJoinToneCurve(DbgThread(), Reverse, Reverse, 256); + Result = cmsJoinToneCurve(ContextID, Reverse, Reverse, 256); - cmsFreeToneCurve(DbgThread(), Forward); - cmsFreeToneCurve(DbgThread(), Reverse); + cmsFreeToneCurve(ContextID, Forward); + cmsFreeToneCurve(ContextID, Reverse); - rc = cmsIsToneCurveLinear(DbgThread(), Result); - cmsFreeToneCurve(DbgThread(), Result); + rc = cmsIsToneCurveLinear(ContextID, Result); + cmsFreeToneCurve(ContextID, Result); return rc; } static -cmsInt32Number CheckFToneCurvePoint(cmsToneCurve* c, cmsUInt16Number Point, cmsInt32Number Value) +cmsInt32Number CheckFToneCurvePoint(cmsContext ContextID, cmsToneCurve* c, cmsUInt16Number Point, cmsInt32Number Value) { cmsInt32Number Result; - Result = cmsEvalToneCurve16(DbgThread(), c, Point); + Result = cmsEvalToneCurve16(ContextID, c, Point); return (abs(Value - Result) < 2); } static -cmsInt32Number CheckReverseDegenerated(void) +cmsInt32Number CheckReverseDegenerated(cmsContext ContextID) { cmsToneCurve* p, *g; cmsUInt16Number Tab[16]; @@ -2702,21 +2695,21 @@ cmsInt32Number CheckReverseDegenerated(void) Tab[14]= 0xffff; Tab[15]= 0xffff; - p = cmsBuildTabulatedToneCurve16(DbgThread(), 16, Tab); - g = cmsReverseToneCurve(DbgThread(), p); + p = cmsBuildTabulatedToneCurve16(ContextID, 16, Tab); + g = cmsReverseToneCurve(ContextID, p); // Now let's check some points - if (!CheckFToneCurvePoint(g, 0x5555, 0x5555)) return 0; - if (!CheckFToneCurvePoint(g, 0x7777, 0x7777)) return 0; + if (!CheckFToneCurvePoint(ContextID, g, 0x5555, 0x5555)) return 0; + if (!CheckFToneCurvePoint(ContextID, g, 0x7777, 0x7777)) return 0; // First point for zero - if (!CheckFToneCurvePoint(g, 0x0000, 0x4444)) return 0; + if (!CheckFToneCurvePoint(ContextID, g, 0x0000, 0x4444)) return 0; // Last point - if (!CheckFToneCurvePoint(g, 0xFFFF, 0xFFFF)) return 0; + if (!CheckFToneCurvePoint(ContextID, g, 0xFFFF, 0xFFFF)) return 0; - cmsFreeToneCurve(DbgThread(), p); - cmsFreeToneCurve(DbgThread(), g); + cmsFreeToneCurve(ContextID, p); + cmsFreeToneCurve(ContextID, g); return 1; } @@ -2724,7 +2717,7 @@ cmsInt32Number CheckReverseDegenerated(void) // Build a parametric sRGB-like curve static -cmsToneCurve* Build_sRGBGamma(void) +cmsToneCurve* Build_sRGBGamma(cmsContext ContextID) { cmsFloat64Number Parameters[5]; @@ -2734,14 +2727,14 @@ cmsToneCurve* Build_sRGBGamma(void) Parameters[3] = 1. / 12.92; Parameters[4] = 0.04045; // d - return cmsBuildParametricToneCurve(DbgThread(), 4, Parameters); + return cmsBuildParametricToneCurve(ContextID, 4, Parameters); } // Join two gamma tables in floating point format. Result should be a straight line static -cmsToneCurve* CombineGammaFloat(cmsToneCurve* g1, cmsToneCurve* g2) +cmsToneCurve* CombineGammaFloat(cmsContext ContextID, cmsToneCurve* g1, cmsToneCurve* g2) { cmsUInt16Number Tab[256]; cmsFloat32Number f; @@ -2750,17 +2743,17 @@ cmsToneCurve* CombineGammaFloat(cmsToneCurve* g1, cmsToneCurve* g2) for (i=0; i < 256; i++) { f = (cmsFloat32Number) i / 255.0F; - f = cmsEvalToneCurveFloat(DbgThread(), g2, cmsEvalToneCurveFloat(DbgThread(), g1, f)); + f = cmsEvalToneCurveFloat(ContextID, g2, cmsEvalToneCurveFloat(ContextID, g1, f)); Tab[i] = (cmsUInt16Number) floor(f * 65535.0 + 0.5); } - return cmsBuildTabulatedToneCurve16(DbgThread(), 256, Tab); + return cmsBuildTabulatedToneCurve16(ContextID, 256, Tab); } // Same of anterior, but using quantized tables static -cmsToneCurve* CombineGamma16(cmsToneCurve* g1, cmsToneCurve* g2) +cmsToneCurve* CombineGamma16(cmsContext ContextID, cmsToneCurve* g1, cmsToneCurve* g2) { cmsUInt16Number Tab[256]; @@ -2771,42 +2764,42 @@ cmsToneCurve* CombineGamma16(cmsToneCurve* g1, cmsToneCurve* g2) cmsUInt16Number wValIn; wValIn = _cmsQuantizeVal(i, 256); - Tab[i] = cmsEvalToneCurve16(DbgThread(), g2, cmsEvalToneCurve16(DbgThread(), g1, wValIn)); + Tab[i] = cmsEvalToneCurve16(ContextID, g2, cmsEvalToneCurve16(ContextID, g1, wValIn)); } - return cmsBuildTabulatedToneCurve16(DbgThread(), 256, Tab); + return cmsBuildTabulatedToneCurve16(ContextID, 256, Tab); } static -cmsInt32Number CheckJointFloatCurves_sRGB(void) +cmsInt32Number CheckJointFloatCurves_sRGB(cmsContext ContextID) { cmsToneCurve *Forward, *Reverse, *Result; cmsBool rc; - Forward = Build_sRGBGamma(); - Reverse = cmsReverseToneCurve(DbgThread(), Forward); - Result = CombineGammaFloat(Forward, Reverse); - cmsFreeToneCurve(DbgThread(), Forward); cmsFreeToneCurve(DbgThread(), Reverse); + Forward = Build_sRGBGamma(ContextID); + Reverse = cmsReverseToneCurve(ContextID, Forward); + Result = CombineGammaFloat(ContextID, Forward, Reverse); + cmsFreeToneCurve(ContextID, Forward); cmsFreeToneCurve(ContextID, Reverse); - rc = cmsIsToneCurveLinear(DbgThread(), Result); - cmsFreeToneCurve(DbgThread(), Result); + rc = cmsIsToneCurveLinear(ContextID, Result); + cmsFreeToneCurve(ContextID, Result); return rc; } static -cmsInt32Number CheckJoint16Curves_sRGB(void) +cmsInt32Number CheckJoint16Curves_sRGB(cmsContext ContextID) { cmsToneCurve *Forward, *Reverse, *Result; cmsBool rc; - Forward = Build_sRGBGamma(); - Reverse = cmsReverseToneCurve(DbgThread(), Forward); - Result = CombineGamma16(Forward, Reverse); - cmsFreeToneCurve(DbgThread(), Forward); cmsFreeToneCurve(DbgThread(), Reverse); + Forward = Build_sRGBGamma(ContextID); + Reverse = cmsReverseToneCurve(ContextID, Forward); + Result = CombineGamma16(ContextID, Forward, Reverse); + cmsFreeToneCurve(ContextID, Forward); cmsFreeToneCurve(ContextID, Reverse); - rc = cmsIsToneCurveLinear(DbgThread(), Result); - cmsFreeToneCurve(DbgThread(), Result); + rc = cmsIsToneCurveLinear(ContextID, Result); + cmsFreeToneCurve(ContextID, Result); return rc; } @@ -2814,21 +2807,21 @@ cmsInt32Number CheckJoint16Curves_sRGB(void) // sigmoidal curve f(x) = (1-x^g) ^(1/g) static -cmsInt32Number CheckJointCurvesSShaped(void) +cmsInt32Number CheckJointCurvesSShaped(cmsContext ContextID) { cmsFloat64Number p = 3.2; cmsToneCurve *Forward, *Reverse, *Result; cmsInt32Number rc; - Forward = cmsBuildParametricToneCurve(DbgThread(), 108, &p); - Reverse = cmsReverseToneCurve(DbgThread(), Forward); - Result = cmsJoinToneCurve(DbgThread(), Forward, Forward, 4096); + Forward = cmsBuildParametricToneCurve(ContextID, 108, &p); + Reverse = cmsReverseToneCurve(ContextID, Forward); + Result = cmsJoinToneCurve(ContextID, Forward, Forward, 4096); - cmsFreeToneCurve(DbgThread(), Forward); - cmsFreeToneCurve(DbgThread(), Reverse); + cmsFreeToneCurve(ContextID, Forward); + cmsFreeToneCurve(ContextID, Reverse); - rc = cmsIsToneCurveLinear(DbgThread(), Result); - cmsFreeToneCurve(DbgThread(), Result); + rc = cmsIsToneCurveLinear(ContextID, Result); + cmsFreeToneCurve(ContextID, Result); return rc; } @@ -2972,15 +2965,15 @@ cmsFloat32Number sigmoidal(cmsFloat32Number x, const cmsFloat64Number Params[]) static -cmsBool CheckSingleParametric(const char* Name, dblfnptr fn, cmsInt32Number Type, const cmsFloat64Number Params[]) +cmsBool CheckSingleParametric(cmsContext ContextID, const char* Name, dblfnptr fn, cmsInt32Number Type, const cmsFloat64Number Params[]) { cmsInt32Number i; cmsToneCurve* tc; cmsToneCurve* tc_1; char InverseText[256]; - tc = cmsBuildParametricToneCurve(DbgThread(), Type, Params); - tc_1 = cmsBuildParametricToneCurve(DbgThread(), -Type, Params); + tc = cmsBuildParametricToneCurve(ContextID, Type, Params); + tc_1 = cmsBuildParametricToneCurve(ContextID, -Type, Params); for (i=0; i <= 1000; i++) { @@ -2988,8 +2981,8 @@ cmsBool CheckSingleParametric(const char* Name, dblfnptr fn, cmsInt32Number Type cmsFloat32Number y_fn, y_param, x_param, y_param2; y_fn = fn(x, Params); - y_param = cmsEvalToneCurveFloat(DbgThread(), tc, x); - x_param = cmsEvalToneCurveFloat(DbgThread(), tc_1, y_param); + y_param = cmsEvalToneCurveFloat(ContextID, tc, x); + x_param = cmsEvalToneCurveFloat(ContextID, tc_1, y_param); y_param2 = fn(x_param, Params); @@ -3001,19 +2994,19 @@ cmsBool CheckSingleParametric(const char* Name, dblfnptr fn, cmsInt32Number Type goto Error; } - cmsFreeToneCurve(DbgThread(), tc); - cmsFreeToneCurve(DbgThread(), tc_1); + cmsFreeToneCurve(ContextID, tc); + cmsFreeToneCurve(ContextID, tc_1); return TRUE; Error: - cmsFreeToneCurve(DbgThread(), tc); - cmsFreeToneCurve(DbgThread(), tc_1); + cmsFreeToneCurve(ContextID, tc); + cmsFreeToneCurve(ContextID, tc_1); return FALSE; } // Check against some known values static -cmsInt32Number CheckParametricToneCurves(void) +cmsInt32Number CheckParametricToneCurves(cmsContext ContextID) { cmsFloat64Number Params[10]; @@ -3021,7 +3014,7 @@ cmsInt32Number CheckParametricToneCurves(void) Params[0] = 2.2; - if (!CheckSingleParametric("Gamma", Gamma, 1, Params)) return 0; + if (!CheckSingleParametric(ContextID, "Gamma", Gamma, 1, Params)) return 0; // 2) CIE 122-1966 // Y = (aX + b)^Gamma | X >= -b/a @@ -3031,7 +3024,7 @@ cmsInt32Number CheckParametricToneCurves(void) Params[1] = 1.5; Params[2] = -0.5; - if (!CheckSingleParametric("CIE122-1966", CIE122, 2, Params)) return 0; + if (!CheckSingleParametric(ContextID, "CIE122-1966", CIE122, 2, Params)) return 0; // 3) IEC 61966-3 // Y = (aX + b)^Gamma | X <= -b/a @@ -3043,7 +3036,7 @@ cmsInt32Number CheckParametricToneCurves(void) Params[3] = 0.3; - if (!CheckSingleParametric("IEC 61966-3", IEC61966_3, 3, Params)) return 0; + if (!CheckSingleParametric(ContextID, "IEC 61966-3", IEC61966_3, 3, Params)) return 0; // 4) IEC 61966-2.1 (sRGB) // Y = (aX + b)^Gamma | X >= d @@ -3055,7 +3048,7 @@ cmsInt32Number CheckParametricToneCurves(void) Params[3] = 1. / 12.92; Params[4] = 0.04045; - if (!CheckSingleParametric("IEC 61966-2.1", IEC61966_21, 4, Params)) return 0; + if (!CheckSingleParametric(ContextID, "IEC 61966-2.1", IEC61966_21, 4, Params)) return 0; // 5) Y = (aX + b)^Gamma + e | X >= d @@ -3069,7 +3062,7 @@ cmsInt32Number CheckParametricToneCurves(void) Params[5] = 0.5; Params[6] = 0.2; - if (!CheckSingleParametric("param_5", param_5, 5, Params)) return 0; + if (!CheckSingleParametric(ContextID, "param_5", param_5, 5, Params)) return 0; // 6) Y = (aX + b) ^ Gamma + c @@ -3078,7 +3071,7 @@ cmsInt32Number CheckParametricToneCurves(void) Params[2] = 0.2; Params[3] = 0.3; - if (!CheckSingleParametric("param_6", param_6, 6, Params)) return 0; + if (!CheckSingleParametric(ContextID, "param_6", param_6, 6, Params)) return 0; // 7) Y = a * log (b * X^Gamma + c) + d @@ -3088,7 +3081,7 @@ cmsInt32Number CheckParametricToneCurves(void) Params[3] = 0.02; Params[4] = 0.1; - if (!CheckSingleParametric("param_7", param_7, 7, Params)) return 0; + if (!CheckSingleParametric(ContextID, "param_7", param_7, 7, Params)) return 0; // 8) Y = a * b ^ (c*X+d) + e @@ -3098,12 +3091,12 @@ cmsInt32Number CheckParametricToneCurves(void) Params[3] = 0.1; Params[4] = 0.2; - if (!CheckSingleParametric("param_8", param_8, 8, Params)) return 0; + if (!CheckSingleParametric(ContextID, "param_8", param_8, 8, Params)) return 0; // 108: S-Shaped: (1 - (1-x)^1/g)^1/g Params[0] = 1.9; - if (!CheckSingleParametric("sigmoidal", sigmoidal, 108, Params)) return 0; + if (!CheckSingleParametric(ContextID, "sigmoidal", sigmoidal, 108, Params)) return 0; // All OK @@ -3113,38 +3106,38 @@ cmsInt32Number CheckParametricToneCurves(void) // LUT checks ------------------------------------------------------------------------------ static -cmsInt32Number CheckLUTcreation(void) +cmsInt32Number CheckLUTcreation(cmsContext ContextID) { cmsPipeline* lut; cmsPipeline* lut2; cmsInt32Number n1, n2; - lut = cmsPipelineAlloc(DbgThread(), 1, 1); - n1 = cmsPipelineStageCount(DbgThread(), lut); - lut2 = cmsPipelineDup(DbgThread(), lut); - n2 = cmsPipelineStageCount(DbgThread(), lut2); + lut = cmsPipelineAlloc(ContextID, 1, 1); + n1 = cmsPipelineStageCount(ContextID, lut); + lut2 = cmsPipelineDup(ContextID, lut); + n2 = cmsPipelineStageCount(ContextID, lut2); - cmsPipelineFree(DbgThread(), lut); - cmsPipelineFree(DbgThread(), lut2); + cmsPipelineFree(ContextID, lut); + cmsPipelineFree(ContextID, lut2); return (n1 == 0) && (n2 == 0); } // Create a MPE for a identity matrix static -void AddIdentityMatrix(cmsPipeline* lut) +void AddIdentityMatrix(cmsContext ContextID, cmsPipeline* lut) { const cmsFloat64Number Identity[] = { 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 }; - cmsPipelineInsertStage(DbgThread(), lut, cmsAT_END, cmsStageAllocMatrix(DbgThread(), 3, 3, Identity, NULL)); + cmsPipelineInsertStage(ContextID, lut, cmsAT_END, cmsStageAllocMatrix(ContextID, 3, 3, Identity, NULL)); } // Create a MPE for identity cmsFloat32Number CLUT static -void AddIdentityCLUTfloat(cmsPipeline* lut) +void AddIdentityCLUTfloat(cmsContext ContextID, cmsPipeline* lut) { const cmsFloat32Number Table[] = { @@ -3161,12 +3154,12 @@ void AddIdentityCLUTfloat(cmsPipeline* lut) 1.0, 1.0, 1.0 }; - cmsPipelineInsertStage(DbgThread(), lut, cmsAT_END, cmsStageAllocCLutFloat(DbgThread(), 2, 3, 3, Table)); + cmsPipelineInsertStage(ContextID, lut, cmsAT_END, cmsStageAllocCLutFloat(ContextID, 2, 3, 3, Table)); } // Create a MPE for identity cmsFloat32Number CLUT static -void AddIdentityCLUT16(cmsPipeline* lut) +void AddIdentityCLUT16(cmsContext ContextID, cmsPipeline* lut) { const cmsUInt16Number Table[] = { @@ -3184,30 +3177,30 @@ void AddIdentityCLUT16(cmsPipeline* lut) }; - cmsPipelineInsertStage(DbgThread(), lut, cmsAT_END, cmsStageAllocCLut16bit(DbgThread(), 2, 3, 3, Table)); + cmsPipelineInsertStage(ContextID, lut, cmsAT_END, cmsStageAllocCLut16bit(ContextID, 2, 3, 3, Table)); } // Create a 3 fn identity curves static -void Add3GammaCurves(cmsPipeline* lut, cmsFloat64Number Curve) +void Add3GammaCurves(cmsContext ContextID, cmsPipeline* lut, cmsFloat64Number Curve) { - cmsToneCurve* id = cmsBuildGamma(DbgThread(), Curve); + cmsToneCurve* id = cmsBuildGamma(ContextID, Curve); cmsToneCurve* id3[3]; id3[0] = id; id3[1] = id; id3[2] = id; - cmsPipelineInsertStage(DbgThread(), lut, cmsAT_END, cmsStageAllocToneCurves(DbgThread(), 3, id3)); + cmsPipelineInsertStage(ContextID, lut, cmsAT_END, cmsStageAllocToneCurves(ContextID, 3, id3)); - cmsFreeToneCurve(DbgThread(), id); + cmsFreeToneCurve(ContextID, id); } static -cmsInt32Number CheckFloatLUT(cmsPipeline* lut) +cmsInt32Number CheckFloatLUT(cmsContext ContextID, cmsPipeline* lut) { cmsInt32Number n1, i, j; cmsFloat32Number Inf[3], Outf[3]; @@ -3219,7 +3212,7 @@ cmsInt32Number CheckFloatLUT(cmsPipeline* lut) cmsInt32Number af[3]; Inf[0] = Inf[1] = Inf[2] = (cmsFloat32Number) j / 65535.0F; - cmsPipelineEvalFloat(DbgThread(), Inf, Outf, lut); + cmsPipelineEvalFloat(ContextID, Inf, Outf, lut); af[0] = (cmsInt32Number) floor(Outf[0]*65535.0 + 0.5); af[1] = (cmsInt32Number) floor(Outf[1]*65535.0 + 0.5); @@ -3239,7 +3232,7 @@ cmsInt32Number CheckFloatLUT(cmsPipeline* lut) static -cmsInt32Number Check16LUT(cmsPipeline* lut) +cmsInt32Number Check16LUT(cmsContext ContextID, cmsPipeline* lut) { cmsInt32Number n2, i, j; cmsUInt16Number Inw[3], Outw[3]; @@ -3251,7 +3244,7 @@ cmsInt32Number Check16LUT(cmsPipeline* lut) cmsInt32Number aw[3]; Inw[0] = Inw[1] = Inw[2] = (cmsUInt16Number) j; - cmsPipelineEval16(DbgThread(), Inw, Outw, lut); + cmsPipelineEval16(ContextID, Inw, Outw, lut); aw[0] = Outw[0]; aw[1] = Outw[1]; aw[2] = Outw[2]; @@ -3271,205 +3264,205 @@ cmsInt32Number Check16LUT(cmsPipeline* lut) // Check any LUT that is linear static -cmsInt32Number CheckStagesLUT(cmsPipeline* lut, cmsInt32Number ExpectedStages) +cmsInt32Number CheckStagesLUT(cmsContext ContextID, cmsPipeline* lut, cmsInt32Number ExpectedStages) { cmsInt32Number nInpChans, nOutpChans, nStages; - nInpChans = cmsPipelineInputChannels(DbgThread(), lut); - nOutpChans = cmsPipelineOutputChannels(DbgThread(), lut); - nStages = cmsPipelineStageCount(DbgThread(), lut); + nInpChans = cmsPipelineInputChannels(ContextID, lut); + nOutpChans = cmsPipelineOutputChannels(ContextID, lut); + nStages = cmsPipelineStageCount(ContextID, lut); return (nInpChans == 3) && (nOutpChans == 3) && (nStages == ExpectedStages); } static -cmsInt32Number CheckFullLUT(cmsPipeline* lut, cmsInt32Number ExpectedStages) +cmsInt32Number CheckFullLUT(cmsContext ContextID, cmsPipeline* lut, cmsInt32Number ExpectedStages) { - cmsInt32Number rc = CheckStagesLUT(lut, ExpectedStages) && Check16LUT(lut) && CheckFloatLUT(lut); + cmsInt32Number rc = CheckStagesLUT(ContextID, lut, ExpectedStages) && Check16LUT(ContextID, lut) && CheckFloatLUT(ContextID, lut); - cmsPipelineFree(DbgThread(), lut); + cmsPipelineFree(ContextID, lut); return rc; } static -cmsInt32Number Check1StageLUT(void) +cmsInt32Number Check1StageLUT(cmsContext ContextID) { - cmsPipeline* lut = cmsPipelineAlloc(DbgThread(), 3, 3); + cmsPipeline* lut = cmsPipelineAlloc(ContextID, 3, 3); - AddIdentityMatrix(lut); - return CheckFullLUT(lut, 1); + AddIdentityMatrix(ContextID, lut); + return CheckFullLUT(ContextID, lut, 1); } static -cmsInt32Number Check2StageLUT(void) +cmsInt32Number Check2StageLUT(cmsContext ContextID) { - cmsPipeline* lut = cmsPipelineAlloc(DbgThread(), 3, 3); + cmsPipeline* lut = cmsPipelineAlloc(ContextID, 3, 3); - AddIdentityMatrix(lut); - AddIdentityCLUTfloat(lut); + AddIdentityMatrix(ContextID, lut); + AddIdentityCLUTfloat(ContextID, lut); - return CheckFullLUT(lut, 2); + return CheckFullLUT(ContextID, lut, 2); } static -cmsInt32Number Check2Stage16LUT(void) +cmsInt32Number Check2Stage16LUT(cmsContext ContextID) { - cmsPipeline* lut = cmsPipelineAlloc(DbgThread(), 3, 3); + cmsPipeline* lut = cmsPipelineAlloc(ContextID, 3, 3); - AddIdentityMatrix(lut); - AddIdentityCLUT16(lut); + AddIdentityMatrix(ContextID, lut); + AddIdentityCLUT16(ContextID, lut); - return CheckFullLUT(lut, 2); + return CheckFullLUT(ContextID, lut, 2); } static -cmsInt32Number Check3StageLUT(void) +cmsInt32Number Check3StageLUT(cmsContext ContextID) { - cmsPipeline* lut = cmsPipelineAlloc(DbgThread(), 3, 3); + cmsPipeline* lut = cmsPipelineAlloc(ContextID, 3, 3); - AddIdentityMatrix(lut); - AddIdentityCLUTfloat(lut); - Add3GammaCurves(lut, 1.0); + AddIdentityMatrix(ContextID, lut); + AddIdentityCLUTfloat(ContextID, lut); + Add3GammaCurves(ContextID, lut, 1.0); - return CheckFullLUT(lut, 3); + return CheckFullLUT(ContextID, lut, 3); } static -cmsInt32Number Check3Stage16LUT(void) +cmsInt32Number Check3Stage16LUT(cmsContext ContextID) { - cmsPipeline* lut = cmsPipelineAlloc(DbgThread(), 3, 3); + cmsPipeline* lut = cmsPipelineAlloc(ContextID, 3, 3); - AddIdentityMatrix(lut); - AddIdentityCLUT16(lut); - Add3GammaCurves(lut, 1.0); + AddIdentityMatrix(ContextID, lut); + AddIdentityCLUT16(ContextID, lut); + Add3GammaCurves(ContextID, lut, 1.0); - return CheckFullLUT(lut, 3); + return CheckFullLUT(ContextID, lut, 3); } static -cmsInt32Number Check4StageLUT(void) +cmsInt32Number Check4StageLUT(cmsContext ContextID) { - cmsPipeline* lut = cmsPipelineAlloc(DbgThread(), 3, 3); + cmsPipeline* lut = cmsPipelineAlloc(ContextID, 3, 3); - AddIdentityMatrix(lut); - AddIdentityCLUTfloat(lut); - Add3GammaCurves(lut, 1.0); - AddIdentityMatrix(lut); + AddIdentityMatrix(ContextID, lut); + AddIdentityCLUTfloat(ContextID, lut); + Add3GammaCurves(ContextID, lut, 1.0); + AddIdentityMatrix(ContextID, lut); - return CheckFullLUT(lut, 4); + return CheckFullLUT(ContextID, lut, 4); } static -cmsInt32Number Check4Stage16LUT(void) +cmsInt32Number Check4Stage16LUT(cmsContext ContextID) { - cmsPipeline* lut = cmsPipelineAlloc(DbgThread(), 3, 3); + cmsPipeline* lut = cmsPipelineAlloc(ContextID, 3, 3); - AddIdentityMatrix(lut); - AddIdentityCLUT16(lut); - Add3GammaCurves(lut, 1.0); - AddIdentityMatrix(lut); + AddIdentityMatrix(ContextID, lut); + AddIdentityCLUT16(ContextID, lut); + Add3GammaCurves(ContextID, lut, 1.0); + AddIdentityMatrix(ContextID, lut); - return CheckFullLUT(lut, 4); + return CheckFullLUT(ContextID, lut, 4); } static -cmsInt32Number Check5StageLUT(void) +cmsInt32Number Check5StageLUT(cmsContext ContextID) { - cmsPipeline* lut = cmsPipelineAlloc(DbgThread(), 3, 3); + cmsPipeline* lut = cmsPipelineAlloc(ContextID, 3, 3); - AddIdentityMatrix(lut); - AddIdentityCLUTfloat(lut); - Add3GammaCurves(lut, 1.0); - AddIdentityMatrix(lut); - Add3GammaCurves(lut, 1.0); + AddIdentityMatrix(ContextID, lut); + AddIdentityCLUTfloat(ContextID, lut); + Add3GammaCurves(ContextID, lut, 1.0); + AddIdentityMatrix(ContextID, lut); + Add3GammaCurves(ContextID, lut, 1.0); - return CheckFullLUT(lut, 5); + return CheckFullLUT(ContextID, lut, 5); } static -cmsInt32Number Check5Stage16LUT(void) +cmsInt32Number Check5Stage16LUT(cmsContext ContextID) { - cmsPipeline* lut = cmsPipelineAlloc(DbgThread(), 3, 3); + cmsPipeline* lut = cmsPipelineAlloc(ContextID, 3, 3); - AddIdentityMatrix(lut); - AddIdentityCLUT16(lut); - Add3GammaCurves(lut, 1.0); - AddIdentityMatrix(lut); - Add3GammaCurves(lut, 1.0); + AddIdentityMatrix(ContextID, lut); + AddIdentityCLUT16(ContextID, lut); + Add3GammaCurves(ContextID, lut, 1.0); + AddIdentityMatrix(ContextID, lut); + Add3GammaCurves(ContextID, lut, 1.0); - return CheckFullLUT(lut, 5); + return CheckFullLUT(ContextID, lut, 5); } static -cmsInt32Number Check6StageLUT(void) +cmsInt32Number Check6StageLUT(cmsContext ContextID) { - cmsPipeline* lut = cmsPipelineAlloc(DbgThread(), 3, 3); + cmsPipeline* lut = cmsPipelineAlloc(ContextID, 3, 3); - AddIdentityMatrix(lut); - Add3GammaCurves(lut, 1.0); - AddIdentityCLUTfloat(lut); - Add3GammaCurves(lut, 1.0); - AddIdentityMatrix(lut); - Add3GammaCurves(lut, 1.0); + AddIdentityMatrix(ContextID, lut); + Add3GammaCurves(ContextID, lut, 1.0); + AddIdentityCLUTfloat(ContextID, lut); + Add3GammaCurves(ContextID, lut, 1.0); + AddIdentityMatrix(ContextID, lut); + Add3GammaCurves(ContextID, lut, 1.0); - return CheckFullLUT(lut, 6); + return CheckFullLUT(ContextID, lut, 6); } static -cmsInt32Number Check6Stage16LUT(void) +cmsInt32Number Check6Stage16LUT(cmsContext ContextID) { - cmsPipeline* lut = cmsPipelineAlloc(DbgThread(), 3, 3); + cmsPipeline* lut = cmsPipelineAlloc(ContextID, 3, 3); - AddIdentityMatrix(lut); - Add3GammaCurves(lut, 1.0); - AddIdentityCLUT16(lut); - Add3GammaCurves(lut, 1.0); - AddIdentityMatrix(lut); - Add3GammaCurves(lut, 1.0); + AddIdentityMatrix(ContextID, lut); + Add3GammaCurves(ContextID, lut, 1.0); + AddIdentityCLUT16(ContextID, lut); + Add3GammaCurves(ContextID, lut, 1.0); + AddIdentityMatrix(ContextID, lut); + Add3GammaCurves(ContextID, lut, 1.0); - return CheckFullLUT(lut, 6); + return CheckFullLUT(ContextID, lut, 6); } static -cmsInt32Number CheckLab2LabLUT(void) +cmsInt32Number CheckLab2LabLUT(cmsContext ContextID) { - cmsPipeline* lut = cmsPipelineAlloc(DbgThread(), 3, 3); + cmsPipeline* lut = cmsPipelineAlloc(ContextID, 3, 3); cmsInt32Number rc; - cmsPipelineInsertStage(DbgThread(), lut, cmsAT_END, _cmsStageAllocLab2XYZ(DbgThread())); - cmsPipelineInsertStage(DbgThread(), lut, cmsAT_END, _cmsStageAllocXYZ2Lab(DbgThread())); + cmsPipelineInsertStage(ContextID, lut, cmsAT_END, _cmsStageAllocLab2XYZ(ContextID)); + cmsPipelineInsertStage(ContextID, lut, cmsAT_END, _cmsStageAllocXYZ2Lab(ContextID)); - rc = CheckFloatLUT(lut) && CheckStagesLUT(lut, 2); + rc = CheckFloatLUT(ContextID, lut) && CheckStagesLUT(ContextID, lut, 2); - cmsPipelineFree(DbgThread(), lut); + cmsPipelineFree(ContextID, lut); return rc; } static -cmsInt32Number CheckXYZ2XYZLUT(void) +cmsInt32Number CheckXYZ2XYZLUT(cmsContext ContextID) { - cmsPipeline* lut = cmsPipelineAlloc(DbgThread(), 3, 3); + cmsPipeline* lut = cmsPipelineAlloc(ContextID, 3, 3); cmsInt32Number rc; - cmsPipelineInsertStage(DbgThread(), lut, cmsAT_END, _cmsStageAllocXYZ2Lab(DbgThread())); - cmsPipelineInsertStage(DbgThread(), lut, cmsAT_END, _cmsStageAllocLab2XYZ(DbgThread())); + cmsPipelineInsertStage(ContextID, lut, cmsAT_END, _cmsStageAllocXYZ2Lab(ContextID)); + cmsPipelineInsertStage(ContextID, lut, cmsAT_END, _cmsStageAllocLab2XYZ(ContextID)); - rc = CheckFloatLUT(lut) && CheckStagesLUT(lut, 2); + rc = CheckFloatLUT(ContextID, lut) && CheckStagesLUT(ContextID, lut, 2); - cmsPipelineFree(DbgThread(), lut); + cmsPipelineFree(ContextID, lut); return rc; } @@ -3477,26 +3470,26 @@ cmsInt32Number CheckXYZ2XYZLUT(void) static -cmsInt32Number CheckLab2LabMatLUT(void) +cmsInt32Number CheckLab2LabMatLUT(cmsContext ContextID) { - cmsPipeline* lut = cmsPipelineAlloc(DbgThread(), 3, 3); + cmsPipeline* lut = cmsPipelineAlloc(ContextID, 3, 3); cmsInt32Number rc; - cmsPipelineInsertStage(DbgThread(), lut, cmsAT_END, _cmsStageAllocLab2XYZ(DbgThread())); - AddIdentityMatrix(lut); - cmsPipelineInsertStage(DbgThread(), lut, cmsAT_END, _cmsStageAllocXYZ2Lab(DbgThread())); + cmsPipelineInsertStage(ContextID, lut, cmsAT_END, _cmsStageAllocLab2XYZ(ContextID)); + AddIdentityMatrix(ContextID, lut); + cmsPipelineInsertStage(ContextID, lut, cmsAT_END, _cmsStageAllocXYZ2Lab(ContextID)); - rc = CheckFloatLUT(lut) && CheckStagesLUT(lut, 3); + rc = CheckFloatLUT(ContextID, lut) && CheckStagesLUT(ContextID, lut, 3); - cmsPipelineFree(DbgThread(), lut); + cmsPipelineFree(ContextID, lut); return rc; } static -cmsInt32Number CheckNamedColorLUT(void) +cmsInt32Number CheckNamedColorLUT(cmsContext ContextID) { - cmsPipeline* lut = cmsPipelineAlloc(DbgThread(), 3, 3); + cmsPipeline* lut = cmsPipelineAlloc(ContextID, 3, 3); cmsNAMEDCOLORLIST* nc; cmsInt32Number i,j, rc = 1, n2; cmsUInt16Number PCS[3]; @@ -3506,7 +3499,7 @@ cmsInt32Number CheckNamedColorLUT(void) - nc = cmsAllocNamedColorList(DbgThread(), 256, 3, "pre", "post"); + nc = cmsAllocNamedColorList(ContextID, 256, 3, "pre", "post"); if (nc == NULL) return 0; for (i=0; i < 256; i++) { @@ -3515,12 +3508,12 @@ cmsInt32Number CheckNamedColorLUT(void) Colorant[0] = Colorant[1] = Colorant[2] = Colorant[3] = (cmsUInt16Number) i; sprintf(Name, "#%d", i); - if (!cmsAppendNamedColor(DbgThread(), nc, Name, PCS, Colorant)) { rc = 0; break; } + if (!cmsAppendNamedColor(ContextID, nc, Name, PCS, Colorant)) { rc = 0; break; } } - cmsPipelineInsertStage(DbgThread(), lut, cmsAT_END, _cmsStageAllocNamedColor(DbgThread(), nc, FALSE)); + cmsPipelineInsertStage(ContextID, lut, cmsAT_END, _cmsStageAllocNamedColor(ContextID, nc, FALSE)); - cmsFreeNamedColorList(DbgThread(), nc); + cmsFreeNamedColorList(ContextID, nc); if (rc == 0) return 0; n2=0; @@ -3529,7 +3522,7 @@ cmsInt32Number CheckNamedColorLUT(void) Inw[0] = (cmsUInt16Number) j; - cmsPipelineEval16(DbgThread(), Inw, Outw, lut); + cmsPipelineEval16(ContextID, Inw, Outw, lut); for (i=0; i < 3; i++) { if (Outw[i] != j) { @@ -3539,7 +3532,7 @@ cmsInt32Number CheckNamedColorLUT(void) } - cmsPipelineFree(DbgThread(), lut); + cmsPipelineFree(ContextID, lut); return (n2 == 0); } @@ -3550,7 +3543,7 @@ cmsInt32Number CheckNamedColorLUT(void) // A lightweight test of multilocalized unicode structures. static -cmsInt32Number CheckMLU(void) +cmsInt32Number CheckMLU(cmsContext ContextID) { cmsMLU* mlu, *mlu2, *mlu3; char Buffer[256], Buffer2[256]; @@ -3559,40 +3552,40 @@ cmsInt32Number CheckMLU(void) cmsHPROFILE h= NULL; // Allocate a MLU structure, no preferred size - mlu = cmsMLUalloc(DbgThread(), 0); + mlu = cmsMLUalloc(ContextID, 0); // Add some localizations - cmsMLUsetWide(DbgThread(), mlu, "en", "US", L"Hello, world"); - cmsMLUsetWide(DbgThread(), mlu, "es", "ES", L"Hola, mundo"); - cmsMLUsetWide(DbgThread(), mlu, "fr", "FR", L"Bonjour, le monde"); - cmsMLUsetWide(DbgThread(), mlu, "ca", "CA", L"Hola, mon"); + cmsMLUsetWide(ContextID, mlu, "en", "US", L"Hello, world"); + cmsMLUsetWide(ContextID, mlu, "es", "ES", L"Hola, mundo"); + cmsMLUsetWide(ContextID, mlu, "fr", "FR", L"Bonjour, le monde"); + cmsMLUsetWide(ContextID, mlu, "ca", "CA", L"Hola, mon"); // Check the returned string for each language - cmsMLUgetASCII(DbgThread(), mlu, "en", "US", Buffer, 256); + cmsMLUgetASCII(ContextID, mlu, "en", "US", Buffer, 256); if (strcmp(Buffer, "Hello, world") != 0) rc = 0; - cmsMLUgetASCII(DbgThread(), mlu, "es", "ES", Buffer, 256); + cmsMLUgetASCII(ContextID, mlu, "es", "ES", Buffer, 256); if (strcmp(Buffer, "Hola, mundo") != 0) rc = 0; - cmsMLUgetASCII(DbgThread(), mlu, "fr", "FR", Buffer, 256); + cmsMLUgetASCII(ContextID, mlu, "fr", "FR", Buffer, 256); if (strcmp(Buffer, "Bonjour, le monde") != 0) rc = 0; - cmsMLUgetASCII(DbgThread(), mlu, "ca", "CA", Buffer, 256); + cmsMLUgetASCII(ContextID, mlu, "ca", "CA", Buffer, 256); if (strcmp(Buffer, "Hola, mon") != 0) rc = 0; if (rc == 0) Fail("Unexpected string '%s'", Buffer); // So far, so good. - cmsMLUfree(DbgThread(), mlu); + cmsMLUfree(ContextID, mlu); // Now for performance, allocate an empty struct - mlu = cmsMLUalloc(DbgThread(), 0); + mlu = cmsMLUalloc(ContextID, 0); // Fill it with several thousands of different lenguages for (i=0; i < 4096; i++) { @@ -3604,14 +3597,14 @@ cmsInt32Number CheckMLU(void) Lang[2] = 0; sprintf(Buffer, "String #%i", i); - cmsMLUsetASCII(DbgThread(), mlu, Lang, Lang, Buffer); + cmsMLUsetASCII(ContextID, mlu, Lang, Lang, Buffer); } // Duplicate it - mlu2 = cmsMLUdup(DbgThread(), mlu); + mlu2 = cmsMLUdup(ContextID, mlu); // Get rid of original - cmsMLUfree(DbgThread(), mlu); + cmsMLUfree(ContextID, mlu); // Check all is still in place for (i=0; i < 4096; i++) { @@ -3622,7 +3615,7 @@ cmsInt32Number CheckMLU(void) Lang[1] = (char)(i / 255); Lang[2] = 0; - cmsMLUgetASCII(DbgThread(), mlu2, Lang, Lang, Buffer2, 256); + cmsMLUgetASCII(ContextID, mlu2, Lang, Lang, Buffer2, 256); sprintf(Buffer, "String #%i", i); if (strcmp(Buffer, Buffer2) != 0) { rc = 0; break; } @@ -3633,18 +3626,18 @@ cmsInt32Number CheckMLU(void) // Check profile IO - h = cmsOpenProfileFromFile(DbgThread(), "mlucheck.icc", "w"); + h = cmsOpenProfileFromFile(ContextID, "mlucheck.icc", "w"); - cmsSetProfileVersion(DbgThread(), h, 4.3); + cmsSetProfileVersion(ContextID, h, 4.3); - cmsWriteTag(DbgThread(), h, cmsSigProfileDescriptionTag, mlu2); - cmsCloseProfile(DbgThread(), h); - cmsMLUfree(DbgThread(), mlu2); + cmsWriteTag(ContextID, h, cmsSigProfileDescriptionTag, mlu2); + cmsCloseProfile(ContextID, h); + cmsMLUfree(ContextID, mlu2); - h = cmsOpenProfileFromFile(DbgThread(), "mlucheck.icc", "r"); + h = cmsOpenProfileFromFile(ContextID, "mlucheck.icc", "r"); - mlu3 = (cmsMLU *) cmsReadTag(DbgThread(), h, cmsSigProfileDescriptionTag); + mlu3 = (cmsMLU *) cmsReadTag(ContextID, h, cmsSigProfileDescriptionTag); if (mlu3 == NULL) { Fail("Profile didn't get the MLU\n"); rc = 0; goto Error; } // Check all is still in place @@ -3656,7 +3649,7 @@ cmsInt32Number CheckMLU(void) Lang[1] = (char) (i / 255); Lang[2] = 0; - cmsMLUgetASCII(DbgThread(), mlu3, Lang, Lang, Buffer2, 256); + cmsMLUgetASCII(ContextID, mlu3, Lang, Lang, Buffer2, 256); sprintf(Buffer, "String #%i", i); if (strcmp(Buffer, Buffer2) != 0) { rc = 0; break; } @@ -3666,7 +3659,7 @@ cmsInt32Number CheckMLU(void) Error: - if (h != NULL) cmsCloseProfile(DbgThread(), h); + if (h != NULL) cmsCloseProfile(ContextID, h); remove("mlucheck.icc"); return rc; @@ -3675,7 +3668,7 @@ Error: // A lightweight test of named color structures. static -cmsInt32Number CheckNamedColorList(void) +cmsInt32Number CheckNamedColorList(cmsContext ContextID) { cmsNAMEDCOLORLIST* nc = NULL, *nc2; cmsInt32Number i, j, rc=1; @@ -3687,7 +3680,7 @@ cmsInt32Number CheckNamedColorList(void) cmsUInt16Number CheckColorant[cmsMAXCHANNELS]; cmsHPROFILE h; - nc = cmsAllocNamedColorList(DbgThread(), 0, 4, "prefix", "suffix"); + nc = cmsAllocNamedColorList(ContextID, 0, 4, "prefix", "suffix"); if (nc == NULL) return 0; for (i=0; i < 4096; i++) { @@ -3697,7 +3690,7 @@ cmsInt32Number CheckNamedColorList(void) Colorant[0] = Colorant[1] = Colorant[2] = Colorant[3] = (cmsUInt16Number) (4096 - i); sprintf(Name, "#%d", i); - if (!cmsAppendNamedColor(DbgThread(), nc, Name, PCS, Colorant)) { rc = 0; break; } + if (!cmsAppendNamedColor(ContextID, nc, Name, PCS, Colorant)) { rc = 0; break; } } for (i=0; i < 4096; i++) { @@ -3706,7 +3699,7 @@ cmsInt32Number CheckNamedColorList(void) CheckColorant[0] = CheckColorant[1] = CheckColorant[2] = CheckColorant[3] = (cmsUInt16Number) (4096 - i); sprintf(CheckName, "#%d", i); - if (!cmsNamedColorInfo(DbgThread(), nc, i, Name, NULL, NULL, PCS, Colorant)) { rc = 0; goto Error; } + if (!cmsNamedColorInfo(ContextID, nc, i, Name, NULL, NULL, PCS, Colorant)) { rc = 0; goto Error; } for (j=0; j < 3; j++) { @@ -3720,19 +3713,19 @@ cmsInt32Number CheckNamedColorList(void) if (strcmp(Name, CheckName) != 0) {rc = 0; Fail("Invalid Name"); goto Error; }; } - h = cmsOpenProfileFromFile(DbgThread(), "namedcol.icc", "w"); + h = cmsOpenProfileFromFile(ContextID, "namedcol.icc", "w"); if (h == NULL) return 0; - if (!cmsWriteTag(DbgThread(), h, cmsSigNamedColor2Tag, nc)) return 0; - cmsCloseProfile(DbgThread(), h); - cmsFreeNamedColorList(DbgThread(), nc); + if (!cmsWriteTag(ContextID, h, cmsSigNamedColor2Tag, nc)) return 0; + cmsCloseProfile(ContextID, h); + cmsFreeNamedColorList(ContextID, nc); nc = NULL; - h = cmsOpenProfileFromFile(DbgThread(), "namedcol.icc", "r"); - nc2 = (cmsNAMEDCOLORLIST *) cmsReadTag(DbgThread(), h, cmsSigNamedColor2Tag); + h = cmsOpenProfileFromFile(ContextID, "namedcol.icc", "r"); + nc2 = (cmsNAMEDCOLORLIST *) cmsReadTag(ContextID, h, cmsSigNamedColor2Tag); - if (cmsNamedColorCount(DbgThread(), nc2) != 4096) { rc = 0; Fail("Invalid count"); goto Error; } + if (cmsNamedColorCount(ContextID, nc2) != 4096) { rc = 0; Fail("Invalid count"); goto Error; } - i = cmsNamedColorIndex(DbgThread(), nc2, "#123"); + i = cmsNamedColorIndex(ContextID, nc2, "#123"); if (i != 123) { rc = 0; Fail("Invalid index"); goto Error; } @@ -3742,7 +3735,7 @@ cmsInt32Number CheckNamedColorList(void) CheckColorant[0] = CheckColorant[1] = CheckColorant[2] = CheckColorant[3] = (cmsUInt16Number) (4096 - i); sprintf(CheckName, "#%d", i); - if (!cmsNamedColorInfo(DbgThread(), nc2, i, Name, NULL, NULL, PCS, Colorant)) { rc = 0; goto Error; } + if (!cmsNamedColorInfo(ContextID, nc2, i, Name, NULL, NULL, PCS, Colorant)) { rc = 0; goto Error; } for (j=0; j < 3; j++) { @@ -3756,11 +3749,11 @@ cmsInt32Number CheckNamedColorList(void) if (strcmp(Name, CheckName) != 0) {rc = 0; Fail("Invalid Name"); goto Error; }; } - cmsCloseProfile(DbgThread(), h); + cmsCloseProfile(ContextID, h); remove("namedcol.icc"); Error: - if (nc != NULL) cmsFreeNamedColorList(DbgThread(), nc); + if (nc != NULL) cmsFreeNamedColorList(ContextID, nc); return rc; } @@ -3813,9 +3806,9 @@ void CheckSingleFormatter16(cmsContext id, cmsUInt32Number Type, const char* Tex Values[i] <<= 8; } - b.Fmt16(DbgThread(), &info, Values, Buffer, 2); + b.Fmt16(id, &info, Values, Buffer, 2); memset(Values, 0, sizeof(Values)); - f.Fmt16(DbgThread(), &info, Values, Buffer, 2); + f.Fmt16(id, &info, Values, Buffer, 2); for (i=0; i < nChannels; i++) { if (bytes == 1) @@ -3834,8 +3827,8 @@ void CheckSingleFormatter16(cmsContext id, cmsUInt32Number Type, const char* Tex Values[i] <<= 8; } - b.Fmt16(DbgThread(), &info, Values, Buffer, 1); - f.Fmt16(DbgThread(), &info, Values, Buffer, 1); + b.Fmt16(id, &info, Values, Buffer, 1); + f.Fmt16(id, &info, Values, Buffer, 1); return; } } @@ -3847,7 +3840,7 @@ void CheckSingleFormatter16(cmsContext id, cmsUInt32Number Type, const char* Tex // Check all formatters static -cmsInt32Number CheckFormatters16(void) +cmsInt32Number CheckFormatters16(cmsContext ContextID) { FormatterFailed = FALSE; @@ -4028,7 +4021,7 @@ cmsInt32Number CheckFormatters16(void) #undef C static -void CheckSingleFormatterFloat(cmsUInt32Number Type, const char* Text) +void CheckSingleFormatterFloat(cmsContext ContextID, cmsUInt32Number Type, const char* Text) { cmsFloat32Number Values[cmsMAXCHANNELS]; cmsUInt8Number Buffer[1024]; @@ -4043,16 +4036,16 @@ void CheckSingleFormatterFloat(cmsUInt32Number Type, const char* Text) info.OutputFormat = info.InputFormat = Type; // Go forth and back - f = _cmsGetFormatter(0, Type, cmsFormatterInput, CMS_PACK_FLAGS_FLOAT); - b = _cmsGetFormatter(0, Type, cmsFormatterOutput, CMS_PACK_FLAGS_FLOAT); + f = _cmsGetFormatter(ContextID, Type, cmsFormatterInput, CMS_PACK_FLAGS_FLOAT); + b = _cmsGetFormatter(ContextID, Type, cmsFormatterOutput, CMS_PACK_FLAGS_FLOAT); if (f.FmtFloat == NULL || b.FmtFloat == NULL) { Fail("no formatter for %s", Text); FormatterFailed = TRUE; // Useful for debug - f = _cmsGetFormatter(0, Type, cmsFormatterInput, CMS_PACK_FLAGS_FLOAT); - b = _cmsGetFormatter(0, Type, cmsFormatterOutput, CMS_PACK_FLAGS_FLOAT); + f = _cmsGetFormatter(ContextID, Type, cmsFormatterInput, CMS_PACK_FLAGS_FLOAT); + b = _cmsGetFormatter(ContextID, Type, cmsFormatterOutput, CMS_PACK_FLAGS_FLOAT); return; } @@ -4064,9 +4057,9 @@ void CheckSingleFormatterFloat(cmsUInt32Number Type, const char* Text) Values[i] = (cmsFloat32Number) (i+j); } - b.FmtFloat(DbgThread(), &info, Values, Buffer, 1); + b.FmtFloat(ContextID, &info, Values, Buffer, 1); memset(Values, 0, sizeof(Values)); - f.FmtFloat(DbgThread(), &info, Values, Buffer, 1); + f.FmtFloat(ContextID, &info, Values, Buffer, 1); for (i=0; i < nChannels; i++) { @@ -4082,18 +4075,18 @@ void CheckSingleFormatterFloat(cmsUInt32Number Type, const char* Text) Values[i] = (cmsFloat32Number) (i+j); } - b.FmtFloat(DbgThread(), &info, Values, Buffer, 1); - f.FmtFloat(DbgThread(), &info, Values, Buffer, 1); + b.FmtFloat(ContextID, &info, Values, Buffer, 1); + f.FmtFloat(ContextID, &info, Values, Buffer, 1); return; } } } } -#define C(a) CheckSingleFormatterFloat(a, #a) +#define C(a) CheckSingleFormatterFloat(ContextID, a, #a) static -cmsInt32Number CheckFormattersFloat(void) +cmsInt32Number CheckFormattersFloat(cmsContext ContextID) { FormatterFailed = FALSE; @@ -4144,7 +4137,7 @@ cmsInt32Number CheckFormattersFloat(void) // Check half float #define my_isfinite(x) ((x) != (x)) static -cmsInt32Number CheckFormattersHalf(void) +cmsInt32Number CheckFormattersHalf(cmsContext ContextID) { int i, j; @@ -4170,7 +4163,7 @@ cmsInt32Number CheckFormattersHalf(void) #endif static -cmsInt32Number CheckOneRGB(cmsHTRANSFORM xform, cmsUInt16Number R, cmsUInt16Number G, cmsUInt16Number B, cmsUInt16Number Ro, cmsUInt16Number Go, cmsUInt16Number Bo) +cmsInt32Number CheckOneRGB(cmsContext ContextID, cmsHTRANSFORM xform, cmsUInt16Number R, cmsUInt16Number G, cmsUInt16Number B, cmsUInt16Number Ro, cmsUInt16Number Go, cmsUInt16Number Bo) { cmsUInt16Number RGB[3]; cmsUInt16Number Out[3]; @@ -4179,7 +4172,7 @@ cmsInt32Number CheckOneRGB(cmsHTRANSFORM xform, cmsUInt16Number R, cmsUInt16Numb RGB[1] = G; RGB[2] = B; - cmsDoTransform(DbgThread(), xform, RGB, Out, 1); + cmsDoTransform(ContextID, xform, RGB, Out, 1); return IsGoodWord("R", Ro , Out[0]) && IsGoodWord("G", Go , Out[1]) && @@ -4188,7 +4181,7 @@ cmsInt32Number CheckOneRGB(cmsHTRANSFORM xform, cmsUInt16Number R, cmsUInt16Numb // Check known values going from sRGB to XYZ static -cmsInt32Number CheckOneRGB_double(cmsHTRANSFORM xform, cmsFloat64Number R, cmsFloat64Number G, cmsFloat64Number B, cmsFloat64Number Ro, cmsFloat64Number Go, cmsFloat64Number Bo) +cmsInt32Number CheckOneRGB_double(cmsContext ContextID, cmsHTRANSFORM xform, cmsFloat64Number R, cmsFloat64Number G, cmsFloat64Number B, cmsFloat64Number Ro, cmsFloat64Number Go, cmsFloat64Number Bo) { cmsFloat64Number RGB[3]; cmsFloat64Number Out[3]; @@ -4197,7 +4190,7 @@ cmsInt32Number CheckOneRGB_double(cmsHTRANSFORM xform, cmsFloat64Number R, cmsFl RGB[1] = G; RGB[2] = B; - cmsDoTransform(DbgThread(), xform, RGB, Out, 1); + cmsDoTransform(ContextID, xform, RGB, Out, 1); return IsGoodVal("R", Ro , Out[0], 0.01) && IsGoodVal("G", Go , Out[1], 0.01) && @@ -4206,37 +4199,37 @@ cmsInt32Number CheckOneRGB_double(cmsHTRANSFORM xform, cmsFloat64Number R, cmsFl static -cmsInt32Number CheckChangeBufferFormat(void) +cmsInt32Number CheckChangeBufferFormat(cmsContext ContextID) { - cmsHPROFILE hsRGB = cmsCreate_sRGBProfile(DbgThread()); + cmsHPROFILE hsRGB = cmsCreate_sRGBProfile(ContextID); cmsHTRANSFORM xform; cmsHTRANSFORM xform2; - xform = cmsCreateTransform(DbgThread(), hsRGB, TYPE_RGB_16, hsRGB, TYPE_RGB_16, INTENT_PERCEPTUAL, 0); - cmsCloseProfile(DbgThread(), hsRGB); + xform = cmsCreateTransform(ContextID, hsRGB, TYPE_RGB_16, hsRGB, TYPE_RGB_16, INTENT_PERCEPTUAL, 0); + cmsCloseProfile(ContextID, hsRGB); if (xform == NULL) return 0; - if (!CheckOneRGB(xform, 0, 0, 0, 0, 0, 0)) return 0; - if (!CheckOneRGB(xform, 120, 0, 0, 120, 0, 0)) return 0; - if (!CheckOneRGB(xform, 0, 222, 255, 0, 222, 255)) return 0; + if (!CheckOneRGB(ContextID, xform, 0, 0, 0, 0, 0, 0)) return 0; + if (!CheckOneRGB(ContextID, xform, 120, 0, 0, 120, 0, 0)) return 0; + if (!CheckOneRGB(ContextID, xform, 0, 222, 255, 0, 222, 255)) return 0; - xform2 = cmsCloneTransformChangingFormats(DbgThread(), xform, TYPE_BGR_16, TYPE_RGB_16); + xform2 = cmsCloneTransformChangingFormats(ContextID, xform, TYPE_BGR_16, TYPE_RGB_16); if (!xform2) return 0; - if (!CheckOneRGB(xform2, 0, 0, 123, 123, 0, 0)) return 0; - if (!CheckOneRGB(xform2, 154, 234, 0, 0, 234, 154)) return 0; + if (!CheckOneRGB(ContextID, xform2, 0, 0, 123, 123, 0, 0)) return 0; + if (!CheckOneRGB(ContextID, xform2, 154, 234, 0, 0, 234, 154)) return 0; - cmsDeleteTransform(DbgThread(),xform2); - xform2 = cmsCloneTransformChangingFormats(DbgThread(), xform, TYPE_RGB_DBL, TYPE_RGB_DBL); + cmsDeleteTransform(ContextID,xform2); + xform2 = cmsCloneTransformChangingFormats(ContextID, xform, TYPE_RGB_DBL, TYPE_RGB_DBL); if (!xform2) return 0; - if (!CheckOneRGB_double(xform2, 0.20, 0, 0, 0.20, 0, 0)) return 0; - if (!CheckOneRGB_double(xform2, 0, 0.9, 1, 0, 0.9, 1)) return 0; + if (!CheckOneRGB_double(ContextID, xform2, 0.20, 0, 0, 0.20, 0, 0)) return 0; + if (!CheckOneRGB_double(ContextID, xform2, 0, 0.9, 1, 0, 0.9, 1)) return 0; - cmsDeleteTransform(DbgThread(),xform2); - cmsDeleteTransform(DbgThread(),xform); + cmsDeleteTransform(ContextID,xform2); + cmsDeleteTransform(ContextID,xform); return 1; } @@ -4245,7 +4238,7 @@ return 1; // Write tag testbed ---------------------------------------------------------------------------------------- static -cmsInt32Number CheckXYZ(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSignature tag) +cmsInt32Number CheckXYZ(cmsContext ContextID, cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSignature tag) { cmsCIEXYZ XYZ, *Pt; @@ -4255,10 +4248,10 @@ cmsInt32Number CheckXYZ(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSignatu case 1: XYZ.X = 1.0; XYZ.Y = 1.1; XYZ.Z = 1.2; - return cmsWriteTag(DbgThread(), hProfile, tag, &XYZ); + return cmsWriteTag(ContextID, hProfile, tag, &XYZ); case 2: - Pt = (cmsCIEXYZ *) cmsReadTag(DbgThread(), hProfile, tag); + Pt = (cmsCIEXYZ *) cmsReadTag(ContextID, hProfile, tag); if (Pt == NULL) return 0; return IsGoodFixed15_16("X", 1.0, Pt ->X) && IsGoodFixed15_16("Y", 1.1, Pt->Y) && @@ -4271,7 +4264,7 @@ cmsInt32Number CheckXYZ(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSignatu static -cmsInt32Number CheckGamma(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSignature tag) +cmsInt32Number CheckGamma(cmsContext ContextID, cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSignature tag) { cmsToneCurve *g, *Pt; cmsInt32Number rc; @@ -4280,15 +4273,15 @@ cmsInt32Number CheckGamma(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSigna case 1: - g = cmsBuildGamma(DbgThread(), 1.0); - rc = cmsWriteTag(DbgThread(), hProfile, tag, g); - cmsFreeToneCurve(DbgThread(), g); + g = cmsBuildGamma(ContextID, 1.0); + rc = cmsWriteTag(ContextID, hProfile, tag, g); + cmsFreeToneCurve(ContextID, g); return rc; case 2: - Pt = (cmsToneCurve *) cmsReadTag(DbgThread(), hProfile, tag); + Pt = (cmsToneCurve *) cmsReadTag(ContextID, hProfile, tag); if (Pt == NULL) return 0; - return cmsIsToneCurveLinear(DbgThread(), Pt); + return cmsIsToneCurveLinear(ContextID, Pt); default: return 0; @@ -4296,7 +4289,7 @@ cmsInt32Number CheckGamma(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSigna } static -cmsInt32Number CheckTextSingle(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSignature tag) +cmsInt32Number CheckTextSingle(cmsContext ContextID, cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSignature tag) { cmsMLU *m, *Pt; cmsInt32Number rc; @@ -4306,16 +4299,16 @@ cmsInt32Number CheckTextSingle(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTag switch (Pass) { case 1: - m = cmsMLUalloc(DbgThread(), 0); - cmsMLUsetASCII(DbgThread(), m, cmsNoLanguage, cmsNoCountry, "Test test"); - rc = cmsWriteTag(DbgThread(), hProfile, tag, m); - cmsMLUfree(DbgThread(), m); + m = cmsMLUalloc(ContextID, 0); + cmsMLUsetASCII(ContextID, m, cmsNoLanguage, cmsNoCountry, "Test test"); + rc = cmsWriteTag(ContextID, hProfile, tag, m); + cmsMLUfree(ContextID, m); return rc; case 2: - Pt = (cmsMLU *) cmsReadTag(DbgThread(), hProfile, tag); + Pt = (cmsMLU *) cmsReadTag(ContextID, hProfile, tag); if (Pt == NULL) return 0; - cmsMLUgetASCII(DbgThread(), Pt, cmsNoLanguage, cmsNoCountry, Buffer, 256); + cmsMLUgetASCII(ContextID, Pt, cmsNoLanguage, cmsNoCountry, Buffer, 256); if (strcmp(Buffer, "Test test") != 0) return FALSE; return TRUE; @@ -4326,7 +4319,7 @@ cmsInt32Number CheckTextSingle(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTag static -cmsInt32Number CheckText(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSignature tag) +cmsInt32Number CheckText(cmsContext ContextID, cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSignature tag) { cmsMLU *m, *Pt; cmsInt32Number rc; @@ -4336,28 +4329,28 @@ cmsInt32Number CheckText(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSignat switch (Pass) { case 1: - m = cmsMLUalloc(DbgThread(), 0); - cmsMLUsetASCII(DbgThread(), m, cmsNoLanguage, cmsNoCountry, "Test test"); - cmsMLUsetASCII(DbgThread(), m, "en", "US", "1 1 1 1"); - cmsMLUsetASCII(DbgThread(), m, "es", "ES", "2 2 2 2"); - cmsMLUsetASCII(DbgThread(), m, "ct", "ES", "3 3 3 3"); - cmsMLUsetASCII(DbgThread(), m, "en", "GB", "444444444"); - rc = cmsWriteTag(DbgThread(), hProfile, tag, m); - cmsMLUfree(DbgThread(), m); + m = cmsMLUalloc(ContextID, 0); + cmsMLUsetASCII(ContextID, m, cmsNoLanguage, cmsNoCountry, "Test test"); + cmsMLUsetASCII(ContextID, m, "en", "US", "1 1 1 1"); + cmsMLUsetASCII(ContextID, m, "es", "ES", "2 2 2 2"); + cmsMLUsetASCII(ContextID, m, "ct", "ES", "3 3 3 3"); + cmsMLUsetASCII(ContextID, m, "en", "GB", "444444444"); + rc = cmsWriteTag(ContextID, hProfile, tag, m); + cmsMLUfree(ContextID, m); return rc; case 2: - Pt = (cmsMLU *) cmsReadTag(DbgThread(), hProfile, tag); + Pt = (cmsMLU *) cmsReadTag(ContextID, hProfile, tag); if (Pt == NULL) return 0; - cmsMLUgetASCII(DbgThread(), Pt, cmsNoLanguage, cmsNoCountry, Buffer, 256); + cmsMLUgetASCII(ContextID, Pt, cmsNoLanguage, cmsNoCountry, Buffer, 256); if (strcmp(Buffer, "Test test") != 0) return FALSE; - cmsMLUgetASCII(DbgThread(), Pt, "en", "US", Buffer, 256); + cmsMLUgetASCII(ContextID, Pt, "en", "US", Buffer, 256); if (strcmp(Buffer, "1 1 1 1") != 0) return FALSE; - cmsMLUgetASCII(DbgThread(), Pt, "es", "ES", Buffer, 256); + cmsMLUgetASCII(ContextID, Pt, "es", "ES", Buffer, 256); if (strcmp(Buffer, "2 2 2 2") != 0) return FALSE; - cmsMLUgetASCII(DbgThread(), Pt, "ct", "ES", Buffer, 256); + cmsMLUgetASCII(ContextID, Pt, "ct", "ES", Buffer, 256); if (strcmp(Buffer, "3 3 3 3") != 0) return FALSE; - cmsMLUgetASCII(DbgThread(), Pt, "en", "GB", Buffer, 256); + cmsMLUgetASCII(ContextID, Pt, "en", "GB", Buffer, 256); if (strcmp(Buffer, "444444444") != 0) return FALSE; return TRUE; @@ -4367,7 +4360,7 @@ cmsInt32Number CheckText(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSignat } static -cmsInt32Number CheckData(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSignature tag) +cmsInt32Number CheckData(cmsContext ContextID, cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSignature tag) { cmsICCData *Pt; cmsICCData d = { 1, 0, { '?' }}; @@ -4377,11 +4370,11 @@ cmsInt32Number CheckData(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSigna switch (Pass) { case 1: - rc = cmsWriteTag(DbgThread(), hProfile, tag, &d); + rc = cmsWriteTag(ContextID, hProfile, tag, &d); return rc; case 2: - Pt = (cmsICCData *) cmsReadTag(DbgThread(), hProfile, tag); + Pt = (cmsICCData *) cmsReadTag(ContextID, hProfile, tag); if (Pt == NULL) return 0; return (Pt ->data[0] == '?') && (Pt ->flag == 0) && (Pt ->len == 1); @@ -4392,7 +4385,7 @@ cmsInt32Number CheckData(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSigna static -cmsInt32Number CheckSignature(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSignature tag) +cmsInt32Number CheckSignature(cmsContext ContextID, cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSignature tag) { cmsTagSignature *Pt, Holder; @@ -4400,10 +4393,10 @@ cmsInt32Number CheckSignature(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTag case 1: Holder = (cmsTagSignature) cmsSigPerceptualReferenceMediumGamut; - return cmsWriteTag(DbgThread(), hProfile, tag, &Holder); + return cmsWriteTag(ContextID, hProfile, tag, &Holder); case 2: - Pt = (cmsTagSignature *) cmsReadTag(DbgThread(), hProfile, tag); + Pt = (cmsTagSignature *) cmsReadTag(ContextID, hProfile, tag); if (Pt == NULL) return 0; return *Pt == cmsSigPerceptualReferenceMediumGamut; @@ -4414,7 +4407,7 @@ cmsInt32Number CheckSignature(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTag static -cmsInt32Number CheckDateTime(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSignature tag) +cmsInt32Number CheckDateTime(cmsContext ContextID, cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSignature tag) { struct tm *Pt, Holder; @@ -4428,10 +4421,10 @@ cmsInt32Number CheckDateTime(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagS Holder.tm_mday = 4; Holder.tm_mon = 5; Holder.tm_year = 2009 - 1900; - return cmsWriteTag(DbgThread(), hProfile, tag, &Holder); + return cmsWriteTag(ContextID, hProfile, tag, &Holder); case 2: - Pt = (struct tm *) cmsReadTag(DbgThread(), hProfile, tag); + Pt = (struct tm *) cmsReadTag(ContextID, hProfile, tag); if (Pt == NULL) return 0; return (Pt ->tm_hour == 1 && @@ -4449,7 +4442,7 @@ cmsInt32Number CheckDateTime(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagS static -cmsInt32Number CheckNamedColor(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSignature tag, cmsInt32Number max_check, cmsBool colorant_check) +cmsInt32Number CheckNamedColor(cmsContext ContextID, cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSignature tag, cmsInt32Number max_check, cmsBool colorant_check) { cmsNAMEDCOLORLIST* nc; cmsInt32Number i, j, rc; @@ -4464,7 +4457,7 @@ cmsInt32Number CheckNamedColor(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTa case 1: - nc = cmsAllocNamedColorList(DbgThread(), 0, 4, "prefix", "suffix"); + nc = cmsAllocNamedColorList(ContextID, 0, 4, "prefix", "suffix"); if (nc == NULL) return 0; for (i=0; i < max_check; i++) { @@ -4473,16 +4466,16 @@ cmsInt32Number CheckNamedColor(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTa Colorant[0] = Colorant[1] = Colorant[2] = Colorant[3] = (cmsUInt16Number) (max_check - i); sprintf(Name, "#%d", i); - if (!cmsAppendNamedColor(DbgThread(), nc, Name, PCS, Colorant)) { Fail("Couldn't append named color"); return 0; } + if (!cmsAppendNamedColor(ContextID, nc, Name, PCS, Colorant)) { Fail("Couldn't append named color"); return 0; } } - rc = cmsWriteTag(DbgThread(), hProfile, tag, nc); - cmsFreeNamedColorList(DbgThread(), nc); + rc = cmsWriteTag(ContextID, hProfile, tag, nc); + cmsFreeNamedColorList(ContextID, nc); return rc; case 2: - nc = (cmsNAMEDCOLORLIST *) cmsReadTag(DbgThread(), hProfile, tag); + nc = (cmsNAMEDCOLORLIST *) cmsReadTag(ContextID, hProfile, tag); if (nc == NULL) return 0; for (i=0; i < max_check; i++) { @@ -4491,7 +4484,7 @@ cmsInt32Number CheckNamedColor(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTa CheckColorant[0] = CheckColorant[1] = CheckColorant[2] = CheckColorant[3] = (cmsUInt16Number) (max_check - i); sprintf(CheckName, "#%d", i); - if (!cmsNamedColorInfo(DbgThread(), nc, i, Name, NULL, NULL, PCS, Colorant)) { Fail("Invalid string"); return 0; } + if (!cmsNamedColorInfo(ContextID, nc, i, Name, NULL, NULL, PCS, Colorant)) { Fail("Invalid string"); return 0; } for (j=0; j < 3; j++) { @@ -4517,7 +4510,7 @@ cmsInt32Number CheckNamedColor(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTa static -cmsInt32Number CheckLUT(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSignature tag) +cmsInt32Number CheckLUT(cmsContext ContextID, cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSignature tag) { cmsPipeline* Lut, *Pt; cmsInt32Number rc; @@ -4527,24 +4520,24 @@ cmsInt32Number CheckLUT(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSignat case 1: - Lut = cmsPipelineAlloc(DbgThread(), 3, 3); + Lut = cmsPipelineAlloc(ContextID, 3, 3); if (Lut == NULL) return 0; // Create an identity LUT - cmsPipelineInsertStage(DbgThread(), Lut, cmsAT_BEGIN, _cmsStageAllocIdentityCurves(DbgThread(), 3)); - cmsPipelineInsertStage(DbgThread(), Lut, cmsAT_END, _cmsStageAllocIdentityCLut(DbgThread(), 3)); - cmsPipelineInsertStage(DbgThread(), Lut, cmsAT_END, _cmsStageAllocIdentityCurves(DbgThread(), 3)); + cmsPipelineInsertStage(ContextID, Lut, cmsAT_BEGIN, _cmsStageAllocIdentityCurves(ContextID, 3)); + cmsPipelineInsertStage(ContextID, Lut, cmsAT_END, _cmsStageAllocIdentityCLut(ContextID, 3)); + cmsPipelineInsertStage(ContextID, Lut, cmsAT_END, _cmsStageAllocIdentityCurves(ContextID, 3)); - rc = cmsWriteTag(DbgThread(), hProfile, tag, Lut); - cmsPipelineFree(DbgThread(), Lut); + rc = cmsWriteTag(ContextID, hProfile, tag, Lut); + cmsPipelineFree(ContextID, Lut); return rc; case 2: - Pt = (cmsPipeline *) cmsReadTag(DbgThread(), hProfile, tag); + Pt = (cmsPipeline *) cmsReadTag(ContextID, hProfile, tag); if (Pt == NULL) return 0; // Transform values, check for identity - return Check16LUT(Pt); + return Check16LUT(ContextID, Pt); default: return 0; @@ -4552,7 +4545,7 @@ cmsInt32Number CheckLUT(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSignat } static -cmsInt32Number CheckCHAD(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSignature tag) +cmsInt32Number CheckCHAD(cmsContext ContextID, cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSignature tag) { cmsFloat64Number *Pt; cmsFloat64Number CHAD[] = { 0, .1, .2, .3, .4, .5, .6, .7, .8 }; @@ -4561,11 +4554,11 @@ cmsInt32Number CheckCHAD(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSigna switch (Pass) { case 1: - return cmsWriteTag(DbgThread(), hProfile, tag, CHAD); + return cmsWriteTag(ContextID, hProfile, tag, CHAD); case 2: - Pt = (cmsFloat64Number *) cmsReadTag(DbgThread(), hProfile, tag); + Pt = (cmsFloat64Number *) cmsReadTag(ContextID, hProfile, tag); if (Pt == NULL) return 0; for (i=0; i < 9; i++) { @@ -4580,18 +4573,18 @@ cmsInt32Number CheckCHAD(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSigna } static -cmsInt32Number CheckChromaticity(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSignature tag) +cmsInt32Number CheckChromaticity(cmsContext ContextID, cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSignature tag) { cmsCIExyYTRIPLE *Pt, c = { {0, .1, 1 }, { .3, .4, 1 }, { .6, .7, 1 }}; switch (Pass) { case 1: - return cmsWriteTag(DbgThread(), hProfile, tag, &c); + return cmsWriteTag(ContextID, hProfile, tag, &c); case 2: - Pt = (cmsCIExyYTRIPLE *) cmsReadTag(DbgThread(), hProfile, tag); + Pt = (cmsCIExyYTRIPLE *) cmsReadTag(ContextID, hProfile, tag); if (Pt == NULL) return 0; if (!IsGoodFixed15_16("xyY", Pt ->Red.x, c.Red.x)) return 0; @@ -4609,7 +4602,7 @@ cmsInt32Number CheckChromaticity(cmsInt32Number Pass, cmsHPROFILE hProfile, cms static -cmsInt32Number CheckColorantOrder(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSignature tag) +cmsInt32Number CheckColorantOrder(cmsContext ContextID, cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSignature tag) { cmsUInt8Number *Pt, c[cmsMAXCHANNELS]; cmsInt32Number i; @@ -4618,11 +4611,11 @@ cmsInt32Number CheckColorantOrder(cmsInt32Number Pass, cmsHPROFILE hProfile, cm case 1: for (i=0; i < cmsMAXCHANNELS; i++) c[i] = (cmsUInt8Number) (cmsMAXCHANNELS - i - 1); - return cmsWriteTag(DbgThread(), hProfile, tag, c); + return cmsWriteTag(ContextID, hProfile, tag, c); case 2: - Pt = (cmsUInt8Number *) cmsReadTag(DbgThread(), hProfile, tag); + Pt = (cmsUInt8Number *) cmsReadTag(ContextID, hProfile, tag); if (Pt == NULL) return 0; for (i=0; i < cmsMAXCHANNELS; i++) { @@ -4636,7 +4629,7 @@ cmsInt32Number CheckColorantOrder(cmsInt32Number Pass, cmsHPROFILE hProfile, cm } static -cmsInt32Number CheckMeasurement(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSignature tag) +cmsInt32Number CheckMeasurement(cmsContext ContextID, cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSignature tag) { cmsICCMeasurementConditions *Pt, m; @@ -4650,11 +4643,11 @@ cmsInt32Number CheckMeasurement(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsT m.Geometry = 1; m.IlluminantType = cmsILLUMINANT_TYPE_D50; m.Observer = 1; - return cmsWriteTag(DbgThread(), hProfile, tag, &m); + return cmsWriteTag(ContextID, hProfile, tag, &m); case 2: - Pt = (cmsICCMeasurementConditions *) cmsReadTag(DbgThread(), hProfile, tag); + Pt = (cmsICCMeasurementConditions *) cmsReadTag(ContextID, hProfile, tag); if (Pt == NULL) return 0; if (!IsGoodFixed15_16("Backing", Pt ->Backing.X, 0.1)) return 0; @@ -4674,7 +4667,7 @@ cmsInt32Number CheckMeasurement(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsT static -cmsInt32Number CheckUcrBg(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSignature tag) +cmsInt32Number CheckUcrBg(cmsContext ContextID, cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSignature tag) { cmsUcrBg *Pt, m; cmsInt32Number rc; @@ -4683,22 +4676,22 @@ cmsInt32Number CheckUcrBg(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSign switch (Pass) { case 1: - m.Ucr = cmsBuildGamma(DbgThread(), 2.4); - m.Bg = cmsBuildGamma(DbgThread(), -2.2); - m.Desc = cmsMLUalloc(DbgThread(), 1); - cmsMLUsetASCII(DbgThread(), m.Desc, cmsNoLanguage, cmsNoCountry, "test UCR/BG"); - rc = cmsWriteTag(DbgThread(), hProfile, tag, &m); - cmsMLUfree(DbgThread(), m.Desc); - cmsFreeToneCurve(DbgThread(), m.Bg); - cmsFreeToneCurve(DbgThread(), m.Ucr); + m.Ucr = cmsBuildGamma(ContextID, 2.4); + m.Bg = cmsBuildGamma(ContextID, -2.2); + m.Desc = cmsMLUalloc(ContextID, 1); + cmsMLUsetASCII(ContextID, m.Desc, cmsNoLanguage, cmsNoCountry, "test UCR/BG"); + rc = cmsWriteTag(ContextID, hProfile, tag, &m); + cmsMLUfree(ContextID, m.Desc); + cmsFreeToneCurve(ContextID, m.Bg); + cmsFreeToneCurve(ContextID, m.Ucr); return rc; case 2: - Pt = (cmsUcrBg *) cmsReadTag(DbgThread(), hProfile, tag); + Pt = (cmsUcrBg *) cmsReadTag(ContextID, hProfile, tag); if (Pt == NULL) return 0; - cmsMLUgetASCII(DbgThread(), Pt ->Desc, cmsNoLanguage, cmsNoCountry, Buffer, 256); + cmsMLUgetASCII(ContextID, Pt ->Desc, cmsNoLanguage, cmsNoCountry, Buffer, 256); if (strcmp(Buffer, "test UCR/BG") != 0) return 0; return 1; @@ -4709,7 +4702,7 @@ cmsInt32Number CheckUcrBg(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSign static -cmsInt32Number CheckCRDinfo(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSignature tag) +cmsInt32Number CheckCRDinfo(cmsContext ContextID, cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSignature tag) { cmsMLU *mlu; char Buffer[256]; @@ -4718,41 +4711,41 @@ cmsInt32Number CheckCRDinfo(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSi switch (Pass) { case 1: - mlu = cmsMLUalloc(DbgThread(), 5); - - cmsMLUsetWide(DbgThread(), mlu, "PS", "nm", L"test postscript"); - cmsMLUsetWide(DbgThread(), mlu, "PS", "#0", L"perceptual"); - cmsMLUsetWide(DbgThread(), mlu, "PS", "#1", L"relative_colorimetric"); - cmsMLUsetWide(DbgThread(), mlu, "PS", "#2", L"saturation"); - cmsMLUsetWide(DbgThread(), mlu, "PS", "#3", L"absolute_colorimetric"); - rc = cmsWriteTag(DbgThread(), hProfile, tag, mlu); - cmsMLUfree(DbgThread(), mlu); + mlu = cmsMLUalloc(ContextID, 5); + + cmsMLUsetWide(ContextID, mlu, "PS", "nm", L"test postscript"); + cmsMLUsetWide(ContextID, mlu, "PS", "#0", L"perceptual"); + cmsMLUsetWide(ContextID, mlu, "PS", "#1", L"relative_colorimetric"); + cmsMLUsetWide(ContextID, mlu, "PS", "#2", L"saturation"); + cmsMLUsetWide(ContextID, mlu, "PS", "#3", L"absolute_colorimetric"); + rc = cmsWriteTag(ContextID, hProfile, tag, mlu); + cmsMLUfree(ContextID, mlu); return rc; case 2: - mlu = (cmsMLU*) cmsReadTag(DbgThread(), hProfile, tag); + mlu = (cmsMLU*) cmsReadTag(ContextID, hProfile, tag); if (mlu == NULL) return 0; - cmsMLUgetASCII(DbgThread(), mlu, "PS", "nm", Buffer, 256); + cmsMLUgetASCII(ContextID, mlu, "PS", "nm", Buffer, 256); if (strcmp(Buffer, "test postscript") != 0) return 0; - cmsMLUgetASCII(DbgThread(), mlu, "PS", "#0", Buffer, 256); + cmsMLUgetASCII(ContextID, mlu, "PS", "#0", Buffer, 256); if (strcmp(Buffer, "perceptual") != 0) return 0; - cmsMLUgetASCII(DbgThread(), mlu, "PS", "#1", Buffer, 256); + cmsMLUgetASCII(ContextID, mlu, "PS", "#1", Buffer, 256); if (strcmp(Buffer, "relative_colorimetric") != 0) return 0; - cmsMLUgetASCII(DbgThread(), mlu, "PS", "#2", Buffer, 256); + cmsMLUgetASCII(ContextID, mlu, "PS", "#2", Buffer, 256); if (strcmp(Buffer, "saturation") != 0) return 0; - cmsMLUgetASCII(DbgThread(), mlu, "PS", "#3", Buffer, 256); + cmsMLUgetASCII(ContextID, mlu, "PS", "#3", Buffer, 256); if (strcmp(Buffer, "absolute_colorimetric") != 0) return 0; return 1; @@ -4763,7 +4756,7 @@ cmsInt32Number CheckCRDinfo(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSi static -cmsToneCurve *CreateSegmentedCurve(void) +cmsToneCurve *CreateSegmentedCurve(cmsContext ContextID) { cmsCurveSegment Seg[3]; cmsFloat32Number Sampled[2] = { 0, 1}; @@ -4790,12 +4783,12 @@ cmsToneCurve *CreateSegmentedCurve(void) Seg[2].x0 = 1; Seg[2].x1 = 1E22F; - return cmsBuildSegmentedToneCurve(DbgThread(), 3, Seg); + return cmsBuildSegmentedToneCurve(ContextID, 3, Seg); } static -cmsInt32Number CheckMPE(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSignature tag) +cmsInt32Number CheckMPE(cmsContext ContextID, cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSignature tag) { cmsPipeline* Lut, *Pt; cmsToneCurve* G[3]; @@ -4805,24 +4798,24 @@ cmsInt32Number CheckMPE(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSignat case 1: - Lut = cmsPipelineAlloc(DbgThread(), 3, 3); + Lut = cmsPipelineAlloc(ContextID, 3, 3); - cmsPipelineInsertStage(DbgThread(), Lut, cmsAT_BEGIN, _cmsStageAllocLabV2ToV4(DbgThread())); - cmsPipelineInsertStage(DbgThread(), Lut, cmsAT_END, _cmsStageAllocLabV4ToV2(DbgThread())); - AddIdentityCLUTfloat(Lut); + cmsPipelineInsertStage(ContextID, Lut, cmsAT_BEGIN, _cmsStageAllocLabV2ToV4(ContextID)); + cmsPipelineInsertStage(ContextID, Lut, cmsAT_END, _cmsStageAllocLabV4ToV2(ContextID)); + AddIdentityCLUTfloat(ContextID, Lut); - G[0] = G[1] = G[2] = CreateSegmentedCurve(); - cmsPipelineInsertStage(DbgThread(), Lut, cmsAT_END, cmsStageAllocToneCurves(DbgThread(), 3, G)); - cmsFreeToneCurve(DbgThread(), G[0]); + G[0] = G[1] = G[2] = CreateSegmentedCurve(ContextID); + cmsPipelineInsertStage(ContextID, Lut, cmsAT_END, cmsStageAllocToneCurves(ContextID, 3, G)); + cmsFreeToneCurve(ContextID, G[0]); - rc = cmsWriteTag(DbgThread(), hProfile, tag, Lut); - cmsPipelineFree(DbgThread(), Lut); + rc = cmsWriteTag(ContextID, hProfile, tag, Lut); + cmsPipelineFree(ContextID, Lut); return rc; case 2: - Pt = (cmsPipeline *) cmsReadTag(DbgThread(), hProfile, tag); + Pt = (cmsPipeline *) cmsReadTag(ContextID, hProfile, tag); if (Pt == NULL) return 0; - return CheckFloatLUT(Pt); + return CheckFloatLUT(ContextID, Pt); default: return 0; @@ -4831,7 +4824,7 @@ cmsInt32Number CheckMPE(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSignat static -cmsInt32Number CheckScreening(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSignature tag) +cmsInt32Number CheckScreening(cmsContext ContextID, cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTagSignature tag) { cmsScreening *Pt, sc; cmsInt32Number rc; @@ -4846,12 +4839,12 @@ cmsInt32Number CheckScreening(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTag sc.Channels[0].ScreenAngle = 3.0; sc.Channels[0].SpotShape = cmsSPOT_ELLIPSE; - rc = cmsWriteTag(DbgThread(), hProfile, tag, &sc); + rc = cmsWriteTag(ContextID, hProfile, tag, &sc); return rc; case 2: - Pt = (cmsScreening *) cmsReadTag(DbgThread(), hProfile, tag); + Pt = (cmsScreening *) cmsReadTag(ContextID, hProfile, tag); if (Pt == NULL) return 0; if (Pt ->nChannels != 1) return 0; @@ -4868,17 +4861,17 @@ cmsInt32Number CheckScreening(cmsInt32Number Pass, cmsHPROFILE hProfile, cmsTag static -cmsBool CheckOneStr(cmsMLU* mlu, cmsInt32Number n) +cmsBool CheckOneStr(cmsContext ContextID, cmsMLU* mlu, cmsInt32Number n) { char Buffer[256], Buffer2[256]; - cmsMLUgetASCII(DbgThread(), mlu, "en", "US", Buffer, 255); + cmsMLUgetASCII(ContextID, mlu, "en", "US", Buffer, 255); sprintf(Buffer2, "Hello, world %d", n); if (strcmp(Buffer, Buffer2) != 0) return FALSE; - cmsMLUgetASCII(DbgThread(), mlu, "es", "ES", Buffer, 255); + cmsMLUgetASCII(ContextID, mlu, "es", "ES", Buffer, 255); sprintf(Buffer2, "Hola, mundo %d", n); if (strcmp(Buffer, Buffer2) != 0) return FALSE; @@ -4887,16 +4880,16 @@ cmsBool CheckOneStr(cmsMLU* mlu, cmsInt32Number n) static -void SetOneStr(cmsMLU** mlu, wchar_t* s1, wchar_t* s2) +void SetOneStr(cmsContext ContextID, cmsMLU** mlu, wchar_t* s1, wchar_t* s2) { - *mlu = cmsMLUalloc(DbgThread(), 0); - cmsMLUsetWide(DbgThread(), *mlu, "en", "US", s1); - cmsMLUsetWide(DbgThread(), *mlu, "es", "ES", s2); + *mlu = cmsMLUalloc(ContextID, 0); + cmsMLUsetWide(ContextID, *mlu, "en", "US", s1); + cmsMLUsetWide(ContextID, *mlu, "es", "ES", s2); } static -cmsInt32Number CheckProfileSequenceTag(cmsInt32Number Pass, cmsHPROFILE hProfile) +cmsInt32Number CheckProfileSequenceTag(cmsContext ContextID, cmsInt32Number Pass, cmsHPROFILE hProfile) { cmsSEQ* s; cmsInt32Number i; @@ -4905,15 +4898,15 @@ cmsInt32Number CheckProfileSequenceTag(cmsInt32Number Pass, cmsHPROFILE hProfil case 1: - s = cmsAllocProfileSequenceDescription(DbgThread(), 3); + s = cmsAllocProfileSequenceDescription(ContextID, 3); if (s == NULL) return 0; - SetOneStr(&s -> seq[0].Manufacturer, L"Hello, world 0", L"Hola, mundo 0"); - SetOneStr(&s -> seq[0].Model, L"Hello, world 0", L"Hola, mundo 0"); - SetOneStr(&s -> seq[1].Manufacturer, L"Hello, world 1", L"Hola, mundo 1"); - SetOneStr(&s -> seq[1].Model, L"Hello, world 1", L"Hola, mundo 1"); - SetOneStr(&s -> seq[2].Manufacturer, L"Hello, world 2", L"Hola, mundo 2"); - SetOneStr(&s -> seq[2].Model, L"Hello, world 2", L"Hola, mundo 2"); + SetOneStr(ContextID, &s -> seq[0].Manufacturer, L"Hello, world 0", L"Hola, mundo 0"); + SetOneStr(ContextID, &s -> seq[0].Model, L"Hello, world 0", L"Hola, mundo 0"); + SetOneStr(ContextID, &s -> seq[1].Manufacturer, L"Hello, world 1", L"Hola, mundo 1"); + SetOneStr(ContextID, &s -> seq[1].Model, L"Hello, world 1", L"Hola, mundo 1"); + SetOneStr(ContextID, &s -> seq[2].Manufacturer, L"Hello, world 2", L"Hola, mundo 2"); + SetOneStr(ContextID, &s -> seq[2].Model, L"Hello, world 2", L"Hola, mundo 2"); #ifdef CMS_DONT_USE_INT64 @@ -4937,13 +4930,13 @@ cmsInt32Number CheckProfileSequenceTag(cmsInt32Number Pass, cmsHPROFILE hProfil s ->seq[2].attributes = cmsTransparency|cmsGlossy; #endif - if (!cmsWriteTag(DbgThread(), hProfile, cmsSigProfileSequenceDescTag, s)) return 0; - cmsFreeProfileSequenceDescription(DbgThread(), s); + if (!cmsWriteTag(ContextID, hProfile, cmsSigProfileSequenceDescTag, s)) return 0; + cmsFreeProfileSequenceDescription(ContextID, s); return 1; case 2: - s = (cmsSEQ *) cmsReadTag(DbgThread(), hProfile, cmsSigProfileSequenceDescTag); + s = (cmsSEQ *) cmsReadTag(ContextID, hProfile, cmsSigProfileSequenceDescTag); if (s == NULL) return 0; if (s ->n != 3) return 0; @@ -4972,8 +4965,8 @@ cmsInt32Number CheckProfileSequenceTag(cmsInt32Number Pass, cmsHPROFILE hProfil // Check MLU for (i=0; i < 3; i++) { - if (!CheckOneStr(s -> seq[i].Manufacturer, i)) return 0; - if (!CheckOneStr(s -> seq[i].Model, i)) return 0; + if (!CheckOneStr(ContextID, s -> seq[i].Manufacturer, i)) return 0; + if (!CheckOneStr(ContextID, s -> seq[i].Model, i)) return 0; } return 1; @@ -4984,7 +4977,7 @@ cmsInt32Number CheckProfileSequenceTag(cmsInt32Number Pass, cmsHPROFILE hProfil static -cmsInt32Number CheckProfileSequenceIDTag(cmsInt32Number Pass, cmsHPROFILE hProfile) +cmsInt32Number CheckProfileSequenceIDTag(cmsContext ContextID, cmsInt32Number Pass, cmsHPROFILE hProfile) { cmsSEQ* s; cmsInt32Number i; @@ -4993,7 +4986,7 @@ cmsInt32Number CheckProfileSequenceIDTag(cmsInt32Number Pass, cmsHPROFILE hProf case 1: - s = cmsAllocProfileSequenceDescription(DbgThread(), 3); + s = cmsAllocProfileSequenceDescription(ContextID, 3); if (s == NULL) return 0; memcpy(s ->seq[0].ProfileID.ID8, "0123456789ABCDEF", 16); @@ -5001,17 +4994,17 @@ cmsInt32Number CheckProfileSequenceIDTag(cmsInt32Number Pass, cmsHPROFILE hProf memcpy(s ->seq[2].ProfileID.ID8, "2222222222222222", 16); - SetOneStr(&s -> seq[0].Description, L"Hello, world 0", L"Hola, mundo 0"); - SetOneStr(&s -> seq[1].Description, L"Hello, world 1", L"Hola, mundo 1"); - SetOneStr(&s -> seq[2].Description, L"Hello, world 2", L"Hola, mundo 2"); + SetOneStr(ContextID, &s -> seq[0].Description, L"Hello, world 0", L"Hola, mundo 0"); + SetOneStr(ContextID, &s -> seq[1].Description, L"Hello, world 1", L"Hola, mundo 1"); + SetOneStr(ContextID, &s -> seq[2].Description, L"Hello, world 2", L"Hola, mundo 2"); - if (!cmsWriteTag(DbgThread(), hProfile, cmsSigProfileSequenceIdTag, s)) return 0; - cmsFreeProfileSequenceDescription(DbgThread(), s); + if (!cmsWriteTag(ContextID, hProfile, cmsSigProfileSequenceIdTag, s)) return 0; + cmsFreeProfileSequenceDescription(ContextID, s); return 1; case 2: - s = (cmsSEQ *) cmsReadTag(DbgThread(), hProfile, cmsSigProfileSequenceIdTag); + s = (cmsSEQ *) cmsReadTag(ContextID, hProfile, cmsSigProfileSequenceIdTag); if (s == NULL) return 0; if (s ->n != 3) return 0; @@ -5022,7 +5015,7 @@ cmsInt32Number CheckProfileSequenceIDTag(cmsInt32Number Pass, cmsHPROFILE hProf for (i=0; i < 3; i++) { - if (!CheckOneStr(s -> seq[i].Description, i)) return 0; + if (!CheckOneStr(ContextID, s -> seq[i].Description, i)) return 0; } return 1; @@ -5034,7 +5027,7 @@ cmsInt32Number CheckProfileSequenceIDTag(cmsInt32Number Pass, cmsHPROFILE hProf static -cmsInt32Number CheckICCViewingConditions(cmsInt32Number Pass, cmsHPROFILE hProfile) +cmsInt32Number CheckICCViewingConditions(cmsContext ContextID, cmsInt32Number Pass, cmsHPROFILE hProfile) { cmsICCViewingConditions* v; cmsICCViewingConditions s; @@ -5050,11 +5043,11 @@ cmsInt32Number CheckICCViewingConditions(cmsInt32Number Pass, cmsHPROFILE hProf s.SurroundXYZ.Y = 0.5; s.SurroundXYZ.Z = 0.6; - if (!cmsWriteTag(DbgThread(), hProfile, cmsSigViewingConditionsTag, &s)) return 0; + if (!cmsWriteTag(ContextID, hProfile, cmsSigViewingConditionsTag, &s)) return 0; return 1; case 2: - v = (cmsICCViewingConditions *) cmsReadTag(DbgThread(), hProfile, cmsSigViewingConditionsTag); + v = (cmsICCViewingConditions *) cmsReadTag(ContextID, hProfile, cmsSigViewingConditionsTag); if (v == NULL) return 0; if (v ->IlluminantType != 1) return 0; @@ -5076,7 +5069,7 @@ cmsInt32Number CheckICCViewingConditions(cmsInt32Number Pass, cmsHPROFILE hProf static -cmsInt32Number CheckVCGT(cmsInt32Number Pass, cmsHPROFILE hProfile) +cmsInt32Number CheckVCGT(cmsContext ContextID, cmsInt32Number Pass, cmsHPROFILE hProfile) { cmsToneCurve* Curves[3]; cmsToneCurve** PtrCurve; @@ -5084,23 +5077,23 @@ cmsInt32Number CheckVCGT(cmsInt32Number Pass, cmsHPROFILE hProfile) switch (Pass) { case 1: - Curves[0] = cmsBuildGamma(DbgThread(), 1.1); - Curves[1] = cmsBuildGamma(DbgThread(), 2.2); - Curves[2] = cmsBuildGamma(DbgThread(), 3.4); + Curves[0] = cmsBuildGamma(ContextID, 1.1); + Curves[1] = cmsBuildGamma(ContextID, 2.2); + Curves[2] = cmsBuildGamma(ContextID, 3.4); - if (!cmsWriteTag(DbgThread(), hProfile, cmsSigVcgtTag, Curves)) return 0; + if (!cmsWriteTag(ContextID, hProfile, cmsSigVcgtTag, Curves)) return 0; - cmsFreeToneCurveTriple(DbgThread(), Curves); + cmsFreeToneCurveTriple(ContextID, Curves); return 1; case 2: - PtrCurve = (cmsToneCurve **) cmsReadTag(DbgThread(), hProfile, cmsSigVcgtTag); + PtrCurve = (cmsToneCurve **) cmsReadTag(ContextID, hProfile, cmsSigVcgtTag); if (PtrCurve == NULL) return 0; - if (!IsGoodVal("VCGT R", cmsEstimateGamma(DbgThread(), PtrCurve[0], 0.01), 1.1, 0.001)) return 0; - if (!IsGoodVal("VCGT G", cmsEstimateGamma(DbgThread(), PtrCurve[1], 0.01), 2.2, 0.001)) return 0; - if (!IsGoodVal("VCGT B", cmsEstimateGamma(DbgThread(), PtrCurve[2], 0.01), 3.4, 0.001)) return 0; + if (!IsGoodVal("VCGT R", cmsEstimateGamma(ContextID, PtrCurve[0], 0.01), 1.1, 0.001)) return 0; + if (!IsGoodVal("VCGT G", cmsEstimateGamma(ContextID, PtrCurve[1], 0.01), 2.2, 0.001)) return 0; + if (!IsGoodVal("VCGT B", cmsEstimateGamma(ContextID, PtrCurve[2], 0.01), 3.4, 0.001)) return 0; return 1; default:; @@ -5112,38 +5105,38 @@ cmsInt32Number CheckVCGT(cmsInt32Number Pass, cmsHPROFILE hProfile) // Only one of the two following may be used, as they share the same tag static -cmsInt32Number CheckDictionary16(cmsInt32Number Pass, cmsHPROFILE hProfile) +cmsInt32Number CheckDictionary16(cmsContext ContextID, cmsInt32Number Pass, cmsHPROFILE hProfile) { cmsHANDLE hDict; const cmsDICTentry* e; switch (Pass) { case 1: - hDict = cmsDictAlloc(DbgThread()); - cmsDictAddEntry(DbgThread(), hDict, L"Name0", NULL, NULL, NULL); - cmsDictAddEntry(DbgThread(), hDict, L"Name1", L"", NULL, NULL); - cmsDictAddEntry(DbgThread(), hDict, L"Name", L"String", NULL, NULL); - cmsDictAddEntry(DbgThread(), hDict, L"Name2", L"12", NULL, NULL); - if (!cmsWriteTag(DbgThread(), hProfile, cmsSigMetaTag, hDict)) return 0; - cmsDictFree(DbgThread(), hDict); + hDict = cmsDictAlloc(ContextID); + cmsDictAddEntry(ContextID, hDict, L"Name0", NULL, NULL, NULL); + cmsDictAddEntry(ContextID, hDict, L"Name1", L"", NULL, NULL); + cmsDictAddEntry(ContextID, hDict, L"Name", L"String", NULL, NULL); + cmsDictAddEntry(ContextID, hDict, L"Name2", L"12", NULL, NULL); + if (!cmsWriteTag(ContextID, hProfile, cmsSigMetaTag, hDict)) return 0; + cmsDictFree(ContextID, hDict); return 1; case 2: - hDict = cmsReadTag(DbgThread(), hProfile, cmsSigMetaTag); + hDict = cmsReadTag(ContextID, hProfile, cmsSigMetaTag); if (hDict == NULL) return 0; - e = cmsDictGetEntryList(DbgThread(), hDict); + e = cmsDictGetEntryList(ContextID, hDict); if (memcmp(e ->Name, L"Name2", sizeof(wchar_t) * 5) != 0) return 0; if (memcmp(e ->Value, L"12", sizeof(wchar_t) * 2) != 0) return 0; - e = cmsDictNextEntry(DbgThread(), e); + e = cmsDictNextEntry(ContextID, e); if (memcmp(e ->Name, L"Name", sizeof(wchar_t) * 4) != 0) return 0; if (memcmp(e ->Value, L"String", sizeof(wchar_t) * 5) != 0) return 0; - e = cmsDictNextEntry(DbgThread(), e); + e = cmsDictNextEntry(ContextID, e); if (memcmp(e ->Name, L"Name1", sizeof(wchar_t) *5) != 0) return 0; if (e ->Value == NULL) return 0; if (*e->Value != 0) return 0; - e = cmsDictNextEntry(DbgThread(), e); + e = cmsDictNextEntry(ContextID, e); if (memcmp(e ->Name, L"Name0", sizeof(wchar_t) * 5) != 0) return 0; if (e ->Value != NULL) return 0; return 1; @@ -5158,7 +5151,7 @@ cmsInt32Number CheckDictionary16(cmsInt32Number Pass, cmsHPROFILE hProfile) static -cmsInt32Number CheckDictionary24(cmsInt32Number Pass, cmsHPROFILE hProfile) +cmsInt32Number CheckDictionary24(cmsContext ContextID, cmsInt32Number Pass, cmsHPROFILE hProfile) { cmsHANDLE hDict; const cmsDICTentry* e; @@ -5169,50 +5162,50 @@ cmsInt32Number CheckDictionary24(cmsInt32Number Pass, cmsHPROFILE hProfile) switch (Pass) { case 1: - hDict = cmsDictAlloc(DbgThread()); + hDict = cmsDictAlloc(ContextID); - DisplayName = cmsMLUalloc(DbgThread(), 0); + DisplayName = cmsMLUalloc(ContextID, 0); - cmsMLUsetWide(DbgThread(), DisplayName, "en", "US", L"Hello, world"); - cmsMLUsetWide(DbgThread(), DisplayName, "es", "ES", L"Hola, mundo"); - cmsMLUsetWide(DbgThread(), DisplayName, "fr", "FR", L"Bonjour, le monde"); - cmsMLUsetWide(DbgThread(), DisplayName, "ca", "CA", L"Hola, mon"); + cmsMLUsetWide(ContextID, DisplayName, "en", "US", L"Hello, world"); + cmsMLUsetWide(ContextID, DisplayName, "es", "ES", L"Hola, mundo"); + cmsMLUsetWide(ContextID, DisplayName, "fr", "FR", L"Bonjour, le monde"); + cmsMLUsetWide(ContextID, DisplayName, "ca", "CA", L"Hola, mon"); - cmsDictAddEntry(DbgThread(), hDict, L"Name", L"String", DisplayName, NULL); - cmsMLUfree(DbgThread(), DisplayName); + cmsDictAddEntry(ContextID, hDict, L"Name", L"String", DisplayName, NULL); + cmsMLUfree(ContextID, DisplayName); - cmsDictAddEntry(DbgThread(), hDict, L"Name2", L"12", NULL, NULL); - if (!cmsWriteTag(DbgThread(), hProfile, cmsSigMetaTag, hDict)) return 0; - cmsDictFree(DbgThread(), hDict); + cmsDictAddEntry(ContextID, hDict, L"Name2", L"12", NULL, NULL); + if (!cmsWriteTag(ContextID, hProfile, cmsSigMetaTag, hDict)) return 0; + cmsDictFree(ContextID, hDict); return 1; case 2: - hDict = cmsReadTag(DbgThread(), hProfile, cmsSigMetaTag); + hDict = cmsReadTag(ContextID, hProfile, cmsSigMetaTag); if (hDict == NULL) return 0; - e = cmsDictGetEntryList(DbgThread(), hDict); + e = cmsDictGetEntryList(ContextID, hDict); if (memcmp(e ->Name, L"Name2", sizeof(wchar_t) * 5) != 0) return 0; if (memcmp(e ->Value, L"12", sizeof(wchar_t) * 2) != 0) return 0; - e = cmsDictNextEntry(DbgThread(), e); + e = cmsDictNextEntry(ContextID, e); if (memcmp(e ->Name, L"Name", sizeof(wchar_t) * 4) != 0) return 0; if (memcmp(e ->Value, L"String", sizeof(wchar_t) * 5) != 0) return 0; - cmsMLUgetASCII(DbgThread(), e->DisplayName, "en", "US", Buffer, 256); + cmsMLUgetASCII(ContextID, e->DisplayName, "en", "US", Buffer, 256); if (strcmp(Buffer, "Hello, world") != 0) rc = 0; - cmsMLUgetASCII(DbgThread(), e->DisplayName, "es", "ES", Buffer, 256); + cmsMLUgetASCII(ContextID, e->DisplayName, "es", "ES", Buffer, 256); if (strcmp(Buffer, "Hola, mundo") != 0) rc = 0; - cmsMLUgetASCII(DbgThread(), e->DisplayName, "fr", "FR", Buffer, 256); + cmsMLUgetASCII(ContextID, e->DisplayName, "fr", "FR", Buffer, 256); if (strcmp(Buffer, "Bonjour, le monde") != 0) rc = 0; - cmsMLUgetASCII(DbgThread(), e->DisplayName, "ca", "CA", Buffer, 256); + cmsMLUgetASCII(ContextID, e->DisplayName, "ca", "CA", Buffer, 256); if (strcmp(Buffer, "Hola, mon") != 0) rc = 0; if (rc == 0) @@ -5226,17 +5219,17 @@ cmsInt32Number CheckDictionary24(cmsInt32Number Pass, cmsHPROFILE hProfile) } static -cmsInt32Number CheckRAWtags(cmsInt32Number Pass, cmsHPROFILE hProfile) +cmsInt32Number CheckRAWtags(cmsContext ContextID, cmsInt32Number Pass, cmsHPROFILE hProfile) { char Buffer[7]; switch (Pass) { case 1: - return cmsWriteRawTag(DbgThread(), hProfile, (cmsTagSignature) 0x31323334, "data123", 7); + return cmsWriteRawTag(ContextID, hProfile, (cmsTagSignature) 0x31323334, "data123", 7); case 2: - if (!cmsReadRawTag(DbgThread(), hProfile, (cmsTagSignature) 0x31323334, Buffer, 7)) return 0; + if (!cmsReadRawTag(ContextID, hProfile, (cmsTagSignature) 0x31323334, Buffer, 7)) return 0; if (strncmp(Buffer, "data123", 7) != 0) return 0; return 1; @@ -5249,153 +5242,153 @@ cmsInt32Number CheckRAWtags(cmsInt32Number Pass, cmsHPROFILE hProfile) // This is a very big test that checks every single tag static -cmsInt32Number CheckProfileCreation(void) +cmsInt32Number CheckProfileCreation(cmsContext ContextID) { cmsHPROFILE h; cmsInt32Number Pass; - h = cmsCreateProfilePlaceholder(DbgThread()); + h = cmsCreateProfilePlaceholder(ContextID); if (h == NULL) return 0; - cmsSetProfileVersion(DbgThread(), h, 4.3); - if (cmsGetTagCount(DbgThread(), h) != 0) { Fail("Empty profile with nonzero number of tags"); goto Error; } - if (cmsIsTag(DbgThread(), h, cmsSigAToB0Tag)) { Fail("Found a tag in an empty profile"); goto Error; } + cmsSetProfileVersion(ContextID, h, 4.3); + if (cmsGetTagCount(ContextID, h) != 0) { Fail("Empty profile with nonzero number of tags"); goto Error; } + if (cmsIsTag(ContextID, h, cmsSigAToB0Tag)) { Fail("Found a tag in an empty profile"); goto Error; } - cmsSetColorSpace(DbgThread(), h, cmsSigRgbData); - if (cmsGetColorSpace(DbgThread(), h) != cmsSigRgbData) { Fail("Unable to set colorspace"); goto Error; } + cmsSetColorSpace(ContextID, h, cmsSigRgbData); + if (cmsGetColorSpace(ContextID, h) != cmsSigRgbData) { Fail("Unable to set colorspace"); goto Error; } - cmsSetPCS(DbgThread(), h, cmsSigLabData); - if (cmsGetPCS(DbgThread(), h) != cmsSigLabData) { Fail("Unable to set colorspace"); goto Error; } + cmsSetPCS(ContextID, h, cmsSigLabData); + if (cmsGetPCS(ContextID, h) != cmsSigLabData) { Fail("Unable to set colorspace"); goto Error; } - cmsSetDeviceClass(DbgThread(), h, cmsSigDisplayClass); - if (cmsGetDeviceClass(DbgThread(), h) != cmsSigDisplayClass) { Fail("Unable to set deviceclass"); goto Error; } + cmsSetDeviceClass(ContextID, h, cmsSigDisplayClass); + if (cmsGetDeviceClass(ContextID, h) != cmsSigDisplayClass) { Fail("Unable to set deviceclass"); goto Error; } - cmsSetHeaderRenderingIntent(DbgThread(), h, INTENT_SATURATION); - if (cmsGetHeaderRenderingIntent(DbgThread(), h) != INTENT_SATURATION) { Fail("Unable to set rendering intent"); goto Error; } + cmsSetHeaderRenderingIntent(ContextID, h, INTENT_SATURATION); + if (cmsGetHeaderRenderingIntent(ContextID, h) != INTENT_SATURATION) { Fail("Unable to set rendering intent"); goto Error; } for (Pass = 1; Pass <= 2; Pass++) { SubTest("Tags holding XYZ"); - if (!CheckXYZ(Pass, h, cmsSigBlueColorantTag)) goto Error; - if (!CheckXYZ(Pass, h, cmsSigGreenColorantTag)) goto Error; - if (!CheckXYZ(Pass, h, cmsSigRedColorantTag)) goto Error; - if (!CheckXYZ(Pass, h, cmsSigMediaBlackPointTag)) goto Error; - if (!CheckXYZ(Pass, h, cmsSigMediaWhitePointTag)) goto Error; - if (!CheckXYZ(Pass, h, cmsSigLuminanceTag)) goto Error; + if (!CheckXYZ(ContextID, Pass, h, cmsSigBlueColorantTag)) goto Error; + if (!CheckXYZ(ContextID, Pass, h, cmsSigGreenColorantTag)) goto Error; + if (!CheckXYZ(ContextID, Pass, h, cmsSigRedColorantTag)) goto Error; + if (!CheckXYZ(ContextID, Pass, h, cmsSigMediaBlackPointTag)) goto Error; + if (!CheckXYZ(ContextID, Pass, h, cmsSigMediaWhitePointTag)) goto Error; + if (!CheckXYZ(ContextID, Pass, h, cmsSigLuminanceTag)) goto Error; SubTest("Tags holding curves"); - if (!CheckGamma(Pass, h, cmsSigBlueTRCTag)) goto Error; - if (!CheckGamma(Pass, h, cmsSigGrayTRCTag)) goto Error; - if (!CheckGamma(Pass, h, cmsSigGreenTRCTag)) goto Error; - if (!CheckGamma(Pass, h, cmsSigRedTRCTag)) goto Error; + if (!CheckGamma(ContextID, Pass, h, cmsSigBlueTRCTag)) goto Error; + if (!CheckGamma(ContextID, Pass, h, cmsSigGrayTRCTag)) goto Error; + if (!CheckGamma(ContextID, Pass, h, cmsSigGreenTRCTag)) goto Error; + if (!CheckGamma(ContextID, Pass, h, cmsSigRedTRCTag)) goto Error; SubTest("Tags holding text"); - if (!CheckTextSingle(Pass, h, cmsSigCharTargetTag)) goto Error; - if (!CheckTextSingle(Pass, h, cmsSigScreeningDescTag)) goto Error; + if (!CheckTextSingle(ContextID, Pass, h, cmsSigCharTargetTag)) goto Error; + if (!CheckTextSingle(ContextID, Pass, h, cmsSigScreeningDescTag)) goto Error; - if (!CheckText(Pass, h, cmsSigCopyrightTag)) goto Error; - if (!CheckText(Pass, h, cmsSigProfileDescriptionTag)) goto Error; - if (!CheckText(Pass, h, cmsSigDeviceMfgDescTag)) goto Error; - if (!CheckText(Pass, h, cmsSigDeviceModelDescTag)) goto Error; - if (!CheckText(Pass, h, cmsSigViewingCondDescTag)) goto Error; + if (!CheckText(ContextID, Pass, h, cmsSigCopyrightTag)) goto Error; + if (!CheckText(ContextID, Pass, h, cmsSigProfileDescriptionTag)) goto Error; + if (!CheckText(ContextID, Pass, h, cmsSigDeviceMfgDescTag)) goto Error; + if (!CheckText(ContextID, Pass, h, cmsSigDeviceModelDescTag)) goto Error; + if (!CheckText(ContextID, Pass, h, cmsSigViewingCondDescTag)) goto Error; SubTest("Tags holding cmsICCData"); - if (!CheckData(Pass, h, cmsSigPs2CRD0Tag)) goto Error; - if (!CheckData(Pass, h, cmsSigPs2CRD1Tag)) goto Error; - if (!CheckData(Pass, h, cmsSigPs2CRD2Tag)) goto Error; - if (!CheckData(Pass, h, cmsSigPs2CRD3Tag)) goto Error; - if (!CheckData(Pass, h, cmsSigPs2CSATag)) goto Error; - if (!CheckData(Pass, h, cmsSigPs2RenderingIntentTag)) goto Error; + if (!CheckData(ContextID, Pass, h, cmsSigPs2CRD0Tag)) goto Error; + if (!CheckData(ContextID, Pass, h, cmsSigPs2CRD1Tag)) goto Error; + if (!CheckData(ContextID, Pass, h, cmsSigPs2CRD2Tag)) goto Error; + if (!CheckData(ContextID, Pass, h, cmsSigPs2CRD3Tag)) goto Error; + if (!CheckData(ContextID, Pass, h, cmsSigPs2CSATag)) goto Error; + if (!CheckData(ContextID, Pass, h, cmsSigPs2RenderingIntentTag)) goto Error; SubTest("Tags holding signatures"); - if (!CheckSignature(Pass, h, cmsSigColorimetricIntentImageStateTag)) goto Error; - if (!CheckSignature(Pass, h, cmsSigPerceptualRenderingIntentGamutTag)) goto Error; - if (!CheckSignature(Pass, h, cmsSigSaturationRenderingIntentGamutTag)) goto Error; - if (!CheckSignature(Pass, h, cmsSigTechnologyTag)) goto Error; + if (!CheckSignature(ContextID, Pass, h, cmsSigColorimetricIntentImageStateTag)) goto Error; + if (!CheckSignature(ContextID, Pass, h, cmsSigPerceptualRenderingIntentGamutTag)) goto Error; + if (!CheckSignature(ContextID, Pass, h, cmsSigSaturationRenderingIntentGamutTag)) goto Error; + if (!CheckSignature(ContextID, Pass, h, cmsSigTechnologyTag)) goto Error; SubTest("Tags holding date_time"); - if (!CheckDateTime(Pass, h, cmsSigCalibrationDateTimeTag)) goto Error; - if (!CheckDateTime(Pass, h, cmsSigDateTimeTag)) goto Error; + if (!CheckDateTime(ContextID, Pass, h, cmsSigCalibrationDateTimeTag)) goto Error; + if (!CheckDateTime(ContextID, Pass, h, cmsSigDateTimeTag)) goto Error; SubTest("Tags holding named color lists"); - if (!CheckNamedColor(Pass, h, cmsSigColorantTableTag, 15, FALSE)) goto Error; - if (!CheckNamedColor(Pass, h, cmsSigColorantTableOutTag, 15, FALSE)) goto Error; - if (!CheckNamedColor(Pass, h, cmsSigNamedColor2Tag, 4096, TRUE)) goto Error; + if (!CheckNamedColor(ContextID, Pass, h, cmsSigColorantTableTag, 15, FALSE)) goto Error; + if (!CheckNamedColor(ContextID, Pass, h, cmsSigColorantTableOutTag, 15, FALSE)) goto Error; + if (!CheckNamedColor(ContextID, Pass, h, cmsSigNamedColor2Tag, 4096, TRUE)) goto Error; SubTest("Tags holding LUTs"); - if (!CheckLUT(Pass, h, cmsSigAToB0Tag)) goto Error; - if (!CheckLUT(Pass, h, cmsSigAToB1Tag)) goto Error; - if (!CheckLUT(Pass, h, cmsSigAToB2Tag)) goto Error; - if (!CheckLUT(Pass, h, cmsSigBToA0Tag)) goto Error; - if (!CheckLUT(Pass, h, cmsSigBToA1Tag)) goto Error; - if (!CheckLUT(Pass, h, cmsSigBToA2Tag)) goto Error; - if (!CheckLUT(Pass, h, cmsSigPreview0Tag)) goto Error; - if (!CheckLUT(Pass, h, cmsSigPreview1Tag)) goto Error; - if (!CheckLUT(Pass, h, cmsSigPreview2Tag)) goto Error; - if (!CheckLUT(Pass, h, cmsSigGamutTag)) goto Error; + if (!CheckLUT(ContextID, Pass, h, cmsSigAToB0Tag)) goto Error; + if (!CheckLUT(ContextID, Pass, h, cmsSigAToB1Tag)) goto Error; + if (!CheckLUT(ContextID, Pass, h, cmsSigAToB2Tag)) goto Error; + if (!CheckLUT(ContextID, Pass, h, cmsSigBToA0Tag)) goto Error; + if (!CheckLUT(ContextID, Pass, h, cmsSigBToA1Tag)) goto Error; + if (!CheckLUT(ContextID, Pass, h, cmsSigBToA2Tag)) goto Error; + if (!CheckLUT(ContextID, Pass, h, cmsSigPreview0Tag)) goto Error; + if (!CheckLUT(ContextID, Pass, h, cmsSigPreview1Tag)) goto Error; + if (!CheckLUT(ContextID, Pass, h, cmsSigPreview2Tag)) goto Error; + if (!CheckLUT(ContextID, Pass, h, cmsSigGamutTag)) goto Error; SubTest("Tags holding CHAD"); - if (!CheckCHAD(Pass, h, cmsSigChromaticAdaptationTag)) goto Error; + if (!CheckCHAD(ContextID, Pass, h, cmsSigChromaticAdaptationTag)) goto Error; SubTest("Tags holding Chromaticity"); - if (!CheckChromaticity(Pass, h, cmsSigChromaticityTag)) goto Error; + if (!CheckChromaticity(ContextID, Pass, h, cmsSigChromaticityTag)) goto Error; SubTest("Tags holding colorant order"); - if (!CheckColorantOrder(Pass, h, cmsSigColorantOrderTag)) goto Error; + if (!CheckColorantOrder(ContextID, Pass, h, cmsSigColorantOrderTag)) goto Error; SubTest("Tags holding measurement"); - if (!CheckMeasurement(Pass, h, cmsSigMeasurementTag)) goto Error; + if (!CheckMeasurement(ContextID, Pass, h, cmsSigMeasurementTag)) goto Error; SubTest("Tags holding CRD info"); - if (!CheckCRDinfo(Pass, h, cmsSigCrdInfoTag)) goto Error; + if (!CheckCRDinfo(ContextID, Pass, h, cmsSigCrdInfoTag)) goto Error; SubTest("Tags holding UCR/BG"); - if (!CheckUcrBg(Pass, h, cmsSigUcrBgTag)) goto Error; + if (!CheckUcrBg(ContextID, Pass, h, cmsSigUcrBgTag)) goto Error; SubTest("Tags holding MPE"); - if (!CheckMPE(Pass, h, cmsSigDToB0Tag)) goto Error; - if (!CheckMPE(Pass, h, cmsSigDToB1Tag)) goto Error; - if (!CheckMPE(Pass, h, cmsSigDToB2Tag)) goto Error; - if (!CheckMPE(Pass, h, cmsSigDToB3Tag)) goto Error; - if (!CheckMPE(Pass, h, cmsSigBToD0Tag)) goto Error; - if (!CheckMPE(Pass, h, cmsSigBToD1Tag)) goto Error; - if (!CheckMPE(Pass, h, cmsSigBToD2Tag)) goto Error; - if (!CheckMPE(Pass, h, cmsSigBToD3Tag)) goto Error; + if (!CheckMPE(ContextID, Pass, h, cmsSigDToB0Tag)) goto Error; + if (!CheckMPE(ContextID, Pass, h, cmsSigDToB1Tag)) goto Error; + if (!CheckMPE(ContextID, Pass, h, cmsSigDToB2Tag)) goto Error; + if (!CheckMPE(ContextID, Pass, h, cmsSigDToB3Tag)) goto Error; + if (!CheckMPE(ContextID, Pass, h, cmsSigBToD0Tag)) goto Error; + if (!CheckMPE(ContextID, Pass, h, cmsSigBToD1Tag)) goto Error; + if (!CheckMPE(ContextID, Pass, h, cmsSigBToD2Tag)) goto Error; + if (!CheckMPE(ContextID, Pass, h, cmsSigBToD3Tag)) goto Error; SubTest("Tags using screening"); - if (!CheckScreening(Pass, h, cmsSigScreeningTag)) goto Error; + if (!CheckScreening(ContextID, Pass, h, cmsSigScreeningTag)) goto Error; SubTest("Tags holding profile sequence description"); - if (!CheckProfileSequenceTag(Pass, h)) goto Error; - if (!CheckProfileSequenceIDTag(Pass, h)) goto Error; + if (!CheckProfileSequenceTag(ContextID, Pass, h)) goto Error; + if (!CheckProfileSequenceIDTag(ContextID, Pass, h)) goto Error; SubTest("Tags holding ICC viewing conditions"); - if (!CheckICCViewingConditions(Pass, h)) goto Error; + if (!CheckICCViewingConditions(ContextID, Pass, h)) goto Error; SubTest("VCGT tags"); - if (!CheckVCGT(Pass, h)) goto Error; + if (!CheckVCGT(ContextID, Pass, h)) goto Error; SubTest("RAW tags"); - if (!CheckRAWtags(Pass, h)) goto Error; + if (!CheckRAWtags(ContextID, Pass, h)) goto Error; SubTest("Dictionary meta tags"); - // if (!CheckDictionary16(Pass, h)) goto Error; - if (!CheckDictionary24(Pass, h)) goto Error; + // if (!CheckDictionary16(ContextID, Pass, h)) goto Error; + if (!CheckDictionary24(ContextID, Pass, h)) goto Error; if (Pass == 1) { - cmsSaveProfileToFile(DbgThread(), h, "alltags.icc"); - cmsCloseProfile(DbgThread(), h); - h = cmsOpenProfileFromFile(DbgThread(), "alltags.icc", "r"); + cmsSaveProfileToFile(ContextID, h, "alltags.icc"); + cmsCloseProfile(ContextID, h); + h = cmsOpenProfileFromFile(ContextID, "alltags.icc", "r"); } } @@ -5409,12 +5402,12 @@ cmsInt32Number CheckProfileCreation(void) cmsSigOutputResponseTag = 0x72657370, // 'resp' -- Possible patent on this */ - cmsCloseProfile(DbgThread(), h); + cmsCloseProfile(ContextID, h); remove("alltags.icc"); return 1; Error: - cmsCloseProfile(DbgThread(), h); + cmsCloseProfile(ContextID, h); remove("alltags.icc"); return 0; } @@ -5422,7 +5415,7 @@ Error: // Thanks to Christopher James Halse Rogers for the bugfixing and providing this test static -cmsInt32Number CheckVersionHeaderWriting(void) +cmsInt32Number CheckVersionHeaderWriting(cmsContext ContextID) { cmsHPROFILE h; int index; @@ -5435,24 +5428,24 @@ cmsInt32Number CheckVersionHeaderWriting(void) for (index = 0; index < sizeof(test_versions)/sizeof(test_versions[0]); index++) { - h = cmsCreateProfilePlaceholder(DbgThread()); + h = cmsCreateProfilePlaceholder(ContextID); if (h == NULL) return 0; - cmsSetProfileVersion(DbgThread(), h, test_versions[index]); + cmsSetProfileVersion(ContextID, h, test_versions[index]); - cmsSaveProfileToFile(DbgThread(), h, "versions.icc"); - cmsCloseProfile(DbgThread(), h); + cmsSaveProfileToFile(ContextID, h, "versions.icc"); + cmsCloseProfile(ContextID, h); - h = cmsOpenProfileFromFile(DbgThread(), "versions.icc", "r"); + h = cmsOpenProfileFromFile(ContextID, "versions.icc", "r"); // Only the first 3 digits are significant - if (fabs(cmsGetProfileVersion(DbgThread(), h) - test_versions[index]) > 0.005) { + if (fabs(cmsGetProfileVersion(ContextID, h) - test_versions[index]) > 0.005) { Fail("Version failed to round-trip: wrote %.2f, read %.2f", - test_versions[index], cmsGetProfileVersion(DbgThread(), h)); + test_versions[index], cmsGetProfileVersion(ContextID, h)); return 0; } - cmsCloseProfile(DbgThread(), h); + cmsCloseProfile(ContextID, h); remove("versions.icc"); } return 1; @@ -5461,21 +5454,21 @@ cmsInt32Number CheckVersionHeaderWriting(void) // Test on Richard Hughes "crayons.icc" static -cmsInt32Number CheckMultilocalizedProfile(void) +cmsInt32Number CheckMultilocalizedProfile(cmsContext ContextID) { cmsHPROFILE hProfile; cmsMLU *Pt; char Buffer[256]; - hProfile = cmsOpenProfileFromFile(DbgThread(), "crayons.icc", "r"); + hProfile = cmsOpenProfileFromFile(ContextID, "crayons.icc", "r"); - Pt = (cmsMLU *) cmsReadTag(DbgThread(), hProfile, cmsSigProfileDescriptionTag); - cmsMLUgetASCII(DbgThread(), Pt, "en", "GB", Buffer, 256); + Pt = (cmsMLU *) cmsReadTag(ContextID, hProfile, cmsSigProfileDescriptionTag); + cmsMLUgetASCII(ContextID, Pt, "en", "GB", Buffer, 256); if (strcmp(Buffer, "Crayon Colours") != 0) return FALSE; - cmsMLUgetASCII(DbgThread(), Pt, "en", "US", Buffer, 256); + cmsMLUgetASCII(ContextID, Pt, "en", "US", Buffer, 256); if (strcmp(Buffer, "Crayon Colors") != 0) return FALSE; - cmsCloseProfile(DbgThread(), hProfile); + cmsCloseProfile(ContextID, hProfile); return TRUE; } @@ -5497,62 +5490,62 @@ void ErrorReportingFunction(cmsContext ContextID, cmsUInt32Number ErrorCode, con static -cmsInt32Number CheckBadProfiles(void) +cmsInt32Number CheckBadProfiles(cmsContext ContextID) { cmsHPROFILE h; - h = cmsOpenProfileFromFile(DbgThread(), "IDoNotExist.icc", "r"); + h = cmsOpenProfileFromFile(ContextID, "IDoNotExist.icc", "r"); if (h != NULL) { - cmsCloseProfile(DbgThread(), h); + cmsCloseProfile(ContextID, h); return 0; } - h = cmsOpenProfileFromFile(DbgThread(), "IAmIllFormed*.icc", "r"); + h = cmsOpenProfileFromFile(ContextID, "IAmIllFormed*.icc", "r"); if (h != NULL) { - cmsCloseProfile(DbgThread(), h); + cmsCloseProfile(ContextID, h); return 0; } // No profile name given - h = cmsOpenProfileFromFile(DbgThread(), "", "r"); + h = cmsOpenProfileFromFile(ContextID, "", "r"); if (h != NULL) { - cmsCloseProfile(DbgThread(), h); + cmsCloseProfile(ContextID, h); return 0; } - h = cmsOpenProfileFromFile(DbgThread(), "..", "r"); + h = cmsOpenProfileFromFile(ContextID, "..", "r"); if (h != NULL) { - cmsCloseProfile(DbgThread(), h); + cmsCloseProfile(ContextID, h); return 0; } - h = cmsOpenProfileFromFile(DbgThread(), "IHaveBadAccessMode.icc", "@"); + h = cmsOpenProfileFromFile(ContextID, "IHaveBadAccessMode.icc", "@"); if (h != NULL) { - cmsCloseProfile(DbgThread(), h); + cmsCloseProfile(ContextID, h); return 0; } - h = cmsOpenProfileFromFile(DbgThread(), "bad.icc", "r"); + h = cmsOpenProfileFromFile(ContextID, "bad.icc", "r"); if (h != NULL) { - cmsCloseProfile(DbgThread(), h); + cmsCloseProfile(ContextID, h); return 0; } - h = cmsOpenProfileFromFile(DbgThread(), "toosmall.icc", "r"); + h = cmsOpenProfileFromFile(ContextID, "toosmall.icc", "r"); if (h != NULL) { - cmsCloseProfile(DbgThread(), h); + cmsCloseProfile(ContextID, h); return 0; } - h = cmsOpenProfileFromMem(DbgThread(), NULL, 3); + h = cmsOpenProfileFromMem(ContextID, NULL, 3); if (h != NULL) { - cmsCloseProfile(DbgThread(), h); + cmsCloseProfile(ContextID, h); return 0; } - h = cmsOpenProfileFromMem(DbgThread(), "123", 3); + h = cmsOpenProfileFromMem(ContextID, "123", 3); if (h != NULL) { - cmsCloseProfile(DbgThread(), h); + cmsCloseProfile(ContextID, h); return 0; } @@ -5563,13 +5556,13 @@ cmsInt32Number CheckBadProfiles(void) static -cmsInt32Number CheckErrReportingOnBadProfiles(void) +cmsInt32Number CheckErrReportingOnBadProfiles(cmsContext ContextID) { cmsInt32Number rc; - cmsSetLogErrorHandler(DbgThread(), ErrorReportingFunction); - rc = CheckBadProfiles(); - cmsSetLogErrorHandler(DbgThread(), FatalErrorQuit); + cmsSetLogErrorHandler(ContextID, ErrorReportingFunction); + rc = CheckBadProfiles(ContextID); + cmsSetLogErrorHandler(ContextID, FatalErrorQuit); // Reset the error state TrappedError = FALSE; @@ -5578,57 +5571,57 @@ cmsInt32Number CheckErrReportingOnBadProfiles(void) static -cmsInt32Number CheckBadTransforms(void) +cmsInt32Number CheckBadTransforms(cmsContext ContextID) { - cmsHPROFILE h1 = cmsCreate_sRGBProfile(DbgThread()); + cmsHPROFILE h1 = cmsCreate_sRGBProfile(ContextID); cmsHTRANSFORM x1; - x1 = cmsCreateTransform(DbgThread(), NULL, 0, NULL, 0, 0, 0); + x1 = cmsCreateTransform(ContextID, NULL, 0, NULL, 0, 0, 0); if (x1 != NULL) { - cmsDeleteTransform(DbgThread(), x1); + cmsDeleteTransform(ContextID, x1); return 0; } - x1 = cmsCreateTransform(DbgThread(), h1, TYPE_RGB_8, h1, TYPE_RGB_8, 12345, 0); + x1 = cmsCreateTransform(ContextID, h1, TYPE_RGB_8, h1, TYPE_RGB_8, 12345, 0); if (x1 != NULL) { - cmsDeleteTransform(DbgThread(), x1); + cmsDeleteTransform(ContextID, x1); return 0; } - x1 = cmsCreateTransform(DbgThread(), h1, TYPE_CMYK_8, h1, TYPE_RGB_8, 0, 0); + x1 = cmsCreateTransform(ContextID, h1, TYPE_CMYK_8, h1, TYPE_RGB_8, 0, 0); if (x1 != NULL) { - cmsDeleteTransform(DbgThread(), x1); + cmsDeleteTransform(ContextID, x1); return 0; } - x1 = cmsCreateTransform(DbgThread(), h1, TYPE_RGB_8, h1, TYPE_CMYK_8, 1, 0); + x1 = cmsCreateTransform(ContextID, h1, TYPE_RGB_8, h1, TYPE_CMYK_8, 1, 0); if (x1 != NULL) { - cmsDeleteTransform(DbgThread(), x1); + cmsDeleteTransform(ContextID, x1); return 0; } // sRGB does its output as XYZ! - x1 = cmsCreateTransform(DbgThread(), h1, TYPE_RGB_8, NULL, TYPE_Lab_8, 1, 0); + x1 = cmsCreateTransform(ContextID, h1, TYPE_RGB_8, NULL, TYPE_Lab_8, 1, 0); if (x1 != NULL) { - cmsDeleteTransform(DbgThread(), x1); + cmsDeleteTransform(ContextID, x1); return 0; } - cmsCloseProfile(DbgThread(), h1); + cmsCloseProfile(ContextID, h1); { - cmsHPROFILE hp1 = cmsOpenProfileFromFile(DbgThread(), "test1.icc", "r"); - cmsHPROFILE hp2 = cmsCreate_sRGBProfile(DbgThread()); + cmsHPROFILE hp1 = cmsOpenProfileFromFile(ContextID, "test1.icc", "r"); + cmsHPROFILE hp2 = cmsCreate_sRGBProfile(ContextID); - x1 = cmsCreateTransform(DbgThread(), hp1, TYPE_BGR_8, hp2, TYPE_BGR_8, INTENT_PERCEPTUAL, 0); + x1 = cmsCreateTransform(ContextID, hp1, TYPE_BGR_8, hp2, TYPE_BGR_8, INTENT_PERCEPTUAL, 0); - cmsCloseProfile(DbgThread(), hp1); cmsCloseProfile(DbgThread(), hp2); + cmsCloseProfile(ContextID, hp1); cmsCloseProfile(ContextID, hp2); if (x1 != NULL) { - cmsDeleteTransform(DbgThread(), x1); + cmsDeleteTransform(ContextID, x1); return 0; } } @@ -5638,13 +5631,13 @@ cmsInt32Number CheckBadTransforms(void) } static -cmsInt32Number CheckErrReportingOnBadTransforms(void) +cmsInt32Number CheckErrReportingOnBadTransforms(cmsContext ContextID) { cmsInt32Number rc; - cmsSetLogErrorHandler(DbgThread(), ErrorReportingFunction); - rc = CheckBadTransforms(); - cmsSetLogErrorHandler(DbgThread(), FatalErrorQuit); + cmsSetLogErrorHandler(ContextID, ErrorReportingFunction); + rc = CheckBadTransforms(ContextID); + cmsSetLogErrorHandler(ContextID, FatalErrorQuit); // Reset the error state TrappedError = FALSE; @@ -5658,7 +5651,7 @@ cmsInt32Number CheckErrReportingOnBadTransforms(void) // Check a linear xform static -cmsInt32Number Check8linearXFORM(cmsHTRANSFORM xform, cmsInt32Number nChan) +cmsInt32Number Check8linearXFORM(cmsContext ContextID, cmsHTRANSFORM xform, cmsInt32Number nChan) { cmsInt32Number n2, i, j; cmsUInt8Number Inw[cmsMAXCHANNELS], Outw[cmsMAXCHANNELS]; @@ -5668,7 +5661,7 @@ cmsInt32Number Check8linearXFORM(cmsHTRANSFORM xform, cmsInt32Number nChan) for (j=0; j < 0xFF; j++) { memset(Inw, j, sizeof(Inw)); - cmsDoTransform(DbgThread(), xform, Inw, Outw, 1); + cmsDoTransform(ContextID, xform, Inw, Outw, 1); for (i=0; i < nChan; i++) { @@ -5689,7 +5682,7 @@ cmsInt32Number Check8linearXFORM(cmsHTRANSFORM xform, cmsInt32Number nChan) } static -cmsInt32Number Compare8bitXFORM(cmsHTRANSFORM xform1, cmsHTRANSFORM xform2, cmsInt32Number nChan) +cmsInt32Number Compare8bitXFORM(cmsContext ContextID, cmsHTRANSFORM xform1, cmsHTRANSFORM xform2, cmsInt32Number nChan) { cmsInt32Number n2, i, j; cmsUInt8Number Inw[cmsMAXCHANNELS], Outw1[cmsMAXCHANNELS], Outw2[cmsMAXCHANNELS];; @@ -5699,8 +5692,8 @@ cmsInt32Number Compare8bitXFORM(cmsHTRANSFORM xform1, cmsHTRANSFORM xform2, cmsI for (j=0; j < 0xFF; j++) { memset(Inw, j, sizeof(Inw)); - cmsDoTransform(DbgThread(), xform1, Inw, Outw1, 1); - cmsDoTransform(DbgThread(), xform2, Inw, Outw2, 1); + cmsDoTransform(ContextID, xform1, Inw, Outw1, 1); + cmsDoTransform(ContextID, xform2, Inw, Outw2, 1); for (i=0; i < nChan; i++) { @@ -5724,7 +5717,7 @@ cmsInt32Number Compare8bitXFORM(cmsHTRANSFORM xform1, cmsHTRANSFORM xform2, cmsI // Check a linear xform static -cmsInt32Number Check16linearXFORM(cmsHTRANSFORM xform, cmsInt32Number nChan) +cmsInt32Number Check16linearXFORM(cmsContext ContextID, cmsHTRANSFORM xform, cmsInt32Number nChan) { cmsInt32Number n2, i, j; cmsUInt16Number Inw[cmsMAXCHANNELS], Outw[cmsMAXCHANNELS]; @@ -5734,7 +5727,7 @@ cmsInt32Number Check16linearXFORM(cmsHTRANSFORM xform, cmsInt32Number nChan) for (i=0; i < nChan; i++) Inw[i] = (cmsUInt16Number) j; - cmsDoTransform(DbgThread(), xform, Inw, Outw, 1); + cmsDoTransform(ContextID, xform, Inw, Outw, 1); for (i=0; i < nChan; i++) { @@ -5756,7 +5749,7 @@ cmsInt32Number Check16linearXFORM(cmsHTRANSFORM xform, cmsInt32Number nChan) } static -cmsInt32Number Compare16bitXFORM(cmsHTRANSFORM xform1, cmsHTRANSFORM xform2, cmsInt32Number nChan) +cmsInt32Number Compare16bitXFORM(cmsContext ContextID, cmsHTRANSFORM xform1, cmsHTRANSFORM xform2, cmsInt32Number nChan) { cmsInt32Number n2, i, j; cmsUInt16Number Inw[cmsMAXCHANNELS], Outw1[cmsMAXCHANNELS], Outw2[cmsMAXCHANNELS];; @@ -5767,8 +5760,8 @@ cmsInt32Number Compare16bitXFORM(cmsHTRANSFORM xform1, cmsHTRANSFORM xform2, cms for (i=0; i < nChan; i++) Inw[i] = (cmsUInt16Number) j; - cmsDoTransform(DbgThread(), xform1, Inw, Outw1, 1); - cmsDoTransform(DbgThread(), xform2, Inw, Outw2, 1); + cmsDoTransform(ContextID, xform1, Inw, Outw1, 1); + cmsDoTransform(ContextID, xform2, Inw, Outw2, 1); for (i=0; i < nChan; i++) { @@ -5792,7 +5785,7 @@ cmsInt32Number Compare16bitXFORM(cmsHTRANSFORM xform1, cmsHTRANSFORM xform2, cms // Check a linear xform static -cmsInt32Number CheckFloatlinearXFORM(cmsHTRANSFORM xform, cmsInt32Number nChan) +cmsInt32Number CheckFloatlinearXFORM(cmsContext ContextID, cmsHTRANSFORM xform, cmsInt32Number nChan) { cmsInt32Number i, j; cmsFloat32Number In[cmsMAXCHANNELS], Out[cmsMAXCHANNELS]; @@ -5801,7 +5794,7 @@ cmsInt32Number CheckFloatlinearXFORM(cmsHTRANSFORM xform, cmsInt32Number nChan) for (i=0; i < nChan; i++) In[i] = (cmsFloat32Number) (j / 65535.0);; - cmsDoTransform(DbgThread(), xform, In, Out, 1); + cmsDoTransform(ContextID, xform, In, Out, 1); for (i=0; i < nChan; i++) { @@ -5817,7 +5810,7 @@ cmsInt32Number CheckFloatlinearXFORM(cmsHTRANSFORM xform, cmsInt32Number nChan) // Check a linear xform static -cmsInt32Number CompareFloatXFORM(cmsHTRANSFORM xform1, cmsHTRANSFORM xform2, cmsInt32Number nChan) +cmsInt32Number CompareFloatXFORM(cmsContext ContextID, cmsHTRANSFORM xform1, cmsHTRANSFORM xform2, cmsInt32Number nChan) { cmsInt32Number i, j; cmsFloat32Number In[cmsMAXCHANNELS], Out1[cmsMAXCHANNELS], Out2[cmsMAXCHANNELS]; @@ -5826,8 +5819,8 @@ cmsInt32Number CompareFloatXFORM(cmsHTRANSFORM xform1, cmsHTRANSFORM xform2, cms for (i=0; i < nChan; i++) In[i] = (cmsFloat32Number) (j / 65535.0);; - cmsDoTransform(DbgThread(), xform1, In, Out1, 1); - cmsDoTransform(DbgThread(), xform2, In, Out2, 1); + cmsDoTransform(ContextID, xform1, In, Out1, 1); + cmsDoTransform(ContextID, xform2, In, Out2, 1); for (i=0; i < nChan; i++) { @@ -5845,7 +5838,7 @@ cmsInt32Number CompareFloatXFORM(cmsHTRANSFORM xform1, cmsHTRANSFORM xform2, cms // Curves only transforms ---------------------------------------------------------------------------------------- static -cmsInt32Number CheckCurvesOnlyTransforms(void) +cmsInt32Number CheckCurvesOnlyTransforms(cmsContext ContextID) { cmsHTRANSFORM xform1, xform2; @@ -5854,64 +5847,64 @@ cmsInt32Number CheckCurvesOnlyTransforms(void) cmsInt32Number rc = 1; - c1 = cmsBuildGamma(DbgThread(), 2.2); - c2 = cmsBuildGamma(DbgThread(), 1/2.2); - c3 = cmsBuildGamma(DbgThread(), 4.84); + c1 = cmsBuildGamma(ContextID, 2.2); + c2 = cmsBuildGamma(ContextID, 1/2.2); + c3 = cmsBuildGamma(ContextID, 4.84); - h1 = cmsCreateLinearizationDeviceLink(DbgThread(), cmsSigGrayData, &c1); - h2 = cmsCreateLinearizationDeviceLink(DbgThread(), cmsSigGrayData, &c2); - h3 = cmsCreateLinearizationDeviceLink(DbgThread(), cmsSigGrayData, &c3); + h1 = cmsCreateLinearizationDeviceLink(ContextID, cmsSigGrayData, &c1); + h2 = cmsCreateLinearizationDeviceLink(ContextID, cmsSigGrayData, &c2); + h3 = cmsCreateLinearizationDeviceLink(ContextID, cmsSigGrayData, &c3); SubTest("Gray float optimizeable transform"); - xform1 = cmsCreateTransform(DbgThread(), h1, TYPE_GRAY_FLT, h2, TYPE_GRAY_FLT, INTENT_PERCEPTUAL, 0); - rc &= CheckFloatlinearXFORM(xform1, 1); - cmsDeleteTransform(DbgThread(), xform1); + xform1 = cmsCreateTransform(ContextID, h1, TYPE_GRAY_FLT, h2, TYPE_GRAY_FLT, INTENT_PERCEPTUAL, 0); + rc &= CheckFloatlinearXFORM(ContextID, xform1, 1); + cmsDeleteTransform(ContextID, xform1); if (rc == 0) goto Error; SubTest("Gray 8 optimizeable transform"); - xform1 = cmsCreateTransform(DbgThread(), h1, TYPE_GRAY_8, h2, TYPE_GRAY_8, INTENT_PERCEPTUAL, 0); - rc &= Check8linearXFORM(xform1, 1); - cmsDeleteTransform(DbgThread(), xform1); + xform1 = cmsCreateTransform(ContextID, h1, TYPE_GRAY_8, h2, TYPE_GRAY_8, INTENT_PERCEPTUAL, 0); + rc &= Check8linearXFORM(ContextID, xform1, 1); + cmsDeleteTransform(ContextID, xform1); if (rc == 0) goto Error; SubTest("Gray 16 optimizeable transform"); - xform1 = cmsCreateTransform(DbgThread(), h1, TYPE_GRAY_16, h2, TYPE_GRAY_16, INTENT_PERCEPTUAL, 0); - rc &= Check16linearXFORM(xform1, 1); - cmsDeleteTransform(DbgThread(), xform1); + xform1 = cmsCreateTransform(ContextID, h1, TYPE_GRAY_16, h2, TYPE_GRAY_16, INTENT_PERCEPTUAL, 0); + rc &= Check16linearXFORM(ContextID, xform1, 1); + cmsDeleteTransform(ContextID, xform1); if (rc == 0) goto Error; SubTest("Gray float non-optimizeable transform"); - xform1 = cmsCreateTransform(DbgThread(), h1, TYPE_GRAY_FLT, h1, TYPE_GRAY_FLT, INTENT_PERCEPTUAL, 0); - xform2 = cmsCreateTransform(DbgThread(), h3, TYPE_GRAY_FLT, NULL, TYPE_GRAY_FLT, INTENT_PERCEPTUAL, 0); + xform1 = cmsCreateTransform(ContextID, h1, TYPE_GRAY_FLT, h1, TYPE_GRAY_FLT, INTENT_PERCEPTUAL, 0); + xform2 = cmsCreateTransform(ContextID, h3, TYPE_GRAY_FLT, NULL, TYPE_GRAY_FLT, INTENT_PERCEPTUAL, 0); - rc &= CompareFloatXFORM(xform1, xform2, 1); - cmsDeleteTransform(DbgThread(), xform1); - cmsDeleteTransform(DbgThread(), xform2); + rc &= CompareFloatXFORM(ContextID, xform1, xform2, 1); + cmsDeleteTransform(ContextID, xform1); + cmsDeleteTransform(ContextID, xform2); if (rc == 0) goto Error; SubTest("Gray 8 non-optimizeable transform"); - xform1 = cmsCreateTransform(DbgThread(), h1, TYPE_GRAY_8, h1, TYPE_GRAY_8, INTENT_PERCEPTUAL, 0); - xform2 = cmsCreateTransform(DbgThread(), h3, TYPE_GRAY_8, NULL, TYPE_GRAY_8, INTENT_PERCEPTUAL, 0); + xform1 = cmsCreateTransform(ContextID, h1, TYPE_GRAY_8, h1, TYPE_GRAY_8, INTENT_PERCEPTUAL, 0); + xform2 = cmsCreateTransform(ContextID, h3, TYPE_GRAY_8, NULL, TYPE_GRAY_8, INTENT_PERCEPTUAL, 0); - rc &= Compare8bitXFORM(xform1, xform2, 1); - cmsDeleteTransform(DbgThread(), xform1); - cmsDeleteTransform(DbgThread(), xform2); + rc &= Compare8bitXFORM(ContextID, xform1, xform2, 1); + cmsDeleteTransform(ContextID, xform1); + cmsDeleteTransform(ContextID, xform2); if (rc == 0) goto Error; SubTest("Gray 16 non-optimizeable transform"); - xform1 = cmsCreateTransform(DbgThread(), h1, TYPE_GRAY_16, h1, TYPE_GRAY_16, INTENT_PERCEPTUAL, 0); - xform2 = cmsCreateTransform(DbgThread(), h3, TYPE_GRAY_16, NULL, TYPE_GRAY_16, INTENT_PERCEPTUAL, 0); + xform1 = cmsCreateTransform(ContextID, h1, TYPE_GRAY_16, h1, TYPE_GRAY_16, INTENT_PERCEPTUAL, 0); + xform2 = cmsCreateTransform(ContextID, h3, TYPE_GRAY_16, NULL, TYPE_GRAY_16, INTENT_PERCEPTUAL, 0); - rc &= Compare16bitXFORM(xform1, xform2, 1); - cmsDeleteTransform(DbgThread(), xform1); - cmsDeleteTransform(DbgThread(), xform2); + rc &= Compare16bitXFORM(ContextID, xform1, xform2, 1); + cmsDeleteTransform(ContextID, xform1); + cmsDeleteTransform(ContextID, xform2); if (rc == 0) goto Error; Error: - cmsCloseProfile(DbgThread(), h1); cmsCloseProfile(DbgThread(), h2); cmsCloseProfile(DbgThread(), h3); - cmsFreeToneCurve(DbgThread(), c1); cmsFreeToneCurve(DbgThread(), c2); cmsFreeToneCurve(DbgThread(), c3); + cmsCloseProfile(ContextID, h1); cmsCloseProfile(ContextID, h2); cmsCloseProfile(ContextID, h3); + cmsFreeToneCurve(ContextID, c1); cmsFreeToneCurve(ContextID, c2); cmsFreeToneCurve(ContextID, c3); return rc; } @@ -5923,21 +5916,21 @@ Error: static cmsFloat64Number MaxDE; static -cmsInt32Number CheckOneLab(cmsHTRANSFORM xform, cmsFloat64Number L, cmsFloat64Number a, cmsFloat64Number b) +cmsInt32Number CheckOneLab(cmsContext ContextID, cmsHTRANSFORM xform, cmsFloat64Number L, cmsFloat64Number a, cmsFloat64Number b) { cmsCIELab In, Out; cmsFloat64Number dE; In.L = L; In.a = a; In.b = b; - cmsDoTransform(DbgThread(), xform, &In, &Out, 1); + cmsDoTransform(ContextID, xform, &In, &Out, 1); - dE = cmsDeltaE(DbgThread(), &In, &Out); + dE = cmsDeltaE(ContextID, &In, &Out); if (dE > MaxDE) MaxDE = dE; if (MaxDE > 0.003) { Fail("dE=%f Lab1=(%f, %f, %f)\n\tLab2=(%f %f %f)", MaxDE, In.L, In.a, In.b, Out.L, Out.a, Out.b); - cmsDoTransform(DbgThread(), xform, &In, &Out, 1); + cmsDoTransform(ContextID, xform, &In, &Out, 1); return 0; } @@ -5946,7 +5939,7 @@ cmsInt32Number CheckOneLab(cmsHTRANSFORM xform, cmsFloat64Number L, cmsFloat64Nu // Check several Lab, slicing at non-exact values. Precision should be 16 bits. 50x50x50 checks aprox. static -cmsInt32Number CheckSeveralLab(cmsHTRANSFORM xform) +cmsInt32Number CheckSeveralLab(cmsContext ContextID, cmsHTRANSFORM xform) { cmsInt32Number L, a, b; @@ -5957,7 +5950,7 @@ cmsInt32Number CheckSeveralLab(cmsHTRANSFORM xform) for (b = 0; b < 65536; b += 1111) { - if (!CheckOneLab(xform, (L * 100.0) / 65535.0, + if (!CheckOneLab(ContextID, xform, (L * 100.0) / 65535.0, (a / 257.0) - 128, (b / 257.0) - 128)) return 0; } @@ -5970,171 +5963,171 @@ cmsInt32Number CheckSeveralLab(cmsHTRANSFORM xform) static -cmsInt32Number OneTrivialLab(cmsHPROFILE hLab1, cmsHPROFILE hLab2, const char* txt) +cmsInt32Number OneTrivialLab(cmsContext ContextID, cmsHPROFILE hLab1, cmsHPROFILE hLab2, const char* txt) { cmsHTRANSFORM xform; cmsInt32Number rc; SubTest(txt); - xform = cmsCreateTransform(DbgThread(), hLab1, TYPE_Lab_DBL, hLab2, TYPE_Lab_DBL, INTENT_RELATIVE_COLORIMETRIC, 0); - cmsCloseProfile(DbgThread(), hLab1); cmsCloseProfile(DbgThread(), hLab2); + xform = cmsCreateTransform(ContextID, hLab1, TYPE_Lab_DBL, hLab2, TYPE_Lab_DBL, INTENT_RELATIVE_COLORIMETRIC, 0); + cmsCloseProfile(ContextID, hLab1); cmsCloseProfile(ContextID, hLab2); - rc = CheckSeveralLab(xform); - cmsDeleteTransform(DbgThread(), xform); + rc = CheckSeveralLab(ContextID, xform); + cmsDeleteTransform(ContextID, xform); return rc; } static -cmsInt32Number CheckFloatLabTransforms(void) +cmsInt32Number CheckFloatLabTransforms(cmsContext ContextID) { - return OneTrivialLab(cmsCreateLab4Profile(DbgThread(), NULL), cmsCreateLab4Profile(DbgThread(), NULL), "Lab4/Lab4") && - OneTrivialLab(cmsCreateLab2Profile(DbgThread(), NULL), cmsCreateLab2Profile(DbgThread(), NULL), "Lab2/Lab2") && - OneTrivialLab(cmsCreateLab4Profile(DbgThread(), NULL), cmsCreateLab2Profile(DbgThread(), NULL), "Lab4/Lab2") && - OneTrivialLab(cmsCreateLab2Profile(DbgThread(), NULL), cmsCreateLab4Profile(DbgThread(), NULL), "Lab2/Lab4"); + return OneTrivialLab(ContextID, cmsCreateLab4Profile(ContextID, NULL), cmsCreateLab4Profile(ContextID, NULL), "Lab4/Lab4") && + OneTrivialLab(ContextID, cmsCreateLab2Profile(ContextID, NULL), cmsCreateLab2Profile(ContextID, NULL), "Lab2/Lab2") && + OneTrivialLab(ContextID, cmsCreateLab4Profile(ContextID, NULL), cmsCreateLab2Profile(ContextID, NULL), "Lab4/Lab2") && + OneTrivialLab(ContextID, cmsCreateLab2Profile(ContextID, NULL), cmsCreateLab4Profile(ContextID, NULL), "Lab2/Lab4"); } static -cmsInt32Number CheckEncodedLabTransforms(void) +cmsInt32Number CheckEncodedLabTransforms(cmsContext ContextID) { cmsHTRANSFORM xform; cmsUInt16Number In[3]; cmsCIELab Lab; cmsCIELab White = { 100, 0, 0 }; - cmsHPROFILE hLab1 = cmsCreateLab4Profile(DbgThread(), NULL); - cmsHPROFILE hLab2 = cmsCreateLab4Profile(DbgThread(), NULL); + cmsHPROFILE hLab1 = cmsCreateLab4Profile(ContextID, NULL); + cmsHPROFILE hLab2 = cmsCreateLab4Profile(ContextID, NULL); - xform = cmsCreateTransform(DbgThread(), hLab1, TYPE_Lab_16, hLab2, TYPE_Lab_DBL, INTENT_RELATIVE_COLORIMETRIC, 0); - cmsCloseProfile(DbgThread(), hLab1); cmsCloseProfile(DbgThread(), hLab2); + xform = cmsCreateTransform(ContextID, hLab1, TYPE_Lab_16, hLab2, TYPE_Lab_DBL, INTENT_RELATIVE_COLORIMETRIC, 0); + cmsCloseProfile(ContextID, hLab1); cmsCloseProfile(ContextID, hLab2); In[0] = 0xFFFF; In[1] = 0x8080; In[2] = 0x8080; - cmsDoTransform(DbgThread(), xform, In, &Lab, 1); + cmsDoTransform(ContextID, xform, In, &Lab, 1); - if (cmsDeltaE(DbgThread(), &Lab, &White) > 0.0001) return 0; - cmsDeleteTransform(DbgThread(), xform); + if (cmsDeltaE(ContextID, &Lab, &White) > 0.0001) return 0; + cmsDeleteTransform(ContextID, xform); - hLab1 = cmsCreateLab2Profile(DbgThread(), NULL); - hLab2 = cmsCreateLab4Profile(DbgThread(), NULL); + hLab1 = cmsCreateLab2Profile(ContextID, NULL); + hLab2 = cmsCreateLab4Profile(ContextID, NULL); - xform = cmsCreateTransform(DbgThread(), hLab1, TYPE_LabV2_16, hLab2, TYPE_Lab_DBL, INTENT_RELATIVE_COLORIMETRIC, 0); - cmsCloseProfile(DbgThread(), hLab1); cmsCloseProfile(DbgThread(), hLab2); + xform = cmsCreateTransform(ContextID, hLab1, TYPE_LabV2_16, hLab2, TYPE_Lab_DBL, INTENT_RELATIVE_COLORIMETRIC, 0); + cmsCloseProfile(ContextID, hLab1); cmsCloseProfile(ContextID, hLab2); In[0] = 0xFF00; In[1] = 0x8000; In[2] = 0x8000; - cmsDoTransform(DbgThread(), xform, In, &Lab, 1); + cmsDoTransform(ContextID, xform, In, &Lab, 1); - if (cmsDeltaE(DbgThread(), &Lab, &White) > 0.0001) return 0; + if (cmsDeltaE(ContextID, &Lab, &White) > 0.0001) return 0; - cmsDeleteTransform(DbgThread(), xform); + cmsDeleteTransform(ContextID, xform); - hLab2 = cmsCreateLab2Profile(DbgThread(), NULL); - hLab1 = cmsCreateLab4Profile(DbgThread(), NULL); + hLab2 = cmsCreateLab2Profile(ContextID, NULL); + hLab1 = cmsCreateLab4Profile(ContextID, NULL); - xform = cmsCreateTransform(DbgThread(), hLab1, TYPE_Lab_DBL, hLab2, TYPE_LabV2_16, INTENT_RELATIVE_COLORIMETRIC, 0); - cmsCloseProfile(DbgThread(), hLab1); cmsCloseProfile(DbgThread(), hLab2); + xform = cmsCreateTransform(ContextID, hLab1, TYPE_Lab_DBL, hLab2, TYPE_LabV2_16, INTENT_RELATIVE_COLORIMETRIC, 0); + cmsCloseProfile(ContextID, hLab1); cmsCloseProfile(ContextID, hLab2); Lab.L = 100; Lab.a = 0; Lab.b = 0; - cmsDoTransform(DbgThread(), xform, &Lab, In, 1); + cmsDoTransform(ContextID, xform, &Lab, In, 1); if (In[0] != 0xFF00 || In[1] != 0x8000 || In[2] != 0x8000) return 0; - cmsDeleteTransform(DbgThread(), xform); + cmsDeleteTransform(ContextID, xform); - hLab1 = cmsCreateLab4Profile(DbgThread(), NULL); - hLab2 = cmsCreateLab4Profile(DbgThread(), NULL); + hLab1 = cmsCreateLab4Profile(ContextID, NULL); + hLab2 = cmsCreateLab4Profile(ContextID, NULL); - xform = cmsCreateTransform(DbgThread(), hLab1, TYPE_Lab_DBL, hLab2, TYPE_Lab_16, INTENT_RELATIVE_COLORIMETRIC, 0); - cmsCloseProfile(DbgThread(), hLab1); cmsCloseProfile(DbgThread(), hLab2); + xform = cmsCreateTransform(ContextID, hLab1, TYPE_Lab_DBL, hLab2, TYPE_Lab_16, INTENT_RELATIVE_COLORIMETRIC, 0); + cmsCloseProfile(ContextID, hLab1); cmsCloseProfile(ContextID, hLab2); Lab.L = 100; Lab.a = 0; Lab.b = 0; - cmsDoTransform(DbgThread(), xform, &Lab, In, 1); + cmsDoTransform(ContextID, xform, &Lab, In, 1); if (In[0] != 0xFFFF || In[1] != 0x8080 || In[2] != 0x8080) return 0; - cmsDeleteTransform(DbgThread(), xform); + cmsDeleteTransform(ContextID, xform); return 1; } static -cmsInt32Number CheckStoredIdentities(void) +cmsInt32Number CheckStoredIdentities(cmsContext ContextID) { cmsHPROFILE hLab, hLink, h4, h2; cmsHTRANSFORM xform; cmsInt32Number rc = 1; - hLab = cmsCreateLab4Profile(DbgThread(), NULL); - xform = cmsCreateTransform(DbgThread(), hLab, TYPE_Lab_8, hLab, TYPE_Lab_8, 0, 0); + hLab = cmsCreateLab4Profile(ContextID, NULL); + xform = cmsCreateTransform(ContextID, hLab, TYPE_Lab_8, hLab, TYPE_Lab_8, 0, 0); - hLink = cmsTransform2DeviceLink(NULL, xform, 3.4, 0); - cmsSaveProfileToFile(DbgThread(), hLink, "abstractv2.icc"); - cmsCloseProfile(DbgThread(), hLink); + hLink = cmsTransform2DeviceLink(ContextID, xform, 3.4, 0); + cmsSaveProfileToFile(ContextID, hLink, "abstractv2.icc"); + cmsCloseProfile(ContextID, hLink); - hLink = cmsTransform2DeviceLink(NULL, xform, 4.3, 0); - cmsSaveProfileToFile(DbgThread(), hLink, "abstractv4.icc"); - cmsCloseProfile(DbgThread(), hLink); + hLink = cmsTransform2DeviceLink(ContextID, xform, 4.3, 0); + cmsSaveProfileToFile(ContextID, hLink, "abstractv4.icc"); + cmsCloseProfile(ContextID, hLink); - cmsDeleteTransform(DbgThread(), xform); - cmsCloseProfile(DbgThread(), hLab); + cmsDeleteTransform(ContextID, xform); + cmsCloseProfile(ContextID, hLab); - h4 = cmsOpenProfileFromFile(DbgThread(), "abstractv4.icc", "r"); + h4 = cmsOpenProfileFromFile(ContextID, "abstractv4.icc", "r"); - xform = cmsCreateTransform(DbgThread(), h4, TYPE_Lab_DBL, h4, TYPE_Lab_DBL, INTENT_RELATIVE_COLORIMETRIC, 0); + xform = cmsCreateTransform(ContextID, h4, TYPE_Lab_DBL, h4, TYPE_Lab_DBL, INTENT_RELATIVE_COLORIMETRIC, 0); SubTest("V4"); - rc &= CheckSeveralLab(xform); + rc &= CheckSeveralLab(ContextID, xform); - cmsDeleteTransform(DbgThread(), xform); - cmsCloseProfile(DbgThread(), h4); + cmsDeleteTransform(ContextID, xform); + cmsCloseProfile(ContextID, h4); if (!rc) goto Error; SubTest("V2"); - h2 = cmsOpenProfileFromFile(DbgThread(), "abstractv2.icc", "r"); + h2 = cmsOpenProfileFromFile(ContextID, "abstractv2.icc", "r"); - xform = cmsCreateTransform(DbgThread(), h2, TYPE_Lab_DBL, h2, TYPE_Lab_DBL, INTENT_RELATIVE_COLORIMETRIC, 0); - rc &= CheckSeveralLab(xform); - cmsDeleteTransform(DbgThread(), xform); - cmsCloseProfile(DbgThread(), h2); + xform = cmsCreateTransform(ContextID, h2, TYPE_Lab_DBL, h2, TYPE_Lab_DBL, INTENT_RELATIVE_COLORIMETRIC, 0); + rc &= CheckSeveralLab(ContextID, xform); + cmsDeleteTransform(ContextID, xform); + cmsCloseProfile(ContextID, h2); if (!rc) goto Error; SubTest("V2 -> V4"); - h2 = cmsOpenProfileFromFile(DbgThread(), "abstractv2.icc", "r"); - h4 = cmsOpenProfileFromFile(DbgThread(), "abstractv4.icc", "r"); + h2 = cmsOpenProfileFromFile(ContextID, "abstractv2.icc", "r"); + h4 = cmsOpenProfileFromFile(ContextID, "abstractv4.icc", "r"); - xform = cmsCreateTransform(DbgThread(), h4, TYPE_Lab_DBL, h2, TYPE_Lab_DBL, INTENT_RELATIVE_COLORIMETRIC, 0); - rc &= CheckSeveralLab(xform); - cmsDeleteTransform(DbgThread(), xform); - cmsCloseProfile(DbgThread(), h2); - cmsCloseProfile(DbgThread(), h4); + xform = cmsCreateTransform(ContextID, h4, TYPE_Lab_DBL, h2, TYPE_Lab_DBL, INTENT_RELATIVE_COLORIMETRIC, 0); + rc &= CheckSeveralLab(ContextID, xform); + cmsDeleteTransform(ContextID, xform); + cmsCloseProfile(ContextID, h2); + cmsCloseProfile(ContextID, h4); SubTest("V4 -> V2"); - h2 = cmsOpenProfileFromFile(DbgThread(), "abstractv2.icc", "r"); - h4 = cmsOpenProfileFromFile(DbgThread(), "abstractv4.icc", "r"); + h2 = cmsOpenProfileFromFile(ContextID, "abstractv2.icc", "r"); + h4 = cmsOpenProfileFromFile(ContextID, "abstractv4.icc", "r"); - xform = cmsCreateTransform(DbgThread(), h2, TYPE_Lab_DBL, h4, TYPE_Lab_DBL, INTENT_RELATIVE_COLORIMETRIC, 0); - rc &= CheckSeveralLab(xform); - cmsDeleteTransform(DbgThread(), xform); - cmsCloseProfile(DbgThread(), h2); - cmsCloseProfile(DbgThread(), h4); + xform = cmsCreateTransform(ContextID, h2, TYPE_Lab_DBL, h4, TYPE_Lab_DBL, INTENT_RELATIVE_COLORIMETRIC, 0); + rc &= CheckSeveralLab(ContextID, xform); + cmsDeleteTransform(ContextID, xform); + cmsCloseProfile(ContextID, h2); + cmsCloseProfile(ContextID, h4); Error: remove("abstractv2.icc"); @@ -6147,23 +6140,23 @@ Error: // Check a simple xform from a matrix profile to itself. Test floating point accuracy. static -cmsInt32Number CheckMatrixShaperXFORMFloat(void) +cmsInt32Number CheckMatrixShaperXFORMFloat(cmsContext ContextID) { cmsHPROFILE hAbove, hSRGB; cmsHTRANSFORM xform; cmsInt32Number rc1, rc2; - hAbove = Create_AboveRGB(); - xform = cmsCreateTransform(DbgThread(), hAbove, TYPE_RGB_FLT, hAbove, TYPE_RGB_FLT, INTENT_RELATIVE_COLORIMETRIC, 0); - cmsCloseProfile(DbgThread(), hAbove); - rc1 = CheckFloatlinearXFORM(xform, 3); - cmsDeleteTransform(DbgThread(), xform); + hAbove = Create_AboveRGB(ContextID); + xform = cmsCreateTransform(ContextID, hAbove, TYPE_RGB_FLT, hAbove, TYPE_RGB_FLT, INTENT_RELATIVE_COLORIMETRIC, 0); + cmsCloseProfile(ContextID, hAbove); + rc1 = CheckFloatlinearXFORM(ContextID, xform, 3); + cmsDeleteTransform(ContextID, xform); - hSRGB = cmsCreate_sRGBProfile(DbgThread()); - xform = cmsCreateTransform(DbgThread(), hSRGB, TYPE_RGB_FLT, hSRGB, TYPE_RGB_FLT, INTENT_RELATIVE_COLORIMETRIC, 0); - cmsCloseProfile(DbgThread(), hSRGB); - rc2 = CheckFloatlinearXFORM(xform, 3); - cmsDeleteTransform(DbgThread(), xform); + hSRGB = cmsCreate_sRGBProfile(ContextID); + xform = cmsCreateTransform(ContextID, hSRGB, TYPE_RGB_FLT, hSRGB, TYPE_RGB_FLT, INTENT_RELATIVE_COLORIMETRIC, 0); + cmsCloseProfile(ContextID, hSRGB); + rc2 = CheckFloatlinearXFORM(ContextID, xform, 3); + cmsDeleteTransform(ContextID, xform); return rc1 && rc2; @@ -6171,24 +6164,24 @@ cmsInt32Number CheckMatrixShaperXFORMFloat(void) // Check a simple xform from a matrix profile to itself. Test 16 bits accuracy. static -cmsInt32Number CheckMatrixShaperXFORM16(void) +cmsInt32Number CheckMatrixShaperXFORM16(cmsContext ContextID) { cmsHPROFILE hAbove, hSRGB; cmsHTRANSFORM xform; cmsInt32Number rc1, rc2; - hAbove = Create_AboveRGB(); - xform = cmsCreateTransform(DbgThread(), hAbove, TYPE_RGB_16, hAbove, TYPE_RGB_16, INTENT_RELATIVE_COLORIMETRIC, 0); - cmsCloseProfile(DbgThread(), hAbove); + hAbove = Create_AboveRGB(ContextID); + xform = cmsCreateTransform(ContextID, hAbove, TYPE_RGB_16, hAbove, TYPE_RGB_16, INTENT_RELATIVE_COLORIMETRIC, 0); + cmsCloseProfile(ContextID, hAbove); - rc1 = Check16linearXFORM(xform, 3); - cmsDeleteTransform(DbgThread(), xform); + rc1 = Check16linearXFORM(ContextID, xform, 3); + cmsDeleteTransform(ContextID, xform); - hSRGB = cmsCreate_sRGBProfile(DbgThread()); - xform = cmsCreateTransform(DbgThread(), hSRGB, TYPE_RGB_16, hSRGB, TYPE_RGB_16, INTENT_RELATIVE_COLORIMETRIC, 0); - cmsCloseProfile(DbgThread(), hSRGB); - rc2 = Check16linearXFORM(xform, 3); - cmsDeleteTransform(DbgThread(), xform); + hSRGB = cmsCreate_sRGBProfile(ContextID); + xform = cmsCreateTransform(ContextID, hSRGB, TYPE_RGB_16, hSRGB, TYPE_RGB_16, INTENT_RELATIVE_COLORIMETRIC, 0); + cmsCloseProfile(ContextID, hSRGB); + rc2 = Check16linearXFORM(ContextID, xform, 3); + cmsDeleteTransform(ContextID, xform); return rc1 && rc2; @@ -6197,23 +6190,23 @@ cmsInt32Number CheckMatrixShaperXFORM16(void) // Check a simple xform from a matrix profile to itself. Test 8 bits accuracy. static -cmsInt32Number CheckMatrixShaperXFORM8(void) +cmsInt32Number CheckMatrixShaperXFORM8(cmsContext ContextID) { cmsHPROFILE hAbove, hSRGB; cmsHTRANSFORM xform; cmsInt32Number rc1, rc2; - hAbove = Create_AboveRGB(); - xform = cmsCreateTransform(DbgThread(), hAbove, TYPE_RGB_8, hAbove, TYPE_RGB_8, INTENT_RELATIVE_COLORIMETRIC, 0); - cmsCloseProfile(DbgThread(), hAbove); - rc1 = Check8linearXFORM(xform, 3); - cmsDeleteTransform(DbgThread(), xform); + hAbove = Create_AboveRGB(ContextID); + xform = cmsCreateTransform(ContextID, hAbove, TYPE_RGB_8, hAbove, TYPE_RGB_8, INTENT_RELATIVE_COLORIMETRIC, 0); + cmsCloseProfile(ContextID, hAbove); + rc1 = Check8linearXFORM(ContextID, xform, 3); + cmsDeleteTransform(ContextID, xform); - hSRGB = cmsCreate_sRGBProfile(DbgThread()); - xform = cmsCreateTransform(DbgThread(), hSRGB, TYPE_RGB_8, hSRGB, TYPE_RGB_8, INTENT_RELATIVE_COLORIMETRIC, 0); - cmsCloseProfile(DbgThread(), hSRGB); - rc2 = Check8linearXFORM(xform, 3); - cmsDeleteTransform(DbgThread(), xform); + hSRGB = cmsCreate_sRGBProfile(ContextID); + xform = cmsCreateTransform(ContextID, hSRGB, TYPE_RGB_8, hSRGB, TYPE_RGB_8, INTENT_RELATIVE_COLORIMETRIC, 0); + cmsCloseProfile(ContextID, hSRGB); + rc2 = Check8linearXFORM(ContextID, xform, 3); + cmsDeleteTransform(ContextID, xform); return rc1 && rc2; @@ -6232,7 +6225,7 @@ cmsInt32Number CheckMatrixShaperXFORM8(void) // Check known values going from sRGB to XYZ static -cmsInt32Number CheckOneRGB_f(cmsHTRANSFORM xform, cmsInt32Number R, cmsInt32Number G, cmsInt32Number B, cmsFloat64Number X, cmsFloat64Number Y, cmsFloat64Number Z, cmsFloat64Number err) +cmsInt32Number CheckOneRGB_f(cmsContext ContextID, cmsHTRANSFORM xform, cmsInt32Number R, cmsInt32Number G, cmsInt32Number B, cmsFloat64Number X, cmsFloat64Number Y, cmsFloat64Number Z, cmsFloat64Number err) { cmsFloat32Number RGB[3]; cmsFloat64Number Out[3]; @@ -6241,7 +6234,7 @@ cmsInt32Number CheckOneRGB_f(cmsHTRANSFORM xform, cmsInt32Number R, cmsInt32Numb RGB[1] = (cmsFloat32Number) (G / 255.0); RGB[2] = (cmsFloat32Number) (B / 255.0); - cmsDoTransform(DbgThread(), xform, RGB, Out, 1); + cmsDoTransform(ContextID, xform, RGB, Out, 1); return IsGoodVal("X", X , Out[0], err) && IsGoodVal("Y", Y , Out[1], err) && @@ -6249,43 +6242,43 @@ cmsInt32Number CheckOneRGB_f(cmsHTRANSFORM xform, cmsInt32Number R, cmsInt32Numb } static -cmsInt32Number Chack_sRGB_Float(void) +cmsInt32Number Chack_sRGB_Float(cmsContext ContextID) { cmsHPROFILE hsRGB, hXYZ, hLab; cmsHTRANSFORM xform1, xform2; cmsInt32Number rc; - hsRGB = cmsCreate_sRGBProfile(DbgThread()); - hXYZ = cmsCreateXYZProfile(DbgThread()); - hLab = cmsCreateLab4Profile(DbgThread(), NULL); + hsRGB = cmsCreate_sRGBProfile(ContextID); + hXYZ = cmsCreateXYZProfile(ContextID); + hLab = cmsCreateLab4Profile(ContextID, NULL); - xform1 = cmsCreateTransform(DbgThread(), hsRGB, TYPE_RGB_FLT, hXYZ, TYPE_XYZ_DBL, + xform1 = cmsCreateTransform(ContextID, hsRGB, TYPE_RGB_FLT, hXYZ, TYPE_XYZ_DBL, INTENT_RELATIVE_COLORIMETRIC, 0); - xform2 = cmsCreateTransform(DbgThread(), hsRGB, TYPE_RGB_FLT, hLab, TYPE_Lab_DBL, + xform2 = cmsCreateTransform(ContextID, hsRGB, TYPE_RGB_FLT, hLab, TYPE_Lab_DBL, INTENT_RELATIVE_COLORIMETRIC, 0); - cmsCloseProfile(DbgThread(), hsRGB); - cmsCloseProfile(DbgThread(), hXYZ); - cmsCloseProfile(DbgThread(), hLab); + cmsCloseProfile(ContextID, hsRGB); + cmsCloseProfile(ContextID, hXYZ); + cmsCloseProfile(ContextID, hLab); MaxErr = 0; // Xform 1 goes from 8 bits to XYZ, - rc = CheckOneRGB_f(xform1, 1, 1, 1, 0.0002927, 0.0003035, 0.000250, 0.0001); - rc &= CheckOneRGB_f(xform1, 127, 127, 127, 0.2046329, 0.212230, 0.175069, 0.0001); - rc &= CheckOneRGB_f(xform1, 12, 13, 15, 0.0038364, 0.0039928, 0.003853, 0.0001); - rc &= CheckOneRGB_f(xform1, 128, 0, 0, 0.0941240, 0.0480256, 0.003005, 0.0001); - rc &= CheckOneRGB_f(xform1, 190, 25, 210, 0.3204592, 0.1605926, 0.468213, 0.0001); + rc = CheckOneRGB_f(ContextID, xform1, 1, 1, 1, 0.0002927, 0.0003035, 0.000250, 0.0001); + rc &= CheckOneRGB_f(ContextID, xform1, 127, 127, 127, 0.2046329, 0.212230, 0.175069, 0.0001); + rc &= CheckOneRGB_f(ContextID, xform1, 12, 13, 15, 0.0038364, 0.0039928, 0.003853, 0.0001); + rc &= CheckOneRGB_f(ContextID, xform1, 128, 0, 0, 0.0941240, 0.0480256, 0.003005, 0.0001); + rc &= CheckOneRGB_f(ContextID, xform1, 190, 25, 210, 0.3204592, 0.1605926, 0.468213, 0.0001); // Xform 2 goes from 8 bits to Lab, we allow 0.01 error max - rc &= CheckOneRGB_f(xform2, 1, 1, 1, 0.2741748, 0, 0, 0.01); - rc &= CheckOneRGB_f(xform2, 127, 127, 127, 53.192776, 0, 0, 0.01); - rc &= CheckOneRGB_f(xform2, 190, 25, 210, 47.052136, 74.565610, -56.883274, 0.01); - rc &= CheckOneRGB_f(xform2, 128, 0, 0, 26.164701, 48.478171, 39.4384713, 0.01); + rc &= CheckOneRGB_f(ContextID, xform2, 1, 1, 1, 0.2741748, 0, 0, 0.01); + rc &= CheckOneRGB_f(ContextID, xform2, 127, 127, 127, 53.192776, 0, 0, 0.01); + rc &= CheckOneRGB_f(ContextID, xform2, 190, 25, 210, 47.052136, 74.565610, -56.883274, 0.01); + rc &= CheckOneRGB_f(ContextID, xform2, 128, 0, 0, 26.164701, 48.478171, 39.4384713, 0.01); - cmsDeleteTransform(DbgThread(), xform1); - cmsDeleteTransform(DbgThread(), xform2); + cmsDeleteTransform(ContextID, xform1); + cmsDeleteTransform(ContextID, xform2); return rc; } @@ -6293,7 +6286,8 @@ cmsInt32Number Chack_sRGB_Float(void) // --------------------------------------------------- static -cmsBool GetProfileRGBPrimaries(cmsHPROFILE hProfile, +cmsBool GetProfileRGBPrimaries(cmsContext ContextID, + cmsHPROFILE hProfile, cmsCIEXYZTRIPLE *result, cmsUInt32Number intent) { @@ -6303,41 +6297,41 @@ cmsBool GetProfileRGBPrimaries(cmsHPROFILE hProfile, {0., 1., 0.}, {0., 0., 1.}}; - hXYZ = cmsCreateXYZProfile(DbgThread()); + hXYZ = cmsCreateXYZProfile(ContextID); if (hXYZ == NULL) return FALSE; - hTransform = cmsCreateTransform(DbgThread(), hProfile, TYPE_RGB_DBL, hXYZ, TYPE_XYZ_DBL, + hTransform = cmsCreateTransform(ContextID, hProfile, TYPE_RGB_DBL, hXYZ, TYPE_XYZ_DBL, intent, cmsFLAGS_NOCACHE | cmsFLAGS_NOOPTIMIZE); - cmsCloseProfile(DbgThread(), hXYZ); + cmsCloseProfile(ContextID, hXYZ); if (hTransform == NULL) return FALSE; - cmsDoTransform(DbgThread(), hTransform, rgb, result, 3); - cmsDeleteTransform(DbgThread(), hTransform); + cmsDoTransform(ContextID, hTransform, rgb, result, 3); + cmsDeleteTransform(ContextID, hTransform); return TRUE; } static -int CheckRGBPrimaries(void) +int CheckRGBPrimaries(cmsContext ContextID) { cmsHPROFILE hsRGB; cmsCIEXYZTRIPLE tripXYZ; cmsCIExyYTRIPLE tripxyY; cmsBool result; - cmsSetAdaptationState(DbgThread(), 0); - hsRGB = cmsCreate_sRGBProfile(DbgThread()); + cmsSetAdaptationState(ContextID, 0); + hsRGB = cmsCreate_sRGBProfile(ContextID); if (!hsRGB) return 0; - result = GetProfileRGBPrimaries(hsRGB, &tripXYZ, + result = GetProfileRGBPrimaries(ContextID, hsRGB, &tripXYZ, INTENT_ABSOLUTE_COLORIMETRIC); - cmsCloseProfile(DbgThread(), hsRGB); + cmsCloseProfile(ContextID, hsRGB); if (!result) return 0; - cmsXYZ2xyY(DbgThread(), &tripxyY.Red, &tripXYZ.Red); - cmsXYZ2xyY(DbgThread(), &tripxyY.Green, &tripXYZ.Green); - cmsXYZ2xyY(DbgThread(), &tripxyY.Blue, &tripXYZ.Blue); + cmsXYZ2xyY(ContextID, &tripxyY.Red, &tripXYZ.Red); + cmsXYZ2xyY(ContextID, &tripxyY.Green, &tripXYZ.Green); + cmsXYZ2xyY(ContextID, &tripxyY.Blue, &tripXYZ.Blue); /* valus were taken from http://en.wikipedia.org/wiki/RGB_color_spaces#Specifications */ @@ -6361,10 +6355,10 @@ int CheckRGBPrimaries(void) // This function will check CMYK -> CMYK transforms. It uses FOGRA29 and SWOP ICC profiles static -cmsInt32Number CheckCMYK(cmsInt32Number Intent, const char *Profile1, const char* Profile2) +cmsInt32Number CheckCMYK(cmsContext ContextID, cmsInt32Number Intent, const char *Profile1, const char* Profile2) { - cmsHPROFILE hSWOP = cmsOpenProfileFromFile(DbgThread(), Profile1, "r"); - cmsHPROFILE hFOGRA = cmsOpenProfileFromFile(DbgThread(), Profile2, "r"); + cmsHPROFILE hSWOP = cmsOpenProfileFromFile(ContextID, Profile1, "r"); + cmsHPROFILE hFOGRA = cmsOpenProfileFromFile(ContextID, Profile2, "r"); cmsHTRANSFORM xform, swop_lab, fogra_lab; cmsFloat32Number CMYK1[4], CMYK2[4]; cmsCIELab Lab1, Lab2; @@ -6372,12 +6366,12 @@ cmsInt32Number CheckCMYK(cmsInt32Number Intent, const char *Profile1, const char cmsFloat64Number DeltaL, Max; cmsInt32Number i; - hLab = cmsCreateLab4Profile(DbgThread(), NULL); + hLab = cmsCreateLab4Profile(ContextID, NULL); - xform = cmsCreateTransform(DbgThread(), hSWOP, TYPE_CMYK_FLT, hFOGRA, TYPE_CMYK_FLT, Intent, 0); + xform = cmsCreateTransform(ContextID, hSWOP, TYPE_CMYK_FLT, hFOGRA, TYPE_CMYK_FLT, Intent, 0); - swop_lab = cmsCreateTransform(DbgThread(), hSWOP, TYPE_CMYK_FLT, hLab, TYPE_Lab_DBL, Intent, 0); - fogra_lab = cmsCreateTransform(DbgThread(), hFOGRA, TYPE_CMYK_FLT, hLab, TYPE_Lab_DBL, Intent, 0); + swop_lab = cmsCreateTransform(ContextID, hSWOP, TYPE_CMYK_FLT, hLab, TYPE_Lab_DBL, Intent, 0); + fogra_lab = cmsCreateTransform(ContextID, hFOGRA, TYPE_CMYK_FLT, hLab, TYPE_Lab_DBL, Intent, 0); Max = 0; for (i=0; i <= 100; i++) { @@ -6387,9 +6381,9 @@ cmsInt32Number CheckCMYK(cmsInt32Number Intent, const char *Profile1, const char CMYK1[2] = 30; CMYK1[3] = (cmsFloat32Number) i; - cmsDoTransform(DbgThread(), swop_lab, CMYK1, &Lab1, 1); - cmsDoTransform(DbgThread(), xform, CMYK1, CMYK2, 1); - cmsDoTransform(DbgThread(), fogra_lab, CMYK2, &Lab2, 1); + cmsDoTransform(ContextID, swop_lab, CMYK1, &Lab1, 1); + cmsDoTransform(ContextID, xform, CMYK1, CMYK2, 1); + cmsDoTransform(ContextID, fogra_lab, CMYK2, &Lab2, 1); DeltaL = fabs(Lab1.L - Lab2.L); @@ -6397,10 +6391,10 @@ cmsInt32Number CheckCMYK(cmsInt32Number Intent, const char *Profile1, const char } - cmsDeleteTransform(DbgThread(), xform); + cmsDeleteTransform(ContextID, xform); - xform = cmsCreateTransform(DbgThread(), hFOGRA, TYPE_CMYK_FLT, hSWOP, TYPE_CMYK_FLT, Intent, 0); + xform = cmsCreateTransform(ContextID, hFOGRA, TYPE_CMYK_FLT, hSWOP, TYPE_CMYK_FLT, Intent, 0); for (i=0; i <= 100; i++) { CMYK1[0] = 10; @@ -6408,9 +6402,9 @@ cmsInt32Number CheckCMYK(cmsInt32Number Intent, const char *Profile1, const char CMYK1[2] = 30; CMYK1[3] = (cmsFloat32Number) i; - cmsDoTransform(DbgThread(), fogra_lab, CMYK1, &Lab1, 1); - cmsDoTransform(DbgThread(), xform, CMYK1, CMYK2, 1); - cmsDoTransform(DbgThread(), swop_lab, CMYK2, &Lab2, 1); + cmsDoTransform(ContextID, fogra_lab, CMYK1, &Lab1, 1); + cmsDoTransform(ContextID, xform, CMYK1, CMYK2, 1); + cmsDoTransform(ContextID, swop_lab, CMYK2, &Lab2, 1); DeltaL = fabs(Lab1.L - Lab2.L); @@ -6418,45 +6412,45 @@ cmsInt32Number CheckCMYK(cmsInt32Number Intent, const char *Profile1, const char } - cmsCloseProfile(DbgThread(), hSWOP); - cmsCloseProfile(DbgThread(), hFOGRA); - cmsCloseProfile(DbgThread(), hLab); + cmsCloseProfile(ContextID, hSWOP); + cmsCloseProfile(ContextID, hFOGRA); + cmsCloseProfile(ContextID, hLab); - cmsDeleteTransform(DbgThread(), xform); - cmsDeleteTransform(DbgThread(), swop_lab); - cmsDeleteTransform(DbgThread(), fogra_lab); + cmsDeleteTransform(ContextID, xform); + cmsDeleteTransform(ContextID, swop_lab); + cmsDeleteTransform(ContextID, fogra_lab); return Max < 3.0; } static -cmsInt32Number CheckCMYKRoundtrip(void) +cmsInt32Number CheckCMYKRoundtrip(cmsContext ContextID) { - return CheckCMYK(INTENT_RELATIVE_COLORIMETRIC, "test1.icc", "test1.icc"); + return CheckCMYK(ContextID, INTENT_RELATIVE_COLORIMETRIC, "test1.icc", "test1.icc"); } static -cmsInt32Number CheckCMYKPerceptual(void) +cmsInt32Number CheckCMYKPerceptual(cmsContext ContextID) { - return CheckCMYK(INTENT_PERCEPTUAL, "test1.icc", "test2.icc"); + return CheckCMYK(ContextID, INTENT_PERCEPTUAL, "test1.icc", "test2.icc"); } static -cmsInt32Number CheckCMYKRelCol(void) +cmsInt32Number CheckCMYKRelCol(cmsContext ContextID) { - return CheckCMYK(INTENT_RELATIVE_COLORIMETRIC, "test1.icc", "test2.icc"); + return CheckCMYK(ContextID, INTENT_RELATIVE_COLORIMETRIC, "test1.icc", "test2.icc"); } static -cmsInt32Number CheckKOnlyBlackPreserving(void) +cmsInt32Number CheckKOnlyBlackPreserving(cmsContext ContextID) { - cmsHPROFILE hSWOP = cmsOpenProfileFromFile(DbgThread(), "test1.icc", "r"); - cmsHPROFILE hFOGRA = cmsOpenProfileFromFile(DbgThread(), "test2.icc", "r"); + cmsHPROFILE hSWOP = cmsOpenProfileFromFile(ContextID, "test1.icc", "r"); + cmsHPROFILE hFOGRA = cmsOpenProfileFromFile(ContextID, "test2.icc", "r"); cmsHTRANSFORM xform, swop_lab, fogra_lab; cmsFloat32Number CMYK1[4], CMYK2[4]; cmsCIELab Lab1, Lab2; @@ -6464,12 +6458,12 @@ cmsInt32Number CheckKOnlyBlackPreserving(void) cmsFloat64Number DeltaL, Max; cmsInt32Number i; - hLab = cmsCreateLab4Profile(DbgThread(), NULL); + hLab = cmsCreateLab4Profile(ContextID, NULL); - xform = cmsCreateTransform(DbgThread(), hSWOP, TYPE_CMYK_FLT, hFOGRA, TYPE_CMYK_FLT, INTENT_PRESERVE_K_ONLY_PERCEPTUAL, 0); + xform = cmsCreateTransform(ContextID, hSWOP, TYPE_CMYK_FLT, hFOGRA, TYPE_CMYK_FLT, INTENT_PRESERVE_K_ONLY_PERCEPTUAL, 0); - swop_lab = cmsCreateTransform(DbgThread(), hSWOP, TYPE_CMYK_FLT, hLab, TYPE_Lab_DBL, INTENT_PERCEPTUAL, 0); - fogra_lab = cmsCreateTransform(DbgThread(), hFOGRA, TYPE_CMYK_FLT, hLab, TYPE_Lab_DBL, INTENT_PERCEPTUAL, 0); + swop_lab = cmsCreateTransform(ContextID, hSWOP, TYPE_CMYK_FLT, hLab, TYPE_Lab_DBL, INTENT_PERCEPTUAL, 0); + fogra_lab = cmsCreateTransform(ContextID, hFOGRA, TYPE_CMYK_FLT, hLab, TYPE_Lab_DBL, INTENT_PERCEPTUAL, 0); Max = 0; @@ -6480,13 +6474,13 @@ cmsInt32Number CheckKOnlyBlackPreserving(void) CMYK1[3] = (cmsFloat32Number) i; // SWOP CMYK to Lab1 - cmsDoTransform(DbgThread(), swop_lab, CMYK1, &Lab1, 1); + cmsDoTransform(ContextID, swop_lab, CMYK1, &Lab1, 1); // SWOP To FOGRA using black preservation - cmsDoTransform(DbgThread(), xform, CMYK1, CMYK2, 1); + cmsDoTransform(ContextID, xform, CMYK1, CMYK2, 1); // Obtained FOGRA CMYK to Lab2 - cmsDoTransform(DbgThread(), fogra_lab, CMYK2, &Lab2, 1); + cmsDoTransform(ContextID, fogra_lab, CMYK2, &Lab2, 1); // We care only on L* DeltaL = fabs(Lab1.L - Lab2.L); @@ -6495,13 +6489,13 @@ cmsInt32Number CheckKOnlyBlackPreserving(void) } - cmsDeleteTransform(DbgThread(), xform); + cmsDeleteTransform(ContextID, xform); // dL should be below 3.0 // Same, but FOGRA to SWOP - xform = cmsCreateTransform(DbgThread(), hFOGRA, TYPE_CMYK_FLT, hSWOP, TYPE_CMYK_FLT, INTENT_PRESERVE_K_ONLY_PERCEPTUAL, 0); + xform = cmsCreateTransform(ContextID, hFOGRA, TYPE_CMYK_FLT, hSWOP, TYPE_CMYK_FLT, INTENT_PRESERVE_K_ONLY_PERCEPTUAL, 0); for (i=0; i <= 100; i++) { CMYK1[0] = 0; @@ -6509,9 +6503,9 @@ cmsInt32Number CheckKOnlyBlackPreserving(void) CMYK1[2] = 0; CMYK1[3] = (cmsFloat32Number) i; - cmsDoTransform(DbgThread(), fogra_lab, CMYK1, &Lab1, 1); - cmsDoTransform(DbgThread(), xform, CMYK1, CMYK2, 1); - cmsDoTransform(DbgThread(), swop_lab, CMYK2, &Lab2, 1); + cmsDoTransform(ContextID, fogra_lab, CMYK1, &Lab1, 1); + cmsDoTransform(ContextID, xform, CMYK1, CMYK2, 1); + cmsDoTransform(ContextID, swop_lab, CMYK2, &Lab2, 1); DeltaL = fabs(Lab1.L - Lab2.L); @@ -6519,22 +6513,22 @@ cmsInt32Number CheckKOnlyBlackPreserving(void) } - cmsCloseProfile(DbgThread(), hSWOP); - cmsCloseProfile(DbgThread(), hFOGRA); - cmsCloseProfile(DbgThread(), hLab); + cmsCloseProfile(ContextID, hSWOP); + cmsCloseProfile(ContextID, hFOGRA); + cmsCloseProfile(ContextID, hLab); - cmsDeleteTransform(DbgThread(), xform); - cmsDeleteTransform(DbgThread(), swop_lab); - cmsDeleteTransform(DbgThread(), fogra_lab); + cmsDeleteTransform(ContextID, xform); + cmsDeleteTransform(ContextID, swop_lab); + cmsDeleteTransform(ContextID, fogra_lab); return Max < 3.0; } static -cmsInt32Number CheckKPlaneBlackPreserving(void) +cmsInt32Number CheckKPlaneBlackPreserving(cmsContext ContextID) { - cmsHPROFILE hSWOP = cmsOpenProfileFromFile(DbgThread(), "test1.icc", "r"); - cmsHPROFILE hFOGRA = cmsOpenProfileFromFile(DbgThread(), "test2.icc", "r"); + cmsHPROFILE hSWOP = cmsOpenProfileFromFile(ContextID, "test1.icc", "r"); + cmsHPROFILE hFOGRA = cmsOpenProfileFromFile(ContextID, "test2.icc", "r"); cmsHTRANSFORM xform, swop_lab, fogra_lab; cmsFloat32Number CMYK1[4], CMYK2[4]; cmsCIELab Lab1, Lab2; @@ -6542,12 +6536,12 @@ cmsInt32Number CheckKPlaneBlackPreserving(void) cmsFloat64Number DeltaE, Max; cmsInt32Number i; - hLab = cmsCreateLab4Profile(DbgThread(), NULL); + hLab = cmsCreateLab4Profile(ContextID, NULL); - xform = cmsCreateTransform(DbgThread(), hSWOP, TYPE_CMYK_FLT, hFOGRA, TYPE_CMYK_FLT, INTENT_PERCEPTUAL, 0); + xform = cmsCreateTransform(ContextID, hSWOP, TYPE_CMYK_FLT, hFOGRA, TYPE_CMYK_FLT, INTENT_PERCEPTUAL, 0); - swop_lab = cmsCreateTransform(DbgThread(), hSWOP, TYPE_CMYK_FLT, hLab, TYPE_Lab_DBL, INTENT_PERCEPTUAL, 0); - fogra_lab = cmsCreateTransform(DbgThread(), hFOGRA, TYPE_CMYK_FLT, hLab, TYPE_Lab_DBL, INTENT_PERCEPTUAL, 0); + swop_lab = cmsCreateTransform(ContextID, hSWOP, TYPE_CMYK_FLT, hLab, TYPE_Lab_DBL, INTENT_PERCEPTUAL, 0); + fogra_lab = cmsCreateTransform(ContextID, hFOGRA, TYPE_CMYK_FLT, hLab, TYPE_Lab_DBL, INTENT_PERCEPTUAL, 0); Max = 0; @@ -6557,19 +6551,19 @@ cmsInt32Number CheckKPlaneBlackPreserving(void) CMYK1[2] = 0; CMYK1[3] = (cmsFloat32Number) i; - cmsDoTransform(DbgThread(), swop_lab, CMYK1, &Lab1, 1); - cmsDoTransform(DbgThread(), xform, CMYK1, CMYK2, 1); - cmsDoTransform(DbgThread(), fogra_lab, CMYK2, &Lab2, 1); + cmsDoTransform(ContextID, swop_lab, CMYK1, &Lab1, 1); + cmsDoTransform(ContextID, xform, CMYK1, CMYK2, 1); + cmsDoTransform(ContextID, fogra_lab, CMYK2, &Lab2, 1); - DeltaE = cmsDeltaE(DbgThread(), &Lab1, &Lab2); + DeltaE = cmsDeltaE(ContextID, &Lab1, &Lab2); if (DeltaE > Max) Max = DeltaE; } - cmsDeleteTransform(DbgThread(), xform); + cmsDeleteTransform(ContextID, xform); - xform = cmsCreateTransform(DbgThread(), hFOGRA, TYPE_CMYK_FLT, hSWOP, TYPE_CMYK_FLT, INTENT_PRESERVE_K_PLANE_PERCEPTUAL, 0); + xform = cmsCreateTransform(ContextID, hFOGRA, TYPE_CMYK_FLT, hSWOP, TYPE_CMYK_FLT, INTENT_PRESERVE_K_PLANE_PERCEPTUAL, 0); for (i=0; i <= 100; i++) { CMYK1[0] = 30; @@ -6577,26 +6571,26 @@ cmsInt32Number CheckKPlaneBlackPreserving(void) CMYK1[2] = 10; CMYK1[3] = (cmsFloat32Number) i; - cmsDoTransform(DbgThread(), fogra_lab, CMYK1, &Lab1, 1); - cmsDoTransform(DbgThread(), xform, CMYK1, CMYK2, 1); - cmsDoTransform(DbgThread(), swop_lab, CMYK2, &Lab2, 1); + cmsDoTransform(ContextID, fogra_lab, CMYK1, &Lab1, 1); + cmsDoTransform(ContextID, xform, CMYK1, CMYK2, 1); + cmsDoTransform(ContextID, swop_lab, CMYK2, &Lab2, 1); - DeltaE = cmsDeltaE(DbgThread(), &Lab1, &Lab2); + DeltaE = cmsDeltaE(ContextID, &Lab1, &Lab2); if (DeltaE > Max) Max = DeltaE; } - cmsDeleteTransform(DbgThread(), xform); + cmsDeleteTransform(ContextID, xform); - cmsCloseProfile(DbgThread(), hSWOP); - cmsCloseProfile(DbgThread(), hFOGRA); - cmsCloseProfile(DbgThread(), hLab); + cmsCloseProfile(ContextID, hSWOP); + cmsCloseProfile(ContextID, hFOGRA); + cmsCloseProfile(ContextID, hLab); - cmsDeleteTransform(DbgThread(), swop_lab); - cmsDeleteTransform(DbgThread(), fogra_lab); + cmsDeleteTransform(ContextID, swop_lab); + cmsDeleteTransform(ContextID, fogra_lab); return Max < 30.0; } @@ -6606,40 +6600,40 @@ cmsInt32Number CheckKPlaneBlackPreserving(void) static -cmsInt32Number CheckProofingXFORMFloat(void) +cmsInt32Number CheckProofingXFORMFloat(cmsContext ContextID) { cmsHPROFILE hAbove; cmsHTRANSFORM xform; cmsInt32Number rc; - hAbove = Create_AboveRGB(); - xform = cmsCreateProofingTransform(DbgThread(), hAbove, TYPE_RGB_FLT, hAbove, TYPE_RGB_FLT, hAbove, + hAbove = Create_AboveRGB(ContextID); + xform = cmsCreateProofingTransform(ContextID, hAbove, TYPE_RGB_FLT, hAbove, TYPE_RGB_FLT, hAbove, INTENT_RELATIVE_COLORIMETRIC, INTENT_RELATIVE_COLORIMETRIC, cmsFLAGS_SOFTPROOFING); - cmsCloseProfile(DbgThread(), hAbove); - rc = CheckFloatlinearXFORM(xform, 3); - cmsDeleteTransform(DbgThread(), xform); + cmsCloseProfile(ContextID, hAbove); + rc = CheckFloatlinearXFORM(ContextID, xform, 3); + cmsDeleteTransform(ContextID, xform); return rc; } static -cmsInt32Number CheckProofingXFORM16(void) +cmsInt32Number CheckProofingXFORM16(cmsContext ContextID) { cmsHPROFILE hAbove; cmsHTRANSFORM xform; cmsInt32Number rc; - hAbove = Create_AboveRGB(); - xform = cmsCreateProofingTransform(DbgThread(), hAbove, TYPE_RGB_16, hAbove, TYPE_RGB_16, hAbove, + hAbove = Create_AboveRGB(ContextID); + xform = cmsCreateProofingTransform(ContextID, hAbove, TYPE_RGB_16, hAbove, TYPE_RGB_16, hAbove, INTENT_RELATIVE_COLORIMETRIC, INTENT_RELATIVE_COLORIMETRIC, cmsFLAGS_SOFTPROOFING|cmsFLAGS_NOCACHE); - cmsCloseProfile(DbgThread(), hAbove); - rc = Check16linearXFORM(xform, 3); - cmsDeleteTransform(DbgThread(), xform); + cmsCloseProfile(ContextID, hAbove); + rc = Check16linearXFORM(ContextID, xform, 3); + cmsDeleteTransform(ContextID, xform); return rc; } static -cmsInt32Number CheckGamutCheck(void) +cmsInt32Number CheckGamutCheck(cmsContext ContextID) { cmsHPROFILE hSRGB, hAbove; cmsHTRANSFORM xform; @@ -6647,42 +6641,42 @@ cmsInt32Number CheckGamutCheck(void) cmsUInt16Number Alarm[16] = { 0xDEAD, 0xBABE, 0xFACE }; // Set alarm codes to fancy values so we could check the out of gamut condition - cmsSetAlarmCodes(DbgThread(), Alarm); + cmsSetAlarmCodes(ContextID, Alarm); // Create the profiles - hSRGB = cmsCreate_sRGBProfile(DbgThread()); - hAbove = Create_AboveRGB(); + hSRGB = cmsCreate_sRGBProfile(ContextID); + hAbove = Create_AboveRGB(ContextID); if (hSRGB == NULL || hAbove == NULL) return 0; // Failed SubTest("Gamut check on floating point"); // Create a gamut checker in the same space. No value should be out of gamut - xform = cmsCreateProofingTransform(DbgThread(), hAbove, TYPE_RGB_FLT, hAbove, TYPE_RGB_FLT, hAbove, + xform = cmsCreateProofingTransform(ContextID, hAbove, TYPE_RGB_FLT, hAbove, TYPE_RGB_FLT, hAbove, INTENT_RELATIVE_COLORIMETRIC, INTENT_RELATIVE_COLORIMETRIC, cmsFLAGS_GAMUTCHECK); - if (!CheckFloatlinearXFORM(xform, 3)) { - cmsCloseProfile(DbgThread(), hSRGB); - cmsCloseProfile(DbgThread(), hAbove); - cmsDeleteTransform(DbgThread(), xform); + if (!CheckFloatlinearXFORM(ContextID, xform, 3)) { + cmsCloseProfile(ContextID, hSRGB); + cmsCloseProfile(ContextID, hAbove); + cmsDeleteTransform(ContextID, xform); Fail("Gamut check on same profile failed"); return 0; } - cmsDeleteTransform(DbgThread(), xform); + cmsDeleteTransform(ContextID, xform); SubTest("Gamut check on 16 bits"); - xform = cmsCreateProofingTransform(DbgThread(), hAbove, TYPE_RGB_16, hAbove, TYPE_RGB_16, hSRGB, + xform = cmsCreateProofingTransform(ContextID, hAbove, TYPE_RGB_16, hAbove, TYPE_RGB_16, hSRGB, INTENT_RELATIVE_COLORIMETRIC, INTENT_RELATIVE_COLORIMETRIC, cmsFLAGS_GAMUTCHECK); - cmsCloseProfile(DbgThread(), hSRGB); - cmsCloseProfile(DbgThread(), hAbove); + cmsCloseProfile(ContextID, hSRGB); + cmsCloseProfile(ContextID, hAbove); - rc = Check16linearXFORM(xform, 3); + rc = Check16linearXFORM(ContextID, xform, 3); - cmsDeleteTransform(DbgThread(), xform); + cmsDeleteTransform(ContextID, xform); return rc; } @@ -6692,54 +6686,54 @@ cmsInt32Number CheckGamutCheck(void) // ------------------------------------------------------------------------------------------------------------------- static -cmsInt32Number CheckBlackPoint(void) +cmsInt32Number CheckBlackPoint(cmsContext ContextID) { cmsHPROFILE hProfile; cmsCIEXYZ Black; cmsCIELab Lab; - hProfile = cmsOpenProfileFromFile(DbgThread(), "test5.icc", "r"); - cmsDetectDestinationBlackPoint(DbgThread(), &Black, hProfile, INTENT_RELATIVE_COLORIMETRIC, 0); - cmsCloseProfile(DbgThread(), hProfile); + hProfile = cmsOpenProfileFromFile(ContextID, "test5.icc", "r"); + cmsDetectDestinationBlackPoint(ContextID, &Black, hProfile, INTENT_RELATIVE_COLORIMETRIC, 0); + cmsCloseProfile(ContextID, hProfile); - hProfile = cmsOpenProfileFromFile(DbgThread(), "test1.icc", "r"); - cmsDetectDestinationBlackPoint(DbgThread(), &Black, hProfile, INTENT_RELATIVE_COLORIMETRIC, 0); - cmsXYZ2Lab(DbgThread(), NULL, &Lab, &Black); - cmsCloseProfile(DbgThread(), hProfile); + hProfile = cmsOpenProfileFromFile(ContextID, "test1.icc", "r"); + cmsDetectDestinationBlackPoint(ContextID, &Black, hProfile, INTENT_RELATIVE_COLORIMETRIC, 0); + cmsXYZ2Lab(ContextID, NULL, &Lab, &Black); + cmsCloseProfile(ContextID, hProfile); - hProfile = cmsOpenProfileFromFile(DbgThread(), "lcms2cmyk.icc", "r"); - cmsDetectDestinationBlackPoint(DbgThread(), &Black, hProfile, INTENT_RELATIVE_COLORIMETRIC, 0); - cmsXYZ2Lab(DbgThread(), NULL, &Lab, &Black); - cmsCloseProfile(DbgThread(), hProfile); + hProfile = cmsOpenProfileFromFile(ContextID, "lcms2cmyk.icc", "r"); + cmsDetectDestinationBlackPoint(ContextID, &Black, hProfile, INTENT_RELATIVE_COLORIMETRIC, 0); + cmsXYZ2Lab(ContextID, NULL, &Lab, &Black); + cmsCloseProfile(ContextID, hProfile); - hProfile = cmsOpenProfileFromFile(DbgThread(), "test2.icc", "r"); - cmsDetectDestinationBlackPoint(DbgThread(), &Black, hProfile, INTENT_RELATIVE_COLORIMETRIC, 0); - cmsXYZ2Lab(DbgThread(), NULL, &Lab, &Black); - cmsCloseProfile(DbgThread(), hProfile); + hProfile = cmsOpenProfileFromFile(ContextID, "test2.icc", "r"); + cmsDetectDestinationBlackPoint(ContextID, &Black, hProfile, INTENT_RELATIVE_COLORIMETRIC, 0); + cmsXYZ2Lab(ContextID, NULL, &Lab, &Black); + cmsCloseProfile(ContextID, hProfile); - hProfile = cmsOpenProfileFromFile(DbgThread(), "test1.icc", "r"); - cmsDetectDestinationBlackPoint(DbgThread(), &Black, hProfile, INTENT_PERCEPTUAL, 0); - cmsXYZ2Lab(DbgThread(), NULL, &Lab, &Black); - cmsCloseProfile(DbgThread(), hProfile); + hProfile = cmsOpenProfileFromFile(ContextID, "test1.icc", "r"); + cmsDetectDestinationBlackPoint(ContextID, &Black, hProfile, INTENT_PERCEPTUAL, 0); + cmsXYZ2Lab(ContextID, NULL, &Lab, &Black); + cmsCloseProfile(ContextID, hProfile); return 1; } static -cmsInt32Number CheckOneTAC(cmsFloat64Number InkLimit) +cmsInt32Number CheckOneTAC(cmsContext ContextID, cmsFloat64Number InkLimit) { cmsHPROFILE h; cmsFloat64Number d; - h =CreateFakeCMYK(InkLimit, TRUE); - cmsSaveProfileToFile(DbgThread(), h, "lcmstac.icc"); - cmsCloseProfile(DbgThread(), h); + h =CreateFakeCMYK(ContextID, InkLimit, TRUE); + cmsSaveProfileToFile(ContextID, h, "lcmstac.icc"); + cmsCloseProfile(ContextID, h); - h = cmsOpenProfileFromFile(DbgThread(), "lcmstac.icc", "r"); - d = cmsDetectTAC(DbgThread(), h); - cmsCloseProfile(DbgThread(), h); + h = cmsOpenProfileFromFile(ContextID, "lcmstac.icc", "r"); + d = cmsDetectTAC(ContextID, h); + cmsCloseProfile(ContextID, h); remove("lcmstac.icc"); @@ -6750,13 +6744,13 @@ cmsInt32Number CheckOneTAC(cmsFloat64Number InkLimit) static -cmsInt32Number CheckTAC(void) +cmsInt32Number CheckTAC(cmsContext ContextID) { - if (!CheckOneTAC(180)) return 0; - if (!CheckOneTAC(220)) return 0; - if (!CheckOneTAC(286)) return 0; - if (!CheckOneTAC(310)) return 0; - if (!CheckOneTAC(330)) return 0; + if (!CheckOneTAC(ContextID, 180)) return 0; + if (!CheckOneTAC(ContextID, 220)) return 0; + if (!CheckOneTAC(ContextID, 286)) return 0; + if (!CheckOneTAC(ContextID, 310)) return 0; + if (!CheckOneTAC(ContextID, 330)) return 0; return 1; } @@ -6767,30 +6761,30 @@ cmsInt32Number CheckTAC(void) #define NPOINTS_IT8 10 // (17*17*17*17) static -cmsInt32Number CheckCGATS(void) +cmsInt32Number CheckCGATS(cmsContext ContextID) { cmsHANDLE it8; cmsInt32Number i; SubTest("IT8 creation"); - it8 = cmsIT8Alloc(DbgThread()); + it8 = cmsIT8Alloc(ContextID); if (it8 == NULL) return 0; - cmsIT8SetSheetType(DbgThread(), it8, "LCMS/TESTING"); - cmsIT8SetPropertyStr(DbgThread(), it8, "ORIGINATOR", "1 2 3 4"); - cmsIT8SetPropertyUncooked(DbgThread(), it8, "DESCRIPTOR", "1234"); - cmsIT8SetPropertyStr(DbgThread(), it8, "MANUFACTURER", "3"); - cmsIT8SetPropertyDbl(DbgThread(), it8, "CREATED", 4); - cmsIT8SetPropertyDbl(DbgThread(), it8, "SERIAL", 5); - cmsIT8SetPropertyHex(DbgThread(), it8, "MATERIAL", 0x123); + cmsIT8SetSheetType(ContextID, it8, "LCMS/TESTING"); + cmsIT8SetPropertyStr(ContextID, it8, "ORIGINATOR", "1 2 3 4"); + cmsIT8SetPropertyUncooked(ContextID, it8, "DESCRIPTOR", "1234"); + cmsIT8SetPropertyStr(ContextID, it8, "MANUFACTURER", "3"); + cmsIT8SetPropertyDbl(ContextID, it8, "CREATED", 4); + cmsIT8SetPropertyDbl(ContextID, it8, "SERIAL", 5); + cmsIT8SetPropertyHex(ContextID, it8, "MATERIAL", 0x123); - cmsIT8SetPropertyDbl(DbgThread(), it8, "NUMBER_OF_SETS", NPOINTS_IT8); - cmsIT8SetPropertyDbl(DbgThread(), it8, "NUMBER_OF_FIELDS", 4); + cmsIT8SetPropertyDbl(ContextID, it8, "NUMBER_OF_SETS", NPOINTS_IT8); + cmsIT8SetPropertyDbl(ContextID, it8, "NUMBER_OF_FIELDS", 4); - cmsIT8SetDataFormat(DbgThread(), it8, 0, "SAMPLE_ID"); - cmsIT8SetDataFormat(DbgThread(), it8, 1, "RGB_R"); - cmsIT8SetDataFormat(DbgThread(), it8, 2, "RGB_G"); - cmsIT8SetDataFormat(DbgThread(), it8, 3, "RGB_B"); + cmsIT8SetDataFormat(ContextID, it8, 0, "SAMPLE_ID"); + cmsIT8SetDataFormat(ContextID, it8, 1, "RGB_R"); + cmsIT8SetDataFormat(ContextID, it8, 2, "RGB_G"); + cmsIT8SetDataFormat(ContextID, it8, 3, "RGB_B"); SubTest("Table creation"); for (i=0; i < NPOINTS_IT8; i++) { @@ -6799,73 +6793,73 @@ cmsInt32Number CheckCGATS(void) sprintf(Patch, "P%d", i); - cmsIT8SetDataRowCol(DbgThread(), it8, i, 0, Patch); - cmsIT8SetDataRowColDbl(DbgThread(), it8, i, 1, i); - cmsIT8SetDataRowColDbl(DbgThread(), it8, i, 2, i); - cmsIT8SetDataRowColDbl(DbgThread(), it8, i, 3, i); + cmsIT8SetDataRowCol(ContextID, it8, i, 0, Patch); + cmsIT8SetDataRowColDbl(ContextID, it8, i, 1, i); + cmsIT8SetDataRowColDbl(ContextID, it8, i, 2, i); + cmsIT8SetDataRowColDbl(ContextID, it8, i, 3, i); } SubTest("Save to file"); - cmsIT8SaveToFile(DbgThread(), it8, "TEST.IT8"); - cmsIT8Free(DbgThread(), it8); + cmsIT8SaveToFile(ContextID, it8, "TEST.IT8"); + cmsIT8Free(ContextID, it8); SubTest("Load from file"); - it8 = cmsIT8LoadFromFile(DbgThread(), "TEST.IT8"); + it8 = cmsIT8LoadFromFile(ContextID, "TEST.IT8"); if (it8 == NULL) return 0; SubTest("Save again file"); - cmsIT8SaveToFile(DbgThread(), it8, "TEST.IT8"); - cmsIT8Free(DbgThread(), it8); + cmsIT8SaveToFile(ContextID, it8, "TEST.IT8"); + cmsIT8Free(ContextID, it8); SubTest("Load from file (II)"); - it8 = cmsIT8LoadFromFile(DbgThread(), "TEST.IT8"); + it8 = cmsIT8LoadFromFile(ContextID, "TEST.IT8"); if (it8 == NULL) return 0; SubTest("Change prop value"); - if (cmsIT8GetPropertyDbl(DbgThread(), it8, "DESCRIPTOR") != 1234) { + if (cmsIT8GetPropertyDbl(ContextID, it8, "DESCRIPTOR") != 1234) { return 0; } - cmsIT8SetPropertyDbl(DbgThread(), it8, "DESCRIPTOR", 5678); - if (cmsIT8GetPropertyDbl(DbgThread(), it8, "DESCRIPTOR") != 5678) { + cmsIT8SetPropertyDbl(ContextID, it8, "DESCRIPTOR", 5678); + if (cmsIT8GetPropertyDbl(ContextID, it8, "DESCRIPTOR") != 5678) { return 0; } SubTest("Positive numbers"); - if (cmsIT8GetDataDbl(DbgThread(), it8, "P3", "RGB_G") != 3) { + if (cmsIT8GetDataDbl(ContextID, it8, "P3", "RGB_G") != 3) { return 0; } SubTest("Positive exponent numbers"); - cmsIT8SetPropertyDbl(DbgThread(), it8, "DBL_PROP", 123E+12); - if ((cmsIT8GetPropertyDbl(DbgThread(), it8, "DBL_PROP") - 123E+12) > 1 ) { + cmsIT8SetPropertyDbl(ContextID, it8, "DBL_PROP", 123E+12); + if ((cmsIT8GetPropertyDbl(ContextID, it8, "DBL_PROP") - 123E+12) > 1 ) { return 0; } SubTest("Negative exponent numbers"); - cmsIT8SetPropertyDbl(DbgThread(), it8, "DBL_PROP_NEG", 123E-45); - if ((cmsIT8GetPropertyDbl(DbgThread(), it8, "DBL_PROP_NEG") - 123E-45) > 1E-45 ) { + cmsIT8SetPropertyDbl(ContextID, it8, "DBL_PROP_NEG", 123E-45); + if ((cmsIT8GetPropertyDbl(ContextID, it8, "DBL_PROP_NEG") - 123E-45) > 1E-45 ) { return 0; } SubTest("Negative numbers"); - cmsIT8SetPropertyDbl(DbgThread(), it8, "DBL_NEG_VAL", -123); - if ((cmsIT8GetPropertyDbl(DbgThread(), it8, "DBL_NEG_VAL")) != -123 ) { + cmsIT8SetPropertyDbl(ContextID, it8, "DBL_NEG_VAL", -123); + if ((cmsIT8GetPropertyDbl(ContextID, it8, "DBL_NEG_VAL")) != -123 ) { return 0; } - cmsIT8Free(DbgThread(), it8); + cmsIT8Free(ContextID, it8); remove("TEST.IT8"); return 1; @@ -6874,28 +6868,28 @@ cmsInt32Number CheckCGATS(void) static -cmsInt32Number CheckCGATS2(void) +cmsInt32Number CheckCGATS2(cmsContext ContextID) { cmsHANDLE handle; const cmsUInt8Number junk[] = { 0x0, 0xd, 0xd, 0xa, 0x20, 0xd, 0x20, 0x20, 0x20, 0x3a, 0x31, 0x3d, 0x3d, 0x3d, 0x3d }; - handle = cmsIT8LoadFromMem(0, (const void*)junk, sizeof(junk)); + handle = cmsIT8LoadFromMem(ContextID, (const void*)junk, sizeof(junk)); if (handle) - cmsIT8Free(DbgThread(), handle); + cmsIT8Free(ContextID, handle); return 1; } static -cmsInt32Number CheckCGATS_Overflow(void) +cmsInt32Number CheckCGATS_Overflow(cmsContext ContextID) { cmsHANDLE handle; const cmsUInt8Number junk[] = { "@\nA 1.e2147483648\n" }; - handle = cmsIT8LoadFromMem(0, (const void*)junk, sizeof(junk)); + handle = cmsIT8LoadFromMem(ContextID, (const void*)junk, sizeof(junk)); if (handle) - cmsIT8Free(DbgThread(), handle); + cmsIT8Free(ContextID, handle); return 1; } @@ -6903,25 +6897,24 @@ cmsInt32Number CheckCGATS_Overflow(void) // Create CSA/CRD static -void GenerateCSA(const char* cInProf, const char* FileName) +void GenerateCSA(cmsContext BuffThread, const char* cInProf, const char* FileName) { cmsHPROFILE hProfile; cmsUInt32Number n; char* Buffer; - cmsContext BuffThread = DbgThread(); FILE* o; if (cInProf == NULL) - hProfile = cmsCreateLab4Profile(DbgThread(), NULL); + hProfile = cmsCreateLab4Profile(BuffThread, NULL); else - hProfile = cmsOpenProfileFromFile(DbgThread(), cInProf, "r"); + hProfile = cmsOpenProfileFromFile(BuffThread, cInProf, "r"); - n = cmsGetPostScriptCSA(DbgThread(), hProfile, 0, 0, NULL, 0); + n = cmsGetPostScriptCSA(BuffThread, hProfile, 0, 0, NULL, 0); if (n == 0) return; Buffer = (char*) _cmsMalloc(BuffThread, n + 1); - cmsGetPostScriptCSA(DbgThread(), hProfile, 0, 0, Buffer, n); + cmsGetPostScriptCSA(BuffThread, hProfile, 0, 0, Buffer, n); Buffer[n] = 0; if (FileName != NULL) { @@ -6931,32 +6924,31 @@ void GenerateCSA(const char* cInProf, const char* FileName) } _cmsFree(BuffThread, Buffer); - cmsCloseProfile(DbgThread(), hProfile); + cmsCloseProfile(BuffThread, hProfile); if (FileName != NULL) remove(FileName); } static -void GenerateCRD(const char* cOutProf, const char* FileName) +void GenerateCRD(cmsContext BuffThread, const char* cOutProf, const char* FileName) { cmsHPROFILE hProfile; cmsUInt32Number n; char* Buffer; cmsUInt32Number dwFlags = 0; - cmsContext BuffThread = DbgThread(); if (cOutProf == NULL) - hProfile = cmsCreateLab4Profile(DbgThread(), NULL); + hProfile = cmsCreateLab4Profile(BuffThread, NULL); else - hProfile = cmsOpenProfileFromFile(DbgThread(), cOutProf, "r"); + hProfile = cmsOpenProfileFromFile(BuffThread, cOutProf, "r"); - n = cmsGetPostScriptCRD(DbgThread(), hProfile, 0, dwFlags, NULL, 0); + n = cmsGetPostScriptCRD(BuffThread, hProfile, 0, dwFlags, NULL, 0); if (n == 0) return; Buffer = (char*) _cmsMalloc(BuffThread, n + 1); - cmsGetPostScriptCRD(DbgThread(), hProfile, 0, dwFlags, Buffer, n); + cmsGetPostScriptCRD(BuffThread, hProfile, 0, dwFlags, Buffer, n); Buffer[n] = 0; if (FileName != NULL) { @@ -6966,38 +6958,38 @@ void GenerateCRD(const char* cOutProf, const char* FileName) } _cmsFree(BuffThread, Buffer); - cmsCloseProfile(DbgThread(), hProfile); + cmsCloseProfile(BuffThread, hProfile); if (FileName != NULL) remove(FileName); } static -cmsInt32Number CheckPostScript(void) +cmsInt32Number CheckPostScript(cmsContext ContextID) { - GenerateCSA("test5.icc", "sRGB_CSA.ps"); - GenerateCSA("aRGBlcms2.icc", "aRGB_CSA.ps"); - GenerateCSA("test4.icc", "sRGBV4_CSA.ps"); - GenerateCSA("test1.icc", "SWOP_CSA.ps"); - GenerateCSA(NULL, "Lab_CSA.ps"); - GenerateCSA("graylcms2.icc", "gray_CSA.ps"); + GenerateCSA(ContextID, "test5.icc", "sRGB_CSA.ps"); + GenerateCSA(ContextID, "aRGBlcms2.icc", "aRGB_CSA.ps"); + GenerateCSA(ContextID, "test4.icc", "sRGBV4_CSA.ps"); + GenerateCSA(ContextID, "test1.icc", "SWOP_CSA.ps"); + GenerateCSA(ContextID, NULL, "Lab_CSA.ps"); + GenerateCSA(ContextID, "graylcms2.icc", "gray_CSA.ps"); - GenerateCRD("test5.icc", "sRGB_CRD.ps"); - GenerateCRD("aRGBlcms2.icc", "aRGB_CRD.ps"); - GenerateCRD(NULL, "Lab_CRD.ps"); - GenerateCRD("test1.icc", "SWOP_CRD.ps"); - GenerateCRD("test4.icc", "sRGBV4_CRD.ps"); - GenerateCRD("graylcms2.icc", "gray_CRD.ps"); + GenerateCRD(ContextID, "test5.icc", "sRGB_CRD.ps"); + GenerateCRD(ContextID, "aRGBlcms2.icc", "aRGB_CRD.ps"); + GenerateCRD(ContextID, NULL, "Lab_CRD.ps"); + GenerateCRD(ContextID, "test1.icc", "SWOP_CRD.ps"); + GenerateCRD(ContextID, "test4.icc", "sRGBV4_CRD.ps"); + GenerateCRD(ContextID, "graylcms2.icc", "gray_CRD.ps"); return 1; } static -cmsInt32Number CheckGray(cmsHTRANSFORM xform, cmsUInt8Number g, double L) +cmsInt32Number CheckGray(cmsContext ContextID, cmsHTRANSFORM xform, cmsUInt8Number g, double L) { cmsCIELab Lab; - cmsDoTransform(DbgThread(), xform, &g, &Lab, 1); + cmsDoTransform(ContextID, xform, &g, &Lab, 1); if (!IsGoodVal("a axis on gray", 0, Lab.a, 0.001)) return 0; if (!IsGoodVal("b axis on gray", 0, Lab.b, 0.001)) return 0; @@ -7006,50 +6998,50 @@ cmsInt32Number CheckGray(cmsHTRANSFORM xform, cmsUInt8Number g, double L) } static -cmsInt32Number CheckInputGray(void) +cmsInt32Number CheckInputGray(cmsContext ContextID) { - cmsHPROFILE hGray = Create_Gray22(); - cmsHPROFILE hLab = cmsCreateLab4Profile(DbgThread(), NULL); + cmsHPROFILE hGray = Create_Gray22(ContextID); + cmsHPROFILE hLab = cmsCreateLab4Profile(ContextID, NULL); cmsHTRANSFORM xform; if (hGray == NULL || hLab == NULL) return 0; - xform = cmsCreateTransform(DbgThread(), hGray, TYPE_GRAY_8, hLab, TYPE_Lab_DBL, INTENT_RELATIVE_COLORIMETRIC, 0); - cmsCloseProfile(DbgThread(), hGray); cmsCloseProfile(DbgThread(), hLab); + xform = cmsCreateTransform(ContextID, hGray, TYPE_GRAY_8, hLab, TYPE_Lab_DBL, INTENT_RELATIVE_COLORIMETRIC, 0); + cmsCloseProfile(ContextID, hGray); cmsCloseProfile(ContextID, hLab); - if (!CheckGray(xform, 0, 0)) return 0; - if (!CheckGray(xform, 125, 52.768)) return 0; - if (!CheckGray(xform, 200, 81.069)) return 0; - if (!CheckGray(xform, 255, 100.0)) return 0; + if (!CheckGray(ContextID, xform, 0, 0)) return 0; + if (!CheckGray(ContextID, xform, 125, 52.768)) return 0; + if (!CheckGray(ContextID, xform, 200, 81.069)) return 0; + if (!CheckGray(ContextID, xform, 255, 100.0)) return 0; - cmsDeleteTransform(DbgThread(), xform); + cmsDeleteTransform(ContextID, xform); return 1; } static -cmsInt32Number CheckLabInputGray(void) +cmsInt32Number CheckLabInputGray(cmsContext ContextID) { - cmsHPROFILE hGray = Create_GrayLab(); - cmsHPROFILE hLab = cmsCreateLab4Profile(DbgThread(), NULL); + cmsHPROFILE hGray = Create_GrayLab(ContextID); + cmsHPROFILE hLab = cmsCreateLab4Profile(ContextID, NULL); cmsHTRANSFORM xform; if (hGray == NULL || hLab == NULL) return 0; - xform = cmsCreateTransform(DbgThread(), hGray, TYPE_GRAY_8, hLab, TYPE_Lab_DBL, INTENT_RELATIVE_COLORIMETRIC, 0); - cmsCloseProfile(DbgThread(), hGray); cmsCloseProfile(DbgThread(), hLab); + xform = cmsCreateTransform(ContextID, hGray, TYPE_GRAY_8, hLab, TYPE_Lab_DBL, INTENT_RELATIVE_COLORIMETRIC, 0); + cmsCloseProfile(ContextID, hGray); cmsCloseProfile(ContextID, hLab); - if (!CheckGray(xform, 0, 0)) return 0; - if (!CheckGray(xform, 125, 49.019)) return 0; - if (!CheckGray(xform, 200, 78.431)) return 0; - if (!CheckGray(xform, 255, 100.0)) return 0; + if (!CheckGray(ContextID, xform, 0, 0)) return 0; + if (!CheckGray(ContextID, xform, 125, 49.019)) return 0; + if (!CheckGray(ContextID, xform, 200, 78.431)) return 0; + if (!CheckGray(ContextID, xform, 255, 100.0)) return 0; - cmsDeleteTransform(DbgThread(), xform); + cmsDeleteTransform(ContextID, xform); return 1; } static -cmsInt32Number CheckOutGray(cmsHTRANSFORM xform, double L, cmsUInt8Number g) +cmsInt32Number CheckOutGray(cmsContext ContextID, cmsHTRANSFORM xform, double L, cmsUInt8Number g) { cmsCIELab Lab; cmsUInt8Number g_out; @@ -7058,50 +7050,50 @@ cmsInt32Number CheckOutGray(cmsHTRANSFORM xform, double L, cmsUInt8Number g) Lab.a = 0; Lab.b = 0; - cmsDoTransform(DbgThread(), xform, &Lab, &g_out, 1); + cmsDoTransform(ContextID, xform, &Lab, &g_out, 1); return IsGoodVal("Gray value", g, (double) g_out, 0.01); } static -cmsInt32Number CheckOutputGray(void) +cmsInt32Number CheckOutputGray(cmsContext ContextID) { - cmsHPROFILE hGray = Create_Gray22(); - cmsHPROFILE hLab = cmsCreateLab4Profile(DbgThread(), NULL); + cmsHPROFILE hGray = Create_Gray22(ContextID); + cmsHPROFILE hLab = cmsCreateLab4Profile(ContextID, NULL); cmsHTRANSFORM xform; if (hGray == NULL || hLab == NULL) return 0; - xform = cmsCreateTransform(DbgThread(), hLab, TYPE_Lab_DBL, hGray, TYPE_GRAY_8, INTENT_RELATIVE_COLORIMETRIC, 0); - cmsCloseProfile(DbgThread(), hGray); cmsCloseProfile(DbgThread(), hLab); + xform = cmsCreateTransform(ContextID, hLab, TYPE_Lab_DBL, hGray, TYPE_GRAY_8, INTENT_RELATIVE_COLORIMETRIC, 0); + cmsCloseProfile(ContextID, hGray); cmsCloseProfile(ContextID, hLab); - if (!CheckOutGray(xform, 0, 0)) return 0; - if (!CheckOutGray(xform, 100, 255)) return 0; + if (!CheckOutGray(ContextID, xform, 0, 0)) return 0; + if (!CheckOutGray(ContextID, xform, 100, 255)) return 0; - if (!CheckOutGray(xform, 20, 52)) return 0; - if (!CheckOutGray(xform, 50, 118)) return 0; + if (!CheckOutGray(ContextID, xform, 20, 52)) return 0; + if (!CheckOutGray(ContextID, xform, 50, 118)) return 0; - cmsDeleteTransform(DbgThread(), xform); + cmsDeleteTransform(ContextID, xform); return 1; } static -cmsInt32Number CheckLabOutputGray(void) +cmsInt32Number CheckLabOutputGray(cmsContext ContextID) { - cmsHPROFILE hGray = Create_GrayLab(); - cmsHPROFILE hLab = cmsCreateLab4Profile(DbgThread(), NULL); + cmsHPROFILE hGray = Create_GrayLab(ContextID); + cmsHPROFILE hLab = cmsCreateLab4Profile(ContextID, NULL); cmsHTRANSFORM xform; cmsInt32Number i; if (hGray == NULL || hLab == NULL) return 0; - xform = cmsCreateTransform(DbgThread(), hLab, TYPE_Lab_DBL, hGray, TYPE_GRAY_8, INTENT_RELATIVE_COLORIMETRIC, 0); - cmsCloseProfile(DbgThread(), hGray); cmsCloseProfile(DbgThread(), hLab); + xform = cmsCreateTransform(ContextID, hLab, TYPE_Lab_DBL, hGray, TYPE_GRAY_8, INTENT_RELATIVE_COLORIMETRIC, 0); + cmsCloseProfile(ContextID, hGray); cmsCloseProfile(ContextID, hLab); - if (!CheckOutGray(xform, 0, 0)) return 0; - if (!CheckOutGray(xform, 100, 255)) return 0; + if (!CheckOutGray(ContextID, xform, 0, 0)) return 0; + if (!CheckOutGray(ContextID, xform, 100, 255)) return 0; for (i=0; i < 100; i++) { @@ -7109,32 +7101,32 @@ cmsInt32Number CheckLabOutputGray(void) g = (cmsUInt8Number) floor(i * 255.0 / 100.0 + 0.5); - if (!CheckOutGray(xform, i, g)) return 0; + if (!CheckOutGray(ContextID, xform, i, g)) return 0; } - cmsDeleteTransform(DbgThread(), xform); + cmsDeleteTransform(ContextID, xform); return 1; } static -cmsInt32Number CheckV4gamma(void) +cmsInt32Number CheckV4gamma(cmsContext ContextID) { cmsHPROFILE h; cmsUInt16Number Lin[] = {0, 0xffff}; - cmsToneCurve*g = cmsBuildTabulatedToneCurve16(DbgThread(), 2, Lin); + cmsToneCurve*g = cmsBuildTabulatedToneCurve16(ContextID, 2, Lin); - h = cmsOpenProfileFromFile(DbgThread(), "v4gamma.icc", "w"); + h = cmsOpenProfileFromFile(ContextID, "v4gamma.icc", "w"); if (h == NULL) return 0; - cmsSetProfileVersion(DbgThread(), h, 4.3); + cmsSetProfileVersion(ContextID, h, 4.3); - if (!cmsWriteTag(DbgThread(), h, cmsSigGrayTRCTag, g)) return 0; - cmsCloseProfile(DbgThread(), h); + if (!cmsWriteTag(ContextID, h, cmsSigGrayTRCTag, g)) return 0; + cmsCloseProfile(ContextID, h); - cmsFreeToneCurve(DbgThread(), g); + cmsFreeToneCurve(ContextID, g); remove("v4gamma.icc"); return 1; } @@ -7143,7 +7135,7 @@ cmsInt32Number CheckV4gamma(void) // Gamut descriptor routines static -cmsInt32Number CheckGBD(void) +cmsInt32Number CheckGBD(cmsContext ContextID) { cmsCIELab Lab; cmsHANDLE h; @@ -7152,7 +7144,7 @@ cmsInt32Number CheckGBD(void) cmsHPROFILE hLab, hsRGB; cmsHTRANSFORM xform; - h = cmsGBDAlloc(DbgThread()); + h = cmsGBDAlloc(ContextID); if (h == NULL) return 0; // Fill all Lab gamut as valid @@ -7165,12 +7157,12 @@ cmsInt32Number CheckGBD(void) Lab.L = L; Lab.a = a; Lab.b = b; - if (!cmsGDBAddPoint(DbgThread(), h, &Lab)) return 0; + if (!cmsGDBAddPoint(ContextID, h, &Lab)) return 0; } // Complete boundaries SubTest("computing Lab gamut"); - if (!cmsGDBCompute(DbgThread(), h, 0)) return 0; + if (!cmsGDBCompute(ContextID, h, 0)) return 0; // All points should be inside gamut @@ -7182,21 +7174,21 @@ cmsInt32Number CheckGBD(void) Lab.L = L; Lab.a = a; Lab.b = b; - if (!cmsGDBCheckPoint(DbgThread(), h, &Lab)) { + if (!cmsGDBCheckPoint(ContextID, h, &Lab)) { return 0; } } - cmsGBDFree(DbgThread(), h); + cmsGBDFree(ContextID, h); // Now for sRGB SubTest("checking sRGB gamut"); - h = cmsGBDAlloc(DbgThread()); - hsRGB = cmsCreate_sRGBProfile(DbgThread()); - hLab = cmsCreateLab4Profile(DbgThread(), NULL); + h = cmsGBDAlloc(ContextID); + hsRGB = cmsCreate_sRGBProfile(ContextID); + hLab = cmsCreateLab4Profile(ContextID, NULL); - xform = cmsCreateTransform(DbgThread(), hsRGB, TYPE_RGB_8, hLab, TYPE_Lab_DBL, INTENT_RELATIVE_COLORIMETRIC, cmsFLAGS_NOCACHE); - cmsCloseProfile(DbgThread(), hsRGB); cmsCloseProfile(DbgThread(), hLab); + xform = cmsCreateTransform(ContextID, hsRGB, TYPE_RGB_8, hLab, TYPE_Lab_DBL, INTENT_RELATIVE_COLORIMETRIC, cmsFLAGS_NOCACHE); + cmsCloseProfile(ContextID, hsRGB); cmsCloseProfile(ContextID, hLab); for (r1=0; r1 < 256; r1 += 5) { @@ -7210,12 +7202,12 @@ cmsInt32Number CheckGBD(void) rgb[1] = (cmsUInt8Number) g1; rgb[2] = (cmsUInt8Number) b1; - cmsDoTransform(DbgThread(), xform, rgb, &Lab, 1); + cmsDoTransform(ContextID, xform, rgb, &Lab, 1); // if (fabs(Lab.b) < 20 && Lab.a > 0) continue; - if (!cmsGDBAddPoint(DbgThread(), h, &Lab)) { - cmsGBDFree(DbgThread(), h); + if (!cmsGDBAddPoint(ContextID, h, &Lab)) { + cmsGBDFree(ContextID, h); return 0; } @@ -7224,7 +7216,7 @@ cmsInt32Number CheckGBD(void) } - if (!cmsGDBCompute(DbgThread(), h, 0)) return 0; + if (!cmsGDBCompute(ContextID, h, 0)) return 0; // cmsGBDdumpVRML(h, "c:\\colormaps\\lab.wrl"); for (r1=10; r1 < 200; r1 += 10) { @@ -7238,22 +7230,22 @@ cmsInt32Number CheckGBD(void) rgb[1] = (cmsUInt8Number) g1; rgb[2] = (cmsUInt8Number) b1; - cmsDoTransform(DbgThread(), xform, rgb, &Lab, 1); - if (!cmsGDBCheckPoint(DbgThread(), h, &Lab)) { + cmsDoTransform(ContextID, xform, rgb, &Lab, 1); + if (!cmsGDBCheckPoint(ContextID, h, &Lab)) { - cmsDeleteTransform(DbgThread(), xform); - cmsGBDFree(DbgThread(), h); + cmsDeleteTransform(ContextID, xform); + cmsGBDFree(ContextID, h); return 0; } } } - cmsDeleteTransform(DbgThread(), xform); - cmsGBDFree(DbgThread(), h); + cmsDeleteTransform(ContextID, xform); + cmsGBDFree(ContextID, h); SubTest("checking LCh chroma ring"); - h = cmsGBDAlloc(DbgThread()); + h = cmsGBDAlloc(ContextID); for (r1=0; r1 < 360; r1++) { @@ -7264,43 +7256,43 @@ cmsInt32Number CheckGBD(void) LCh.C = 60; LCh.h = r1; - cmsLCh2Lab(DbgThread(), &Lab, &LCh); - if (!cmsGDBAddPoint(DbgThread(), h, &Lab)) { - cmsGBDFree(DbgThread(), h); + cmsLCh2Lab(ContextID, &Lab, &LCh); + if (!cmsGDBAddPoint(ContextID, h, &Lab)) { + cmsGBDFree(ContextID, h); return 0; } } - if (!cmsGDBCompute(DbgThread(), h, 0)) return 0; + if (!cmsGDBCompute(ContextID, h, 0)) return 0; - cmsGBDFree(DbgThread(), h); + cmsGBDFree(ContextID, h); return 1; } static -int CheckMD5(void) +int CheckMD5(cmsContext ContextID) { _cmsICCPROFILE* h; - cmsHPROFILE pProfile = cmsOpenProfileFromFile(DbgThread(), "sRGBlcms2.icc", "r"); + cmsHPROFILE pProfile = cmsOpenProfileFromFile(ContextID, "sRGBlcms2.icc", "r"); cmsProfileID ProfileID1, ProfileID2, ProfileID3, ProfileID4; h =(_cmsICCPROFILE*) pProfile; - if (cmsMD5computeID(DbgThread(), pProfile)) cmsGetHeaderProfileID(DbgThread(), pProfile, ProfileID1.ID8); - if (cmsMD5computeID(DbgThread(), pProfile)) cmsGetHeaderProfileID(DbgThread(), pProfile,ProfileID2.ID8); + if (cmsMD5computeID(ContextID, pProfile)) cmsGetHeaderProfileID(ContextID, pProfile, ProfileID1.ID8); + if (cmsMD5computeID(ContextID, pProfile)) cmsGetHeaderProfileID(ContextID, pProfile,ProfileID2.ID8); - cmsCloseProfile(DbgThread(), pProfile); + cmsCloseProfile(ContextID, pProfile); - pProfile = cmsOpenProfileFromFile(DbgThread(), "sRGBlcms2.icc", "r"); + pProfile = cmsOpenProfileFromFile(ContextID, "sRGBlcms2.icc", "r"); h =(_cmsICCPROFILE*) pProfile; - if (cmsMD5computeID(DbgThread(), pProfile)) cmsGetHeaderProfileID(DbgThread(), pProfile, ProfileID3.ID8); - if (cmsMD5computeID(DbgThread(), pProfile)) cmsGetHeaderProfileID(DbgThread(), pProfile,ProfileID4.ID8); + if (cmsMD5computeID(ContextID, pProfile)) cmsGetHeaderProfileID(ContextID, pProfile, ProfileID3.ID8); + if (cmsMD5computeID(ContextID, pProfile)) cmsGetHeaderProfileID(ContextID, pProfile,ProfileID4.ID8); - cmsCloseProfile(DbgThread(), pProfile); + cmsCloseProfile(ContextID, pProfile); return ((memcmp(ProfileID1.ID8, ProfileID3.ID8, sizeof(ProfileID1)) == 0) && (memcmp(ProfileID2.ID8, ProfileID4.ID8, sizeof(ProfileID2)) == 0)); @@ -7309,47 +7301,47 @@ int CheckMD5(void) static -int CheckLinking(void) +int CheckLinking(cmsContext ContextID) { cmsHPROFILE h; cmsPipeline * pipeline; cmsStage *stageBegin, *stageEnd; // Create a CLUT based profile - h = cmsCreateInkLimitingDeviceLink(DbgThread(), cmsSigCmykData, 150); + h = cmsCreateInkLimitingDeviceLink(ContextID, cmsSigCmykData, 150); // link a second tag - cmsLinkTag(DbgThread(), h, cmsSigAToB1Tag, cmsSigAToB0Tag); + cmsLinkTag(ContextID, h, cmsSigAToB1Tag, cmsSigAToB0Tag); // Save the linked devicelink - if (!cmsSaveProfileToFile(DbgThread(), h, "lcms2link.icc")) return 0; - cmsCloseProfile(DbgThread(), h); + if (!cmsSaveProfileToFile(ContextID, h, "lcms2link.icc")) return 0; + cmsCloseProfile(ContextID, h); // Now open the profile and read the pipeline - h = cmsOpenProfileFromFile(DbgThread(), "lcms2link.icc", "r"); + h = cmsOpenProfileFromFile(ContextID, "lcms2link.icc", "r"); if (h == NULL) return 0; - pipeline = (cmsPipeline*) cmsReadTag(DbgThread(), h, cmsSigAToB1Tag); + pipeline = (cmsPipeline*) cmsReadTag(ContextID, h, cmsSigAToB1Tag); if (pipeline == NULL) { return 0; } - pipeline = cmsPipelineDup(DbgThread(), pipeline); + pipeline = cmsPipelineDup(ContextID, pipeline); // extract stage from pipe line - cmsPipelineUnlinkStage(DbgThread(), pipeline, cmsAT_BEGIN, &stageBegin); - cmsPipelineUnlinkStage(DbgThread(), pipeline, cmsAT_END, &stageEnd); - cmsPipelineInsertStage(DbgThread(), pipeline, cmsAT_END, stageEnd); - cmsPipelineInsertStage(DbgThread(), pipeline, cmsAT_BEGIN, stageBegin); + cmsPipelineUnlinkStage(ContextID, pipeline, cmsAT_BEGIN, &stageBegin); + cmsPipelineUnlinkStage(ContextID, pipeline, cmsAT_END, &stageEnd); + cmsPipelineInsertStage(ContextID, pipeline, cmsAT_END, stageEnd); + cmsPipelineInsertStage(ContextID, pipeline, cmsAT_BEGIN, stageBegin); - if (cmsTagLinkedTo(DbgThread(), h, cmsSigAToB1Tag) != cmsSigAToB0Tag) return 0; + if (cmsTagLinkedTo(ContextID, h, cmsSigAToB1Tag) != cmsSigAToB0Tag) return 0; - cmsWriteTag(DbgThread(), h, cmsSigAToB0Tag, pipeline); - cmsPipelineFree(DbgThread(), pipeline); + cmsWriteTag(ContextID, h, cmsSigAToB0Tag, pipeline); + cmsPipelineFree(ContextID, pipeline); - if (!cmsSaveProfileToFile(DbgThread(), h, "lcms2link2.icc")) return 0; - cmsCloseProfile(DbgThread(), h); + if (!cmsSaveProfileToFile(ContextID, h, "lcms2link2.icc")) return 0; + cmsCloseProfile(ContextID, h); return 1; @@ -7361,51 +7353,50 @@ int CheckLinking(void) // Created by Paul Miller on 30/08/2016. // static -cmsHPROFILE IdentityMatrixProfile( cmsColorSpaceSignature dataSpace) +cmsHPROFILE IdentityMatrixProfile(cmsContext ctx, cmsColorSpaceSignature dataSpace) { - cmsContext ctx = 0; cmsVEC3 zero = {{0,0,0}}; cmsMAT3 identity; cmsPipeline* forward; cmsPipeline* reverse; - cmsHPROFILE identityProfile = cmsCreateProfilePlaceholder( ctx); + cmsHPROFILE identityProfile = cmsCreateProfilePlaceholder(ctx); - cmsSetProfileVersion(DbgThread(), identityProfile, 4.3); + cmsSetProfileVersion(ctx, identityProfile, 4.3); - cmsSetDeviceClass(DbgThread(), identityProfile, cmsSigColorSpaceClass); - cmsSetColorSpace(DbgThread(), identityProfile, dataSpace); - cmsSetPCS(DbgThread(), identityProfile, cmsSigXYZData); + cmsSetDeviceClass(ctx, identityProfile, cmsSigColorSpaceClass); + cmsSetColorSpace(ctx, identityProfile, dataSpace); + cmsSetPCS(ctx, identityProfile, cmsSigXYZData); - cmsSetHeaderRenderingIntent(DbgThread(), identityProfile, INTENT_RELATIVE_COLORIMETRIC); + cmsSetHeaderRenderingIntent(ctx, identityProfile, INTENT_RELATIVE_COLORIMETRIC); - cmsWriteTag(DbgThread(), identityProfile, cmsSigMediaWhitePointTag, cmsD50_XYZ(DbgThread())); + cmsWriteTag(ctx, identityProfile, cmsSigMediaWhitePointTag, cmsD50_XYZ(ctx)); - _cmsMAT3identity(DbgThread(), &identity); + _cmsMAT3identity(ctx, &identity); // build forward transform.... (RGB to PCS) - forward = cmsPipelineAlloc( 0, 3, 3); - cmsPipelineInsertStage(DbgThread(), forward, cmsAT_END, cmsStageAllocMatrix( ctx, 3, 3, (cmsFloat64Number*)&identity, (cmsFloat64Number*)&zero)); - cmsWriteTag(DbgThread(), identityProfile, cmsSigDToB1Tag, forward); + forward = cmsPipelineAlloc(ctx, 3, 3); + cmsPipelineInsertStage(ctx, forward, cmsAT_END, cmsStageAllocMatrix( ctx, 3, 3, (cmsFloat64Number*)&identity, (cmsFloat64Number*)&zero)); + cmsWriteTag(ctx, identityProfile, cmsSigDToB1Tag, forward); - cmsPipelineFree(DbgThread(), forward); + cmsPipelineFree(ctx, forward); - reverse = cmsPipelineAlloc( 0, 3, 3); - cmsPipelineInsertStage(DbgThread(), reverse, cmsAT_END, cmsStageAllocMatrix( ctx, 3, 3, (cmsFloat64Number*)&identity, (cmsFloat64Number*)&zero)); - cmsWriteTag(DbgThread(), identityProfile, cmsSigBToD1Tag, reverse); + reverse = cmsPipelineAlloc(ctx, 3, 3); + cmsPipelineInsertStage(ctx, reverse, cmsAT_END, cmsStageAllocMatrix( ctx, 3, 3, (cmsFloat64Number*)&identity, (cmsFloat64Number*)&zero)); + cmsWriteTag(ctx, identityProfile, cmsSigBToD1Tag, reverse); - cmsPipelineFree(DbgThread(), reverse); + cmsPipelineFree(ctx, reverse); return identityProfile; } static -cmsInt32Number CheckFloatXYZ(void) +cmsInt32Number CheckFloatXYZ(cmsContext ctx) { cmsHPROFILE input; - cmsHPROFILE xyzProfile = cmsCreateXYZProfile(DbgThread()); + cmsHPROFILE xyzProfile = cmsCreateXYZProfile(ctx); cmsHTRANSFORM xform; cmsFloat32Number in[4]; cmsFloat32Number out[4]; @@ -7416,13 +7407,13 @@ cmsInt32Number CheckFloatXYZ(void) in[3] = 0.5; // RGB to XYZ - input = IdentityMatrixProfile( cmsSigRgbData); + input = IdentityMatrixProfile(ctx, cmsSigRgbData); - xform = cmsCreateTransform(DbgThread(), input, TYPE_RGB_FLT, xyzProfile, TYPE_XYZ_FLT, INTENT_RELATIVE_COLORIMETRIC, 0); - cmsCloseProfile(DbgThread(), input); + xform = cmsCreateTransform(ctx, input, TYPE_RGB_FLT, xyzProfile, TYPE_XYZ_FLT, INTENT_RELATIVE_COLORIMETRIC, 0); + cmsCloseProfile(ctx, input); - cmsDoTransform(DbgThread(), xform, in, out, 1); - cmsDeleteTransform(DbgThread(), xform); + cmsDoTransform(ctx, xform, in, out, 1); + cmsDeleteTransform(ctx, xform); if (!IsGoodVal("Float RGB->XYZ", in[0], out[0], FLOAT_PRECISSION) || !IsGoodVal("Float RGB->XYZ", in[1], out[1], FLOAT_PRECISSION) || @@ -7431,15 +7422,15 @@ cmsInt32Number CheckFloatXYZ(void) // XYZ to XYZ - input = IdentityMatrixProfile( cmsSigXYZData); + input = IdentityMatrixProfile(ctx, cmsSigXYZData); - xform = cmsCreateTransform(DbgThread(), input, TYPE_XYZ_FLT, xyzProfile, TYPE_XYZ_FLT, INTENT_RELATIVE_COLORIMETRIC, 0); - cmsCloseProfile(DbgThread(), input); + xform = cmsCreateTransform(ctx, input, TYPE_XYZ_FLT, xyzProfile, TYPE_XYZ_FLT, INTENT_RELATIVE_COLORIMETRIC, 0); + cmsCloseProfile(ctx, input); - cmsDoTransform(DbgThread(), xform, in, out, 1); + cmsDoTransform(ctx, xform, in, out, 1); - cmsDeleteTransform(DbgThread(), xform); + cmsDeleteTransform(ctx, xform); if (!IsGoodVal("Float XYZ->XYZ", in[0], out[0], FLOAT_PRECISSION) || !IsGoodVal("Float XYZ->XYZ", in[1], out[1], FLOAT_PRECISSION) || @@ -7447,17 +7438,17 @@ cmsInt32Number CheckFloatXYZ(void) return 0; - input = IdentityMatrixProfile( cmsSigXYZData); + input = IdentityMatrixProfile(ctx, cmsSigXYZData); # define TYPE_XYZA_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_XYZ)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(4)) - xform = cmsCreateTransform(DbgThread(), input, TYPE_XYZA_FLT, xyzProfile, TYPE_XYZA_FLT, INTENT_RELATIVE_COLORIMETRIC, cmsFLAGS_COPY_ALPHA); - cmsCloseProfile(DbgThread(), input); + xform = cmsCreateTransform(ctx, input, TYPE_XYZA_FLT, xyzProfile, TYPE_XYZA_FLT, INTENT_RELATIVE_COLORIMETRIC, cmsFLAGS_COPY_ALPHA); + cmsCloseProfile(ctx, input); - cmsDoTransform(DbgThread(), xform, in, out, 1); + cmsDoTransform(ctx, xform, in, out, 1); - cmsDeleteTransform(DbgThread(), xform); + cmsDeleteTransform(ctx, xform); if (!IsGoodVal("Float XYZA->XYZA", in[0], out[0], FLOAT_PRECISSION) || !IsGoodVal("Float XYZA->XYZA", in[1], out[1], FLOAT_PRECISSION) || @@ -7467,14 +7458,14 @@ cmsInt32Number CheckFloatXYZ(void) // XYZ to RGB - input = IdentityMatrixProfile( cmsSigRgbData); + input = IdentityMatrixProfile(ctx, cmsSigRgbData); - xform = cmsCreateTransform(DbgThread(), xyzProfile, TYPE_XYZ_FLT, input, TYPE_RGB_FLT, INTENT_RELATIVE_COLORIMETRIC, 0); - cmsCloseProfile(DbgThread(), input); + xform = cmsCreateTransform(ctx, xyzProfile, TYPE_XYZ_FLT, input, TYPE_RGB_FLT, INTENT_RELATIVE_COLORIMETRIC, 0); + cmsCloseProfile(ctx, input); - cmsDoTransform(DbgThread(), xform, in, out, 1); + cmsDoTransform(ctx, xform, in, out, 1); - cmsDeleteTransform(DbgThread(), xform); + cmsDeleteTransform(ctx, xform); if (!IsGoodVal("Float XYZ->RGB", in[0], out[0], FLOAT_PRECISSION) || !IsGoodVal("Float XYZ->RGB", in[1], out[1], FLOAT_PRECISSION) || @@ -7485,21 +7476,21 @@ cmsInt32Number CheckFloatXYZ(void) // Now the optimizer should remove a stage // XYZ to RGB - input = IdentityMatrixProfile( cmsSigRgbData); + input = IdentityMatrixProfile(ctx, cmsSigRgbData); - xform = cmsCreateTransform(DbgThread(), input, TYPE_RGB_FLT, input, TYPE_RGB_FLT, INTENT_RELATIVE_COLORIMETRIC, 0); - cmsCloseProfile(DbgThread(), input); + xform = cmsCreateTransform(ctx, input, TYPE_RGB_FLT, input, TYPE_RGB_FLT, INTENT_RELATIVE_COLORIMETRIC, 0); + cmsCloseProfile(ctx, input); - cmsDoTransform(DbgThread(), xform, in, out, 1); + cmsDoTransform(ctx, xform, in, out, 1); - cmsDeleteTransform(DbgThread(), xform); + cmsDeleteTransform(ctx, xform); if (!IsGoodVal("Float RGB->RGB", in[0], out[0], FLOAT_PRECISSION) || !IsGoodVal("Float RGB->RGB", in[1], out[1], FLOAT_PRECISSION) || !IsGoodVal("Float RGB->RGB", in[2], out[2], FLOAT_PRECISSION)) return 0; - cmsCloseProfile(DbgThread(), xyzProfile); + cmsCloseProfile(ctx, xyzProfile); return 1; @@ -7523,13 +7514,13 @@ Bug reported */ static -cmsInt32Number ChecksRGB2LabFLT(void) +cmsInt32Number ChecksRGB2LabFLT(cmsContext ctx) { - cmsHPROFILE hSRGB = cmsCreate_sRGBProfile(DbgThread()); - cmsHPROFILE hLab = cmsCreateLab4Profile(DbgThread(), NULL); + cmsHPROFILE hSRGB = cmsCreate_sRGBProfile(ctx); + cmsHPROFILE hLab = cmsCreateLab4Profile(ctx, NULL); - cmsHTRANSFORM xform1 = cmsCreateTransform(DbgThread(), hSRGB, TYPE_RGBA_FLT, hLab, TYPE_LabA_FLT, 0, cmsFLAGS_NOCACHE|cmsFLAGS_NOOPTIMIZE); - cmsHTRANSFORM xform2 = cmsCreateTransform(DbgThread(), hLab, TYPE_LabA_FLT, hSRGB, TYPE_RGBA_FLT, 0, cmsFLAGS_NOCACHE|cmsFLAGS_NOOPTIMIZE); + cmsHTRANSFORM xform1 = cmsCreateTransform(ctx, hSRGB, TYPE_RGBA_FLT, hLab, TYPE_LabA_FLT, 0, cmsFLAGS_NOCACHE|cmsFLAGS_NOOPTIMIZE); + cmsHTRANSFORM xform2 = cmsCreateTransform(ctx, hLab, TYPE_LabA_FLT, hSRGB, TYPE_RGBA_FLT, 0, cmsFLAGS_NOCACHE|cmsFLAGS_NOOPTIMIZE); cmsFloat32Number RGBA1[4], RGBA2[4], LabA[4]; int i; @@ -7542,8 +7533,8 @@ cmsInt32Number ChecksRGB2LabFLT(void) RGBA1[2] = i / 100.0F; RGBA1[3] = 0; - cmsDoTransform(DbgThread(), xform1, RGBA1, LabA, 1); - cmsDoTransform(DbgThread(), xform2, LabA, RGBA2, 1); + cmsDoTransform(ctx, xform1, RGBA1, LabA, 1); + cmsDoTransform(ctx, xform2, LabA, RGBA2, 1); if (!IsGoodVal("Float RGB->RGB", RGBA1[0], RGBA2[0], FLOAT_PRECISSION) || !IsGoodVal("Float RGB->RGB", RGBA1[1], RGBA2[1], FLOAT_PRECISSION) || @@ -7552,10 +7543,10 @@ cmsInt32Number ChecksRGB2LabFLT(void) } - cmsDeleteTransform(DbgThread(), xform1); - cmsDeleteTransform(DbgThread(), xform2); - cmsCloseProfile(DbgThread(), hSRGB); - cmsCloseProfile(DbgThread(), hLab); + cmsDeleteTransform(ctx, xform1); + cmsDeleteTransform(ctx, xform2); + cmsCloseProfile(ctx, hSRGB); + cmsCloseProfile(ctx, hLab); return 1; } @@ -7578,7 +7569,7 @@ double Rec709(double L) static -cmsInt32Number CheckParametricRec709(void) +cmsInt32Number CheckParametricRec709(cmsContext ContextID) { cmsFloat64Number params[7]; cmsToneCurve* t; @@ -7592,23 +7583,23 @@ cmsInt32Number CheckParametricRec709(void) params[5] = -0.099; /* e */ params[6] = 0.0; /* f */ - t = cmsBuildParametricToneCurve (NULL, 5, params); + t = cmsBuildParametricToneCurve (ContextID, 5, params); for (i=0; i < 256; i++) { cmsFloat32Number n = (cmsFloat32Number) i / 255.0F; - cmsUInt16Number f1 = (cmsUInt16Number) floor(255.0 * cmsEvalToneCurveFloat(DbgThread(), t, n) + 0.5); + cmsUInt16Number f1 = (cmsUInt16Number) floor(255.0 * cmsEvalToneCurveFloat(ContextID, t, n) + 0.5); cmsUInt16Number f2 = (cmsUInt16Number) floor(255.0*Rec709((double) i / 255.0) + 0.5); if (f1 != f2) { - cmsFreeToneCurve(DbgThread(), t); + cmsFreeToneCurve(ContextID, t); return 0; } } - cmsFreeToneCurve(DbgThread(), t); + cmsFreeToneCurve(ContextID, t); return 1; } @@ -7622,7 +7613,7 @@ static cmsFloat32Number StraightLine( cmsFloat32Number x) return (cmsFloat32Number) (0.1 + 0.9 * x); } -static cmsInt32Number TestCurve( const char* label, cmsToneCurve* curve, Function fn) +static cmsInt32Number TestCurve(cmsContext ContextID, const char* label, cmsToneCurve* curve, Function fn) { cmsInt32Number ok = 1; int i; @@ -7630,7 +7621,7 @@ static cmsInt32Number TestCurve( const char* label, cmsToneCurve* curve, Functio cmsFloat32Number x = (cmsFloat32Number)i / (kNumPoints*3 - 1); cmsFloat32Number expectedY = fn(x); - cmsFloat32Number out = cmsEvalToneCurveFloat(DbgThread(), curve, x); + cmsFloat32Number out = cmsEvalToneCurveFloat(ContextID, curve, x); if (!IsGoodVal(label, expectedY, out, FLOAT_PRECISSION)) { ok = 0; @@ -7640,7 +7631,7 @@ static cmsInt32Number TestCurve( const char* label, cmsToneCurve* curve, Functio } static -cmsInt32Number CheckFloatSamples(void) +cmsInt32Number CheckFloatSamples(cmsContext ContextID) { cmsFloat32Number y[kNumPoints]; int i; @@ -7653,15 +7644,15 @@ cmsInt32Number CheckFloatSamples(void) y[i] = StraightLine(x); } - curve = cmsBuildTabulatedToneCurveFloat(NULL, kNumPoints, y); - ok = TestCurve( "Float Samples", curve, StraightLine); - cmsFreeToneCurve(DbgThread(), curve); + curve = cmsBuildTabulatedToneCurveFloat(ContextID, kNumPoints, y); + ok = TestCurve(ContextID, "Float Samples", curve, StraightLine); + cmsFreeToneCurve(ContextID, curve); return ok; } static -cmsInt32Number CheckFloatSegments(void) +cmsInt32Number CheckFloatSegments(cmsContext ContextID) { cmsInt32Number ok = 1; int i; @@ -7706,18 +7697,18 @@ cmsInt32Number CheckFloatSegments(void) Seg[2].Params[3] = 0.1f; Seg[2].Params[4] = 0.0f; - curve = cmsBuildSegmentedToneCurve(0, 3, Seg); + curve = cmsBuildSegmentedToneCurve(ContextID, 3, Seg); - ok = TestCurve( "Float Segmented Curve", curve, StraightLine); + ok = TestCurve(ContextID, "Float Segmented Curve", curve, StraightLine); - cmsFreeToneCurve(DbgThread(), curve); + cmsFreeToneCurve(ContextID, curve); return ok; } static -cmsInt32Number CheckReadRAW(void) +cmsInt32Number CheckReadRAW(cmsContext ContextID) { cmsInt32Number tag_size, tag_size1; char buffer[4]; @@ -7725,15 +7716,15 @@ cmsInt32Number CheckReadRAW(void) SubTest("RAW read on on-disk"); - hProfile = cmsOpenProfileFromFile(DbgThread(), "test1.icc", "r"); + hProfile = cmsOpenProfileFromFile(ContextID, "test1.icc", "r"); if (hProfile == NULL) return 0; - tag_size = cmsReadRawTag(DbgThread(), hProfile, cmsSigGamutTag, buffer, 4); - tag_size1 = cmsReadRawTag(DbgThread(), hProfile, cmsSigGamutTag, NULL, 0); + tag_size = cmsReadRawTag(ContextID, hProfile, cmsSigGamutTag, buffer, 4); + tag_size1 = cmsReadRawTag(ContextID, hProfile, cmsSigGamutTag, NULL, 0); - cmsCloseProfile(DbgThread(), hProfile); + cmsCloseProfile(ContextID, hProfile); if (tag_size != 4) return 0; @@ -7742,11 +7733,11 @@ cmsInt32Number CheckReadRAW(void) return 0; SubTest("RAW read on in-memory created profiles"); - hProfile = cmsCreate_sRGBProfile(DbgThread()); - tag_size = cmsReadRawTag(DbgThread(), hProfile, cmsSigGreenColorantTag, buffer, 4); - tag_size1 = cmsReadRawTag(DbgThread(), hProfile, cmsSigGreenColorantTag, NULL, 0); + hProfile = cmsCreate_sRGBProfile(ContextID); + tag_size = cmsReadRawTag(ContextID, hProfile, cmsSigGreenColorantTag, buffer, 4); + tag_size1 = cmsReadRawTag(ContextID, hProfile, cmsSigGreenColorantTag, NULL, 0); - cmsCloseProfile(DbgThread(), hProfile); + cmsCloseProfile(ContextID, hProfile); if (tag_size != 4) return 0; @@ -7758,7 +7749,7 @@ cmsInt32Number CheckReadRAW(void) static -cmsInt32Number CheckMeta(void) +cmsInt32Number CheckMeta(cmsContext ContextID) { char *data; cmsHANDLE dict; @@ -7768,20 +7759,20 @@ cmsInt32Number CheckMeta(void) int rc; /* open file */ - p = cmsOpenProfileFromFile(DbgThread(), "ibm-t61.icc", "r"); + p = cmsOpenProfileFromFile(ContextID, "ibm-t61.icc", "r"); if (p == NULL) return 0; /* read dictionary, but don't do anything with the value */ //COMMENT OUT THE NEXT TWO LINES AND IT WORKS FINE!!! - dict = cmsReadTag(DbgThread(), p, cmsSigMetaTag); + dict = cmsReadTag(ContextID, p, cmsSigMetaTag); if (dict == NULL) return 0; /* serialize profile to memory */ - rc = cmsSaveProfileToMem(DbgThread(), p, NULL, &clen); + rc = cmsSaveProfileToMem(ContextID, p, NULL, &clen); if (!rc) return 0; data = (char*) malloc(clen); - rc = cmsSaveProfileToMem(DbgThread(), p, data, &clen); + rc = cmsSaveProfileToMem(ContextID, p, data, &clen); if (!rc) return 0; /* write the memory blob to a file */ @@ -7791,39 +7782,39 @@ cmsInt32Number CheckMeta(void) fclose(fp); free(data); - cmsCloseProfile(DbgThread(), p); + cmsCloseProfile(ContextID, p); /* open newly created file and read metadata */ - p = cmsOpenProfileFromFile(DbgThread(), "new.icc", "r"); + p = cmsOpenProfileFromFile(ContextID, "new.icc", "r"); //ERROR: Bad dictionary Name/Value //ERROR: Corrupted tag 'meta' //test: test.c:59: main: Assertion `dict' failed. - dict = cmsReadTag(DbgThread(), p, cmsSigMetaTag); + dict = cmsReadTag(ContextID, p, cmsSigMetaTag); if (dict == NULL) return 0; - cmsCloseProfile(DbgThread(), p); + cmsCloseProfile(ContextID, p); return 1; } // Bug on applying null transforms on floating point buffers static -cmsInt32Number CheckFloatNULLxform(void) +cmsInt32Number CheckFloatNULLxform(cmsContext ContextID) { int i; cmsFloat32Number in[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; cmsFloat32Number out[10]; - cmsHTRANSFORM xform = cmsCreateTransform(DbgThread(), NULL, TYPE_GRAY_FLT, NULL, TYPE_GRAY_FLT, INTENT_PERCEPTUAL, cmsFLAGS_NULLTRANSFORM); + cmsHTRANSFORM xform = cmsCreateTransform(ContextID, NULL, TYPE_GRAY_FLT, NULL, TYPE_GRAY_FLT, INTENT_PERCEPTUAL, cmsFLAGS_NULLTRANSFORM); if (xform == NULL) { Fail("Unable to create float null transform"); return 0; } - cmsDoTransform(DbgThread(), xform, in, out, 10); + cmsDoTransform(ContextID, xform, in, out, 10); - cmsDeleteTransform(DbgThread(), xform); + cmsDeleteTransform(ContextID, xform); for (i=0; i < 10; i++) { if (!IsGoodVal("float nullxform", in[i], out[i], 0.001)) { @@ -7836,36 +7827,36 @@ cmsInt32Number CheckFloatNULLxform(void) } static -cmsInt32Number CheckRemoveTag(void) +cmsInt32Number CheckRemoveTag(cmsContext ContextID) { cmsHPROFILE p; cmsMLU *mlu; int ret; - p = cmsCreate_sRGBProfile(NULL); + p = cmsCreate_sRGBProfile(ContextID); /* set value */ - mlu = cmsMLUalloc (NULL, 1); - ret = cmsMLUsetASCII(DbgThread(), mlu, "en", "US", "bar"); + mlu = cmsMLUalloc (ContextID, 1); + ret = cmsMLUsetASCII(ContextID, mlu, "en", "US", "bar"); if (!ret) return 0; - ret = cmsWriteTag(DbgThread(), p, cmsSigDeviceMfgDescTag, mlu); + ret = cmsWriteTag(ContextID, p, cmsSigDeviceMfgDescTag, mlu); if (!ret) return 0; - cmsMLUfree(DbgThread(), mlu); + cmsMLUfree(ContextID, mlu); /* remove the tag */ - ret = cmsWriteTag(DbgThread(), p, cmsSigDeviceMfgDescTag, NULL); + ret = cmsWriteTag(ContextID, p, cmsSigDeviceMfgDescTag, NULL); if (!ret) return 0; /* THIS EXPLODES */ - cmsCloseProfile(DbgThread(), p); + cmsCloseProfile(ContextID, p); return 1; } static -cmsInt32Number CheckMatrixSimplify(void) +cmsInt32Number CheckMatrixSimplify(cmsContext ContextID) { cmsHPROFILE pIn; @@ -7874,16 +7865,16 @@ cmsInt32Number CheckMatrixSimplify(void) unsigned char buf[3] = { 127, 32, 64 }; - pIn = cmsCreate_sRGBProfile(DbgThread()); - pOut = cmsOpenProfileFromFile(DbgThread(), "ibm-t61.icc", "r"); + pIn = cmsCreate_sRGBProfile(ContextID); + pOut = cmsOpenProfileFromFile(ContextID, "ibm-t61.icc", "r"); if (pIn == NULL || pOut == NULL) return 0; - t = cmsCreateTransform(DbgThread(), pIn, TYPE_RGB_8, pOut, TYPE_RGB_8, INTENT_PERCEPTUAL, 0); - cmsDoTransformStride(DbgThread(), t, buf, buf, 1, 1); - cmsDeleteTransform(DbgThread(), t); - cmsCloseProfile(DbgThread(), pIn); - cmsCloseProfile(DbgThread(), pOut); + t = cmsCreateTransform(ContextID, pIn, TYPE_RGB_8, pOut, TYPE_RGB_8, INTENT_PERCEPTUAL, 0); + cmsDoTransformStride(ContextID, t, buf, buf, 1, 1); + cmsDeleteTransform(ContextID, t); + cmsCloseProfile(ContextID, pIn); + cmsCloseProfile(ContextID, pOut); return buf[0] == 144 && buf[1] == 0 && buf[2] == 69; @@ -7892,7 +7883,7 @@ cmsInt32Number CheckMatrixSimplify(void) static -cmsInt32Number CheckTransformLineStride(void) +cmsInt32Number CheckTransformLineStride(cmsContext ContextID) { cmsHPROFILE pIn; @@ -7924,50 +7915,50 @@ cmsInt32Number CheckTransformLineStride(void) memset(out, 0, sizeof(out)); - pIn = cmsCreate_sRGBProfile(DbgThread()); - pOut = cmsOpenProfileFromFile(DbgThread(), "ibm-t61.icc", "r"); + pIn = cmsCreate_sRGBProfile(ContextID); + pOut = cmsOpenProfileFromFile(ContextID, "ibm-t61.icc", "r"); if (pIn == NULL || pOut == NULL) return 0; - t = cmsCreateTransform(DbgThread(), pIn, TYPE_RGB_8, pOut, TYPE_RGB_8, INTENT_PERCEPTUAL, cmsFLAGS_COPY_ALPHA); + t = cmsCreateTransform(ContextID, pIn, TYPE_RGB_8, pOut, TYPE_RGB_8, INTENT_PERCEPTUAL, cmsFLAGS_COPY_ALPHA); - cmsDoTransformLineStride(DbgThread(), t, buf1, out, 2, 4, 7, 7, 0, 0); - cmsDeleteTransform(DbgThread(), t); + cmsDoTransformLineStride(ContextID, t, buf1, out, 2, 4, 7, 7, 0, 0); + cmsDeleteTransform(ContextID, t); if (memcmp(out, buf1, sizeof(buf1)) != 0) { Fail("Failed transform line stride on RGB8"); - cmsCloseProfile(DbgThread(), pIn); - cmsCloseProfile(DbgThread(), pOut); + cmsCloseProfile(ContextID, pIn); + cmsCloseProfile(ContextID, pOut); return 0; } memset(out, 0, sizeof(out)); - t = cmsCreateTransform(DbgThread(), pIn, TYPE_RGBA_8, pOut, TYPE_RGBA_8, INTENT_PERCEPTUAL, cmsFLAGS_COPY_ALPHA); + t = cmsCreateTransform(ContextID, pIn, TYPE_RGBA_8, pOut, TYPE_RGBA_8, INTENT_PERCEPTUAL, cmsFLAGS_COPY_ALPHA); - cmsDoTransformLineStride(DbgThread(), t, buf2, out, 2, 4, 9, 9, 0, 0); + cmsDoTransformLineStride(ContextID, t, buf2, out, 2, 4, 9, 9, 0, 0); - cmsDeleteTransform(DbgThread(), t); + cmsDeleteTransform(ContextID, t); if (memcmp(out, buf2, sizeof(buf2)) != 0) { - cmsCloseProfile(DbgThread(), pIn); - cmsCloseProfile(DbgThread(), pOut); + cmsCloseProfile(ContextID, pIn); + cmsCloseProfile(ContextID, pOut); Fail("Failed transform line stride on RGBA8"); return 0; } memset(out, 0, sizeof(out)); - t = cmsCreateTransform(DbgThread(), pIn, TYPE_RGBA_16, pOut, TYPE_RGBA_16, INTENT_PERCEPTUAL, cmsFLAGS_COPY_ALPHA); + t = cmsCreateTransform(ContextID, pIn, TYPE_RGBA_16, pOut, TYPE_RGBA_16, INTENT_PERCEPTUAL, cmsFLAGS_COPY_ALPHA); - cmsDoTransformLineStride(DbgThread(), t, buf3, out, 2, 4, 18, 18, 0, 0); + cmsDoTransformLineStride(ContextID, t, buf3, out, 2, 4, 18, 18, 0, 0); - cmsDeleteTransform(DbgThread(), t); + cmsDeleteTransform(ContextID, t); if (memcmp(out, buf3, sizeof(buf3)) != 0) { - cmsCloseProfile(DbgThread(), pIn); - cmsCloseProfile(DbgThread(), pOut); + cmsCloseProfile(ContextID, pIn); + cmsCloseProfile(ContextID, pOut); Fail("Failed transform line stride on RGBA16"); return 0; } @@ -7977,42 +7968,42 @@ cmsInt32Number CheckTransformLineStride(void) // From 8 to 16 - t = cmsCreateTransform(DbgThread(), pIn, TYPE_RGBA_8, pOut, TYPE_RGBA_16, INTENT_PERCEPTUAL, cmsFLAGS_COPY_ALPHA); + t = cmsCreateTransform(ContextID, pIn, TYPE_RGBA_8, pOut, TYPE_RGBA_16, INTENT_PERCEPTUAL, cmsFLAGS_COPY_ALPHA); - cmsDoTransformLineStride(DbgThread(), t, buf2, out, 2, 4, 9, 18, 0, 0); + cmsDoTransformLineStride(ContextID, t, buf2, out, 2, 4, 9, 18, 0, 0); - cmsDeleteTransform(DbgThread(), t); + cmsDeleteTransform(ContextID, t); if (memcmp(out, buf3, sizeof(buf3)) != 0) { - cmsCloseProfile(DbgThread(), pIn); - cmsCloseProfile(DbgThread(), pOut); + cmsCloseProfile(ContextID, pIn); + cmsCloseProfile(ContextID, pOut); Fail("Failed transform line stride on RGBA16"); return 0; } - cmsCloseProfile(DbgThread(), pIn); - cmsCloseProfile(DbgThread(), pOut); + cmsCloseProfile(ContextID, pIn); + cmsCloseProfile(ContextID, pOut); return 1; } static -int CheckPlanar8opt(void) +int CheckPlanar8opt(cmsContext ContextID) { - cmsHPROFILE aboveRGB = Create_AboveRGB(); - cmsHPROFILE sRGB = cmsCreate_sRGBProfile(DbgThread()); + cmsHPROFILE aboveRGB = Create_AboveRGB(ContextID); + cmsHPROFILE sRGB = cmsCreate_sRGBProfile(ContextID); - cmsHTRANSFORM transform = cmsCreateTransform(DbgThread(), + cmsHTRANSFORM transform = cmsCreateTransform(ContextID, sRGB, TYPE_RGB_8_PLANAR, aboveRGB, TYPE_RGB_8_PLANAR, INTENT_PERCEPTUAL, 0); - cmsDeleteTransform(DbgThread(), transform); - cmsCloseProfile(DbgThread(), aboveRGB); - cmsCloseProfile(DbgThread(), sRGB); + cmsDeleteTransform(ContextID, transform); + cmsCloseProfile(ContextID, aboveRGB); + cmsCloseProfile(ContextID, sRGB); return 1; } @@ -8021,20 +8012,20 @@ int CheckPlanar8opt(void) * Bug reported & fixed. Thanks to Kornel Lesinski for spotting this. */ static -int CheckSE(void) +int CheckSE(cmsContext ContextID) { - cmsHPROFILE input_profile = Create_AboveRGB(); - cmsHPROFILE output_profile = cmsCreate_sRGBProfile(DbgThread()); + cmsHPROFILE input_profile = Create_AboveRGB(ContextID); + cmsHPROFILE output_profile = cmsCreate_sRGBProfile(ContextID); - cmsHTRANSFORM tr = cmsCreateTransform(DbgThread(), input_profile, TYPE_RGBA_8, output_profile, TYPE_RGBA_16_SE, INTENT_RELATIVE_COLORIMETRIC, cmsFLAGS_COPY_ALPHA); + cmsHTRANSFORM tr = cmsCreateTransform(ContextID, input_profile, TYPE_RGBA_8, output_profile, TYPE_RGBA_16_SE, INTENT_RELATIVE_COLORIMETRIC, cmsFLAGS_COPY_ALPHA); cmsUInt8Number rgba[4] = { 40, 41, 41, 0xfa }; cmsUInt16Number out[4]; - cmsDoTransform(DbgThread(), tr, rgba, out, 1); - cmsCloseProfile(DbgThread(), input_profile); - cmsCloseProfile(DbgThread(), output_profile); - cmsDeleteTransform(DbgThread(), tr); + cmsDoTransform(ContextID, tr, rgba, out, 1); + cmsCloseProfile(ContextID, input_profile); + cmsCloseProfile(ContextID, output_profile); + cmsDeleteTransform(ContextID, tr); if (out[0] != 0xf622 || out[1] != 0x7f24 || out[2] != 0x7f24) return 0; @@ -8046,7 +8037,7 @@ int CheckSE(void) * Bug reported. */ static -int CheckForgedMPE(void) +int CheckForgedMPE(cmsContext ContextID) { cmsUInt32Number i; cmsHPROFILE srcProfile; @@ -8059,18 +8050,18 @@ int CheckForgedMPE(void) cmsHTRANSFORM hTransform; cmsUInt8Number output[4]; - srcProfile = cmsOpenProfileFromFile(DbgThread(), "bad_mpe.icc", "r"); + srcProfile = cmsOpenProfileFromFile(ContextID, "bad_mpe.icc", "r"); if (!srcProfile) return 0; - dstProfile = cmsCreate_sRGBProfile(DbgThread()); + dstProfile = cmsCreate_sRGBProfile(ContextID); if (!dstProfile) { - cmsCloseProfile(DbgThread(), srcProfile); + cmsCloseProfile(ContextID, srcProfile); return 0; } - srcCS = cmsGetColorSpace(DbgThread(), srcProfile); - nSrcComponents = cmsChannelsOf(DbgThread(), srcCS); + srcCS = cmsGetColorSpace(ContextID, srcProfile); + nSrcComponents = cmsChannelsOf(ContextID, srcCS); if (srcCS == cmsSigLabData) { srcFormat = @@ -8081,14 +8072,14 @@ int CheckForgedMPE(void) COLORSPACE_SH(PT_ANY) | CHANNELS_SH(nSrcComponents) | BYTES_SH(1); } - cmsSetLogErrorHandler(DbgThread(), ErrorReportingFunction); + cmsSetLogErrorHandler(ContextID, ErrorReportingFunction); - hTransform = cmsCreateTransform(DbgThread(), srcProfile, srcFormat, dstProfile, + hTransform = cmsCreateTransform(ContextID, srcProfile, srcFormat, dstProfile, TYPE_BGR_8, intent, flags); - cmsCloseProfile(DbgThread(), srcProfile); - cmsCloseProfile(DbgThread(), dstProfile); + cmsCloseProfile(ContextID, srcProfile); + cmsCloseProfile(ContextID, dstProfile); - cmsSetLogErrorHandler(DbgThread(), FatalErrorQuit); + cmsSetLogErrorHandler(ContextID, FatalErrorQuit); // Should report error if (!TrappedError) return 0; @@ -8103,15 +8094,15 @@ int CheckForgedMPE(void) double input[128]; for (i = 0; i < nSrcComponents; i++) input[i] = 0.5f; - cmsDoTransform(DbgThread(), hTransform, input, output, 1); + cmsDoTransform(ContextID, hTransform, input, output, 1); } else { cmsUInt8Number input[128]; for (i = 0; i < nSrcComponents; i++) input[i] = 128; - cmsDoTransform(DbgThread(), hTransform, input, output, 1); + cmsDoTransform(ContextID, hTransform, input, output, 1); } - cmsDeleteTransform(DbgThread(), hTransform); + cmsDeleteTransform(ContextID, hTransform); return 0; } @@ -8123,16 +8114,16 @@ int CheckForgedMPE(void) * Thanks to Richard Hughes for providing the test */ static -int CheckProofingIntersection(void) +int CheckProofingIntersection(cmsContext ContextID) { cmsHPROFILE profile_null, hnd1, hnd2; cmsHTRANSFORM transform; - hnd1 = cmsCreate_sRGBProfile(DbgThread()); - hnd2 = Create_AboveRGB(); + hnd1 = cmsCreate_sRGBProfile(ContextID); + hnd2 = Create_AboveRGB(ContextID); - profile_null = cmsCreateNULLProfile(DbgThread()); - transform = cmsCreateProofingTransform(DbgThread(), + profile_null = cmsCreateNULLProfile(ContextID); + transform = cmsCreateProofingTransform(ContextID, hnd1, TYPE_RGB_FLT, profile_null, @@ -8143,14 +8134,14 @@ int CheckProofingIntersection(void) cmsFLAGS_GAMUTCHECK | cmsFLAGS_SOFTPROOFING); - cmsCloseProfile(DbgThread(), hnd1); - cmsCloseProfile(DbgThread(), hnd2); - cmsCloseProfile(DbgThread(), profile_null); + cmsCloseProfile(ContextID, hnd1); + cmsCloseProfile(ContextID, hnd2); + cmsCloseProfile(ContextID, profile_null); // Failed? if (transform == NULL) return 0; - cmsDeleteTransform(DbgThread(), transform); + cmsDeleteTransform(ContextID, transform); return 1; } @@ -8185,7 +8176,7 @@ void PrintPerformance(cmsUInt32Number Bytes, cmsUInt32Number SizeOfPixel, cmsFlo static -void SpeedTest32bits(const char * Title, cmsHPROFILE hlcmsProfileIn, cmsHPROFILE hlcmsProfileOut, cmsInt32Number Intent) +void SpeedTest32bits(cmsContext ContextID, const char * Title, cmsHPROFILE hlcmsProfileIn, cmsHPROFILE hlcmsProfileOut, cmsInt32Number Intent) { cmsInt32Number r, g, b, j; clock_t atime; @@ -8199,10 +8190,10 @@ void SpeedTest32bits(const char * Title, cmsHPROFILE hlcmsProfileIn, cmsHPROFILE if (hlcmsProfileIn == NULL || hlcmsProfileOut == NULL) Die("Unable to open profiles"); - hlcmsxform = cmsCreateTransform(DbgThread(), hlcmsProfileIn, TYPE_RGBA_FLT, + hlcmsxform = cmsCreateTransform(ContextID, hlcmsProfileIn, TYPE_RGBA_FLT, hlcmsProfileOut, TYPE_RGBA_FLT, Intent, cmsFLAGS_NOCACHE); - cmsCloseProfile(DbgThread(), hlcmsProfileIn); - cmsCloseProfile(DbgThread(), hlcmsProfileOut); + cmsCloseProfile(ContextID, hlcmsProfileIn); + cmsCloseProfile(ContextID, hlcmsProfileOut); NumPixels = 256 / Interval * 256 / Interval * 256 / Interval; Mb = NumPixels * sizeof(Scanline_rgba32); @@ -8227,19 +8218,19 @@ void SpeedTest32bits(const char * Title, cmsHPROFILE hlcmsProfileIn, cmsHPROFILE atime = clock(); - cmsDoTransform(DbgThread(), hlcmsxform, In, In, NumPixels); + cmsDoTransform(ContextID, hlcmsxform, In, In, NumPixels); diff = clock() - atime; free(In); PrintPerformance(Mb, sizeof(Scanline_rgba32), diff); - cmsDeleteTransform(DbgThread(), hlcmsxform); + cmsDeleteTransform(ContextID, hlcmsxform); } static -void SpeedTest16bits(const char * Title, cmsHPROFILE hlcmsProfileIn, cmsHPROFILE hlcmsProfileOut, cmsInt32Number Intent) +void SpeedTest16bits(cmsContext ContextID, const char * Title, cmsHPROFILE hlcmsProfileIn, cmsHPROFILE hlcmsProfileOut, cmsInt32Number Intent) { cmsInt32Number r, g, b, j; clock_t atime; @@ -8251,10 +8242,10 @@ void SpeedTest16bits(const char * Title, cmsHPROFILE hlcmsProfileIn, cmsHPROFILE if (hlcmsProfileIn == NULL || hlcmsProfileOut == NULL) Die("Unable to open profiles"); - hlcmsxform = cmsCreateTransform(DbgThread(), hlcmsProfileIn, TYPE_RGB_16, + hlcmsxform = cmsCreateTransform(ContextID, hlcmsProfileIn, TYPE_RGB_16, hlcmsProfileOut, TYPE_RGB_16, Intent, cmsFLAGS_NOCACHE); - cmsCloseProfile(DbgThread(), hlcmsProfileIn); - cmsCloseProfile(DbgThread(), hlcmsProfileOut); + cmsCloseProfile(ContextID, hlcmsProfileIn); + cmsCloseProfile(ContextID, hlcmsProfileOut); Mb = 256*256*256 * sizeof(Scanline_rgb16); @@ -8277,19 +8268,19 @@ void SpeedTest16bits(const char * Title, cmsHPROFILE hlcmsProfileIn, cmsHPROFILE atime = clock(); - cmsDoTransform(DbgThread(), hlcmsxform, In, In, 256*256*256); + cmsDoTransform(ContextID, hlcmsxform, In, In, 256*256*256); diff = clock() - atime; free(In); PrintPerformance(Mb, sizeof(Scanline_rgb16), diff); - cmsDeleteTransform(DbgThread(), hlcmsxform); + cmsDeleteTransform(ContextID, hlcmsxform); } static -void SpeedTest32bitsCMYK(const char * Title, cmsHPROFILE hlcmsProfileIn, cmsHPROFILE hlcmsProfileOut) +void SpeedTest32bitsCMYK(cmsContext ContextID, const char * Title, cmsHPROFILE hlcmsProfileIn, cmsHPROFILE hlcmsProfileOut) { cmsInt32Number r, g, b, j; clock_t atime; @@ -8303,10 +8294,10 @@ void SpeedTest32bitsCMYK(const char * Title, cmsHPROFILE hlcmsProfileIn, cmsHPRO if (hlcmsProfileIn == NULL || hlcmsProfileOut == NULL) Die("Unable to open profiles"); - hlcmsxform = cmsCreateTransform(DbgThread(), hlcmsProfileIn, TYPE_CMYK_FLT, + hlcmsxform = cmsCreateTransform(ContextID, hlcmsProfileIn, TYPE_CMYK_FLT, hlcmsProfileOut, TYPE_CMYK_FLT, INTENT_PERCEPTUAL, cmsFLAGS_NOCACHE); - cmsCloseProfile(DbgThread(), hlcmsProfileIn); - cmsCloseProfile(DbgThread(), hlcmsProfileOut); + cmsCloseProfile(ContextID, hlcmsProfileIn); + cmsCloseProfile(ContextID, hlcmsProfileOut); NumPixels = 256 / Interval * 256 / Interval * 256 / Interval; Mb = NumPixels * sizeof(Scanline_rgba32); @@ -8331,7 +8322,7 @@ void SpeedTest32bitsCMYK(const char * Title, cmsHPROFILE hlcmsProfileIn, cmsHPRO atime = clock(); - cmsDoTransform(DbgThread(), hlcmsxform, In, In, NumPixels); + cmsDoTransform(ContextID, hlcmsxform, In, In, NumPixels); diff = clock() - atime; @@ -8339,13 +8330,13 @@ void SpeedTest32bitsCMYK(const char * Title, cmsHPROFILE hlcmsProfileIn, cmsHPRO PrintPerformance(Mb, sizeof(Scanline_rgba32), diff); - cmsDeleteTransform(DbgThread(), hlcmsxform); + cmsDeleteTransform(ContextID, hlcmsxform); } static -void SpeedTest16bitsCMYK(const char * Title, cmsHPROFILE hlcmsProfileIn, cmsHPROFILE hlcmsProfileOut) +void SpeedTest16bitsCMYK(cmsContext ContextID, const char * Title, cmsHPROFILE hlcmsProfileIn, cmsHPROFILE hlcmsProfileOut) { cmsInt32Number r, g, b, j; clock_t atime; @@ -8357,10 +8348,10 @@ void SpeedTest16bitsCMYK(const char * Title, cmsHPROFILE hlcmsProfileIn, cmsHPRO if (hlcmsProfileIn == NULL || hlcmsProfileOut == NULL) Die("Unable to open profiles"); - hlcmsxform = cmsCreateTransform(DbgThread(), hlcmsProfileIn, TYPE_CMYK_16, + hlcmsxform = cmsCreateTransform(ContextID, hlcmsProfileIn, TYPE_CMYK_16, hlcmsProfileOut, TYPE_CMYK_16, INTENT_PERCEPTUAL, cmsFLAGS_NOCACHE); - cmsCloseProfile(DbgThread(), hlcmsProfileIn); - cmsCloseProfile(DbgThread(), hlcmsProfileOut); + cmsCloseProfile(ContextID, hlcmsProfileIn); + cmsCloseProfile(ContextID, hlcmsProfileOut); Mb = 256*256*256*sizeof(Scanline_rgba16); @@ -8384,7 +8375,7 @@ void SpeedTest16bitsCMYK(const char * Title, cmsHPROFILE hlcmsProfileIn, cmsHPRO atime = clock(); - cmsDoTransform(DbgThread(), hlcmsxform, In, In, 256*256*256); + cmsDoTransform(ContextID, hlcmsxform, In, In, 256*256*256); diff = clock() - atime; @@ -8392,13 +8383,13 @@ void SpeedTest16bitsCMYK(const char * Title, cmsHPROFILE hlcmsProfileIn, cmsHPRO PrintPerformance(Mb, sizeof(Scanline_rgba16), diff); - cmsDeleteTransform(DbgThread(), hlcmsxform); + cmsDeleteTransform(ContextID, hlcmsxform); } static -void SpeedTest8bits(const char * Title, cmsHPROFILE hlcmsProfileIn, cmsHPROFILE hlcmsProfileOut, cmsInt32Number Intent) +void SpeedTest8bits(cmsContext ContextID, const char * Title, cmsHPROFILE hlcmsProfileIn, cmsHPROFILE hlcmsProfileOut, cmsInt32Number Intent) { cmsInt32Number r, g, b, j; clock_t atime; @@ -8410,10 +8401,10 @@ void SpeedTest8bits(const char * Title, cmsHPROFILE hlcmsProfileIn, cmsHPROFILE if (hlcmsProfileIn == NULL || hlcmsProfileOut == NULL) Die("Unable to open profiles"); - hlcmsxform = cmsCreateTransform(DbgThread(), hlcmsProfileIn, TYPE_RGB_8, + hlcmsxform = cmsCreateTransform(ContextID, hlcmsProfileIn, TYPE_RGB_8, hlcmsProfileOut, TYPE_RGB_8, Intent, cmsFLAGS_NOCACHE); - cmsCloseProfile(DbgThread(), hlcmsProfileIn); - cmsCloseProfile(DbgThread(), hlcmsProfileOut); + cmsCloseProfile(ContextID, hlcmsProfileIn); + cmsCloseProfile(ContextID, hlcmsProfileOut); Mb = 256*256*256*sizeof(Scanline_rgb8); @@ -8435,7 +8426,7 @@ void SpeedTest8bits(const char * Title, cmsHPROFILE hlcmsProfileIn, cmsHPROFILE atime = clock(); - cmsDoTransform(DbgThread(), hlcmsxform, In, In, 256*256*256); + cmsDoTransform(ContextID, hlcmsxform, In, In, 256*256*256); diff = clock() - atime; @@ -8443,13 +8434,13 @@ void SpeedTest8bits(const char * Title, cmsHPROFILE hlcmsProfileIn, cmsHPROFILE PrintPerformance(Mb, sizeof(Scanline_rgb8), diff); - cmsDeleteTransform(DbgThread(), hlcmsxform); + cmsDeleteTransform(ContextID, hlcmsxform); } static -void SpeedTest8bitsCMYK(const char * Title, cmsHPROFILE hlcmsProfileIn, cmsHPROFILE hlcmsProfileOut) +void SpeedTest8bitsCMYK(cmsContext ContextID, const char * Title, cmsHPROFILE hlcmsProfileIn, cmsHPROFILE hlcmsProfileOut) { cmsInt32Number r, g, b, j; clock_t atime; @@ -8461,10 +8452,10 @@ void SpeedTest8bitsCMYK(const char * Title, cmsHPROFILE hlcmsProfileIn, cmsHPROF if (hlcmsProfileIn == NULL || hlcmsProfileOut == NULL) Die("Unable to open profiles"); - hlcmsxform = cmsCreateTransform(DbgThread(), hlcmsProfileIn, TYPE_CMYK_8, + hlcmsxform = cmsCreateTransform(ContextID, hlcmsProfileIn, TYPE_CMYK_8, hlcmsProfileOut, TYPE_CMYK_8, INTENT_PERCEPTUAL, cmsFLAGS_NOCACHE); - cmsCloseProfile(DbgThread(), hlcmsProfileIn); - cmsCloseProfile(DbgThread(), hlcmsProfileOut); + cmsCloseProfile(ContextID, hlcmsProfileIn); + cmsCloseProfile(ContextID, hlcmsProfileOut); Mb = 256*256*256*sizeof(Scanline_rgba8); @@ -8487,7 +8478,7 @@ void SpeedTest8bitsCMYK(const char * Title, cmsHPROFILE hlcmsProfileIn, cmsHPROF atime = clock(); - cmsDoTransform(DbgThread(), hlcmsxform, In, In, 256*256*256); + cmsDoTransform(ContextID, hlcmsxform, In, In, 256*256*256); diff = clock() - atime; @@ -8496,13 +8487,13 @@ void SpeedTest8bitsCMYK(const char * Title, cmsHPROFILE hlcmsProfileIn, cmsHPROF PrintPerformance(Mb, sizeof(Scanline_rgba8), diff); - cmsDeleteTransform(DbgThread(), hlcmsxform); + cmsDeleteTransform(ContextID, hlcmsxform); } static -void SpeedTest32bitsGray(const char * Title, cmsHPROFILE hlcmsProfileIn, cmsHPROFILE hlcmsProfileOut, cmsInt32Number Intent) +void SpeedTest32bitsGray(cmsContext ContextID, const char * Title, cmsHPROFILE hlcmsProfileIn, cmsHPROFILE hlcmsProfileOut, cmsInt32Number Intent) { cmsInt32Number r, g, b, j; clock_t atime; @@ -8516,10 +8507,10 @@ void SpeedTest32bitsGray(const char * Title, cmsHPROFILE hlcmsProfileIn, cmsHPRO if (hlcmsProfileIn == NULL || hlcmsProfileOut == NULL) Die("Unable to open profiles"); - hlcmsxform = cmsCreateTransform(DbgThread(), hlcmsProfileIn, + hlcmsxform = cmsCreateTransform(ContextID, hlcmsProfileIn, TYPE_GRAY_FLT, hlcmsProfileOut, TYPE_GRAY_FLT, Intent, cmsFLAGS_NOCACHE); - cmsCloseProfile(DbgThread(), hlcmsProfileIn); - cmsCloseProfile(DbgThread(), hlcmsProfileOut); + cmsCloseProfile(ContextID, hlcmsProfileIn); + cmsCloseProfile(ContextID, hlcmsProfileOut); NumPixels = 256 / Interval * 256 / Interval * 256 / Interval; Mb = NumPixels * sizeof(cmsFloat32Number); @@ -8540,18 +8531,18 @@ void SpeedTest32bitsGray(const char * Title, cmsHPROFILE hlcmsProfileIn, cmsHPRO atime = clock(); - cmsDoTransform(DbgThread(), hlcmsxform, In, In, NumPixels); + cmsDoTransform(ContextID, hlcmsxform, In, In, NumPixels); diff = clock() - atime; free(In); PrintPerformance(Mb, sizeof(cmsFloat32Number), diff); - cmsDeleteTransform(DbgThread(), hlcmsxform); + cmsDeleteTransform(ContextID, hlcmsxform); } static -void SpeedTest16bitsGray(const char * Title, cmsHPROFILE hlcmsProfileIn, cmsHPROFILE hlcmsProfileOut, cmsInt32Number Intent) +void SpeedTest16bitsGray(cmsContext ContextID, const char * Title, cmsHPROFILE hlcmsProfileIn, cmsHPROFILE hlcmsProfileOut, cmsInt32Number Intent) { cmsInt32Number r, g, b, j; clock_t atime; @@ -8563,10 +8554,10 @@ void SpeedTest16bitsGray(const char * Title, cmsHPROFILE hlcmsProfileIn, cmsHPRO if (hlcmsProfileIn == NULL || hlcmsProfileOut == NULL) Die("Unable to open profiles"); - hlcmsxform = cmsCreateTransform(DbgThread(), hlcmsProfileIn, + hlcmsxform = cmsCreateTransform(ContextID, hlcmsProfileIn, TYPE_GRAY_16, hlcmsProfileOut, TYPE_GRAY_16, Intent, cmsFLAGS_NOCACHE); - cmsCloseProfile(DbgThread(), hlcmsProfileIn); - cmsCloseProfile(DbgThread(), hlcmsProfileOut); + cmsCloseProfile(ContextID, hlcmsProfileIn); + cmsCloseProfile(ContextID, hlcmsProfileOut); Mb = 256*256*256 * sizeof(cmsUInt16Number); In = (cmsUInt16Number *) malloc(Mb); @@ -8585,18 +8576,18 @@ void SpeedTest16bitsGray(const char * Title, cmsHPROFILE hlcmsProfileIn, cmsHPRO atime = clock(); - cmsDoTransform(DbgThread(), hlcmsxform, In, In, 256*256*256); + cmsDoTransform(ContextID, hlcmsxform, In, In, 256*256*256); diff = clock() - atime; free(In); PrintPerformance(Mb, sizeof(cmsUInt16Number), diff); - cmsDeleteTransform(DbgThread(), hlcmsxform); + cmsDeleteTransform(ContextID, hlcmsxform); } static -void SpeedTest8bitsGray(const char * Title, cmsHPROFILE hlcmsProfileIn, cmsHPROFILE hlcmsProfileOut, cmsInt32Number Intent) +void SpeedTest8bitsGray(cmsContext ContextID, const char * Title, cmsHPROFILE hlcmsProfileIn, cmsHPROFILE hlcmsProfileOut, cmsInt32Number Intent) { cmsInt32Number r, g, b, j; clock_t atime; @@ -8609,10 +8600,10 @@ void SpeedTest8bitsGray(const char * Title, cmsHPROFILE hlcmsProfileIn, cmsHPROF if (hlcmsProfileIn == NULL || hlcmsProfileOut == NULL) Die("Unable to open profiles"); - hlcmsxform = cmsCreateTransform(DbgThread(), hlcmsProfileIn, + hlcmsxform = cmsCreateTransform(ContextID, hlcmsProfileIn, TYPE_GRAY_8, hlcmsProfileOut, TYPE_GRAY_8, Intent, cmsFLAGS_NOCACHE); - cmsCloseProfile(DbgThread(), hlcmsProfileIn); - cmsCloseProfile(DbgThread(), hlcmsProfileOut); + cmsCloseProfile(ContextID, hlcmsProfileIn); + cmsCloseProfile(ContextID, hlcmsProfileOut); Mb = 256*256*256; In = (cmsUInt8Number*) malloc(Mb); @@ -8631,191 +8622,191 @@ void SpeedTest8bitsGray(const char * Title, cmsHPROFILE hlcmsProfileIn, cmsHPROF atime = clock(); - cmsDoTransform(DbgThread(), hlcmsxform, In, In, 256*256*256); + cmsDoTransform(ContextID, hlcmsxform, In, In, 256*256*256); diff = clock() - atime; free(In); PrintPerformance(Mb, sizeof(cmsUInt8Number), diff); - cmsDeleteTransform(DbgThread(), hlcmsxform); + cmsDeleteTransform(ContextID, hlcmsxform); } static -cmsHPROFILE CreateCurves(void) +cmsHPROFILE CreateCurves(cmsContext ContextID) { - cmsToneCurve* Gamma = cmsBuildGamma(DbgThread(), 1.1); + cmsToneCurve* Gamma = cmsBuildGamma(ContextID, 1.1); cmsToneCurve* Transfer[3]; cmsHPROFILE h; Transfer[0] = Transfer[1] = Transfer[2] = Gamma; - h = cmsCreateLinearizationDeviceLink(DbgThread(), cmsSigRgbData, Transfer); + h = cmsCreateLinearizationDeviceLink(ContextID, cmsSigRgbData, Transfer); - cmsFreeToneCurve(DbgThread(), Gamma); + cmsFreeToneCurve(ContextID, Gamma); return h; } static -void SpeedTest(void) +void SpeedTest(cmsContext ContextID) { printf("\n\nP E R F O R M A N C E T E S T S\n"); printf( "=================================\n\n"); fflush(stdout); - SpeedTest8bits("8 bits on CLUT profiles", - cmsOpenProfileFromFile(DbgThread(), "test5.icc", "r"), - cmsOpenProfileFromFile(DbgThread(), "test3.icc", "r"), + SpeedTest8bits(ContextID, "8 bits on CLUT profiles", + cmsOpenProfileFromFile(ContextID, "test5.icc", "r"), + cmsOpenProfileFromFile(ContextID, "test3.icc", "r"), INTENT_PERCEPTUAL); - SpeedTest16bits("16 bits on CLUT profiles", - cmsOpenProfileFromFile(DbgThread(), "test5.icc", "r"), - cmsOpenProfileFromFile(DbgThread(), "test3.icc", "r"), INTENT_PERCEPTUAL); + SpeedTest16bits(ContextID, "16 bits on CLUT profiles", + cmsOpenProfileFromFile(ContextID, "test5.icc", "r"), + cmsOpenProfileFromFile(ContextID, "test3.icc", "r"), INTENT_PERCEPTUAL); - SpeedTest32bits("32 bits on CLUT profiles", - cmsOpenProfileFromFile(DbgThread(), "test5.icc", "r"), - cmsOpenProfileFromFile(DbgThread(), "test3.icc", "r"), INTENT_PERCEPTUAL); + SpeedTest32bits(ContextID, "32 bits on CLUT profiles", + cmsOpenProfileFromFile(ContextID, "test5.icc", "r"), + cmsOpenProfileFromFile(ContextID, "test3.icc", "r"), INTENT_PERCEPTUAL); printf("\n"); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SpeedTest8bits("8 bits on Matrix-Shaper profiles", - cmsOpenProfileFromFile(DbgThread(), "test5.icc", "r"), - cmsOpenProfileFromFile(DbgThread(), "aRGBlcms2.icc", "r"), + SpeedTest8bits(ContextID, "8 bits on Matrix-Shaper profiles", + cmsOpenProfileFromFile(ContextID, "test5.icc", "r"), + cmsOpenProfileFromFile(ContextID, "aRGBlcms2.icc", "r"), INTENT_PERCEPTUAL); - SpeedTest16bits("16 bits on Matrix-Shaper profiles", - cmsOpenProfileFromFile(DbgThread(), "test5.icc", "r"), - cmsOpenProfileFromFile(DbgThread(), "aRGBlcms2.icc", "r"), + SpeedTest16bits(ContextID, "16 bits on Matrix-Shaper profiles", + cmsOpenProfileFromFile(ContextID, "test5.icc", "r"), + cmsOpenProfileFromFile(ContextID, "aRGBlcms2.icc", "r"), INTENT_PERCEPTUAL); - SpeedTest32bits("32 bits on Matrix-Shaper profiles", - cmsOpenProfileFromFile(DbgThread(), "test5.icc", "r"), - cmsOpenProfileFromFile(DbgThread(), "aRGBlcms2.icc", "r"), + SpeedTest32bits(ContextID, "32 bits on Matrix-Shaper profiles", + cmsOpenProfileFromFile(ContextID, "test5.icc", "r"), + cmsOpenProfileFromFile(ContextID, "aRGBlcms2.icc", "r"), INTENT_PERCEPTUAL); printf("\n"); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SpeedTest8bits("8 bits on SAME Matrix-Shaper profiles", - cmsOpenProfileFromFile(DbgThread(), "test5.icc", "r"), - cmsOpenProfileFromFile(DbgThread(), "test5.icc", "r"), + SpeedTest8bits(ContextID, "8 bits on SAME Matrix-Shaper profiles", + cmsOpenProfileFromFile(ContextID, "test5.icc", "r"), + cmsOpenProfileFromFile(ContextID, "test5.icc", "r"), INTENT_PERCEPTUAL); - SpeedTest16bits("16 bits on SAME Matrix-Shaper profiles", - cmsOpenProfileFromFile(DbgThread(), "aRGBlcms2.icc", "r"), - cmsOpenProfileFromFile(DbgThread(), "aRGBlcms2.icc", "r"), + SpeedTest16bits(ContextID, "16 bits on SAME Matrix-Shaper profiles", + cmsOpenProfileFromFile(ContextID, "aRGBlcms2.icc", "r"), + cmsOpenProfileFromFile(ContextID, "aRGBlcms2.icc", "r"), INTENT_PERCEPTUAL); - SpeedTest32bits("32 bits on SAME Matrix-Shaper profiles", - cmsOpenProfileFromFile(DbgThread(), "aRGBlcms2.icc", "r"), - cmsOpenProfileFromFile(DbgThread(), "aRGBlcms2.icc", "r"), + SpeedTest32bits(ContextID, "32 bits on SAME Matrix-Shaper profiles", + cmsOpenProfileFromFile(ContextID, "aRGBlcms2.icc", "r"), + cmsOpenProfileFromFile(ContextID, "aRGBlcms2.icc", "r"), INTENT_PERCEPTUAL); printf("\n"); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SpeedTest8bits("8 bits on Matrix-Shaper profiles (AbsCol)", - cmsOpenProfileFromFile(DbgThread(), "test5.icc", "r"), - cmsOpenProfileFromFile(DbgThread(), "aRGBlcms2.icc", "r"), + SpeedTest8bits(ContextID, "8 bits on Matrix-Shaper profiles (AbsCol)", + cmsOpenProfileFromFile(ContextID, "test5.icc", "r"), + cmsOpenProfileFromFile(ContextID, "aRGBlcms2.icc", "r"), INTENT_ABSOLUTE_COLORIMETRIC); - SpeedTest16bits("16 bits on Matrix-Shaper profiles (AbsCol)", - cmsOpenProfileFromFile(DbgThread(), "test5.icc", "r"), - cmsOpenProfileFromFile(DbgThread(), "aRGBlcms2.icc", "r"), + SpeedTest16bits(ContextID, "16 bits on Matrix-Shaper profiles (AbsCol)", + cmsOpenProfileFromFile(ContextID, "test5.icc", "r"), + cmsOpenProfileFromFile(ContextID, "aRGBlcms2.icc", "r"), INTENT_ABSOLUTE_COLORIMETRIC); - SpeedTest32bits("32 bits on Matrix-Shaper profiles (AbsCol)", - cmsOpenProfileFromFile(DbgThread(), "test5.icc", "r"), - cmsOpenProfileFromFile(DbgThread(), "aRGBlcms2.icc", "r"), + SpeedTest32bits(ContextID, "32 bits on Matrix-Shaper profiles (AbsCol)", + cmsOpenProfileFromFile(ContextID, "test5.icc", "r"), + cmsOpenProfileFromFile(ContextID, "aRGBlcms2.icc", "r"), INTENT_ABSOLUTE_COLORIMETRIC); printf("\n"); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SpeedTest8bits("8 bits on curves", - CreateCurves(), - CreateCurves(), + SpeedTest8bits(ContextID, "8 bits on curves", + CreateCurves(ContextID), + CreateCurves(ContextID), INTENT_PERCEPTUAL); - SpeedTest16bits("16 bits on curves", - CreateCurves(), - CreateCurves(), + SpeedTest16bits(ContextID, "16 bits on curves", + CreateCurves(ContextID), + CreateCurves(ContextID), INTENT_PERCEPTUAL); - SpeedTest32bits("32 bits on curves", - CreateCurves(), - CreateCurves(), + SpeedTest32bits(ContextID, "32 bits on curves", + CreateCurves(ContextID), + CreateCurves(ContextID), INTENT_PERCEPTUAL); printf("\n"); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SpeedTest8bitsCMYK("8 bits on CMYK profiles", - cmsOpenProfileFromFile(DbgThread(), "test1.icc", "r"), - cmsOpenProfileFromFile(DbgThread(), "test2.icc", "r")); + SpeedTest8bitsCMYK(ContextID, "8 bits on CMYK profiles", + cmsOpenProfileFromFile(ContextID, "test1.icc", "r"), + cmsOpenProfileFromFile(ContextID, "test2.icc", "r")); - SpeedTest16bitsCMYK("16 bits on CMYK profiles", - cmsOpenProfileFromFile(DbgThread(), "test1.icc", "r"), - cmsOpenProfileFromFile(DbgThread(), "test2.icc", "r")); + SpeedTest16bitsCMYK(ContextID, "16 bits on CMYK profiles", + cmsOpenProfileFromFile(ContextID, "test1.icc", "r"), + cmsOpenProfileFromFile(ContextID, "test2.icc", "r")); - SpeedTest32bitsCMYK("32 bits on CMYK profiles", - cmsOpenProfileFromFile(DbgThread(), "test1.icc", "r"), - cmsOpenProfileFromFile(DbgThread(), "test2.icc", "r")); + SpeedTest32bitsCMYK(ContextID, "32 bits on CMYK profiles", + cmsOpenProfileFromFile(ContextID, "test1.icc", "r"), + cmsOpenProfileFromFile(ContextID, "test2.icc", "r")); printf("\n"); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SpeedTest8bitsGray("8 bits on gray-to gray", - cmsOpenProfileFromFile(DbgThread(), "gray3lcms2.icc", "r"), - cmsOpenProfileFromFile(DbgThread(), "graylcms2.icc", "r"), INTENT_RELATIVE_COLORIMETRIC); + SpeedTest8bitsGray(ContextID, "8 bits on gray-to gray", + cmsOpenProfileFromFile(ContextID, "gray3lcms2.icc", "r"), + cmsOpenProfileFromFile(ContextID, "graylcms2.icc", "r"), INTENT_RELATIVE_COLORIMETRIC); - SpeedTest16bitsGray("16 bits on gray-to gray", - cmsOpenProfileFromFile(DbgThread(), "gray3lcms2.icc", "r"), - cmsOpenProfileFromFile(DbgThread(), "graylcms2.icc", "r"), INTENT_RELATIVE_COLORIMETRIC); + SpeedTest16bitsGray(ContextID, "16 bits on gray-to gray", + cmsOpenProfileFromFile(ContextID, "gray3lcms2.icc", "r"), + cmsOpenProfileFromFile(ContextID, "graylcms2.icc", "r"), INTENT_RELATIVE_COLORIMETRIC); - SpeedTest32bitsGray("32 bits on gray-to gray", - cmsOpenProfileFromFile(DbgThread(), "gray3lcms2.icc", "r"), - cmsOpenProfileFromFile(DbgThread(), "graylcms2.icc", "r"), INTENT_RELATIVE_COLORIMETRIC); + SpeedTest32bitsGray(ContextID, "32 bits on gray-to gray", + cmsOpenProfileFromFile(ContextID, "gray3lcms2.icc", "r"), + cmsOpenProfileFromFile(ContextID, "graylcms2.icc", "r"), INTENT_RELATIVE_COLORIMETRIC); printf("\n"); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SpeedTest8bitsGray("8 bits on gray-to-lab gray", - cmsOpenProfileFromFile(DbgThread(), "graylcms2.icc", "r"), - cmsOpenProfileFromFile(DbgThread(), "glablcms2.icc", "r"), INTENT_RELATIVE_COLORIMETRIC); + SpeedTest8bitsGray(ContextID, "8 bits on gray-to-lab gray", + cmsOpenProfileFromFile(ContextID, "graylcms2.icc", "r"), + cmsOpenProfileFromFile(ContextID, "glablcms2.icc", "r"), INTENT_RELATIVE_COLORIMETRIC); - SpeedTest16bitsGray("16 bits on gray-to-lab gray", - cmsOpenProfileFromFile(DbgThread(), "graylcms2.icc", "r"), - cmsOpenProfileFromFile(DbgThread(), "glablcms2.icc", "r"), INTENT_RELATIVE_COLORIMETRIC); + SpeedTest16bitsGray(ContextID, "16 bits on gray-to-lab gray", + cmsOpenProfileFromFile(ContextID, "graylcms2.icc", "r"), + cmsOpenProfileFromFile(ContextID, "glablcms2.icc", "r"), INTENT_RELATIVE_COLORIMETRIC); - SpeedTest32bitsGray("32 bits on gray-to-lab gray", - cmsOpenProfileFromFile(DbgThread(), "graylcms2.icc", "r"), - cmsOpenProfileFromFile(DbgThread(), "glablcms2.icc", "r"), INTENT_RELATIVE_COLORIMETRIC); + SpeedTest32bitsGray(ContextID, "32 bits on gray-to-lab gray", + cmsOpenProfileFromFile(ContextID, "graylcms2.icc", "r"), + cmsOpenProfileFromFile(ContextID, "glablcms2.icc", "r"), INTENT_RELATIVE_COLORIMETRIC); printf("\n"); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SpeedTest8bitsGray("8 bits on SAME gray-to-gray", - cmsOpenProfileFromFile(DbgThread(), "graylcms2.icc", "r"), - cmsOpenProfileFromFile(DbgThread(), "graylcms2.icc", "r"), INTENT_PERCEPTUAL); + SpeedTest8bitsGray(ContextID, "8 bits on SAME gray-to-gray", + cmsOpenProfileFromFile(ContextID, "graylcms2.icc", "r"), + cmsOpenProfileFromFile(ContextID, "graylcms2.icc", "r"), INTENT_PERCEPTUAL); - SpeedTest16bitsGray("16 bits on SAME gray-to-gray", - cmsOpenProfileFromFile(DbgThread(), "graylcms2.icc", "r"), - cmsOpenProfileFromFile(DbgThread(), "graylcms2.icc", "r"), INTENT_PERCEPTUAL); + SpeedTest16bitsGray(ContextID, "16 bits on SAME gray-to-gray", + cmsOpenProfileFromFile(ContextID, "graylcms2.icc", "r"), + cmsOpenProfileFromFile(ContextID, "graylcms2.icc", "r"), INTENT_PERCEPTUAL); - SpeedTest32bitsGray("32 bits on SAME gray-to-gray", - cmsOpenProfileFromFile(DbgThread(), "graylcms2.icc", "r"), - cmsOpenProfileFromFile(DbgThread(), "graylcms2.icc", "r"), INTENT_PERCEPTUAL); + SpeedTest32bitsGray(ContextID, "32 bits on SAME gray-to-gray", + cmsOpenProfileFromFile(ContextID, "graylcms2.icc", "r"), + cmsOpenProfileFromFile(ContextID, "graylcms2.icc", "r"), INTENT_PERCEPTUAL); printf("\n"); } @@ -8856,6 +8847,7 @@ int main(int argc, char* argv[]) cmsInt32Number DoCheckTests = 1; cmsInt32Number DoPluginTests = 1; cmsInt32Number DoZooTests = 0; + cmsContext ctx; #ifdef _MSC_VER _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); @@ -8881,250 +8873,251 @@ int main(int argc, char* argv[]) printf("done.\n"); #endif - printf("Installing debug memory plug-in ... "); - cmsPlugin(DbgThread(), &DebugMemHandler); + cmsPlugin(NULL, &DebugMemHandler); printf("done.\n"); + ctx = NULL;//cmsCreateContext(NULL, NULL); + printf("Installing error logger ... "); - cmsSetLogErrorHandler(DbgThread(), FatalErrorQuit); + cmsSetLogErrorHandler(NULL, FatalErrorQuit); printf("done.\n"); PrintSupportedIntents(); - Check("Base types", CheckBaseTypes); - Check("endianness", CheckEndianness); - Check("quick floor", CheckQuickFloor); - Check("quick floor word", CheckQuickFloorWord); - Check("Fixed point 15.16 representation", CheckFixedPoint15_16); - Check("Fixed point 8.8 representation", CheckFixedPoint8_8); - Check("D50 roundtrip", CheckD50Roundtrip); + Check(ctx, "Base types", CheckBaseTypes); + Check(ctx, "endianness", CheckEndianness); + Check(ctx, "quick floor", CheckQuickFloor); + Check(ctx, "quick floor word", CheckQuickFloorWord); + Check(ctx, "Fixed point 15.16 representation", CheckFixedPoint15_16); + Check(ctx, "Fixed point 8.8 representation", CheckFixedPoint8_8); + Check(ctx, "D50 roundtrip", CheckD50Roundtrip); // Create utility profiles if (DoCheckTests || DoSpeedTests) - Check("Creation of test profiles", CreateTestProfiles); + Check(ctx, "Creation of test profiles", CreateTestProfiles); if (DoCheckTests) { // Forward 1D interpolation - Check("1D interpolation in 2pt tables", Check1DLERP2); - Check("1D interpolation in 3pt tables", Check1DLERP3); - Check("1D interpolation in 4pt tables", Check1DLERP4); - Check("1D interpolation in 6pt tables", Check1DLERP6); - Check("1D interpolation in 18pt tables", Check1DLERP18); - Check("1D interpolation in descending 2pt tables", Check1DLERP2Down); - Check("1D interpolation in descending 3pt tables", Check1DLERP3Down); - Check("1D interpolation in descending 6pt tables", Check1DLERP6Down); - Check("1D interpolation in descending 18pt tables", Check1DLERP18Down); + Check(ctx, "1D interpolation in 2pt tables", Check1DLERP2); + Check(ctx, "1D interpolation in 3pt tables", Check1DLERP3); + Check(ctx, "1D interpolation in 4pt tables", Check1DLERP4); + Check(ctx, "1D interpolation in 6pt tables", Check1DLERP6); + Check(ctx, "1D interpolation in 18pt tables", Check1DLERP18); + Check(ctx, "1D interpolation in descending 2pt tables", Check1DLERP2Down); + Check(ctx, "1D interpolation in descending 3pt tables", Check1DLERP3Down); + Check(ctx, "1D interpolation in descending 6pt tables", Check1DLERP6Down); + Check(ctx, "1D interpolation in descending 18pt tables", Check1DLERP18Down); if (Exhaustive) { - Check("1D interpolation in n tables", ExhaustiveCheck1DLERP); - Check("1D interpolation in descending tables", ExhaustiveCheck1DLERPDown); + Check(ctx, "1D interpolation in n tables", ExhaustiveCheck1DLERP); + Check(ctx, "1D interpolation in descending tables", ExhaustiveCheck1DLERPDown); } // Forward 3D interpolation - Check("3D interpolation Tetrahedral (float) ", Check3DinterpolationFloatTetrahedral); - Check("3D interpolation Trilinear (float) ", Check3DinterpolationFloatTrilinear); - Check("3D interpolation Tetrahedral (16) ", Check3DinterpolationTetrahedral16); - Check("3D interpolation Trilinear (16) ", Check3DinterpolationTrilinear16); + Check(ctx, "3D interpolation Tetrahedral (float) ", Check3DinterpolationFloatTetrahedral); + Check(ctx, "3D interpolation Trilinear (float) ", Check3DinterpolationFloatTrilinear); + Check(ctx, "3D interpolation Tetrahedral (16) ", Check3DinterpolationTetrahedral16); + Check(ctx, "3D interpolation Trilinear (16) ", Check3DinterpolationTrilinear16); if (Exhaustive) { - Check("Exhaustive 3D interpolation Tetrahedral (float) ", ExaustiveCheck3DinterpolationFloatTetrahedral); - Check("Exhaustive 3D interpolation Trilinear (float) ", ExaustiveCheck3DinterpolationFloatTrilinear); - Check("Exhaustive 3D interpolation Tetrahedral (16) ", ExhaustiveCheck3DinterpolationTetrahedral16); - Check("Exhaustive 3D interpolation Trilinear (16) ", ExhaustiveCheck3DinterpolationTrilinear16); + Check(ctx, "Exhaustive 3D interpolation Tetrahedral (float) ", ExaustiveCheck3DinterpolationFloatTetrahedral); + Check(ctx, "Exhaustive 3D interpolation Trilinear (float) ", ExaustiveCheck3DinterpolationFloatTrilinear); + Check(ctx, "Exhaustive 3D interpolation Tetrahedral (16) ", ExhaustiveCheck3DinterpolationTetrahedral16); + Check(ctx, "Exhaustive 3D interpolation Trilinear (16) ", ExhaustiveCheck3DinterpolationTrilinear16); } - Check("Reverse interpolation 3 -> 3", CheckReverseInterpolation3x3); - Check("Reverse interpolation 4 -> 3", CheckReverseInterpolation4x3); + Check(ctx, "Reverse interpolation 3 -> 3", CheckReverseInterpolation3x3); + Check(ctx, "Reverse interpolation 4 -> 3", CheckReverseInterpolation4x3); // High dimensionality interpolation - Check("3D interpolation", Check3Dinterp); - Check("3D interpolation with granularity", Check3DinterpGranular); - Check("4D interpolation", Check4Dinterp); - Check("4D interpolation with granularity", Check4DinterpGranular); - Check("5D interpolation with granularity", Check5DinterpGranular); - Check("6D interpolation with granularity", Check6DinterpGranular); - Check("7D interpolation with granularity", Check7DinterpGranular); - Check("8D interpolation with granularity", Check8DinterpGranular); + Check(ctx, "3D interpolation", Check3Dinterp); + Check(ctx, "3D interpolation with granularity", Check3DinterpGranular); + Check(ctx, "4D interpolation", Check4Dinterp); + Check(ctx, "4D interpolation with granularity", Check4DinterpGranular); + Check(ctx, "5D interpolation with granularity", Check5DinterpGranular); + Check(ctx, "6D interpolation with granularity", Check6DinterpGranular); + Check(ctx, "7D interpolation with granularity", Check7DinterpGranular); + Check(ctx, "8D interpolation with granularity", Check8DinterpGranular); // Encoding of colorspaces - Check("Lab to LCh and back (float only) ", CheckLab2LCh); - Check("Lab to XYZ and back (float only) ", CheckLab2XYZ); - Check("Lab to xyY and back (float only) ", CheckLab2xyY); - Check("Lab V2 encoding", CheckLabV2encoding); - Check("Lab V4 encoding", CheckLabV4encoding); + Check(ctx, "Lab to LCh and back (float only) ", CheckLab2LCh); + Check(ctx, "Lab to XYZ and back (float only) ", CheckLab2XYZ); + Check(ctx, "Lab to xyY and back (float only) ", CheckLab2xyY); + Check(ctx, "Lab V2 encoding", CheckLabV2encoding); + Check(ctx, "Lab V4 encoding", CheckLabV4encoding); // BlackBody - Check("Blackbody radiator", CheckTemp2CHRM); + Check(ctx, "Blackbody radiator", CheckTemp2CHRM); // Tone curves - Check("Linear gamma curves (16 bits)", CheckGammaCreation16); - Check("Linear gamma curves (float)", CheckGammaCreationFlt); + Check(ctx, "Linear gamma curves (16 bits)", CheckGammaCreation16); + Check(ctx, "Linear gamma curves (float)", CheckGammaCreationFlt); - Check("Curve 1.8 (float)", CheckGamma18); - Check("Curve 2.2 (float)", CheckGamma22); - Check("Curve 3.0 (float)", CheckGamma30); + Check(ctx, "Curve 1.8 (float)", CheckGamma18); + Check(ctx, "Curve 2.2 (float)", CheckGamma22); + Check(ctx, "Curve 3.0 (float)", CheckGamma30); - Check("Curve 1.8 (table)", CheckGamma18Table); - Check("Curve 2.2 (table)", CheckGamma22Table); - Check("Curve 3.0 (table)", CheckGamma30Table); + Check(ctx, "Curve 1.8 (table)", CheckGamma18Table); + Check(ctx, "Curve 2.2 (table)", CheckGamma22Table); + Check(ctx, "Curve 3.0 (table)", CheckGamma30Table); - Check("Curve 1.8 (word table)", CheckGamma18TableWord); - Check("Curve 2.2 (word table)", CheckGamma22TableWord); - Check("Curve 3.0 (word table)", CheckGamma30TableWord); + Check(ctx, "Curve 1.8 (word table)", CheckGamma18TableWord); + Check(ctx, "Curve 2.2 (word table)", CheckGamma22TableWord); + Check(ctx, "Curve 3.0 (word table)", CheckGamma30TableWord); - Check("Parametric curves", CheckParametricToneCurves); + Check(ctx, "Parametric curves", CheckParametricToneCurves); - Check("Join curves", CheckJointCurves); - Check("Join curves descending", CheckJointCurvesDescending); - Check("Join curves degenerated", CheckReverseDegenerated); - Check("Join curves sRGB (Float)", CheckJointFloatCurves_sRGB); - Check("Join curves sRGB (16 bits)", CheckJoint16Curves_sRGB); - Check("Join curves sigmoidal", CheckJointCurvesSShaped); + Check(ctx, "Join curves", CheckJointCurves); + Check(ctx, "Join curves descending", CheckJointCurvesDescending); + Check(ctx, "Join curves degenerated", CheckReverseDegenerated); + Check(ctx, "Join curves sRGB (Float)", CheckJointFloatCurves_sRGB); + Check(ctx, "Join curves sRGB (16 bits)", CheckJoint16Curves_sRGB); + Check(ctx, "Join curves sigmoidal", CheckJointCurvesSShaped); // LUT basics - Check("LUT creation & dup", CheckLUTcreation); - Check("1 Stage LUT ", Check1StageLUT); - Check("2 Stage LUT ", Check2StageLUT); - Check("2 Stage LUT (16 bits)", Check2Stage16LUT); - Check("3 Stage LUT ", Check3StageLUT); - Check("3 Stage LUT (16 bits)", Check3Stage16LUT); - Check("4 Stage LUT ", Check4StageLUT); - Check("4 Stage LUT (16 bits)", Check4Stage16LUT); - Check("5 Stage LUT ", Check5StageLUT); - Check("5 Stage LUT (16 bits) ", Check5Stage16LUT); - Check("6 Stage LUT ", Check6StageLUT); - Check("6 Stage LUT (16 bits) ", Check6Stage16LUT); + Check(ctx, "LUT creation & dup", CheckLUTcreation); + Check(ctx, "1 Stage LUT ", Check1StageLUT); + Check(ctx, "2 Stage LUT ", Check2StageLUT); + Check(ctx, "2 Stage LUT (16 bits)", Check2Stage16LUT); + Check(ctx, "3 Stage LUT ", Check3StageLUT); + Check(ctx, "3 Stage LUT (16 bits)", Check3Stage16LUT); + Check(ctx, "4 Stage LUT ", Check4StageLUT); + Check(ctx, "4 Stage LUT (16 bits)", Check4Stage16LUT); + Check(ctx, "5 Stage LUT ", Check5StageLUT); + Check(ctx, "5 Stage LUT (16 bits) ", Check5Stage16LUT); + Check(ctx, "6 Stage LUT ", Check6StageLUT); + Check(ctx, "6 Stage LUT (16 bits) ", Check6Stage16LUT); // LUT operation - Check("Lab to Lab LUT (float only) ", CheckLab2LabLUT); - Check("XYZ to XYZ LUT (float only) ", CheckXYZ2XYZLUT); - Check("Lab to Lab MAT LUT (float only) ", CheckLab2LabMatLUT); - Check("Named Color LUT", CheckNamedColorLUT); - Check("Usual formatters", CheckFormatters16); - Check("Floating point formatters", CheckFormattersFloat); + Check(ctx, "Lab to Lab LUT (float only) ", CheckLab2LabLUT); + Check(ctx, "XYZ to XYZ LUT (float only) ", CheckXYZ2XYZLUT); + Check(ctx, "Lab to Lab MAT LUT (float only) ", CheckLab2LabMatLUT); + Check(ctx, "Named Color LUT", CheckNamedColorLUT); + Check(ctx, "Usual formatters", CheckFormatters16); + Check(ctx, "Floating point formatters", CheckFormattersFloat); #ifndef CMS_NO_HALF_SUPPORT - Check("HALF formatters", CheckFormattersHalf); + Check(ctx, "HALF formatters", CheckFormattersHalf); #endif // ChangeBuffersFormat - Check("ChangeBuffersFormat", CheckChangeBufferFormat); + Check(ctx, "ChangeBuffersFormat", CheckChangeBufferFormat); // MLU - Check("Multilocalized Unicode", CheckMLU); + Check(ctx, "Multilocalized Unicode", CheckMLU); // Named color - Check("Named color lists", CheckNamedColorList); + Check(ctx, "Named color lists", CheckNamedColorList); // Profile I/O (this one is huge!) - Check("Profile creation", CheckProfileCreation); - Check("Header version", CheckVersionHeaderWriting); - Check("Multilocalized profile", CheckMultilocalizedProfile); + Check(ctx, "Profile creation", CheckProfileCreation); + Check(ctx, "Header version", CheckVersionHeaderWriting); + Check(ctx, "Multilocalized profile", CheckMultilocalizedProfile); // Error reporting - Check("Error reporting on bad profiles", CheckErrReportingOnBadProfiles); - Check("Error reporting on bad transforms", CheckErrReportingOnBadTransforms); + Check(ctx, "Error reporting on bad profiles", CheckErrReportingOnBadProfiles); + Check(ctx, "Error reporting on bad transforms", CheckErrReportingOnBadTransforms); // Transforms - Check("Curves only transforms", CheckCurvesOnlyTransforms); - Check("Float Lab->Lab transforms", CheckFloatLabTransforms); - Check("Encoded Lab->Lab transforms", CheckEncodedLabTransforms); - Check("Stored identities", CheckStoredIdentities); + Check(ctx, "Curves only transforms", CheckCurvesOnlyTransforms); + Check(ctx, "Float Lab->Lab transforms", CheckFloatLabTransforms); + Check(ctx, "Encoded Lab->Lab transforms", CheckEncodedLabTransforms); + Check(ctx, "Stored identities", CheckStoredIdentities); - Check("Matrix-shaper transform (float)", CheckMatrixShaperXFORMFloat); - Check("Matrix-shaper transform (16 bits)", CheckMatrixShaperXFORM16); - Check("Matrix-shaper transform (8 bits)", CheckMatrixShaperXFORM8); + Check(ctx, "Matrix-shaper transform (float)", CheckMatrixShaperXFORMFloat); + Check(ctx, "Matrix-shaper transform (16 bits)", CheckMatrixShaperXFORM16); + Check(ctx, "Matrix-shaper transform (8 bits)", CheckMatrixShaperXFORM8); - Check("Primaries of sRGB", CheckRGBPrimaries); + Check(ctx, "Primaries of sRGB", CheckRGBPrimaries); // Known values - Check("Known values across matrix-shaper", Chack_sRGB_Float); - Check("Gray input profile", CheckInputGray); - Check("Gray Lab input profile", CheckLabInputGray); - Check("Gray output profile", CheckOutputGray); - Check("Gray Lab output profile", CheckLabOutputGray); + Check(ctx, "Known values across matrix-shaper", Chack_sRGB_Float); + Check(ctx, "Gray input profile", CheckInputGray); + Check(ctx, "Gray Lab input profile", CheckLabInputGray); + Check(ctx, "Gray output profile", CheckOutputGray); + Check(ctx, "Gray Lab output profile", CheckLabOutputGray); - Check("Matrix-shaper proofing transform (float)", CheckProofingXFORMFloat); - Check("Matrix-shaper proofing transform (16 bits)", CheckProofingXFORM16); + Check(ctx, "Matrix-shaper proofing transform (float)", CheckProofingXFORMFloat); + Check(ctx, "Matrix-shaper proofing transform (16 bits)", CheckProofingXFORM16); - Check("Gamut check", CheckGamutCheck); + Check(ctx, "Gamut check", CheckGamutCheck); - Check("CMYK roundtrip on perceptual transform", CheckCMYKRoundtrip); + Check(ctx, "CMYK roundtrip on perceptual transform", CheckCMYKRoundtrip); - Check("CMYK perceptual transform", CheckCMYKPerceptual); + Check(ctx, "CMYK perceptual transform", CheckCMYKPerceptual); // Check("CMYK rel.col. transform", CheckCMYKRelCol); - Check("Black ink only preservation", CheckKOnlyBlackPreserving); - Check("Black plane preservation", CheckKPlaneBlackPreserving); - - - Check("Deciding curve types", CheckV4gamma); - - Check("Black point detection", CheckBlackPoint); - Check("TAC detection", CheckTAC); - - Check("CGATS parser", CheckCGATS); - Check("CGATS parser on junk", CheckCGATS2); - Check("CGATS parser on overflow", CheckCGATS_Overflow); - Check("PostScript generator", CheckPostScript); - Check("Segment maxima GBD", CheckGBD); - Check("MD5 digest", CheckMD5); - Check("Linking", CheckLinking); - Check("floating point tags on XYZ", CheckFloatXYZ); - Check("RGB->Lab->RGB with alpha on FLT", ChecksRGB2LabFLT); - Check("Parametric curve on Rec709", CheckParametricRec709); - Check("Floating Point sampled curve with non-zero start", CheckFloatSamples); - Check("Floating Point segmented curve with short sampled segment", CheckFloatSegments); - Check("Read RAW portions", CheckReadRAW); - Check("Check MetaTag", CheckMeta); - Check("Null transform on floats", CheckFloatNULLxform); - Check("Set free a tag", CheckRemoveTag); - Check("Matrix simplification", CheckMatrixSimplify); - Check("Planar 8 optimization", CheckPlanar8opt); - Check("Swap endian feature", CheckSE); - Check("Transform line stride RGB", CheckTransformLineStride); - Check("Forged MPE profile", CheckForgedMPE); - Check("Proofing intersection", CheckProofingIntersection); + Check(ctx, "Black ink only preservation", CheckKOnlyBlackPreserving); + Check(ctx, "Black plane preservation", CheckKPlaneBlackPreserving); + + + Check(ctx, "Deciding curve types", CheckV4gamma); + + Check(ctx, "Black point detection", CheckBlackPoint); + Check(ctx, "TAC detection", CheckTAC); + + Check(ctx, "CGATS parser", CheckCGATS); + Check(ctx, "CGATS parser on junk", CheckCGATS2); + Check(ctx, "CGATS parser on overflow", CheckCGATS_Overflow); + Check(ctx, "PostScript generator", CheckPostScript); + Check(ctx, "Segment maxima GBD", CheckGBD); + Check(ctx, "MD5 digest", CheckMD5); + Check(ctx, "Linking", CheckLinking); + Check(ctx, "floating point tags on XYZ", CheckFloatXYZ); + Check(ctx, "RGB->Lab->RGB with alpha on FLT", ChecksRGB2LabFLT); + Check(ctx, "Parametric curve on Rec709", CheckParametricRec709); + Check(ctx, "Floating Point sampled curve with non-zero start", CheckFloatSamples); + Check(ctx, "Floating Point segmented curve with short sampled segment", CheckFloatSegments); + Check(ctx, "Read RAW portions", CheckReadRAW); + Check(ctx, "Check MetaTag", CheckMeta); + Check(ctx, "Null transform on floats", CheckFloatNULLxform); + Check(ctx, "Set free a tag", CheckRemoveTag); + Check(ctx, "Matrix simplification", CheckMatrixSimplify); + Check(ctx, "Planar 8 optimization", CheckPlanar8opt); + Check(ctx, "Swap endian feature", CheckSE); + Check(ctx, "Transform line stride RGB", CheckTransformLineStride); + Check(ctx, "Forged MPE profile", CheckForgedMPE); + Check(ctx, "Proofing intersection", CheckProofingIntersection); } if (DoPluginTests) { - Check("Context memory handling", CheckAllocContext); - Check("Simple context functionality", CheckSimpleContext); - Check("Alarm codes context", CheckAlarmColorsContext); - Check("Adaptation state context", CheckAdaptationStateContext); - Check("1D interpolation plugin", CheckInterp1DPlugin); - Check("3D interpolation plugin", CheckInterp3DPlugin); - Check("Parametric curve plugin", CheckParametricCurvePlugin); - Check("Formatters plugin", CheckFormattersPlugin); - Check("Tag type plugin", CheckTagTypePlugin); - Check("MPE type plugin", CheckMPEPlugin); - Check("Optimization plugin", CheckOptimizationPlugin); - Check("Rendering intent plugin", CheckIntentPlugin); - Check("Full transform plugin", CheckTransformPlugin); - Check("Mutex plugin", CheckMutexPlugin); + Check(ctx, "Context memory handling", CheckAllocContext); + Check(ctx, "Simple context functionality", CheckSimpleContext); + Check(ctx, "Alarm codes context", CheckAlarmColorsContext); + Check(ctx, "Adaptation state context", CheckAdaptationStateContext); + Check(ctx, "1D interpolation plugin", CheckInterp1DPlugin); + Check(ctx, "3D interpolation plugin", CheckInterp3DPlugin); + Check(ctx, "Parametric curve plugin", CheckParametricCurvePlugin); + Check(ctx, "Formatters plugin", CheckFormattersPlugin); + Check(ctx, "Tag type plugin", CheckTagTypePlugin); + Check(ctx, "MPE type plugin", CheckMPEPlugin); + Check(ctx, "Optimization plugin", CheckOptimizationPlugin); + Check(ctx, "Rendering intent plugin", CheckIntentPlugin); + Check(ctx, "Full transform plugin", CheckTransformPlugin); + Check(ctx, "Mutex plugin", CheckMutexPlugin); } if (DoSpeedTests) - SpeedTest(); + SpeedTest(ctx); #ifdef CMS_IS_WINDOWS_ if (DoZooTests) - CheckProfileZOO(NULL); + CheckProfileZOO(ctx); #endif DebugMemPrintTotals(); - cmsUnregisterPlugins(DbgThread()); + cmsUnregisterPlugins(NULL); // Cleanup if (DoCheckTests || DoSpeedTests) diff --git a/lcms2mt/testbed/testcms2.h b/lcms2mt/testbed/testcms2.h index 862f0ace..980f2c0b 100755 --- a/lcms2mt/testbed/testcms2.h +++ b/lcms2mt/testbed/testcms2.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2014 Marti Maria Saguer +// Copyright (c) 1998-2020 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -27,13 +27,16 @@ #ifndef TESTCMS2_H #define TESTCMS2_H +#include "lcms2_internal.h" + +// On Visual Studio, use debug CRT #ifdef _MSC_VER -# define _CRT_SECURE_NO_WARNINGS 1 -# include "crtdbg.h" -# include <io.h> +# include "crtdbg.h" #endif -#include "lcms2_internal.h" +#ifdef CMS_IS_WINDOWS_ +# include <io.h> +#endif #define cmsmin(a, b) (((a) < (b)) ? (a) : (b)) @@ -59,23 +62,22 @@ void TestMemoryLeaks(cmsBool ok); void Say(const char* str); // Plug-in tests -cmsInt32Number CheckSimpleContext(void); -cmsInt32Number CheckAllocContext(void); -cmsInt32Number CheckAlarmColorsContext(void); -cmsInt32Number CheckAdaptationStateContext(void); -cmsInt32Number CheckInterp1DPlugin(void); -cmsInt32Number CheckInterp3DPlugin(void); -cmsInt32Number CheckParametricCurvePlugin(void); -cmsInt32Number CheckFormattersPlugin(void); -cmsInt32Number CheckTagTypePlugin(void); -cmsInt32Number CheckMPEPlugin(void); -cmsInt32Number CheckOptimizationPlugin(void); -cmsInt32Number CheckIntentPlugin(void); -cmsInt32Number CheckTransformPlugin(void); -cmsInt32Number CheckMutexPlugin(void); - +cmsInt32Number CheckSimpleContext(cmsContext ContextID); +cmsInt32Number CheckAllocContext(cmsContext ContextID); +cmsInt32Number CheckAlarmColorsContext(cmsContext ContextID); +cmsInt32Number CheckAdaptationStateContext(cmsContext ContextID); +cmsInt32Number CheckInterp1DPlugin(cmsContext ContextID); +cmsInt32Number CheckInterp3DPlugin(cmsContext ContextID); +cmsInt32Number CheckParametricCurvePlugin(cmsContext ContextID); +cmsInt32Number CheckFormattersPlugin(cmsContext ContextID); +cmsInt32Number CheckTagTypePlugin(cmsContext ContextID); +cmsInt32Number CheckMPEPlugin(cmsContext ContextID); +cmsInt32Number CheckOptimizationPlugin(cmsContext ContextID); +cmsInt32Number CheckIntentPlugin(cmsContext ContextID); +cmsInt32Number CheckTransformPlugin(cmsContext ContextID); +cmsInt32Number CheckMutexPlugin(cmsContext ContextID); +cmsInt32Number CheckMethodPackDoublesFromFloat(cmsContext ContextID); -cmsInt32Number CheckOptimizationPluginLeak(void); // Zoo void CheckProfileZOO(cmsContext ContextID); diff --git a/lcms2mt/testbed/testplugin.c b/lcms2mt/testbed/testplugin.c index b70e7d95..90d8e75c 100755 --- a/lcms2mt/testbed/testplugin.c +++ b/lcms2mt/testbed/testplugin.c @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2017 Marti Maria Saguer +// Copyright (c) 1998-2020 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -46,7 +46,7 @@ cmsContext DupContext(cmsContext src, void* Data) // -------------------------------------------------------------------------------------------------- // Allocation order -cmsInt32Number CheckAllocContext(void) +cmsInt32Number CheckAllocContext(cmsContext ContextID) { cmsContext c1, c2, c3, c4; @@ -78,7 +78,7 @@ cmsInt32Number CheckAllocContext(void) } // Test the very basic context capabilities -cmsInt32Number CheckSimpleContext(void) +cmsInt32Number CheckSimpleContext(cmsContext ContextID) { int a = 1; int b = 32; @@ -140,7 +140,7 @@ cmsInt32Number CheckSimpleContext(void) // -------------------------------------------------------------------------------------------------- // This function tests the alarm codes across contexts -cmsInt32Number CheckAlarmColorsContext(void) +cmsInt32Number CheckAlarmColorsContext(cmsContext ContextID) { cmsInt32Number rc = 0; const cmsUInt16Number codes[] = {0x0000, 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7777, 0x8888, 0x9999, 0xaaaa, 0xbbbb, 0xcccc, 0xdddd, 0xeeee, 0xffff}; @@ -178,7 +178,7 @@ cmsInt32Number CheckAlarmColorsContext(void) // -------------------------------------------------------------------------------------------------- // Similar to the previous, but for adaptation state -cmsInt32Number CheckAdaptationStateContext(void) +cmsInt32Number CheckAdaptationStateContext(cmsContext ContextID) { cmsInt32Number rc = 0; cmsContext c1, c2, c3; @@ -276,13 +276,13 @@ cmsInterpFunction my_Interpolators_Factory(cmsContext ContextID, cmsUInt32Number static cmsPluginInterpolation InterpPluginSample = { - { cmsPluginMagicNumber, 2060, cmsPluginInterpolationSig, NULL }, + { cmsPluginMagicNumber, 2060-2000, cmsPluginInterpolationSig, NULL }, my_Interpolators_Factory }; // This is the check code for 1D interpolation plug-in -cmsInt32Number CheckInterp1DPlugin(void) +cmsInt32Number CheckInterp1DPlugin(cmsContext ContextID) { cmsToneCurve* Sampled1D = NULL; cmsContext ctx = NULL; @@ -345,7 +345,7 @@ Error: } // Checks the 3D interpolation -cmsInt32Number CheckInterp3DPlugin(void) +cmsInt32Number CheckInterp3DPlugin(cmsContext ContextID) { cmsPipeline* p; @@ -512,7 +512,7 @@ static double Rec709Math(cmsContext ContextID, int Type, const double Params[], cmsPluginParametricCurves Rec709Plugin = { - { cmsPluginMagicNumber, 2060, cmsPluginParametricCurveSig, NULL }, + { cmsPluginMagicNumber, 2060-2000, cmsPluginParametricCurveSig, NULL }, 1, {TYPE_709}, {5}, Rec709Math @@ -521,7 +521,7 @@ cmsPluginParametricCurves Rec709Plugin = { static cmsPluginParametricCurves CurvePluginSample = { - { cmsPluginMagicNumber, 2060, cmsPluginParametricCurveSig, NULL }, + { cmsPluginMagicNumber, 2060-2000, cmsPluginParametricCurveSig, NULL }, 2, // nFunctions { TYPE_SIN, TYPE_COS }, // Function Types @@ -531,7 +531,7 @@ cmsPluginParametricCurves CurvePluginSample = { static cmsPluginParametricCurves CurvePluginSample2 = { - { cmsPluginMagicNumber, 2060, cmsPluginParametricCurveSig, NULL }, + { cmsPluginMagicNumber, 2060-2000, cmsPluginParametricCurveSig, NULL }, 1, // nFunctions { TYPE_TAN}, // Function Types @@ -542,7 +542,7 @@ cmsPluginParametricCurves CurvePluginSample2 = { // -------------------------------------------------------------------------------------------------- // In this test, the DupContext function will be checked as well // -------------------------------------------------------------------------------------------------- -cmsInt32Number CheckParametricCurvePlugin(void) +cmsInt32Number CheckParametricCurvePlugin(cmsContext ContextID) { cmsContext ctx = NULL; cmsContext cpy = NULL; @@ -691,7 +691,7 @@ cmsFormatter my_FormatterFactory2(cmsContext ContextID, cmsUInt32Number Type, static cmsPluginFormatters FormattersPluginSample = { {cmsPluginMagicNumber, - 2060, + 2060-2000, cmsPluginFormattersSig, NULL}, my_FormatterFactory }; @@ -700,13 +700,13 @@ cmsPluginFormatters FormattersPluginSample = { {cmsPluginMagicNumber, static cmsPluginFormatters FormattersPluginSample2 = { {cmsPluginMagicNumber, - 2060, + 2060-2000, cmsPluginFormattersSig, NULL}, my_FormatterFactory2 }; -cmsInt32Number CheckFormattersPlugin(void) +cmsInt32Number CheckFormattersPlugin(cmsContext ContextID) { cmsContext ctx = WatchDogContext(NULL); cmsContext cpy; @@ -779,21 +779,22 @@ void Type_int_Free(cmsContext ContextID, struct _cms_typehandler_struct* self, static cmsPluginTag HiddenTagPluginSample = { - { cmsPluginMagicNumber, 2060, cmsPluginTagSig, NULL}, + { cmsPluginMagicNumber, 2060-2000, cmsPluginTagSig, NULL}, SigInt, { 1, 1, { SigIntType }, NULL } }; static cmsPluginTagType TagTypePluginSample = { - { cmsPluginMagicNumber, 2060, cmsPluginTagTypeSig, (cmsPluginBase*) &HiddenTagPluginSample}, + { cmsPluginMagicNumber, 2060-2000, cmsPluginTagTypeSig, (cmsPluginBase*) &HiddenTagPluginSample}, { SigIntType, Type_int_Read, Type_int_Write, Type_int_Dup, Type_int_Free, 0 } }; -cmsInt32Number CheckTagTypePlugin(void) +cmsInt32Number CheckTagTypePlugin(cmsContext ContextID) { cmsContext ctx = NULL; cmsContext cpy = NULL; + cmsContext cpy2 = NULL; cmsHPROFILE h = NULL; cmsUInt32Number myTag = 1234; cmsUInt32Number rc = 0; @@ -805,20 +806,24 @@ cmsInt32Number CheckTagTypePlugin(void) cmsPlugin(ctx, &TagTypePluginSample); cpy = DupContext(ctx, NULL); + cpy2 = DupContext(cpy, NULL); - h = cmsCreateProfilePlaceholder(cpy); + cmsDeleteContext(ctx); + cmsDeleteContext(cpy); + + h = cmsCreateProfilePlaceholder(cpy2); if (h == NULL) { Fail("Create placeholder failed"); goto Error; } - if (!cmsWriteTag(cpy, h, SigInt, &myTag)) { + if (!cmsWriteTag(cpy2, h, SigInt, &myTag)) { Fail("Plug-in failed"); goto Error; } - rc = cmsSaveProfileToMem(cpy, h, NULL, &clen); + rc = cmsSaveProfileToMem(cpy2, h, NULL, &clen); if (!rc) { Fail("Fetch mem size failed"); goto Error; @@ -832,32 +837,32 @@ cmsInt32Number CheckTagTypePlugin(void) } - rc = cmsSaveProfileToMem(cpy, h, data, &clen); + rc = cmsSaveProfileToMem(cpy2, h, data, &clen); if (!rc) { Fail("Save to mem failed"); goto Error; } - cmsCloseProfile(cpy, h); + cmsCloseProfile(cpy2, h); - cmsSetLogErrorHandler(cpy, NULL); - h = cmsOpenProfileFromMem(cpy, data, clen); + cmsSetLogErrorHandler(ContextID, NULL); + h = cmsOpenProfileFromMem(ContextID, data, clen); if (h == NULL) { Fail("Open profile failed"); goto Error; } - ptr = (cmsUInt32Number*) cmsReadTag(cpy, h, SigInt); + ptr = (cmsUInt32Number*) cmsReadTag(ContextID, h, SigInt); if (ptr != NULL) { Fail("read tag/context switching failed"); goto Error; } - cmsCloseProfile(cpy, h); - ResetFatalError(cpy); + cmsCloseProfile(ContextID, h); + ResetFatalError(ContextID); - h = cmsOpenProfileFromMem(cpy, data, clen); + h = cmsOpenProfileFromMem(cpy2, data, clen); if (h == NULL) { Fail("Open profile from mem failed"); goto Error; @@ -866,7 +871,7 @@ cmsInt32Number CheckTagTypePlugin(void) // Get rid of data free(data); data = NULL; - ptr = (cmsUInt32Number*) cmsReadTag(cpy, h, SigInt); + ptr = (cmsUInt32Number*) cmsReadTag(cpy2, h, SigInt); if (ptr == NULL) { Fail("Read tag/conext switching failed (2)"); return 0; @@ -874,9 +879,8 @@ cmsInt32Number CheckTagTypePlugin(void) rc = (*ptr == 1234); - cmsCloseProfile(cpy, h); - cmsDeleteContext(ctx); - cmsDeleteContext(cpy); + cmsCloseProfile(cpy2, h); + cmsDeleteContext(cpy2); return rc; @@ -940,16 +944,17 @@ cmsBool Type_negate_Write(cmsContext ContextID, struct _cms_typehandler_struct* static cmsPluginMultiProcessElement MPEPluginSample = { - {cmsPluginMagicNumber, 2060, cmsPluginMultiProcessElementSig, NULL}, + {cmsPluginMagicNumber, 2060-2000, cmsPluginMultiProcessElementSig, NULL}, { (cmsTagTypeSignature) SigNegateType, Type_negate_Read, Type_negate_Write, NULL, NULL, 0 } }; -cmsInt32Number CheckMPEPlugin(void) +cmsInt32Number CheckMPEPlugin(cmsContext ContextID) { cmsContext ctx = NULL; cmsContext cpy = NULL; + cmsContext cpy2 = NULL; cmsHPROFILE h = NULL; cmsUInt32Number myTag = 1234; cmsUInt32Number rc = 0; @@ -962,19 +967,23 @@ cmsInt32Number CheckMPEPlugin(void) cmsPlugin(ctx, &MPEPluginSample); cpy = DupContext(ctx, NULL); + cpy2 = DupContext(cpy, NULL); + + cmsDeleteContext(ctx); + cmsDeleteContext(cpy); - h = cmsCreateProfilePlaceholder(cpy); + h = cmsCreateProfilePlaceholder(cpy2); if (h == NULL) { Fail("Create placeholder failed"); goto Error; } - pipe = cmsPipelineAlloc(cpy, 3, 3); - cmsPipelineInsertStage(cpy, pipe, cmsAT_BEGIN, StageAllocNegate(cpy)); + pipe = cmsPipelineAlloc(cpy2, 3, 3); + cmsPipelineInsertStage(cpy2, pipe, cmsAT_BEGIN, StageAllocNegate(cpy2)); In[0] = 0.3f; In[1] = 0.2f; In[2] = 0.9f; - cmsPipelineEvalFloat(cpy, In, Out, pipe); + cmsPipelineEvalFloat(cpy2, In, Out, pipe); rc = (IsGoodVal("0", Out[0], 1.0-In[0], 0.001) && IsGoodVal("1", Out[1], 1.0-In[1], 0.001) && @@ -985,15 +994,15 @@ cmsInt32Number CheckMPEPlugin(void) goto Error; } - if (!cmsWriteTag(cpy, h, cmsSigDToB3Tag, pipe)) { + if (!cmsWriteTag(cpy2, h, cmsSigDToB3Tag, pipe)) { Fail("Plug-in failed"); goto Error; } // This cleans the stage as well - cmsPipelineFree(cpy, pipe); + cmsPipelineFree(cpy2, pipe); - rc = cmsSaveProfileToMem(cpy, h, NULL, &clen); + rc = cmsSaveProfileToMem(cpy2, h, NULL, &clen); if (!rc) { Fail("Fetch mem size failed"); goto Error; @@ -1007,22 +1016,22 @@ cmsInt32Number CheckMPEPlugin(void) } - rc = cmsSaveProfileToMem(cpy, h, data, &clen); + rc = cmsSaveProfileToMem(cpy2, h, data, &clen); if (!rc) { Fail("Save to mem failed"); goto Error; } - cmsCloseProfile(cpy, h); + cmsCloseProfile(cpy2, h); - cmsSetLogErrorHandler(cpy, NULL); - h = cmsOpenProfileFromMem(cpy, data, clen); + cmsSetLogErrorHandler(ContextID, NULL); + h = cmsOpenProfileFromMem(ContextID, data, clen); if (h == NULL) { Fail("Open profile failed"); goto Error; } - pipe = (cmsPipeline*) cmsReadTag(cpy, h, cmsSigDToB3Tag); + pipe = (cmsPipeline*) cmsReadTag(ContextID, h, cmsSigDToB3Tag); if (pipe != NULL) { // Unsupported stage, should fail @@ -1030,11 +1039,11 @@ cmsInt32Number CheckMPEPlugin(void) goto Error; } - cmsCloseProfile(cpy, h); + cmsCloseProfile(ContextID, h); - ResetFatalError(cpy); + ResetFatalError(ContextID); - h = cmsOpenProfileFromMem(cpy, data, clen); + h = cmsOpenProfileFromMem(cpy2, data, clen); if (h == NULL) { Fail("Open profile from mem failed"); goto Error; @@ -1043,7 +1052,7 @@ cmsInt32Number CheckMPEPlugin(void) // Get rid of data free(data); data = NULL; - pipe = (cmsPipeline*) cmsReadTag(cpy, h, cmsSigDToB3Tag); + pipe = (cmsPipeline*) cmsReadTag(cpy2, h, cmsSigDToB3Tag); if (pipe == NULL) { Fail("Read tag/conext switching failed (2)"); return 0; @@ -1051,22 +1060,20 @@ cmsInt32Number CheckMPEPlugin(void) // Evaluate for negation In[0] = 0.3f; In[1] = 0.2f; In[2] = 0.9f; - cmsPipelineEvalFloat(cpy, In, Out, pipe); + cmsPipelineEvalFloat(cpy2, In, Out, pipe); rc = (IsGoodVal("0", Out[0], 1.0-In[0], 0.001) && IsGoodVal("1", Out[1], 1.0-In[1], 0.001) && IsGoodVal("2", Out[2], 1.0-In[2], 0.001)); - cmsCloseProfile(cpy, h); - cmsDeleteContext(ctx); - cmsDeleteContext(cpy); + cmsCloseProfile(cpy2, h); + cmsDeleteContext(cpy2); return rc; Error: - if (h != NULL) cmsCloseProfile(ctx, h); - if (ctx != NULL) cmsDeleteContext(ctx); - if (cpy != NULL) cmsDeleteContext(cpy); + if (h != NULL) cmsCloseProfile(cpy2, h); + if (cpy2 != NULL) cmsDeleteContext(cpy2); if (data) free(data); return 0; @@ -1117,12 +1124,12 @@ cmsBool MyOptimize(cmsContext ContextID, cmsPipeline** Lut, cmsPluginOptimization OptimizationPluginSample = { - {cmsPluginMagicNumber, 2060, cmsPluginOptimizationSig, NULL}, + {cmsPluginMagicNumber, 2060-2000, cmsPluginOptimizationSig, NULL}, MyOptimize }; -cmsInt32Number CheckOptimizationPlugin(void) +cmsInt32Number CheckOptimizationPlugin(cmsContext ContextID) { cmsContext ctx = WatchDogContext(NULL); cmsContext cpy; @@ -1205,12 +1212,12 @@ cmsPipeline* MyNewIntent(cmsContext ContextID, static cmsPluginRenderingIntent IntentPluginSample = { - {cmsPluginMagicNumber, 2060, cmsPluginRenderingIntentSig, NULL}, + {cmsPluginMagicNumber, 2060-2000, cmsPluginRenderingIntentSig, NULL}, INTENT_DECEPTIVE, MyNewIntent, "bypass gray to gray rendering intent" }; -cmsInt32Number CheckIntentPlugin(void) +cmsInt32Number CheckIntentPlugin(cmsContext ContextID) { cmsContext ctx = WatchDogContext(NULL); cmsContext cpy; @@ -1295,12 +1302,12 @@ cmsBool TransformFactory(cmsContext ContextID, _cmsTransformFn* xformPtr, // The Plug-in entry point static cmsPluginTransform FullTransformPluginSample = { - { cmsPluginMagicNumber, 2060, cmsPluginTransformSig, NULL}, + { cmsPluginMagicNumber, 2060-2000, cmsPluginTransformSig, NULL}, TransformFactory }; -cmsInt32Number CheckTransformPlugin(void) +cmsInt32Number CheckTransformPlugin(cmsContext ContextID) { cmsContext ctx = WatchDogContext(NULL); cmsContext cpy; @@ -1390,7 +1397,7 @@ static cmsPluginMutex MutexPluginSample = { }; -cmsInt32Number CheckMutexPlugin(void) +cmsInt32Number CheckMutexPlugin(cmsContext ContextID) { cmsContext ctx = WatchDogContext(NULL); cmsContext cpy; @@ -1424,3 +1431,75 @@ cmsInt32Number CheckMutexPlugin(void) return 1; } + + +cmsInt32Number CheckMethodPackDoublesFromFloat(cmsContext ContextID) +{ + + cmsContext ctx = WatchDogContext(NULL); + + cmsHTRANSFORM xform; + cmsHTRANSFORM l_pFakeProfileLAB; + + cmsFloat64Number l_D_OutputColorArrayBlack[8]; + cmsFloat64Number l_D_OutputColorArrayBlue[8]; + + cmsCIELab LabInBlack; + cmsCIELab LabInBlue; + + cmsUInt16Number Lab_UI16_Black[3]; + cmsUInt16Number Lab_UI16_Blue[3]; + + cmsHPROFILE OutputCMYKProfile; + cmsUInt32Number l_UI32_OutputFormat; + + + cmsPlugin(ctx, &FullTransformPluginSample); + + + l_pFakeProfileLAB = cmsCreateLab2Profile(ctx, NULL); + + if (l_pFakeProfileLAB == NULL) + return 0; + + OutputCMYKProfile = cmsOpenProfileFromFile(ctx, "TestCLT.icc", "r"); + + if (OutputCMYKProfile == NULL) + return 0; + + l_UI32_OutputFormat = 0; + l_UI32_OutputFormat |= COLORSPACE_SH(PT_CMYK); + l_UI32_OutputFormat |= PLANAR_SH(1); + l_UI32_OutputFormat |= CHANNELS_SH(4); + l_UI32_OutputFormat |= BYTES_SH(0); + l_UI32_OutputFormat |= FLOAT_SH(1); + + + xform = cmsCreateTransform(ctx, l_pFakeProfileLAB, TYPE_Lab_DBL, OutputCMYKProfile, l_UI32_OutputFormat, INTENT_PERCEPTUAL, 0); + cmsCloseProfile(ctx, OutputCMYKProfile); + cmsCloseProfile(ctx, l_pFakeProfileLAB); + + Lab_UI16_Black[0] = 0; + Lab_UI16_Black[1] = 32768; + Lab_UI16_Black[2] = 32768; + + Lab_UI16_Blue[0] = 0; + Lab_UI16_Blue[1] = 8192; + Lab_UI16_Blue[2] = 8192; + + cmsLabEncoded2Float(ctx, &LabInBlack, Lab_UI16_Black); + cmsLabEncoded2Float(ctx, &LabInBlue, Lab_UI16_Blue); + + memset(l_D_OutputColorArrayBlack, 0, sizeof(l_D_OutputColorArrayBlack)); + memset(l_D_OutputColorArrayBlue, 0, sizeof(l_D_OutputColorArrayBlue)); + + cmsDoTransform(ctx, xform, &LabInBlack, l_D_OutputColorArrayBlack, 1); + cmsDoTransform(ctx, xform, &LabInBlue, l_D_OutputColorArrayBlue, 1); + + + cmsDeleteTransform(ctx, xform); + cmsDeleteContext(ctx); + + return 1; +} + diff --git a/lcms2mt/testbed/zoo_icc.c b/lcms2mt/testbed/zoo_icc.c index 06d05887..929bb5d5 100755 --- a/lcms2mt/testbed/zoo_icc.c +++ b/lcms2mt/testbed/zoo_icc.c @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2017 Marti Maria Saguer +// Copyright (c) 1998-2020 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), diff --git a/lcms2mt/utils/common/utils.h b/lcms2mt/utils/common/utils.h index 4df35b07..6c78b062 100644 --- a/lcms2mt/utils/common/utils.h +++ b/lcms2mt/utils/common/utils.h @@ -2,7 +2,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2017 Marti Maria Saguer +// Copyright (c) 1998-2020 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), diff --git a/lcms2mt/utils/common/vprf.c b/lcms2mt/utils/common/vprf.c index d2e1efc0..9e8c13e9 100644 --- a/lcms2mt/utils/common/vprf.c +++ b/lcms2mt/utils/common/vprf.c @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2017 Marti Maria Saguer +// Copyright (c) 1998-2020 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), diff --git a/lcms2mt/utils/jpgicc/Makefile.am b/lcms2mt/utils/jpgicc/Makefile.am index d0a0897f..e0d975b9 100644 --- a/lcms2mt/utils/jpgicc/Makefile.am +++ b/lcms2mt/utils/jpgicc/Makefile.am @@ -14,7 +14,7 @@ else bin_PROGRAMS = endif -jpgicc_LDADD = $(top_builddir)/src/liblcms2.la @JPEGICC_DEPLIBS@ +jpgicc_LDADD = $(top_builddir)/src/liblcms2mt.la @JPEGICC_DEPLIBS@ jpgicc_LDFLAGS = @LDFLAGS@ jpgicc_SOURCES = jpgicc.c iccjpeg.c ../common/xgetopt.c ../common/vprf.c ../common/utils.h man_MANS = jpgicc.1 diff --git a/lcms2mt/utils/jpgicc/Makefile.in b/lcms2mt/utils/jpgicc/Makefile.in index 69032832..978d6ad7 100644 --- a/lcms2mt/utils/jpgicc/Makefile.in +++ b/lcms2mt/utils/jpgicc/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -117,7 +117,7 @@ am__dirstamp = $(am__leading_dot)dirstamp am_jpgicc_OBJECTS = jpgicc.$(OBJEXT) iccjpeg.$(OBJEXT) \ ../common/xgetopt.$(OBJEXT) ../common/vprf.$(OBJEXT) jpgicc_OBJECTS = $(am_jpgicc_OBJECTS) -jpgicc_DEPENDENCIES = $(top_builddir)/src/liblcms2.la +jpgicc_DEPENDENCIES = $(top_builddir)/src/liblcms2mt.la AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent @@ -139,7 +139,7 @@ am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = -am__depfiles_maybe = +am__maybe_remake_depfiles = COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ @@ -362,7 +362,7 @@ AUTOMAKE_OPTIONS = 1.7 foreign no-dependencies AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include \ -I$(top_srcdir)/utils/common -I$(top_builddir)/utils/common -jpgicc_LDADD = $(top_builddir)/src/liblcms2.la @JPEGICC_DEPLIBS@ +jpgicc_LDADD = $(top_builddir)/src/liblcms2mt.la @JPEGICC_DEPLIBS@ jpgicc_LDFLAGS = @LDFLAGS@ jpgicc_SOURCES = jpgicc.c iccjpeg.c ../common/xgetopt.c ../common/vprf.c ../common/utils.h man_MANS = jpgicc.1 @@ -388,8 +388,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -576,7 +576,10 @@ cscopelist-am: $(am__tagged_files) distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ diff --git a/lcms2mt/utils/jpgicc/jpgicc.c b/lcms2mt/utils/jpgicc/jpgicc.c index 55d4cc5c..41deff08 100644 --- a/lcms2mt/utils/jpgicc/jpgicc.c +++ b/lcms2mt/utils/jpgicc/jpgicc.c @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2017 Marti Maria Saguer +// Copyright (c) 1998-2020 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -696,19 +696,19 @@ cmsUInt32Number ComputeOutputFormatDescriptor(cmsUInt32Number dwInput, int OutCo // Equivalence between ICC color spaces and lcms color spaces static -int GetProfileColorSpace(cmsHPROFILE hProfile) +int GetProfileColorSpace(cmsContext ContextID, cmsHPROFILE hProfile) { - cmsColorSpaceSignature ProfileSpace = cmsGetColorSpace(NULL, hProfile); + cmsColorSpaceSignature ProfileSpace = cmsGetColorSpace(ContextID, hProfile); - return _cmsLCMScolorSpace(NULL, ProfileSpace); + return _cmsLCMScolorSpace(ContextID, ProfileSpace); } static -int GetDevicelinkColorSpace(cmsHPROFILE hProfile) +int GetDevicelinkColorSpace(cmsContext ContextID, cmsHPROFILE hProfile) { - cmsColorSpaceSignature ProfileSpace = cmsGetPCS(NULL, hProfile); + cmsColorSpaceSignature ProfileSpace = cmsGetPCS(ContextID, hProfile); - return _cmsLCMScolorSpace(NULL, ProfileSpace); + return _cmsLCMScolorSpace(ContextID, ProfileSpace); } @@ -842,7 +842,7 @@ void DoEmbedProfile(const char* ProfileFile) static -int DoTransform(cmsHTRANSFORM hXForm, int OutputColorSpace) +int DoTransform(cmsContext ContextID, cmsHTRANSFORM hXForm, int OutputColorSpace) { JSAMPROW ScanLineIn; JSAMPROW ScanLineOut; @@ -874,7 +874,7 @@ int DoTransform(cmsHTRANSFORM hXForm, int OutputColorSpace) jpeg_read_scanlines(&Decompressor, &ScanLineIn, 1); - cmsDoTransform(NULL, hXForm, ScanLineIn, ScanLineOut, Decompressor.output_width); + cmsDoTransform(ContextID, hXForm, ScanLineIn, ScanLineOut, Decompressor.output_width); jpeg_write_scanlines(&Compressor, &ScanLineOut, 1); } @@ -893,7 +893,7 @@ int DoTransform(cmsHTRANSFORM hXForm, int OutputColorSpace) // Transform one image static -int TransformImage(char *cDefInpProf, char *cOutputProf) +int TransformImage(cmsContext ContextID, char *cDefInpProf, char *cOutputProf) { cmsHPROFILE hIn, hOut, hProof; cmsHTRANSFORM xform; @@ -904,7 +904,7 @@ int TransformImage(char *cDefInpProf, char *cOutputProf) cmsUInt8Number* EmbedBuffer; - cmsSetAdaptationState(ObserverAdaptationState); + cmsSetAdaptationState(ContextID, ObserverAdaptationState); if (BlackPointCompensation) { @@ -923,7 +923,7 @@ int TransformImage(char *cDefInpProf, char *cOutputProf) if (GamutCheck) { dwFlags |= cmsFLAGS_GAMUTCHECK; - cmsSetAlarmCodes(Alarm); + cmsSetAlarmCodes(ContextID, Alarm); } // Take input color space @@ -931,7 +931,7 @@ int TransformImage(char *cDefInpProf, char *cOutputProf) if (lIsDeviceLink) { - hIn = cmsOpenProfileFromFile(cDefInpProf, "r"); + hIn = cmsOpenProfileFromFile(ContextID, cDefInpProf, "r"); hOut = NULL; hProof = NULL; } @@ -939,12 +939,12 @@ int TransformImage(char *cDefInpProf, char *cOutputProf) if (!IgnoreEmbedded && read_icc_profile(&Decompressor, &EmbedBuffer, &EmbedLen)) { - hIn = cmsOpenProfileFromMem(EmbedBuffer, EmbedLen); + hIn = cmsOpenProfileFromMem(ContextID, EmbedBuffer, EmbedLen); if (Verbose) { fprintf(stdout, " (Embedded profile found)\n"); - PrintProfileInformation(NULL, hIn); + PrintProfileInformation(ContextID, hIn); fflush(stdout); } @@ -987,17 +987,17 @@ int TransformImage(char *cDefInpProf, char *cOutputProf) FatalError("Output profile couldn't be read."); // Assure both, input profile and input JPEG are on same colorspace - if (cmsGetColorSpace(NULL, hIn) != _cmsICCcolorSpace(NULL, T_COLORSPACE(wInput))) + if (cmsGetColorSpace(ContextID, hIn) != _cmsICCcolorSpace(ContextID, T_COLORSPACE(wInput))) FatalError("Input profile is not operating in proper color space"); // Output colorspace is given by output profile if (lIsDeviceLink) { - OutputColorSpace = GetDevicelinkColorSpace(hIn); + OutputColorSpace = GetDevicelinkColorSpace(ContextID, hIn); } else { - OutputColorSpace = GetProfileColorSpace(hOut); + OutputColorSpace = GetProfileColorSpace(ContextID, hOut); } jpeg_copy_critical_parameters(&Decompressor, &Compressor); @@ -1007,22 +1007,22 @@ int TransformImage(char *cDefInpProf, char *cOutputProf) wOutput = ComputeOutputFormatDescriptor(wInput, OutputColorSpace); - xform = cmsCreateProofingTransform(hIn, wInput, + xform = cmsCreateProofingTransform(ContextID, hIn, wInput, hOut, wOutput, hProof, Intent, ProofingIntent, dwFlags); if (xform == NULL) FatalError("Cannot transform by using the profiles"); - DoTransform(xform, OutputColorSpace); + DoTransform(ContextID, xform, OutputColorSpace); jcopy_markers_execute(&Decompressor, &Compressor); - cmsDeleteTransform(NULL, xform); - cmsCloseProfile(NULL, hIn); - cmsCloseProfile(NULL, hOut); - if (hProof) cmsCloseProfile(NULL, hProof); + cmsDeleteTransform(ContextID, xform); + cmsCloseProfile(ContextID, hIn); + cmsCloseProfile(ContextID, hOut); + if (hProof) cmsCloseProfile(ContextID, hProof); return 1; } @@ -1238,6 +1238,8 @@ void HandleSwitches(int argc, char *argv[]) int main(int argc, char* argv[]) { + cmsContext ContextID = cmsCreateContext(NULL, NULL); + InitUtils(NULL, "jpgicc"); HandleSwitches(argc, argv); @@ -1249,13 +1251,15 @@ int main(int argc, char* argv[]) OpenInput(argv[xoptind]); OpenOutput(argv[xoptind+1]); - TransformImage(cInpProf, cOutProf); + TransformImage(ContextID, cInpProf, cOutProf); if (Verbose) { fprintf(stdout, "\n"); fflush(stdout); } Done(); + cmsDeleteContext(ContextID); + return 0; } diff --git a/lcms2mt/utils/linkicc/Makefile.am b/lcms2mt/utils/linkicc/Makefile.am index 3b918697..78cd3710 100644 --- a/lcms2mt/utils/linkicc/Makefile.am +++ b/lcms2mt/utils/linkicc/Makefile.am @@ -11,9 +11,9 @@ AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include \ bin_PROGRAMS = linkicc -linkicc_LDADD = $(top_builddir)/src/liblcms2.la +linkicc_LDADD = $(top_builddir)/src/liblcms2mt.la linkicc_LDFLAGS = @LDFLAGS@ linkicc_SOURCES = linkicc.c ../common/xgetopt.c ../common/vprf.c ../common/utils.h -linkicc_MANS = linkicc.1 +man_MANS = linkicc.1 EXTRA_DIST = $(man_MANS) diff --git a/lcms2mt/utils/linkicc/Makefile.in b/lcms2mt/utils/linkicc/Makefile.in index 2631ab87..c5cb2fc9 100644 --- a/lcms2mt/utils/linkicc/Makefile.in +++ b/lcms2mt/utils/linkicc/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -111,13 +111,13 @@ DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = -am__installdirs = "$(DESTDIR)$(bindir)" +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" PROGRAMS = $(bin_PROGRAMS) am__dirstamp = $(am__leading_dot)dirstamp am_linkicc_OBJECTS = linkicc.$(OBJEXT) ../common/xgetopt.$(OBJEXT) \ ../common/vprf.$(OBJEXT) linkicc_OBJECTS = $(am_linkicc_OBJECTS) -linkicc_DEPENDENCIES = $(top_builddir)/src/liblcms2.la +linkicc_DEPENDENCIES = $(top_builddir)/src/liblcms2mt.la AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent @@ -139,7 +139,7 @@ am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = -am__depfiles_maybe = +am__maybe_remake_depfiles = COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ @@ -165,6 +165,36 @@ am__can_run_installinfo = \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +man1dir = $(mandir)/man1 +NROFF = nroff +MANS = $(man_MANS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is @@ -332,10 +362,10 @@ AUTOMAKE_OPTIONS = 1.7 foreign no-dependencies AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include \ -I$(top_srcdir)/utils/common -I$(top_builddir)/utils/common -linkicc_LDADD = $(top_builddir)/src/liblcms2.la +linkicc_LDADD = $(top_builddir)/src/liblcms2mt.la linkicc_LDFLAGS = @LDFLAGS@ linkicc_SOURCES = linkicc.c ../common/xgetopt.c ../common/vprf.c ../common/utils.h -linkicc_MANS = linkicc.1 +man_MANS = linkicc.1 EXTRA_DIST = $(man_MANS) all: all-am @@ -358,8 +388,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -450,6 +480,49 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs +install-man1: $(man_MANS) + @$(NORMAL_INSTALL) + @list1=''; \ + list2='$(man_MANS)'; \ + test -n "$(man1dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.1[a-z]*$$/p'; \ + fi; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ + done; } + +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man1dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.1[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique @@ -503,7 +576,10 @@ cscopelist-am: $(am__tagged_files) distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -535,9 +611,9 @@ distdir: $(DISTFILES) done check-am: all-am check: check-am -all-am: Makefile $(PROGRAMS) +all-am: Makefile $(PROGRAMS) $(MANS) installdirs: - for dir in "$(DESTDIR)$(bindir)"; do \ + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am @@ -592,7 +668,7 @@ info: info-am info-am: -install-data-am: +install-data-am: install-man install-dvi: install-dvi-am @@ -608,7 +684,7 @@ install-info: install-info-am install-info-am: -install-man: +install-man: install-man1 install-pdf: install-pdf-am @@ -637,7 +713,9 @@ ps: ps-am ps-am: -uninstall-am: uninstall-binPROGRAMS +uninstall-am: uninstall-binPROGRAMS uninstall-man + +uninstall-man: uninstall-man1 .MAKE: install-am install-strip @@ -648,12 +726,13 @@ uninstall-am: uninstall-binPROGRAMS html-am info info-am install install-am install-binPROGRAMS \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags tags-am uninstall uninstall-am uninstall-binPROGRAMS + install-info install-info-am install-man install-man1 \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ + uninstall-binPROGRAMS uninstall-man uninstall-man1 .PRECIOUS: Makefile diff --git a/lcms2mt/utils/linkicc/linkicc.c b/lcms2mt/utils/linkicc/linkicc.c index e2fa28c9..3be4323f 100644 --- a/lcms2mt/utils/linkicc/linkicc.c +++ b/lcms2mt/utils/linkicc/linkicc.c @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2017 Marti Maria Saguer +// Copyright (c) 1998-2020 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), diff --git a/lcms2mt/utils/psicc/Makefile.am b/lcms2mt/utils/psicc/Makefile.am index fd9839a8..3f6bf4f2 100644 --- a/lcms2mt/utils/psicc/Makefile.am +++ b/lcms2mt/utils/psicc/Makefile.am @@ -11,9 +11,9 @@ AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include \ bin_PROGRAMS = psicc -psicc_LDADD = $(top_builddir)/src/liblcms2.la @LCMS_LIB_DEPLIBS@ +psicc_LDADD = $(top_builddir)/src/liblcms2mt.la @LCMS_LIB_DEPLIBS@ psicc_LDFLAGS = @LDFLAGS@ psicc_SOURCES = psicc.c ../common/xgetopt.c ../common/vprf.c ../common/utils.h -psicc_MANS = psicc.1 +man_MANS = psicc.1 EXTRA_DIST = $(man_MANS) diff --git a/lcms2mt/utils/psicc/Makefile.in b/lcms2mt/utils/psicc/Makefile.in index 6fed4758..a7f44689 100644 --- a/lcms2mt/utils/psicc/Makefile.in +++ b/lcms2mt/utils/psicc/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -111,13 +111,13 @@ DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = -am__installdirs = "$(DESTDIR)$(bindir)" +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" PROGRAMS = $(bin_PROGRAMS) am__dirstamp = $(am__leading_dot)dirstamp am_psicc_OBJECTS = psicc.$(OBJEXT) ../common/xgetopt.$(OBJEXT) \ ../common/vprf.$(OBJEXT) psicc_OBJECTS = $(am_psicc_OBJECTS) -psicc_DEPENDENCIES = $(top_builddir)/src/liblcms2.la +psicc_DEPENDENCIES = $(top_builddir)/src/liblcms2mt.la AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent @@ -139,7 +139,7 @@ am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = -am__depfiles_maybe = +am__maybe_remake_depfiles = COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ @@ -165,6 +165,36 @@ am__can_run_installinfo = \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +man1dir = $(mandir)/man1 +NROFF = nroff +MANS = $(man_MANS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is @@ -332,10 +362,10 @@ AUTOMAKE_OPTIONS = 1.7 foreign no-dependencies AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include \ -I$(top_srcdir)/utils/common -I$(top_builddir)/utils/common -psicc_LDADD = $(top_builddir)/src/liblcms2.la +psicc_LDADD = $(top_builddir)/src/liblcms2mt.la @LCMS_LIB_DEPLIBS@ psicc_LDFLAGS = @LDFLAGS@ psicc_SOURCES = psicc.c ../common/xgetopt.c ../common/vprf.c ../common/utils.h -psicc_MANS = psicc.1 +man_MANS = psicc.1 EXTRA_DIST = $(man_MANS) all: all-am @@ -358,8 +388,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -450,6 +480,49 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs +install-man1: $(man_MANS) + @$(NORMAL_INSTALL) + @list1=''; \ + list2='$(man_MANS)'; \ + test -n "$(man1dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.1[a-z]*$$/p'; \ + fi; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ + done; } + +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man1dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.1[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique @@ -503,7 +576,10 @@ cscopelist-am: $(am__tagged_files) distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -535,9 +611,9 @@ distdir: $(DISTFILES) done check-am: all-am check: check-am -all-am: Makefile $(PROGRAMS) +all-am: Makefile $(PROGRAMS) $(MANS) installdirs: - for dir in "$(DESTDIR)$(bindir)"; do \ + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am @@ -592,7 +668,7 @@ info: info-am info-am: -install-data-am: +install-data-am: install-man install-dvi: install-dvi-am @@ -608,7 +684,7 @@ install-info: install-info-am install-info-am: -install-man: +install-man: install-man1 install-pdf: install-pdf-am @@ -637,7 +713,9 @@ ps: ps-am ps-am: -uninstall-am: uninstall-binPROGRAMS +uninstall-am: uninstall-binPROGRAMS uninstall-man + +uninstall-man: uninstall-man1 .MAKE: install-am install-strip @@ -648,12 +726,13 @@ uninstall-am: uninstall-binPROGRAMS html-am info info-am install install-am install-binPROGRAMS \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags tags-am uninstall uninstall-am uninstall-binPROGRAMS + install-info install-info-am install-man install-man1 \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ + uninstall-binPROGRAMS uninstall-man uninstall-man1 .PRECIOUS: Makefile diff --git a/lcms2mt/utils/psicc/psicc.c b/lcms2mt/utils/psicc/psicc.c index 51851e00..3a4d9961 100644 --- a/lcms2mt/utils/psicc/psicc.c +++ b/lcms2mt/utils/psicc/psicc.c @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2017 Marti Maria Saguer +// Copyright (c) 1998-2020 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), diff --git a/lcms2mt/utils/samples/Makefile.am b/lcms2mt/utils/samples/Makefile.am index b3b62017..d33f7aa5 100644 --- a/lcms2mt/utils/samples/Makefile.am +++ b/lcms2mt/utils/samples/Makefile.am @@ -11,9 +11,9 @@ AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include \ bin_PROGRAMS = wtpt -wtpt_LDADD = $(top_builddir)/src/liblcms2.la +wtpt_LDADD = $(top_builddir)/src/liblcms2mt.la wtpt_LDFLAGS = @LDFLAGS@ wtpt_SOURCES = wtpt.c ../common/xgetopt.c ../common/vprf.c ../common/utils.h -wtpt_MANS = wtpt.1 +man_MANS = wtpt.1 EXTRA_DIST = $(man_MANS) roundtrip.c mktiff8.c mkgrayer.c mkcmy.c itufax.c diff --git a/lcms2mt/utils/tificc/Makefile.am b/lcms2mt/utils/tificc/Makefile.am index 50f5dc44..9e3643f2 100644 --- a/lcms2mt/utils/tificc/Makefile.am +++ b/lcms2mt/utils/tificc/Makefile.am @@ -16,7 +16,7 @@ else bin_PROGRAMS = endif -tificc_LDADD = $(top_builddir)/src/liblcms2.la @TIFFICC_DEPLIBS@ +tificc_LDADD = $(top_builddir)/src/liblcms2mt.la @TIFFICC_DEPLIBS@ tificc_LDFLAGS = @LDFLAGS@ tificc_SOURCES = tificc.c ../common/xgetopt.c ../common/vprf.c ../common/utils.h man_MANS = tificc.1 diff --git a/lcms2mt/utils/tificc/Makefile.in b/lcms2mt/utils/tificc/Makefile.in index de4d9c29..c85c881d 100644 --- a/lcms2mt/utils/tificc/Makefile.in +++ b/lcms2mt/utils/tificc/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -117,7 +117,7 @@ am__dirstamp = $(am__leading_dot)dirstamp am_tificc_OBJECTS = tificc.$(OBJEXT) ../common/xgetopt.$(OBJEXT) \ ../common/vprf.$(OBJEXT) tificc_OBJECTS = $(am_tificc_OBJECTS) -tificc_DEPENDENCIES = $(top_builddir)/src/liblcms2.la +tificc_DEPENDENCIES = $(top_builddir)/src/liblcms2mt.la AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent @@ -139,7 +139,7 @@ am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = -am__depfiles_maybe = +am__maybe_remake_depfiles = COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ @@ -362,7 +362,7 @@ AUTOMAKE_OPTIONS = 1.7 foreign no-dependencies AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include \ -I$(top_srcdir)/utils/common -I$(top_builddir)/utils/common -tificc_LDADD = $(top_builddir)/src/liblcms2.la @TIFFICC_DEPLIBS@ +tificc_LDADD = $(top_builddir)/src/liblcms2mt.la @TIFFICC_DEPLIBS@ tificc_LDFLAGS = @LDFLAGS@ tificc_SOURCES = tificc.c ../common/xgetopt.c ../common/vprf.c ../common/utils.h man_MANS = tificc.1 @@ -388,8 +388,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -576,7 +576,10 @@ cscopelist-am: $(am__tagged_files) distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ diff --git a/lcms2mt/utils/tificc/tifdiff.c b/lcms2mt/utils/tificc/tifdiff.c index 6719ec1c..fb12b3c4 100644 --- a/lcms2mt/utils/tificc/tifdiff.c +++ b/lcms2mt/utils/tificc/tifdiff.c @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2017 Marti Maria Saguer +// Copyright (c) 1998-2020 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), diff --git a/lcms2mt/utils/tificc/tificc.c b/lcms2mt/utils/tificc/tificc.c index 2d2c70f3..445cc338 100644 --- a/lcms2mt/utils/tificc/tificc.c +++ b/lcms2mt/utils/tificc/tificc.c @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2017 Marti Maria Saguer +// Copyright (c) 1998-2020 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -237,7 +237,7 @@ cmsFormatter TiffFormatterFactory(cmsContext ContextID, cmsUInt32Number Type, return Result; } -static cmsPluginFormatters TiffLabPlugin = { {cmsPluginMagicNumber, 2000, cmsPluginFormattersSig, NULL}, TiffFormatterFactory }; +static cmsPluginFormatters TiffLabPlugin = { {cmsPluginMagicNumber, 2000-2000, cmsPluginFormattersSig, NULL}, TiffFormatterFactory }; @@ -375,7 +375,7 @@ cmsUInt32Number ComputeOutputFormatDescriptor(cmsUInt32Number dwInput, int OutCo // Tile based transforms static -int TileBasedXform(cmsHTRANSFORM hXForm, TIFF* in, TIFF* out, int nPlanes) +int TileBasedXform(cmsContext ContextID, cmsHTRANSFORM hXForm, TIFF* in, TIFF* out, int nPlanes) { tsize_t BufSizeIn = TIFFTileSize(in); tsize_t BufSizeOut = TIFFTileSize(out); @@ -385,16 +385,20 @@ int TileBasedXform(cmsHTRANSFORM hXForm, TIFF* in, TIFF* out, int nPlanes) int PixelCount, j; + // Check for bad tiffs + if (BufSizeIn > INT_MAX || BufSizeOut > INT_MAX) + FatalError("Probably corrupted TIFF, tile too big."); + TIFFGetFieldDefaulted(in, TIFFTAG_TILEWIDTH, &tw); TIFFGetFieldDefaulted(in, TIFFTAG_TILELENGTH, &tl); PixelCount = (int) tw * tl; BufferIn = (unsigned char *) _TIFFmalloc(BufSizeIn * nPlanes); - if (!BufferIn) OutOfMem(BufSizeIn * nPlanes); + if (!BufferIn) OutOfMem((cmsUInt32Number) BufSizeIn * nPlanes); BufferOut = (unsigned char *) _TIFFmalloc(BufSizeOut * nPlanes); - if (!BufferOut) OutOfMem(BufSizeOut * nPlanes); + if (!BufferOut) OutOfMem((cmsUInt32Number) BufSizeOut * nPlanes); for (i = 0; i < TileCount; i++) { @@ -405,7 +409,7 @@ int TileBasedXform(cmsHTRANSFORM hXForm, TIFF* in, TIFF* out, int nPlanes) BufferIn + (j*BufSizeIn), BufSizeIn) < 0) goto cleanup; } - cmsDoTransform(NULL, hXForm, BufferIn, BufferOut, PixelCount); + cmsDoTransform(ContextID, hXForm, BufferIn, BufferOut, PixelCount); for (j=0; j < nPlanes; j++) { @@ -431,7 +435,7 @@ cleanup: // Strip based transforms static -int StripBasedXform(cmsHTRANSFORM hXForm, TIFF* in, TIFF* out, int nPlanes) +int StripBasedXform(cmsContext ContextID, cmsHTRANSFORM hXForm, TIFF* in, TIFF* out, int nPlanes) { tsize_t BufSizeIn = TIFFStripSize(in); tsize_t BufSizeOut = TIFFStripSize(out); @@ -443,6 +447,10 @@ int StripBasedXform(cmsHTRANSFORM hXForm, TIFF* in, TIFF* out, int nPlanes) int j; int PixelCount; + // Check for bad tiffs + if (BufSizeIn > INT_MAX || BufSizeOut > INT_MAX) + FatalError("Probably corrupted TIFF, strip too big."); + TIFFGetFieldDefaulted(in, TIFFTAG_IMAGEWIDTH, &sw); TIFFGetFieldDefaulted(in, TIFFTAG_ROWSPERSTRIP, &sl); TIFFGetFieldDefaulted(in, TIFFTAG_IMAGELENGTH, &iml); @@ -452,10 +460,10 @@ int StripBasedXform(cmsHTRANSFORM hXForm, TIFF* in, TIFF* out, int nPlanes) sl = iml; // One strip for whole image BufferIn = (unsigned char *) _TIFFmalloc(BufSizeIn * nPlanes); - if (!BufferIn) OutOfMem(BufSizeIn * nPlanes); + if (!BufferIn) OutOfMem((cmsUInt32Number) BufSizeIn * nPlanes); BufferOut = (unsigned char *) _TIFFmalloc(BufSizeOut * nPlanes); - if (!BufferOut) OutOfMem(BufSizeOut * nPlanes); + if (!BufferOut) OutOfMem((cmsUInt32Number) BufSizeOut * nPlanes); for (i = 0; i < StripCount; i++) { @@ -469,7 +477,7 @@ int StripBasedXform(cmsHTRANSFORM hXForm, TIFF* in, TIFF* out, int nPlanes) PixelCount = (int) sw * (iml < sl ? iml : sl); iml -= sl; - cmsDoTransform(NULL, hXForm, BufferIn, BufferOut, PixelCount); + cmsDoTransform(ContextID, hXForm, BufferIn, BufferOut, PixelCount); for (j=0; j < nPlanes; j++) { if (TIFFWriteEncodedStrip(out, i + (j * StripCount), @@ -667,7 +675,7 @@ void DoEmbedProfile(TIFF* Out, const char* ProfileFile) size = cmsfilelength(f); if (size < 0) return; - EmbedBuffer = (cmsUInt8Number*) malloc(size + 1); + EmbedBuffer = (cmsUInt8Number*) malloc((size_t) size + 1); if (EmbedBuffer == NULL) { OutOfMem(size+1); return; @@ -675,7 +683,7 @@ void DoEmbedProfile(TIFF* Out, const char* ProfileFile) EmbedLen = (cmsUInt32Number) fread(EmbedBuffer, 1, (size_t) size, f); - if (EmbedLen != size) + if (EmbedLen != (cmsUInt32Number) size) FatalError("Cannot read %ld bytes to %s", size, ProfileFile); fclose(f); @@ -688,7 +696,7 @@ void DoEmbedProfile(TIFF* Out, const char* ProfileFile) static -cmsHPROFILE GetTIFFProfile(TIFF* in) +cmsHPROFILE GetTIFFProfile(cmsContext ContextID, TIFF* in) { cmsCIExyYTRIPLE Primaries; cmsFloat32Number* chr; @@ -705,13 +713,13 @@ cmsHPROFILE GetTIFFProfile(TIFF* in) if (TIFFGetField(in, TIFFTAG_ICCPROFILE, &EmbedLen, &EmbedBuffer)) { - hProfile = cmsOpenProfileFromMem(EmbedBuffer, EmbedLen); + hProfile = cmsOpenProfileFromMem(ContextID, EmbedBuffer, EmbedLen); // Print description found in the profile if (Verbose && (hProfile != NULL)) { fprintf(stdout, "\n[Embedded profile]\n"); - PrintProfileInformation(NULL, hProfile); + PrintProfileInformation(ContextID, hProfile); fflush(stdout); } @@ -747,14 +755,14 @@ cmsHPROFILE GetTIFFProfile(TIFF* in) &gmg, &gmb); - Curve[0] = cmsBuildTabulatedToneCurve16(NULL, 256, gmr); - Curve[1] = cmsBuildTabulatedToneCurve16(NULL, 256, gmg); - Curve[2] = cmsBuildTabulatedToneCurve16(NULL, 256, gmb); + Curve[0] = cmsBuildTabulatedToneCurve16(ContextID, 256, gmr); + Curve[1] = cmsBuildTabulatedToneCurve16(ContextID, 256, gmg); + Curve[2] = cmsBuildTabulatedToneCurve16(ContextID, 256, gmb); - hProfile = cmsCreateRGBProfileTHR(NULL, &WhitePoint, &Primaries, Curve); + hProfile = cmsCreateRGBProfile(ContextID, &WhitePoint, &Primaries, Curve); for (i=0; i < 3; i++) - cmsFreeToneCurve(NULL, Curve[i]); + cmsFreeToneCurve(ContextID, Curve[i]); if (Verbose) { fprintf(stdout, "\n[Colorimetric TIFF]\n"); @@ -771,7 +779,7 @@ cmsHPROFILE GetTIFFProfile(TIFF* in) // Transform one image static -int TransformImage(TIFF* in, TIFF* out, const char *cDefInpProf) +int TransformImage(cmsContext ContextID, TIFF* in, TIFF* out, const char *cDefInpProf) { cmsHPROFILE hIn, hOut, hProof, hInkLimit = NULL; cmsHTRANSFORM xform; @@ -783,7 +791,7 @@ int TransformImage(TIFF* in, TIFF* out, const char *cDefInpProf) // Observer adaptation state (only meaningful on absolute colorimetric intent) - cmsSetAdaptationState(ObserverAdaptationState); + cmsSetAdaptationState(ContextID, ObserverAdaptationState); if (EmbedProfile && cOutProf) DoEmbedProfile(out, cOutProf); @@ -811,20 +819,20 @@ int TransformImage(TIFF* in, TIFF* out, const char *cDefInpProf) if (lIsDeviceLink) { - hIn = cmsOpenProfileFromFile(cDefInpProf, "r"); + hIn = cmsOpenProfileFromFile(ContextID, cDefInpProf, "r"); } else { - hIn = GetTIFFProfile(in); + hIn = GetTIFFProfile(ContextID, in); if (hIn == NULL) - hIn = OpenStockProfile(NULL, cDefInpProf); + hIn = OpenStockProfile(ContextID, cDefInpProf); - hOut = OpenStockProfile(NULL, cOutProf); + hOut = OpenStockProfile(ContextID, cOutProf); if (cProofing != NULL) { - hProof = OpenStockProfile(NULL, cProofing); + hProof = OpenStockProfile(ContextID, cProofing); dwFlags |= cmsFLAGS_SOFTPROOFING; } } @@ -835,14 +843,14 @@ int TransformImage(TIFF* in, TIFF* out, const char *cDefInpProf) // Assure both, input profile and input TIFF are on same colorspace - if (_cmsLCMScolorSpace(NULL, cmsGetColorSpace(NULL, hIn)) != (int) T_COLORSPACE(wInput)) + if (_cmsLCMScolorSpace(ContextID, cmsGetColorSpace(ContextID, hIn)) != (int) T_COLORSPACE(wInput)) FatalError("Input profile is not operating in proper color space"); if (!lIsDeviceLink) - OutputColorSpace = _cmsLCMScolorSpace(NULL, cmsGetColorSpace(NULL, hOut)); + OutputColorSpace = _cmsLCMScolorSpace(ContextID, cmsGetColorSpace(ContextID, hOut)); else - OutputColorSpace = _cmsLCMScolorSpace(NULL, cmsGetPCS(NULL, hIn)); + OutputColorSpace = _cmsLCMScolorSpace(ContextID, cmsGetPCS(ContextID, hIn)); wOutput = ComputeOutputFormatDescriptor(wInput, OutputColorSpace, bps); @@ -857,7 +865,7 @@ int TransformImage(TIFF* in, TIFF* out, const char *cDefInpProf) int nProfiles = 0; - hInkLimit = cmsCreateInkLimitingDeviceLink(cmsGetColorSpace(NULL, hOut), InkLimit); + hInkLimit = cmsCreateInkLimitingDeviceLink(ContextID, cmsGetColorSpace(ContextID, hOut), InkLimit); hProfiles[nProfiles++] = hIn; if (hProof) { @@ -868,26 +876,26 @@ int TransformImage(TIFF* in, TIFF* out, const char *cDefInpProf) hProfiles[nProfiles++] = hOut; hProfiles[nProfiles++] = hInkLimit; - xform = cmsCreateMultiprofileTransform(hProfiles, nProfiles, + xform = cmsCreateMultiprofileTransform(ContextID, hProfiles, nProfiles, wInput, wOutput, Intent, dwFlags); } else { - xform = cmsCreateProofingTransform(hIn, wInput, + xform = cmsCreateProofingTransform(ContextID, hIn, wInput, hOut, wOutput, hProof, Intent, ProofingIntent, dwFlags); } - cmsCloseProfile(NULL, hIn); - cmsCloseProfile(NULL, hOut); + cmsCloseProfile(ContextID, hIn); + cmsCloseProfile(ContextID, hOut); if (hInkLimit) - cmsCloseProfile(NULL, hInkLimit); + cmsCloseProfile(ContextID, hInkLimit); if (hProof) - cmsCloseProfile(NULL, hProof); + cmsCloseProfile(ContextID, hProof); if (xform == NULL) return 0; @@ -901,14 +909,14 @@ int TransformImage(TIFF* in, TIFF* out, const char *cDefInpProf) // Handle tile by tile or strip by strip if (TIFFIsTiled(in)) { - TileBasedXform(xform, in, out, nPlanes); + TileBasedXform(ContextID, xform, in, out, nPlanes); } else { - StripBasedXform(xform, in, out, nPlanes); + StripBasedXform(ContextID, xform, in, out, nPlanes); } - cmsDeleteTransform(NULL, xform); + cmsDeleteTransform(ContextID, xform); TIFFWriteDirectory(out); @@ -1134,11 +1142,14 @@ void HandleSwitches(int argc, char *argv[]) int main(int argc, char* argv[]) { + cmsContext ContextID; TIFF *in, *out; - cmsPlugin(&TiffLabPlugin); + ContextID = cmsCreateContext(NULL, NULL); + + cmsPlugin(ContextID, &TiffLabPlugin); - InitUtils(NULL, "tificc"); + InitUtils(ContextID, "tificc"); HandleSwitches(argc, argv); @@ -1164,7 +1175,7 @@ int main(int argc, char* argv[]) do { - TransformImage(in, out, cInpProf); + TransformImage(ContextID, in, out, cInpProf); } while (TIFFReadDirectory(in)); @@ -1175,6 +1186,7 @@ int main(int argc, char* argv[]) TIFFClose(in); TIFFClose(out); + cmsDeleteContext(ContextID); + return 0; } - diff --git a/lcms2mt/utils/transicc/Makefile.am b/lcms2mt/utils/transicc/Makefile.am index 7f033c6c..9078250a 100644 --- a/lcms2mt/utils/transicc/Makefile.am +++ b/lcms2mt/utils/transicc/Makefile.am @@ -11,9 +11,9 @@ AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include \ bin_PROGRAMS = transicc -transicc_LDADD = $(top_builddir)/src/liblcms2.la @LCMS_LIB_DEPLIBS@ +transicc_LDADD = $(top_builddir)/src/liblcms2mt.la @LCMS_LIB_DEPLIBS@ transicc_LDFLAGS = @LDFLAGS@ transicc_SOURCES = transicc.c ../common/xgetopt.c ../common/vprf.c ../common/utils.h -transicc_MANS = transicc.1 +man_MANS = transicc.1 EXTRA_DIST = $(man_MANS) diff --git a/lcms2mt/utils/transicc/Makefile.in b/lcms2mt/utils/transicc/Makefile.in index ce93e538..c4032bc2 100644 --- a/lcms2mt/utils/transicc/Makefile.in +++ b/lcms2mt/utils/transicc/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -111,13 +111,13 @@ DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = -am__installdirs = "$(DESTDIR)$(bindir)" +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" PROGRAMS = $(bin_PROGRAMS) am__dirstamp = $(am__leading_dot)dirstamp am_transicc_OBJECTS = transicc.$(OBJEXT) ../common/xgetopt.$(OBJEXT) \ ../common/vprf.$(OBJEXT) transicc_OBJECTS = $(am_transicc_OBJECTS) -transicc_DEPENDENCIES = $(top_builddir)/src/liblcms2.la +transicc_DEPENDENCIES = $(top_builddir)/src/liblcms2mt.la AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent @@ -139,7 +139,7 @@ am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = -am__depfiles_maybe = +am__maybe_remake_depfiles = COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ @@ -165,6 +165,36 @@ am__can_run_installinfo = \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +man1dir = $(mandir)/man1 +NROFF = nroff +MANS = $(man_MANS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is @@ -332,10 +362,10 @@ AUTOMAKE_OPTIONS = 1.7 foreign no-dependencies AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include \ -I$(top_srcdir)/utils/common -I$(top_builddir)/utils/common -transicc_LDADD = $(top_builddir)/src/liblcms2.la +transicc_LDADD = $(top_builddir)/src/liblcms2mt.la @LCMS_LIB_DEPLIBS@ transicc_LDFLAGS = @LDFLAGS@ transicc_SOURCES = transicc.c ../common/xgetopt.c ../common/vprf.c ../common/utils.h -transicc_MANS = transicc.1 +man_MANS = transicc.1 EXTRA_DIST = $(man_MANS) all: all-am @@ -358,8 +388,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -450,6 +480,49 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs +install-man1: $(man_MANS) + @$(NORMAL_INSTALL) + @list1=''; \ + list2='$(man_MANS)'; \ + test -n "$(man1dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.1[a-z]*$$/p'; \ + fi; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ + done; } + +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man1dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.1[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique @@ -503,7 +576,10 @@ cscopelist-am: $(am__tagged_files) distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -535,9 +611,9 @@ distdir: $(DISTFILES) done check-am: all-am check: check-am -all-am: Makefile $(PROGRAMS) +all-am: Makefile $(PROGRAMS) $(MANS) installdirs: - for dir in "$(DESTDIR)$(bindir)"; do \ + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am @@ -592,7 +668,7 @@ info: info-am info-am: -install-data-am: +install-data-am: install-man install-dvi: install-dvi-am @@ -608,7 +684,7 @@ install-info: install-info-am install-info-am: -install-man: +install-man: install-man1 install-pdf: install-pdf-am @@ -637,7 +713,9 @@ ps: ps-am ps-am: -uninstall-am: uninstall-binPROGRAMS +uninstall-am: uninstall-binPROGRAMS uninstall-man + +uninstall-man: uninstall-man1 .MAKE: install-am install-strip @@ -648,12 +726,13 @@ uninstall-am: uninstall-binPROGRAMS html-am info info-am install install-am install-binPROGRAMS \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags tags-am uninstall uninstall-am uninstall-binPROGRAMS + install-info install-info-am install-man install-man1 \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ + uninstall-binPROGRAMS uninstall-man uninstall-man1 .PRECIOUS: Makefile diff --git a/lcms2mt/utils/transicc/transicc.c b/lcms2mt/utils/transicc/transicc.c index 4bd1b5bd..a92e3e18 100644 --- a/lcms2mt/utils/transicc/transicc.c +++ b/lcms2mt/utils/transicc/transicc.c @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2017 Marti Maria Saguer +// Copyright (c) 1998-2020 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), |