diff options
Diffstat (limited to 'lcms2mt/src')
30 files changed, 1414 insertions, 1404 deletions
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 |