Граф коммитов

176 Коммитов

Автор SHA1 Сообщение Дата
Jeff Muizelaar 54a52e060a Bug 1710897 - Handle matrix inversion failing more gracefully. r=aosmond
Prior to making invert() return an Option we just gleefully
assumed that it succeeded here. Instead of panicing let's
fail to create the transform.

The problem was found by oss-fuzz:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=34216

Differential Revision: https://phabricator.services.mozilla.com/D114999
2021-05-12 20:52:53 +00:00
Jeff Muizelaar c92ee2a045 Bug 1710542 - Remove 'invalid' field from Matrix. r=aosmond
This changes to using Option<Matrix> instead of
having an 'invalid' field. This makes sure we check
when we need to and don't have to check otherwise.

Differential Revision: https://phabricator.services.mozilla.com/D114808
2021-05-11 13:58:20 +00:00
Jeff Muizelaar 9b9ddc9cc2 Bug 1710450 - Pass a reference to read_tag_s15Fixed16ArrayType r=aosmond
This lets us avoid having to look up the tag again.

Differential Revision: https://phabricator.services.mozilla.com/D114751
2021-05-11 13:57:43 +00:00
Jeff Muizelaar 7c5d88731c Bug 1708805 - Reject output luts with channels != 3. r=aosmond
This problem was introduced by the CMYK support
patch not rejecting 4 channel LUTs at parse time.

The problem was caught by oss-fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=33647

Differential Revision: https://phabricator.services.mozilla.com/D114014
2021-05-01 02:39:06 +00:00
Jeff Muizelaar db8307e53c Bug 1707794 - Add support for CMYK to the fuzzing target. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D113460
2021-04-27 14:38:51 +00:00
Jeff Muizelaar cdd4899132 Bug 1555331. Add a test that parametric functions are properly inverted. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D113227
2021-04-26 12:48:33 +00:00
Jeff Muizelaar 0fe884da2d Bug 1555331. Use parametric inversion when building an output_lut. r=aosmond
Previously we didn't invert at all which was causing over saturation.

Differential Revision: https://phabricator.services.mozilla.com/D113226
2021-04-26 12:48:33 +00:00
Jeff Muizelaar bf77763c5d Bug 1555331. Implement analytic inversion for parametric transfer functions. r=aosmond
This also adjusts the initialization of Param to make inversion better behaved.

Differential Revision: https://phabricator.services.mozilla.com/D113225
2021-04-26 12:48:32 +00:00
Jeff Muizelaar e98ff078aa Bug 1555331. Add a Param struct. r=aosmond
This makes our parsing of parametric transfer functions
more clear because you can see exactly what output variables
the input variables map to.

Differential Revision: https://phabricator.services.mozilla.com/D113224
2021-04-26 12:48:32 +00:00
Jeff Muizelaar 404d7d8cfe Bug 1706144 - Add support for CMYK. r=aosmond
This is not enabled in Gecko yet.

Differential Revision: https://phabricator.services.mozilla.com/D112643
2021-04-23 02:42:53 +00:00
Butkovits Atila 0a6b07942c Backed out changeset d87602a10873 (bug 1706144) for causing build bustages. CLOSED TREE 2021-04-23 04:59:43 +03:00
Jeff Muizelaar 33c441281c Bug 1706144 - Add support for CMYK. r=aosmond
This is not enabled in Gecko yet.

Differential Revision: https://phabricator.services.mozilla.com/D112643
2021-04-23 01:36:00 +00:00
Jeff Muizelaar 84dc71e689 Bug 1705950 - Add safe API for transforming with different formats. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D112489
2021-04-19 18:15:05 +00:00
Jeff Muizelaar d0d3ba387d Bug 1705847 - Use the input_gamma_table_gray as an array. r=aosmond
Cleaner, safer and just as fast.

Differential Revision: https://phabricator.services.mozilla.com/D112446
2021-04-19 18:14:47 +00:00
Jeff Muizelaar 1a31db3a4d Bug 1704909 - Use a Box<[f32; 256]> instead of a Vec. r=aosmond
This gives a known length at compile time at the cost of slightly
worse ergonomics. Knowing the length should let the compiler drop
some bounds checks and will make it easier to make some of the
transform functions safe.

