| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "sabirov_s_linear_filtering_block_partitioning/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <algorithm> | ||
| 4 | #include <cstddef> | ||
| 5 | #include <cstdint> | ||
| 6 | |||
| 7 | #include "sabirov_s_linear_filtering_block_partitioning/common/include/common.hpp" | ||
| 8 | |||
| 9 | namespace sabirov_s_linear_filtering_block_partitioning { | ||
| 10 | |||
| 11 |
1/2✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
|
40 | SabirovSLinearFilteringBlockPartitioningSEQ::SabirovSLinearFilteringBlockPartitioningSEQ(const InType &in) { |
| 12 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 13 | GetInput() = in; | ||
| 14 | 40 | } | |
| 15 | |||
| 16 |
1/2✓ Branch 0 taken 40 times.
✗ Branch 1 not taken.
|
40 | bool SabirovSLinearFilteringBlockPartitioningSEQ::ValidationImpl() { |
| 17 | const auto &input = GetInput(); | ||
| 18 |
4/8✓ Branch 0 taken 40 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 40 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 40 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 40 times.
|
40 | return !input.Empty() && input.width > 0 && input.height > 0 && input.channels == 3; |
| 19 | } | ||
| 20 | |||
| 21 | 40 | bool SabirovSLinearFilteringBlockPartitioningSEQ::PreProcessingImpl() { | |
| 22 | const auto &input = GetInput(); | ||
| 23 | 40 | GetOutput() = ImageData(input.width, input.height, input.channels); | |
| 24 | 40 | return !GetOutput().Empty(); | |
| 25 | } | ||
| 26 | |||
| 27 |
1/2✓ Branch 0 taken 40 times.
✗ Branch 1 not taken.
|
40 | bool SabirovSLinearFilteringBlockPartitioningSEQ::RunImpl() { |
| 28 | const auto &input = GetInput(); | ||
| 29 | auto &output = GetOutput(); | ||
| 30 | |||
| 31 |
3/6✓ Branch 0 taken 40 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 40 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 40 times.
✗ Branch 5 not taken.
|
40 | if (input.Empty() || input.width < 3 || input.height < 3) { |
| 32 | return false; | ||
| 33 | } | ||
| 34 | |||
| 35 | const int width = input.width; | ||
| 36 | const int height = input.height; | ||
| 37 | 40 | const int channels = input.channels; | |
| 38 | |||
| 39 | // Применяем фильтр Гаусса к каждому пикселю | ||
| 40 |
2/2✓ Branch 0 taken 512 times.
✓ Branch 1 taken 40 times.
|
552 | for (int row = 0; row < height; row++) { |
| 41 |
2/2✓ Branch 0 taken 11024 times.
✓ Branch 1 taken 512 times.
|
11536 | for (int col = 0; col < width; col++) { |
| 42 |
2/2✓ Branch 0 taken 33072 times.
✓ Branch 1 taken 11024 times.
|
44096 | for (int ch = 0; ch < channels; ch++) { |
| 43 | 33072 | float sum = ApplyGaussianKernel(input, row, col, ch); | |
| 44 | 33072 | auto output_idx = | |
| 45 | 33072 | ((static_cast<std::size_t>(row) * static_cast<std::size_t>(width) + static_cast<std::size_t>(col)) * | |
| 46 | 33072 | static_cast<std::size_t>(channels)) + | |
| 47 | 33072 | static_cast<std::size_t>(ch); | |
| 48 | 33072 | output.pixels[output_idx] = static_cast<uint8_t>(std::clamp(sum, 0.0F, 255.0F)); | |
| 49 | } | ||
| 50 | } | ||
| 51 | } | ||
| 52 | |||
| 53 | return true; | ||
| 54 | } | ||
| 55 | |||
| 56 | 40 | bool SabirovSLinearFilteringBlockPartitioningSEQ::PostProcessingImpl() { | |
| 57 | 40 | return !GetOutput().Empty(); | |
| 58 | } | ||
| 59 | |||
| 60 | } // namespace sabirov_s_linear_filtering_block_partitioning | ||
| 61 |