aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configure.ac16
-rw-r--r--libtoolame-dab/ath.c5
-rw-r--r--libtoolame-dab/ath.h4
-rw-r--r--libtoolame-dab/common.h4
-rw-r--r--libtoolame-dab/psycho_3.c2
-rw-r--r--m4/ax_check_compile_flag.m474
6 files changed, 97 insertions, 8 deletions
diff --git a/configure.ac b/configure.ac
index 53ae845..5d0918a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -28,6 +28,22 @@ AC_CHECK_LIB([m], [sin])
AC_CHECK_LIB([rt], [clock_gettime], [], [AC_MSG_ERROR([library rt is missing])])
+AX_CHECK_COMPILE_FLAG([-Wduplicated-cond], [CFLAGS="$CFLAGS -Wduplicated-cond"])
+AX_CHECK_COMPILE_FLAG([-Wduplicated-branches], [CFLAGS="$CFLAGS -Wduplicated-branches"])
+AX_CHECK_COMPILE_FLAG([-Wlogical-op], [CFLAGS="$CFLAGS -Wlogical-op"])
+AX_CHECK_COMPILE_FLAG([-Wrestrict], [CFLAGS="$CFLAGS -Wrestrict"])
+AX_CHECK_COMPILE_FLAG([-Wdouble-promotion], [CFLAGS="$CFLAGS -Wdouble-promotion"])
+AX_CHECK_COMPILE_FLAG(["-Wformat=2"], [CFLAGS="$CFLAGS -Wformat=2"])
+
+AC_LANG_PUSH([C++])
+AX_CHECK_COMPILE_FLAG([-Wduplicated-cond], [CXXFLAGS="$CXXFLAGS -Wduplicated-cond"])
+AX_CHECK_COMPILE_FLAG([-Wduplicated-branches], [CXXFLAGS="$CXXFLAGS -Wduplicated-branches"])
+AX_CHECK_COMPILE_FLAG([-Wlogical-op], [CXXFLAGS="$CXXFLAGS -Wlogical-op"])
+AX_CHECK_COMPILE_FLAG([-Wrestrict], [CXXFLAGS="$CXXFLAGS -Wrestrict"])
+AX_CHECK_COMPILE_FLAG([-Wdouble-promotion], [CXXFLAGS="$CXXFLAGS -Wdouble-promotion"])
+AX_CHECK_COMPILE_FLAG(["-Wformat=2"], [CXXFLAGS="$CXXFLAGS -Wformat=2"])
+AC_LANG_POP([C++])
+
# Check for options
AC_ARG_ENABLE([alsa],
AS_HELP_STRING([--enable-alsa], [Enable ALSA input]))
diff --git a/libtoolame-dab/ath.c b/libtoolame-dab/ath.c
index 8544752..94baf8e 100644
--- a/libtoolame-dab/ath.c
+++ b/libtoolame-dab/ath.c
@@ -51,9 +51,8 @@ bitrate is more balanced according to the -V value.*/
/* Convert ATH values from dB into energy values as required by the psycho model */
-float ATH_energy(float freq, float value) {
- float db;
- db = ATH_dB(freq, 0) + value; // Originally: ATH_dB(freq,value)
+FLOAT8 ATH_energy(FLOAT8 freq, FLOAT8 value) {
+ FLOAT db = ATH_dB(freq, 0) + value; // Originally: ATH_dB(freq,value)
/* The values in the standard, and from the ATH formula are in dB.
In the psycho model we are working in the energy domain. Hence the values that
are in the absthr_X tables are not in dB. This function converts from dB into the energy domain.
diff --git a/libtoolame-dab/ath.h b/libtoolame-dab/ath.h
index 297f91f..ee35a82 100644
--- a/libtoolame-dab/ath.h
+++ b/libtoolame-dab/ath.h
@@ -1,3 +1,3 @@
-FLOAT8 ATH_dB(FLOAT8 f, FLOAT8 value);
-FLOAT8 ATH_energy(FLOAT8 f, FLOAT8 value);
+FLOAT8 ATH_dB(FLOAT8 freq, FLOAT8 value);
+FLOAT8 ATH_energy(FLOAT8 freq, FLOAT8 value);
FLOAT8 freq2bark(FLOAT8 freq);
diff --git a/libtoolame-dab/common.h b/libtoolame-dab/common.h
index 0a19af6..9f56a4e 100644
--- a/libtoolame-dab/common.h
+++ b/libtoolame-dab/common.h
@@ -9,7 +9,7 @@
#define EXIT_FAILURE 1
#endif
-#define FLOAT float
+#define FLOAT double
#ifndef FALSE
#define FALSE 0
@@ -78,7 +78,7 @@
#define BUFFER_SIZE 4096
-#define FLOAT8 float
+#define FLOAT8 double
/***********************************************************************
*
* Global Type Definitions
diff --git a/libtoolame-dab/psycho_3.c b/libtoolame-dab/psycho_3.c
index 3dbd462..c623b7f 100644
--- a/libtoolame-dab/psycho_3.c
+++ b/libtoolame-dab/psycho_3.c
@@ -454,7 +454,7 @@ void psycho_3_init(options *glopts) {
by 1.0 of a bark, start a new critical band. */
numlines = (int *)calloc(HBLKSIZE, sizeof(int));
- cbval = (float *)calloc(HBLKSIZE, sizeof(float));
+ cbval = (FLOAT*)calloc(HBLKSIZE, sizeof(FLOAT));
cbandindex[0] = 1;
for (i=1;i<HBLKSIZE;i++) {
if ((bark[i] - bark[cbase]) > 1.0) { /* 1 critical band? 1 bark? */
diff --git a/m4/ax_check_compile_flag.m4 b/m4/ax_check_compile_flag.m4
new file mode 100644
index 0000000..dcabb92
--- /dev/null
+++ b/m4/ax_check_compile_flag.m4
@@ -0,0 +1,74 @@
+# ===========================================================================
+# https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT])
+#
+# DESCRIPTION
+#
+# Check whether the given FLAG works with the current language's compiler
+# or gives an error. (Warnings, however, are ignored)
+#
+# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
+# success/failure.
+#
+# If EXTRA-FLAGS is defined, it is added to the current language's default
+# flags (e.g. CFLAGS) when the check is done. The check is thus made with
+# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to
+# force the compiler to issue an error when a bad flag is given.
+#
+# INPUT gives an alternative input source to AC_COMPILE_IFELSE.
+#
+# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
+# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG.
+#
+# LICENSE
+#
+# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
+# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
+#
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
+#
+# This program 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 General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the Autoconf
+# Macro released by the Autoconf Archive. When you make and distribute a
+# modified version of the Autoconf Macro, you may extend this special
+# exception to the GPL to apply to your modified version as well.
+
+#serial 5
+
+AC_DEFUN([AX_CHECK_COMPILE_FLAG],
+[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
+AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
+AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
+ ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
+ _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
+ AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
+ [AS_VAR_SET(CACHEVAR,[yes])],
+ [AS_VAR_SET(CACHEVAR,[no])])
+ _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags])
+AS_VAR_IF(CACHEVAR,yes,
+ [m4_default([$2], :)],
+ [m4_default([$3], :)])
+AS_VAR_POPDEF([CACHEVAR])dnl
+])dnl AX_CHECK_COMPILE_FLAGS