Satisfy clippy on the reference tone curve's data
One sample of the ACR3 table is 0.70711, which clippy reads as an approximation of 1/sqrt(2). It is the curve's published value, so the lint is allowed on the table with that reason rather than the number replaced. And the pair-count check uses is_multiple_of.
This commit is contained in:
@@ -21,7 +21,12 @@
|
||||
pub const TONE_SAMPLES: usize = 1025;
|
||||
|
||||
/// The ACR3 default tone curve, linear in, linear out.
|
||||
///
|
||||
/// `approx_constant` is allowed because one sample is 0.70711, which clippy
|
||||
/// takes for an approximation of 1/√2. It is a measured value of the curve,
|
||||
/// copied as published; replacing it with the constant would change it.
|
||||
#[rustfmt::skip]
|
||||
#[allow(clippy::approx_constant)]
|
||||
pub const ACR3_DEFAULT: [f32; TONE_SAMPLES] = [
|
||||
0.00000, 0.00078, 0.00160, 0.00242, 0.00314, 0.00385, 0.00460, 0.00539,
|
||||
0.00623, 0.00712, 0.00806, 0.00906, 0.01012, 0.01122, 0.01238, 0.01359,
|
||||
@@ -163,7 +168,7 @@ pub const ACR3_DEFAULT: [f32; TONE_SAMPLES] = [
|
||||
/// x not increasing, values outside `[0, 1]`) or describe the identity,
|
||||
/// which RawTherapee also treats as no curve.
|
||||
pub fn resample_tone_curve(pairs: &[f32]) -> Option<Vec<f32>> {
|
||||
if pairs.len() < 4 || pairs.len() % 2 != 0 {
|
||||
if pairs.len() < 4 || !pairs.len().is_multiple_of(2) {
|
||||
return None;
|
||||
}
|
||||
let xs: Vec<f64> = pairs.iter().step_by(2).map(|&v| f64::from(v)).collect();
|
||||
|
||||
Reference in New Issue
Block a user