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
aca7a630
Commit
aca7a630
authored
14 years ago
by
Jean-Marc Valin
Browse files
Options
Downloads
Patches
Plain Diff
VQ search no longer needs to put more than one pulse at a time
parent
dfb3e686
No related branches found
Branches containing commit
No related tags found
Tags containing commit
Loading
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libcelt/vq.c
+20
-12
20 additions, 12 deletions
libcelt/vq.c
with
20 additions
and
12 deletions
libcelt/vq.c
+
20
−
12
View file @
aca7a630
...
...
@@ -167,7 +167,7 @@ void alg_quant(celt_norm *X, int N, int K, int spread, int B, celt_norm *lowband
VARDECL
(
celt_norm
,
y
);
VARDECL
(
int
,
iy
);
VARDECL
(
celt_word16
,
signx
);
int
j
,
is
;
int
j
;
celt_word16
s
;
int
pulsesLeft
;
celt_word32
sum
;
...
...
@@ -270,9 +270,22 @@ void alg_quant(celt_norm *X, int N, int K, int spread, int B, celt_norm *lowband
}
celt_assert2
(
pulsesLeft
>=
1
,
"Allocated too many pulses in the quick pass"
);
/* This should never happen, but just in case it does (e.g. on silence)
we fill the first bin with pulses. */
#ifdef FIXED_POINT_DEBUG
celt_assert2
(
pulsesLeft
<=
N
+
3
,
"Not enough pulses in the quick pass"
);
#endif
if
(
pulsesLeft
>
N
+
3
)
{
celt_word16
tmp
=
SHL16
(
pulsesLeft
,
yshift
);
yy
=
MAC16_16
(
yy
,
tmp
,
tmp
);
yy
=
MAC16_16
(
yy
,
tmp
,
y
[
0
]);
iy
[
0
]
+=
pulsesLeft
;
pulsesLeft
=
0
;
}
while
(
pulsesLeft
>
0
)
{
int
pulsesAtOnce
=
1
;
int
best_id
;
celt_word16
magnitude
;
celt_word32
best_num
=
-
VERY_LARGE16
;
...
...
@@ -280,14 +293,10 @@ void alg_quant(celt_norm *X, int N, int K, int spread, int B, celt_norm *lowband
#ifdef FIXED_POINT
int
rshift
;
#endif
/* Decide on how many pulses to find at once */
pulsesAtOnce
=
(
pulsesLeft
*
N_1
)
>>
9
;
/* pulsesLeft/N */
if
(
pulsesAtOnce
<
1
)
pulsesAtOnce
=
1
;
#ifdef FIXED_POINT
rshift
=
yshift
+
1
+
celt_ilog2
(
K
-
pulsesLeft
+
pulsesAtOnce
);
rshift
=
yshift
+
1
+
celt_ilog2
(
K
-
pulsesLeft
+
1
);
#endif
magnitude
=
SHL16
(
pulsesAtOnce
,
yshift
);
magnitude
=
SHL16
(
1
,
yshift
);
best_id
=
0
;
/* The squared magnitude term gets added anyway, so we might as well
...
...
@@ -320,8 +329,7 @@ void alg_quant(celt_norm *X, int N, int K, int spread, int B, celt_norm *lowband
}
while
(
++
j
<
N
);
j
=
best_id
;
is
=
pulsesAtOnce
;
s
=
SHL16
(
is
,
yshift
);
s
=
SHL16
(
1
,
yshift
);
/* Updating the sums of the new pulse(s) */
xy
=
xy
+
MULT16_16
(
s
,
X
[
j
]);
...
...
@@ -331,8 +339,8 @@ void alg_quant(celt_norm *X, int N, int K, int spread, int B, celt_norm *lowband
/* Only now that we've made the final choice, update y/iy */
/* Multiplying y[j] by 2 so we don't have to do it everywhere else */
y
[
j
]
+=
2
*
s
;
iy
[
j
]
+=
is
;
pulsesLeft
-=
pulsesAtOnce
;
iy
[
j
]
++
;
pulsesLeft
--
;
}
/* Put the original sign back */
...
...
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