| 1 | /* |
| 2 | * // Copyright (c) Radzivon Bartoshyk 3/2025. All rights reserved. |
| 3 | * // |
| 4 | * // Redistribution and use in source and binary forms, with or without modification, |
| 5 | * // are permitted provided that the following conditions are met: |
| 6 | * // |
| 7 | * // 1. Redistributions of source code must retain the above copyright notice, this |
| 8 | * // list of conditions and the following disclaimer. |
| 9 | * // |
| 10 | * // 2. Redistributions in binary form must reproduce the above copyright notice, |
| 11 | * // this list of conditions and the following disclaimer in the documentation |
| 12 | * // and/or other materials provided with the distribution. |
| 13 | * // |
| 14 | * // 3. Neither the name of the copyright holder nor the names of its |
| 15 | * // contributors may be used to endorse or promote products derived from |
| 16 | * // this software without specific prior written permission. |
| 17 | * // |
| 18 | * // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 19 | * // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 20 | * // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 21 | * // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
| 22 | * // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 23 | * // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 24 | * // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| 25 | * // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 26 | * // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 27 | * // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 | */ |
| 29 | #![cfg(feature = "avx_luts")] |
| 30 | use craterust-analyzer cargo moxcms 0.8.1 crate/::conversionsrust-analyzer cargo moxcms 0.8.1 conversions/::LutBarycentricReductionrust-analyzer cargo moxcms 0.8.1 conversions/reduction/LutBarycentricReduction#; |
| 31 | use craterust-analyzer cargo moxcms 0.8.1 crate/::conversionsrust-analyzer cargo moxcms 0.8.1 conversions/::avxrust-analyzer cargo moxcms 0.8.1 conversions/avx/::interpolator_q0_15rust-analyzer cargo moxcms 0.8.1 conversions/avx/interpolator_q0_15/::*; |
| 32 | use craterust-analyzer cargo moxcms 0.8.1 crate/::conversionsrust-analyzer cargo moxcms 0.8.1 conversions/::interpolatorrust-analyzer cargo moxcms 0.8.1 conversions/interpolator/::BarycentricWeightrust-analyzer cargo moxcms 0.8.1 conversions/interpolator/BarycentricWeight#; |
| 33 | use craterust-analyzer cargo moxcms 0.8.1 crate/::transformrust-analyzer cargo moxcms 0.8.1 transform/::PointeeSizeExpressiblerust-analyzer cargo moxcms 0.8.1 transform/PointeeSizeExpressible#; |
| 34 | use craterust-analyzer cargo moxcms 0.8.1 crate/::{CmsErrorrust-analyzer cargo moxcms 0.8.1 err/CmsError#, DataColorSpacerust-analyzer cargo moxcms 0.8.1 profile/DataColorSpace#, InterpolationMethodrust-analyzer cargo moxcms 0.8.1 transform/InterpolationMethod#, Layoutrust-analyzer cargo moxcms 0.8.1 transform/Layout#, TransformExecutorrust-analyzer cargo moxcms 0.8.1 transform/TransformExecutor#}; |
| 35 | use num_traitsrust-analyzer cargo num-traits 0.2.19 crate/::AsPrimitiverust-analyzer cargo num-traits 0.2.19 cast/AsPrimitive#; |
| 36 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::archrust-analyzer cargo std https://github.com/rust-lang/rust/library/std arch/::x86_64rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/arch/x86_64/::*; |
| 37 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::markerrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/::PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#; |
| 38 | |
| 39 | pub(craterust-analyzer cargo moxcms 0.8.1 crate/) struct TransformLut3x3AvxQ0_15rust-analyzer cargo moxcms 0.8.1 conversions/avx/t_lut3_to_3_q0_15/TransformLut3x3AvxQ0_15#< |
| 40 | T, |
| 41 | U, |
| 42 | const SRC_LAYOUT: u8, |
| 43 | const DST_LAYOUT: u8, |
| 44 | const GRID_SIZE: usize, |
| 45 | const BIT_DEPTH: usize, |
| 46 | const BINS: usize, |
| 47 | const BARYCENTRIC_BINS: usize, |
| 48 | > { |
| 49 | pub(craterust-analyzer cargo moxcms 0.8.1 crate/) lutrust-analyzer cargo moxcms 0.8.1 conversions/avx/t_lut3_to_3_q0_15/TransformLut3x3AvxQ0_15#lut.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<AvxAlignedI16rust-analyzer cargo moxcms 0.8.1 conversions/avx/interpolator_q0_15/AvxAlignedI16#>, |
| 50 | pub(craterust-analyzer cargo moxcms 0.8.1 crate/) _phantomrust-analyzer cargo moxcms 0.8.1 conversions/avx/t_lut3_to_3_q0_15/TransformLut3x3AvxQ0_15#_phantom.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#<T>, |
| 51 | pub(craterust-analyzer cargo moxcms 0.8.1 crate/) _phantom2rust-analyzer cargo moxcms 0.8.1 conversions/avx/t_lut3_to_3_q0_15/TransformLut3x3AvxQ0_15#_phantom2.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#<U>, |
| 52 | pub(craterust-analyzer cargo moxcms 0.8.1 crate/) interpolation_methodrust-analyzer cargo moxcms 0.8.1 conversions/avx/t_lut3_to_3_q0_15/TransformLut3x3AvxQ0_15#interpolation_method.: InterpolationMethodrust-analyzer cargo moxcms 0.8.1 transform/InterpolationMethod#, |
| 53 | pub(craterust-analyzer cargo moxcms 0.8.1 crate/) weightsrust-analyzer cargo moxcms 0.8.1 conversions/avx/t_lut3_to_3_q0_15/TransformLut3x3AvxQ0_15#weights.: Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<[BarycentricWeightrust-analyzer cargo moxcms 0.8.1 conversions/interpolator/BarycentricWeight#<i16>; BINS]>, |
| 54 | pub(craterust-analyzer cargo moxcms 0.8.1 crate/) color_spacerust-analyzer cargo moxcms 0.8.1 conversions/avx/t_lut3_to_3_q0_15/TransformLut3x3AvxQ0_15#color_space.: DataColorSpacerust-analyzer cargo moxcms 0.8.1 profile/DataColorSpace#, |
| 55 | pub(craterust-analyzer cargo moxcms 0.8.1 crate/) is_linearrust-analyzer cargo moxcms 0.8.1 conversions/avx/t_lut3_to_3_q0_15/TransformLut3x3AvxQ0_15#is_linear.: bool, |
| 56 | } |
| 57 | |
| 58 | impl< |
| 59 | T: Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy# + AsPrimitiverust-analyzer cargo num-traits 0.2.19 cast/AsPrimitive#<f32> + Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# + PointeeSizeExpressiblerust-analyzer cargo moxcms 0.8.1 transform/PointeeSizeExpressible#, |
| 60 | U: AsPrimitiverust-analyzer cargo num-traits 0.2.19 cast/AsPrimitive#<usize>, |
| 61 | const SRC_LAYOUT: u8, |
| 62 | const DST_LAYOUT: u8, |
| 63 | const GRID_SIZE: usize, |
| 64 | const BIT_DEPTH: usize, |
| 65 | const BINS: usize, |
| 66 | const BARYCENTRIC_BINS: usize, |
| 67 | > |
| 68 | TransformLut3x3AvxQ0_15rust-analyzer cargo moxcms 0.8.1 conversions/avx/t_lut3_to_3_q0_15/TransformLut3x3AvxQ0_15#< |
| 69 | T, |
| 70 | U, |
| 71 | SRC_LAYOUT, |
| 72 | DST_LAYOUT, |
| 73 | GRID_SIZE, |
| 74 | BIT_DEPTH, |
| 75 | BINS, |
| 76 | BARYCENTRIC_BINS, |
| 77 | > |
| 78 | where |
| 79 | f32: AsPrimitiverust-analyzer cargo num-traits 0.2.19 cast/AsPrimitive#<T>, |
| 80 | u32: AsPrimitiverust-analyzer cargo num-traits 0.2.19 cast/AsPrimitive#<T>, |
| 81 | (): LutBarycentricReductionrust-analyzer cargo moxcms 0.8.1 conversions/reduction/LutBarycentricReduction#<T, U>, |
| 82 | { |
| 83 | #[allow(unused_unsafe)] |
| 84 | #[target_feature(enable = "avx2")] |
| 85 | unsafe fn transform_chunkrust-analyzer cargo moxcms 0.8.1 conversions/avx/t_lut3_to_3_q0_15/impl#[`TransformLut3x3AvxQ0_15<T, U, SRC_LAYOUT, DST_LAYOUT, GRID_SIZE, BIT_DEPTH, BINS, BARYCENTRIC_BINS>`]transform_chunk().( |
| 86 | &self, |
| 87 | src: &[T], |
| 88 | dst: &mut [T], |
| 89 | interpolator: Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn AvxMdInterpolationQ0_15rust-analyzer cargo moxcms 0.8.1 conversions/avx/interpolator_q0_15/AvxMdInterpolationQ0_15# + Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send# + Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync#>, |
| 90 | ) { |
| 91 | unsafe { |
| 92 | let src_cn = Layoutrust-analyzer cargo moxcms 0.8.1 transform/Layout#::fromrust-analyzer cargo moxcms 0.8.1 transform/impl#[Layout][`From<u8>`]from().(SRC_LAYOUT); |
| 93 | let src_channels = src_cn.channelsrust-analyzer cargo moxcms 0.8.1 transform/impl#[Layout]channels().(); |
| 94 | |
| 95 | let dst_cn = Layoutrust-analyzer cargo moxcms 0.8.1 transform/Layout#::fromrust-analyzer cargo moxcms 0.8.1 transform/impl#[Layout][`From<u8>`]from().(DST_LAYOUT); |
| 96 | let dst_channels = dst_cn.channelsrust-analyzer cargo moxcms 0.8.1 transform/impl#[Layout]channels().(); |
| 97 | |
| 98 | let f_value_scale = _mm_set1_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_set1_ps().(1. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Div<Self>`]div().((1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[i32][`Shl<Self>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[i32][`Shl<Self>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[i32][`Shl<Self>`]shl().14i32) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub().1) as f32); |
| 99 | let max_value = ((1u32 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<usize>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<usize>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<usize>`]shl().BIT_DEPTH) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Sub<Self>`]sub().1).as_rust-analyzer cargo num-traits 0.2.19 cast/AsPrimitive#as_().(); |
| 100 | let v_max_scale = if T::FINITErust-analyzer cargo moxcms 0.8.1 transform/PointeeSizeExpressible#FINITE. { |
| 101 | _mm_set1_epi16rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse2/_mm_set1_epi16().(((1i32 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[i32][`Shl<usize>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[i32][`Shl<usize>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[i32][`Shl<usize>`]shl().BIT_DEPTH) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub().1) as i16) |
| 102 | } else { |
| 103 | _mm_set1_epi16rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse2/_mm_set1_epi16().(((1i32 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[i32][`Shl<Self>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[i32][`Shl<Self>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[i32][`Shl<Self>`]shl().14i32) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub().1) as i16) |
| 104 | }; |
| 105 | |
| 106 | for (src, dst) in src |
| 107 | .chunks_exactrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]chunks_exact().(src_channels) |
| 108 | .ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(dst.chunks_exact_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]chunks_exact_mut().(dst_channels)) |
| 109 | { |
| 110 | let x = <() as LutBarycentricReductionrust-analyzer cargo moxcms 0.8.1 conversions/reduction/LutBarycentricReduction#<T, U>>::reducerust-analyzer cargo moxcms 0.8.1 conversions/reduction/LutBarycentricReduction#reduce().::<BIT_DEPTH, BARYCENTRIC_BINS>( |
| 111 | src[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().src_cn.r_irust-analyzer cargo moxcms 0.8.1 transform/impl#[Layout]r_i().()]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., |
| 112 | ); |
| 113 | let y = <() as LutBarycentricReductionrust-analyzer cargo moxcms 0.8.1 conversions/reduction/LutBarycentricReduction#<T, U>>::reducerust-analyzer cargo moxcms 0.8.1 conversions/reduction/LutBarycentricReduction#reduce().::<BIT_DEPTH, BARYCENTRIC_BINS>( |
| 114 | src[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().src_cn.g_irust-analyzer cargo moxcms 0.8.1 transform/impl#[Layout]g_i().()]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., |
| 115 | ); |
| 116 | let z = <() as LutBarycentricReductionrust-analyzer cargo moxcms 0.8.1 conversions/reduction/LutBarycentricReduction#<T, U>>::reducerust-analyzer cargo moxcms 0.8.1 conversions/reduction/LutBarycentricReduction#reduce().::<BIT_DEPTH, BARYCENTRIC_BINS>( |
| 117 | src[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().src_cn.b_irust-analyzer cargo moxcms 0.8.1 transform/impl#[Layout]b_i().()]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., |
| 118 | ); |
| 119 | |
| 120 | let a = if src_channels rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().4 { |
| 121 | src[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().src_cn.a_irust-analyzer cargo moxcms 0.8.1 transform/impl#[Layout]a_i().()]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). |
| 122 | } else { |
| 123 | max_value |
| 124 | }; |
| 125 | |
| 126 | let v = interpolator.inter3_sserust-analyzer cargo moxcms 0.8.1 conversions/avx/interpolator_q0_15/AvxMdInterpolationQ0_15#inter3_sse().( |
| 127 | &self.lutrust-analyzer cargo moxcms 0.8.1 conversions/avx/t_lut3_to_3_q0_15/TransformLut3x3AvxQ0_15#lut., |
| 128 | x.as_rust-analyzer cargo num-traits 0.2.19 cast/AsPrimitive#as_().(), |
| 129 | y.as_rust-analyzer cargo num-traits 0.2.19 cast/AsPrimitive#as_().(), |
| 130 | z.as_rust-analyzer cargo num-traits 0.2.19 cast/AsPrimitive#as_().(), |
| 131 | self.weightsrust-analyzer cargo moxcms 0.8.1 conversions/avx/t_lut3_to_3_q0_15/TransformLut3x3AvxQ0_15#weights..as_slicerust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`]as_slice().(), |
| 132 | ); |
| 133 | if T::FINITErust-analyzer cargo moxcms 0.8.1 transform/PointeeSizeExpressible#FINITE. { |
| 134 | let mut o = _mm_max_epi16rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse2/_mm_max_epi16().(v.vrust-analyzer cargo moxcms 0.8.1 conversions/avx/interpolator_q0_15/AvxVectorQ0_15Sse#v., _mm_setzero_si128rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse2/_mm_setzero_si128().()); |
| 135 | o = _mm_min_epi16rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse2/_mm_min_epi16().(o, v_max_scale); |
| 136 | let x = _mm_extract_epi16rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse2/_mm_extract_epi16().::<0>(o); |
| 137 | let y = _mm_extract_epi16rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse2/_mm_extract_epi16().::<1>(o); |
| 138 | let z = _mm_extract_epi16rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse2/_mm_extract_epi16().::<2>(o); |
| 139 | |
| 140 | dst[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().dst_cn.r_irust-analyzer cargo moxcms 0.8.1 transform/impl#[Layout]r_i().()]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut(). = (x as u32).as_rust-analyzer cargo num-traits 0.2.19 cast/AsPrimitive#as_().(); |
| 141 | dst[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().dst_cn.g_irust-analyzer cargo moxcms 0.8.1 transform/impl#[Layout]g_i().()]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut(). = (y as u32).as_rust-analyzer cargo num-traits 0.2.19 cast/AsPrimitive#as_().(); |
| 142 | dst[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().dst_cn.b_irust-analyzer cargo moxcms 0.8.1 transform/impl#[Layout]b_i().()]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut(). = (z as u32).as_rust-analyzer cargo num-traits 0.2.19 cast/AsPrimitive#as_().(); |
| 143 | } else { |
| 144 | let mut r = _mm_cvtepi32_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse2/_mm_cvtepi32_ps().(_mm_cvtepi16_epi32rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse41/_mm_cvtepi16_epi32().(v.vrust-analyzer cargo moxcms 0.8.1 conversions/avx/interpolator_q0_15/AvxVectorQ0_15Sse#v.)); |
| 145 | r = _mm_mul_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_mul_ps().(r, f_value_scale); |
| 146 | dst[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().dst_cn.r_irust-analyzer cargo moxcms 0.8.1 transform/impl#[Layout]r_i().()]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut(). = f32::from_bitsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]from_bits().(_mm_extract_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse41/_mm_extract_ps().::<0>(r) as u32).as_rust-analyzer cargo num-traits 0.2.19 cast/AsPrimitive#as_().(); |
| 147 | dst[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().dst_cn.g_irust-analyzer cargo moxcms 0.8.1 transform/impl#[Layout]g_i().()]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut(). = f32::from_bitsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]from_bits().(_mm_extract_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse41/_mm_extract_ps().::<1>(r) as u32).as_rust-analyzer cargo num-traits 0.2.19 cast/AsPrimitive#as_().(); |
| 148 | dst[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().dst_cn.b_irust-analyzer cargo moxcms 0.8.1 transform/impl#[Layout]b_i().()]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut(). = f32::from_bitsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]from_bits().(_mm_extract_psrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse41/_mm_extract_ps().::<2>(r) as u32).as_rust-analyzer cargo num-traits 0.2.19 cast/AsPrimitive#as_().(); |
| 149 | } |
| 150 | if dst_channels rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().4 { |
| 151 | dst[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().dst_cn.a_irust-analyzer cargo moxcms 0.8.1 transform/impl#[Layout]a_i().()]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut(). = a; |
| 152 | } |
| 153 | } |
| 154 | } |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | impl< |
| 159 | T: Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy# + AsPrimitiverust-analyzer cargo num-traits 0.2.19 cast/AsPrimitive#<f32> + Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# + PointeeSizeExpressiblerust-analyzer cargo moxcms 0.8.1 transform/PointeeSizeExpressible#, |
| 160 | U: AsPrimitiverust-analyzer cargo num-traits 0.2.19 cast/AsPrimitive#<usize>, |
| 161 | const SRC_LAYOUT: u8, |
| 162 | const DST_LAYOUT: u8, |
| 163 | const GRID_SIZE: usize, |
| 164 | const BIT_DEPTH: usize, |
| 165 | const BINS: usize, |
| 166 | const BARYCENTRIC_BINS: usize, |
| 167 | > TransformExecutorrust-analyzer cargo moxcms 0.8.1 transform/TransformExecutor#<T> |
| 168 | for TransformLut3x3AvxQ0_15rust-analyzer cargo moxcms 0.8.1 conversions/avx/t_lut3_to_3_q0_15/TransformLut3x3AvxQ0_15#< |
| 169 | T, |
| 170 | U, |
| 171 | SRC_LAYOUT, |
| 172 | DST_LAYOUT, |
| 173 | GRID_SIZE, |
| 174 | BIT_DEPTH, |
| 175 | BINS, |
| 176 | BARYCENTRIC_BINS, |
| 177 | > |
| 178 | where |
| 179 | f32: AsPrimitiverust-analyzer cargo num-traits 0.2.19 cast/AsPrimitive#<T>, |
| 180 | u32: AsPrimitiverust-analyzer cargo num-traits 0.2.19 cast/AsPrimitive#<T>, |
| 181 | (): LutBarycentricReductionrust-analyzer cargo moxcms 0.8.1 conversions/reduction/LutBarycentricReduction#<T, U>, |
| 182 | { |
| 183 | fn transformrust-analyzer cargo moxcms 0.8.1 conversions/avx/t_lut3_to_3_q0_15/impl#[`TransformLut3x3AvxQ0_15<T, U, SRC_LAYOUT, DST_LAYOUT, GRID_SIZE, BIT_DEPTH, BINS, BARYCENTRIC_BINS>`][`TransformExecutor<T>`]transform().(&self, src: &[T], dst: &mut [T]) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), CmsErrorrust-analyzer cargo moxcms 0.8.1 err/CmsError#> { |
| 184 | let src_cn = Layoutrust-analyzer cargo moxcms 0.8.1 transform/Layout#::fromrust-analyzer cargo moxcms 0.8.1 transform/impl#[Layout][`From<u8>`]from().(SRC_LAYOUT); |
| 185 | let src_channels = src_cn.channelsrust-analyzer cargo moxcms 0.8.1 transform/impl#[Layout]channels().(); |
| 186 | |
| 187 | let dst_cn = Layoutrust-analyzer cargo moxcms 0.8.1 transform/Layout#::fromrust-analyzer cargo moxcms 0.8.1 transform/impl#[Layout][`From<u8>`]from().(DST_LAYOUT); |
| 188 | let dst_channels = dst_cn.channelsrust-analyzer cargo moxcms 0.8.1 transform/impl#[Layout]channels().(); |
| 189 | if src.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem().src_channels rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().0 { |
| 190 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(CmsErrorrust-analyzer cargo moxcms 0.8.1 err/CmsError#::LaneMultipleOfChannelsrust-analyzer cargo moxcms 0.8.1 err/CmsError#LaneMultipleOfChannels#); |
| 191 | } |
| 192 | if dst.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem().dst_channels rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().0 { |
| 193 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(CmsErrorrust-analyzer cargo moxcms 0.8.1 err/CmsError#::LaneMultipleOfChannelsrust-analyzer cargo moxcms 0.8.1 err/CmsError#LaneMultipleOfChannels#); |
| 194 | } |
| 195 | let src_chunks = src.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div().src_channels; |
| 196 | let dst_chunks = dst.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div().dst_channels; |
| 197 | if src_chunks rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().dst_chunks { |
| 198 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(CmsErrorrust-analyzer cargo moxcms 0.8.1 err/CmsError#::LaneSizeMismatchrust-analyzer cargo moxcms 0.8.1 err/CmsError#LaneSizeMismatch#); |
| 199 | } |
| 200 | |
| 201 | unsafe { |
| 202 | if self.color_spacerust-analyzer cargo moxcms 0.8.1 conversions/avx/t_lut3_to_3_q0_15/TransformLut3x3AvxQ0_15#color_space. rust-analyzer cargo moxcms 0.8.1 profile/impl#[DataColorSpace][`PartialEq<Self>`]eq().==rust-analyzer cargo moxcms 0.8.1 profile/impl#[DataColorSpace][`PartialEq<Self>`]eq(). rust-analyzer cargo moxcms 0.8.1 profile/impl#[DataColorSpace][`PartialEq<Self>`]eq().DataColorSpacerust-analyzer cargo moxcms 0.8.1 profile/DataColorSpace#::Labrust-analyzer cargo moxcms 0.8.1 profile/DataColorSpace#Lab# |
| 203 | || (self.is_linearrust-analyzer cargo moxcms 0.8.1 conversions/avx/t_lut3_to_3_q0_15/TransformLut3x3AvxQ0_15#is_linear. && self.color_spacerust-analyzer cargo moxcms 0.8.1 conversions/avx/t_lut3_to_3_q0_15/TransformLut3x3AvxQ0_15#color_space. rust-analyzer cargo moxcms 0.8.1 profile/impl#[DataColorSpace][`PartialEq<Self>`]eq().==rust-analyzer cargo moxcms 0.8.1 profile/impl#[DataColorSpace][`PartialEq<Self>`]eq(). rust-analyzer cargo moxcms 0.8.1 profile/impl#[DataColorSpace][`PartialEq<Self>`]eq().DataColorSpacerust-analyzer cargo moxcms 0.8.1 profile/DataColorSpace#::Rgbrust-analyzer cargo moxcms 0.8.1 profile/DataColorSpace#Rgb#) |
| 204 | || self.color_spacerust-analyzer cargo moxcms 0.8.1 conversions/avx/t_lut3_to_3_q0_15/TransformLut3x3AvxQ0_15#color_space. rust-analyzer cargo moxcms 0.8.1 profile/impl#[DataColorSpace][`PartialEq<Self>`]eq().==rust-analyzer cargo moxcms 0.8.1 profile/impl#[DataColorSpace][`PartialEq<Self>`]eq(). rust-analyzer cargo moxcms 0.8.1 profile/impl#[DataColorSpace][`PartialEq<Self>`]eq().DataColorSpacerust-analyzer cargo moxcms 0.8.1 profile/DataColorSpace#::Xyzrust-analyzer cargo moxcms 0.8.1 profile/DataColorSpace#Xyz# |
| 205 | { |
| 206 | self.transform_chunkrust-analyzer cargo moxcms 0.8.1 conversions/avx/t_lut3_to_3_q0_15/impl#[`TransformLut3x3AvxQ0_15<T, U, SRC_LAYOUT, DST_LAYOUT, GRID_SIZE, BIT_DEPTH, BINS, BARYCENTRIC_BINS>`]transform_chunk().(src, dst, Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(TrilinearAvxQ0_15rust-analyzer cargo moxcms 0.8.1 conversions/avx/interpolator_q0_15/TrilinearAvxQ0_15#::<GRID_SIZE> {})); |
| 207 | } else { |
| 208 | match self.interpolation_methodrust-analyzer cargo moxcms 0.8.1 conversions/avx/t_lut3_to_3_q0_15/TransformLut3x3AvxQ0_15#interpolation_method. { |
| 209 | #[cfg(feature = "options")] |
| 210 | InterpolationMethodrust-analyzer cargo moxcms 0.8.1 transform/InterpolationMethod#::Tetrahedralrust-analyzer cargo moxcms 0.8.1 transform/InterpolationMethod#Tetrahedral# => { |
| 211 | self.transform_chunkrust-analyzer cargo moxcms 0.8.1 conversions/avx/t_lut3_to_3_q0_15/impl#[`TransformLut3x3AvxQ0_15<T, U, SRC_LAYOUT, DST_LAYOUT, GRID_SIZE, BIT_DEPTH, BINS, BARYCENTRIC_BINS>`]transform_chunk().( |
| 212 | src, |
| 213 | dst, |
| 214 | Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(TetrahedralAvxQ0_15rust-analyzer cargo moxcms 0.8.1 conversions/avx/interpolator_q0_15/TetrahedralAvxQ0_15#::<GRID_SIZE> {}), |
| 215 | ); |
| 216 | } |
| 217 | #[cfg(feature = "options")] |
| 218 | InterpolationMethodrust-analyzer cargo moxcms 0.8.1 transform/InterpolationMethod#::Pyramidrust-analyzer cargo moxcms 0.8.1 transform/InterpolationMethod#Pyramid# => { |
| 219 | self.transform_chunkrust-analyzer cargo moxcms 0.8.1 conversions/avx/t_lut3_to_3_q0_15/impl#[`TransformLut3x3AvxQ0_15<T, U, SRC_LAYOUT, DST_LAYOUT, GRID_SIZE, BIT_DEPTH, BINS, BARYCENTRIC_BINS>`]transform_chunk().(src, dst, Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(PyramidalAvxQ0_15rust-analyzer cargo moxcms 0.8.1 conversions/avx/interpolator_q0_15/PyramidalAvxQ0_15#::<GRID_SIZE> {})); |
| 220 | } |
| 221 | #[cfg(feature = "options")] |
| 222 | InterpolationMethodrust-analyzer cargo moxcms 0.8.1 transform/InterpolationMethod#::Prismrust-analyzer cargo moxcms 0.8.1 transform/InterpolationMethod#Prism# => { |
| 223 | self.transform_chunkrust-analyzer cargo moxcms 0.8.1 conversions/avx/t_lut3_to_3_q0_15/impl#[`TransformLut3x3AvxQ0_15<T, U, SRC_LAYOUT, DST_LAYOUT, GRID_SIZE, BIT_DEPTH, BINS, BARYCENTRIC_BINS>`]transform_chunk().(src, dst, Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(PrismaticAvxQ0_15rust-analyzer cargo moxcms 0.8.1 conversions/avx/interpolator_q0_15/PrismaticAvxQ0_15#::<GRID_SIZE> {})); |
| 224 | } |
| 225 | InterpolationMethodrust-analyzer cargo moxcms 0.8.1 transform/InterpolationMethod#::Linearrust-analyzer cargo moxcms 0.8.1 transform/InterpolationMethod#Linear# => { |
| 226 | self.transform_chunkrust-analyzer cargo moxcms 0.8.1 conversions/avx/t_lut3_to_3_q0_15/impl#[`TransformLut3x3AvxQ0_15<T, U, SRC_LAYOUT, DST_LAYOUT, GRID_SIZE, BIT_DEPTH, BINS, BARYCENTRIC_BINS>`]transform_chunk().(src, dst, Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(TrilinearAvxQ0_15rust-analyzer cargo moxcms 0.8.1 conversions/avx/interpolator_q0_15/TrilinearAvxQ0_15#::<GRID_SIZE> {})); |
| 227 | } |
| 228 | } |
| 229 | } |
| 230 | } |
| 231 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 232 | } |
| 233 | } |