Only reconstruct on debug
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
use image::{save_buffer, GenericImageView};
|
use image::{save_buffer, GenericImageView};
|
||||||
use std::f64::consts::{PI, SQRT_2};
|
use std::f64::consts::{PI, SQRT_2};
|
||||||
use crate::descriptors::{Descriptor, DCT, print_matrix};
|
use crate::descriptors::{Descriptor, DCT, print_matrix};
|
||||||
use log::debug;
|
use log::{debug, log_enabled, Level};
|
||||||
|
|
||||||
|
|
||||||
impl DCT {
|
impl DCT {
|
||||||
@@ -114,6 +114,7 @@ impl Descriptor for DCT {
|
|||||||
}
|
}
|
||||||
debug!("DCT-coefficients, quantized:\n {}", print_matrix(dct_values));
|
debug!("DCT-coefficients, quantized:\n {}", print_matrix(dct_values));
|
||||||
|
|
||||||
|
if log_enabled!(Level::Debug) {
|
||||||
// De-quantization:
|
// De-quantization:
|
||||||
for i in 0..64 {
|
for i in 0..64 {
|
||||||
dct_values[i] = dct_values[i] * self.quantization_matrix[i] as f64;
|
dct_values[i] = dct_values[i] * self.quantization_matrix[i] as f64;
|
||||||
@@ -131,6 +132,7 @@ impl Descriptor for DCT {
|
|||||||
8,
|
8,
|
||||||
image::ColorType::L8
|
image::ColorType::L8
|
||||||
).expect("Error saving buffer");
|
).expect("Error saving buffer");
|
||||||
|
}
|
||||||
|
|
||||||
// Calculating descriptor from dct values:
|
// Calculating descriptor from dct values:
|
||||||
let mut mask: u64 = 0;
|
let mut mask: u64 = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user