Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
CELT
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
CELT
Commits
bbc010c4
Commit
bbc010c4
authored
14 years ago
by
Jean-Marc Valin
Browse files
Options
Downloads
Patches
Plain Diff
Removing yshift from the fixed-point VQ search
parent
3d25e71b
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libcelt/vq.c
+6
-12
6 additions, 12 deletions
libcelt/vq.c
with
6 additions
and
12 deletions
libcelt/vq.c
+
6
−
12
View file @
bbc010c4
...
...
@@ -173,9 +173,6 @@ void alg_quant(celt_norm *X, int N, int K, int spread, int B, celt_norm *lowband
celt_word32
sum
;
celt_word32
xy
,
yy
;
int
N_1
;
/* Inverse of N, in Q14 format (even for float) */
#ifdef FIXED_POINT
int
yshift
;
#endif
SAVE_STACK
;
/* When there's no pulse, fill with noise or folded spectrum */
...
...
@@ -203,9 +200,6 @@ void alg_quant(celt_norm *X, int N, int K, int spread, int B, celt_norm *lowband
return
;
}
K
=
get_pulses
(
K
);
#ifdef FIXED_POINT
yshift
=
13
-
celt_ilog2
(
K
);
#endif
ALLOC
(
y
,
N
,
celt_norm
);
ALLOC
(
iy
,
N
,
int
);
...
...
@@ -261,7 +255,7 @@ void alg_quant(celt_norm *X, int N, int K, int spread, int B, celt_norm *lowband
#else
iy
[
j
]
=
(
int
)
floor
(
rcp
*
X
[
j
]);
#endif
y
[
j
]
=
SHL16
(
iy
[
j
],
yshift
)
;
y
[
j
]
=
iy
[
j
]
;
yy
=
MAC16_16
(
yy
,
y
[
j
],
y
[
j
]);
xy
=
MAC16_16
(
xy
,
X
[
j
],
y
[
j
]);
y
[
j
]
*=
2
;
...
...
@@ -277,14 +271,14 @@ void alg_quant(celt_norm *X, int N, int K, int spread, int B, celt_norm *lowband
#endif
if
(
pulsesLeft
>
N
+
3
)
{
celt_word16
tmp
=
SHL16
(
pulsesLeft
,
yshift
)
;
celt_word16
tmp
=
pulsesLeft
;
yy
=
MAC16_16
(
yy
,
tmp
,
tmp
);
yy
=
MAC16_16
(
yy
,
tmp
,
y
[
0
]);
iy
[
0
]
+=
pulsesLeft
;
pulsesLeft
=
0
;
}
s
=
SHL16
(
1
,
yshift
)
;
s
=
1
;
for
(
i
=
0
;
i
<
pulsesLeft
;
i
++
)
{
int
best_id
;
...
...
@@ -294,7 +288,7 @@ void alg_quant(celt_norm *X, int N, int K, int spread, int B, celt_norm *lowband
int
rshift
;
#endif
#ifdef FIXED_POINT
rshift
=
yshift
+
1
+
celt_ilog2
(
K
-
pulsesLeft
+
i
+
1
);
rshift
=
1
+
celt_ilog2
(
K
-
pulsesLeft
+
i
+
1
);
#endif
best_id
=
0
;
...
...
@@ -309,7 +303,7 @@ void alg_quant(celt_norm *X, int N, int K, int spread, int B, celt_norm *lowband
/* Temporary sums of the new pulse(s) */
Rxy
=
EXTRACT16
(
SHR32
(
MAC16_16
(
xy
,
s
,
X
[
j
]),
rshift
));
/* We're multiplying y[j] by two so we don't have to do it here */
Ryy
=
EXTRACT16
(
SHR32
(
MAC16_16
(
yy
,
s
,
y
[
j
])
,
rshift
))
;
Ryy
=
MAC16_16
(
yy
,
s
,
y
[
j
]);
/* Approximate score: we maximise Rxy/sqrt(Ryy) (we're guaranteed that
Rxy is positive because the sign is pre-computed) */
...
...
@@ -349,7 +343,7 @@ void alg_quant(celt_norm *X, int N, int K, int spread, int B, celt_norm *lowband
if
(
resynth
)
{
normalise_residual
(
iy
,
X
,
N
,
K
,
EXTRACT16
(
SHR32
(
yy
,
2
*
yshift
))
,
gain
);
normalise_residual
(
iy
,
X
,
N
,
K
,
yy
,
gain
);
exp_rotation
(
X
,
N
,
-
1
,
B
,
K
,
spread
);
}
RESTORE_STACK
;
...
...
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