From 503822eb20df75207700289da728762cb63e8ed8 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Thu, 27 Oct 2016 09:11:26 +0530 Subject: [PATCH] Explicitly define float constants as float With MSVC, this gives the following warning: warning C4305: 'function': truncation from 'double' to 'gfloat' Apparently, MSVC does not figure out what type to use for constants based on the assignment. This warning is very spammy, so let's try to fix it. --- ext/gl/gstgltransformation.c | 2 +- gst-libs/gst/gl/gstglcolorconvert.c | 32 ++++++++++++++--------------- gst-libs/gst/gl/gstglviewconvert.c | 12 +++++------ 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/ext/gl/gstgltransformation.c b/ext/gl/gstgltransformation.c index a4df30414a..1fcf902464 100644 --- a/ext/gl/gstgltransformation.c +++ b/ext/gl/gstgltransformation.c @@ -251,7 +251,7 @@ gst_gl_transformation_init (GstGLTransformation * filter) filter->shader = NULL; filter->fov = 90; filter->aspect = 1.0; - filter->znear = 0.1; + filter->znear = 0.1f; filter->zfar = 100; filter->xscale = 1.0; diff --git a/gst-libs/gst/gl/gstglcolorconvert.c b/gst-libs/gst/gl/gstglcolorconvert.c index e9eb88a2e1..908a53eccf 100644 --- a/gst-libs/gst/gl/gstglcolorconvert.c +++ b/gst-libs/gst/gl/gstglcolorconvert.c @@ -69,19 +69,19 @@ static gboolean _do_convert_draw (GstGLContext * context, * Y = [16..235] (of 255) * Cb/Cr = [16..240] (of 255) */ -static const gfloat from_yuv_bt601_offset[] = {-0.0625, -0.5, -0.5}; -static const gfloat from_yuv_bt601_rcoeff[] = {1.164, 0.000, 1.596}; -static const gfloat from_yuv_bt601_gcoeff[] = {1.164,-0.391,-0.813}; -static const gfloat from_yuv_bt601_bcoeff[] = {1.164, 2.018, 0.000}; +static const gfloat from_yuv_bt601_offset[] = {-0.0625f, -0.5f, -0.5f}; +static const gfloat from_yuv_bt601_rcoeff[] = {1.164f, 0.000f, 1.596f}; +static const gfloat from_yuv_bt601_gcoeff[] = {1.164f,-0.391f,-0.813f}; +static const gfloat from_yuv_bt601_bcoeff[] = {1.164f, 2.018f, 0.000f}; /* BT. 709 standard with the following ranges: * Y = [16..235] (of 255) * Cb/Cr = [16..240] (of 255) */ -static const gfloat from_yuv_bt709_offset[] = {-0.0625, -0.5, -0.5}; -static const gfloat from_yuv_bt709_rcoeff[] = {1.164, 0.000, 1.787}; -static const gfloat from_yuv_bt709_gcoeff[] = {1.164,-0.213,-0.531}; -static const gfloat from_yuv_bt709_bcoeff[] = {1.164,2.112, 0.000}; +static const gfloat from_yuv_bt709_offset[] = {-0.0625f, -0.5f, -0.5f}; +static const gfloat from_yuv_bt709_rcoeff[] = {1.164f, 0.000f, 1.787f}; +static const gfloat from_yuv_bt709_gcoeff[] = {1.164f,-0.213f,-0.531f}; +static const gfloat from_yuv_bt709_bcoeff[] = {1.164f,2.112f, 0.000f}; #define RGB_TO_YUV_COEFFICIENTS \ "uniform vec3 offset;\n" \ @@ -94,19 +94,19 @@ static const gfloat from_yuv_bt709_bcoeff[] = {1.164,2.112, 0.000}; * Y = [16..235] (of 255) * Cb/Cr = [16..240] (of 255) */ -static const gfloat from_rgb_bt601_offset[] = {0.0625, 0.5, 0.5}; -static const gfloat from_rgb_bt601_ycoeff[] = {0.256816, 0.504154, 0.0979137}; -static const gfloat from_rgb_bt601_ucoeff[] = {-0.148246, -0.29102, 0.439266}; -static const gfloat from_rgb_bt601_vcoeff[] = {0.439271, -0.367833, -0.071438}; +static const gfloat from_rgb_bt601_offset[] = {0.0625f, 0.5f, 0.5f}; +static const gfloat from_rgb_bt601_ycoeff[] = {0.256816f, 0.504154f, 0.0979137f}; +static const gfloat from_rgb_bt601_ucoeff[] = {-0.148246f, -0.29102f, 0.439266f}; +static const gfloat from_rgb_bt601_vcoeff[] = {0.439271f, -0.367833f, -0.071438f}; /* BT. 709 standard with the following ranges: * Y = [16..235] (of 255) * Cb/Cr = [16..240] (of 255) */ -static const gfloat from_rgb_bt709_offset[] = {0.0625, 0.5, 0.5}; -static const gfloat from_rgb_bt709_ycoeff[] = { 0.182604, 0.614526, 0.061976 }; -static const gfloat from_rgb_bt709_ucoeff[] = { -0.100640, -0.338688, 0.439327 }; -static const gfloat from_rgb_bt709_vcoeff[] = { 0.440654, -0.400285, -0.040370 }; +static const gfloat from_rgb_bt709_offset[] = {0.0625f, 0.5f, 0.5f}; +static const gfloat from_rgb_bt709_ycoeff[] = {0.182604f, 0.614526f, 0.061976f}; +static const gfloat from_rgb_bt709_ucoeff[] = {-0.100640f, -0.338688f, 0.439327f}; +static const gfloat from_rgb_bt709_vcoeff[] = {0.440654f, -0.400285f, -0.040370f}; /* GRAY16 to RGB conversion * data transfered as GL_LUMINANCE_ALPHA then convert back to GRAY16 diff --git a/gst-libs/gst/gl/gstglviewconvert.c b/gst-libs/gst/gl/gstglviewconvert.c index c409e3a662..5fa06eb738 100644 --- a/gst-libs/gst/gl/gstglviewconvert.c +++ b/gst-libs/gst/gl/gstglviewconvert.c @@ -132,17 +132,17 @@ gst_gl_stereo_downmix_mode_get_type (void) /* These match the order and number of DOWNMIX_ANAGLYPH_* modes */ static GLfloat downmix_matrices[][2][9] = { { /* Green-Magenta Dubois */ - {-0.062, 0.284, -0.015, -0.158, 0.668, -0.027, -0.039, 0.143, 0.021}, - {0.529, -0.016, 0.009, 0.705, -0.015, 0.075, 0.024, -0.065, 0.937} + {-0.062f, 0.284f, -0.015f, -0.158f, 0.668f, -0.027f, -0.039f, 0.143f, 0.021f}, + {0.529f, -0.016f, 0.009f, 0.705f, -0.015f, 0.075f, 0.024f, -0.065f, 0.937f} }, { /* Red-Cyan Dubois */ /* Source of this matrix: http://www.site.uottawa.ca/~edubois/anaglyph/LeastSquaresHowToPhotoshop.pdf */ - {0.437, -0.062, -0.048, 0.449, -0.062, -0.050, 0.164, -0.024, -0.017}, - {-0.011, 0.377, -0.026, -0.032, 0.761, -0.093, -0.007, 0.009, 1.234} + {0.437f, -0.062f, -0.048f, 0.449f, -0.062f, -0.050f, 0.164f, -0.024f, -0.017f}, + {-0.011f, 0.377f, -0.026f, -0.032f, 0.761f, -0.093f, -0.007f, 0.009f, 1.234f} }, { /* Amber-blue Dubois */ - {1.062, -0.026, -0.038, -0.205, 0.908, -0.173, 0.299, 0.068, 0.022}, - {-0.016, 0.006, 0.094, -0.123, 0.062, 0.185, -0.017, -0.017, 0.911} + {1.062f, -0.026f, -0.038f, -0.205f, 0.908f, -0.173f, 0.299f, 0.068f, 0.022f}, + {-0.016f, 0.006f, 0.094f, -0.123f, 0.062f, 0.185f, -0.017f, -0.017f, 0.911f} } };