GCC Code Coverage Report


Directory: ./
File: tasks/klimenko_v_lsh_contrast_incr/seq/src/ops_seq.cpp
Date: 2026-04-02 17:12:27
Exec Total Coverage
Lines: 17 19 89.5%
Functions: 5 5 100.0%
Branches: 7 12 58.3%

Line Branch Exec Source
1 #include "klimenko_v_lsh_contrast_incr/seq/include/ops_seq.hpp"
2
3 #include <algorithm>
4 #include <cstddef>
5 #include <vector>
6
7 #include "klimenko_v_lsh_contrast_incr/common/include/common.hpp"
8
9 namespace klimenko_v_lsh_contrast_incr {
10
11
1/2
✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
24 KlimenkoVLSHContrastIncrSEQ::KlimenkoVLSHContrastIncrSEQ(const InType &in) {
12 SetTypeOfTask(GetStaticTypeOfTask());
13
1/2
✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
24 GetInput() = in;
14 24 }
15
16 24 bool KlimenkoVLSHContrastIncrSEQ::ValidationImpl() {
17 24 return !GetInput().empty();
18 }
19
20 24 bool KlimenkoVLSHContrastIncrSEQ::PreProcessingImpl() {
21 24 GetOutput().resize(GetInput().size());
22 24 return true;
23 }
24
25
1/2
✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
24 bool KlimenkoVLSHContrastIncrSEQ::RunImpl() {
26 const auto &input = GetInput();
27 auto &output = GetOutput();
28
29
1/2
✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
24 if (input.empty()) {
30 return false;
31 }
32
33 auto minmax = std::ranges::minmax_element(input);
34 24 int min_val = *minmax.min;
35 24 int max_val = *minmax.max;
36
37
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 24 times.
24 if (max_val == min_val) {
38 output = input;
39 return true;
40 }
41
42
2/2
✓ Branch 0 taken 24 times.
✓ Branch 1 taken 10368 times.
10392 for (size_t i = 0; i < input.size(); ++i) {
43 10368 output[i] = ((input[i] - min_val) * 255) / (max_val - min_val);
44 }
45
46 return true;
47 }
48
49 24 bool KlimenkoVLSHContrastIncrSEQ::PostProcessingImpl() {
50 24 return GetOutput().size() == GetInput().size();
51 }
52
53 } // namespace klimenko_v_lsh_contrast_incr
54