Commit 0915a551 authored by Josh Coalson's avatar Josh Coalson
Browse files

Fixes for Sun Studio/Forte; us AC_C_INLINE to detect inline keyword for...

Fixes for Sun Studio/Forte; us AC_C_INLINE to detect inline keyword for compiler; eliminate floating point calcs in RG analysis array size calculations (SF#1701960: https://sourceforge.net/tracker2/?func=detail&aid=1701960&group_id=13478&atid=313478)
parent 8e28e43b
......@@ -60,6 +60,7 @@ AC_LANG_POP(C++)
AC_C_VARARRAYS
AC_C_BIGENDIAN
AC_C_INLINE
AC_CHECK_TYPES(socklen_t, [], [])
......@@ -316,12 +317,15 @@ fi
CPPFLAGS='-I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include'" $CPPFLAGS"
if test "x$debug" = xtrue; then
CPPFLAGS="-DDEBUG $CPPFLAGS"
CPPFLAGS="-DDEBUG -DFLaC__INLINE= $CPPFLAGS"
CFLAGS="-g $CFLAGS"
else
CPPFLAGS="-DNDEBUG $CPPFLAGS"
# $ac_cv_c_inline from AC_C_INLINE
if test "x$ac_cv_c_inline" != xno ; then
CPPFLAGS="-DFLaC__INLINE=$ac_cv_c_inline $CPPFLAGS"
fi
if test "x$GCC" = xyes; then
CPPFLAGS="-DFLaC__INLINE=__inline__ $CPPFLAGS"
CFLAGS="-O3 -funroll-loops -finline-functions -Wall -W -Winline $CFLAGS"
fi
fi
......
......@@ -106,6 +106,7 @@
<ul>
<li>Fixes for MinGW (<a href="https://sourceforge.net/tracker2/?func=detail&aid=2000973&group_id=13478&atid=113478">SF #2000973</a>, <a href="https://sourceforge.net/tracker2/?func=detail&aid=2209829&group_id=13478&atid=113478">SF #2209829</a>).</li>
<li>Fixes for gcc 4.3 (<a href="https://sourceforge.net/tracker2/?func=detail&aid=1834168&group_id=13478&atid=113478">SF #1834168</a>, <a href="https://sourceforge.net/tracker2/?func=detail&aid=2002481&group_id=13478&atid=113478">SF #2002481</a>).</li>
<li>Fixes for Sun Studio/Forte (<a href="https://sourceforge.net/tracker2/?func=detail&aid=1701960&group_id=13478&atid=313478">SF #1701960</a>).</li>
<li>Fixes for windows builds (<a href="https://sourceforge.net/tracker2/?func=detail&aid=1676822&group_id=13478&atid=113478">SF #1676822</a>, <a href="https://sourceforge.net/tracker2/?func=detail&aid=1756624&group_id=13478&atid=363478">SF #1756624</a>, <a href="https://sourceforge.net/tracker2/?func=detail&aid=1809863&group_id=13478&atid=113478">SF #1809863</a>, <a href="https://sourceforge.net/tracker2/?func=detail&aid=1911149&group_id=13478&atid=363478">SF #1911149</a>).</li>
</ul>
</li>
......
/*
* ReplayGainAnalysis - analyzes input samples and give the recommended dB change
* Copyright (C) 2001 David Robinson and Glen Sawyer
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* concept and filter values by David Robinson (David@Robinson.org)
* -- blame him if you think the idea is flawed
* coding by Glen Sawyer (glensawyer@hotmail.com) 442 N 700 E, Provo, UT 84606 USA
* -- blame him if you think this runs too slowly, or the coding is otherwise flawed
* minor cosmetic tweaks to integrate with FLAC by Josh Coalson
*
* For an explanation of the concepts and the basic algorithms involved, go to:
* http://www.replaygain.org/
*/
#ifndef GAIN_ANALYSIS_H
#define GAIN_ANALYSIS_H
#include <stddef.h>
#define GAIN_NOT_ENOUGH_SAMPLES -24601
#define GAIN_ANALYSIS_ERROR 0
#define GAIN_ANALYSIS_OK 1
#define INIT_GAIN_ANALYSIS_ERROR 0
#define INIT_GAIN_ANALYSIS_OK 1
#ifdef __cplusplus
extern "C" {
#endif
typedef float Float_t; /* Type used for filtering */
extern Float_t ReplayGainReferenceLoudness; /* in dB SPL, currently == 89.0 */
int InitGainAnalysis ( long samplefreq );
int AnalyzeSamples ( const Float_t* left_samples, const Float_t* right_samples, size_t num_samples, int num_channels );
int ResetSampleFrequency ( long samplefreq );
Float_t GetTitleGain ( void );
Float_t GetAlbumGain ( void );
#ifdef __cplusplus
}
#endif
#endif /* GAIN_ANALYSIS_H */
/*
* ReplayGainAnalysis - analyzes input samples and give the recommended dB change
* Copyright (C) 2001 David Robinson and Glen Sawyer
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* concept and filter values by David Robinson (David@Robinson.org)
* -- blame him if you think the idea is flawed
* coding by Glen Sawyer (glensawyer@hotmail.com) 442 N 700 E, Provo, UT 84606 USA
* -- blame him if you think this runs too slowly, or the coding is otherwise flawed
* minor cosmetic tweaks to integrate with FLAC by Josh Coalson
*
* For an explanation of the concepts and the basic algorithms involved, go to:
* http://www.replaygain.org/
*/
#ifndef GAIN_ANALYSIS_H
#define GAIN_ANALYSIS_H
#include <stddef.h>
#define GAIN_NOT_ENOUGH_SAMPLES -24601
#define GAIN_ANALYSIS_ERROR 0
#define GAIN_ANALYSIS_OK 1
#define INIT_GAIN_ANALYSIS_ERROR 0
#define INIT_GAIN_ANALYSIS_OK 1
#ifdef __cplusplus
extern "C" {
#endif
typedef float Float_t; /* Type used for filtering */
extern Float_t ReplayGainReferenceLoudness; /* in dB SPL, currently == 89.0 */
int InitGainAnalysis ( long samplefreq );
int AnalyzeSamples ( const Float_t* left_samples, const Float_t* right_samples, size_t num_samples, int num_channels );
int ResetSampleFrequency ( long samplefreq );
Float_t GetTitleGain ( void );
Float_t GetAlbumGain ( void );
#ifdef __cplusplus
}
#endif
#endif /* GAIN_ANALYSIS_H */
......@@ -43,7 +43,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I ".\include" /I "..\..\include" /D "NDEBUG" /D "FLAC_API_EXPORTS" /D "FLAC__HAS_OGG" /D VERSION=\"1.2.1\" /D "FLAC__CPU_IA32" /D "FLAC__HAS_NASM" /D "FLAC__USE_3DNOW" /D "_WINDOWS" /D "_WINDLL" /D "WIN32" /D "_USRDLL" /FR /FD /c
# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I ".\include" /I "..\..\include" /D "NDEBUG" /D "FLAC_API_EXPORTS" /D "FLAC__HAS_OGG" /D VERSION=\"1.2.1\" /D "FLAC__CPU_IA32" /D "FLAC__HAS_NASM" /D "FLAC__USE_3DNOW" /D FLaC__INLINE=_inline /D "_WINDOWS" /D "_WINDLL" /D "WIN32" /D "_USRDLL" /FR /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
......
......@@ -119,7 +119,7 @@
OmitFramePointers="true"
WholeProgramOptimization="true"
AdditionalIncludeDirectories=".\include;..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FLAC_API_EXPORTS;FLAC__HAS_OGG;FLAC__CPU_IA32;FLAC__HAS_NASM;FLAC__USE_3DNOW;VERSION=\&quot;1.2.0\&quot;"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FLAC_API_EXPORTS;FLAC__HAS_OGG;FLAC__CPU_IA32;FLAC__HAS_NASM;FLAC__USE_3DNOW;VERSION=\&quot;1.2.0\&quot;;FLaC__INLINE=_inline"
RuntimeLibrary="0"
BufferSecurityCheck="false"
UsePrecompiledHeader="0"
......
......@@ -41,7 +41,7 @@ RSC=rc.exe
# PROP Intermediate_Dir "Release_static"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /Op /I ".\include" /I "..\..\include" /D VERSION=\"1.2.1\" /D "FLAC__NO_DLL" /D "FLAC__HAS_OGG" /D "FLAC__CPU_IA32" /D "FLAC__HAS_NASM" /D "FLAC__USE_3DNOW" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /Op /I ".\include" /I "..\..\include" /D VERSION=\"1.2.1\" /D "FLAC__NO_DLL" /D "FLAC__HAS_OGG" /D "FLAC__CPU_IA32" /D "FLAC__HAS_NASM" /D "FLAC__USE_3DNOW" /D FLaC__INLINE=_inline /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
......
......@@ -108,7 +108,7 @@
OmitFramePointers="true"
WholeProgramOptimization="true"
AdditionalIncludeDirectories=".\include;..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;FLAC__HAS_OGG;FLAC__CPU_IA32;FLAC__HAS_NASM;FLAC__USE_3DNOW;VERSION=\&quot;1.2.0\&quot;;FLAC__NO_DLL"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;FLAC__HAS_OGG;FLAC__CPU_IA32;FLAC__HAS_NASM;FLAC__USE_3DNOW;VERSION=\&quot;1.2.0\&quot;;FLAC__NO_DLL;FLaC__INLINE=_inline"
RuntimeLibrary="0"
BufferSecurityCheck="false"
UsePrecompiledHeader="0"
......
......@@ -41,7 +41,7 @@ RSC=rc.exe
# PROP Intermediate_Dir "Release_static"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /MD /W3 /WX /GX /Ox /Og /Oi /Os /Op /I ".\include" /I "..\..\include" /D "FLAC__NO_DLL" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /MD /W3 /WX /GX /Ox /Og /Oi /Os /Op /I ".\include" /I "..\..\include" /D "FLAC__NO_DLL" /D FLaC__INLINE=_inline /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
......
......@@ -108,7 +108,7 @@
OmitFramePointers="true"
WholeProgramOptimization="true"
AdditionalIncludeDirectories=".\include;..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;FLAC__NO_DLL"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;FLAC__NO_DLL;FLaC__INLINE=_inline"
RuntimeLibrary="0"
BufferSecurityCheck="false"
UsePrecompiledHeader="0"
......
......@@ -110,24 +110,24 @@ typedef signed int Int32_t;
#define YULE_ORDER 10
#define BUTTER_ORDER 2
#define RMS_PERCENTILE 0.95 /* percentile which is louder than the proposed level */
#define MAX_SAMP_FREQ 48000. /* maximum allowed sample frequency [Hz] */
#define RMS_WINDOW_TIME 0.050 /* Time slice size [s] */
#define MAX_SAMP_FREQ 48000 /* maximum allowed sample frequency [Hz] */
#define RMS_WINDOW_TIME 50 /* Time slice size [ms] */
#define STEPS_per_dB 100. /* Table entries per dB */
#define MAX_dB 120. /* Table entries for 0...MAX_dB (normal max. values are 70...80 dB) */
#define MAX_ORDER (BUTTER_ORDER > YULE_ORDER ? BUTTER_ORDER : YULE_ORDER)
/* [JEC] the following was originally #defined as:
* (size_t) (MAX_SAMP_FREQ * RMS_WINDOW_TIME)
* (size_t) (MAX_SAMP_FREQ * RMS_WINDOW_TIME / 1000)
* but that seemed to fail to take into account the ceil() part of the
* sampleWindow calculation in ResetSampleFrequency(), and was causing
* buffer overflows for 48kHz analysis, hence the +1.
*/
#ifndef __sun
#define MAX_SAMPLES_PER_WINDOW (size_t) (MAX_SAMP_FREQ * RMS_WINDOW_TIME + 1.) /* max. Samples per Time slice */
#else
/* [JEC] Solaris Forte compiler doesn't like float calc in array indices */
#define MAX_SAMPLES_PER_WINDOW (size_t) (2401)
#endif
/* [JEC] WATCHOUT: if MAX_SAMP_FREQ * RMS_WINDOW_TIME / 1000 is not an
* integer it must be manually rounded up. there is a limit on the
* kind of calculation that can be done in array size definition (e.g.
* Sun Forte compiler cannot handle any floating point terms).
*/
#define MAX_SAMPLES_PER_WINDOW (size_t) (MAX_SAMP_FREQ * RMS_WINDOW_TIME / 1000 + 1) /* max. Samples per Time slice */
#define PINK_REF 64.82 /* 298640883795 */ /* calibration value */
static Float_t linprebuf [MAX_ORDER * 2];
......@@ -255,7 +255,7 @@ ResetSampleFrequency ( long samplefreq ) {
default: return INIT_GAIN_ANALYSIS_ERROR;
}
sampleWindow = (int) ceil (samplefreq * RMS_WINDOW_TIME);
sampleWindow = (int) ceil ((double)samplefreq * (double)RMS_WINDOW_TIME / 1000.0);
lsum = 0.;
rsum = 0.;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment