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

176 Коммитов

Автор SHA1 Сообщение Дата
Jeff Muizelaar 770d4ae760 Bug 1681945 - Remove some unneeded derives and reduce visibility. r=aosmond
Some comments also get put back in the proper places.

Differential Revision: https://phabricator.services.mozilla.com/D99454
2020-12-11 14:40:30 +00:00
Jeff Muizelaar 942dba0566 Bug 1681726 - Move c bindings to a separate file. r=aosmond
This will isolate the unsafe and make building without them easier.

Differential Revision: https://phabricator.services.mozilla.com/D99350
2020-12-10 14:34:39 +00:00
Jeff Muizelaar a9a4649bd7 Bug 1681723 - Drop 'qcms_' prefix from chain functions. r=aosmond
These functions aren't part of the public api so don't need the prefix.

Differential Revision: https://phabricator.services.mozilla.com/D99348
2020-12-10 13:59:12 +00:00
Jeff Muizelaar 419b002c14 Bug 1681312 - Drop 'extern "C"' from transform module functions. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D99081
2020-12-08 18:37:35 +00:00
Jeff Muizelaar bc3cc1e2bc Bug 1681227 - Run cargo fmt. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D98996
2020-12-08 02:14:18 +00:00
Jeff Muizelaar 8b9b9258af Bug 1681078 - Add proper limits for input tables. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D98926
2020-12-07 15:58:34 +00:00
Jeff Muizelaar c14733e74e Bug 1680938 - Remove unused libc imports. r=aosmond
Get rid of some unsafety too.

Differential Revision: https://phabricator.services.mozilla.com/D98846
2020-12-06 01:14:51 +00:00
Jeff Muizelaar 5636d0ee07 Bug 1680921 - More control flow fixing. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D98842
2020-12-05 20:10:56 +00:00
Jeff Muizelaar 52f656f24a Bug 1680408 - Redo control flow in qcms_modular_transform_create. r=aosmond
This gets rid of current_block and makes the control more like
the original C code.

Differential Revision: https://phabricator.services.mozilla.com/D98552
2020-12-03 01:42:22 +00:00
Jeff Muizelaar 949306149a Bug 1680401 - Fix up some of the unstructured control flow. r=aosmond
Now that we have a working destructor for qcms_modular_transform
we don't have to worry about calling qcms_modular_transform_release
and can just return None.

Differential Revision: https://phabricator.services.mozilla.com/D98549
2020-12-03 00:16:58 +00:00
Jeff Muizelaar c949054c94 Bug 1680257 - Use default initialization for qcms_modular_transform. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D98467
2020-12-02 16:01:00 +00:00
Jeff Muizelaar c0cc28dc85 Bug 1680119 - Cleanup qcms_modular_transform_release. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D98380
2020-12-02 02:07:59 +00:00
Jeff Muizelaar 6464b0b4fe Bug 1680016 - Fix leak in v4_output test. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D98320
2020-12-01 19:52:50 +00:00
Jeff Muizelaar ad44f7baf9 Bug 1679915 - Convert output_clut_table's to Vecs. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D98263
2020-12-01 02:56:52 +00:00
Jeff Muizelaar b50abe998a Bug 1679914 - Use a vec for clut. r=aosmond
Instead of storing the offseted buffers in qcms_modular_transform
we just offset them at transform time.

Differential Revision: https://phabricator.services.mozilla.com/D98262
2020-12-01 02:56:39 +00:00
Jeff Muizelaar 4ff091fbba Bug 1679621. Add a test for v4 output. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D98245
2020-11-30 22:50:40 +00:00
Jeff Muizelaar 7e81bae011 Bug 1679621. Add back accidentally dropped append_transform. r=aosmond
I'll try to add a test in a follow up.

Differential Revision: https://phabricator.services.mozilla.com/D98130
2020-11-30 13:49:48 +00:00
Jeff Muizelaar 692b11db89 Bug 1679568. Cleanup profile creation. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D98084
2020-11-27 19:09:24 +00:00
Jeff Muizelaar ba25e09021 Bug 1679568. Reduce the visibility of the qcms_profile members. r=aosmond
And make profile_sRGB() public.

Differential Revision: https://phabricator.services.mozilla.com/D98083
2020-11-27 19:08:26 +00:00
Jeff Muizelaar 7ae91b7238 Bug 1679411 - Make qcms_profile_sRGB() safer. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D98056
2020-11-27 18:26:33 +00:00
Jeff Muizelaar 3fb4d899ee Bug 1679345 - Make transform_module_fn_t take a *const. r=aosmond
We don't need the mutability

