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.
This commit is contained in:
Nirbheek Chauhan 2016-10-27 09:11:26 +05:30
parent 83df90ed6c
commit f790863755
10 changed files with 41 additions and 41 deletions

View file

@ -198,7 +198,7 @@ enum
/* Default values for properties */
#define DEFAULT_MAX_BUFFERING_TIME 30 /* in seconds */
#define DEFAULT_BANDWIDTH_USAGE 0.8 /* 0 to 1 */
#define DEFAULT_BANDWIDTH_USAGE 0.8f /* 0 to 1 */
#define DEFAULT_MAX_BITRATE 0 /* in bit/s */
#define DEFAULT_MAX_VIDEO_WIDTH 0
#define DEFAULT_MAX_VIDEO_HEIGHT 0

View file

@ -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;

View file

@ -133,7 +133,7 @@ GST_DEBUG_CATEGORY (adaptivedemux_debug);
#define MAX_DOWNLOAD_ERROR_COUNT 3
#define DEFAULT_FAILED_COUNT 3
#define DEFAULT_CONNECTION_SPEED 0
#define DEFAULT_BITRATE_LIMIT 0.8
#define DEFAULT_BITRATE_LIMIT 0.8f
#define SRC_QUEUE_MAX_BYTES 20 * 1024 * 1024 /* For safety. Large enough to hold a segment. */
#define NUM_LOOKBACK_FRAGMENTS 3

View file

@ -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

View file

@ -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}
}
};

View file

@ -1442,7 +1442,7 @@ gst_field_analysis_process_buffer (GstFieldAnalysis * filter,
/* compare the fields within the buffer, if the buffer exhibits combing it
* could be interlaced or a mixed telecine frame */
res0->f = filter->same_frame (filter, &history);
res0->t = res0->b = res0->t_b = res0->b_t = G_MAXINT64;
res0->t = res0->b = res0->t_b = res0->b_t = G_MAXFLOAT;
if (filter->nframes == 1)
GST_DEBUG_OBJECT (filter, "Scores: f %f, t , b , t_b , b_t ", res0->f);
if (res0->f <= filter->frame_thresh) {

View file

@ -181,7 +181,7 @@ freeverb_allpass_init (freeverb_allpass * allpass)
gfloat *buf = allpass->buffer;
for (i = 0; i < len; i++) {
buf[i] = DC_OFFSET; /* this is not 100 % correct. */
buf[i] = (gfloat) DC_OFFSET; /* this is not 100 % correct. */
}
}
@ -246,7 +246,7 @@ freeverb_comb_init (freeverb_comb * comb)
gfloat *buf = comb->buffer;
for (i = 0; i < len; i++) {
buf[i] = DC_OFFSET; /* This is not 100 % correct. */
buf[i] = (gfloat) DC_OFFSET; /* This is not 100 % correct. */
}
}
@ -406,7 +406,7 @@ gst_freeverb_class_init (GstFreeverbClass * klass)
G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_DAMPING,
g_param_spec_float ("damping", "Damping", "Damping of high frequencies",
0.0, 1.0, 0.2,
0.0, 1.0, 0.2f,
G_PARAM_CONSTRUCT | G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE |
G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_PAN_WIDTH,
@ -720,8 +720,8 @@ gst_freeverb_transform_m2s_int (GstFreeverb * filter,
}
/* Remove the DC offset */
out_l1 -= DC_OFFSET;
out_r1 -= DC_OFFSET;
out_l1 -= (gfloat) DC_OFFSET;
out_r1 -= (gfloat) DC_OFFSET;
/* Calculate output */
out_l2 = out_l1 * priv->wet1 + out_r1 * priv->wet2 + input_2 * priv->dry;
@ -767,8 +767,8 @@ gst_freeverb_transform_s2s_int (GstFreeverb * filter,
}
/* Remove the DC offset */
out_l1 -= DC_OFFSET;
out_r1 -= DC_OFFSET;
out_l1 -= (gfloat) DC_OFFSET;
out_r1 -= (gfloat) DC_OFFSET;
/* Calculate output */
out_l2 = out_l1 * priv->wet1 + out_r1 * priv->wet2 + input_2l * priv->dry;
@ -816,8 +816,8 @@ gst_freeverb_transform_m2s_float (GstFreeverb * filter,
}
/* Remove the DC offset */
out_l1 -= DC_OFFSET;
out_r1 -= DC_OFFSET;
out_l1 -= (gfloat) DC_OFFSET;
out_r1 -= (gfloat) DC_OFFSET;
/* Calculate output */
out_l2 = out_l1 * priv->wet1 + out_r1 * priv->wet2 + input_2 * priv->dry;
@ -861,8 +861,8 @@ gst_freeverb_transform_s2s_float (GstFreeverb * filter,
}
/* Remove the DC offset */
out_l1 -= DC_OFFSET;
out_r1 -= DC_OFFSET;
out_l1 -= (gfloat) DC_OFFSET;
out_r1 -= (gfloat) DC_OFFSET;
/* Calculate output */
out_l2 = out_l1 * priv->wet1 + out_r1 * priv->wet2 + input_2l * priv->dry;

View file

@ -178,7 +178,7 @@ gst_gaussianblur_set_info (GstVideoFilter * filter, GstCaps * incaps,
static void
gst_gaussianblur_init (GstGaussianBlur * gb)
{
gb->sigma = DEFAULT_SIGMA;
gb->sigma = (gfloat) DEFAULT_SIGMA;
gb->cur_sigma = -1.0;
}

View file

@ -390,7 +390,7 @@ gst_speed_class_init (GstSpeedClass * klass)
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_SPEED,
g_param_spec_float ("speed", "speed", "speed",
0.1, 40.0, 1.0,
0.1f, 40.0, 1.0,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS));
gst_element_class_set_static_metadata (gstelement_class, "Speed",

View file

@ -102,7 +102,7 @@ gst_stereo_class_init (GstStereoClass * klass)
g_object_class_install_property (gobject_class, PROP_STEREO,
g_param_spec_float ("stereo", "stereo", "stereo",
0.0, 1.0, 0.1,
0.0, 1.0, 0.1f,
G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
trans_class->transform_ip = GST_DEBUG_FUNCPTR (gst_stereo_transform_ip);
@ -112,7 +112,7 @@ static void
gst_stereo_init (GstStereo * stereo)
{
stereo->active = TRUE;
stereo->stereo = 0.1;
stereo->stereo = 0.1f;
}
static GstFlowReturn