Differential Revision: https://phabricator.services.mozilla.com/D111917
2021-04-16 22:34:13 +00:00
Jan-Erik Rediger 598f4a226a Bug 1705693 - Pass verifier callback as an option. r=aosmond
`ProduceVerifyOutput` takes an `transform_fn_t`, which is a type
definition for `Option<unsafe fn(...)>`.
So we need to pass `Some`. This code can never have worked correctly.

Differential Revision: https://phabricator.services.mozilla.com/D112341
2021-04-16 12:40:33 +00:00
Jeff Muizelaar 5f53667340 Bug 1704407 - Use a CLU helper like the original C++ code. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D111572
2021-04-14 01:09:37 +00:00
Butkovits Atila 45016e9a4a Backed out changeset 1bba2e7410e1 (bug 1697818) as requested by Jeff. CLOSED TREE 2021-03-31 17:55:28 +03:00
Jeff Muizelaar 7bd7df3eeb Bug 1702080 - Make RUSTC_BOOTSTRAP usage conditional on 'neon' feature. r=aosmond
This makes it so our subversion to get NEON doesn't happen by default.

Differential Revision: https://phabricator.services.mozilla.com/D110348
2021-03-31 14:31:23 +00:00
Jeff Muizelaar 23af50ef79 Bug 1701758. Avoid identity sRGB transforms. r=aosmond
This avoids the performance cost and ensures the data remains unchanged.

Differential Revision: https://phabricator.services.mozilla.com/D110289
2021-03-31 13:15:26 +00:00
Jeff Muizelaar ce00bef848 Bug 1701457 - Rewrite compute_curve_gamma_table_type_parametric. r=aosmond
This rewites the function to use slice patterns and make the computation
more closely follow the ICC spec. It also fixes a bug where we forgot to
divide X by 255 before applying the threshold.

Differential Revision: https://phabricator.services.mozilla.com/D110037
2021-03-29 16:41:09 +00:00
Jeff Muizelaar 4a6a749d05 Bug 1701125 - Remove the Option<> from build_lut_matrix. r=aosmond
We always pass Some(lut) to build_lut_matrix so we
don't need take an Option.

Differential Revision: https://phabricator.services.mozilla.com/D109839
2021-03-26 14:51:44 +00:00
Jeff Muizelaar 720be19554 Bug 1698363 - Use trait objects instead of home grown polymorphism. r=aosmond
This lets each ModularTransform contain only the data that needs
instead of all of the possible data and will allow for removing
some of the Option wrappers.

Differential Revision: https://phabricator.services.mozilla.com/D108357
2021-03-15 18:44:17 +00:00
Jeff Muizelaar 83e8eeb430 Bug 1698363 - Use a Vec instead of a list to store ModularTransforms. r=aosmond
This makes things a little simpler at the cost of the Vec<> allocation.
However, it lets us switch to using trait objects because we don't
need a common next_transform field.

Differential Revision: https://phabricator.services.mozilla.com/D108356
2021-03-15 18:44:17 +00:00
Jeff Muizelaar 4408cb9135 Bug 1698325 - Remove dead field. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D108341
2021-03-15 17:58:12 +00:00
Jeff Muizelaar c2592d4467 Bug 1698324 - Store an array of curves instead of explicit rgb ones. r=aosmond
This will make supporting CMYK easier.

Differential Revision: https://phabricator.services.mozilla.com/D108340
2021-03-15 17:05:26 +00:00
Jeff Muizelaar 812f96aeba Bug 1697818 - Drop handrolled NEON SIMD wrappers. r=aosmond
We require Rust 1.50 now which is new enough to not need these
wrappers anymore.

Differential Revision: https://phabricator.services.mozilla.com/D108337
2021-03-14 19:44:57 +00:00
Jeff Muizelaar 7016de7023 Bug 1697595 - Profile doesn't need to be #[repr(C)]. r=aosmond
The members are not used in any C api.

Differential Revision: https://phabricator.services.mozilla.com/D107928
2021-03-11 00:21:45 +00:00
Jeff Muizelaar 5010c8bfcc Bug 1695549 - Cleanup modular_transform_create_output a little. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D106741
2021-03-02 00:31:56 +00:00
Jeff Muizelaar 278f93eac9 Bug 1695549 - Cleanup matrix usage in qcms_transform_data_template_lut. r=aosmond
This avoids unsafe pointer math and is much easier to read.

