dct with working inverse
This commit is contained in:
+3
-4
@@ -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",
|
||||||
|
|||||||
Reference in New Issue
Block a user