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
a847b775
Commit
a847b775
authored
17 years ago
by
Jean-Marc Valin
Browse files
Options
Downloads
Patches
Plain Diff
fixed-point: done with mix_pitch_and_residual() though a bit of cleaning up
wouldn't hurt
parent
1ca07225
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libcelt/vq.c
+26
-3
26 additions, 3 deletions
libcelt/vq.c
with
26 additions
and
3 deletions
libcelt/vq.c
+
26
−
3
View file @
a847b775
...
...
@@ -59,6 +59,29 @@ static inline float approx_inv(float x)
#define approx_inv(x) (1.f/(x))
#endif
#ifdef FIXED_POINT
#define C0 3634
#define C1 21173
#define C2 -12627
#define C3 4204
static
inline
celt_word32_t
celt_sqrt
(
celt_word32_t
x
)
{
int
k
;
//printf ("%d ", x);
celt_word32_t
rt
;
/* ((EC_ILOG(x)-1)>>1) is just the int log4(x) (EC_ILOG returns log2 + 1) */
k
=
((
EC_ILOG
(
x
)
-
1
)
>>
1
)
-
6
;
x
=
VSHR32
(
x
,
(
k
<<
1
));
rt
=
ADD16
(
C0
,
MULT16_16_Q14
(
x
,
ADD16
(
C1
,
MULT16_16_Q14
(
x
,
ADD16
(
C2
,
MULT16_16_Q14
(
x
,
(
C3
)))))));
rt
=
VSHR32
(
rt
,
7
-
k
);
//printf ("%d\n", rt);
return
rt
;
}
#else
#define celt_sqrt sqrt
#endif
/** Takes the pitch vector and the decoded residual vector (non-compressed),
applies the compression in the pitch direction, computes the gain that will
give ||p+g*y||=1 and mixes the residual with the pitch. */
...
...
@@ -66,7 +89,7 @@ static void mix_pitch_and_residual(int *iy, celt_norm_t *X, int N, int K, celt_n
{
int
i
;
celt_word32_t
Ryp
,
Ryy
,
Rpp
;
floa
t
g
;
celt_word32_
t
g
;
VARDECL
(
celt_norm_t
*
y
);
#ifdef FIXED_POINT
int
yshift
=
14
-
EC_ILOG
(
K
);
...
...
@@ -99,10 +122,10 @@ static void mix_pitch_and_residual(int *iy, celt_norm_t *X, int N, int K, celt_n
Ryy
=
MAC16_16
(
Ryy
,
y
[
i
],
y
[
i
]);
/* g = (sqrt(Ryp^2 + Ryy - Rpp*Ryy)-Ryp)/Ryy */
g
=
(
sqrt
(
MULT16_16
(
PSHR32
(
Ryp
,
14
),
PSHR32
(
Ryp
,
14
))
+
Ryy
-
MULT16_16
(
PSHR32
(
Ryy
,
14
),
PSHR32
(
Rpp
,
14
)))
-
PSHR32
(
Ryp
,
14
)
)
/
Ryy
;
g
=
DIV32
(
SHL32
(
celt_
sqrt
(
MULT16_16
(
PSHR32
(
Ryp
,
14
),
PSHR32
(
Ryp
,
14
))
+
Ryy
-
MULT16_16
(
PSHR32
(
Ryy
,
14
),
PSHR32
(
Rpp
,
14
)))
-
PSHR32
(
Ryp
,
14
)
,
14
),
PSHR32
(
Ryy
,
14
))
;
for
(
i
=
0
;
i
<
N
;
i
++
)
X
[
i
]
=
P
[
i
]
+
NORM_SCALING
*
g
*
y
[
i
]
;
X
[
i
]
=
P
[
i
]
+
MULT16_32_Q14
(
y
[
i
],
g
)
;
}
/** All the info necessary to keep track of a hypothesis during the search */
...
...
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