GCC Code Coverage Report


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

Line Branch Exec Source
1 #include "pylaeva_s_inc_contrast_img_by_lsh/seq/include/ops_seq.hpp"
2
3 #include <algorithm>
4 #include <cmath> // для std::round
5 #include <cstddef>
6 #include <cstdint>
7 #include <vector>
8
9 #include "pylaeva_s_inc_contrast_img_by_lsh/common/include/common.hpp"
10
11 namespace pylaeva_s_inc_contrast_img_by_lsh {
12
13
1/2
✓ Branch 1 taken 140 times.
✗ Branch 2 not taken.
140 PylaevaSIncContrastImgByLshSEQ::PylaevaSIncContrastImgByLshSEQ(const InType &in) {
14 SetTypeOfTask(GetStaticTypeOfTask());
15
1/2
✓ Branch 1 taken 140 times.
✗ Branch 2 not taken.
140 GetInput() = in;
16 GetOutput() = {};
17 140 }
18
19 140 bool PylaevaSIncContrastImgByLshSEQ::ValidationImpl() {
20 140 return !(GetInput().empty());
21 }
22
23 140 bool PylaevaSIncContrastImgByLshSEQ::PreProcessingImpl() {
24 140 GetOutput().resize(GetInput().size());
25 140 return true;
26 }
27
28
2/2
✓ Branch 0 taken 52 times.
✓ Branch 1 taken 88 times.
140 bool PylaevaSIncContrastImgByLshSEQ::RunImpl() {
29 const auto &input = GetInput();
30 auto &output = GetOutput();
31
32 140 auto [min_pixel, max_pixel] = std::ranges::minmax(input);
33
34
2/2
✓ Branch 0 taken 52 times.
✓ Branch 1 taken 88 times.
140 if (min_pixel == max_pixel) {
35 52 output = input;
36 52 return true;
37 }
38
39 88 float scale = 255.0F / static_cast<float>(max_pixel - min_pixel);
40
41
2/2
✓ Branch 0 taken 512 times.
✓ Branch 1 taken 88 times.
600 for (size_t i = 0; i < input.size(); ++i) {
42 512 output[i] = static_cast<uint8_t>(std::round(static_cast<float>(input[i] - min_pixel) * scale));
43 }
44
45 return true;
46 }
47
48 140 bool PylaevaSIncContrastImgByLshSEQ::PostProcessingImpl() {
49 140 return true;
50 }
51
52 } // namespace pylaeva_s_inc_contrast_img_by_lsh
53