GCC Code Coverage Report


Directory: ./
File: tasks/lukin_i_ench_contr_lin_hist/seq/src/ops_seq.cpp
Date: 2026-04-02 17:12:27
Exec Total Coverage
Lines: 20 20 100.0%
Functions: 5 5 100.0%
Branches: 8 12 66.7%

Line Branch Exec Source
1 #include "lukin_i_ench_contr_lin_hist/seq/include/ops_seq.hpp"
2
3 #include <algorithm>
4 #include <vector>
5
6 #include "lukin_i_ench_contr_lin_hist/common/include/common.hpp"
7
8 namespace lukin_i_ench_contr_lin_hist {
9
10
1/2
✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
32 LukinITestTaskSEQ::LukinITestTaskSEQ(const InType &in) {
11 SetTypeOfTask(GetStaticTypeOfTask());
12
1/2
✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
32 GetInput() = in;
13
1/2
✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
32 GetOutput() = OutType(GetInput().size());
14 32 }
15
16 32 bool LukinITestTaskSEQ::ValidationImpl() {
17 32 return !(GetInput().empty());
18 }
19
20 32 bool LukinITestTaskSEQ::PreProcessingImpl() {
21 32 return true;
22 }
23
24
1/2
✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
32 bool LukinITestTaskSEQ::RunImpl() {
25 auto min_it = std::ranges::min_element(GetInput().begin(), GetInput().end());
26 auto max_it = std::ranges::max_element(GetInput().begin(), GetInput().end());
27
28 32 unsigned char min = *min_it;
29 32 unsigned char max = *max_it;
30
31
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 24 times.
32 if (max == min) // Однотонное изображение
32 {
33 8 GetOutput() = GetInput();
34 8 return true;
35 }
36
37 24 float scale = 255.0F / static_cast<float>(max - min);
38
39 24 int size = static_cast<int>(GetInput().size());
40
41
2/2
✓ Branch 0 taken 2752512 times.
✓ Branch 1 taken 24 times.
2752536 for (int i = 0; i < size; i++) { // Линейное растяжение
42 2752512 GetOutput()[i] = static_cast<unsigned char>(static_cast<float>(GetInput()[i] - min) * scale);
43 }
44
45 return true;
46 }
47
48 32 bool LukinITestTaskSEQ::PostProcessingImpl() {
49 32 return true;
50 }
51
52 } // namespace lukin_i_ench_contr_lin_hist
53