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
e38c7c18
Commit
e38c7c18
authored
17 years ago
by
Jean-Marc Valin
Browse files
Options
Downloads
Patches
Plain Diff
Energy is now Laplace-encoded (very poorly for now)
parent
8143be30
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
libcelt/celt.c
+3
-3
3 additions, 3 deletions
libcelt/celt.c
libcelt/quant_bands.c
+8
-6
8 additions, 6 deletions
libcelt/quant_bands.c
libentcode/Makefile.am
+1
-1
1 addition, 1 deletion
libentcode/Makefile.am
libentcode/laplace.c
+10
-1
10 additions, 1 deletion
libentcode/laplace.c
with
22 additions
and
11 deletions
libcelt/celt.c
+
3
−
3
View file @
e38c7c18
...
...
@@ -397,12 +397,12 @@ int celt_decode(CELTDecoder *st, char *data, int len, short *pcm)
ec_byte_readinit
(
&
buf
,
data
,
len
);
ec_dec_init
(
&
dec
,
&
buf
);
/* Get band energies */
unquant_energy
(
st
->
mode
,
bandE
,
st
->
oldBandE
,
&
dec
);
/* Get the pitch index */
pitch_index
=
ec_dec_uint
(
&
dec
,
MAX_PERIOD
-
(
B
+
1
)
*
N
);;
/* Get band energies */
unquant_energy
(
st
->
mode
,
bandE
,
st
->
oldBandE
,
&
dec
);
/* Pitch MDCT */
compute_mdcts
(
&
st
->
mdct_lookup
,
st
->
window
,
st
->
out_mem
+
pitch_index
,
P
,
N
,
B
);
...
...
This diff is collapsed.
Click to expand it.
libcelt/quant_bands.c
+
8
−
6
View file @
e38c7c18
...
...
@@ -31,10 +31,9 @@
#include
"quant_bands.h"
#include
"laplace.h"
#include
<math.h>
int
dummy_qi
[
100
];
void
quant_energy
(
CELTMode
*
m
,
float
*
eBands
,
float
*
oldEBands
,
ec_enc
*
enc
)
{
int
i
;
...
...
@@ -51,11 +50,14 @@ void quant_energy(CELTMode *m, float *eBands, float *oldEBands, ec_enc *enc)
res
=
.
25
f
*
(
i
+
3
.
f
);
//res = 1;
qi
=
(
int
)
floor
(.
5
+
(
x
-
pred
-
prev
)
/
res
);
dummy_qi
[
i
]
=
qi
;
/*if (qi > 40)
qi = 40;
if (qi < -40)
qi = -40;*/
ec_laplace_encode
(
enc
,
qi
,
15000
);
q
=
qi
*
res
;
//printf("%f %f ", pred+prev+q, x);
//printf("%d ", qi);
//printf("%f ", x-pred-prev);
oldEBands
[
i
]
=
pred
+
prev
+
q
;
...
...
@@ -79,9 +81,8 @@ void unquant_energy(CELTMode *m, float *eBands, float *oldEBands, ec_dec *dec)
float
pred
=
.
7
*
oldEBands
[
i
];
res
=
.
25
f
*
(
i
+
3
.
f
);
qi
=
dummy_qi
[
i
]
;
qi
=
ec_laplace_decode
(
dec
,
15000
)
;
q
=
qi
*
res
;
//printf("%f %f ", pred+prev+q, x);
//printf("%d ", qi);
//printf("%f ", x-pred-prev);
...
...
@@ -92,4 +93,5 @@ void unquant_energy(CELTMode *m, float *eBands, float *oldEBands, ec_dec *dec)
eBands
[
i
]
=
0
;
prev
=
(
prev
+
.
5
*
q
);
}
//printf ("\n");
}
This diff is collapsed.
Click to expand it.
libentcode/Makefile.am
+
1
−
1
View file @
e38c7c18
...
...
@@ -7,4 +7,4 @@ bin_PROGRAMS = ectest
ectest_SOURCES
=
ectest.c
ectest_LDADD
=
$(
top_builddir
)
/libentcode/libentcode.la
noinst_HEADERS
=
bitrdec.h bitree.h bitrenc.h ecintrin.h entcode.h entdec.h
\
entenc.h mfrngcod.h probdec.h probenc.h probmod.h
entenc.h
laplace.h
mfrngcod.h probdec.h probenc.h probmod.h
This diff is collapsed.
Click to expand it.
libentcode/laplace.c
+
10
−
1
View file @
e38c7c18
...
...
@@ -33,7 +33,7 @@
#include
"entdec.h"
#include
<stdio.h>
int
ec_laplace_get_total
(
int
decay
)
static
int
ec_laplace_get_total
(
int
decay
)
{
return
(
1
<<
30
)
/
((
1
<<
14
)
-
decay
)
-
(
1
<<
15
)
+
1
;
}
...
...
@@ -52,8 +52,17 @@ void ec_laplace_encode(ec_enc *enc, int value, int decay)
fs
=
1
<<
15
;
for
(
i
=
0
;
i
<
value
;
i
++
)
{
int
tmp_l
,
tmp_s
;
tmp_l
=
fl
;
tmp_s
=
fs
;
fl
+=
fs
*
2
;
fs
=
(
fs
*
decay
)
>>
14
;
if
(
fs
==
0
)
{
fs
=
tmp_s
;
fl
=
tmp_l
;
break
;
}
}
if
(
fl
<
0
)
fl
=
0
;
...
...
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