aboutsummaryrefslogtreecommitdiffstats
path: root/community/lcms/remove-linear-interpol-test.patch
diff options
context:
space:
mode:
Diffstat (limited to 'community/lcms/remove-linear-interpol-test.patch')
-rw-r--r--community/lcms/remove-linear-interpol-test.patch279
1 files changed, 279 insertions, 0 deletions
diff --git a/community/lcms/remove-linear-interpol-test.patch b/community/lcms/remove-linear-interpol-test.patch
new file mode 100644
index 0000000000..3e93e6946d
--- /dev/null
+++ b/community/lcms/remove-linear-interpol-test.patch
@@ -0,0 +1,279 @@
+diff --git a/testbed/testcms.c b/testbed/testcms.c
+index 98ec153..1f3f162 100755
+--- a/testbed/testcms.c
++++ b/testbed/testcms.c
+@@ -329,266 +329,6 @@ int TestReversingOfCurves(void)
+ // Tables are supposed to be monotonic, but the algorithm works on
+ // non-monotonic as well.
+
+-static
+-int TestLinearInterpolation(int lExhaustive)
+-{
+- static WORD Tab[4098];
+- int j, i, k = 0;
+- L16PARAMS p;
+- int n;
+- clock_t time;
+-
+- printf("Testing linear interpolation ...");
+-
+- // First I will check exact values. Since prime factors of 65535 (FFFF) are,
+- //
+- // 0xFFFF = 1 * 3 * 5 * 17 * 257
+- //
+- // I test tables of 2, 4, 6, and 18 points, that will be exact.
+- // Then, a table of 3 elements are tested. Error must be < 1
+- // Since no floating point is involved, This will be a measure of speed.
+-
+-
+- // Perform 10 times, so i can measure average times
+-
+- time = clock();
+- for (j=0; j < 10; j++)
+- {
+-
+- // 2 points - exact
+-
+- Tab[0] = 0;
+- Tab[1] = 0xffffU;
+-
+- cmsCalcL16Params(2, &p);
+-
+- for (i=0; i <= 0xffffL; i++)
+- {
+- n = cmsLinearInterpLUT16((WORD) i, Tab, &p);
+- if (n != i)
+- {
+- printf("Error in Linear interpolation (2p): Must be i=%x, But is n=%x\n", i, n);
+- return 0;
+- }
+-
+- }
+-
+-
+- // 3 points - Here the error must be <= 1, since
+- // 2 == (3 - 1) is not a factor of 0xffff
+-
+- Tab[0] = 0;
+- Tab[1] = 0x7FFF;
+- Tab[2] = 0xffffU;
+-
+- cmsCalcL16Params(3, &p);
+-
+- for (i=0; i <= 0xffffL; i++)
+- {
+- n = cmsLinearInterpLUT16((WORD) i, Tab, &p);
+- if (abs(n - i) > 1)
+- {
+- printf("Error in Linear interpolation (3p): Must be i=%x, But is n=%x\n", i, n);
+- return 0;
+- }
+-
+- }
+-
+-
+- // 4 points - exact
+-
+- Tab[0] = 0;
+- Tab[1] = 0x5555U;
+- Tab[2] = 0xAAAAU;
+- Tab[3] = 0xffffU;
+-
+- cmsCalcL16Params(4, &p);
+-
+- for (i=0; i <= 0xffffL; i++)
+- {
+- n = cmsLinearInterpLUT16((WORD) i, Tab, &p);
+- if (n != i) {
+- printf("Error in Linear interpolation (4p): Must be i=%x, But is n=%x\n", i, n);
+- return 0;
+- }
+-
+- }
+-
+-
+- // 6 - points
+-
+- Tab[0] = 0;
+- Tab[1] = 0x3333U;
+- Tab[2] = 0x6666U;
+- Tab[3] = 0x9999U;
+- Tab[4] = 0xCCCCU;
+- Tab[5] = 0xFFFFU;
+-
+- cmsCalcL16Params(6, &p);
+-
+- for (i=0; i <= 0xffffL; i++)
+- {
+- n = cmsLinearInterpLUT16((WORD) i, Tab, &p);
+- if (n != i) {
+- printf("Error in Linear interpolation (6p): Must be i=%x, But is n=%x\n", i, n);
+- return 0;
+- }
+-
+- }
+-
+-
+- // 18 points
+-
+- for (i=0; i < 18; i++)
+- Tab[i] = (WORD) (0x0f0fU*i);
+-
+- cmsCalcL16Params(18, &p);
+-
+- for (i=0; i <= 0xffffL; i++)
+- {
+- n = cmsLinearInterpLUT16((WORD) i, Tab, &p);
+- if (n != i) {
+- printf("Error in Linear interpolation (18p): Must be i=%x, But is n=%x\n", i, n);
+- return 0;
+- }
+- }
+- }
+-
+-
+-
+- printf("pass. (%d tics)\n", (int) (clock() - time));
+-
+- // Now test descending tables
+- printf("Testing descending tables (linear interpolation)...");
+-
+- // 2 points - exact
+-
+- Tab[1] = 0;
+- Tab[0] = 0xffffU;
+-
+- cmsCalcL16Params(2, &p);
+-
+- for (i=0xffffL; i > 0; --i)
+- {
+- n = cmsLinearInterpLUT16((WORD) i, Tab, &p);
+- if ((0xffffL - n) != i) {
+-
+- printf("Error in Linear interpolation (descending) (2p): Must be i=%x, But is n=%x\n", i, 0xffff - n);
+- return 0;
+- }
+- }
+-
+-
+- // 3 points - Here the error must be <= 1, since
+- // 2 = (3 - 1) is not a factor of 0xffff
+-
+- Tab[2] = 0;
+- Tab[1] = 0x7FFF;
+- Tab[0] = 0xffffU;
+-
+- cmsCalcL16Params(3, &p);
+-
+- for (i=0xffffL; i > 0; --i)
+- {
+- n = cmsLinearInterpLUT16((WORD) i, Tab, &p);
+- if (abs((0xffffL - n) - i) > 1) {
+-
+- printf("Error in Linear interpolation (descending) (3p): Must be i=%x, But is n=%x\n", i, n);
+- return 0;
+- }
+- }
+-
+-
+- // 4 points - exact
+-
+- Tab[3] = 0;
+- Tab[2] = 0x5555U;
+- Tab[1] = 0xAAAAU;
+- Tab[0] = 0xffffU;
+-
+- cmsCalcL16Params(4, &p);
+-
+- for (i=0xffffL; i > 0; --i)
+- {
+- n = cmsLinearInterpLUT16((WORD) i, Tab, &p);
+- if ((0xffffL - n) != i) {
+-
+- printf("Error in Linear interpolation (descending) (4p): Must be i=%x, But is n=%x\n", i, n);
+- return 0;
+- }
+- }
+-
+-
+- // 6 - points
+-
+- Tab[5] = 0;
+- Tab[4] = 0x3333U;
+- Tab[3] = 0x6666U;
+- Tab[2] = 0x9999U;
+- Tab[1] = 0xCCCCU;
+- Tab[0] = 0xFFFFU;
+-
+- cmsCalcL16Params(6, &p);
+-
+- for (i=0xffffL; i > 0; --i)
+- {
+- n = cmsLinearInterpLUT16((WORD) i, Tab, &p);
+- if ((0xffffL - n) != i) {
+- printf("Error in Linear interpolation (descending) (6p): Must be i=%x, But is n=%x\n", i, n);
+- return 0;
+- }
+-
+- }
+-
+-
+- // 18 points
+-
+- for (i=0; i < 18; i++)
+- Tab[17-i] = (WORD) (0x0f0fU*i);
+-
+- cmsCalcL16Params(18, &p);
+-
+- for (i=0xffffL; i > 0; --i)
+- {
+- n = cmsLinearInterpLUT16((WORD) i, Tab, &p);
+- if ((0xffffL - n) != i) {
+-
+- printf("Error in Linear interpolation (descending) (18p): Must be i=%x, But is n=%x\n", i, n);
+- return 0;
+- }
+- }
+-
+- printf("pass.\n");
+-
+- if (!lExhaustive) return 1;
+-
+- printf("Now, testing interpolation errors for tables of n elements ...\n");
+-
+- for (j=10; j < 4096; j ++)
+- {
+- if ((j % 10) == 0) printf("%d\r", j);
+-
+- for (i=0; i <= j; i++)
+- {
+- Tab[i] = (WORD) floor((((double) i / ((double) j-1)) * 65535.0) + .5);
+- }
+-
+- k =0;
+- cmsCalcL16Params(j, &p);
+- for (i=0; i <= 0xffffL; i++)
+- {
+- n = cmsLinearInterpLUT16((WORD) i, Tab, &p);
+- if (n != i) k++;
+-
+- }
+-
+- }
+- printf("\n%d: %d errors\n\n", j, k);
+- return 1;
+-}
+-
+-
+-
+ static
+ int IsGood(const char *frm, WORD in, WORD out)
+ {
+@@ -2318,7 +2058,6 @@ int main(int argc, char *argv[])
+ if (!TestFixedScaling()) return 1;
+ if (!TestJointCurves()) return 1;
+ if (!TestReversingOfCurves()) return 1;
+- if (!TestLinearInterpolation(lExhaustive)) return 1;
+ if (!TestReverseLinearInterpolation()) return 1;
+
+