Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(352)

Side by Side Diff: third_party/qcms/src/transform_util.c

Issue 2815303003: [qcms] Disable advisory asserts when running in libfuzzer (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/qcms/src/transform.c ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // qcms 1 // qcms
2 // Copyright (C) 2009 Mozilla Foundation 2 // Copyright (C) 2009 Mozilla Foundation
3 // 3 //
4 // Permission is hereby granted, free of charge, to any person obtaining 4 // Permission is hereby granted, free of charge, to any person obtaining
5 // a copy of this software and associated documentation files (the "Software"), 5 // a copy of this software and associated documentation files (the "Software"),
6 // to deal in the Software without restriction, including without limitation 6 // to deal in the Software without restriction, including without limitation
7 // the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 // and/or sell copies of the Software, and to permit persons to whom the Softwar e 8 // and/or sell copies of the Software, and to permit persons to whom the Softwar e
9 // is furnished to do so, subject to the following conditions: 9 // is furnished to do so, subject to the following conditions:
10 // 10 //
(...skipping 14 matching lines...) Expand all
25 #include <assert.h> 25 #include <assert.h>
26 #include <string.h> //memcpy 26 #include <string.h> //memcpy
27 #include "qcmsint.h" 27 #include "qcmsint.h"
28 #include "transform_util.h" 28 #include "transform_util.h"
29 #include "matrix.h" 29 #include "matrix.h"
30 30
31 #if !defined(INFINITY) 31 #if !defined(INFINITY)
32 #define INFINITY HUGE_VAL 32 #define INFINITY HUGE_VAL
33 #endif 33 #endif
34 34
35 #ifdef USE_LIBFUZZER
36 #define ASSERT(x)
37 #else
38 #define ASSERT(x) assert(x)
39 #endif
40
35 #define PARAMETRIC_CURVE_TYPE 0x70617261 //'para' 41 #define PARAMETRIC_CURVE_TYPE 0x70617261 //'para'
36 42
37 /* value must be a value between 0 and 1 */ 43 /* value must be a value between 0 and 1 */
38 //XXX: is the above a good restriction to have? 44 //XXX: is the above a good restriction to have?
39 // the output range of this function is 0..1 45 // the output range of this function is 0..1
40 float lut_interp_linear(double input_value, uint16_t *table, size_t length) 46 float lut_interp_linear(double input_value, uint16_t *table, size_t length)
41 { 47 {
42 int upper, lower; 48 int upper, lower;
43 float value; 49 float value;
44 input_value = input_value * (length - 1); // scale to length of the arra y 50 input_value = input_value * (length - 1); // scale to length of the arra y
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 f = 0; 181 f = 0;
176 interval = parameter[4]; 182 interval = parameter[4];
177 } else if(count == 4) { 183 } else if(count == 4) {
178 a = parameter[1]; 184 a = parameter[1];
179 b = parameter[2]; 185 b = parameter[2];
180 c = parameter[3]; 186 c = parameter[3];
181 e = parameter[5] - c; 187 e = parameter[5] - c;
182 f = parameter[6]; 188 f = parameter[6];
183 interval = parameter[4]; 189 interval = parameter[4];
184 } else { 190 } else {
185 assert(0 && "invalid parametric function type."); 191 ASSERT(0 && "invalid parametric function type.");
186 a = 1; 192 a = 1;
187 b = 0; 193 b = 0;
188 c = 0; 194 c = 0;
189 e = 0; 195 e = 0;
190 f = 0; 196 f = 0;
191 interval = -INFINITY; 197 interval = -INFINITY;
192 } 198 }
193 for (X = 0; X < 256; X++) { 199 for (X = 0; X < 256; X++) {
194 float x = X / 255.0; 200 float x = X / 255.0;
195 if (x >= interval) { 201 if (x >= interval) {
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 if (!curve || curve->type != PARAMETRIC_CURVE_TYPE) 670 if (!curve || curve->type != PARAMETRIC_CURVE_TYPE)
665 return 0; 671 return 0;
666 672
667 size = COUNT_TO_LENGTH[curve->count]; 673 size = COUNT_TO_LENGTH[curve->count];
668 674
669 if (data) 675 if (data)
670 memcpy(data, curve->parameter, size * sizeof(float)); 676 memcpy(data, curve->parameter, size * sizeof(float));
671 677
672 return size; 678 return size;
673 } 679 }
OLDNEW
« no previous file with comments | « third_party/qcms/src/transform.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698