OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the Chromium LICENSE file. |
| 4 |
| 5 #include "qcms_test_util.h" |
| 6 |
| 7 #include <stdio.h> |
| 8 #include <stdlib.h> |
| 9 #include <time.h> |
| 10 |
| 11 static qcms_bool invalid_rgb_color_profile(qcms_profile *profile) |
| 12 { |
| 13 return rgbData != qcms_profile_get_color_space(profile) || qcms_profile_is_b
ogus(profile); |
| 14 } |
| 15 |
| 16 static int qcms_test_ntsc_gamut(size_t width, |
| 17 size_t height, |
| 18 int iterations, |
| 19 const char *input_path, |
| 20 const char *referece_path, |
| 21 const int force_software) |
| 22 { |
| 23 qcms_profile *input_profile; |
| 24 qcms_profile *reference_profile = qcms_profile_sRGB(); |
| 25 qcms_transform *transform; |
| 26 float input_gamut_metric, reference_gamut_metric; |
| 27 |
| 28 if (!input_path) { |
| 29 fprintf(stderr, "%s: please provide valid ICC profiles via -i/o options\
n", __FUNCTION__); |
| 30 return EXIT_FAILURE; |
| 31 } |
| 32 |
| 33 input_profile = qcms_profile_from_path(input_path); |
| 34 if (!input_profile || invalid_rgb_color_profile(input_profile)) { |
| 35 fprintf(stderr, "Invalid input profile\n"); |
| 36 return EXIT_FAILURE; |
| 37 } |
| 38 |
| 39 transform = qcms_transform_create(input_profile, QCMS_DATA_RGBA_8, reference
_profile, QCMS_DATA_RGBA_8, QCMS_INTENT_DEFAULT); |
| 40 if (!transform) { |
| 41 fprintf(stderr, "Could not create transform\n"); |
| 42 return EXIT_FAILURE; |
| 43 } |
| 44 |
| 45 if (!(transform->transform_flags & TRANSFORM_FLAG_MATRIX)) { |
| 46 fprintf(stderr, "Transform is not matrix\n"); |
| 47 qcms_transform_release(transform); |
| 48 qcms_profile_release(input_profile); |
| 49 qcms_profile_release(reference_profile); |
| 50 return EXIT_FAILURE; |
| 51 } |
| 52 |
| 53 printf("NTSC 1953 relative gamut area test\n"); |
| 54 |
| 55 input_gamut_metric = qcms_profile_ntsc_relative_gamut_size(input_profile); |
| 56 printf("Input profile\n\tDescription: %s\n\tNTSC relative gamut area: %.3f %
%\n", |
| 57 input_profile->description, input_gamut_metric); |
| 58 |
| 59 reference_gamut_metric = qcms_profile_ntsc_relative_gamut_size(reference_pro
file); |
| 60 printf("Internal reference profile\n\tDescription: %s\n\tNTSC relative gamut
area: %.3f %%\n", |
| 61 reference_profile->description, reference_gamut_metric); |
| 62 |
| 63 qcms_transform_release(transform); |
| 64 qcms_profile_release(input_profile); |
| 65 qcms_profile_release(reference_profile); |
| 66 |
| 67 return 0; |
| 68 } |
| 69 |
| 70 struct qcms_test_case qcms_test_ntsc_gamut_info = { |
| 71 "qcms_test_ntsc_gamut", |
| 72 qcms_test_ntsc_gamut, |
| 73 QCMS_TEST_DISABLED |
| 74 }; |
OLD | NEW |