| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include <vector> | ||
| 4 | |||
| 5 | #include "papulina_y_gauss_filter_block/common/include/common.hpp" | ||
| 6 | #include "task/include/task.hpp" | ||
| 7 | namespace papulina_y_gauss_filter_block { | ||
| 8 | |||
| 9 | struct Block { | ||
| 10 | int my_block_rows = 0; | ||
| 11 | int my_block_cols = 0; | ||
| 12 | int expanded_rows = 0; | ||
| 13 | int expanded_cols = 0; | ||
| 14 | int start_row = 0; | ||
| 15 | int start_col = 0; | ||
| 16 | Block(int mb_rows, int mb_cols, int exp_rows, int exp_cols, int s_row, int s_col) | ||
| 17 | 124 | : my_block_rows(mb_rows), | |
| 18 | 124 | my_block_cols(mb_cols), | |
| 19 | 124 | expanded_rows(exp_rows), | |
| 20 | 124 | expanded_cols(exp_cols), | |
| 21 | 124 | start_row(s_row), | |
| 22 |
1/2✓ Branch 1 taken 31 times.
✗ Branch 2 not taken.
|
124 | start_col(s_col) {} |
| 23 | }; | ||
| 24 | |||
| 25 | class PapulinaYGaussFilterMPI : public BaseTask { | ||
| 26 | public: | ||
| 27 | static constexpr ppc::task::TypeOfTask GetStaticTypeOfTask() { | ||
| 28 | return ppc::task::TypeOfTask::kMPI; | ||
| 29 | } | ||
| 30 | explicit PapulinaYGaussFilterMPI(const InType &in); | ||
| 31 | |||
| 32 | private: | ||
| 33 | bool ValidationImpl() override; | ||
| 34 | bool PreProcessingImpl() override; | ||
| 35 | bool RunImpl() override; | ||
| 36 | bool PostProcessingImpl() override; | ||
| 37 | Picture Pic_; | ||
| 38 | int procNum_ = 0; | ||
| 39 | int height_ = 0; | ||
| 40 | int width_ = 0; | ||
| 41 | int channels_ = 0; | ||
| 42 | int overlap_ = 1; | ||
| 43 | int grid_rows_ = 0; | ||
| 44 | int grid_cols_ = 0; | ||
| 45 | int block_rows_ = 0; | ||
| 46 | int block_cols_ = 0; | ||
| 47 | int extra_rows_ = 0; | ||
| 48 | int extra_cols_ = 0; | ||
| 49 | void CalculateBlock(const Block &block, std::vector<unsigned char> &my_block); | ||
| 50 | void DataDistribution(); | ||
| 51 | void NewBlock(const Block &block, const std::vector<unsigned char> &my_block, | ||
| 52 | std::vector<unsigned char> &filtered_block) const; | ||
| 53 | void GetResult(const int &rank, const Block &block, const std::vector<unsigned char> &filtered_block); | ||
| 54 | void ExtractBlock(const Block &block, const std::vector<unsigned char> &filtered_block, | ||
| 55 | std::vector<unsigned char> &my_result) const; | ||
| 56 | void FillImage(const Block &block, const std::vector<unsigned char> &my_result, | ||
| 57 | std::vector<unsigned char> &final_image) const; | ||
| 58 | static void ClampCoordinates(int &global_i, int &global_j, int height, int width); | ||
| 59 | }; | ||
| 60 | |||
| 61 | } // namespace papulina_y_gauss_filter_block | ||
| 62 |