Skip to content

Commit

Permalink
Get happy on Windows (benchmark includes)
Browse files Browse the repository at this point in the history
  • Loading branch information
sudara committed Nov 12, 2023
1 parent ab9654d commit a8c8575
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 55 deletions.
85 changes: 44 additions & 41 deletions benchmarks/benchmarks.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
#include "catch2/benchmark/catch_benchmark.hpp"
#include "catch2/catch_approx.hpp"
#include "catch2/catch_test_macros.hpp"
#include "../melatonin/implementations/all.h"
#include "melatonin/implementations/gin.h"
#include "juce_graphics/juce_graphics.h"
#include "melatonin_blur/melatonin_blur.h"
#include "../melatonin/implementations/naive.h"
#include "../melatonin/implementations/float_vector_stack_blur.h"

// other benchmarks
#include "single_channel.cpp"
#include "argb.cpp"
#include "drop_shadow.cpp"
Expand All @@ -27,26 +30,26 @@ TEST_CASE ("Melatonin Blur Benchmarks Misc")
return color;
};

BENCHMARK ("Naive")
{
melatonin::stackBlur::circularBufferSingleChannel (image, 10);
auto color = data.getPixelColour (20, 20);
return color;
};

BENCHMARK ("With Martin Optimization")
{
melatonin::stackBlur::martinOptimizationSingleChannel (image, 10);
auto color = data.getPixelColour (20, 20);
return color;
};

BENCHMARK ("templated float w/ martin")
{
melatonin::stackBlur::templatedFloatSingleChannel (image, 10);
auto color = data.getPixelColour (20, 20);
return color;
};
// BENCHMARK ("Naive")
// {
// melatonin::stackBlur::circularBufferSingleChannel (image, 10);
// auto color = data.getPixelColour (20, 20);
// return color;
// };
//
// BENCHMARK ("With Martin Optimization")
// {
// melatonin::stackBlur::martinOptimizationSingleChannel (image, 10);
// auto color = data.getPixelColour (20, 20);
// return color;
// };
//
// BENCHMARK ("templated float w/ martin")
// {
// melatonin::stackBlur::templatedFloatSingleChannel (image, 10);
// auto color = data.getPixelColour (20, 20);
// return color;
// };
}

SECTION ("martin optimization 50x50px black on 100x100px white with 10px blur")
Expand All @@ -57,25 +60,25 @@ TEST_CASE ("Melatonin Blur Benchmarks Misc")
g.drawRect (50, 50, 50, 50);
juce::Image::BitmapData data (image, juce::Image::BitmapData::readOnly);

BENCHMARK ("Naive")
{
melatonin::stackBlur::circularBufferSingleChannel (image, 10);
auto color = data.getPixelColour (20, 20);
return color;
};

BENCHMARK ("With Martin Optimization")
{
melatonin::stackBlur::martinOptimizationSingleChannel (image, 10);
auto color = data.getPixelColour (20, 20);
return color;
};

BENCHMARK ("templated float w/ martin")
{
melatonin::stackBlur::templatedFloatSingleChannel (image, 10);
auto color = data.getPixelColour (20, 20);
return color;
};
// BENCHMARK ("Naive")
// {
// melatonin::stackBlur::circularBufferSingleChannel (image, 10);
// auto color = data.getPixelColour (20, 20);
// return color;
// };
//
// BENCHMARK ("With Martin Optimization")
// {
// melatonin::stackBlur::martinOptimizationSingleChannel (image, 10);
// auto color = data.getPixelColour (20, 20);
// return color;
// };
//
// BENCHMARK ("templated float w/ martin")
// {
// melatonin::stackBlur::templatedFloatSingleChannel (image, 10);
// auto color = data.getPixelColour (20, 20);
// return color;
// };
}
}
26 changes: 13 additions & 13 deletions benchmarks/single_channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,19 @@ TEST_CASE ("Melatonin Blur Single Channel Benchmarks")
// return color;
// };

BENCHMARK ("templated function float")
{
melatonin::stackBlur::templatedFloatSingleChannel (image, radius);
auto color = data.getPixelColour (dimension - radius, dimension - radius);
return color;
};

BENCHMARK ("melatonin vector")
{
melatonin::stackBlur::vectorSingleChannel (image, radius);
auto color = data.getPixelColour (dimension - radius, dimension - radius);
return color;
};
// BENCHMARK ("templated function float")
// {
// melatonin::stackBlur::templatedFloatSingleChannel (image, radius);
// auto color = data.getPixelColour (dimension - radius, dimension - radius);
// return color;
// };
//
// BENCHMARK ("melatonin vector")
// {
// melatonin::stackBlur::vectorSingleChannel (image, radius);
// auto color = data.getPixelColour (dimension - radius, dimension - radius);
// return color;
// };
// BENCHMARK ("vector class")
// {
// melatonin::VectorStackBlur stackBlur (image, radius);
Expand Down
2 changes: 1 addition & 1 deletion melatonin_blur.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#if RUN_MELATONIN_TESTS
#include "benchmarks/benchmarks.cpp"
#include "tests/correctness.cpp"
#include "tests/blur_implementations.cpp"
#include "tests/drop_shadow.cpp"
#include "tests/inner_shadow.cpp"
#endif

0 comments on commit a8c8575

Please sign in to comment.