(imageData, candidates)
| 397 | } |
| 398 | |
| 399 | validateCandidates(imageData, candidates) { |
| 400 | let bestCandidate = { blockSize: 1, confidence: 0 }; |
| 401 | |
| 402 | for (const candidate of candidates) { |
| 403 | const confidence = this.validateBlockSize(imageData, candidate.size); |
| 404 | |
| 405 | if (confidence > bestCandidate.confidence) { |
| 406 | bestCandidate = { |
| 407 | blockSize: candidate.size, |
| 408 | confidence: confidence * candidate.confidence |
| 409 | }; |
| 410 | } |
| 411 | } |
| 412 | |
| 413 | return bestCandidate; |
| 414 | } |
| 415 | |
| 416 | validateBlockSize(imageData, blockSize) { |
| 417 | const { data, width, height } = imageData; |
no test coverage detected