-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsequential_solution.cuh
45 lines (27 loc) · 1.59 KB
/
sequential_solution.cuh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#pragma once
#include "solution.cuh"
namespace SequentialFunction {
void convolution(const int32_t *input, uint32_t inputWidth, uint32_t inputHeight, const int32_t *filter, uint32_t filterSize, int32_t *output);
void convertToGray(uchar3 *input, uint32_t width, uint32_t height, int32_t *output);
void addAbs(int32_t *input_1, int32_t *input_2, uint32_t inputWidth, uint32_t inputHeight, int32_t *output);
void createCumulativeEnergyMap(int32_t *input, uint32_t inputWidth, uint32_t inputHeight, int32_t *output);
void findSeamCurve(int32_t *input, uint32_t inputWidth, uint32_t inputHeight, uint32_t *output);
int findMinIndex(const int32_t *arr, uint32_t size);
void copyARow(const int32_t *input, uint32_t width, uint32_t rowIdx, int32_t *output);
void copyARowAndRemove(uchar3 *input, uint32_t width, uint32_t rowIdx, int32_t removedIdx, uchar3 *output);
void reduce(uchar3 *input, uint32_t width, uint32_t height, uint32_t *path, uchar3 *output);
}
class SequentialSolution : public BaseSolution {
private:
static const uint32_t FILTER_SIZE = 3;
static const int32_t SOBEL_X[9];
static const int32_t SOBEL_Y[9];
protected:
static IntImage calculateSeamMap(const IntImage &inputImage);
static IntImage convertToGrayScale(const PnmImage &inputImage);
static IntImage calculateEnergyMap(const IntImage &inputImage);
static PnmImage deleteSeam(const PnmImage &inputImage, uint32_t *seam);
static void extractSeam(const IntImage &energyMap, uint32_t *seam);
public:
PnmImage run(const PnmImage &inputImage, int argc, char **argv) override;
};