Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Mark Harris
Opus
Commits
0a3e79aa
Commit
0a3e79aa
authored
Jan 07, 2008
by
Jean-Marc Valin
Browse files
Pseudo-masking curve for the MDCT
parent
825ec60b
Changes
2
Hide whitespace changes
Inline
Side-by-side
libcelt/psy.c
View file @
0a3e79aa
...
...
@@ -61,6 +61,7 @@ static void spreading_func(float *psd, float *mask, int len, int Fs)
decayR
[
i
]
=
pow
(.
1
f
,
deriv
);
/* decay corresponding to -25dB/Bark */
decayL
[
i
]
=
pow
(
0
.
0031623
f
,
deriv
);
//printf ("%f %f\n", decayL[i], decayR[i]);
}
/* Compute right slope (-10 dB/Bark) */
mem
=
psd
[
0
];
...
...
@@ -117,3 +118,20 @@ void compute_masking(float *X, float *mask, int len, int Fs)
}
void
compute_mdct_masking
(
float
*
X
,
float
*
mask
,
int
len
,
int
Fs
)
{
int
i
;
float
psd
[
len
];
float
mem
;
for
(
i
=
0
;
i
<
len
;
i
++
)
mask
[
i
]
=
X
[
i
]
*
X
[
i
];
for
(
i
=
1
;
i
<
len
-
1
;
i
++
)
psd
[
i
]
=
.
5
*
mask
[
i
]
+
.
25
*
(
mask
[
i
-
1
]
+
mask
[
i
+
1
]);
//psd[0] = .5*mask[0]+.25*(mask[1]+mask[2]);
psd
[
0
]
=
.
5
*
mask
[
0
]
+
.
5
*
mask
[
1
];
psd
[
len
-
1
]
=
.
5
*
(
mask
[
len
-
1
]
+
mask
[
len
-
2
]);
/* TODO: Do tone masking */
/* Noise masking */
spreading_func
(
psd
,
mask
,
len
,
Fs
);
}
libcelt/psy.h
View file @
0a3e79aa
...
...
@@ -33,4 +33,6 @@
void
compute_masking
(
float
*
X
,
float
*
mask
,
int
len
,
int
Fs
);
void
compute_mdct_masking
(
float
*
X
,
float
*
mask
,
int
len
,
int
Fs
);
#endif
/* PSY_H */
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment