GCC Code Coverage Report


Directory: ./
File: tasks/shemetov_d_gauss_filter_linear/seq/src/ops_seq.cpp
Date: 2026-01-27 01:59:34
Exec Total Coverage
Lines: 36 36 100.0%
Functions: 6 6 100.0%
Branches: 26 46 56.5%

Line Branch Exec Source
1 #include "shemetov_d_gauss_filter_linear/seq/include/ops_seq.hpp"
2
3 #include <algorithm>
4 #include <cstdint>
5 #include <vector>
6
7 #include "shemetov_d_gauss_filter_linear/common/include/common.hpp"
8
9 namespace shemetov_d_gauss_filter_linear {
10
11
1/2
✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
32 GaussFilterSEQ::GaussFilterSEQ(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() = in;
15 32 }
16
17 2080752 Pixel GaussFilterSEQ::ApplyKernel(const InType &in, int i, int j, const std::vector<std::vector<float>> &kernel) {
18 2080752 float channel_red = 0.F;
19 2080752 float channel_green = 0.F;
20 2080752 float channel_blue = 0.F;
21
22
2/2
✓ Branch 0 taken 6242256 times.
✓ Branch 1 taken 2080752 times.
8323008 for (int ki = -1; ki <= 1; ++ki) {
23
2/2
✓ Branch 0 taken 18726768 times.
✓ Branch 1 taken 6242256 times.
24969024 for (int kj = -1; kj <= 1; ++kj) {
24 18726768 const auto &lnk_pixel = in[i + ki][j + kj];
25 18726768 float coefficient = kernel[ki + 1][kj + 1];
26
27 18726768 channel_red += coefficient * static_cast<float>(lnk_pixel.channel_red);
28 18726768 channel_green += coefficient * static_cast<float>(lnk_pixel.channel_green);
29 18726768 channel_blue += coefficient * static_cast<float>(lnk_pixel.channel_blue);
30 }
31 }
32
33 2080752 Pixel m_pixel = {.channel_red = static_cast<uint8_t>(std::clamp(channel_red, 0.F, 255.F)),
34 2080752 .channel_green = static_cast<uint8_t>(std::clamp(channel_green, 0.F, 255.F)),
35 2080752 .channel_blue = static_cast<uint8_t>(std::clamp(channel_blue, 0.F, 255.F))};
36 2080752 return m_pixel;
37 }
38
39
1/2
✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
32 bool GaussFilterSEQ::ValidationImpl() {
40 const auto &in = GetInput();
41
2/4
✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 32 times.
32 return !in.empty() && !in[0].empty();
42 }
43
44 32 bool GaussFilterSEQ::PreProcessingImpl() {
45 32 return true;
46 }
47
48
2/2
✓ Branch 0 taken 24 times.
✓ Branch 1 taken 8 times.
32 bool GaussFilterSEQ::RunImpl() {
49 const auto &in = GetInput();
50 auto &out = GetOutput();
51
52 32 height = static_cast<int>(in.size());
53 32 width = static_cast<int>(in[0].size());
54
55
3/4
✓ Branch 0 taken 24 times.
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 24 times.
32 if (height < 3 || width < 3) {
56 8 out = in;
57 8 return true;
58 }
59
60 const std::vector<std::vector<float>> kernel = {
61
4/10
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✓ Branch 3 taken 72 times.
✓ Branch 4 taken 24 times.
✓ Branch 5 taken 72 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
96 {1.F / 16, 2.F / 16, 1.F / 16}, {2.F / 16, 4.F / 16, 2.F / 16}, {1.F / 16, 2.F / 16, 1.F / 16}};
62
63
2/2
✓ Branch 0 taken 5200 times.
✓ Branch 1 taken 24 times.
5224 for (int i = 1; i < height - 1; i++) {
64
2/2
✓ Branch 0 taken 2080752 times.
✓ Branch 1 taken 5200 times.
2085952 for (int j = 1; j < width - 1; j++) {
65 2080752 out[i][j] = ApplyKernel(in, i, j, kernel);
66 }
67 }
68
69 return true;
70
3/10
✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 24 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 24 times.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
48 }
71
72 32 bool GaussFilterSEQ::PostProcessingImpl() {
73 32 return true;
74 }
75
76 } // namespace shemetov_d_gauss_filter_linear
77