OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the Chromium LICENSE file. | 3 // found in the Chromium LICENSE file. |
4 | 4 |
5 #include "qcms.h" | 5 #include "qcms.h" |
6 #include "qcms_test_util.h" | 6 #include "qcms_test_util.h" |
7 #include "timing.h" | 7 #include "timing.h" |
8 | 8 |
9 #include <math.h> | 9 #include <math.h> |
10 #include <stdio.h> | 10 #include <stdio.h> |
11 #include <stdlib.h> | 11 #include <stdlib.h> |
12 #include <string.h> | 12 #include <string.h> |
13 | 13 |
14 // Manually update the items below to add more tests. | 14 // Manually update the items below to add more tests. |
15 extern struct qcms_test_case qcms_test_tetra_clut_rgba_info; | 15 extern struct qcms_test_case qcms_test_tetra_clut_rgba_info; |
16 extern struct qcms_test_case qcms_test_munsell_info; | 16 extern struct qcms_test_case qcms_test_munsell_info; |
17 extern struct qcms_test_case qcms_test_internal_srgb_info; | 17 extern struct qcms_test_case qcms_test_internal_srgb_info; |
18 extern struct qcms_test_case qcms_test_ntsc_gamut_info; | 18 extern struct qcms_test_case qcms_test_ntsc_gamut_info; |
| 19 extern struct qcms_test_case qcms_test_output_trc_info; |
19 | 20 |
20 struct qcms_test_case qcms_test[4]; | 21 struct qcms_test_case qcms_test[5]; |
21 #define TEST_CASES (sizeof(qcms_test) / sizeof(qcms_test[0])) | 22 #define TEST_CASES (sizeof(qcms_test) / sizeof(qcms_test[0])) |
22 | 23 |
23 static void initialize_tests() | 24 static void initialize_tests() |
24 { | 25 { |
25 qcms_test[0] = qcms_test_tetra_clut_rgba_info; | 26 qcms_test[0] = qcms_test_tetra_clut_rgba_info; |
26 qcms_test[1] = qcms_test_munsell_info; | 27 qcms_test[1] = qcms_test_munsell_info; |
27 qcms_test[2] = qcms_test_internal_srgb_info; | 28 qcms_test[2] = qcms_test_internal_srgb_info; |
28 qcms_test[3] = qcms_test_ntsc_gamut_info; | 29 qcms_test[3] = qcms_test_ntsc_gamut_info; |
| 30 qcms_test[4] = qcms_test_output_trc_info; |
29 } | 31 } |
30 | 32 |
31 static void list_tests() | 33 static void list_tests() |
32 { | 34 { |
33 int i; | 35 int i; |
34 printf("Available qcms tests:\n"); | 36 printf("Available qcms tests:\n"); |
35 | 37 |
36 for (i = 0; i < TEST_CASES; ++i) { | 38 for (i = 0; i < TEST_CASES; ++i) { |
37 printf("\t%s\n", qcms_test[i].test_name); | 39 printf("\t%s\n", qcms_test[i].test_name); |
38 } | 40 } |
39 | 41 |
40 exit(EXIT_FAILURE); | 42 exit(EXIT_FAILURE); |
41 } | 43 } |
42 | 44 |
43 static void print_usage() | 45 static void print_usage() |
44 { | 46 { |
45 printf("Usage:\n\tqcms_test -w WIDTH -h HEIGHT -n ITERATIONS -t TEST\n"); | 47 printf("Usage:\n\tqcms_test -w WIDTH -h HEIGHT -n ITERATIONS -t TEST\n"); |
(...skipping 20 matching lines...) Expand all Loading... |
66 for (i = 0; i < TEST_CASES; ++i) { | 68 for (i = 0; i < TEST_CASES; ++i) { |
67 if (strcmp(qcms_test[i].test_name, args) == 0) { | 69 if (strcmp(qcms_test[i].test_name, args) == 0) { |
68 qcms_test[i].status = QCMS_TEST_ENABLED; | 70 qcms_test[i].status = QCMS_TEST_ENABLED; |
69 return 1; | 71 return 1; |
70 } | 72 } |
71 } | 73 } |
72 | 74 |
73 return 0; | 75 return 0; |
74 } | 76 } |
75 | 77 |
76 void generate_source_uint8_t(unsigned char *src, const size_t length, const size
_t pixel_size) | |
77 { | |
78 size_t bytes = length * pixel_size; | |
79 size_t i; | |
80 | |
81 for (i = 0; i < bytes; ++i) { | |
82 *src++ = rand() & 255; | |
83 } | |
84 } | |
85 | |
86 int main(int argc, const char **argv) | 78 int main(int argc, const char **argv) |
87 { | 79 { |
88 int iterations = 1; | 80 int iterations = 1; |
89 size_t height = 2000; | 81 size_t height = 2000; |
90 size_t width = 2000; | 82 size_t width = 2000; |
91 int run_all = 0; | 83 int run_all = 0; |
92 const char *in = NULL, *out = NULL; | 84 const char *in = NULL, *out = NULL; |
93 int force_software = 0; | 85 int force_software = 0; |
94 int exit_status; | 86 int exit_status; |
95 int enabled_tests = 0; | 87 int enabled_tests = 0; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 122 |
131 exit_status = 0; | 123 exit_status = 0; |
132 | 124 |
133 for (i = 0; i < TEST_CASES; ++i) { | 125 for (i = 0; i < TEST_CASES; ++i) { |
134 if (run_all || QCMS_TEST_ENABLED == qcms_test[i].status) | 126 if (run_all || QCMS_TEST_ENABLED == qcms_test[i].status) |
135 exit_status += qcms_test[i].test_fn(width, height, iterations, in, o
ut, force_software); | 127 exit_status += qcms_test[i].test_fn(width, height, iterations, in, o
ut, force_software); |
136 } | 128 } |
137 | 129 |
138 return exit_status; | 130 return exit_status; |
139 } | 131 } |
OLD | NEW |