Skip to content

Commit 1434058

Browse files
committed
CRLF
1 parent d030f46 commit 1434058

File tree

229 files changed

+41046
-41046
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

229 files changed

+41046
-41046
lines changed

SerialPrograms/Source/CommonFramework/ErrorReports/ErrorReports.cpp

Lines changed: 428 additions & 428 deletions
Large diffs are not rendered by default.
Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
/* Program Dumper
2-
*
3-
* From: https://github.com/PokemonAutomation/
4-
*
5-
*/
6-
7-
#include "Common/Compiler.h"
8-
#include "ProgramDumper.h"
9-
10-
11-
#if _WIN32 && _MSC_VER
12-
#include "ProgramDumper_Windows.tpp"
13-
14-
#else
15-
namespace PokemonAutomation{
16-
void setup_crash_handler(){
17-
// Not supported
18-
}
19-
bool program_dump(Logger* logger, const std::string& filename){
20-
return false;
21-
}
22-
}
23-
#endif
1+
/* Program Dumper
2+
*
3+
* From: https://github.com/PokemonAutomation/
4+
*
5+
*/
6+
7+
#include "Common/Compiler.h"
8+
#include "ProgramDumper.h"
9+
10+
11+
#if _WIN32 && _MSC_VER
12+
#include "ProgramDumper_Windows.tpp"
13+
14+
#else
15+
namespace PokemonAutomation{
16+
void setup_crash_handler(){
17+
// Not supported
18+
}
19+
bool program_dump(Logger* logger, const std::string& filename){
20+
return false;
21+
}
22+
}
23+
#endif
Lines changed: 115 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -1,115 +1,115 @@
1-
/* Image Diff
2-
*
3-
* From: https://github.com/PokemonAutomation/
4-
*
5-
*/
6-
7-
#include <cmath>
8-
#include "Common/Compiler.h"
9-
#include "Common/Cpp/Exceptions.h"
10-
#include "Kernels/ImageStats/Kernels_ImagePixelSumSqr.h"
11-
#include "Kernels/ImageStats/Kernels_ImagePixelSumSqrDev.h"
12-
#include "Kernels/ImageScaleBrightness/Kernels_ImageScaleBrightness.h"
13-
#include "CommonFramework/ImageTypes/ImageViewRGB32.h"
14-
#include "CommonFramework/ImageTypes/ImageRGB32.h"
15-
#include "ImageDiff.h"
16-
17-
#include <iostream>
18-
using std::cout;
19-
using std::endl;
20-
21-
namespace PokemonAutomation{
22-
namespace ImageMatch{
23-
24-
25-
FloatPixel pixel_average(const ImageViewRGB32& image, const ImageViewRGB32& alpha_mask){
26-
if (!image){
27-
throw InternalProgramError(nullptr, PA_CURRENT_FUNCTION, "Invalid Dimensions");
28-
}
29-
if (image.width() != alpha_mask.width() || image.height() != alpha_mask.height()){
30-
throw InternalProgramError(nullptr, PA_CURRENT_FUNCTION, "Mismatching Dimensions");
31-
}
32-
Kernels::PixelSums sums;
33-
Kernels::pixel_sum_sqr(
34-
sums, image.width(), image.height(),
35-
image.data(), image.bytes_per_row(),
36-
alpha_mask.data(), alpha_mask.bytes_per_row()
37-
);
38-
39-
FloatPixel sum((double)sums.sumR, (double)sums.sumG, (double)sums.sumB);
40-
sum /= (double)sums.count;
41-
return sum;
42-
}
43-
44-
45-
46-
void scale_brightness(ImageRGB32& image, const FloatPixel& multiplier){
47-
Kernels::scale_brightness(
48-
image.width(), image.height(),
49-
image.data(), image.bytes_per_row(),
50-
(float)multiplier.r, (float)multiplier.g, (float)multiplier.b
51-
);
52-
}
53-
54-
55-
56-
double pixel_RMSD(const ImageViewRGB32& reference, const ImageViewRGB32& image){
57-
if (!image){
58-
// throw InternalProgramError(nullptr, PA_CURRENT_FUNCTION, "Invalid Dimensions");
59-
return 765; // Max possible deviation.
60-
}
61-
if (reference.width() != image.width() || reference.height() != image.height()){
62-
throw InternalProgramError(nullptr, PA_CURRENT_FUNCTION, "Mismatching Dimensions");
63-
}
64-
uint64_t count = 0;
65-
uint64_t sumsqrs = 0;
66-
Kernels::sum_sqr_deviation(
67-
count, sumsqrs,
68-
reference.width(), reference.height(),
69-
reference.data(), reference.bytes_per_row(),
70-
image.data(), image.bytes_per_row()
71-
);
72-
return std::sqrt((double)sumsqrs / (double)count);
73-
}
74-
double pixel_RMSD(const ImageViewRGB32& reference, const ImageViewRGB32& image, Color background){
75-
if (!image){
76-
// throw InternalProgramError(nullptr, PA_CURRENT_FUNCTION, "Invalid Dimensions");
77-
return 765; // Max possible deviation.
78-
}
79-
if (reference.width() != image.width() || reference.height() != image.height()){
80-
throw InternalProgramError(nullptr, PA_CURRENT_FUNCTION, "Mismatching Dimensions");
81-
}
82-
uint64_t count = 0;
83-
uint64_t sumsqrs = 0;
84-
Kernels::sum_sqr_deviation(
85-
count, sumsqrs,
86-
reference.width(), reference.height(),
87-
reference.data(), reference.bytes_per_row(),
88-
image.data(), image.bytes_per_row(),
89-
(uint32_t)background
90-
);
91-
return std::sqrt((double)sumsqrs / (double)count);
92-
}
93-
double pixel_RMSD_masked(const ImageViewRGB32& reference, const ImageViewRGB32& image){
94-
if (!image){
95-
// throw InternalProgramError(nullptr, PA_CURRENT_FUNCTION, "Invalid Dimensions");
96-
return 765; // Max possible deviation.
97-
}
98-
if (reference.width() != image.width() || reference.height() != image.height()){
99-
throw InternalProgramError(nullptr, PA_CURRENT_FUNCTION, "Mismatching Dimensions");
100-
}
101-
uint64_t count = 0;
102-
uint64_t sumsqrs = 0;
103-
Kernels::sum_sqr_deviation_masked(
104-
count, sumsqrs,
105-
reference.width(), reference.height(),
106-
reference.data(), reference.bytes_per_row(),
107-
image.data(), image.bytes_per_row()
108-
);
109-
return std::sqrt((double)sumsqrs / (double)count);
110-
}
111-
112-
113-
114-
}
115-
}
1+
/* Image Diff
2+
*
3+
* From: https://github.com/PokemonAutomation/
4+
*
5+
*/
6+
7+
#include <cmath>
8+
#include "Common/Compiler.h"
9+
#include "Common/Cpp/Exceptions.h"
10+
#include "Kernels/ImageStats/Kernels_ImagePixelSumSqr.h"
11+
#include "Kernels/ImageStats/Kernels_ImagePixelSumSqrDev.h"
12+
#include "Kernels/ImageScaleBrightness/Kernels_ImageScaleBrightness.h"
13+
#include "CommonFramework/ImageTypes/ImageViewRGB32.h"
14+
#include "CommonFramework/ImageTypes/ImageRGB32.h"
15+
#include "ImageDiff.h"
16+
17+
#include <iostream>
18+
using std::cout;
19+
using std::endl;
20+
21+
namespace PokemonAutomation{
22+
namespace ImageMatch{
23+
24+
25+
FloatPixel pixel_average(const ImageViewRGB32& image, const ImageViewRGB32& alpha_mask){
26+
if (!image){
27+
throw InternalProgramError(nullptr, PA_CURRENT_FUNCTION, "Invalid Dimensions");
28+
}
29+
if (image.width() != alpha_mask.width() || image.height() != alpha_mask.height()){
30+
throw InternalProgramError(nullptr, PA_CURRENT_FUNCTION, "Mismatching Dimensions");
31+
}
32+
Kernels::PixelSums sums;
33+
Kernels::pixel_sum_sqr(
34+
sums, image.width(), image.height(),
35+
image.data(), image.bytes_per_row(),
36+
alpha_mask.data(), alpha_mask.bytes_per_row()
37+
);
38+
39+
FloatPixel sum((double)sums.sumR, (double)sums.sumG, (double)sums.sumB);
40+
sum /= (double)sums.count;
41+
return sum;
42+
}
43+
44+
45+
46+
void scale_brightness(ImageRGB32& image, const FloatPixel& multiplier){
47+
Kernels::scale_brightness(
48+
image.width(), image.height(),
49+
image.data(), image.bytes_per_row(),
50+
(float)multiplier.r, (float)multiplier.g, (float)multiplier.b
51+
);
52+
}
53+
54+
55+
56+
double pixel_RMSD(const ImageViewRGB32& reference, const ImageViewRGB32& image){
57+
if (!image){
58+
// throw InternalProgramError(nullptr, PA_CURRENT_FUNCTION, "Invalid Dimensions");
59+
return 765; // Max possible deviation.
60+
}
61+
if (reference.width() != image.width() || reference.height() != image.height()){
62+
throw InternalProgramError(nullptr, PA_CURRENT_FUNCTION, "Mismatching Dimensions");
63+
}
64+
uint64_t count = 0;
65+
uint64_t sumsqrs = 0;
66+
Kernels::sum_sqr_deviation(
67+
count, sumsqrs,
68+
reference.width(), reference.height(),
69+
reference.data(), reference.bytes_per_row(),
70+
image.data(), image.bytes_per_row()
71+
);
72+
return std::sqrt((double)sumsqrs / (double)count);
73+
}
74+
double pixel_RMSD(const ImageViewRGB32& reference, const ImageViewRGB32& image, Color background){
75+
if (!image){
76+
// throw InternalProgramError(nullptr, PA_CURRENT_FUNCTION, "Invalid Dimensions");
77+
return 765; // Max possible deviation.
78+
}
79+
if (reference.width() != image.width() || reference.height() != image.height()){
80+
throw InternalProgramError(nullptr, PA_CURRENT_FUNCTION, "Mismatching Dimensions");
81+
}
82+
uint64_t count = 0;
83+
uint64_t sumsqrs = 0;
84+
Kernels::sum_sqr_deviation(
85+
count, sumsqrs,
86+
reference.width(), reference.height(),
87+
reference.data(), reference.bytes_per_row(),
88+
image.data(), image.bytes_per_row(),
89+
(uint32_t)background
90+
);
91+
return std::sqrt((double)sumsqrs / (double)count);
92+
}
93+
double pixel_RMSD_masked(const ImageViewRGB32& reference, const ImageViewRGB32& image){
94+
if (!image){
95+
// throw InternalProgramError(nullptr, PA_CURRENT_FUNCTION, "Invalid Dimensions");
96+
return 765; // Max possible deviation.
97+
}
98+
if (reference.width() != image.width() || reference.height() != image.height()){
99+
throw InternalProgramError(nullptr, PA_CURRENT_FUNCTION, "Mismatching Dimensions");
100+
}
101+
uint64_t count = 0;
102+
uint64_t sumsqrs = 0;
103+
Kernels::sum_sqr_deviation_masked(
104+
count, sumsqrs,
105+
reference.width(), reference.height(),
106+
reference.data(), reference.bytes_per_row(),
107+
image.data(), image.bytes_per_row()
108+
);
109+
return std::sqrt((double)sumsqrs / (double)count);
110+
}
111+
112+
113+
114+
}
115+
}

0 commit comments

Comments
 (0)