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
5aaf1233
Commit
5aaf1233
authored
15 years ago
by
Jean-Marc Valin
Browse files
Options
Downloads
Patches
Plain Diff
Enabling more than 128 pulses for N=3 and N=4.
parent
8eadcdc6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
libcelt/arch.h
+2
-0
2 additions, 0 deletions
libcelt/arch.h
libcelt/rate.h
+34
-11
34 additions, 11 deletions
libcelt/rate.h
with
36 additions
and
11 deletions
libcelt/arch.h
+
2
−
0
View file @
5aaf1233
...
...
@@ -49,6 +49,8 @@
#endif
#define IMUL32(a,b) ((a)*(b))
#define UMUL32(a,b) ((celt_int32_t)(a)*(celt_int32_t)(b))
#define UMUL16_16(a,b) ((celt_int32_t)(a)*(celt_int32_t)(b))
#define ABS(x) ((x) < 0 ? (-(x)) : (x))
/**< Absolute integer value. */
#define ABS16(x) ((x) < 0 ? (-(x)) : (x))
/**< Absolute 16-bit value. */
...
...
This diff is collapsed.
Click to expand it.
libcelt/rate.h
+
34
−
11
View file @
5aaf1233
...
...
@@ -49,21 +49,37 @@ static inline int bits2pulses(const CELTMode *m, const celt_int16_t *cache, int
hi
=
MAX_PULSES
-
1
;
/* Use of more than MAX_PULSES is disabled until we are able to cwrs that decently */
if
(
0
&&
bits
>
cache
[
MAX_PULSES
-
1
]
&&
N
==
3
)
if
(
bits
>
cache
[
MAX_PULSES
-
1
]
&&
N
<=
4
)
{
/*int pulses;
pulses = 127;
while (16 + log2_frac(2*(pulses+1)*(pulses+1) + 1, 4) <= bits && pulses < 32767)
pulses++;*/
lo
=
127
;
hi
=
32767
;
for
(
i
=
0
;
i
<
15
;
i
++
)
switch
(
N
)
{
int
pulses
=
(
lo
+
hi
)
>>
1
;
if
(
16
+
log2_frac
(
2
*
pulses
*
pulses
+
1
,
4
)
>
bits
)
hi
=
pulses
;
else
lo
=
pulses
;
case
3
:
hi
=
32767
;
for
(
i
=
0
;
i
<
15
;
i
++
)
{
int
pulses
=
(
lo
+
hi
)
>>
1
;
if
(
log2_frac
(((
UMUL16_16
(
pulses
,
pulses
)
>>
1
)
+
1
)
>>
1
,
4
)
>
bits
)
hi
=
pulses
;
else
lo
=
pulses
;
}
break
;
case
4
:
hi
=
1172
;
for
(
i
=
0
;
i
<
15
;
i
++
)
{
int
pulses
=
(
lo
+
hi
)
>>
1
;
if
(
log2_frac
((
UMUL32
(
UMUL16_16
(
pulses
,
pulses
)
+
2
,
pulses
))
/
3
<<
3
,
4
)
>
bits
)
hi
=
pulses
;
else
lo
=
pulses
;
}
break
;
}
return
lo
;
}
...
...
@@ -89,11 +105,18 @@ static inline int bits2pulses(const CELTMode *m, const celt_int16_t *cache, int
static
inline
int
pulses2bits
(
const
celt_int16_t
*
cache
,
int
N
,
int
pulses
)
{
/* Use of more than MAX_PULSES is disabled until we are able to cwrs that decently */
if
(
0
&&
pulses
>
127
)
if
(
pulses
>
127
)
{
int
bits
;
celt_assert
(
N
==
3
);
bits
=
16
+
log2_frac
(
2
*
pulses
*
pulses
+
1
,
4
);
switch
(
N
)
{
case
3
:
bits
=
log2_frac
(((
UMUL16_16
(
pulses
,
pulses
)
>>
1
)
+
1
)
>>
1
,
4
);
break
;
case
4
:
bits
=
log2_frac
((
UMUL32
(
UMUL16_16
(
pulses
,
pulses
)
+
2
,
pulses
))
/
3
<<
3
,
4
);
break
;
}
/*printf ("%d <- %d\n", bits, pulses);*/
return
bits
;
}
...
...
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