#![allow(unused_assignments, unused_mut, unused_parens, clippy::all)]
use super::wide::{W, round_shift, wrap32, wraplow};
use zvidlib_core::simd::vector::I32x;
const COSPI_1_64: i64 = 16364;
const COSPI_2_64: i64 = 16305;
const COSPI_3_64: i64 = 16207;
const COSPI_4_64: i64 = 16069;
const COSPI_5_64: i64 = 15893;
const COSPI_6_64: i64 = 15679;
const COSPI_7_64: i64 = 15426;
const COSPI_8_64: i64 = 15137;
const COSPI_9_64: i64 = 14811;
const COSPI_10_64: i64 = 14449;
const COSPI_11_64: i64 = 14053;
const COSPI_12_64: i64 = 13623;
const COSPI_13_64: i64 = 13160;
const COSPI_14_64: i64 = 12665;
const COSPI_15_64: i64 = 12140;
const COSPI_16_64: i64 = 11585;
const COSPI_17_64: i64 = 11003;
const COSPI_18_64: i64 = 10394;
const COSPI_19_64: i64 = 9760;
const COSPI_20_64: i64 = 9102;
const COSPI_21_64: i64 = 8423;
const COSPI_22_64: i64 = 7723;
const COSPI_23_64: i64 = 7005;
const COSPI_24_64: i64 = 6270;
const COSPI_25_64: i64 = 5520;
const COSPI_26_64: i64 = 4756;
const COSPI_27_64: i64 = 3981;
const COSPI_28_64: i64 = 3196;
const COSPI_29_64: i64 = 2404;
const COSPI_30_64: i64 = 1606;
const COSPI_31_64: i64 = 804;
const SINPI_1_9: i64 = 5283;
const SINPI_2_9: i64 = 9929;
const SINPI_3_9: i64 = 13377;
const SINPI_4_9: i64 = 15212;
#[inline(always)]
pub(super) unsafe fn idct4<V: I32x>(input: &[W<V>], output: &mut [W<V>]) {
let mut step = [unsafe { W::zero() }; 4];
let mut temp1: W<V>;
let mut temp2: W<V>;
temp1 = (((input[0]).t16()) + ((input[2]).t16())) * COSPI_16_64;
temp2 = (((input[0]).t16()) - ((input[2]).t16())) * COSPI_16_64;
step[0] = (wraplow(round_shift(temp1))).t16();
step[1] = (wraplow(round_shift(temp2))).t16();
temp1 = ((input[1]).t16()) * COSPI_24_64 - ((input[3]).t16()) * COSPI_8_64;
temp2 = ((input[1]).t16()) * COSPI_8_64 + ((input[3]).t16()) * COSPI_24_64;
step[2] = (wraplow(round_shift(temp1))).t16();
step[3] = (wraplow(round_shift(temp2))).t16();
output[0] = (wraplow(step[0] + step[3]));
output[1] = (wraplow(step[1] + step[2]));
output[2] = (wraplow(step[1] - step[2]));
output[3] = (wraplow(step[0] - step[3]));
}
#[inline(always)]
pub(super) unsafe fn iadst4<V: I32x>(input: &[W<V>], output: &mut [W<V>]) {
let mut s0: W<V>;
let mut s1: W<V>;
let mut s2: W<V>;
let mut s3: W<V>;
let mut s4: W<V>;
let mut s5: W<V>;
let mut s6: W<V>;
let mut s7: W<V>;
let mut x0: W<V> = (input[0]);
let mut x1: W<V> = (input[1]);
let mut x2: W<V> = (input[2]);
let mut x3: W<V> = (input[3]);
s0 = SINPI_1_9 * x0;
s1 = SINPI_2_9 * x0;
s2 = SINPI_3_9 * x1;
s3 = SINPI_4_9 * x2;
s4 = SINPI_1_9 * x2;
s5 = SINPI_2_9 * x3;
s6 = SINPI_4_9 * x3;
s7 = wraplow(x0 - x2 + x3);
s0 = s0 + s3 + s5;
s1 = s1 - s4 - s6;
s3 = s2;
s2 = SINPI_3_9 * s7;
output[0] = (wraplow(round_shift(s0 + s3)));
output[1] = (wraplow(round_shift(s1 + s3)));
output[2] = (wraplow(round_shift(s2)));
output[3] = (wraplow(round_shift(s0 + s1 - s3)));
}
#[inline(always)]
pub(super) unsafe fn idct8<V: I32x>(input: &[W<V>], output: &mut [W<V>]) {
let mut step1 = [unsafe { W::zero() }; 8];
let mut step2 = [unsafe { W::zero() }; 8];
let mut temp1: W<V>;
let mut temp2: W<V>;
step1[0] = ((input[0]).t16()).t16();
step1[2] = ((input[4]).t16()).t16();
step1[1] = ((input[2]).t16()).t16();
step1[3] = ((input[6]).t16()).t16();
temp1 = ((input[1]).t16()) * COSPI_28_64 - ((input[7]).t16()) * COSPI_4_64;
temp2 = ((input[1]).t16()) * COSPI_4_64 + ((input[7]).t16()) * COSPI_28_64;
step1[4] = (wraplow(round_shift(temp1))).t16();
step1[7] = (wraplow(round_shift(temp2))).t16();
temp1 = ((input[5]).t16()) * COSPI_12_64 - ((input[3]).t16()) * COSPI_20_64;
temp2 = ((input[5]).t16()) * COSPI_20_64 + ((input[3]).t16()) * COSPI_12_64;
step1[5] = (wraplow(round_shift(temp1))).t16();
step1[6] = (wraplow(round_shift(temp2))).t16();
temp1 = (step1[0] + step1[2]) * COSPI_16_64;
temp2 = (step1[0] - step1[2]) * COSPI_16_64;
step2[0] = (wraplow(round_shift(temp1))).t16();
step2[1] = (wraplow(round_shift(temp2))).t16();
temp1 = step1[1] * COSPI_24_64 - step1[3] * COSPI_8_64;
temp2 = step1[1] * COSPI_8_64 + step1[3] * COSPI_24_64;
step2[2] = (wraplow(round_shift(temp1))).t16();
step2[3] = (wraplow(round_shift(temp2))).t16();
step2[4] = (wraplow(step1[4] + step1[5])).t16();
step2[5] = (wraplow(step1[4] - step1[5])).t16();
step2[6] = (wraplow(-step1[6] + step1[7])).t16();
step2[7] = (wraplow(step1[6] + step1[7])).t16();
step1[0] = (wraplow(step2[0] + step2[3])).t16();
step1[1] = (wraplow(step2[1] + step2[2])).t16();
step1[2] = (wraplow(step2[1] - step2[2])).t16();
step1[3] = (wraplow(step2[0] - step2[3])).t16();
step1[4] = (step2[4]).t16();
temp1 = (step2[6] - step2[5]) * COSPI_16_64;
temp2 = (step2[5] + step2[6]) * COSPI_16_64;
step1[5] = (wraplow(round_shift(temp1))).t16();
step1[6] = (wraplow(round_shift(temp2))).t16();
step1[7] = (step2[7]).t16();
output[0] = (wraplow(step1[0] + step1[7]));
output[1] = (wraplow(step1[1] + step1[6]));
output[2] = (wraplow(step1[2] + step1[5]));
output[3] = (wraplow(step1[3] + step1[4]));
output[4] = (wraplow(step1[3] - step1[4]));
output[5] = (wraplow(step1[2] - step1[5]));
output[6] = (wraplow(step1[1] - step1[6]));
output[7] = (wraplow(step1[0] - step1[7]));
}
#[inline(always)]
pub(super) unsafe fn iadst8<V: I32x>(input: &[W<V>], output: &mut [W<V>]) {
let mut s0: W<V>;
let mut s1: W<V>;
let mut s2: W<V>;
let mut s3: W<V>;
let mut s4: W<V>;
let mut s5: W<V>;
let mut s6: W<V>;
let mut s7: W<V>;
let mut x0: W<V> = (input[7]);
let mut x1: W<V> = (input[0]);
let mut x2: W<V> = (input[5]);
let mut x3: W<V> = (input[2]);
let mut x4: W<V> = (input[3]);
let mut x5: W<V> = (input[4]);
let mut x6: W<V> = (input[1]);
let mut x7: W<V> = (input[6]);
s0 = (wrap32(COSPI_2_64 * x0 + COSPI_30_64 * x1));
s1 = (wrap32(COSPI_30_64 * x0 - COSPI_2_64 * x1));
s2 = (wrap32(COSPI_10_64 * x2 + COSPI_22_64 * x3));
s3 = (wrap32(COSPI_22_64 * x2 - COSPI_10_64 * x3));
s4 = (wrap32(COSPI_18_64 * x4 + COSPI_14_64 * x5));
s5 = (wrap32(COSPI_14_64 * x4 - COSPI_18_64 * x5));
s6 = (wrap32(COSPI_26_64 * x6 + COSPI_6_64 * x7));
s7 = (wrap32(COSPI_6_64 * x6 - COSPI_26_64 * x7));
x0 = wraplow(round_shift(s0 + s4));
x1 = wraplow(round_shift(s1 + s5));
x2 = wraplow(round_shift(s2 + s6));
x3 = wraplow(round_shift(s3 + s7));
x4 = wraplow(round_shift(s0 - s4));
x5 = wraplow(round_shift(s1 - s5));
x6 = wraplow(round_shift(s2 - s6));
x7 = wraplow(round_shift(s3 - s7));
s0 = (wrap32(x0));
s1 = (wrap32(x1));
s2 = (wrap32(x2));
s3 = (wrap32(x3));
s4 = (wrap32(COSPI_8_64 * x4 + COSPI_24_64 * x5));
s5 = (wrap32(COSPI_24_64 * x4 - COSPI_8_64 * x5));
s6 = (wrap32(-COSPI_24_64 * x6 + COSPI_8_64 * x7));
s7 = (wrap32(COSPI_8_64 * x6 + COSPI_24_64 * x7));
x0 = wraplow(s0 + s2);
x1 = wraplow(s1 + s3);
x2 = wraplow(s0 - s2);
x3 = wraplow(s1 - s3);
x4 = wraplow(round_shift(s4 + s6));
x5 = wraplow(round_shift(s5 + s7));
x6 = wraplow(round_shift(s4 - s6));
x7 = wraplow(round_shift(s5 - s7));
s2 = (wrap32(COSPI_16_64 * (x2 + x3)));
s3 = (wrap32(COSPI_16_64 * (x2 - x3)));
s6 = (wrap32(COSPI_16_64 * (x6 + x7)));
s7 = (wrap32(COSPI_16_64 * (x6 - x7)));
x2 = wraplow(round_shift(s2));
x3 = wraplow(round_shift(s3));
x6 = wraplow(round_shift(s6));
x7 = wraplow(round_shift(s7));
output[0] = (wraplow(x0));
output[1] = (wraplow(-x4));
output[2] = (wraplow(x6));
output[3] = (wraplow(-x2));
output[4] = (wraplow(x3));
output[5] = (wraplow(-x7));
output[6] = (wraplow(x5));
output[7] = (wraplow(-x1));
}
#[inline(always)]
pub(super) unsafe fn idct16<V: I32x>(input: &[W<V>], output: &mut [W<V>]) {
let mut step1 = [unsafe { W::zero() }; 16];
let mut step2 = [unsafe { W::zero() }; 16];
let mut temp1: W<V>;
let mut temp2: W<V>;
step1[0] = ((input[0]).t16()).t16();
step1[1] = ((input[8]).t16()).t16();
step1[2] = ((input[4]).t16()).t16();
step1[3] = ((input[12]).t16()).t16();
step1[4] = ((input[2]).t16()).t16();
step1[5] = ((input[10]).t16()).t16();
step1[6] = ((input[6]).t16()).t16();
step1[7] = ((input[14]).t16()).t16();
step1[8] = ((input[1]).t16()).t16();
step1[9] = ((input[9]).t16()).t16();
step1[10] = ((input[5]).t16()).t16();
step1[11] = ((input[13]).t16()).t16();
step1[12] = ((input[3]).t16()).t16();
step1[13] = ((input[11]).t16()).t16();
step1[14] = ((input[7]).t16()).t16();
step1[15] = ((input[15]).t16()).t16();
step2[0] = (step1[0]).t16();
step2[1] = (step1[1]).t16();
step2[2] = (step1[2]).t16();
step2[3] = (step1[3]).t16();
step2[4] = (step1[4]).t16();
step2[5] = (step1[5]).t16();
step2[6] = (step1[6]).t16();
step2[7] = (step1[7]).t16();
temp1 = step1[8] * COSPI_30_64 - step1[15] * COSPI_2_64;
temp2 = step1[8] * COSPI_2_64 + step1[15] * COSPI_30_64;
step2[8] = (wraplow(round_shift(temp1))).t16();
step2[15] = (wraplow(round_shift(temp2))).t16();
temp1 = step1[9] * COSPI_14_64 - step1[14] * COSPI_18_64;
temp2 = step1[9] * COSPI_18_64 + step1[14] * COSPI_14_64;
step2[9] = (wraplow(round_shift(temp1))).t16();
step2[14] = (wraplow(round_shift(temp2))).t16();
temp1 = step1[10] * COSPI_22_64 - step1[13] * COSPI_10_64;
temp2 = step1[10] * COSPI_10_64 + step1[13] * COSPI_22_64;
step2[10] = (wraplow(round_shift(temp1))).t16();
step2[13] = (wraplow(round_shift(temp2))).t16();
temp1 = step1[11] * COSPI_6_64 - step1[12] * COSPI_26_64;
temp2 = step1[11] * COSPI_26_64 + step1[12] * COSPI_6_64;
step2[11] = (wraplow(round_shift(temp1))).t16();
step2[12] = (wraplow(round_shift(temp2))).t16();
step1[0] = (step2[0]).t16();
step1[1] = (step2[1]).t16();
step1[2] = (step2[2]).t16();
step1[3] = (step2[3]).t16();
temp1 = step2[4] * COSPI_28_64 - step2[7] * COSPI_4_64;
temp2 = step2[4] * COSPI_4_64 + step2[7] * COSPI_28_64;
step1[4] = (wraplow(round_shift(temp1))).t16();
step1[7] = (wraplow(round_shift(temp2))).t16();
temp1 = step2[5] * COSPI_12_64 - step2[6] * COSPI_20_64;
temp2 = step2[5] * COSPI_20_64 + step2[6] * COSPI_12_64;
step1[5] = (wraplow(round_shift(temp1))).t16();
step1[6] = (wraplow(round_shift(temp2))).t16();
step1[8] = (wraplow(step2[8] + step2[9])).t16();
step1[9] = (wraplow(step2[8] - step2[9])).t16();
step1[10] = (wraplow(-step2[10] + step2[11])).t16();
step1[11] = (wraplow(step2[10] + step2[11])).t16();
step1[12] = (wraplow(step2[12] + step2[13])).t16();
step1[13] = (wraplow(step2[12] - step2[13])).t16();
step1[14] = (wraplow(-step2[14] + step2[15])).t16();
step1[15] = (wraplow(step2[14] + step2[15])).t16();
temp1 = (step1[0] + step1[1]) * COSPI_16_64;
temp2 = (step1[0] - step1[1]) * COSPI_16_64;
step2[0] = (wraplow(round_shift(temp1))).t16();
step2[1] = (wraplow(round_shift(temp2))).t16();
temp1 = step1[2] * COSPI_24_64 - step1[3] * COSPI_8_64;
temp2 = step1[2] * COSPI_8_64 + step1[3] * COSPI_24_64;
step2[2] = (wraplow(round_shift(temp1))).t16();
step2[3] = (wraplow(round_shift(temp2))).t16();
step2[4] = (wraplow(step1[4] + step1[5])).t16();
step2[5] = (wraplow(step1[4] - step1[5])).t16();
step2[6] = (wraplow(-step1[6] + step1[7])).t16();
step2[7] = (wraplow(step1[6] + step1[7])).t16();
step2[8] = (step1[8]).t16();
step2[15] = (step1[15]).t16();
temp1 = -step1[9] * COSPI_8_64 + step1[14] * COSPI_24_64;
temp2 = step1[9] * COSPI_24_64 + step1[14] * COSPI_8_64;
step2[9] = (wraplow(round_shift(temp1))).t16();
step2[14] = (wraplow(round_shift(temp2))).t16();
temp1 = -step1[10] * COSPI_24_64 - step1[13] * COSPI_8_64;
temp2 = -step1[10] * COSPI_8_64 + step1[13] * COSPI_24_64;
step2[10] = (wraplow(round_shift(temp1))).t16();
step2[13] = (wraplow(round_shift(temp2))).t16();
step2[11] = (step1[11]).t16();
step2[12] = (step1[12]).t16();
step1[0] = (wraplow(step2[0] + step2[3])).t16();
step1[1] = (wraplow(step2[1] + step2[2])).t16();
step1[2] = (wraplow(step2[1] - step2[2])).t16();
step1[3] = (wraplow(step2[0] - step2[3])).t16();
step1[4] = (step2[4]).t16();
temp1 = (step2[6] - step2[5]) * COSPI_16_64;
temp2 = (step2[5] + step2[6]) * COSPI_16_64;
step1[5] = (wraplow(round_shift(temp1))).t16();
step1[6] = (wraplow(round_shift(temp2))).t16();
step1[7] = (step2[7]).t16();
step1[8] = (wraplow(step2[8] + step2[11])).t16();
step1[9] = (wraplow(step2[9] + step2[10])).t16();
step1[10] = (wraplow(step2[9] - step2[10])).t16();
step1[11] = (wraplow(step2[8] - step2[11])).t16();
step1[12] = (wraplow(-step2[12] + step2[15])).t16();
step1[13] = (wraplow(-step2[13] + step2[14])).t16();
step1[14] = (wraplow(step2[13] + step2[14])).t16();
step1[15] = (wraplow(step2[12] + step2[15])).t16();
step2[0] = (wraplow(step1[0] + step1[7])).t16();
step2[1] = (wraplow(step1[1] + step1[6])).t16();
step2[2] = (wraplow(step1[2] + step1[5])).t16();
step2[3] = (wraplow(step1[3] + step1[4])).t16();
step2[4] = (wraplow(step1[3] - step1[4])).t16();
step2[5] = (wraplow(step1[2] - step1[5])).t16();
step2[6] = (wraplow(step1[1] - step1[6])).t16();
step2[7] = (wraplow(step1[0] - step1[7])).t16();
step2[8] = (step1[8]).t16();
step2[9] = (step1[9]).t16();
temp1 = (-step1[10] + step1[13]) * COSPI_16_64;
temp2 = (step1[10] + step1[13]) * COSPI_16_64;
step2[10] = (wraplow(round_shift(temp1))).t16();
step2[13] = (wraplow(round_shift(temp2))).t16();
temp1 = (-step1[11] + step1[12]) * COSPI_16_64;
temp2 = (step1[11] + step1[12]) * COSPI_16_64;
step2[11] = (wraplow(round_shift(temp1))).t16();
step2[12] = (wraplow(round_shift(temp2))).t16();
step2[14] = (step1[14]).t16();
step2[15] = (step1[15]).t16();
output[0] = (wraplow(step2[0] + step2[15]));
output[1] = (wraplow(step2[1] + step2[14]));
output[2] = (wraplow(step2[2] + step2[13]));
output[3] = (wraplow(step2[3] + step2[12]));
output[4] = (wraplow(step2[4] + step2[11]));
output[5] = (wraplow(step2[5] + step2[10]));
output[6] = (wraplow(step2[6] + step2[9]));
output[7] = (wraplow(step2[7] + step2[8]));
output[8] = (wraplow(step2[7] - step2[8]));
output[9] = (wraplow(step2[6] - step2[9]));
output[10] = (wraplow(step2[5] - step2[10]));
output[11] = (wraplow(step2[4] - step2[11]));
output[12] = (wraplow(step2[3] - step2[12]));
output[13] = (wraplow(step2[2] - step2[13]));
output[14] = (wraplow(step2[1] - step2[14]));
output[15] = (wraplow(step2[0] - step2[15]));
}
#[inline(always)]
pub(super) unsafe fn iadst16<V: I32x>(input: &[W<V>], output: &mut [W<V>]) {
let mut s0: W<V>;
let mut s1: W<V>;
let mut s2: W<V>;
let mut s3: W<V>;
let mut s4: W<V>;
let mut s5: W<V>;
let mut s6: W<V>;
let mut s7: W<V>;
let mut s8: W<V>;
let mut s9: W<V>;
let mut s10: W<V>;
let mut s11: W<V>;
let mut s12: W<V>;
let mut s13: W<V>;
let mut s14: W<V>;
let mut s15: W<V>;
let mut x0: W<V> = (input[15]);
let mut x1: W<V> = (input[0]);
let mut x2: W<V> = (input[13]);
let mut x3: W<V> = (input[2]);
let mut x4: W<V> = (input[11]);
let mut x5: W<V> = (input[4]);
let mut x6: W<V> = (input[9]);
let mut x7: W<V> = (input[6]);
let mut x8: W<V> = (input[7]);
let mut x9: W<V> = (input[8]);
let mut x10: W<V> = (input[5]);
let mut x11: W<V> = (input[10]);
let mut x12: W<V> = (input[3]);
let mut x13: W<V> = (input[12]);
let mut x14: W<V> = (input[1]);
let mut x15: W<V> = (input[14]);
s0 = x0 * COSPI_1_64 + x1 * COSPI_31_64;
s1 = x0 * COSPI_31_64 - x1 * COSPI_1_64;
s2 = x2 * COSPI_5_64 + x3 * COSPI_27_64;
s3 = x2 * COSPI_27_64 - x3 * COSPI_5_64;
s4 = x4 * COSPI_9_64 + x5 * COSPI_23_64;
s5 = x4 * COSPI_23_64 - x5 * COSPI_9_64;
s6 = x6 * COSPI_13_64 + x7 * COSPI_19_64;
s7 = x6 * COSPI_19_64 - x7 * COSPI_13_64;
s8 = x8 * COSPI_17_64 + x9 * COSPI_15_64;
s9 = x8 * COSPI_15_64 - x9 * COSPI_17_64;
s10 = x10 * COSPI_21_64 + x11 * COSPI_11_64;
s11 = x10 * COSPI_11_64 - x11 * COSPI_21_64;
s12 = x12 * COSPI_25_64 + x13 * COSPI_7_64;
s13 = x12 * COSPI_7_64 - x13 * COSPI_25_64;
s14 = x14 * COSPI_29_64 + x15 * COSPI_3_64;
s15 = x14 * COSPI_3_64 - x15 * COSPI_29_64;
x0 = wraplow(round_shift(s0 + s8));
x1 = wraplow(round_shift(s1 + s9));
x2 = wraplow(round_shift(s2 + s10));
x3 = wraplow(round_shift(s3 + s11));
x4 = wraplow(round_shift(s4 + s12));
x5 = wraplow(round_shift(s5 + s13));
x6 = wraplow(round_shift(s6 + s14));
x7 = wraplow(round_shift(s7 + s15));
x8 = wraplow(round_shift(s0 - s8));
x9 = wraplow(round_shift(s1 - s9));
x10 = wraplow(round_shift(s2 - s10));
x11 = wraplow(round_shift(s3 - s11));
x12 = wraplow(round_shift(s4 - s12));
x13 = wraplow(round_shift(s5 - s13));
x14 = wraplow(round_shift(s6 - s14));
x15 = wraplow(round_shift(s7 - s15));
s0 = x0;
s1 = x1;
s2 = x2;
s3 = x3;
s4 = x4;
s5 = x5;
s6 = x6;
s7 = x7;
s8 = x8 * COSPI_4_64 + x9 * COSPI_28_64;
s9 = x8 * COSPI_28_64 - x9 * COSPI_4_64;
s10 = x10 * COSPI_20_64 + x11 * COSPI_12_64;
s11 = x10 * COSPI_12_64 - x11 * COSPI_20_64;
s12 = -x12 * COSPI_28_64 + x13 * COSPI_4_64;
s13 = x12 * COSPI_4_64 + x13 * COSPI_28_64;
s14 = -x14 * COSPI_12_64 + x15 * COSPI_20_64;
s15 = x14 * COSPI_20_64 + x15 * COSPI_12_64;
x0 = wraplow(s0 + s4);
x1 = wraplow(s1 + s5);
x2 = wraplow(s2 + s6);
x3 = wraplow(s3 + s7);
x4 = wraplow(s0 - s4);
x5 = wraplow(s1 - s5);
x6 = wraplow(s2 - s6);
x7 = wraplow(s3 - s7);
x8 = wraplow(round_shift(s8 + s12));
x9 = wraplow(round_shift(s9 + s13));
x10 = wraplow(round_shift(s10 + s14));
x11 = wraplow(round_shift(s11 + s15));
x12 = wraplow(round_shift(s8 - s12));
x13 = wraplow(round_shift(s9 - s13));
x14 = wraplow(round_shift(s10 - s14));
x15 = wraplow(round_shift(s11 - s15));
s0 = x0;
s1 = x1;
s2 = x2;
s3 = x3;
s4 = x4 * COSPI_8_64 + x5 * COSPI_24_64;
s5 = x4 * COSPI_24_64 - x5 * COSPI_8_64;
s6 = -x6 * COSPI_24_64 + x7 * COSPI_8_64;
s7 = x6 * COSPI_8_64 + x7 * COSPI_24_64;
s8 = x8;
s9 = x9;
s10 = x10;
s11 = x11;
s12 = x12 * COSPI_8_64 + x13 * COSPI_24_64;
s13 = x12 * COSPI_24_64 - x13 * COSPI_8_64;
s14 = -x14 * COSPI_24_64 + x15 * COSPI_8_64;
s15 = x14 * COSPI_8_64 + x15 * COSPI_24_64;
x0 = wraplow(s0 + s2);
x1 = wraplow(s1 + s3);
x2 = wraplow(s0 - s2);
x3 = wraplow(s1 - s3);
x4 = wraplow(round_shift(s4 + s6));
x5 = wraplow(round_shift(s5 + s7));
x6 = wraplow(round_shift(s4 - s6));
x7 = wraplow(round_shift(s5 - s7));
x8 = wraplow(s8 + s10);
x9 = wraplow(s9 + s11);
x10 = wraplow(s8 - s10);
x11 = wraplow(s9 - s11);
x12 = wraplow(round_shift(s12 + s14));
x13 = wraplow(round_shift(s13 + s15));
x14 = wraplow(round_shift(s12 - s14));
x15 = wraplow(round_shift(s13 - s15));
s2 = (-COSPI_16_64) * (x2 + x3);
s3 = COSPI_16_64 * (x2 - x3);
s6 = COSPI_16_64 * (x6 + x7);
s7 = COSPI_16_64 * (-x6 + x7);
s10 = COSPI_16_64 * (x10 + x11);
s11 = COSPI_16_64 * (-x10 + x11);
s14 = (-COSPI_16_64) * (x14 + x15);
s15 = COSPI_16_64 * (x14 - x15);
x2 = wraplow(round_shift(s2));
x3 = wraplow(round_shift(s3));
x6 = wraplow(round_shift(s6));
x7 = wraplow(round_shift(s7));
x10 = wraplow(round_shift(s10));
x11 = wraplow(round_shift(s11));
x14 = wraplow(round_shift(s14));
x15 = wraplow(round_shift(s15));
output[0] = (wraplow(x0));
output[1] = (wraplow(-x8));
output[2] = (wraplow(x12));
output[3] = (wraplow(-x4));
output[4] = (wraplow(x6));
output[5] = (wraplow(x14));
output[6] = (wraplow(x10));
output[7] = (wraplow(x2));
output[8] = (wraplow(x3));
output[9] = (wraplow(x11));
output[10] = (wraplow(x15));
output[11] = (wraplow(x7));
output[12] = (wraplow(x5));
output[13] = (wraplow(-x13));
output[14] = (wraplow(x9));
output[15] = (wraplow(-x1));
}
#[inline(always)]
pub(super) unsafe fn idct32<V: I32x>(input: &[W<V>], output: &mut [W<V>]) {
let mut step1 = [unsafe { W::zero() }; 32];
let mut step2 = [unsafe { W::zero() }; 32];
let mut temp1: W<V>;
let mut temp2: W<V>;
step1[0] = ((input[0]).t16()).t16();
step1[1] = ((input[16]).t16()).t16();
step1[2] = ((input[8]).t16()).t16();
step1[3] = ((input[24]).t16()).t16();
step1[4] = ((input[4]).t16()).t16();
step1[5] = ((input[20]).t16()).t16();
step1[6] = ((input[12]).t16()).t16();
step1[7] = ((input[28]).t16()).t16();
step1[8] = ((input[2]).t16()).t16();
step1[9] = ((input[18]).t16()).t16();
step1[10] = ((input[10]).t16()).t16();
step1[11] = ((input[26]).t16()).t16();
step1[12] = ((input[6]).t16()).t16();
step1[13] = ((input[22]).t16()).t16();
step1[14] = ((input[14]).t16()).t16();
step1[15] = ((input[30]).t16()).t16();
temp1 = ((input[1]).t16()) * COSPI_31_64 - ((input[31]).t16()) * COSPI_1_64;
temp2 = ((input[1]).t16()) * COSPI_1_64 + ((input[31]).t16()) * COSPI_31_64;
step1[16] = (wraplow(round_shift(temp1))).t16();
step1[31] = (wraplow(round_shift(temp2))).t16();
temp1 = ((input[17]).t16()) * COSPI_15_64 - ((input[15]).t16()) * COSPI_17_64;
temp2 = ((input[17]).t16()) * COSPI_17_64 + ((input[15]).t16()) * COSPI_15_64;
step1[17] = (wraplow(round_shift(temp1))).t16();
step1[30] = (wraplow(round_shift(temp2))).t16();
temp1 = ((input[9]).t16()) * COSPI_23_64 - ((input[23]).t16()) * COSPI_9_64;
temp2 = ((input[9]).t16()) * COSPI_9_64 + ((input[23]).t16()) * COSPI_23_64;
step1[18] = (wraplow(round_shift(temp1))).t16();
step1[29] = (wraplow(round_shift(temp2))).t16();
temp1 = ((input[25]).t16()) * COSPI_7_64 - ((input[7]).t16()) * COSPI_25_64;
temp2 = ((input[25]).t16()) * COSPI_25_64 + ((input[7]).t16()) * COSPI_7_64;
step1[19] = (wraplow(round_shift(temp1))).t16();
step1[28] = (wraplow(round_shift(temp2))).t16();
temp1 = ((input[5]).t16()) * COSPI_27_64 - ((input[27]).t16()) * COSPI_5_64;
temp2 = ((input[5]).t16()) * COSPI_5_64 + ((input[27]).t16()) * COSPI_27_64;
step1[20] = (wraplow(round_shift(temp1))).t16();
step1[27] = (wraplow(round_shift(temp2))).t16();
temp1 = ((input[21]).t16()) * COSPI_11_64 - ((input[11]).t16()) * COSPI_21_64;
temp2 = ((input[21]).t16()) * COSPI_21_64 + ((input[11]).t16()) * COSPI_11_64;
step1[21] = (wraplow(round_shift(temp1))).t16();
step1[26] = (wraplow(round_shift(temp2))).t16();
temp1 = ((input[13]).t16()) * COSPI_19_64 - ((input[19]).t16()) * COSPI_13_64;
temp2 = ((input[13]).t16()) * COSPI_13_64 + ((input[19]).t16()) * COSPI_19_64;
step1[22] = (wraplow(round_shift(temp1))).t16();
step1[25] = (wraplow(round_shift(temp2))).t16();
temp1 = ((input[29]).t16()) * COSPI_3_64 - ((input[3]).t16()) * COSPI_29_64;
temp2 = ((input[29]).t16()) * COSPI_29_64 + ((input[3]).t16()) * COSPI_3_64;
step1[23] = (wraplow(round_shift(temp1))).t16();
step1[24] = (wraplow(round_shift(temp2))).t16();
step2[0] = (step1[0]).t16();
step2[1] = (step1[1]).t16();
step2[2] = (step1[2]).t16();
step2[3] = (step1[3]).t16();
step2[4] = (step1[4]).t16();
step2[5] = (step1[5]).t16();
step2[6] = (step1[6]).t16();
step2[7] = (step1[7]).t16();
temp1 = step1[8] * COSPI_30_64 - step1[15] * COSPI_2_64;
temp2 = step1[8] * COSPI_2_64 + step1[15] * COSPI_30_64;
step2[8] = (wraplow(round_shift(temp1))).t16();
step2[15] = (wraplow(round_shift(temp2))).t16();
temp1 = step1[9] * COSPI_14_64 - step1[14] * COSPI_18_64;
temp2 = step1[9] * COSPI_18_64 + step1[14] * COSPI_14_64;
step2[9] = (wraplow(round_shift(temp1))).t16();
step2[14] = (wraplow(round_shift(temp2))).t16();
temp1 = step1[10] * COSPI_22_64 - step1[13] * COSPI_10_64;
temp2 = step1[10] * COSPI_10_64 + step1[13] * COSPI_22_64;
step2[10] = (wraplow(round_shift(temp1))).t16();
step2[13] = (wraplow(round_shift(temp2))).t16();
temp1 = step1[11] * COSPI_6_64 - step1[12] * COSPI_26_64;
temp2 = step1[11] * COSPI_26_64 + step1[12] * COSPI_6_64;
step2[11] = (wraplow(round_shift(temp1))).t16();
step2[12] = (wraplow(round_shift(temp2))).t16();
step2[16] = (wraplow(step1[16] + step1[17])).t16();
step2[17] = (wraplow(step1[16] - step1[17])).t16();
step2[18] = (wraplow(-step1[18] + step1[19])).t16();
step2[19] = (wraplow(step1[18] + step1[19])).t16();
step2[20] = (wraplow(step1[20] + step1[21])).t16();
step2[21] = (wraplow(step1[20] - step1[21])).t16();
step2[22] = (wraplow(-step1[22] + step1[23])).t16();
step2[23] = (wraplow(step1[22] + step1[23])).t16();
step2[24] = (wraplow(step1[24] + step1[25])).t16();
step2[25] = (wraplow(step1[24] - step1[25])).t16();
step2[26] = (wraplow(-step1[26] + step1[27])).t16();
step2[27] = (wraplow(step1[26] + step1[27])).t16();
step2[28] = (wraplow(step1[28] + step1[29])).t16();
step2[29] = (wraplow(step1[28] - step1[29])).t16();
step2[30] = (wraplow(-step1[30] + step1[31])).t16();
step2[31] = (wraplow(step1[30] + step1[31])).t16();
step1[0] = (step2[0]).t16();
step1[1] = (step2[1]).t16();
step1[2] = (step2[2]).t16();
step1[3] = (step2[3]).t16();
temp1 = step2[4] * COSPI_28_64 - step2[7] * COSPI_4_64;
temp2 = step2[4] * COSPI_4_64 + step2[7] * COSPI_28_64;
step1[4] = (wraplow(round_shift(temp1))).t16();
step1[7] = (wraplow(round_shift(temp2))).t16();
temp1 = step2[5] * COSPI_12_64 - step2[6] * COSPI_20_64;
temp2 = step2[5] * COSPI_20_64 + step2[6] * COSPI_12_64;
step1[5] = (wraplow(round_shift(temp1))).t16();
step1[6] = (wraplow(round_shift(temp2))).t16();
step1[8] = (wraplow(step2[8] + step2[9])).t16();
step1[9] = (wraplow(step2[8] - step2[9])).t16();
step1[10] = (wraplow(-step2[10] + step2[11])).t16();
step1[11] = (wraplow(step2[10] + step2[11])).t16();
step1[12] = (wraplow(step2[12] + step2[13])).t16();
step1[13] = (wraplow(step2[12] - step2[13])).t16();
step1[14] = (wraplow(-step2[14] + step2[15])).t16();
step1[15] = (wraplow(step2[14] + step2[15])).t16();
step1[16] = (step2[16]).t16();
step1[31] = (step2[31]).t16();
temp1 = -step2[17] * COSPI_4_64 + step2[30] * COSPI_28_64;
temp2 = step2[17] * COSPI_28_64 + step2[30] * COSPI_4_64;
step1[17] = (wraplow(round_shift(temp1))).t16();
step1[30] = (wraplow(round_shift(temp2))).t16();
temp1 = -step2[18] * COSPI_28_64 - step2[29] * COSPI_4_64;
temp2 = -step2[18] * COSPI_4_64 + step2[29] * COSPI_28_64;
step1[18] = (wraplow(round_shift(temp1))).t16();
step1[29] = (wraplow(round_shift(temp2))).t16();
step1[19] = (step2[19]).t16();
step1[20] = (step2[20]).t16();
temp1 = -step2[21] * COSPI_20_64 + step2[26] * COSPI_12_64;
temp2 = step2[21] * COSPI_12_64 + step2[26] * COSPI_20_64;
step1[21] = (wraplow(round_shift(temp1))).t16();
step1[26] = (wraplow(round_shift(temp2))).t16();
temp1 = -step2[22] * COSPI_12_64 - step2[25] * COSPI_20_64;
temp2 = -step2[22] * COSPI_20_64 + step2[25] * COSPI_12_64;
step1[22] = (wraplow(round_shift(temp1))).t16();
step1[25] = (wraplow(round_shift(temp2))).t16();
step1[23] = (step2[23]).t16();
step1[24] = (step2[24]).t16();
step1[27] = (step2[27]).t16();
step1[28] = (step2[28]).t16();
temp1 = (step1[0] + step1[1]) * COSPI_16_64;
temp2 = (step1[0] - step1[1]) * COSPI_16_64;
step2[0] = (wraplow(round_shift(temp1))).t16();
step2[1] = (wraplow(round_shift(temp2))).t16();
temp1 = step1[2] * COSPI_24_64 - step1[3] * COSPI_8_64;
temp2 = step1[2] * COSPI_8_64 + step1[3] * COSPI_24_64;
step2[2] = (wraplow(round_shift(temp1))).t16();
step2[3] = (wraplow(round_shift(temp2))).t16();
step2[4] = (wraplow(step1[4] + step1[5])).t16();
step2[5] = (wraplow(step1[4] - step1[5])).t16();
step2[6] = (wraplow(-step1[6] + step1[7])).t16();
step2[7] = (wraplow(step1[6] + step1[7])).t16();
step2[8] = (step1[8]).t16();
step2[15] = (step1[15]).t16();
temp1 = -step1[9] * COSPI_8_64 + step1[14] * COSPI_24_64;
temp2 = step1[9] * COSPI_24_64 + step1[14] * COSPI_8_64;
step2[9] = (wraplow(round_shift(temp1))).t16();
step2[14] = (wraplow(round_shift(temp2))).t16();
temp1 = -step1[10] * COSPI_24_64 - step1[13] * COSPI_8_64;
temp2 = -step1[10] * COSPI_8_64 + step1[13] * COSPI_24_64;
step2[10] = (wraplow(round_shift(temp1))).t16();
step2[13] = (wraplow(round_shift(temp2))).t16();
step2[11] = (step1[11]).t16();
step2[12] = (step1[12]).t16();
step2[16] = (wraplow(step1[16] + step1[19])).t16();
step2[17] = (wraplow(step1[17] + step1[18])).t16();
step2[18] = (wraplow(step1[17] - step1[18])).t16();
step2[19] = (wraplow(step1[16] - step1[19])).t16();
step2[20] = (wraplow(-step1[20] + step1[23])).t16();
step2[21] = (wraplow(-step1[21] + step1[22])).t16();
step2[22] = (wraplow(step1[21] + step1[22])).t16();
step2[23] = (wraplow(step1[20] + step1[23])).t16();
step2[24] = (wraplow(step1[24] + step1[27])).t16();
step2[25] = (wraplow(step1[25] + step1[26])).t16();
step2[26] = (wraplow(step1[25] - step1[26])).t16();
step2[27] = (wraplow(step1[24] - step1[27])).t16();
step2[28] = (wraplow(-step1[28] + step1[31])).t16();
step2[29] = (wraplow(-step1[29] + step1[30])).t16();
step2[30] = (wraplow(step1[29] + step1[30])).t16();
step2[31] = (wraplow(step1[28] + step1[31])).t16();
step1[0] = (wraplow(step2[0] + step2[3])).t16();
step1[1] = (wraplow(step2[1] + step2[2])).t16();
step1[2] = (wraplow(step2[1] - step2[2])).t16();
step1[3] = (wraplow(step2[0] - step2[3])).t16();
step1[4] = (step2[4]).t16();
temp1 = (step2[6] - step2[5]) * COSPI_16_64;
temp2 = (step2[5] + step2[6]) * COSPI_16_64;
step1[5] = (wraplow(round_shift(temp1))).t16();
step1[6] = (wraplow(round_shift(temp2))).t16();
step1[7] = (step2[7]).t16();
step1[8] = (wraplow(step2[8] + step2[11])).t16();
step1[9] = (wraplow(step2[9] + step2[10])).t16();
step1[10] = (wraplow(step2[9] - step2[10])).t16();
step1[11] = (wraplow(step2[8] - step2[11])).t16();
step1[12] = (wraplow(-step2[12] + step2[15])).t16();
step1[13] = (wraplow(-step2[13] + step2[14])).t16();
step1[14] = (wraplow(step2[13] + step2[14])).t16();
step1[15] = (wraplow(step2[12] + step2[15])).t16();
step1[16] = (step2[16]).t16();
step1[17] = (step2[17]).t16();
temp1 = -step2[18] * COSPI_8_64 + step2[29] * COSPI_24_64;
temp2 = step2[18] * COSPI_24_64 + step2[29] * COSPI_8_64;
step1[18] = (wraplow(round_shift(temp1))).t16();
step1[29] = (wraplow(round_shift(temp2))).t16();
temp1 = -step2[19] * COSPI_8_64 + step2[28] * COSPI_24_64;
temp2 = step2[19] * COSPI_24_64 + step2[28] * COSPI_8_64;
step1[19] = (wraplow(round_shift(temp1))).t16();
step1[28] = (wraplow(round_shift(temp2))).t16();
temp1 = -step2[20] * COSPI_24_64 - step2[27] * COSPI_8_64;
temp2 = -step2[20] * COSPI_8_64 + step2[27] * COSPI_24_64;
step1[20] = (wraplow(round_shift(temp1))).t16();
step1[27] = (wraplow(round_shift(temp2))).t16();
temp1 = -step2[21] * COSPI_24_64 - step2[26] * COSPI_8_64;
temp2 = -step2[21] * COSPI_8_64 + step2[26] * COSPI_24_64;
step1[21] = (wraplow(round_shift(temp1))).t16();
step1[26] = (wraplow(round_shift(temp2))).t16();
step1[22] = (step2[22]).t16();
step1[23] = (step2[23]).t16();
step1[24] = (step2[24]).t16();
step1[25] = (step2[25]).t16();
step1[30] = (step2[30]).t16();
step1[31] = (step2[31]).t16();
step2[0] = (wraplow(step1[0] + step1[7])).t16();
step2[1] = (wraplow(step1[1] + step1[6])).t16();
step2[2] = (wraplow(step1[2] + step1[5])).t16();
step2[3] = (wraplow(step1[3] + step1[4])).t16();
step2[4] = (wraplow(step1[3] - step1[4])).t16();
step2[5] = (wraplow(step1[2] - step1[5])).t16();
step2[6] = (wraplow(step1[1] - step1[6])).t16();
step2[7] = (wraplow(step1[0] - step1[7])).t16();
step2[8] = (step1[8]).t16();
step2[9] = (step1[9]).t16();
temp1 = (-step1[10] + step1[13]) * COSPI_16_64;
temp2 = (step1[10] + step1[13]) * COSPI_16_64;
step2[10] = (wraplow(round_shift(temp1))).t16();
step2[13] = (wraplow(round_shift(temp2))).t16();
temp1 = (-step1[11] + step1[12]) * COSPI_16_64;
temp2 = (step1[11] + step1[12]) * COSPI_16_64;
step2[11] = (wraplow(round_shift(temp1))).t16();
step2[12] = (wraplow(round_shift(temp2))).t16();
step2[14] = (step1[14]).t16();
step2[15] = (step1[15]).t16();
step2[16] = (wraplow(step1[16] + step1[23])).t16();
step2[17] = (wraplow(step1[17] + step1[22])).t16();
step2[18] = (wraplow(step1[18] + step1[21])).t16();
step2[19] = (wraplow(step1[19] + step1[20])).t16();
step2[20] = (wraplow(step1[19] - step1[20])).t16();
step2[21] = (wraplow(step1[18] - step1[21])).t16();
step2[22] = (wraplow(step1[17] - step1[22])).t16();
step2[23] = (wraplow(step1[16] - step1[23])).t16();
step2[24] = (wraplow(-step1[24] + step1[31])).t16();
step2[25] = (wraplow(-step1[25] + step1[30])).t16();
step2[26] = (wraplow(-step1[26] + step1[29])).t16();
step2[27] = (wraplow(-step1[27] + step1[28])).t16();
step2[28] = (wraplow(step1[27] + step1[28])).t16();
step2[29] = (wraplow(step1[26] + step1[29])).t16();
step2[30] = (wraplow(step1[25] + step1[30])).t16();
step2[31] = (wraplow(step1[24] + step1[31])).t16();
step1[0] = (wraplow(step2[0] + step2[15])).t16();
step1[1] = (wraplow(step2[1] + step2[14])).t16();
step1[2] = (wraplow(step2[2] + step2[13])).t16();
step1[3] = (wraplow(step2[3] + step2[12])).t16();
step1[4] = (wraplow(step2[4] + step2[11])).t16();
step1[5] = (wraplow(step2[5] + step2[10])).t16();
step1[6] = (wraplow(step2[6] + step2[9])).t16();
step1[7] = (wraplow(step2[7] + step2[8])).t16();
step1[8] = (wraplow(step2[7] - step2[8])).t16();
step1[9] = (wraplow(step2[6] - step2[9])).t16();
step1[10] = (wraplow(step2[5] - step2[10])).t16();
step1[11] = (wraplow(step2[4] - step2[11])).t16();
step1[12] = (wraplow(step2[3] - step2[12])).t16();
step1[13] = (wraplow(step2[2] - step2[13])).t16();
step1[14] = (wraplow(step2[1] - step2[14])).t16();
step1[15] = (wraplow(step2[0] - step2[15])).t16();
step1[16] = (step2[16]).t16();
step1[17] = (step2[17]).t16();
step1[18] = (step2[18]).t16();
step1[19] = (step2[19]).t16();
temp1 = (-step2[20] + step2[27]) * COSPI_16_64;
temp2 = (step2[20] + step2[27]) * COSPI_16_64;
step1[20] = (wraplow(round_shift(temp1))).t16();
step1[27] = (wraplow(round_shift(temp2))).t16();
temp1 = (-step2[21] + step2[26]) * COSPI_16_64;
temp2 = (step2[21] + step2[26]) * COSPI_16_64;
step1[21] = (wraplow(round_shift(temp1))).t16();
step1[26] = (wraplow(round_shift(temp2))).t16();
temp1 = (-step2[22] + step2[25]) * COSPI_16_64;
temp2 = (step2[22] + step2[25]) * COSPI_16_64;
step1[22] = (wraplow(round_shift(temp1))).t16();
step1[25] = (wraplow(round_shift(temp2))).t16();
temp1 = (-step2[23] + step2[24]) * COSPI_16_64;
temp2 = (step2[23] + step2[24]) * COSPI_16_64;
step1[23] = (wraplow(round_shift(temp1))).t16();
step1[24] = (wraplow(round_shift(temp2))).t16();
step1[28] = (step2[28]).t16();
step1[29] = (step2[29]).t16();
step1[30] = (step2[30]).t16();
step1[31] = (step2[31]).t16();
output[0] = (wraplow(step1[0] + step1[31]));
output[1] = (wraplow(step1[1] + step1[30]));
output[2] = (wraplow(step1[2] + step1[29]));
output[3] = (wraplow(step1[3] + step1[28]));
output[4] = (wraplow(step1[4] + step1[27]));
output[5] = (wraplow(step1[5] + step1[26]));
output[6] = (wraplow(step1[6] + step1[25]));
output[7] = (wraplow(step1[7] + step1[24]));
output[8] = (wraplow(step1[8] + step1[23]));
output[9] = (wraplow(step1[9] + step1[22]));
output[10] = (wraplow(step1[10] + step1[21]));
output[11] = (wraplow(step1[11] + step1[20]));
output[12] = (wraplow(step1[12] + step1[19]));
output[13] = (wraplow(step1[13] + step1[18]));
output[14] = (wraplow(step1[14] + step1[17]));
output[15] = (wraplow(step1[15] + step1[16]));
output[16] = (wraplow(step1[15] - step1[16]));
output[17] = (wraplow(step1[14] - step1[17]));
output[18] = (wraplow(step1[13] - step1[18]));
output[19] = (wraplow(step1[12] - step1[19]));
output[20] = (wraplow(step1[11] - step1[20]));
output[21] = (wraplow(step1[10] - step1[21]));
output[22] = (wraplow(step1[9] - step1[22]));
output[23] = (wraplow(step1[8] - step1[23]));
output[24] = (wraplow(step1[7] - step1[24]));
output[25] = (wraplow(step1[6] - step1[25]));
output[26] = (wraplow(step1[5] - step1[26]));
output[27] = (wraplow(step1[4] - step1[27]));
output[28] = (wraplow(step1[3] - step1[28]));
output[29] = (wraplow(step1[2] - step1[29]));
output[30] = (wraplow(step1[1] - step1[30]));
output[31] = (wraplow(step1[0] - step1[31]));
}