OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
Mask.h
Go to the documentation of this file.
1#ifndef MSLANG_MASK_H
2#define MSLANG_MASK_H
3
4#include "Utilities/MSLang.h"
6
7namespace mslang {
8 struct Mask: public Function {
9 static bool parse_detail(iterator &it, const iterator &end, Function* &fun);
10 virtual void print(int ident);
11 virtual void apply(std::vector<std::shared_ptr<Base> > &bfuncs);
12
13 std::vector<Rectangle> pixels_m;
14
15 private:
16
17 struct IntPoint {
18 IntPoint(int x, int y):
19 x_m(x),
20 y_m(y)
21 { }
22
23 int x_m;
24 int y_m;
25 };
26
27 typedef std::pair<IntPoint, IntPoint> IntPixel_t;
28
29 std::vector<IntPixel_t> minimizeNumberOfRectangles(std::vector<bool> pixels,
30 unsigned int height,
31 unsigned int width);
32
33 std::pair<IntPoint, IntPoint> findMaximalRectangle(const std::vector<bool> &pixels,
34 unsigned int height,
35 unsigned int width) const;
36
37 unsigned int computeArea(const IntPoint &ll, const IntPoint &ur) const;
38
39 void updateCache(const std::vector<bool> &pixels, std::vector<unsigned int> &cache, unsigned int y) const;
40 };
41}
42
43#endif
PartBunchBase< T, Dim >::ConstIterator end(PartBunchBase< T, Dim > const &bunch)
std::string::iterator iterator
Definition: MSLang.h:16
virtual void apply(std::vector< std::shared_ptr< Base > > &bfuncs)
Definition: Mask.cpp:190
virtual void print(int ident)
Definition: Mask.cpp:186
std::vector< IntPixel_t > minimizeNumberOfRectangles(std::vector< bool > pixels, unsigned int height, unsigned int width)
Definition: Mask.cpp:81
std::pair< IntPoint, IntPoint > findMaximalRectangle(const std::vector< bool > &pixels, unsigned int height, unsigned int width) const
Definition: Mask.cpp:29
static bool parse_detail(iterator &it, const iterator &end, Function *&fun)
Definition: Mask.cpp:120
unsigned int computeArea(const IntPoint &ll, const IntPoint &ur) const
Definition: Mask.cpp:22
std::pair< IntPoint, IntPoint > IntPixel_t
Definition: Mask.h:27
void updateCache(const std::vector< bool > &pixels, std::vector< unsigned int > &cache, unsigned int y) const
Definition: Mask.cpp:10
std::vector< Rectangle > pixels_m
Definition: Mask.h:13
IntPoint(int x, int y)
Definition: Mask.h:18