| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "shemetov_d_increasing_contrast/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <algorithm> | ||
| 4 | #include <cstddef> | ||
| 5 | #include <cstdint> | ||
| 6 | |||
| 7 | #include "shemetov_d_increasing_contrast/common/include/common.hpp" | ||
| 8 | |||
| 9 | namespace shemetov_d_increasing_contrast { | ||
| 10 | |||
| 11 |
1/2✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
|
32 | IncreaseContrastTaskSEQ::IncreaseContrastTaskSEQ(const InType &in) { |
| 12 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 13 |
1/2✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
|
32 | GetInput() = in; |
| 14 |
1/2✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
|
32 | GetOutput().resize(in.size()); |
| 15 | 32 | } | |
| 16 | |||
| 17 | 32 | bool IncreaseContrastTaskSEQ::ValidationImpl() { | |
| 18 | 32 | return !GetInput().empty(); | |
| 19 | } | ||
| 20 | |||
| 21 | 32 | bool IncreaseContrastTaskSEQ::PreProcessingImpl() { | |
| 22 | 32 | GetOutput().resize(GetInput().size()); | |
| 23 | 32 | return true; | |
| 24 | } | ||
| 25 | |||
| 26 | 32 | bool IncreaseContrastTaskSEQ::RunImpl() { | |
| 27 | constexpr float kFactor = 1.3F; | ||
| 28 | |||
| 29 |
2/2✓ Branch 0 taken 2107168 times.
✓ Branch 1 taken 32 times.
|
2107200 | for (size_t i = 0; i < GetInput().size(); ++i) { |
| 30 | const Pixel &local_input = GetInput()[i]; | ||
| 31 | Pixel &local_output = GetOutput()[i]; | ||
| 32 | |||
| 33 | 2107168 | const auto m_red = static_cast<float>(local_input.channel_red) * kFactor; | |
| 34 | const auto m_green = static_cast<float>(local_input.channel_red) * kFactor; | ||
| 35 | const auto m_blue = static_cast<float>(local_input.channel_red) * kFactor; | ||
| 36 | |||
| 37 | 2107168 | local_output.channel_red = static_cast<uint8_t>(std::clamp(m_red, 0.F, 255.F)); | |
| 38 | 2107168 | local_output.channel_green = static_cast<uint8_t>(std::clamp(m_green, 0.F, 255.F)); | |
| 39 | 2107168 | local_output.channel_blue = static_cast<uint8_t>(std::clamp(m_blue, 0.F, 255.F)); | |
| 40 | } | ||
| 41 | |||
| 42 | 32 | return true; | |
| 43 | } | ||
| 44 | |||
| 45 | 32 | bool IncreaseContrastTaskSEQ::PostProcessingImpl() { | |
| 46 | 32 | return !GetOutput().empty(); | |
| 47 | } | ||
| 48 | |||
| 49 | } // namespace shemetov_d_increasing_contrast | ||
| 50 |