Differential Revision: https://phabricator.services.mozilla.com/D97975
2020-11-26 13:34:54 +00:00
Jeff Muizelaar 6d5ceb5eb5 Bug 1679202 - Make next_transform into a Option<Box<_>>. r=aosmond
Not beautiful but it will at least make things safer.

Differential Revision: https://phabricator.services.mozilla.com/D97935
2020-11-25 12:46:59 +00:00
Jeff Muizelaar ad47fe9775 Bug 1679202. Append the transform after construction instead of before. r=aosmond
This will make it easier to use safe versions of this functions
because we can transfer ownership into the append_transform function.

Differential Revision: https://phabricator.services.mozilla.com/D97934
2020-11-25 12:48:37 +00:00
Jeff Muizelaar e8d0ea1988 Bug 1679180 - qcms: Remove some unneeded unsafe and extern "C". r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D97928
2020-11-24 19:42:35 +00:00
Jeff Muizelaar 06f27a67a4 Bug 1678966 - Remove unused fields from qcms_transform and derive Default. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D97867
2020-11-23 14:55:56 +00:00
Butkovits Atila d3beb62a99 Backed out changeset d38c84c21e76 (bug 1678966) for causing build bustages. CLOSED TREE 2020-11-23 16:27:01 +02:00
Jeff Muizelaar 65652df547 Bug 1678966 - Remove unused fields from qcms_transform and derive Default. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D97867
2020-11-23 13:51:02 +00:00
Jeff Muizelaar f3f4ba58d5 Bug 1678019 - Re-add handling of lut creation failure. r=aosmond
This was found by oss-fuzz:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=27601
and caused by 1f9a32185f4c1d2abfe1e32d773505d865541ad7

Differential Revision: https://phabricator.services.mozilla.com/D97446
2020-11-18 15:02:52 +00:00
Jeff Muizelaar 072eb124b3 Bug 1677385 - Make qcms_transform_precacheLUT_float safe. r=aosmond
This replaces r/g/b_clut pointers with a single
vec and creates the separate pointers as needed in
qcms_transform_data_tetra_clut_template.

Differential Revision: https://phabricator.services.mozilla.com/D97099
2020-11-17 14:33:53 +00:00
Jeff Muizelaar e34aa778ff Bug 1677384 - Drop the unused transform_alloc and transform_free. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D97098
2020-11-15 14:09:38 +00:00
Jeff Muizelaar 6e6d1d327a Bug 1677382 - Make qcms_transform_create safe. r=aosmond
Tack on a little clean up in compute_whitepoint_adaption

Differential Revision: https://phabricator.services.mozilla.com/D97097
2020-11-15 14:04:42 +00:00
Jeff Muizelaar 8ece49dbf8 Bug 1677381 - Turn AVX and Neon features into atomic bools. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D97096
2020-11-15 14:01:58 +00:00
Jeff Muizelaar daf018a6cb Bug 1677352 - Use RGB_SIGNATURE. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D97090
2020-11-15 12:27:44 +00:00
Jeff Muizelaar 398666fb8d Bug 1677326 - Make lut_interp_linear_float safe. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D97085
2020-11-14 21:02:45 +00:00
Jeff Muizelaar 6e93fa82c2 Bug 1677309 - Make qcms_profile_precache_output_transform safe. r=aosmond
There's a couple of formatting cleanups too.

Differential Revision: https://phabricator.services.mozilla.com/D97080
2020-11-14 16:35:58 +00:00
Jeff Muizelaar c0c278d532 Bug 1677006 - Make compute_precache safe. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D96955
2020-11-13 02:10:39 +00:00
Jeff Muizelaar f616e5a1e9 Bug 1677004 - More propagating of [u8; 8192]. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D96954
2020-11-13 01:54:16 +00:00
Jeff Muizelaar d392268136 Bug 1676871 - Propagate [8; 8192] type to compute_precache. r=aosmond
Have compute_precache take &mut to an array of the right size.

Differential Revision: https://phabricator.services.mozilla.com/D96829
2020-11-12 16:26:34 +00:00
Jeff Muizelaar cd031ba211 Bug 1676649 - Remove an unneeded cast and make build_colorant_matrix safe. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D96717
2020-11-12 14:42:41 +00:00
Jeff Muizelaar 32c8aeeb94 Bug 1676555 - Use PRECACHE_OUTPUT_* in more places. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D96670
2020-11-11 14:10:07 +00:00
Jeff Muizelaar 8084874c09 Bug 1675524 - Use symbolic PRECACHE constants. r=aosmond
This restores the use of PRECACHE constants that got replaced
during conversion to Rust.

