]> git.seodisparate.com - blue_noise_generation/commitdiff
Some fixes, progress with grayscale blue-noise
authorStephen Seo <seo.disparate@gmail.com>
Wed, 6 Oct 2021 09:22:31 +0000 (18:22 +0900)
committerStephen Seo <seo.disparate@gmail.com>
Wed, 6 Oct 2021 09:22:31 +0000 (18:22 +0900)
src/blue_noise.cpp

index 3a2ba18d3f511ace9ae5311a044808a17e53dc9a..bb30f31365f6fad75c0d1cd504c952ed25af87f0 100644 (file)
@@ -110,9 +110,13 @@ image::Bl dither::blue_noise_grayscale(int width, int height, int threads) {
     std::vector<float> image = internal::random_noise_grayscale(count);
 
     int iterations = 0;
-    int filter_size = (width + height) / 4;
+    int filter_size = (width + height) / 2;
     std::vector<float> precomputed(internal::precompute_gaussian(filter_size));
 
+    int min, max;
+    float tempPixel;
+    int prevmin = -1;
+    int prevmax = -1;
     while(true) {
         printf("Iteration %d\n", iterations);
 
@@ -121,10 +125,6 @@ image::Bl dither::blue_noise_grayscale(int width, int height, int threads) {
                                            filter_size, filter_out,
                                            &precomputed, threads);
 
-        int min, max;
-        float tempPixel;
-        int prevmin = -1;
-        int prevmax = -1;
         std::tie(min, max) = internal::filter_minmax(filter_out);
         printf("min == %4d, max == %4d\n", min, max);
         tempPixel = image[max];