stage: clippy fix and gate dxo_edge_reader

This commit is contained in:
Henry Schimke
2024-02-07 13:28:56 -06:00
parent 76e8998f4b
commit 888efeb93f
13 changed files with 27 additions and 23 deletions

View File

@@ -205,7 +205,7 @@ impl<B: Binarizer> BinaryBitmap<B> {
}
pub fn get_source(&self) -> &B::Source {
&self.binarizer.get_luminance_source()
self.binarizer.get_luminance_source()
}
pub fn get_binarizer(&self) -> &B {

View File

@@ -320,12 +320,12 @@ fn test_xor_2() {
match i {
1 => assert_eq!(array_1.getBitArray(), &[0b1]),
2 => assert_eq!(array_1.getBitArray(), &[0b10]),
3 => assert_eq!(array_1.getBitArray(), &[0b10_1]),
3 => assert_eq!(array_1.getBitArray(), &[0b101]),
4 => assert_eq!(array_1.getBitArray(), &[0b10_10]),
5 => assert_eq!(array_1.getBitArray(), &[0b10_10_1]),
5 => assert_eq!(array_1.getBitArray(), &[0b1_0101]),
6 => assert_eq!(array_1.getBitArray(), &[0b10_10_11]),
7..=24 => assert_eq!(array_1.getBitArray(), &[0b10_10_11 << (i - 6)], "{i}"),
_ => assert_eq!(array_1.getBitArray(), &[0b10_10_11 << i - 6, 0], "{i}"),
_ => assert_eq!(array_1.getBitArray(), &[0b10_10_11 << (i - 6), 0], "{i}"),
}
}
}

View File

