Warning, /graphics/krita/3rdparty/ext_lcms2/0003-Revert-Fix-LUT-based-optimization-on-8-bits.patch is written in an unsupported language. File is not indexed.
0001 From 592d81225a0e1689b11cd15fa8b3a239ca6685ff Mon Sep 17 00:00:00 2001
0002 From: "L. E. Segovia" <amy@amyspark.me>
0003 Date: Mon, 28 Nov 2022 18:56:57 -0300
0004 Subject: [PATCH] Revert "Fix LUT based optimization on 8 bits"
0005
0006 This reverts commit d24a40c9cc685b7145e8082606d5d9384d08e472.
0007 ---
0008 plugins/fast_float/src/fast_8_tethra.c | 6 +-
0009 plugins/fast_float/testbed/demo_cmyk.c | 151 -------------------------
0010 2 files changed, 5 insertions(+), 152 deletions(-)
0011 delete mode 100644 plugins/fast_float/testbed/demo_cmyk.c
0012
0013 diff --git a/plugins/fast_float/src/fast_8_tethra.c b/plugins/fast_float/src/fast_8_tethra.c
0014 index 84c36a0..7f72184 100644
0015 --- a/plugins/fast_float/src/fast_8_tethra.c
0016 +++ b/plugins/fast_float/src/fast_8_tethra.c
0017 @@ -414,7 +414,11 @@ cmsBool Optimize8BitRGBTransform(_cmsTransform2Fn* TransformFn,
0018 // Check for validity
0019 lIsSuitable = TRUE;
0020 for (t=0; (lIsSuitable && (t < 3)); t++) {
0021 -
0022 +
0023 + // Exclude if non-monotonic
0024 + if (!cmsIsToneCurveMonotonic(Trans[t]))
0025 + lIsSuitable = FALSE;
0026 +
0027 if (IsDegenerated(Trans[t]))
0028 lIsSuitable = FALSE;
0029 }
0030 diff --git a/plugins/fast_float/testbed/demo_cmyk.c b/plugins/fast_float/testbed/demo_cmyk.c
0031 deleted file mode 100644
0032 index d41f3f5..0000000
0033 --- a/plugins/fast_float/testbed/demo_cmyk.c
0034 +++ /dev/null
0035 @@ -1,151 +0,0 @@
0036 -//---------------------------------------------------------------------------------
0037 -//
0038 -// Little Color Management System, fast floating point extensions
0039 -// Copyright (c) 1998-2022 Marti Maria Saguer, all rights reserved
0040 -//
0041 -//
0042 -// This program is free software: you can redistribute it and/or modify
0043 -// it under the terms of the GNU General Public License as published by
0044 -// the Free Software Foundation, either version 3 of the License, or
0045 -// (at your option) any later version.
0046 -//
0047 -// This program is distributed in the hope that it will be useful,
0048 -// but WITHOUT ANY WARRANTY; without even the implied warranty of
0049 -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0050 -// GNU General Public License for more details.
0051 -//
0052 -// You should have received a copy of the GNU General Public License
0053 -// along with this program. If not, see <http://www.gnu.org/licenses/>.
0054 -//
0055 -//---------------------------------------------------------------------------------
0056 -
0057 -#include "lcms2_fast_float.h"
0058 -
0059 -#include <stdlib.h>
0060 -#include <memory.h>
0061 -
0062 -static
0063 -void Fail(const char* frm, ...)
0064 -{
0065 - va_list args;
0066 -
0067 - va_start(args, frm);
0068 - vprintf(frm, args);
0069 - va_end(args);
0070 - exit(1);
0071 -}
0072 -
0073 -
0074 -
0075 -#define ALIGNED_SIZE(a,x) (((x)+((a) - 1)) & ~((a) - 1))
0076 -
0077 -
0078 -static
0079 -void* make_image(size_t size_x, size_t size_y, cmsBool fill_rgb, cmsUInt32Number* stride_x)
0080 -{
0081 - cmsUInt32Number size_x_aligned = ALIGNED_SIZE(16, size_x);
0082 - cmsUInt32Number line_size_in_bytes = size_x_aligned * sizeof(cmsUInt32Number); // RGBA
0083 -
0084 - cmsUInt8Number* ptr_image = (cmsUInt8Number*) calloc(size_y, line_size_in_bytes);
0085 -
0086 - if (ptr_image == NULL) Fail("Couldn't allocate memory for image");
0087 -
0088 - if (fill_rgb)
0089 - {
0090 - size_t line;
0091 -
0092 - for (line = 0; line < size_y; line++)
0093 - {
0094 - cmsUInt32Number* ptr_line = (cmsUInt32Number*)(ptr_image + line_size_in_bytes * line);
0095 - cmsUInt32Number argb = 0;
0096 - int col;
0097 -
0098 - for (col = 0; col < size_x; col++)
0099 - *ptr_line++ = argb++;
0100 -
0101 - }
0102 - }
0103 -
0104 - *stride_x = line_size_in_bytes;
0105 - return (void*) ptr_image;
0106 -}
0107 -
0108 -#define SIZE_X 10000
0109 -#define SIZE_Y 10000
0110 -
0111 -static
0112 -cmsFloat64Number MPixSec(cmsFloat64Number diff)
0113 -{
0114 - cmsFloat64Number seconds = (cmsFloat64Number)diff / (cmsFloat64Number)CLOCKS_PER_SEC;
0115 - return (SIZE_X * SIZE_Y) / (1024.0 * 1024.0 * seconds);
0116 -}
0117 -
0118 -
0119 -
0120 -static
0121 -cmsFloat64Number speed_test(void)
0122 -{
0123 - clock_t atime;
0124 - cmsFloat64Number diff;
0125 - cmsHPROFILE hProfileIn;
0126 - cmsHPROFILE hProfileOut;
0127 - cmsHTRANSFORM xform;
0128 - void* image_in;
0129 - void* image_out;
0130 - cmsUInt32Number stride_rgb_x, stride_cmyk_x;
0131 -
0132 -
0133 - hProfileIn = cmsOpenProfileFromFile("sRGB Color Space Profile.icm", "r");
0134 - hProfileOut = cmsOpenProfileFromFile("USWebCoatedSWOP.icc", "r");
0135 -
0136 - if (hProfileIn == NULL || hProfileOut == NULL)
0137 - Fail("Unable to open profiles");
0138 -
0139 - xform = cmsCreateTransform(hProfileIn, TYPE_RGBA_8, hProfileOut, TYPE_CMYK_8, INTENT_PERCEPTUAL, 0);
0140 - cmsCloseProfile(hProfileIn);
0141 - cmsCloseProfile(hProfileOut);
0142 -
0143 -
0144 - image_in = make_image(SIZE_X, SIZE_Y, TRUE, &stride_rgb_x);
0145 - image_out = make_image(SIZE_X, SIZE_Y, FALSE, &stride_cmyk_x);
0146 -
0147 - atime = clock();
0148 -
0149 - cmsDoTransformLineStride(xform, image_in, image_out, SIZE_X, SIZE_Y, stride_rgb_x, stride_cmyk_x, 0, 0);
0150 -
0151 - diff = clock() - atime;
0152 -
0153 - free(image_in);
0154 - free(image_out);
0155 -
0156 - cmsDeleteTransform(xform);
0157 - return MPixSec(diff);
0158 -}
0159 -
0160 -
0161 -int main(void)
0162 -{
0163 - cmsFloat64Number without_plugin;
0164 - cmsFloat64Number with_plugin;
0165 -
0166 - fprintf(stdout, "DEMO of littleCMS fast float plugin: RGBA -> CMYK in Megapixels per second\n"); fflush(stdout);
0167 -
0168 - // filling cache
0169 - fprintf(stdout, "Wait CPU cache to stabilize: "); fflush(stdout);
0170 - speed_test();
0171 - fprintf(stdout, "Ok\n");
0172 -
0173 - fprintf(stdout, "Without plugin: "); fflush(stdout);
0174 - without_plugin = speed_test();
0175 - fprintf(stdout, "%.2f\n", without_plugin); fflush(stdout);
0176 -
0177 - cmsPlugin(cmsFastFloatExtensions());
0178 -
0179 - fprintf(stdout, "With plugin: "); fflush(stdout);
0180 - with_plugin = speed_test();
0181 - fprintf(stdout, "%.2f\n", with_plugin); fflush(stdout);
0182 -
0183 - fprintf(stdout, "x %2.2f\n", (with_plugin/without_plugin)); fflush(stdout);
0184 -
0185 - return 0;
0186 -}
0187 \ No newline at end of file
0188 --
0189 2.37.1.windows.1
0190