diff --git a/src/beauty/beauty-demo.cpp b/src/beauty/beauty-demo.cpp index ec665abe1..c7cb6b764 100644 --- a/src/beauty/beauty-demo.cpp +++ b/src/beauty/beauty-demo.cpp @@ -17,7 +17,7 @@ constexpr bool OFFSCREEN = false; constexpr int VA_HW_DEVICE_INDEX = 0; constexpr unsigned long DIAG = hypot(double(WIDTH), double(HEIGHT)); -constexpr int BLUR_KERNEL_SIZE = DIAG / 413 % 2 == 0 ? DIAG / 413 + 1 : DIAG / 413; +constexpr int BLUR_KERNEL_SIZE = std::max(int(DIAG / 413 % 2 == 0 ? DIAG / 413 + 1 : DIAG / 413), 1); using std::cerr; using std::endl; diff --git a/src/optflow/optflow-demo.cpp b/src/optflow/optflow-demo.cpp index 42eb01802..b3b778a12 100644 --- a/src/optflow/optflow-demo.cpp +++ b/src/optflow/optflow-demo.cpp @@ -36,7 +36,7 @@ constexpr float POINT_LOSS = 25; // of tracked points and therefor is usually much smaller. constexpr int MAX_STROKE = 17; // Intensity of glow defined by kernel size. The default scales with the image diagonal. -constexpr int GLOW_KERNEL_SIZE = DIAG / 138 % 2 == 0 ? DIAG / 138 + 1 : DIAG / 138; +constexpr int GLOW_KERNEL_SIZE = std::max(int(DIAG / 138 % 2 == 0 ? DIAG / 138 + 1 : DIAG / 138), 1); //hue, saturation, lightness and alpha all from 0 to 255 const cv::Scalar EFFECT_COLOR(26, 255, 153, 7); diff --git a/src/tetra/tetra-demo.cpp b/src/tetra/tetra-demo.cpp index b3c30568e..0371b8626 100644 --- a/src/tetra/tetra-demo.cpp +++ b/src/tetra/tetra-demo.cpp @@ -10,7 +10,7 @@ constexpr const char* OUTPUT_FILENAME = "tetra-demo.mkv"; constexpr const int VA_HW_DEVICE_INDEX = 0; constexpr unsigned long DIAG = hypot(double(WIDTH), double(HEIGHT)); -constexpr int GLOW_KERNEL_SIZE = DIAG / 138 % 2 == 0 ? DIAG / 138 + 1 : DIAG / 138; +constexpr int GLOW_KERNEL_SIZE = std::max(int(DIAG / 138 % 2 == 0 ? DIAG / 138 + 1 : DIAG / 138), 1); using std::cerr; using std::endl; diff --git a/src/video/video-demo.cpp b/src/video/video-demo.cpp index ecfa4631a..828369a9b 100644 --- a/src/video/video-demo.cpp +++ b/src/video/video-demo.cpp @@ -10,8 +10,7 @@ constexpr bool OFFSCREEN = false; constexpr const char *OUTPUT_FILENAME = "video-demo.mkv"; constexpr unsigned long DIAG = hypot(double(WIDTH), double(HEIGHT)); -constexpr int GLOW_KERNEL_SIZE = DIAG / 138 % 2 == 0 ? DIAG / 138 + 1 : DIAG / 138; - +constexpr int GLOW_KERNEL_SIZE = std::max(int(DIAG / 138 % 2 == 0 ? DIAG / 138 + 1 : DIAG / 138), 1); using std::cerr; using std::endl;