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
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
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
Marcus Asteborg
Opus
Commits
04465630
Commit
04465630
authored
13 years ago
by
Jean-Marc Valin
Browse files
Options
Downloads
Patches
Plain Diff
Implements OPUS_RESET_STATE for the decoder (untested)
parent
ec8008b0
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
src/opus.h
+2
-0
2 additions, 0 deletions
src/opus.h
src/opus_decoder.c
+28
-9
28 additions, 9 deletions
src/opus_decoder.c
with
30 additions
and
9 deletions
src/opus.h
+
2
−
0
View file @
04465630
...
@@ -157,6 +157,8 @@ extern "C" {
...
@@ -157,6 +157,8 @@ extern "C" {
#define OPUS_GET_LOOKAHEAD_REQUEST 27
#define OPUS_GET_LOOKAHEAD_REQUEST 27
#define OPUS_GET_LOOKAHEAD(x) OPUS_GET_LOOKAHEAD_REQUEST, __opus_check_int_ptr(x)
#define OPUS_GET_LOOKAHEAD(x) OPUS_GET_LOOKAHEAD_REQUEST, __opus_check_int_ptr(x)
#define OPUS_RESET_STATE 28
/* For testing purposes: the encoder and decoder state should
/* For testing purposes: the encoder and decoder state should
always be identical after coding a payload */
always be identical after coding a payload */
#define OPUS_GET_FINAL_RANGE_REQUEST 29
#define OPUS_GET_FINAL_RANGE_REQUEST 29
...
...
This diff is collapsed.
Click to expand it.
src/opus_decoder.c
+
28
−
9
View file @
04465630
...
@@ -50,17 +50,19 @@ struct OpusDecoder {
...
@@ -50,17 +50,19 @@ struct OpusDecoder {
int
celt_dec_offset
;
int
celt_dec_offset
;
int
silk_dec_offset
;
int
silk_dec_offset
;
int
channels
;
int
channels
;
int
Fs
;
/** Sampling rate (at the API level) */
/* Everything beyond this point gets cleared on a reset */
#define OPUS_DECODER_RESET_START stream_channels
int
stream_channels
;
int
stream_channels
;
int
bandwidth
;
int
bandwidth
;
/* Sampling rate (at the API level) */
int
mode
;
int
Fs
;
int
prev_mode
;
int
mode
;
int
frame_size
;
int
prev_mode
;
int
prev_redundancy
;
int
frame_size
;
int
prev_redundancy
;
int
rangeFinal
;
int
rangeFinal
;
};
};
#ifdef FIXED_POINT
#ifdef FIXED_POINT
...
@@ -216,7 +218,6 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data,
...
@@ -216,7 +218,6 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data,
{
{
data
=
NULL
;
data
=
NULL
;
/* In that case, don't conceal more than what the ToC says */
/* In that case, don't conceal more than what the ToC says */
/* FIXME: What if st->frame_size has never been set? */
frame_size
=
IMIN
(
frame_size
,
st
->
frame_size
);
frame_size
=
IMIN
(
frame_size
,
st
->
frame_size
);
}
}
if
(
data
!=
NULL
)
if
(
data
!=
NULL
)
...
@@ -759,6 +760,24 @@ int opus_decoder_ctl(OpusDecoder *st, int request, ...)
...
@@ -759,6 +760,24 @@ int opus_decoder_ctl(OpusDecoder *st, int request, ...)
*
value
=
st
->
rangeFinal
;
*
value
=
st
->
rangeFinal
;
}
}
break
;
break
;
case
OPUS_RESET_STATE
:
{
void
*
silk_dec
;
CELTDecoder
*
celt_dec
;
silk_dec
=
(
char
*
)
st
+
st
->
silk_dec_offset
;
celt_dec
=
(
CELTDecoder
*
)((
char
*
)
st
+
st
->
celt_dec_offset
);
OPUS_CLEAR
((
char
*
)
&
st
->
OPUS_DECODER_RESET_START
,
opus_decoder_get_size
(
st
->
channels
)
-
((
char
*
)
&
st
->
OPUS_DECODER_RESET_START
-
(
char
*
)
st
));
celt_decoder_ctl
(
celt_dec
,
CELT_RESET_STATE
);
silk_InitDecoder
(
silk_dec
);
st
->
stream_channels
=
st
->
channels
;
st
->
frame_size
=
st
->
Fs
/
400
;
}
break
;
default:
default:
/*fprintf(stderr, "unknown opus_decoder_ctl() request: %d", request);*/
/*fprintf(stderr, "unknown opus_decoder_ctl() request: %d", request);*/
ret
=
OPUS_BAD_ARG
;
ret
=
OPUS_BAD_ARG
;
...
...
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