Differential Revision: https://phabricator.services.mozilla.com/D106740
2021-03-02 00:31:55 +00:00
Jeff Muizelaar 62f4683595 Bug 1695549 - Run cargo fmt on qcms. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D106739
2021-03-02 00:31:54 +00:00
Jeff Muizelaar 6a023272d5 Bug 1695324 - Cleanup read_tag_lutType. r=aosmond
This makes some overflow avoidance more obvious and prepares
for supporting more than 3 input channels.

Differential Revision: https://phabricator.services.mozilla.com/D106665
2021-02-27 19:27:15 +00:00
Jeff Muizelaar 6217a9ef1a Bug 1695110 - Make module_transform_alloc infallible. r=aosmond
This lets us cleanup a bunch of uses of the transform
because it's not an Option anymore.

Differential Revision: https://phabricator.services.mozilla.com/D106571
2021-02-26 12:37:05 +00:00
Jeff Muizelaar e06735bf71 Bug 1695110 - cargo fmt src/chain.rs r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D106570
2021-02-26 12:37:05 +00:00
Jeff Muizelaar 4428c5ac72 Bug 1694958 - Drop extern "C" from the transform functions. r=aosmond
This removes the parts of the gtest that were using these
functions. That specific testing is already happeing in src/gtest.rs

Differential Revision: https://phabricator.services.mozilla.com/D106471
2021-02-26 02:18:32 +00:00
Jeff Muizelaar 27d0c297fd Bug 1694956 - qcms: Make read_u32/u16/u8 safe. r=aosmond
This removes the last bit of unsafety from iccread.rs.

It also removes the now unused 'be' types and conversion
functions.

Differential Revision: https://phabricator.services.mozilla.com/D106469
2021-02-25 16:49:06 +00:00
Jeff Muizelaar 22ceddbe92 Bug 1694955 - qcms: make write_u32/u16 safe. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D106466
2021-02-25 15:30:08 +00:00
Jeff Muizelaar 13e6a365b0 Bug 1694680 - Fix qcms_data_create_rgb_with_gamma.
This fixes a number of problems:

1. The check around get_rgb_colorants was inverted. This caused us to
   only continue if the colorants were wrong.

2. get_rgb_colorants can just return the Matrix instead of taking
   a reference to it.

3. No tests

Differential Revision: https://phabricator.services.mozilla.com/D106463
2021-02-25 13:57:05 +00:00
Jeff Muizelaar 4ac01c88b7 Bug 1694670. Fix the OOB check in write_u32/u16. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D106362
2021-02-25 13:18:47 +00:00
Jeff Muizelaar 8e60a5afe5 Bug 1693404 - Add Profile::new_XYZD50(). r=aosmond
This will be useful implementing Profile::approx_eq()

Differential Revision: https://phabricator.services.mozilla.com/D105518
2021-02-17 23:19:11 +00:00
Jeff Muizelaar a3db045160 Bug 1685214 - Add some documentation to qcms and bump the crate version. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D100845
2021-01-06 01:36:30 +00:00
Jeff Muizelaar 63c64ed972 Bug 1685101 - Fix bytes_per_pixel for GrayA8. r=aosmond
This was found by oss-fuzz https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=29235

Differential Revision: https://phabricator.services.mozilla.com/D100785
2021-01-05 15:56:51 +00:00
Jeff Muizelaar 8eec586c99 Bug 1684760 - Drop unneeded 'pub'. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D100636
2021-01-03 15:14:51 +00:00
Jeff Muizelaar ddce3eff5d Bug 1684760 - Rename qcms_modular_transform to ModularTransform. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D100635
2021-01-03 15:14:49 +00:00
Jeff Muizelaar 1f3be0afea Bug 1684760 - Rename qcms_data_type to DataType. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D100634
2021-01-03 15:13:21 +00:00
Jeff Muizelaar ea48efb477 Bug 1684760 - Rename Intent enum variants. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D100633
2021-01-03 15:10:55 +00:00
Jeff Muizelaar c1acf8890b Bug 1684760 - Run cargo fmt. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D100632
2021-01-03 15:10:07 +00:00
Jeff Muizelaar 09895f6d43 Bug 1684760 - Rename precache_output to PrecacheOutput. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D100631
2021-01-03 15:09:43 +00:00
Jeff Muizelaar d22a451eab Bug 1684760 - Improve panic message. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D100630
2021-01-03 15:09:21 +00:00
Jeff Muizelaar a2b8048d70 Bug 1684723 - Make transform functions take a & instead of *const. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D100622
2021-01-03 14:12:34 +00:00