GCC Code Coverage Report


Directory: ./
File: tasks/lazareva_a_gauss_filter_horizontal/seq/src/ops_seq.cpp
Date: 2026-01-27 01:59:34
Exec Total Coverage
Lines: 28 28 100.0%
Functions: 6 6 100.0%
Branches: 24 40 60.0%

Line Branch Exec Source
1 #include "lazareva_a_gauss_filter_horizontal/seq/include/ops_seq.hpp"
2
3 #include <algorithm>
4 #include <array>
5 #include <cstddef>
6 #include <limits>
7
8 #include "lazareva_a_gauss_filter_horizontal/common/include/common.hpp"
9
10 namespace lazareva_a_gauss_filter_horizontal {
11
12 namespace {
13 11284992 int GetKernelValue(int ki, int kj) {
14 11284992 constexpr std::array<std::array<int, 3>, 3> kKernelLocal = {{{1, 2, 1}, {2, 4, 2}, {1, 2, 1}}};
15
2/4
✓ Branch 0 taken 11284992 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 11284992 times.
✗ Branch 3 not taken.
11284992 return kKernelLocal.at(ki).at(kj);
16 }
17 } // namespace
18
19
1/2
✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
40 LazarevaAGaussFilterHorizontalSEQ::LazarevaAGaussFilterHorizontalSEQ(const InType &in) {
20 SetTypeOfTask(GetStaticTypeOfTask());
21
1/2
✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
40 GetInput() = in;
22 GetOutput().clear();
23 40 }
24
25
1/2
✓ Branch 0 taken 40 times.
✗ Branch 1 not taken.
40 bool LazarevaAGaussFilterHorizontalSEQ::ValidationImpl() {
26
3/6
✗ Branch 0 not taken.
✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 40 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 40 times.
40 return (GetInput().size() >= 2) && GetOutput().empty() && (GetInput()[0] > 0) && (GetInput()[1] > 0) &&
27
2/4
✓ Branch 0 taken 40 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 40 times.
80 (GetInput()[0] <= std::numeric_limits<int>::max() / GetInput()[1]) &&
28
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 40 times.
40 (GetInput().size() == (2 + (static_cast<size_t>(GetInput()[0]) * static_cast<size_t>(GetInput()[1]))));
29 }
30
31
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 40 times.
40 bool LazarevaAGaussFilterHorizontalSEQ::PreProcessingImpl() {
32 40 height_ = GetInput()[0];
33
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 40 times.
40 width_ = GetInput()[1];
34
35 GetOutput().clear();
36 40 GetOutput().resize(static_cast<size_t>(height_) * static_cast<size_t>(width_));
37
38 40 return true;
39 }
40
41 40 bool LazarevaAGaussFilterHorizontalSEQ::RunImpl() {
42 const auto &input = GetInput();
43 auto &output = GetOutput();
44
45
2/2
✓ Branch 0 taken 5952 times.
✓ Branch 1 taken 40 times.
5992 for (int i = 0; i < height_; i++) {
46
2/2
✓ Branch 0 taken 1253888 times.
✓ Branch 1 taken 5952 times.
1259840 for (int j = 0; j < width_; j++) {
47 int sum = 0;
48
49
2/2
✓ Branch 0 taken 3761664 times.
✓ Branch 1 taken 1253888 times.
5015552 for (int ki = 0; ki < 3; ki++) {
50
2/2
✓ Branch 0 taken 11284992 times.
✓ Branch 1 taken 3761664 times.
15046656 for (int kj = 0; kj < 3; kj++) {
51 11284992 int row = std::clamp(i + ki - 1, 0, height_ - 1);
52 11284992 int col = std::clamp(j + kj - 1, 0, width_ - 1);
53
54 11284992 int pixel_value = input[2 + (row * width_) + col];
55 11284992 sum += pixel_value * GetKernelValue(ki, kj);
56 }
57 }
58
59 1253888 output[(i * width_) + j] = sum / kKernelSum;
60 }
61 }
62
63 40 return true;
64 }
65
66
1/2
✓ Branch 0 taken 40 times.
✗ Branch 1 not taken.
40 bool LazarevaAGaussFilterHorizontalSEQ::PostProcessingImpl() {
67
2/4
✓ Branch 0 taken 40 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 40 times.
40 return !GetOutput().empty() && (GetOutput().size() == (static_cast<size_t>(height_) * static_cast<size_t>(width_)));
68 }
69
70 } // namespace lazareva_a_gauss_filter_horizontal
71