Differential Revision: https://phabricator.services.mozilla.com/D96183
2020-11-06 13:56:02 +00:00
Jeff Muizelaar 5d4c355232 Bug 1675425 - Make build_output_lut safe. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D95959
2020-11-05 14:27:59 +00:00
Jeff Muizelaar c3b95f0135 Bug 1675080 - Make build_input_gamma_table safe. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D95763
2020-11-05 14:49:01 +00:00
Butkovits Atila a458bf18ff Backed out changeset 0cb7e54c81fd (bug 1675425) for bustages complaining about
calling unsafe function. CLOSED TREE
2020-11-05 16:22:51 +02:00
Jeff Muizelaar 5142f9112d Bug 1675425 - Make build_output_lut safe. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D95959
2020-11-05 13:54:09 +00:00
Jeff Muizelaar ff58e7d381 Bug 1674956 - Make lut_interp_linear safe. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D95653
2020-11-03 11:37:16 +00:00
Jeff Muizelaar 109c8f450a Bug 1674672 - qcms: Change input gamma table to a Option<Vec<f32>>. r=aosmond
All of the code that produces these tables is updated to operate
on Vecs.

Differential Revision: https://phabricator.services.mozilla.com/D95463
2020-11-02 13:32:07 +00:00
Jeff Muizelaar 0f61683211 Bug 1674656 - qcms: make lut_inverse_interp16 safe. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D95460
2020-11-01 20:06:06 +00:00
Jeff Muizelaar 7d71ab63f7 Bug 1674621 - qcms: change some *mut to *const. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D95459
2020-11-01 20:05:01 +00:00
Jeff Muizelaar 7b07725fe9 Bug 1672547 - qcms: Change some raw ptrs to references. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D94397
2020-11-01 01:54:48 +00:00
Jeff Muizelaar edcb500aaa Bug 1672309 - Port remaning gtests to Rust. r=aosmond
I've left the C++ ones for now.

Differential Revision: https://phabricator.services.mozilla.com/D94246
2020-10-31 21:55:20 +00:00
Razvan Maries 90372fb9cf Backed out changeset cef722eb6583 (bug 1672309) for Windows 2012 debug BR bustages. CLOSED TREE 2020-10-22 09:01:29 +03:00
Jeff Muizelaar 6df3bcb6d8 Bug 1672309 - Port remaning gtests to Rust. r=aosmond
I've left the C++ ones for now.

Differential Revision: https://phabricator.services.mozilla.com/D94246
2020-10-22 01:30:48 +00:00
Dorel Luca 03c2fad3dc Backed out changeset 02f6caf121bb (bug 1672309) for Backout conflicts with Bug 1654103. CLOSED TREE 2020-10-22 03:50:06 +03:00
Jeff Muizelaar 577c167863 Bug 1672309 - Port remaning gtests to Rust. r=aosmond
I've left the C++ ones for now.

Differential Revision: https://phabricator.services.mozilla.com/D94246
2020-10-22 00:05:08 +00:00
Jeff Muizelaar cc1de268e5 Bug 1671311 - qcms: Make a couple of functions safe. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D93625
2020-10-15 13:02:01 +00:00
Jeff Muizelaar 3fd8898736 Bug 1670404 - Cleanup profile_create_rgb_with_table. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D93156
2020-10-14 20:46:29 +00:00
Jeff Muizelaar 253ba9aba0 Bug 1668912 - Implement Default for qcms_transform. r=aosmond
Using Default::default() to initialize qcms_tranform
instead of zero will avoid us having to rely on the particular
representation of the members which makes things more
sane once the pointer members become Option<Vec<_>>s

Once all the members use Default::default() we can switch
to deriving Default instead of implementing it manually.

Differential Revision: https://phabricator.services.mozilla.com/D92285
2020-10-03 19:16:32 +00:00
Jeff Muizelaar c78d8d9811 Bug 1668967 - qcms: Make sure we read the entire output table. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D92315
2020-10-03 13:59:28 +00:00
Jeff Muizelaar 06840cd992 Bug 1668859 - Separate out the safe part of profile_create_rgb_with_table. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D92251
2020-10-02 19:00:59 +00:00
Jeff Muizelaar e53f994944 Bug 1668708 - Make build_sRGB_gamma_table safe. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D92169
2020-10-02 15:59:39 +00:00
Jeff Muizelaar 803305dab6 Bug 1668526 - qcms: Fix v4 profiles. r=aosmond
Using floor() instead of ceil() was a typo that was introduced while
converting from the libm functions to rust builtins.