@@ -40,7 +40,7 @@ impl<LS: LuminanceSource> AdaptiveThresholdBinarizer<LS> {
};
let filtered_iamge =
imageproc::contrast::adaptive_threshold(&image_buffer, self.radius.into());
imageproc::contrast::adaptive_threshold(&image_buffer, self.radius);
let dynamic_filtered = DynamicImage::from(filtered_iamge);
@@ -79,7 +79,7 @@ impl<LS: LuminanceSource> Binarizer for AdaptiveThresholdBinarizer<LS> {
Self: Sized,
{
Self {
source: source,
source,
matrix: OnceCell::new(),
radius: self.radius,
}

View File

@@ -76,10 +76,10 @@ impl BitMatrix {
Ok(Self {
width,
height,
row_size: ((width as usize + BASE_BITS - 1) / BASE_BITS) as usize,
row_size: ((width as usize + BASE_BITS - 1) / BASE_BITS),
bits: vec![
0;
(((width as usize + BASE_BITS - 1) / BASE_BITS) * height as usize) as usize
((width as usize + BASE_BITS - 1) / BASE_BITS) * height as usize
],
})
// this.width = width;

View File

@@ -1,4 +1,4 @@
use crate::common::cpp_essentials::PatternRow;
use crate::common::BitMatrix;
use crate::common::Result;
use crate::point_f;

View File

@@ -1,5 +1,5 @@
use std::iter::Sum;
use std::ops::Shl;
use crate::common::Result;
use crate::qrcode::cpp_port::detector::AppendBit;
@@ -80,10 +80,10 @@ pub fn ToInt(a: &[u32]) -> Option<u32> {
let mut pattern = 0;
for (i, element) in a.iter().copied().enumerate() {
// for (int i = 0; i < Size(a); i++)
pattern = (pattern << element) | !(0xffffffff << element) * (!i & 1) as u32;
pattern = (pattern << element) | (!(0xffffffff << element) * (!i & 1) as u32);
}
return Some(pattern);
Some(pattern)
}
pub fn ToIntPos(
@@ -94,7 +94,7 @@ pub fn ToIntPos(
// assert(0 <= count && count <= 8 * (int)sizeof(T));
// assert(0 <= pos && pos + count <= bits.size());
let count = std::cmp::min(count as usize, bits.len());
let count = std::cmp::min(count, bits.len());
let mut res = 0;
for bit in bits.iter().skip(pos).take(count) {
AppendBit(&mut res, bit == &0);
@@ -103,5 +103,5 @@ pub fn ToIntPos(
// for (int i = 0; i < count; ++i, ++it)
// {AppendBit(res, *it);}
return Some(res as u32);
Some(res as u32)
}

View File

@@ -40,7 +40,7 @@ impl LuminanceSource for Luma8LuminanceSource {
.chunks_exact(self.original_dimension.0 as usize)
.skip(self.origin.1 as usize)
.fold(Vec::default(), |mut acc, e| {
acc.push(e[self.origin.0 as usize + x as usize]);
acc.push(e[self.origin.0 as usize + x]);
acc
})
.iter()

View File

@@ -1143,7 +1143,7 @@ mod detector_test {
.read_to_string(&mut expected_result)
.unwrap();
let detection = super::detect(&bitmatrix, true).unwrap();
let detection = super::detect(bitmatrix, true).unwrap();
// let i: image::DynamicImage = detection.getBits().into();
// i.save("dbgfle-transformed.png")

View File

@@ -17,6 +17,7 @@
use std::collections::{HashMap, HashSet};
use crate::common::Result;
#[cfg(feature="experimental_features")]
use crate::oned::cpp::ODReader;
use crate::qrcode::cpp_port::QrReader;
use crate::{
@@ -195,6 +196,7 @@ impl MultiFormatReader {
BarcodeFormat::MAXICODE => {
MaxiCodeReader::default().decode_with_hints(image, &self.hints)
}
#[cfg(feature="experimental_features")]
BarcodeFormat::DXFilmEdge => {
ODReader::new(&self.hints).decode_with_hints(image, &self.hints)
}
@@ -234,6 +236,7 @@ impl MultiFormatReader {
if let Ok(res) = MaxiCodeReader::default().decode_with_hints(image, &self.hints) {
return Ok(res);
}
#[cfg(feature="experimental_features")]
if let Ok(res) = ODReader::new(&self.hints).decode_with_hints(image, &self.hints) {
return Ok(res);
}

View File

@@ -94,4 +94,5 @@ pub use upc_e_writer::*;
mod telepen_common;
#[cfg(feature = "experimental_features")]
pub mod cpp;

View File

@@ -42,7 +42,7 @@ pub struct AI013x0x1xDecoder<'a> {
impl AI01weightDecoder for AI013x0x1xDecoder<'_> {
fn addWeightCode(&self, buf: &mut String, weight: u32) {
buf.push('(');
buf.push_str(&self.firstAIdigits);
buf.push_str(self.firstAIdigits);
buf.push_str(&(weight / 100000).to_string());
buf.push(')');
}
@@ -108,7 +108,7 @@ impl<'a> AI013x0x1xDecoder<'_> {
}
buf.push('(');
buf.push_str(&self.dateCode);
buf.push_str(self.dateCode);
buf.push(')');
let day = numericDate % 32;

View File

@@ -259,7 +259,7 @@ impl LuminanceSource for PlanarYUVLuminanceSource {
row
}
fn get_column(&self, x: usize) -> Vec<u8> {
fn get_column(&self, _x: usize) -> Vec<u8> {
unimplemented!()
}
@@ -332,7 +332,7 @@ impl LuminanceSource for PlanarYUVLuminanceSource {
self.invert = !self.invert;
}
fn get_luma8_point(&self, x: usize, y: usize) -> u8 {
fn get_luma8_point(&self, _x: usize, _y: usize) -> u8 {
unimplemented!()
}
}

View File

@@ -60,7 +60,7 @@ impl LuminanceSource for RGBLuminanceSource {
row
}
fn get_column(&self, x: usize) -> Vec<u8> {
fn get_column(&self, _x: usize) -> Vec<u8> {
unimplemented!()
}
@@ -131,9 +131,9 @@ impl LuminanceSource for RGBLuminanceSource {
}
fn get_luma8_point(&self, x: usize, y: usize) -> u8 {
let width = self.get_width();
let _width = self.get_width();
let row_offset = (y + self.top) * self.dataWidth + self.left;
let col_offset = (x + self.left);
let col_offset = x + self.left;
self.luminances[row_offset + col_offset]
}