dct with working inverse

This commit is contained in:
2024-05-05 22:45:31 +02:00
parent c61f87bdc3
commit 75dff82f0f
+3 -4
View File
@@ -76,7 +76,6 @@ impl Descriptor for DCT {
(y*v*PI/16.0).cos() (y*v*PI/16.0).cos()
} }
dct_values[k] = alpha * sum; dct_values[k] = alpha * sum;
//println!("For {u},{v} the output is {}", dct_values[k]);
//println!{"{}", dct_values[k]} //println!{"{}", dct_values[k]}
} }
} }
@@ -103,9 +102,9 @@ impl Descriptor for DCT {
((2.0 * y + 1.0) * v * PI / 16.0).cos() ((2.0 * y + 1.0) * v * PI / 16.0).cos()
} }
} }
println!("Reconstructed pixel: {}", 127 + (0.25 * sum).round() as u16); sum = 127.0 + (0.25 * sum).round();
reconstructed[k] = std::cmp::min(255_u16, 127 + (0.25 * sum).round() as u16) as u8; //println!("Reconstructed pixel: {}", sum);
//println!("{x},{y}: {}", dct_values[k]) reconstructed[k] = std::cmp::min(255_u8, sum as u8);
} }
save_buffer( save_buffer(
"reconstructed.png", "reconstructed.png",