Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Opus
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alexander Traud
Opus
Commits
6f7e83d8
Commit
6f7e83d8
authored
17 years ago
by
Jean-Marc Valin
Browse files
Options
Downloads
Patches
Plain Diff
Pre-emphasis, plus a few minor tweaks
parent
41af4215
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
celt.kdevelop
+52
-5
52 additions, 5 deletions
celt.kdevelop
libcelt/arch.h
+2
-11
2 additions, 11 deletions
libcelt/arch.h
libcelt/celt.c
+45
-6
45 additions, 6 deletions
libcelt/celt.c
libcelt/pitch.c
+2
-2
2 additions, 2 deletions
libcelt/pitch.c
with
101 additions
and
24 deletions
celt.kdevelop
+
52
−
5
View file @
6f7e83d8
...
...
@@ -8,12 +8,27 @@
<primarylanguage>
C
</primarylanguage>
<ignoreparts/>
<projectname>
celt
</projectname>
<projectdirectory>
.
</projectdirectory>
<absoluteprojectpath>
false
</absoluteprojectpath>
<description/>
<defaultencoding/>
</general>
<kdevautoproject>
<general>
<useconfiguration>
default
</useconfiguration>
</general>
<run/>
<run>
<mainprogram/>
<programargs/>
<globaldebugarguments/>
<globalcwd/>
<useglobalprogram>
true
</useglobalprogram>
<terminal>
false
</terminal>
<autocompile>
false
</autocompile>
<autoinstall>
false
</autoinstall>
<autokdesu>
false
</autokdesu>
<envvars/>
</run>
<configurations>
<optimized>
<builddir>
optimized
</builddir>
...
...
@@ -41,7 +56,20 @@
<kdevdebugger>
<general>
<dbgshell>
libtool
</dbgshell>
<gdbpath/>
<configGdbScript/>
<runShellScript/>
<runGdbScript/>
<breakonloadinglibs>
true
</breakonloadinglibs>
<separatetty>
false
</separatetty>
<floatingtoolbar>
false
</floatingtoolbar>
<raiseGDBOnStart>
false
</raiseGDBOnStart>
</general>
<display>
<staticmembers>
false
</staticmembers>
<demanglenames>
true
</demanglenames>
<outputradix>
10
</outputradix>
</display>
</kdevdebugger>
<kdevdoctreeview>
<ignoretocs>
...
...
@@ -103,13 +131,12 @@
<used>
false
</used>
<version>
3
</version>
<includestyle>
3
</includestyle>
<root>
/usr/share/qt3
</root>
<root></root>
<designerintegration>
EmbeddedKDevDesigner
</designerintegration>
<qmake>
/usr/bin/qmake-qt3
</qmake>
<designer>
/usr/bin/designer
</designer>
<qmake></qmake>
<designer></designer>
<designerpluginpaths/>
</qt>
<references/>
<codecompletion>
<automaticCodeCompletion>
false
</automaticCodeCompletion>
<automaticArgumentsHint>
true
</automaticArgumentsHint>
...
...
@@ -133,7 +160,27 @@
<alwaysIncludeNamespaces>
false
</alwaysIncludeNamespaces>
<includePaths>
.;
</includePaths>
</codecompletion>
<creategettersetter>
<prefixGet/>
<prefixSet>
set
</prefixSet>
<prefixVariable>
m_,_
</prefixVariable>
<parameterName>
theValue
</parameterName>
<inlineGet>
true
</inlineGet>
<inlineSet>
true
</inlineSet>
</creategettersetter>
<splitheadersource>
<enabled>
false
</enabled>
<synchronize>
true
</synchronize>
<orientation>
Vertical
</orientation>
</splitheadersource>
<references/>
</kdevcppsupport>
<cppsupportpart>
<filetemplates>
<interfacesuffix>
.h
</interfacesuffix>
<implementationsuffix>
.cpp
</implementationsuffix>
</filetemplates>
</cppsupportpart>
<kdevfileview>
<groups>
<hidenonprojectfiles>
false
</hidenonprojectfiles>
...
...
This diff is collapsed.
Click to expand it.
libcelt/arch.h
+
2
−
11
View file @
6f7e83d8
...
...
@@ -35,14 +35,6 @@
#ifndef ARCH_H
#define ARCH_H
#ifndef SPEEX_VERSION
#define SPEEX_MAJOR_VERSION 1
/**< Major Speex version. */
#define SPEEX_MINOR_VERSION 1
/**< Minor Speex version. */
#define SPEEX_MICRO_VERSION 15
/**< Micro Speex version. */
#define SPEEX_EXTRA_VERSION ""
/**< Extra Speex version. */
#define SPEEX_VERSION "speex-1.2beta4"
/**< Speex version string. */
#endif
/* A couple test to catch stupid option combinations */
#ifdef FIXED_POINT
...
...
@@ -74,9 +66,8 @@
#endif
#ifndef OUTSIDE_SPEEX
#include
"speex/speex_types.h"
#endif
typedef
int
spx_int32_t
;
typedef
short
spx_int16_t
;
#define ABS(x) ((x) < 0 ? (-(x)) : (x))
/**< Absolute integer value. */
#define ABS16(x) ((x) < 0 ? (-(x)) : (x))
/**< Absolute 16-bit value. */
...
...
This diff is collapsed.
Click to expand it.
libcelt/celt.c
+
45
−
6
View file @
6f7e83d8
...
...
@@ -45,7 +45,8 @@ struct CELTState_ {
int
nb_blocks
;
float
preemph
;
float
preemph_mem
;
float
preemph_memE
;
float
preemph_memD
;
mdct_lookup
mdct_lookup
;
void
*
fft
;
...
...
@@ -78,6 +79,8 @@ CELTState *celt_encoder_new(int blockSize, int blocksPerFrame)
st
->
out_mem
=
celt_alloc
(
MAX_PERIOD
*
sizeof
(
float
));
for
(
i
=
0
;
i
<
N
;
i
++
)
st
->
window
[
i
]
=
st
->
window
[
2
*
N
-
i
-
1
]
=
sin
(.
5
*
M_PI
*
sin
(.
5
*
M_PI
*
(
i
+
.
5
)
/
N
)
*
sin
(.
5
*
M_PI
*
(
i
+
.
5
)
/
N
));
st
->
preemph
=
0
.
8
;
return
st
;
}
...
...
@@ -99,6 +102,32 @@ void celt_encoder_destroy(CELTState *st)
celt_free
(
st
);
}
static
void
haar1
(
float
*
X
,
int
N
)
{
int
i
;
for
(
i
=
0
;
i
<
N
;
i
+=
2
)
{
float
a
,
b
;
a
=
X
[
i
];
b
=
X
[
i
+
1
];
X
[
i
]
=
.
707107
f
*
(
a
+
b
);
X
[
i
+
1
]
=
.
707107
f
*
(
a
-
b
);
}
}
static
void
inv_haar1
(
float
*
X
,
int
N
)
{
int
i
;
for
(
i
=
0
;
i
<
N
;
i
+=
2
)
{
float
a
,
b
;
a
=
X
[
i
];
b
=
X
[
i
+
1
];
X
[
i
]
=
.
707107
f
*
(
a
+
b
);
X
[
i
+
1
]
=
.
707107
f
*
(
a
-
b
);
}
}
static
void
compute_mdcts
(
mdct_lookup
*
mdct_lookup
,
float
*
window
,
float
*
in
,
float
*
out
,
int
N
,
int
B
)
{
int
i
;
...
...
@@ -135,10 +164,13 @@ int celt_encode(CELTState *st, short *pcm)
for
(
i
=
0
;
i
<
N
;
i
++
)
in
[
i
]
=
st
->
in_mem
[
i
];
for
(;
i
<
(
B
+
1
)
*
N
;
i
++
)
in
[
i
]
=
pcm
[
i
-
N
];
{
float
tmp
=
pcm
[
i
-
N
];
in
[
i
]
=
tmp
-
st
->
preemph
*
st
->
preemph_memE
;
st
->
preemph_memE
=
tmp
;
}
for
(
i
=
0
;
i
<
N
;
i
++
)
st
->
in_mem
[
i
]
=
pcm
[(
B
-
1
)
*
N
+
i
];
st
->
in_mem
[
i
]
=
in
[
B
*
N
+
i
];
/* Compute MDCTs */
compute_mdcts
(
&
st
->
mdct_lookup
,
st
->
window
,
in
,
X
,
N
,
B
);
...
...
@@ -160,10 +192,11 @@ int celt_encode(CELTState *st, short *pcm)
for (j=0;j<B*N;j++)
printf ("%f ", P[j]);
printf ("\n");*/
//haar1(X, B*N);
//haar1(P, B*N);
/* Band normalisation */
compute_bands
(
X
,
B
,
bandE
);
//for (i=0;i<NBANDS;i++) printf("%f ",bandE[i]);printf("\n");
normalise_bands
(
X
,
B
,
bandE
);
compute_bands
(
P
,
B
,
bandEp
);
...
...
@@ -194,6 +227,8 @@ int celt_encode(CELTState *st, short *pcm)
/* Synthesis */
denormalise_bands
(
X
,
B
,
bandE
);
//inv_haar1(X, B*N);
CELT_MOVE
(
st
->
out_mem
,
st
->
out_mem
+
B
*
N
,
MAX_PERIOD
-
B
*
N
);
/* Compute inverse MDCTs */
for
(
i
=
0
;
i
<
B
;
i
++
)
...
...
@@ -213,7 +248,11 @@ int celt_encode(CELTState *st, short *pcm)
st
->
mdct_overlap
[
j
]
=
x
[
N
+
j
];
for
(
j
=
0
;
j
<
N
;
j
++
)
pcm
[
i
*
N
+
j
]
=
(
short
)
floor
(.
5
+
st
->
out_mem
[
MAX_PERIOD
+
(
i
-
B
)
*
N
+
j
]);
{
float
tmp
=
st
->
out_mem
[
MAX_PERIOD
+
(
i
-
B
)
*
N
+
j
]
+
st
->
preemph
*
st
->
preemph_memD
;
st
->
preemph_memD
=
tmp
;
pcm
[
i
*
N
+
j
]
=
(
short
)
floor
(.
5
+
tmp
);
}
}
return
0
;
...
...
This diff is collapsed.
Click to expand it.
libcelt/pitch.c
+
2
−
2
View file @
6f7e83d8
...
...
@@ -56,9 +56,9 @@ void find_spectral_pitch(void *fft, float *x, float *y, int lag, int len, int *p
X
[
0
]
=
X
[
lag
-
1
]
=
0
;
spx_ifft
(
fft
,
X
,
xx
);
float
max_corr
=-
1
;
float
max_corr
=-
1
e10
;
//int pitch;
*
pitch
=
-
1
;
*
pitch
=
0
;
for
(
i
=
0
;
i
<
lag
-
len
;
i
++
)
{
//printf ("%f ", xx[i]);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment