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; | |
20 | 19 |
21 struct qcms_test_case qcms_test[5]; | 20 struct qcms_test_case qcms_test[4]; |
22 #define TEST_CASES (sizeof(qcms_test) / sizeof(qcms_test[0])) | 21 #define TEST_CASES (sizeof(qcms_test) / sizeof(qcms_test[0])) |
23 | 22 |
24 static void initialize_tests() | 23 static void initialize_tests() |
25 { | 24 { |
26 qcms_test[0] = qcms_test_tetra_clut_rgba_info; | 25 qcms_test[0] = qcms_test_tetra_clut_rgba_info; |
27 qcms_test[1] = qcms_test_munsell_info; | 26 qcms_test[1] = qcms_test_munsell_info; |
28 qcms_test[2] = qcms_test_internal_srgb_info; | 27 qcms_test[2] = qcms_test_internal_srgb_info; |
29 qcms_test[3] = qcms_test_ntsc_gamut_info; | 28 qcms_test[3] = qcms_test_ntsc_gamut_info; |
30 qcms_test[4] = qcms_test_output_trc_info; | |
31 } | 29 } |
32 | 30 |
33 static void list_tests() | 31 static void list_tests() |
34 { | 32 { |
35 int i; | 33 int i; |
36 printf("Available qcms tests:\n"); | 34 printf("Available qcms tests:\n"); |
37 | 35 |
38 for (i = 0; i < TEST_CASES; ++i) { | 36 for (i = 0; i < TEST_CASES; ++i) { |
39 printf("\t%s\n", qcms_test[i].test_name); | 37 printf("\t%s\n", qcms_test[i].test_name); |
40 } | 38 } |
41 | 39 |
42 exit(EXIT_FAILURE); | 40 exit(EXIT_FAILURE); |
43 } | 41 } |
44 | 42 |
45 static void print_usage() | 43 static void print_usage() |
46 { | 44 { |
47 printf("Usage:\n\tqcms_test -w WIDTH -h HEIGHT -n ITERATIONS -t TEST\n"); | 45 printf("Usage:\n\tqcms_test -w WIDTH -h HEIGHT -n ITERATIONS -t TEST\n"); |
(...skipping 20 matching lines...) Expand all Loading... |
68 for (i = 0; i < TEST_CASES; ++i) { | 66 for (i = 0; i < TEST_CASES; ++i) { |
69 if (strcmp(qcms_test[i].test_name, args) == 0) { | 67 if (strcmp(qcms_test[i].test_name, args) == 0) { |
70 qcms_test[i].status = QCMS_TEST_ENABLED; | 68 qcms_test[i].status = QCMS_TEST_ENABLED; |
71 return 1; | 69 return 1; |
72 } | 70 } |
73 } | 71 } |
74 | 72 |
75 return 0; | 73 return 0; |
76 } | 74 } |
77 | 75 |
| 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 |
78 int main(int argc, const char **argv) | 86 int main(int argc, const char **argv) |
79 { | 87 { |
80 int iterations = 1; | 88 int iterations = 1; |
81 size_t height = 2000; | 89 size_t height = 2000; |
82 size_t width = 2000; | 90 size_t width = 2000; |
83 int run_all = 0; | 91 int run_all = 0; |
84 const char *in = NULL, *out = NULL; | 92 const char *in = NULL, *out = NULL; |
85 int force_software = 0; | 93 int force_software = 0; |
86 int exit_status; | 94 int exit_status; |
87 int enabled_tests = 0; | 95 int enabled_tests = 0; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 | 130 |
123 exit_status = 0; | 131 exit_status = 0; |
124 | 132 |
125 for (i = 0; i < TEST_CASES; ++i) { | 133 for (i = 0; i < TEST_CASES; ++i) { |
126 if (run_all || QCMS_TEST_ENABLED == qcms_test[i].status) | 134 if (run_all || QCMS_TEST_ENABLED == qcms_test[i].status) |
127 exit_status += qcms_test[i].test_fn(width, height, iterations, in, o
ut, force_software); | 135 exit_status += qcms_test[i].test_fn(width, height, iterations, in, o
ut, force_software); |
128 } | 136 } |
129 | 137 |
130 return exit_status; | 138 return exit_status; |
131 } | 139 } |
OLD | NEW |