Debian Codegraph @

libtwolame/psycho_n1.c

raw
1 /*
2 * TwoLAME: an optimized MPEG Audio Layer Two encoder
3 *
4 * Copyright (C) 2001-2004 Michael Cheng
5 * Copyright (C) 2004-2018 The TwoLAME Project
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 */
22
23 #include <stdio.h>
24
25 #include "twolame.h"
26 #include "common.h"
27 #include "psycho_n1.h"
28
29 /* this is the null psychoacoustic model
30 All it does it copy some predefined values.
31 No actual modelling takes place */
32
33 /* a bunch of SNR values I sort of made up MFC 1 oct 99
34 Found by averaging the SNR values over a sound file
35 FIXME: Do a more rigourous investigation MFC Feb 2003 */
36
37 // From Castanets.wav
38 static const FLOAT snrdef[32] = {
39 30, 17, 16, 10, 3, 12, 8, 2.5, 5, 5, 6, 6, 5, 6, 10, 6, -4,
40 -10, -21, -30, -42, -55, -68, -75, -75, -75, -75, -75, -91, -107, -110, -108
41 };
42
43 #ifdef TESTSNR
44 // Using TMBG song "I am not your broom" about 1min. Psy Model 2
45 static const FLOAT snrdefa[32] = {
46 31, 17, 11, 9, 9, 7, 5, 3, 3, 3, 3, 3, 3, 1, -0, -2,
47 -5, -9, -15, -22, -32, -42, -54, -62, -63, -64, -66, -67, -83, -96, -98, -102
48 };
49
50 // Using Babylon5 "messages from earth: track 6" 15mins. Psy Model 2.
51 static const FLOAT snrdefb[32] = {
52 30, 17, 11, 9, 8, 9, 6, 5, 5, 4, 4, 3, 2, -0, -2, -5,
53 -8, -13, -19, -27, -35, -46, -55, -64, -65, -66, -68, -69, -84, -97, -99, -104
54 };
55
56 // Using Babylon5 "messages from earth: track 6" 15mins. Psy Model 1
57 static const FLOAT snrdefc[32] = {
58 32, 26, 22, 18, 16, 14, 12, 11, 10, 9, 9, 8, 6, 6, 4, 2,
59 0, -2, -7, -12, -18, -27, -35, -47, -53, -54, -56, -57, -57, -70, 0, 0
60 };
61 #endif
62
63 void twolame_psycho_n1(twolame_options * glopts, FLOAT ltmin[2][SBLIMIT], int stereo)
64 {
65 int i, k;
66
67 for (k = 0; k < stereo; k++)
68 for (i = 0; i < SBLIMIT; i++)
69 ltmin[k][i] = snrdef[i];
70 }
71
72 // vim:ts=4:sw=4:nowrap: