| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "makovskiy_i_gauss_filter_vert/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <array> | ||
| 4 | #include <cstddef> | ||
| 5 | #include <task/include/task.hpp> | ||
| 6 | #include <tuple> | ||
| 7 | #include <vector> | ||
| 8 | |||
| 9 | #include "makovskiy_i_gauss_filter_vert/common/include/common.hpp" | ||
| 10 | |||
| 11 | namespace makovskiy_i_gauss_filter_vert { | ||
| 12 | |||
| 13 |
1/2✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
|
16 | GaussFilterSEQ::GaussFilterSEQ(const InType &in) { |
| 14 | InType temp(in); | ||
| 15 | this->GetInput().swap(temp); | ||
| 16 | SetTypeOfTask(ppc::task::TypeOfTask::kSEQ); | ||
| 17 | 16 | } | |
| 18 | |||
| 19 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | bool GaussFilterSEQ::ValidationImpl() { |
| 20 | const auto &[input, width, height] = GetInput(); | ||
| 21 |
4/8✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 16 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 16 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 16 times.
|
16 | return !input.empty() && width > 0 && height > 0 && input.size() == static_cast<size_t>(width) * height; |
| 22 | } | ||
| 23 | |||
| 24 | 16 | bool GaussFilterSEQ::PreProcessingImpl() { | |
| 25 | const auto &[_, width, height] = GetInput(); | ||
| 26 | 16 | GetOutput().resize(static_cast<size_t>(width) * height); | |
| 27 | 16 | return true; | |
| 28 | } | ||
| 29 | |||
| 30 | 16 | bool GaussFilterSEQ::RunImpl() { | |
| 31 | const auto &[input, width, height] = GetInput(); | ||
| 32 | auto &output = GetOutput(); | ||
| 33 | |||
| 34 | 16 | const std::array<int, 9> kernel = {1, 2, 1, 2, 4, 2, 1, 2, 1}; | |
| 35 | const int kernel_sum = 16; | ||
| 36 | |||
| 37 |
2/2✓ Branch 0 taken 56 times.
✓ Branch 1 taken 16 times.
|
72 | for (int row = 0; row < height; ++row) { |
| 38 |
2/2✓ Branch 0 taken 200 times.
✓ Branch 1 taken 56 times.
|
256 | for (int col = 0; col < width; ++col) { |
| 39 | int sum = 0; | ||
| 40 |
2/2✓ Branch 0 taken 600 times.
✓ Branch 1 taken 200 times.
|
800 | for (int k_row = -1; k_row <= 1; ++k_row) { |
| 41 |
2/2✓ Branch 0 taken 1800 times.
✓ Branch 1 taken 600 times.
|
2400 | for (int k_col = -1; k_col <= 1; ++k_col) { |
| 42 | 1800 | sum += GetPixel(input, col + k_col, row + k_row, width, height) * | |
| 43 | 1800 | kernel.at((static_cast<size_t>(k_row + 1) * 3) + static_cast<size_t>(k_col + 1)); | |
| 44 | } | ||
| 45 | } | ||
| 46 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 200 times.
|
200 | output.at((static_cast<size_t>(row) * width) + col) = sum / kernel_sum; |
| 47 | } | ||
| 48 | } | ||
| 49 | 16 | return true; | |
| 50 | } | ||
| 51 | |||
| 52 | 16 | bool GaussFilterSEQ::PostProcessingImpl() { | |
| 53 | 16 | return true; | |
| 54 | } | ||
| 55 | |||
| 56 | } // namespace makovskiy_i_gauss_filter_vert | ||
| 57 |