| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "shkenev_i_linear_stretching_histogram_increase_contr/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <algorithm> | ||
| 4 | #include <cstddef> | ||
| 5 | #include <vector> | ||
| 6 | |||
| 7 | #include "shkenev_i_linear_stretching_histogram_increase_contr/common/include/common.hpp" | ||
| 8 | |||
| 9 | namespace shkenev_i_linear_stretching_histogram_increase_contr { | ||
| 10 | |||
| 11 |
1/2✓ Branch 1 taken 88 times.
✗ Branch 2 not taken.
|
88 | ShkenevIlinerStretchingHistIncreaseContrSEQ::ShkenevIlinerStretchingHistIncreaseContrSEQ(const InType &in) { |
| 12 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 13 |
1/2✓ Branch 1 taken 88 times.
✗ Branch 2 not taken.
|
88 | GetInput() = in; |
| 14 | 88 | } | |
| 15 | |||
| 16 |
2/2✓ Branch 0 taken 80 times.
✓ Branch 1 taken 8 times.
|
88 | bool ShkenevIlinerStretchingHistIncreaseContrSEQ::ValidationImpl() { |
| 17 |
2/2✓ Branch 0 taken 80 times.
✓ Branch 1 taken 8 times.
|
88 | if (GetInput().empty()) { |
| 18 | return true; | ||
| 19 | } | ||
| 20 | |||
| 21 |
7/14✗ Branch 0 not taken.
✓ Branch 1 taken 12016 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 12016 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 12016 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 12016 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 24 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 40 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 56 times.
|
12216 | return std::all_of(GetInput().begin(), GetInput().end(), [](int val) { return val >= 0 && val <= 255; }); |
| 22 | } | ||
| 23 | |||
| 24 | 88 | bool ShkenevIlinerStretchingHistIncreaseContrSEQ::PreProcessingImpl() { | |
| 25 | 88 | GetOutput().resize(GetInput().size()); | |
| 26 | 88 | return true; | |
| 27 | } | ||
| 28 | |||
| 29 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 80 times.
|
88 | bool ShkenevIlinerStretchingHistIncreaseContrSEQ::RunImpl() { |
| 30 | const auto &input = GetInput(); | ||
| 31 | auto &output = GetOutput(); | ||
| 32 | |||
| 33 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 80 times.
|
88 | if (input.empty()) { |
| 34 | output.clear(); | ||
| 35 | 8 | return true; | |
| 36 | } | ||
| 37 | |||
| 38 | auto min_it = std::ranges::min_element(input); | ||
| 39 | auto max_it = std::ranges::max_element(input); | ||
| 40 | 80 | int min_val = *min_it; | |
| 41 | 80 | int max_val = *max_it; | |
| 42 | |||
| 43 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 16 times.
|
80 | if (max_val > min_val) { |
| 44 | 64 | int range = max_val - min_val; | |
| 45 |
2/2✓ Branch 0 taken 48136 times.
✓ Branch 1 taken 64 times.
|
48200 | for (size_t i = 0; i < input.size(); ++i) { |
| 46 | 48136 | output[i] = (input[i] - min_val) * 255 / range; | |
| 47 | } | ||
| 48 | } else { | ||
| 49 | 16 | output = input; | |
| 50 | } | ||
| 51 | |||
| 52 | return true; | ||
| 53 | } | ||
| 54 | |||
| 55 | 88 | bool ShkenevIlinerStretchingHistIncreaseContrSEQ::PostProcessingImpl() { | |
| 56 | 88 | return true; | |
| 57 | } | ||
| 58 | |||
| 59 | } // namespace shkenev_i_linear_stretching_histogram_increase_contr | ||
| 60 |