This adds a test to prevent us from breaking it in the future.

Differential Revision: https://phabricator.services.mozilla.com/D92131
2020-10-01 19:09:37 +00:00
Jeff Muizelaar 62fa39d35f Bug 1668419 - Make icc profile parsing safe. r=aosmond
This makes qcms_profile_from_memory() a wrapper
around a safe profile_from_slice() function.

Differential Revision: https://phabricator.services.mozilla.com/D92012
2020-10-01 13:18:41 +00:00
Jeff Muizelaar 079948dafe Bug 1668418 - Rustify precache. r=aosmond
Change the *mut precache_output pointers to Option<Arc<precache_output>>
These are the last fields in qcms_profile that we interact with
unsafely.

Differential Revision: https://phabricator.services.mozilla.com/D92011
2020-10-01 12:48:23 +00:00
Jeff Muizelaar f82318cd6e Bug 1667921 - qcms: Make read_tag_lutmABType safe. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D91676
2020-09-29 02:38:02 +00:00
Jeff Muizelaar 6f690d3efc Bug 1667875. Make sure that we enable the instruction set that we're using. r=aosmond
Without this the intrinsics end up as calls instead of inline

Differential Revision: https://phabricator.services.mozilla.com/D91639
2020-09-28 21:04:30 +00:00
Jeff Muizelaar 8d848ca717 Bug 1667691 - qcms: Make lutType safe. r=aosmond
Instead of using a common buffer for all lookup tables
we just use individual Vecs for each.

Differential Revision: https://phabricator.services.mozilla.com/D91534
2020-09-28 00:34:15 +00:00
Jeff Muizelaar ac8e8a021c Bug 1667689 - Make set_rgb_colorants safe. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D91533
2020-09-27 22:56:03 +00:00
Jeff Muizelaar a6bc0ef436 Bug 1667689 - Make build_RGB_to_XYZ_transfer_matrix safe. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D91532
2020-09-27 22:55:56 +00:00
Jeff Muizelaar 8f56d5e521 Bug 1667689 - Make curve_from_table safe. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D91531
2020-09-27 22:54:37 +00:00
Jeff Muizelaar 23b9ed74a2 Bug 1667687 - qcms: Make read_nested safe. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D91530
2020-09-27 22:53:13 +00:00
Jeff Muizelaar 8daf0bd825 Bug 1667686 - Use ptr::write_unaligned to properly handle unaligned accesses. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D91529
2020-09-27 22:52:55 +00:00
Jeff Muizelaar b5a1244a00 Bug 1667374 - Make curveType more Rust like. r=aosmond
Turns curveType into a enum. The change is mostly mechanical fixing of
the the code to the new structure except that for Parametrics curves
we now store the result of COUNT_TO_LENGTH as the len.
This mostly affects compute_curve_gamma_table_type_parametric where we
use the post COUNT_TO_LENGTH instead of the pre COUNT_TO_LENGTH.

Differential Revision: https://phabricator.services.mozilla.com/D91421
2020-09-27 18:57:50 +00:00
Jeff Muizelaar 70cb4bccd7 Bug 1666811. Make tag finding safe. r=aosmond
Change find_tag() to return an Option<&tag> instead of *const tag
and clean up all of the users.

Differential Revision: https://phabricator.services.mozilla.com/D91150
2020-09-25 11:45:04 +00:00
Jeff Muizelaar a9b12a7d10 Bug 1666782. Fix GrayAlpha color conversion. r=aosmond
GrayAlpha::has_alpha was accidentally set to false.

Differential Revision: https://phabricator.services.mozilla.com/D91147
2020-09-23 14:52:19 +00:00
Jeff Muizelaar 0f0c9a9a0c Bug 1666057. Convert qcms to rust. r=aosmond
The conversion was done with c2rust and then manually cleaned up some.
There's still lots of unsafe code remaining but I'd rather do the rest
of the cleanup in-tree so that it's easier to catch and revert
regressions.

I've dropped support for SSE1 (Firefox requires SSE2) and Altivec
(not wanting to deal with fixing Rust's Altivec support).

transform_neon.rs manually implements a bunch of intrinsics, this
can be fixed when we can depend on Rust 1.48.

The fuzz target is changed to a cargo-fuzz target.

Some of the gtests are moved to Rust.

Differential Revision: https://phabricator.services.mozilla.com/D90782
2020-09-21 18:40:51 +00:00