mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-26 04:12:34 +00:00
cargo fmt
This commit is contained in:
@@ -57,9 +57,9 @@ impl DataBlock {
|
|||||||
|
|
||||||
// First count the total number of data blocks
|
// First count the total number of data blocks
|
||||||
let ecBlockArray = ecBlocks.getECBlocks();
|
let ecBlockArray = ecBlocks.getECBlocks();
|
||||||
let totalBlocks = ecBlockArray.iter().fold(0, |acc, ecBlock| {
|
let totalBlocks = ecBlockArray
|
||||||
acc + ecBlock.getCount() as usize
|
.iter()
|
||||||
});
|
.fold(0, |acc, ecBlock| acc + ecBlock.getCount() as usize);
|
||||||
|
|
||||||
// Now establish DataBlocks of the appropriate size and number of data codewords
|
// Now establish DataBlocks of the appropriate size and number of data codewords
|
||||||
let mut result = Vec::with_capacity(totalBlocks);
|
let mut result = Vec::with_capacity(totalBlocks);
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ fn decode_bitmatrix_parser_with_hints(
|
|||||||
let dataBlocks = DataBlock::getDataBlocks(&codewords, version, ecLevel)?;
|
let dataBlocks = DataBlock::getDataBlocks(&codewords, version, ecLevel)?;
|
||||||
|
|
||||||
// Count total number of data bytes
|
// Count total number of data bytes
|
||||||
let totalBytes = dataBlocks.iter().fold(0, |acc,dataBlock| {
|
let totalBytes = dataBlocks.iter().fold(0, |acc, dataBlock| {
|
||||||
acc + dataBlock.getNumDataCodewords() as usize
|
acc + dataBlock.getNumDataCodewords() as usize
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -686,8 +686,8 @@ impl FinderPatternFinder {
|
|||||||
// vary too much. We arbitrarily say that when the total deviation from average exceeds
|
// vary too much. We arbitrarily say that when the total deviation from average exceeds
|
||||||
// 5% of the total module size estimates, it's too much.
|
// 5% of the total module size estimates, it's too much.
|
||||||
let average = totalModuleSize / max as f32;
|
let average = totalModuleSize / max as f32;
|
||||||
let totalDeviation = self.possibleCenters.iter().fold(0.0, |acc, pattern| {
|
let totalDeviation = self.possibleCenters.iter().fold(0.0, |acc, pattern| {
|
||||||
acc + (pattern.getEstimatedModuleSize() - average).abs()
|
acc + (pattern.getEstimatedModuleSize() - average).abs()
|
||||||
});
|
});
|
||||||
|
|
||||||
totalDeviation <= 0.05 * totalModuleSize
|
totalDeviation <= 0.05 * totalModuleSize
|
||||||
|
|||||||
Reference in New Issue
Block a user