From 4c716539ad2a9cf361b076a9b811aa24f7b874cb Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 2 Jun 2014 01:00:15 +0200 Subject: COMMON: Use float constants in DCT code. Makes the DCT code use constants of type float in expressions which only use type float values otherwise. This silences some floating point conversion warnings in the DCT code. --- common/dct.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'common/dct.cpp') diff --git a/common/dct.cpp b/common/dct.cpp index dea75f4c45..27e0c0bf41 100644 --- a/common/dct.cpp +++ b/common/dct.cpp @@ -73,7 +73,7 @@ void DCT::calc(float *data) { void DCT::calcDCTI(float *data) { int n = 1 << _bits; - float next = -0.5 * (data[0] - data[n]); + float next = -0.5f * (data[0] - data[n]); for (int i = 0; i < (n / 2); i++) { float tmp1 = data[i ]; @@ -87,7 +87,7 @@ void DCT::calcDCTI(float *data) { next += c; - tmp1 = (tmp1 + tmp2) * 0.5; + tmp1 = (tmp1 + tmp2) * 0.5f; data[i ] = tmp1 - s; data[n - i] = tmp1 + s; @@ -113,7 +113,7 @@ void DCT::calcDCTII(float *data) { s *= tmp1 - tmp2; - tmp1 = (tmp1 + tmp2) * 0.5; + tmp1 = (tmp1 + tmp2) * 0.5f; data[i ] = tmp1 + s; data[n - i - 1] = tmp1 - s; @@ -121,7 +121,7 @@ void DCT::calcDCTII(float *data) { _rdft->calc(data); - float next = data[1] * 0.5; + float next = data[1] * 0.5f; data[1] *= -1; @@ -143,7 +143,7 @@ void DCT::calcDCTIII(float *data) { int n = 1 << _bits; float next = data[n - 1]; - float inv_n = 1.0 / n; + float inv_n = 1.0f / n; for (int i = n - 2; i >= 2; i -= 2) { float val1 = data[i ]; @@ -184,7 +184,7 @@ void DCT::calcDSTI(float *data) { float s = SIN(n, 2 * i); s *= tmp1 + tmp2; - tmp1 = (tmp1 - tmp2) * 0.5; + tmp1 = (tmp1 - tmp2) * 0.5f; data[i ] = s + tmp1; data[n - i] = s - tmp1; @@ -194,7 +194,7 @@ void DCT::calcDSTI(float *data) { _rdft->calc(data); - data[0] *= 0.5; + data[0] *= 0.5f; for (int i = 1; i < (n - 2); i += 2) { data[i + 1] += data[i - 1]; -- cgit v1.2.3