// Copyright (c) the JPEG XL Project Authors. All rights reserved. // // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. #![allow(unused)] #![allow(clippy::type_complexity)] #![allow(clippy::erasing_op)] #![allow(clippy::identity_op)] use crate::*; use jxl_simd::{F32SimdVec, SimdDescriptor}; #[allow(clippy::too_many_arguments)] #[allow(clippy::excessive_precision)] #[inline(always)] pub(super) fn idct_2( d: D, mut v0: D::F32Vec, mut v1: D::F32Vec, ) -> (D::F32Vec, D::F32Vec) { let mut v2 = v0 + v1; let mut v3 = v0 - v1; (v2, v3) } #[inline(always)] pub(super) fn do_idct_2( d: D, data: &mut [::UnderlyingArray], stride: usize, ) { assert!(data.len() > 1 * stride); let mut v0 = D::F32Vec::load_array(d, &data[0 * stride]); let mut v1 = D::F32Vec::load_array(d, &data[1 * stride]); (v0, v1) = idct_2(d, v0, v1); v0.store_array(&mut data[0 * stride]); v1.store_array(&mut data[1 * stride]); } #[inline(always)] pub(super) fn do_idct_2_rowblock( d: D, data: &mut [::UnderlyingArray], ) { assert!(data.len() >= 2); const { assert!(2usize.is_multiple_of(D::F32Vec::LEN)) }; let row_stride = 2 / D::F32Vec::LEN; let mut v0 = D::F32Vec::load_array( d, &data[row_stride * (0 % D::F32Vec::LEN) + (0 / D::F32Vec::LEN)], ); let mut v1 = D::F32Vec::load_array( d, &data[row_stride * (1 % D::F32Vec::LEN) + (1 / D::F32Vec::LEN)], ); (v0, v1) = idct_2(d, v0, v1); v0.store_array(&mut data[row_stride * (0 % D::F32Vec::LEN) + (0 / D::F32Vec::LEN)]); v1.store_array(&mut data[row_stride * (1 % D::F32Vec::LEN) + (1 / D::F32Vec::LEN)]); }