diff mbox series

[FFmpeg-devel] lavfi/vf_ssim360: Fix compilation with MSVC

Message ID 20230128162033.198838-1-martin@martin.st
State Accepted
Commit c0cf2c47864bde4db155909e77436008654fef27
Headers show
Series [FFmpeg-devel] lavfi/vf_ssim360: Fix compilation with MSVC | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Martin Storsjö Jan. 28, 2023, 4:20 p.m. UTC
Don't use "static const" for compile time float constants, but use
defines. This fixes the following error:

src/libavfilter/vf_ssim360.c(549): error C2099: initializer is not a constant

Signed-off-by: Martin Storsjö <martin@martin.st>
---
 libavfilter/vf_ssim360.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Martin Storsjö Jan. 28, 2023, 4:54 p.m. UTC | #1
On Sat, 28 Jan 2023, Martin Storsjö wrote:

> Don't use "static const" for compile time float constants, but use
> defines. This fixes the following error:
>
> src/libavfilter/vf_ssim360.c(549): error C2099: initializer is not a constant
>
> Signed-off-by: Martin Storsjö <martin@martin.st>
> ---
> libavfilter/vf_ssim360.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/libavfilter/vf_ssim360.c b/libavfilter/vf_ssim360.c
> index 0990db0ed5..a0bf73da1e 100644
> --- a/libavfilter/vf_ssim360.c
> +++ b/libavfilter/vf_ssim360.c
> @@ -72,11 +72,11 @@
>
> #define DEFAULT_EXPANSION_COEF 1.01f
>
> -static const float BARREL_THETA_RANGE   = DEFAULT_EXPANSION_COEF *  2.0f * M_PI_F;
> -static const float BARREL_PHI_RANGE     = DEFAULT_EXPANSION_COEF *  M_PI_2_F;
> +#define BARREL_THETA_RANGE (DEFAULT_EXPANSION_COEF *  2.0f * M_PI_F)
> +#define BARREL_PHI_RANGE   (DEFAULT_EXPANSION_COEF *  M_PI_2_F)
>
> // Use fixed-point with 16 bit precision for fast bilinear math
> -static const int   FIXED_POINT_PRECISION = 16;
> +#define FIXED_POINT_PRECISION 16
>
> // Use 1MB per channel for the histogram to get 5-digit precise SSIM value
> #define SSIM360_HIST_SIZE 131072
> -- 
> 2.34.1

OK'd by Anton on irc, pushed.

// Martin
diff mbox series

Patch

diff --git a/libavfilter/vf_ssim360.c b/libavfilter/vf_ssim360.c
index 0990db0ed5..a0bf73da1e 100644
--- a/libavfilter/vf_ssim360.c
+++ b/libavfilter/vf_ssim360.c
@@ -72,11 +72,11 @@ 
 
 #define DEFAULT_EXPANSION_COEF 1.01f
 
-static const float BARREL_THETA_RANGE   = DEFAULT_EXPANSION_COEF *  2.0f * M_PI_F;
-static const float BARREL_PHI_RANGE     = DEFAULT_EXPANSION_COEF *  M_PI_2_F;
+#define BARREL_THETA_RANGE (DEFAULT_EXPANSION_COEF *  2.0f * M_PI_F)
+#define BARREL_PHI_RANGE   (DEFAULT_EXPANSION_COEF *  M_PI_2_F)
 
 // Use fixed-point with 16 bit precision for fast bilinear math
-static const int   FIXED_POINT_PRECISION = 16;
+#define FIXED_POINT_PRECISION 16
 
 // Use 1MB per channel for the histogram to get 5-digit precise SSIM value
 #define SSIM360_HIST_SIZE 131072