#![allow(unused_assignments, unused_mut, unused_parens, clippy::all)]
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;
fn wraplow(x: i64) -> i64 {
x as i32 as i64
}
fn wrap32(x: i64) -> i64 {
x as i32 as i64
}
fn round_shift(x: i64) -> i64 {
(x + (1 << 13)) >> 14
}
pub fn idct4(input: &[i32], output: &mut [i32]) {
let mut step = [0i64; 4];
let mut temp1: i64;
let mut temp2: i64;
temp1 = (((input[0] as i64) as i16 as i64) + ((input[2] as i64) as i16 as i64)) * COSPI_16_64;
temp2 = (((input[0] as i64) as i16 as i64) - ((input[2] as i64) as i16 as i64)) * COSPI_16_64;
step[0] = (wraplow(round_shift(temp1))) as i16 as i64;
step[1] = (wraplow(round_shift(temp2))) as i16 as i64;
temp1 = ((input[1] as i64) as i16 as i64) * COSPI_24_64
- ((input[3] as i64) as i16 as i64) * COSPI_8_64;
temp2 = ((input[1] as i64) as i16 as i64) * COSPI_8_64
+ ((input[3] as i64) as i16 as i64) * COSPI_24_64;
step[2] = (wraplow(round_shift(temp1))) as i16 as i64;
step[3] = (wraplow(round_shift(temp2))) as i16 as i64;
output[0] = (wraplow(step[0] + step[3])) as i32;
output[1] = (wraplow(step[1] + step[2])) as i32;
output[2] = (wraplow(step[1] - step[2])) as i32;
output[3] = (wraplow(step[0] - step[3])) as i32;
}
pub fn iadst4(input: &[i32], output: &mut [i32]) {
let mut s0: i64;
let mut s1: i64;
let mut s2: i64;
let mut s3: i64;
let mut s4: i64;
let mut s5: i64;
let mut s6: i64;
let mut s7: i64;
let mut x0: i64 = (input[0] as i64);
let mut x1: i64 = (input[1] as i64);
let mut x2: i64 = (input[2] as i64);
let mut x3: i64 = (input[3] as i64);
if (x0 | x1 | x2 | x3) == 0 {
output.fill(0);
return;
}
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))) as i32;
output[1] = (wraplow(round_shift(s1 + s3))) as i32;
output[2] = (wraplow(round_shift(s2))) as i32;
output[3] = (wraplow(round_shift(s0 + s1 - s3))) as i32;
}
pub fn idct8(input: &[i32], output: &mut [i32]) {
let mut step1 = [0i64; 8];
let mut step2 = [0i64; 8];
let mut temp1: i64;
let mut temp2: i64;
step1[0] = ((input[0] as i64) as i16 as i64) as i16 as i64;
step1[2] = ((input[4] as i64) as i16 as i64) as i16 as i64;
step1[1] = ((input[2] as i64) as i16 as i64) as i16 as i64;
step1[3] = ((input[6] as i64) as i16 as i64) as i16 as i64;
temp1 = ((input[1] as i64) as i16 as i64) * COSPI_28_64
- ((input[7] as i64) as i16 as i64) * COSPI_4_64;
temp2 = ((input[1] as i64) as i16 as i64) * COSPI_4_64
+ ((input[7] as i64) as i16 as i64) * COSPI_28_64;
step1[4] = (wraplow(round_shift(temp1))) as i16 as i64;
step1[7] = (wraplow(round_shift(temp2))) as i16 as i64;
temp1 = ((input[5] as i64) as i16 as i64) * COSPI_12_64
- ((input[3] as i64) as i16 as i64) * COSPI_20_64;
temp2 = ((input[5] as i64) as i16 as i64) * COSPI_20_64
+ ((input[3] as i64) as i16 as i64) * COSPI_12_64;
step1[5] = (wraplow(round_shift(temp1))) as i16 as i64;
step1[6] = (wraplow(round_shift(temp2))) as i16 as i64;
temp1 = (step1[0] + step1[2]) * COSPI_16_64;
temp2 = (step1[0] - step1[2]) * COSPI_16_64;
step2[0] = (wraplow(round_shift(temp1))) as i16 as i64;
step2[1] = (wraplow(round_shift(temp2))) as i16 as i64;
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))) as i16 as i64;
step2[3] = (wraplow(round_shift(temp2))) as i16 as i64;
step2[4] = (wraplow(step1[4] + step1[5])) as i16 as i64;
step2[5] = (wraplow(step1[4] - step1[5])) as i16 as i64;
step2[6] = (wraplow(-step1[6] + step1[7])) as i16 as i64;
step2[7] = (wraplow(step1[6] + step1[7])) as i16 as i64;
step1[0] = (wraplow(step2[0] + step2[3])) as i16 as i64;
step1[1] = (wraplow(step2[1] + step2[2])) as i16 as i64;
step1[2] = (wraplow(step2[1] - step2[2])) as i16 as i64;
step1[3] = (wraplow(step2[0] - step2[3])) as i16 as i64;
step1[4] = (step2[4]) as i16 as i64;
temp1 = (step2[6] - step2[5]) * COSPI_16_64;
temp2 = (step2[5] + step2[6]) * COSPI_16_64;
step1[5] = (wraplow(round_shift(temp1))) as i16 as i64;
step1[6] = (wraplow(round_shift(temp2))) as i16 as i64;
step1[7] = (step2[7]) as i16 as i64;
output[0] = (wraplow(step1[0] + step1[7])) as i32;
output[1] = (wraplow(step1[1] + step1[6])) as i32;
output[2] = (wraplow(step1[2] + step1[5])) as i32;
output[3] = (wraplow(step1[3] + step1[4])) as i32;
output[4] = (wraplow(step1[3] - step1[4])) as i32;
output[5] = (wraplow(step1[2] - step1[5])) as i32;
output[6] = (wraplow(step1[1] - step1[6])) as i32;
output[7] = (wraplow(step1[0] - step1[7])) as i32;
}
pub fn iadst8(input: &[i32], output: &mut [i32]) {
let mut s0: i64;
let mut s1: i64;
let mut s2: i64;
let mut s3: i64;
let mut s4: i64;
let mut s5: i64;
let mut s6: i64;
let mut s7: i64;
let mut x0: i64 = (input[7] as i64);
let mut x1: i64 = (input[0] as i64);
let mut x2: i64 = (input[5] as i64);
let mut x3: i64 = (input[2] as i64);
let mut x4: i64 = (input[3] as i64);
let mut x5: i64 = (input[4] as i64);
let mut x6: i64 = (input[1] as i64);
let mut x7: i64 = (input[6] as i64);
if (x0 | x1 | x2 | x3 | x4 | x5 | x6 | x7) == 0 {
output.fill(0);
return;
}
s0 = (wrap32(COSPI_2_64 * x0 + COSPI_30_64 * x1)) as i32 as i64;
s1 = (wrap32(COSPI_30_64 * x0 - COSPI_2_64 * x1)) as i32 as i64;
s2 = (wrap32(COSPI_10_64 * x2 + COSPI_22_64 * x3)) as i32 as i64;
s3 = (wrap32(COSPI_22_64 * x2 - COSPI_10_64 * x3)) as i32 as i64;
s4 = (wrap32(COSPI_18_64 * x4 + COSPI_14_64 * x5)) as i32 as i64;
s5 = (wrap32(COSPI_14_64 * x4 - COSPI_18_64 * x5)) as i32 as i64;
s6 = (wrap32(COSPI_26_64 * x6 + COSPI_6_64 * x7)) as i32 as i64;
s7 = (wrap32(COSPI_6_64 * x6 - COSPI_26_64 * x7)) as i32 as i64;
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)) as i32 as i64;
s1 = (wrap32(x1)) as i32 as i64;
s2 = (wrap32(x2)) as i32 as i64;
s3 = (wrap32(x3)) as i32 as i64;
s4 = (wrap32(COSPI_8_64 * x4 + COSPI_24_64 * x5)) as i32 as i64;
s5 = (wrap32(COSPI_24_64 * x4 - COSPI_8_64 * x5)) as i32 as i64;
s6 = (wrap32(-COSPI_24_64 * x6 + COSPI_8_64 * x7)) as i32 as i64;
s7 = (wrap32(COSPI_8_64 * x6 + COSPI_24_64 * x7)) as i32 as i64;
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))) as i32 as i64;
s3 = (wrap32(COSPI_16_64 * (x2 - x3))) as i32 as i64;
s6 = (wrap32(COSPI_16_64 * (x6 + x7))) as i32 as i64;
s7 = (wrap32(COSPI_16_64 * (x6 - x7))) as i32 as i64;
x2 = wraplow(round_shift(s2));
x3 = wraplow(round_shift(s3));
x6 = wraplow(round_shift(s6));
x7 = wraplow(round_shift(s7));
output[0] = (wraplow(x0)) as i32;
output[1] = (wraplow(-x4)) as i32;
output[2] = (wraplow(x6)) as i32;
output[3] = (wraplow(-x2)) as i32;
output[4] = (wraplow(x3)) as i32;
output[5] = (wraplow(-x7)) as i32;
output[6] = (wraplow(x5)) as i32;
output[7] = (wraplow(-x1)) as i32;
}
pub fn idct16(input: &[i32], output: &mut [i32]) {
let mut step1 = [0i64; 16];
let mut step2 = [0i64; 16];
let mut temp1: i64;
let mut temp2: i64;
step1[0] = ((input[0] as i64) as i16 as i64) as i16 as i64;
step1[1] = ((input[8] as i64) as i16 as i64) as i16 as i64;
step1[2] = ((input[4] as i64) as i16 as i64) as i16 as i64;
step1[3] = ((input[12] as i64) as i16 as i64) as i16 as i64;
step1[4] = ((input[2] as i64) as i16 as i64) as i16 as i64;
step1[5] = ((input[10] as i64) as i16 as i64) as i16 as i64;
step1[6] = ((input[6] as i64) as i16 as i64) as i16 as i64;
step1[7] = ((input[14] as i64) as i16 as i64) as i16 as i64;
step1[8] = ((input[1] as i64) as i16 as i64) as i16 as i64;
step1[9] = ((input[9] as i64) as i16 as i64) as i16 as i64;
step1[10] = ((input[5] as i64) as i16 as i64) as i16 as i64;
step1[11] = ((input[13] as i64) as i16 as i64) as i16 as i64;
step1[12] = ((input[3] as i64) as i16 as i64) as i16 as i64;
step1[13] = ((input[11] as i64) as i16 as i64) as i16 as i64;
step1[14] = ((input[7] as i64) as i16 as i64) as i16 as i64;
step1[15] = ((input[15] as i64) as i16 as i64) as i16 as i64;
step2[0] = (step1[0]) as i16 as i64;
step2[1] = (step1[1]) as i16 as i64;
step2[2] = (step1[2]) as i16 as i64;
step2[3] = (step1[3]) as i16 as i64;
step2[4] = (step1[4]) as i16 as i64;
step2[5] = (step1[5]) as i16 as i64;
step2[6] = (step1[6]) as i16 as i64;
step2[7] = (step1[7]) as i16 as i64;
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))) as i16 as i64;
step2[15] = (wraplow(round_shift(temp2))) as i16 as i64;
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))) as i16 as i64;
step2[14] = (wraplow(round_shift(temp2))) as i16 as i64;
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))) as i16 as i64;
step2[13] = (wraplow(round_shift(temp2))) as i16 as i64;
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))) as i16 as i64;
step2[12] = (wraplow(round_shift(temp2))) as i16 as i64;
step1[0] = (step2[0]) as i16 as i64;
step1[1] = (step2[1]) as i16 as i64;
step1[2] = (step2[2]) as i16 as i64;
step1[3] = (step2[3]) as i16 as i64;
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))) as i16 as i64;
step1[7] = (wraplow(round_shift(temp2))) as i16 as i64;
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))) as i16 as i64;
step1[6] = (wraplow(round_shift(temp2))) as i16 as i64;
step1[8] = (wraplow(step2[8] + step2[9])) as i16 as i64;
step1[9] = (wraplow(step2[8] - step2[9])) as i16 as i64;
step1[10] = (wraplow(-step2[10] + step2[11])) as i16 as i64;
step1[11] = (wraplow(step2[10] + step2[11])) as i16 as i64;
step1[12] = (wraplow(step2[12] + step2[13])) as i16 as i64;
step1[13] = (wraplow(step2[12] - step2[13])) as i16 as i64;
step1[14] = (wraplow(-step2[14] + step2[15])) as i16 as i64;
step1[15] = (wraplow(step2[14] + step2[15])) as i16 as i64;
temp1 = (step1[0] + step1[1]) * COSPI_16_64;
temp2 = (step1[0] - step1[1]) * COSPI_16_64;
step2[0] = (wraplow(round_shift(temp1))) as i16 as i64;
step2[1] = (wraplow(round_shift(temp2))) as i16 as i64;
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))) as i16 as i64;
step2[3] = (wraplow(round_shift(temp2))) as i16 as i64;
step2[4] = (wraplow(step1[4] + step1[5])) as i16 as i64;
step2[5] = (wraplow(step1[4] - step1[5])) as i16 as i64;
step2[6] = (wraplow(-step1[6] + step1[7])) as i16 as i64;
step2[7] = (wraplow(step1[6] + step1[7])) as i16 as i64;
step2[8] = (step1[8]) as i16 as i64;
step2[15] = (step1[15]) as i16 as i64;
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))) as i16 as i64;
step2[14] = (wraplow(round_shift(temp2))) as i16 as i64;
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))) as i16 as i64;
step2[13] = (wraplow(round_shift(temp2))) as i16 as i64;
step2[11] = (step1[11]) as i16 as i64;
step2[12] = (step1[12]) as i16 as i64;
step1[0] = (wraplow(step2[0] + step2[3])) as i16 as i64;
step1[1] = (wraplow(step2[1] + step2[2])) as i16 as i64;
step1[2] = (wraplow(step2[1] - step2[2])) as i16 as i64;
step1[3] = (wraplow(step2[0] - step2[3])) as i16 as i64;
step1[4] = (step2[4]) as i16 as i64;
temp1 = (step2[6] - step2[5]) * COSPI_16_64;
temp2 = (step2[5] + step2[6]) * COSPI_16_64;
step1[5] = (wraplow(round_shift(temp1))) as i16 as i64;
step1[6] = (wraplow(round_shift(temp2))) as i16 as i64;
step1[7] = (step2[7]) as i16 as i64;
step1[8] = (wraplow(step2[8] + step2[11])) as i16 as i64;
step1[9] = (wraplow(step2[9] + step2[10])) as i16 as i64;
step1[10] = (wraplow(step2[9] - step2[10])) as i16 as i64;
step1[11] = (wraplow(step2[8] - step2[11])) as i16 as i64;
step1[12] = (wraplow(-step2[12] + step2[15])) as i16 as i64;
step1[13] = (wraplow(-step2[13] + step2[14])) as i16 as i64;
step1[14] = (wraplow(step2[13] + step2[14])) as i16 as i64;
step1[15] = (wraplow(step2[12] + step2[15])) as i16 as i64;
step2[0] = (wraplow(step1[0] + step1[7])) as i16 as i64;
step2[1] = (wraplow(step1[1] + step1[6])) as i16 as i64;
step2[2] = (wraplow(step1[2] + step1[5])) as i16 as i64;
step2[3] = (wraplow(step1[3] + step1[4])) as i16 as i64;
step2[4] = (wraplow(step1[3] - step1[4])) as i16 as i64;
step2[5] = (wraplow(step1[2] - step1[5])) as i16 as i64;
step2[6] = (wraplow(step1[1] - step1[6])) as i16 as i64;
step2[7] = (wraplow(step1[0] - step1[7])) as i16 as i64;
step2[8] = (step1[8]) as i16 as i64;
step2[9] = (step1[9]) as i16 as i64;
temp1 = (-step1[10] + step1[13]) * COSPI_16_64;
temp2 = (step1[10] + step1[13]) * COSPI_16_64;
step2[10] = (wraplow(round_shift(temp1))) as i16 as i64;
step2[13] = (wraplow(round_shift(temp2))) as i16 as i64;
temp1 = (-step1[11] + step1[12]) * COSPI_16_64;
temp2 = (step1[11] + step1[12]) * COSPI_16_64;
step2[11] = (wraplow(round_shift(temp1))) as i16 as i64;
step2[12] = (wraplow(round_shift(temp2))) as i16 as i64;
step2[14] = (step1[14]) as i16 as i64;
step2[15] = (step1[15]) as i16 as i64;
output[0] = (wraplow(step2[0] + step2[15])) as i32;
output[1] = (wraplow(step2[1] + step2[14])) as i32;
output[2] = (wraplow(step2[2] + step2[13])) as i32;
output[3] = (wraplow(step2[3] + step2[12])) as i32;
output[4] = (wraplow(step2[4] + step2[11])) as i32;
output[5] = (wraplow(step2[5] + step2[10])) as i32;
output[6] = (wraplow(step2[6] + step2[9])) as i32;
output[7] = (wraplow(step2[7] + step2[8])) as i32;
output[8] = (wraplow(step2[7] - step2[8])) as i32;
output[9] = (wraplow(step2[6] - step2[9])) as i32;
output[10] = (wraplow(step2[5] - step2[10])) as i32;
output[11] = (wraplow(step2[4] - step2[11])) as i32;
output[12] = (wraplow(step2[3] - step2[12])) as i32;
output[13] = (wraplow(step2[2] - step2[13])) as i32;
output[14] = (wraplow(step2[1] - step2[14])) as i32;
output[15] = (wraplow(step2[0] - step2[15])) as i32;
}
pub fn iadst16(input: &[i32], output: &mut [i32]) {
let mut s0: i64;
let mut s1: i64;
let mut s2: i64;
let mut s3: i64;
let mut s4: i64;
let mut s5: i64;
let mut s6: i64;
let mut s7: i64;
let mut s8: i64;
let mut s9: i64;
let mut s10: i64;
let mut s11: i64;
let mut s12: i64;
let mut s13: i64;
let mut s14: i64;
let mut s15: i64;
let mut x0: i64 = (input[15] as i64);
let mut x1: i64 = (input[0] as i64);
let mut x2: i64 = (input[13] as i64);
let mut x3: i64 = (input[2] as i64);
let mut x4: i64 = (input[11] as i64);
let mut x5: i64 = (input[4] as i64);
let mut x6: i64 = (input[9] as i64);
let mut x7: i64 = (input[6] as i64);
let mut x8: i64 = (input[7] as i64);
let mut x9: i64 = (input[8] as i64);
let mut x10: i64 = (input[5] as i64);
let mut x11: i64 = (input[10] as i64);
let mut x12: i64 = (input[3] as i64);
let mut x13: i64 = (input[12] as i64);
let mut x14: i64 = (input[1] as i64);
let mut x15: i64 = (input[14] as i64);
if (x0 | x1 | x2 | x3 | x4 | x5 | x6 | x7 | x8 | x9 | x10 | x11 | x12 | x13 | x14 | x15) == 0 {
output.fill(0);
return;
}
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)) as i32;
output[1] = (wraplow(-x8)) as i32;
output[2] = (wraplow(x12)) as i32;
output[3] = (wraplow(-x4)) as i32;
output[4] = (wraplow(x6)) as i32;
output[5] = (wraplow(x14)) as i32;
output[6] = (wraplow(x10)) as i32;
output[7] = (wraplow(x2)) as i32;
output[8] = (wraplow(x3)) as i32;
output[9] = (wraplow(x11)) as i32;
output[10] = (wraplow(x15)) as i32;
output[11] = (wraplow(x7)) as i32;
output[12] = (wraplow(x5)) as i32;
output[13] = (wraplow(-x13)) as i32;
output[14] = (wraplow(x9)) as i32;
output[15] = (wraplow(-x1)) as i32;
}
pub fn idct32(input: &[i32], output: &mut [i32]) {
let mut step1 = [0i64; 32];
let mut step2 = [0i64; 32];
let mut temp1: i64;
let mut temp2: i64;
step1[0] = ((input[0] as i64) as i16 as i64) as i16 as i64;
step1[1] = ((input[16] as i64) as i16 as i64) as i16 as i64;
step1[2] = ((input[8] as i64) as i16 as i64) as i16 as i64;
step1[3] = ((input[24] as i64) as i16 as i64) as i16 as i64;
step1[4] = ((input[4] as i64) as i16 as i64) as i16 as i64;
step1[5] = ((input[20] as i64) as i16 as i64) as i16 as i64;
step1[6] = ((input[12] as i64) as i16 as i64) as i16 as i64;
step1[7] = ((input[28] as i64) as i16 as i64) as i16 as i64;
step1[8] = ((input[2] as i64) as i16 as i64) as i16 as i64;
step1[9] = ((input[18] as i64) as i16 as i64) as i16 as i64;
step1[10] = ((input[10] as i64) as i16 as i64) as i16 as i64;
step1[11] = ((input[26] as i64) as i16 as i64) as i16 as i64;
step1[12] = ((input[6] as i64) as i16 as i64) as i16 as i64;
step1[13] = ((input[22] as i64) as i16 as i64) as i16 as i64;
step1[14] = ((input[14] as i64) as i16 as i64) as i16 as i64;
step1[15] = ((input[30] as i64) as i16 as i64) as i16 as i64;
temp1 = ((input[1] as i64) as i16 as i64) * COSPI_31_64
- ((input[31] as i64) as i16 as i64) * COSPI_1_64;
temp2 = ((input[1] as i64) as i16 as i64) * COSPI_1_64
+ ((input[31] as i64) as i16 as i64) * COSPI_31_64;
step1[16] = (wraplow(round_shift(temp1))) as i16 as i64;
step1[31] = (wraplow(round_shift(temp2))) as i16 as i64;
temp1 = ((input[17] as i64) as i16 as i64) * COSPI_15_64
- ((input[15] as i64) as i16 as i64) * COSPI_17_64;
temp2 = ((input[17] as i64) as i16 as i64) * COSPI_17_64
+ ((input[15] as i64) as i16 as i64) * COSPI_15_64;
step1[17] = (wraplow(round_shift(temp1))) as i16 as i64;
step1[30] = (wraplow(round_shift(temp2))) as i16 as i64;
temp1 = ((input[9] as i64) as i16 as i64) * COSPI_23_64
- ((input[23] as i64) as i16 as i64) * COSPI_9_64;
temp2 = ((input[9] as i64) as i16 as i64) * COSPI_9_64
+ ((input[23] as i64) as i16 as i64) * COSPI_23_64;
step1[18] = (wraplow(round_shift(temp1))) as i16 as i64;
step1[29] = (wraplow(round_shift(temp2))) as i16 as i64;
temp1 = ((input[25] as i64) as i16 as i64) * COSPI_7_64
- ((input[7] as i64) as i16 as i64) * COSPI_25_64;
temp2 = ((input[25] as i64) as i16 as i64) * COSPI_25_64
+ ((input[7] as i64) as i16 as i64) * COSPI_7_64;
step1[19] = (wraplow(round_shift(temp1))) as i16 as i64;
step1[28] = (wraplow(round_shift(temp2))) as i16 as i64;
temp1 = ((input[5] as i64) as i16 as i64) * COSPI_27_64
- ((input[27] as i64) as i16 as i64) * COSPI_5_64;
temp2 = ((input[5] as i64) as i16 as i64) * COSPI_5_64
+ ((input[27] as i64) as i16 as i64) * COSPI_27_64;
step1[20] = (wraplow(round_shift(temp1))) as i16 as i64;
step1[27] = (wraplow(round_shift(temp2))) as i16 as i64;
temp1 = ((input[21] as i64) as i16 as i64) * COSPI_11_64
- ((input[11] as i64) as i16 as i64) * COSPI_21_64;
temp2 = ((input[21] as i64) as i16 as i64) * COSPI_21_64
+ ((input[11] as i64) as i16 as i64) * COSPI_11_64;
step1[21] = (wraplow(round_shift(temp1))) as i16 as i64;
step1[26] = (wraplow(round_shift(temp2))) as i16 as i64;
temp1 = ((input[13] as i64) as i16 as i64) * COSPI_19_64
- ((input[19] as i64) as i16 as i64) * COSPI_13_64;
temp2 = ((input[13] as i64) as i16 as i64) * COSPI_13_64
+ ((input[19] as i64) as i16 as i64) * COSPI_19_64;
step1[22] = (wraplow(round_shift(temp1))) as i16 as i64;
step1[25] = (wraplow(round_shift(temp2))) as i16 as i64;
temp1 = ((input[29] as i64) as i16 as i64) * COSPI_3_64
- ((input[3] as i64) as i16 as i64) * COSPI_29_64;
temp2 = ((input[29] as i64) as i16 as i64) * COSPI_29_64
+ ((input[3] as i64) as i16 as i64) * COSPI_3_64;
step1[23] = (wraplow(round_shift(temp1))) as i16 as i64;
step1[24] = (wraplow(round_shift(temp2))) as i16 as i64;
step2[0] = (step1[0]) as i16 as i64;
step2[1] = (step1[1]) as i16 as i64;
step2[2] = (step1[2]) as i16 as i64;
step2[3] = (step1[3]) as i16 as i64;
step2[4] = (step1[4]) as i16 as i64;
step2[5] = (step1[5]) as i16 as i64;
step2[6] = (step1[6]) as i16 as i64;
step2[7] = (step1[7]) as i16 as i64;
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))) as i16 as i64;
step2[15] = (wraplow(round_shift(temp2))) as i16 as i64;
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))) as i16 as i64;
step2[14] = (wraplow(round_shift(temp2))) as i16 as i64;
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))) as i16 as i64;
step2[13] = (wraplow(round_shift(temp2))) as i16 as i64;
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))) as i16 as i64;
step2[12] = (wraplow(round_shift(temp2))) as i16 as i64;
step2[16] = (wraplow(step1[16] + step1[17])) as i16 as i64;
step2[17] = (wraplow(step1[16] - step1[17])) as i16 as i64;
step2[18] = (wraplow(-step1[18] + step1[19])) as i16 as i64;
step2[19] = (wraplow(step1[18] + step1[19])) as i16 as i64;
step2[20] = (wraplow(step1[20] + step1[21])) as i16 as i64;
step2[21] = (wraplow(step1[20] - step1[21])) as i16 as i64;
step2[22] = (wraplow(-step1[22] + step1[23])) as i16 as i64;
step2[23] = (wraplow(step1[22] + step1[23])) as i16 as i64;
step2[24] = (wraplow(step1[24] + step1[25])) as i16 as i64;
step2[25] = (wraplow(step1[24] - step1[25])) as i16 as i64;
step2[26] = (wraplow(-step1[26] + step1[27])) as i16 as i64;
step2[27] = (wraplow(step1[26] + step1[27])) as i16 as i64;
step2[28] = (wraplow(step1[28] + step1[29])) as i16 as i64;
step2[29] = (wraplow(step1[28] - step1[29])) as i16 as i64;
step2[30] = (wraplow(-step1[30] + step1[31])) as i16 as i64;
step2[31] = (wraplow(step1[30] + step1[31])) as i16 as i64;
step1[0] = (step2[0]) as i16 as i64;
step1[1] = (step2[1]) as i16 as i64;
step1[2] = (step2[2]) as i16 as i64;
step1[3] = (step2[3]) as i16 as i64;
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))) as i16 as i64;
step1[7] = (wraplow(round_shift(temp2))) as i16 as i64;
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))) as i16 as i64;
step1[6] = (wraplow(round_shift(temp2))) as i16 as i64;
step1[8] = (wraplow(step2[8] + step2[9])) as i16 as i64;
step1[9] = (wraplow(step2[8] - step2[9])) as i16 as i64;
step1[10] = (wraplow(-step2[10] + step2[11])) as i16 as i64;
step1[11] = (wraplow(step2[10] + step2[11])) as i16 as i64;
step1[12] = (wraplow(step2[12] + step2[13])) as i16 as i64;
step1[13] = (wraplow(step2[12] - step2[13])) as i16 as i64;
step1[14] = (wraplow(-step2[14] + step2[15])) as i16 as i64;
step1[15] = (wraplow(step2[14] + step2[15])) as i16 as i64;
step1[16] = (step2[16]) as i16 as i64;
step1[31] = (step2[31]) as i16 as i64;
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))) as i16 as i64;
step1[30] = (wraplow(round_shift(temp2))) as i16 as i64;
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))) as i16 as i64;
step1[29] = (wraplow(round_shift(temp2))) as i16 as i64;
step1[19] = (step2[19]) as i16 as i64;
step1[20] = (step2[20]) as i16 as i64;
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))) as i16 as i64;
step1[26] = (wraplow(round_shift(temp2))) as i16 as i64;
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))) as i16 as i64;
step1[25] = (wraplow(round_shift(temp2))) as i16 as i64;
step1[23] = (step2[23]) as i16 as i64;
step1[24] = (step2[24]) as i16 as i64;
step1[27] = (step2[27]) as i16 as i64;
step1[28] = (step2[28]) as i16 as i64;
temp1 = (step1[0] + step1[1]) * COSPI_16_64;
temp2 = (step1[0] - step1[1]) * COSPI_16_64;
step2[0] = (wraplow(round_shift(temp1))) as i16 as i64;
step2[1] = (wraplow(round_shift(temp2))) as i16 as i64;
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))) as i16 as i64;
step2[3] = (wraplow(round_shift(temp2))) as i16 as i64;
step2[4] = (wraplow(step1[4] + step1[5])) as i16 as i64;
step2[5] = (wraplow(step1[4] - step1[5])) as i16 as i64;
step2[6] = (wraplow(-step1[6] + step1[7])) as i16 as i64;
step2[7] = (wraplow(step1[6] + step1[7])) as i16 as i64;
step2[8] = (step1[8]) as i16 as i64;
step2[15] = (step1[15]) as i16 as i64;
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))) as i16 as i64;
step2[14] = (wraplow(round_shift(temp2))) as i16 as i64;
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))) as i16 as i64;
step2[13] = (wraplow(round_shift(temp2))) as i16 as i64;
step2[11] = (step1[11]) as i16 as i64;
step2[12] = (step1[12]) as i16 as i64;
step2[16] = (wraplow(step1[16] + step1[19])) as i16 as i64;
step2[17] = (wraplow(step1[17] + step1[18])) as i16 as i64;
step2[18] = (wraplow(step1[17] - step1[18])) as i16 as i64;
step2[19] = (wraplow(step1[16] - step1[19])) as i16 as i64;
step2[20] = (wraplow(-step1[20] + step1[23])) as i16 as i64;
step2[21] = (wraplow(-step1[21] + step1[22])) as i16 as i64;
step2[22] = (wraplow(step1[21] + step1[22])) as i16 as i64;
step2[23] = (wraplow(step1[20] + step1[23])) as i16 as i64;
step2[24] = (wraplow(step1[24] + step1[27])) as i16 as i64;
step2[25] = (wraplow(step1[25] + step1[26])) as i16 as i64;
step2[26] = (wraplow(step1[25] - step1[26])) as i16 as i64;
step2[27] = (wraplow(step1[24] - step1[27])) as i16 as i64;
step2[28] = (wraplow(-step1[28] + step1[31])) as i16 as i64;
step2[29] = (wraplow(-step1[29] + step1[30])) as i16 as i64;
step2[30] = (wraplow(step1[29] + step1[30])) as i16 as i64;
step2[31] = (wraplow(step1[28] + step1[31])) as i16 as i64;
step1[0] = (wraplow(step2[0] + step2[3])) as i16 as i64;
step1[1] = (wraplow(step2[1] + step2[2])) as i16 as i64;
step1[2] = (wraplow(step2[1] - step2[2])) as i16 as i64;
step1[3] = (wraplow(step2[0] - step2[3])) as i16 as i64;
step1[4] = (step2[4]) as i16 as i64;
temp1 = (step2[6] - step2[5]) * COSPI_16_64;
temp2 = (step2[5] + step2[6]) * COSPI_16_64;
step1[5] = (wraplow(round_shift(temp1))) as i16 as i64;
step1[6] = (wraplow(round_shift(temp2))) as i16 as i64;
step1[7] = (step2[7]) as i16 as i64;
step1[8] = (wraplow(step2[8] + step2[11])) as i16 as i64;
step1[9] = (wraplow(step2[9] + step2[10])) as i16 as i64;
step1[10] = (wraplow(step2[9] - step2[10])) as i16 as i64;
step1[11] = (wraplow(step2[8] - step2[11])) as i16 as i64;
step1[12] = (wraplow(-step2[12] + step2[15])) as i16 as i64;
step1[13] = (wraplow(-step2[13] + step2[14])) as i16 as i64;
step1[14] = (wraplow(step2[13] + step2[14])) as i16 as i64;
step1[15] = (wraplow(step2[12] + step2[15])) as i16 as i64;
step1[16] = (step2[16]) as i16 as i64;
step1[17] = (step2[17]) as i16 as i64;
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))) as i16 as i64;
step1[29] = (wraplow(round_shift(temp2))) as i16 as i64;
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))) as i16 as i64;
step1[28] = (wraplow(round_shift(temp2))) as i16 as i64;
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))) as i16 as i64;
step1[27] = (wraplow(round_shift(temp2))) as i16 as i64;
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))) as i16 as i64;
step1[26] = (wraplow(round_shift(temp2))) as i16 as i64;
step1[22] = (step2[22]) as i16 as i64;
step1[23] = (step2[23]) as i16 as i64;
step1[24] = (step2[24]) as i16 as i64;
step1[25] = (step2[25]) as i16 as i64;
step1[30] = (step2[30]) as i16 as i64;
step1[31] = (step2[31]) as i16 as i64;
step2[0] = (wraplow(step1[0] + step1[7])) as i16 as i64;
step2[1] = (wraplow(step1[1] + step1[6])) as i16 as i64;
step2[2] = (wraplow(step1[2] + step1[5])) as i16 as i64;
step2[3] = (wraplow(step1[3] + step1[4])) as i16 as i64;
step2[4] = (wraplow(step1[3] - step1[4])) as i16 as i64;
step2[5] = (wraplow(step1[2] - step1[5])) as i16 as i64;
step2[6] = (wraplow(step1[1] - step1[6])) as i16 as i64;
step2[7] = (wraplow(step1[0] - step1[7])) as i16 as i64;
step2[8] = (step1[8]) as i16 as i64;
step2[9] = (step1[9]) as i16 as i64;
temp1 = (-step1[10] + step1[13]) * COSPI_16_64;
temp2 = (step1[10] + step1[13]) * COSPI_16_64;
step2[10] = (wraplow(round_shift(temp1))) as i16 as i64;
step2[13] = (wraplow(round_shift(temp2))) as i16 as i64;
temp1 = (-step1[11] + step1[12]) * COSPI_16_64;
temp2 = (step1[11] + step1[12]) * COSPI_16_64;
step2[11] = (wraplow(round_shift(temp1))) as i16 as i64;
step2[12] = (wraplow(round_shift(temp2))) as i16 as i64;
step2[14] = (step1[14]) as i16 as i64;
step2[15] = (step1[15]) as i16 as i64;
step2[16] = (wraplow(step1[16] + step1[23])) as i16 as i64;
step2[17] = (wraplow(step1[17] + step1[22])) as i16 as i64;
step2[18] = (wraplow(step1[18] + step1[21])) as i16 as i64;
step2[19] = (wraplow(step1[19] + step1[20])) as i16 as i64;
step2[20] = (wraplow(step1[19] - step1[20])) as i16 as i64;
step2[21] = (wraplow(step1[18] - step1[21])) as i16 as i64;
step2[22] = (wraplow(step1[17] - step1[22])) as i16 as i64;
step2[23] = (wraplow(step1[16] - step1[23])) as i16 as i64;
step2[24] = (wraplow(-step1[24] + step1[31])) as i16 as i64;
step2[25] = (wraplow(-step1[25] + step1[30])) as i16 as i64;
step2[26] = (wraplow(-step1[26] + step1[29])) as i16 as i64;
step2[27] = (wraplow(-step1[27] + step1[28])) as i16 as i64;
step2[28] = (wraplow(step1[27] + step1[28])) as i16 as i64;
step2[29] = (wraplow(step1[26] + step1[29])) as i16 as i64;
step2[30] = (wraplow(step1[25] + step1[30])) as i16 as i64;
step2[31] = (wraplow(step1[24] + step1[31])) as i16 as i64;
step1[0] = (wraplow(step2[0] + step2[15])) as i16 as i64;
step1[1] = (wraplow(step2[1] + step2[14])) as i16 as i64;
step1[2] = (wraplow(step2[2] + step2[13])) as i16 as i64;
step1[3] = (wraplow(step2[3] + step2[12])) as i16 as i64;
step1[4] = (wraplow(step2[4] + step2[11])) as i16 as i64;
step1[5] = (wraplow(step2[5] + step2[10])) as i16 as i64;
step1[6] = (wraplow(step2[6] + step2[9])) as i16 as i64;
step1[7] = (wraplow(step2[7] + step2[8])) as i16 as i64;
step1[8] = (wraplow(step2[7] - step2[8])) as i16 as i64;
step1[9] = (wraplow(step2[6] - step2[9])) as i16 as i64;
step1[10] = (wraplow(step2[5] - step2[10])) as i16 as i64;
step1[11] = (wraplow(step2[4] - step2[11])) as i16 as i64;
step1[12] = (wraplow(step2[3] - step2[12])) as i16 as i64;
step1[13] = (wraplow(step2[2] - step2[13])) as i16 as i64;
step1[14] = (wraplow(step2[1] - step2[14])) as i16 as i64;
step1[15] = (wraplow(step2[0] - step2[15])) as i16 as i64;
step1[16] = (step2[16]) as i16 as i64;
step1[17] = (step2[17]) as i16 as i64;
step1[18] = (step2[18]) as i16 as i64;
step1[19] = (step2[19]) as i16 as i64;
temp1 = (-step2[20] + step2[27]) * COSPI_16_64;
temp2 = (step2[20] + step2[27]) * COSPI_16_64;
step1[20] = (wraplow(round_shift(temp1))) as i16 as i64;
step1[27] = (wraplow(round_shift(temp2))) as i16 as i64;
temp1 = (-step2[21] + step2[26]) * COSPI_16_64;
temp2 = (step2[21] + step2[26]) * COSPI_16_64;
step1[21] = (wraplow(round_shift(temp1))) as i16 as i64;
step1[26] = (wraplow(round_shift(temp2))) as i16 as i64;
temp1 = (-step2[22] + step2[25]) * COSPI_16_64;
temp2 = (step2[22] + step2[25]) * COSPI_16_64;
step1[22] = (wraplow(round_shift(temp1))) as i16 as i64;
step1[25] = (wraplow(round_shift(temp2))) as i16 as i64;
temp1 = (-step2[23] + step2[24]) * COSPI_16_64;
temp2 = (step2[23] + step2[24]) * COSPI_16_64;
step1[23] = (wraplow(round_shift(temp1))) as i16 as i64;
step1[24] = (wraplow(round_shift(temp2))) as i16 as i64;
step1[28] = (step2[28]) as i16 as i64;
step1[29] = (step2[29]) as i16 as i64;
step1[30] = (step2[30]) as i16 as i64;
step1[31] = (step2[31]) as i16 as i64;
output[0] = (wraplow(step1[0] + step1[31])) as i32;
output[1] = (wraplow(step1[1] + step1[30])) as i32;
output[2] = (wraplow(step1[2] + step1[29])) as i32;
output[3] = (wraplow(step1[3] + step1[28])) as i32;
output[4] = (wraplow(step1[4] + step1[27])) as i32;
output[5] = (wraplow(step1[5] + step1[26])) as i32;
output[6] = (wraplow(step1[6] + step1[25])) as i32;
output[7] = (wraplow(step1[7] + step1[24])) as i32;
output[8] = (wraplow(step1[8] + step1[23])) as i32;
output[9] = (wraplow(step1[9] + step1[22])) as i32;
output[10] = (wraplow(step1[10] + step1[21])) as i32;
output[11] = (wraplow(step1[11] + step1[20])) as i32;
output[12] = (wraplow(step1[12] + step1[19])) as i32;
output[13] = (wraplow(step1[13] + step1[18])) as i32;
output[14] = (wraplow(step1[14] + step1[17])) as i32;
output[15] = (wraplow(step1[15] + step1[16])) as i32;
output[16] = (wraplow(step1[15] - step1[16])) as i32;
output[17] = (wraplow(step1[14] - step1[17])) as i32;
output[18] = (wraplow(step1[13] - step1[18])) as i32;
output[19] = (wraplow(step1[12] - step1[19])) as i32;
output[20] = (wraplow(step1[11] - step1[20])) as i32;
output[21] = (wraplow(step1[10] - step1[21])) as i32;
output[22] = (wraplow(step1[9] - step1[22])) as i32;
output[23] = (wraplow(step1[8] - step1[23])) as i32;
output[24] = (wraplow(step1[7] - step1[24])) as i32;
output[25] = (wraplow(step1[6] - step1[25])) as i32;
output[26] = (wraplow(step1[5] - step1[26])) as i32;
output[27] = (wraplow(step1[4] - step1[27])) as i32;
output[28] = (wraplow(step1[3] - step1[28])) as i32;
output[29] = (wraplow(step1[2] - step1[29])) as i32;
output[30] = (wraplow(step1[1] - step1[30])) as i32;
output[31] = (wraplow(step1[0] - step1[31])) as i32;
}