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
b3c05b6b
Commit
b3c05b6b
authored
14 years ago
by
Timothy B. Terriberry
Committed by
Jean-Marc Valin
14 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Implements ec_enc_patch_initial_bits()
parent
079b9169
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/entenc.c
+25
-0
25 additions, 0 deletions
libcelt/entenc.c
with
25 additions
and
0 deletions
libcelt/entenc.c
+
25
−
0
View file @
b3c05b6b
...
...
@@ -215,6 +215,31 @@ void ec_enc_bits(ec_enc *_this,ec_uint32 _fl,unsigned _bits){
_this
->
nbits_total
+=
_bits
;
}
int
ec_enc_patch_initial_bits
(
ec_enc
*
_this
,
unsigned
_val
,
int
_nbits
){
int
shift
;
unsigned
mask
;
if
(
_nbits
<
0
||
_nbits
>
EC_SYM_BITS
)
return
-
1
;
shift
=
EC_SYM_BITS
-
_nbits
;
mask
=
(
1
<<
_nbits
)
-
1
<<
shift
;
if
(
_this
->
offs
>
0
){
/*The first byte has been finalized.*/
_this
->
buf
[
0
]
=
(
unsigned
char
)(
_this
->
buf
[
0
]
&~
mask
|
_val
<<
shift
);
}
else
if
(
_this
->
rem
>=
0
){
/*The first byte is still awaiting carry propagation.*/
_this
->
rem
=
_this
->
rem
&~
mask
|
_val
<<
shift
;
}
else
if
(
_this
->
rng
<=
EC_CODE_TOP
>>
shift
){
/*The renormalization loop has never been run.*/
_this
->
val
=
_this
->
val
&~
((
ec_uint32
)
mask
<<
EC_CODE_SHIFT
)
|
(
ec_uint32
)
_val
<<
EC_CODE_SHIFT
+
shift
;
}
/*The encoder hasn't even encoded _nbits of data yet.*/
else
return
-
1
;
/*Success!*/
return
0
;
}
void
ec_enc_shrink
(
ec_enc
*
_this
,
ec_uint32
_size
){
celt_assert
(
_this
->
offs
+
_this
->
end_offs
<=
_size
);
CELT_MOVE
(
_this
->
buf
+
_size
-
_this
->
end_offs
,
...
...
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