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

Side by Side Diff: third_party/qcms/google.patch

Issue 1138473002: qcms: Limit vcgt table to a maximum of 1024 entries (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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/README.chromium ('k') | third_party/qcms/src/iccread.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 diff --git a/third_party/qcms/src/iccread.c b/third_party/qcms/src/iccread.c 1 diff --git a/third_party/qcms/src/iccread.c b/third_party/qcms/src/iccread.c
2 index 36b7011..18b286d 100644 2 index 36b7011..0deab10 100644
3 --- a/third_party/qcms/src/iccread.c 3 --- a/third_party/qcms/src/iccread.c
4 +++ b/third_party/qcms/src/iccread.c 4 +++ b/third_party/qcms/src/iccread.c
5 @@ -266,7 +266,7 @@ qcms_bool qcms_profile_is_bogus(qcms_profile *profile) 5 @@ -266,7 +266,7 @@ qcms_bool qcms_profile_is_bogus(qcms_profile *profile)
6 if (profile->color_space != RGB_SIGNATURE) 6 if (profile->color_space != RGB_SIGNATURE)
7 return false; 7 return false;
8 8
9 - if (profile->A2B0 || profile->B2A0) 9 - if (profile->A2B0 || profile->B2A0)
10 + if (qcms_supports_iccv4 && (profile->A2B0 || profile->B2A0)) 10 + if (qcms_supports_iccv4 && (profile->A2B0 || profile->B2A0))
11 return false; 11 return false;
12 12
(...skipping 23 matching lines...) Expand all
36 if (!(((sum[i] - tolerance[i]) <= target[i]) && 36 if (!(((sum[i] - tolerance[i]) <= target[i]) &&
37 @@ -331,6 +340,8 @@ qcms_bool qcms_profile_is_bogus(qcms_profile *profile) 37 @@ -331,6 +340,8 @@ qcms_bool qcms_profile_is_bogus(qcms_profile *profile)
38 #define TAG_A2B0 0x41324230 38 #define TAG_A2B0 0x41324230
39 #define TAG_B2A0 0x42324130 39 #define TAG_B2A0 0x42324130
40 #define TAG_CHAD 0x63686164 40 #define TAG_CHAD 0x63686164
41 +#define TAG_desc 0x64657363 41 +#define TAG_desc 0x64657363
42 +#define TAG_vcgt 0x76636774 42 +#define TAG_vcgt 0x76636774
43 43
44 static struct tag *find_tag(struct tag_index index, uint32_t tag_id) 44 static struct tag *find_tag(struct tag_index index, uint32_t tag_id)
45 { 45 {
46 @@ -344,6 +355,211 @@ static struct tag *find_tag(struct tag_index index, uint32 _t tag_id) 46 @@ -344,6 +355,215 @@ static struct tag *find_tag(struct tag_index index, uint32 _t tag_id)
47 return tag; 47 return tag;
48 } 48 }
49 49
50 +#define DESC_TYPE 0x64657363 // 'desc' 50 +#define DESC_TYPE 0x64657363 // 'desc'
51 +#define MLUC_TYPE 0x6d6c7563 // 'mluc' 51 +#define MLUC_TYPE 0x6d6c7563 // 'mluc'
52 +#define MMOD_TYPE 0x6D6D6F64 // 'mmod' 52 +#define MMOD_TYPE 0x6D6D6F64 // 'mmod'
53 +#define VCGT_TYPE 0x76636774 // 'vcgt' 53 +#define VCGT_TYPE 0x76636774 // 'vcgt'
54 + 54 +
55 +// Check unsigned short is uint16_t. 55 +// Check unsigned short is uint16_t.
56 +typedef char assert_short_not_16b[(sizeof(unsigned short) == sizeof(uint16_t)) ? 1 : -1]; 56 +typedef char assert_short_not_16b[(sizeof(unsigned short) == sizeof(uint16_t)) ? 1 : -1];
(...skipping 14 matching lines...) Expand all
71 + 71 +
72 + // Only support 3 channels. 72 + // Only support 3 channels.
73 + if (channels != 3) 73 + if (channels != 3)
74 + return true; 74 + return true;
75 + // Only support single or double byte values. 75 + // Only support single or double byte values.
76 + if (byte_depth != 1 && byte_depth != 2) 76 + if (byte_depth != 1 && byte_depth != 2)
77 + return true; 77 + return true;
78 + // Only support table data, not equation. 78 + // Only support table data, not equation.
79 + if (vcgt_type != 0) 79 + if (vcgt_type != 0)
80 + return true; 80 + return true;
81 + // Limit the table to a sensible size; 10-bit gamma is a reasonable
82 + // maximum for hardware correction.
83 + if (elements > 1024)
84 + return true;
81 + 85 +
82 + // Empty table is invalid. 86 + // Empty table is invalid.
83 + if (!elements) 87 + if (!elements)
84 + goto invalid_vcgt_tag; 88 + goto invalid_vcgt_tag;
85 + 89 +
86 + profile->vcgt.length = elements; 90 + profile->vcgt.length = elements;
87 + profile->vcgt.data = malloc(3 * elements * sizeof(uint16_t)); 91 + profile->vcgt.data = malloc(3 * elements * sizeof(uint16_t));
88 + if (!profile->vcgt.data) 92 + if (!profile->vcgt.data)
89 + return false; 93 + return false;
90 + 94 +
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 +invalid_mmod_tag: 252 +invalid_mmod_tag:
249 + invalid_source(src, "invalid mmod tag"); 253 + invalid_source(src, "invalid mmod tag");
250 + return false; 254 + return false;
251 +} 255 +}
252 + 256 +
253 +#endif // __APPLE__ 257 +#endif // __APPLE__
254 + 258 +
255 #define XYZ_TYPE 0x58595a20 // 'XYZ ' 259 #define XYZ_TYPE 0x58595a20 // 'XYZ '
256 #define CURVE_TYPE 0x63757276 // 'curv' 260 #define CURVE_TYPE 0x63757276 // 'curv'
257 #define PARAMETRIC_CURVE_TYPE 0x70617261 // 'para' 261 #define PARAMETRIC_CURVE_TYPE 0x70617261 // 'para'
258 @@ -402,7 +618,7 @@ static struct XYZNumber read_tag_XYZType(struct mem_source * src, struct tag_inde 262 @@ -402,7 +622,7 @@ static struct XYZNumber read_tag_XYZType(struct mem_source * src, struct tag_inde
259 // present that are not part of the tag_index. 263 // present that are not part of the tag_index.
260 static struct curveType *read_curveType(struct mem_source *src, uint32_t offset , uint32_t *len) 264 static struct curveType *read_curveType(struct mem_source *src, uint32_t offset , uint32_t *len)
261 { 265 {
262 - static const size_t COUNT_TO_LENGTH[5] = {1, 3, 4, 5, 7}; 266 - static const size_t COUNT_TO_LENGTH[5] = {1, 3, 4, 5, 7};
263 + static const uint32_t COUNT_TO_LENGTH[5] = {1, 3, 4, 5, 7}; 267 + static const uint32_t COUNT_TO_LENGTH[5] = {1, 3, 4, 5, 7};
264 struct curveType *curve = NULL; 268 struct curveType *curve = NULL;
265 uint32_t type = read_u32(src, offset); 269 uint32_t type = read_u32(src, offset);
266 uint32_t count; 270 uint32_t count;
267 @@ -484,19 +700,23 @@ static void read_nested_curveType(struct mem_source *src, struct curveType *(*cu 271 @@ -484,19 +704,23 @@ static void read_nested_curveType(struct mem_source *src, struct curveType *(*cu
268 uint32_t channel_offset = 0; 272 uint32_t channel_offset = 0;
269 int i; 273 int i;
270 for (i = 0; i < num_channels; i++) { 274 for (i = 0; i < num_channels; i++) {
271 - uint32_t tag_len; 275 - uint32_t tag_len;
272 + uint32_t tag_len = ~0; 276 + uint32_t tag_len = ~0;
273 277
274 (*curveArray)[i] = read_curveType(src, curve_offset + channel_of fset, &tag_len); 278 (*curveArray)[i] = read_curveType(src, curve_offset + channel_of fset, &tag_len);
275 if (!(*curveArray)[i]) { 279 if (!(*curveArray)[i]) {
276 invalid_source(src, "invalid nested curveType curve"); 280 invalid_source(src, "invalid nested curveType curve");
277 } 281 }
278 282
279 + if (tag_len == ~0) { 283 + if (tag_len == ~0) {
280 + invalid_source(src, "invalid nested curveType tag length "); 284 + invalid_source(src, "invalid nested curveType tag length ");
281 + return; 285 + return;
282 + } 286 + }
283 + 287 +
284 channel_offset += tag_len; 288 channel_offset += tag_len;
285 // 4 byte aligned 289 // 4 byte aligned
286 if ((tag_len % 4) != 0) 290 if ((tag_len % 4) != 0)
287 channel_offset += 4 - (tag_len % 4); 291 channel_offset += 4 - (tag_len % 4);
288 } 292 }
289 - 293 -
290 } 294 }
291 295
292 static void mAB_release(struct lutmABType *lut) 296 static void mAB_release(struct lutmABType *lut)
293 @@ -540,7 +760,7 @@ static struct lutmABType *read_tag_lutmABType(struct mem_sou rce *src, struct tag 297 @@ -540,7 +764,7 @@ static struct lutmABType *read_tag_lutmABType(struct mem_sou rce *src, struct tag
294 // We require 3in/out channels since we only support RGB->XYZ (or RGB->L AB) 298 // We require 3in/out channels since we only support RGB->XYZ (or RGB->L AB)
295 // XXX: If we remove this restriction make sure that the number of chann els 299 // XXX: If we remove this restriction make sure that the number of chann els
296 // is less or equal to the maximum number of mAB curves in qcmsint. h 300 // is less or equal to the maximum number of mAB curves in qcmsint. h
297 - // also check for clut_size overflow. 301 - // also check for clut_size overflow.
298 + // also check for clut_size overflow. Also make sure it's != 0 302 + // also check for clut_size overflow. Also make sure it's != 0
299 if (num_in_channels != 3 || num_out_channels != 3) 303 if (num_in_channels != 3 || num_out_channels != 3)
300 return NULL; 304 return NULL;
301 305
302 @@ -570,6 +790,9 @@ static struct lutmABType *read_tag_lutmABType(struct mem_sou rce *src, struct tag 306 @@ -570,6 +794,9 @@ static struct lutmABType *read_tag_lutmABType(struct mem_sou rce *src, struct tag
303 // clut_size can not overflow since lg(256^num_in_channels) = 24 bits. 307 // clut_size can not overflow since lg(256^num_in_channels) = 24 bits.
304 for (i = 0; i < num_in_channels; i++) { 308 for (i = 0; i < num_in_channels; i++) {
305 clut_size *= read_u8(src, clut_offset + i); 309 clut_size *= read_u8(src, clut_offset + i);
306 + if (clut_size == 0) { 310 + if (clut_size == 0) {
307 + invalid_source(src, "bad clut_size"); 311 + invalid_source(src, "bad clut_size");
308 + } 312 + }
309 } 313 }
310 } else { 314 } else {
311 clut_size = 0; 315 clut_size = 0;
312 @@ -590,6 +813,9 @@ static struct lutmABType *read_tag_lutmABType(struct mem_sou rce *src, struct tag 316 @@ -590,6 +817,9 @@ static struct lutmABType *read_tag_lutmABType(struct mem_sou rce *src, struct tag
313 317
314 for (i = 0; i < num_in_channels; i++) { 318 for (i = 0; i < num_in_channels; i++) {
315 lut->num_grid_points[i] = read_u8(src, clut_offset + i); 319 lut->num_grid_points[i] = read_u8(src, clut_offset + i);
316 + if (lut->num_grid_points[i] == 0) { 320 + if (lut->num_grid_points[i] == 0) {
317 + invalid_source(src, "bad grid_points"); 321 + invalid_source(src, "bad grid_points");
318 + } 322 + }
319 } 323 }
320 324
321 // Reverse the processing of transformation elements for mBA type. 325 // Reverse the processing of transformation elements for mBA type.
322 @@ -657,7 +883,7 @@ static struct lutType *read_tag_lutType(struct mem_source *s rc, struct tag_index 326 @@ -657,7 +887,7 @@ static struct lutType *read_tag_lutType(struct mem_source *s rc, struct tag_index
323 uint16_t num_input_table_entries; 327 uint16_t num_input_table_entries;
324 uint16_t num_output_table_entries; 328 uint16_t num_output_table_entries;
325 uint8_t in_chan, grid_points, out_chan; 329 uint8_t in_chan, grid_points, out_chan;
326 - uint32_t clut_offset, output_offset; 330 - uint32_t clut_offset, output_offset;
327 + size_t clut_offset, output_offset; 331 + size_t clut_offset, output_offset;
328 uint32_t clut_size; 332 uint32_t clut_size;
329 size_t entry_size; 333 size_t entry_size;
330 struct lutType *lut; 334 struct lutType *lut;
331 @@ -672,6 +898,10 @@ static struct lutType *read_tag_lutType(struct mem_source * src, struct tag_index 335 @@ -672,6 +902,10 @@ static struct lutType *read_tag_lutType(struct mem_source * src, struct tag_index
332 } else if (type == LUT16_TYPE) { 336 } else if (type == LUT16_TYPE) {
333 num_input_table_entries = read_u16(src, offset + 48); 337 num_input_table_entries = read_u16(src, offset + 48);
334 num_output_table_entries = read_u16(src, offset + 50); 338 num_output_table_entries = read_u16(src, offset + 50);
335 + if (num_input_table_entries == 0 || num_output_table_entries == 0) { 339 + if (num_input_table_entries == 0 || num_output_table_entries == 0) {
336 + invalid_source(src, "Bad channel count"); 340 + invalid_source(src, "Bad channel count");
337 + return NULL; 341 + return NULL;
338 + } 342 + }
339 entry_size = 2; 343 entry_size = 2;
340 } else { 344 } else {
341 assert(0); // the caller checks that this doesn't happen 345 assert(0); // the caller checks that this doesn't happen
342 @@ -685,15 +915,18 @@ static struct lutType *read_tag_lutType(struct mem_source *src, struct tag_index 346 @@ -685,15 +919,18 @@ static struct lutType *read_tag_lutType(struct mem_source *src, struct tag_index
343 347
344 clut_size = pow(grid_points, in_chan); 348 clut_size = pow(grid_points, in_chan);
345 if (clut_size > MAX_CLUT_SIZE) { 349 if (clut_size > MAX_CLUT_SIZE) {
346 + invalid_source(src, "CLUT too large"); 350 + invalid_source(src, "CLUT too large");
347 return NULL; 351 return NULL;
348 } 352 }
349 353
350 if (in_chan != 3 || out_chan != 3) { 354 if (in_chan != 3 || out_chan != 3) {
351 + invalid_source(src, "CLUT only supports RGB"); 355 + invalid_source(src, "CLUT only supports RGB");
352 return NULL; 356 return NULL;
353 } 357 }
354 358
355 lut = malloc(sizeof(struct lutType) + (num_input_table_entries * in_chan + clut_size*out_chan + num_output_table_entries * out_chan)*sizeof(float)); 359 lut = malloc(sizeof(struct lutType) + (num_input_table_entries * in_chan + clut_size*out_chan + num_output_table_entries * out_chan)*sizeof(float));
356 if (!lut) { 360 if (!lut) {
357 + invalid_source(src, "CLUT too large"); 361 + invalid_source(src, "CLUT too large");
358 return NULL; 362 return NULL;
359 } 363 }
360 364
361 @@ -704,9 +937,9 @@ static struct lutType *read_tag_lutType(struct mem_source *s rc, struct tag_index 365 @@ -704,9 +941,9 @@ static struct lutType *read_tag_lutType(struct mem_source *s rc, struct tag_index
362 366
363 lut->num_input_table_entries = num_input_table_entries; 367 lut->num_input_table_entries = num_input_table_entries;
364 lut->num_output_table_entries = num_output_table_entries; 368 lut->num_output_table_entries = num_output_table_entries;
365 - lut->num_input_channels = read_u8(src, offset + 8); 369 - lut->num_input_channels = read_u8(src, offset + 8);
366 - lut->num_output_channels = read_u8(src, offset + 9); 370 - lut->num_output_channels = read_u8(src, offset + 9);
367 - lut->num_clut_grid_points = read_u8(src, offset + 10); 371 - lut->num_clut_grid_points = read_u8(src, offset + 10);
368 + lut->num_input_channels = in_chan; 372 + lut->num_input_channels = in_chan;
369 + lut->num_output_channels = out_chan; 373 + lut->num_output_channels = out_chan;
370 + lut->num_clut_grid_points = grid_points; 374 + lut->num_clut_grid_points = grid_points;
371 lut->e00 = read_s15Fixed16Number(src, offset+12); 375 lut->e00 = read_s15Fixed16Number(src, offset+12);
372 lut->e01 = read_s15Fixed16Number(src, offset+16); 376 lut->e01 = read_s15Fixed16Number(src, offset+16);
373 lut->e02 = read_s15Fixed16Number(src, offset+20); 377 lut->e02 = read_s15Fixed16Number(src, offset+20);
374 @@ -979,11 +1212,13 @@ qcms_profile* qcms_profile_sRGB(void) 378 @@ -979,11 +1216,13 @@ qcms_profile* qcms_profile_sRGB(void)
375 return NO_MEM_PROFILE; 379 return NO_MEM_PROFILE;
376 380
377 profile = qcms_profile_create_rgb_with_table(D65, Rec709Primaries, table , 1024); 381 profile = qcms_profile_create_rgb_with_table(D65, Rec709Primaries, table , 1024);
378 + if (profile) 382 + if (profile)
379 + strcpy(profile->description, "sRGB IEC61966-2.1"); 383 + strcpy(profile->description, "sRGB IEC61966-2.1");
380 + 384 +
381 free(table); 385 free(table);
382 return profile; 386 return profile;
383 } 387 }
384 388
385 - 389 -
386 /* qcms_profile_from_memory does not hold a reference to the memory passed in * / 390 /* qcms_profile_from_memory does not hold a reference to the memory passed in * /
387 qcms_profile* qcms_profile_from_memory(const void *mem, size_t size) 391 qcms_profile* qcms_profile_from_memory(const void *mem, size_t size)
388 { 392 {
389 @@ -997,6 +1232,9 @@ qcms_profile* qcms_profile_from_memory(const void *mem, siz e_t size) 393 @@ -997,6 +1236,9 @@ qcms_profile* qcms_profile_from_memory(const void *mem, siz e_t size)
390 source.size = size; 394 source.size = size;
391 source.valid = true; 395 source.valid = true;
392 396
393 + if (size < 4) 397 + if (size < 4)
394 + return INVALID_PROFILE; 398 + return INVALID_PROFILE;
395 + 399 +
396 length = read_u32(src, 0); 400 length = read_u32(src, 0);
397 if (length <= size) { 401 if (length <= size) {
398 // shrink the area that we can read if appropriate 402 // shrink the area that we can read if appropriate
399 @@ -1028,12 +1266,26 @@ qcms_profile* qcms_profile_from_memory(const void *mem, size_t size) 403 @@ -1028,12 +1270,26 @@ qcms_profile* qcms_profile_from_memory(const void *mem, size_t size)
400 if (!src->valid || !index.tags) 404 if (!src->valid || !index.tags)
401 goto invalid_tag_table; 405 goto invalid_tag_table;
402 406
403 + if (!read_tag_descType(profile, src, index, TAG_desc)) 407 + if (!read_tag_descType(profile, src, index, TAG_desc))
404 + goto invalid_tag_table; 408 + goto invalid_tag_table;
405 +#if defined(__APPLE__) 409 +#if defined(__APPLE__)
406 + if (!read_tag_dscmType(profile, src, index, TAG_dscm)) 410 + if (!read_tag_dscmType(profile, src, index, TAG_dscm))
407 + goto invalid_tag_table; 411 + goto invalid_tag_table;
408 + if (!read_tag_mmodType(profile, src, index, TAG_mmod)) 412 + if (!read_tag_mmodType(profile, src, index, TAG_mmod))
409 + goto invalid_tag_table; 413 + goto invalid_tag_table;
410 +#endif // __APPLE__ 414 +#endif // __APPLE__
411 + 415 +
412 if (find_tag(index, TAG_CHAD)) { 416 if (find_tag(index, TAG_CHAD)) {
413 profile->chromaticAdaption = read_tag_s15Fixed16ArrayType(src, i ndex, TAG_CHAD); 417 profile->chromaticAdaption = read_tag_s15Fixed16ArrayType(src, i ndex, TAG_CHAD);
414 } else { 418 } else {
415 profile->chromaticAdaption.invalid = true; //Signal the data is not present 419 profile->chromaticAdaption.invalid = true; //Signal the data is not present
416 } 420 }
417 421
418 + if (find_tag(index, TAG_vcgt)) { 422 + if (find_tag(index, TAG_vcgt)) {
419 + if (!read_tag_vcgtType(profile, src, index)) 423 + if (!read_tag_vcgtType(profile, src, index))
420 + goto invalid_tag_table; 424 + goto invalid_tag_table;
421 + } 425 + }
422 + 426 +
423 if (profile->class == DISPLAY_DEVICE_PROFILE || profile->class == INPUT_ DEVICE_PROFILE || 427 if (profile->class == DISPLAY_DEVICE_PROFILE || profile->class == INPUT_ DEVICE_PROFILE ||
424 profile->class == OUTPUT_DEVICE_PROFILE || profile->class == COLOR _SPACE_PROFILE) { 428 profile->class == OUTPUT_DEVICE_PROFILE || profile->class == COLOR _SPACE_PROFILE) {
425 if (profile->color_space == RGB_SIGNATURE) { 429 if (profile->color_space == RGB_SIGNATURE) {
426 @@ -1098,6 +1350,16 @@ invalid_profile: 430 @@ -1098,6 +1354,16 @@ invalid_profile:
427 return INVALID_PROFILE; 431 return INVALID_PROFILE;
428 } 432 }
429 433
430 +qcms_bool qcms_profile_match(qcms_profile *p1, qcms_profile *p2) 434 +qcms_bool qcms_profile_match(qcms_profile *p1, qcms_profile *p2)
431 +{ 435 +{
432 + return memcmp(p1->description, p2->description, sizeof p1->description) == 0; 436 + return memcmp(p1->description, p2->description, sizeof p1->description) == 0;
433 +} 437 +}
434 + 438 +
435 +const char* qcms_profile_get_description(qcms_profile *profile) 439 +const char* qcms_profile_get_description(qcms_profile *profile)
436 +{ 440 +{
437 + return profile->description; 441 + return profile->description;
438 +} 442 +}
439 + 443 +
440 qcms_intent qcms_profile_get_rendering_intent(qcms_profile *profile) 444 qcms_intent qcms_profile_get_rendering_intent(qcms_profile *profile)
441 { 445 {
442 return profile->rendering_intent; 446 return profile->rendering_intent;
443 @@ -1114,6 +1376,18 @@ static void lut_release(struct lutType *lut) 447 @@ -1114,6 +1380,18 @@ static void lut_release(struct lutType *lut)
444 free(lut); 448 free(lut);
445 } 449 }
446 450
447 +size_t qcms_profile_get_vcgt_channel_length(qcms_profile *profile) { 451 +size_t qcms_profile_get_vcgt_channel_length(qcms_profile *profile) {
448 + return profile->vcgt.length; 452 + return profile->vcgt.length;
449 +} 453 +}
450 + 454 +
451 +qcms_bool qcms_profile_get_vcgt_rgb_channels(qcms_profile *profile, unsigned sh ort *data) { 455 +qcms_bool qcms_profile_get_vcgt_rgb_channels(qcms_profile *profile, unsigned sh ort *data) {
452 + size_t vcgt_channel_bytes = qcms_profile_get_vcgt_channel_length(profile ) * sizeof(uint16_t); 456 + size_t vcgt_channel_bytes = qcms_profile_get_vcgt_channel_length(profile ) * sizeof(uint16_t);
453 + if (!vcgt_channel_bytes || !data) 457 + if (!vcgt_channel_bytes || !data)
454 + return false; 458 + return false;
455 + memcpy(data, profile->vcgt.data, 3 * vcgt_channel_bytes); 459 + memcpy(data, profile->vcgt.data, 3 * vcgt_channel_bytes);
456 + return true; 460 + return true;
457 +} 461 +}
458 + 462 +
459 void qcms_profile_release(qcms_profile *profile) 463 void qcms_profile_release(qcms_profile *profile)
460 { 464 {
461 if (profile->output_table_r) 465 if (profile->output_table_r)
462 @@ -1133,6 +1407,9 @@ void qcms_profile_release(qcms_profile *profile) 466 @@ -1133,6 +1411,9 @@ void qcms_profile_release(qcms_profile *profile)
463 if (profile->mBA) 467 if (profile->mBA)
464 mAB_release(profile->mBA); 468 mAB_release(profile->mBA);
465 469
466 + if (profile->vcgt.data) 470 + if (profile->vcgt.data)
467 + free(profile->vcgt.data); 471 + free(profile->vcgt.data);
468 + 472 +
469 free(profile->redTRC); 473 free(profile->redTRC);
470 free(profile->blueTRC); 474 free(profile->blueTRC);
471 free(profile->greenTRC); 475 free(profile->greenTRC);
472 diff --git a/third_party/qcms/src/qcms.h b/third_party/qcms/src/qcms.h 476 diff --git a/third_party/qcms/src/qcms.h b/third_party/qcms/src/qcms.h
(...skipping 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after
1686 1690
1687 -float lut_interp_linear(double value, uint16_t *table, int length); 1691 -float lut_interp_linear(double value, uint16_t *table, int length);
1688 -float lut_interp_linear_float(float value, float *table, int length); 1692 -float lut_interp_linear_float(float value, float *table, int length);
1689 -uint16_t lut_interp_linear16(uint16_t input_value, uint16_t *table, int length) ; 1693 -uint16_t lut_interp_linear16(uint16_t input_value, uint16_t *table, int length) ;
1690 +float lut_interp_linear(double value, uint16_t *table, size_t length); 1694 +float lut_interp_linear(double value, uint16_t *table, size_t length);
1691 +float lut_interp_linear_float(float value, float *table, size_t length); 1695 +float lut_interp_linear_float(float value, float *table, size_t length);
1692 +uint16_t lut_interp_linear16(uint16_t input_value, uint16_t *table, size_t leng th); 1696 +uint16_t lut_interp_linear16(uint16_t input_value, uint16_t *table, size_t leng th);
1693 1697
1694 1698
1695 static inline float lerp(float a, float b, float t) 1699 static inline float lerp(float a, float b, float t)
OLDNEW
« no previous file with comments | « third_party/qcms/README.chromium ('k') | third_party/qcms/src/iccread.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698