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
ebf72da7
Commit
ebf72da7
authored
16 years ago
by
Jean-Marc Valin
Browse files
Options
Downloads
Patches
Plain Diff
At least attempting to use all the bits.
parent
825ead82
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/rate.c
+16
-22
16 additions, 22 deletions
libcelt/rate.c
libcelt/rate.h
+1
-1
1 addition, 1 deletion
libcelt/rate.h
with
17 additions
and
23 deletions
libcelt/rate.c
+
16
−
22
View file @
ebf72da7
...
...
@@ -118,23 +118,10 @@ static inline int bits2pulses(const CELTMode *m, const celt_int16_t *cache, int
return
hi
;
}
static
int
vec_bits2pulses
(
const
CELTMode
*
m
,
const
celt_int16_t
*
const
*
cache
,
int
*
bits
,
int
*
pulses
,
int
len
)
{
int
i
;
int
sum
=
0
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
sum
+=
bits
[
i
];
}
/*printf ("sum = %d\n", sum);*/
return
sum
;
}
static
int
interp_bits2pulses
(
const
CELTMode
*
m
,
const
celt_int16_t
*
const
*
cache
,
int
*
bits1
,
int
*
bits2
,
int
*
ebits1
,
int
*
ebits2
,
int
total
,
int
*
pulses
,
int
*
bits
,
int
*
ebits
,
int
len
)
static
void
interp_bits2pulses
(
const
CELTMode
*
m
,
const
celt_int16_t
*
const
*
cache
,
int
*
bits1
,
int
*
bits2
,
int
*
ebits1
,
int
*
ebits2
,
int
total
,
int
*
pulses
,
int
*
bits
,
int
*
ebits
,
int
len
)
{
int
esum
,
psum
;
int
lo
,
hi
,
out
;
int
lo
,
hi
;
int
j
;
const
int
C
=
CHANNELS
(
m
);
SAVE_STACK
;
...
...
@@ -168,15 +155,23 @@ static int interp_bits2pulses(const CELTMode *m, const celt_int16_t * const *cac
bits
[
j
]
=
((
1
<<
BITRES
)
-
lo
)
*
bits1
[
j
]
+
lo
*
bits2
[
j
];
psum
+=
bits
[
j
];
}
out
=
psum
;
/*printf ("left to allocate: %d\n", total-C*esum-(out>>BITRES));*/
/* Allocate the remaining bits */
{
int
left
,
perband
;
left
=
((
total
-
C
*
esum
)
<<
BITRES
)
-
psum
;
perband
=
left
/
len
;
for
(
j
=
0
;
j
<
len
;
j
++
)
bits
[
j
]
+=
perband
;
left
=
left
-
len
*
perband
;
for
(
j
=
0
;
j
<
left
;
j
++
)
bits
[
j
]
++
;
}
RESTORE_STACK
;
return
(
out
+
BITROUND
)
>>
BITRES
;
}
int
compute_allocation
(
const
CELTMode
*
m
,
int
*
offsets
,
const
int
*
stereo_mode
,
int
total
,
int
*
pulses
,
int
*
ebits
)
void
compute_allocation
(
const
CELTMode
*
m
,
int
*
offsets
,
const
int
*
stereo_mode
,
int
total
,
int
*
pulses
,
int
*
ebits
)
{
int
lo
,
hi
,
len
,
ret
,
i
;
int
lo
,
hi
,
len
,
i
;
VARDECL
(
int
,
bits
);
VARDECL
(
int
,
bits1
);
VARDECL
(
int
,
bits2
);
...
...
@@ -244,7 +239,7 @@ int compute_allocation(const CELTMode *m, int *offsets, const int *stereo_mode,
if
(
bits2
[
j
]
<
0
)
bits2
[
j
]
=
0
;
}
ret
=
interp_bits2pulses
(
m
,
cache
,
bits1
,
bits2
,
ebits1
,
ebits2
,
total
,
pulses
,
bits
,
ebits
,
len
);
interp_bits2pulses
(
m
,
cache
,
bits1
,
bits2
,
ebits1
,
ebits2
,
total
,
pulses
,
bits
,
ebits
,
len
);
}
{
int
balance
=
0
;
...
...
@@ -276,6 +271,5 @@ int compute_allocation(const CELTMode *m, int *offsets, const int *stereo_mode,
//printf ("\n");
}
RESTORE_STACK
;
return
ret
;
}
This diff is collapsed.
Click to expand it.
libcelt/rate.h
+
1
−
1
View file @
ebf72da7
...
...
@@ -47,7 +47,7 @@ celt_int16_t **compute_alloc_cache(CELTMode *m, int C);
@param pulses Number of pulses per band (returned)
@return Total number of bits allocated
*/
int
compute_allocation
(
const
CELTMode
*
m
,
int
*
offsets
,
const
int
*
stereo_mode
,
int
total
,
int
*
pulses
,
int
*
ebits
);
void
compute_allocation
(
const
CELTMode
*
m
,
int
*
offsets
,
const
int
*
stereo_mode
,
int
total
,
int
*
pulses
,
int
*
ebits
);
#endif
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