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
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
Opus
Commits
f94bd543
Verified
Commit
f94bd543
authored
1 year ago
by
Jean-Marc Valin
Browse files
Options
Downloads
Patches
Plain Diff
Handle the sign of the DRED offset
parent
115edd9c
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
silk/dred_decoder.c
+6
-2
6 additions, 2 deletions
silk/dred_decoder.c
with
6 additions
and
2 deletions
silk/dred_decoder.c
+
6
−
2
View file @
f94bd543
...
...
@@ -36,7 +36,11 @@
#include
"dred_coding.h"
#include
"celt/entdec.h"
/* From http://graphics.stanford.edu/~seander/bithacks.html#FixedSignExtend */
static
int
sign_extend
(
int
x
,
int
b
)
{
int
m
=
1U
<<
(
b
-
1
);
return
(
x
^
m
)
-
m
;
}
int
dred_ec_decode
(
OpusDRED
*
dec
,
const
opus_uint8
*
bytes
,
int
num_bytes
,
int
min_feature_frames
)
...
...
@@ -57,7 +61,7 @@ int dred_ec_decode(OpusDRED *dec, const opus_uint8 *bytes, int num_bytes, int mi
/* decode initial state and initialize RDOVAE decoder */
ec_dec_init
(
&
ec
,
(
unsigned
char
*
)
bytes
,
num_bytes
);
dec
->
dred_offset
=
ec_dec_uint
(
&
ec
,
32
);
dec
->
dred_offset
=
sign_extend
(
ec_dec_uint
(
&
ec
,
32
)
,
5
)
;
q0
=
ec_dec_uint
(
&
ec
,
16
);
dQ
=
ec_dec_uint
(
&
ec
,
8
);
/*printf("%d %d %d\n", dred_offset, q0, dQ);*/
...
...
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