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
Container Registry
Model registry
Operate
Environments
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
Xiph.Org
Opus
Commits
5fa59954
Commit
5fa59954
authored
17 years ago
by
Jean-Marc Valin
Browse files
Options
Downloads
Patches
Plain Diff
moved pulse [en|de]coding to cwrs.c
parent
31348844
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
libcelt/cwrs.c
+24
-8
24 additions, 8 deletions
libcelt/cwrs.c
libcelt/cwrs.h
+6
-0
6 additions, 0 deletions
libcelt/cwrs.h
libcelt/vq.c
+5
-13
5 additions, 13 deletions
libcelt/vq.c
with
35 additions
and
21 deletions
libcelt/cwrs.c
+
24
−
8
View file @
5fa59954
...
...
@@ -30,7 +30,7 @@
#include
<stdlib.h>
#include
"cwrs.h"
static
celt_uint64_t
update
_ncwrs64
(
celt_uint64_t
*
nc
,
int
len
,
int
nc0
)
static
celt_uint64_t
next
_ncwrs64
(
celt_uint64_t
*
nc
,
int
len
,
int
nc0
)
{
int
i
;
celt_uint64_t
mem
;
...
...
@@ -45,7 +45,7 @@ static celt_uint64_t update_ncwrs64(celt_uint64_t *nc, int len, int nc0)
}
}
static
celt_uint64_t
rev
erse
_ncwrs64
(
celt_uint64_t
*
nc
,
int
len
,
int
nc0
)
static
celt_uint64_t
p
rev_ncwrs64
(
celt_uint64_t
*
nc
,
int
len
,
int
nc0
)
{
int
i
;
celt_uint64_t
mem
;
...
...
@@ -209,7 +209,7 @@ void cwrsi64(int _n,int _m,celt_uint64_t _i,int *_x,int *_s){
for
(
j
=
0
;
j
<
_n
+
1
;
j
++
)
nc
[
j
]
=
1
;
for
(
k
=
0
;
k
<
_m
-
1
;
k
++
)
update
_ncwrs64
(
nc
,
_n
+
1
,
0
);
next
_ncwrs64
(
nc
,
_n
+
1
,
0
);
for
(
k
=
j
=
0
;
k
<
_m
;
k
++
){
celt_uint64_t
pn
;
celt_uint64_t
p
;
...
...
@@ -236,9 +236,9 @@ void cwrsi64(int _n,int _m,celt_uint64_t _i,int *_x,int *_s){
_x
[
k
]
=
j
;
if
(
_s
[
k
])
_i
-=
t
;
if
(
k
<
_m
-
2
)
rev
erse
_ncwrs64
(
nc
,
_n
+
1
,
0
);
p
rev_ncwrs64
(
nc
,
_n
+
1
,
0
);
else
rev
erse
_ncwrs64
(
nc
,
_n
+
1
,
1
);
p
rev_ncwrs64
(
nc
,
_n
+
1
,
1
);
}
}
...
...
@@ -254,7 +254,7 @@ celt_uint64_t icwrs64(int _n,int _m,const int *_x,const int *_s){
for
(
j
=
0
;
j
<
_n
+
1
;
j
++
)
nc
[
j
]
=
1
;
for
(
k
=
0
;
k
<
_m
-
1
;
k
++
)
update
_ncwrs64
(
nc
,
_n
+
1
,
0
);
next
_ncwrs64
(
nc
,
_n
+
1
,
0
);
i
=
0
;
for
(
k
=
j
=
0
;
k
<
_m
;
k
++
){
celt_uint64_t
pn
;
...
...
@@ -275,9 +275,9 @@ celt_uint64_t icwrs64(int _n,int _m,const int *_x,const int *_s){
}
if
((
k
==
0
||
_x
[
k
]
!=
_x
[
k
-
1
])
&&
_s
[
k
])
i
+=
p
>>
1
;
if
(
k
<
_m
-
2
)
rev
erse
_ncwrs64
(
nc
,
_n
+
1
,
0
);
p
rev_ncwrs64
(
nc
,
_n
+
1
,
0
);
else
rev
erse
_ncwrs64
(
nc
,
_n
+
1
,
1
);
p
rev_ncwrs64
(
nc
,
_n
+
1
,
1
);
}
return
i
;
}
...
...
@@ -321,3 +321,19 @@ void pulse2comb(int _n,int _m,int *_x,int *_s,const int *_y){
}
}
void
encode_pulses
(
int
*
_y
,
int
N
,
int
K
,
ec_enc
*
enc
)
{
int
comb
[
K
];
int
signs
[
K
];
pulse2comb
(
N
,
K
,
comb
,
signs
,
_y
);
ec_enc_uint64
(
enc
,
icwrs64
(
N
,
K
,
comb
,
signs
),
ncwrs64
(
N
,
K
));
}
void
decode_pulses
(
int
*
_y
,
int
N
,
int
K
,
ec_dec
*
dec
)
{
int
comb
[
K
];
int
signs
[
K
];
cwrsi64
(
N
,
K
,
ec_dec_uint64
(
dec
,
ncwrs64
(
N
,
K
)),
comb
,
signs
);
comb2pulse
(
N
,
K
,
_y
,
comb
,
signs
);
}
This diff is collapsed.
Click to expand it.
libcelt/cwrs.h
+
6
−
0
View file @
5fa59954
...
...
@@ -33,6 +33,8 @@
#define CWRS_H
#include
"arch.h"
#include
"entenc.h"
#include
"entdec.h"
celt_uint32_t
ncwrs
(
int
_n
,
int
_m
);
...
...
@@ -51,4 +53,8 @@ void cwrsi64(int _n,int _m,celt_uint64_t _i,int *_x,int *_s);
celt_uint64_t
icwrs64
(
int
_n
,
int
_m
,
const
int
*
_x
,
const
int
*
_s
);
void
encode_pulses
(
int
*
_y
,
int
N
,
int
K
,
ec_enc
*
enc
);
void
decode_pulses
(
int
*
_y
,
int
N
,
int
K
,
ec_dec
*
dec
);
#endif
/* CWRS_H */
This diff is collapsed.
Click to expand it.
libcelt/vq.c
+
5
−
13
View file @
5fa59954
...
...
@@ -226,12 +226,9 @@ void alg_quant(float *x, float *W, int N, int K, float *p, float alpha, ec_enc *
for
(
i
=
0
;
i
<
N
;
i
++
)
x
[
i
]
*=
E
;
}
int
comb
[
K
];
int
signs
[
K
];
//for (i=0;i<N;i++)
// printf ("%d ", iy[0][i]);
pulse2comb
(
N
,
K
,
comb
,
signs
,
iy
[
0
]);
ec_enc_uint64
(
enc
,
icwrs64
(
N
,
K
,
comb
,
signs
),
ncwrs64
(
N
,
K
));
encode_pulses
(
iy
[
0
],
N
,
K
,
enc
);
//printf ("%llu ", icwrs64(N, K, comb, signs));
/* Recompute the gain in one pass to reduce the encoder-decoder mismatch
due to the recursive computation used in quantisation.
...
...
@@ -269,18 +266,13 @@ void alg_quant(float *x, float *W, int N, int K, float *p, float alpha, ec_enc *
void
alg_unquant
(
float
*
x
,
int
N
,
int
K
,
float
*
p
,
float
alpha
,
ec_dec
*
dec
)
{
int
i
;
celt_uint64_t
id
;
int
comb
[
K
];
int
signs
[
K
];
int
iy
[
N
];
float
y
[
N
];
float
Rpp
=
0
,
Ryp
=
0
,
Ryy
=
0
;
float
g
;
id
=
ec_dec_uint64
(
dec
,
ncwrs64
(
N
,
K
));
//printf ("%llu ", id);
cwrsi64
(
N
,
K
,
id
,
comb
,
signs
);
comb2pulse
(
N
,
K
,
iy
,
comb
,
signs
);
decode_pulses
(
iy
,
N
,
K
,
dec
);
//for (i=0;i<N;i++)
// printf ("%d ", iy[i]);
for
(
i
=
0
;
i
<
N
;
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