diff options
author | Daniil Cherednik <dan.cherednik@gmail.com> | 2024-07-08 21:42:48 +0000 |
---|---|---|
committer | Daniil Cherednik <dan.cherednik@gmail.com> | 2024-07-09 23:07:40 +0200 |
commit | c4b19af8391640f143aaf446658354dcf01432d1 (patch) | |
tree | 68ebb11f38eaec53e16879e59ce776bd249d8491 /src/lib/mdct/mdct_ut_common.h | |
parent | f8eabde1e1a2fa6bdb2b09dcdee5cecb750beb30 (diff) | |
download | atracdenc-c4b19af8391640f143aaf446658354dcf01432d1.tar.gz |
Allow to configure atracdenc to use float instead of double
The default is double for hystorical reason.
Actually no any reason to use double precision float point
calculation for all processing. AT3P encoding will use float
except places were we really need double precision.
So this default will be changed to float in near future and
this option will be removed.
Diffstat (limited to 'src/lib/mdct/mdct_ut_common.h')
-rw-r--r-- | src/lib/mdct/mdct_ut_common.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/lib/mdct/mdct_ut_common.h b/src/lib/mdct/mdct_ut_common.h new file mode 100644 index 0000000..5c1096c --- /dev/null +++ b/src/lib/mdct/mdct_ut_common.h @@ -0,0 +1,28 @@ +/* + * This file is part of AtracDEnc. + * + * AtracDEnc 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. + * + * AtracDEnc 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 AtracDEnc; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#pragma once + +#include "mdct.h" + +// Calculate value of error for given magnitude +inline TFloat CalcEps(TFloat magn) { + const float snr = (sizeof(TFloat) == 4) ? -114.0 : -240.0; + return magn * pow(10, (snr / 20.0)); +} + |