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
9ba17435
Commit
9ba17435
authored
13 years ago
by
Jean-Marc Valin
Browse files
Options
Downloads
Patches
Plain Diff
Implements OPUS_SET_MAX_BANDWIDTH()
parent
9dc0e404
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
celt/opus_defines.h
+16
-13
16 additions, 13 deletions
celt/opus_defines.h
src/opus_encoder.c
+26
-0
26 additions, 0 deletions
src/opus_encoder.c
with
42 additions
and
13 deletions
celt/opus_defines.h
+
16
−
13
View file @
9ba17435
...
...
@@ -77,31 +77,34 @@ extern "C" {
/** These are the actual Encoder CTL ID numbers.
* They should not be used directly by applications. */
#define OPUS_SET_
COMPLEXITY
_REQUEST
40
1
0
#define OPUS_GET_
COMPLEXITY
_REQUEST
40
1
1
#define OPUS_SET_
APPLICATION
_REQUEST 40
0
0
#define OPUS_GET_
APPLICATION
_REQUEST 40
0
1
#define OPUS_SET_BITRATE_REQUEST 4002
#define OPUS_GET_BITRATE_REQUEST 4003
#define OPUS_SET_MAX_BANDWIDTH_REQUEST 4004
#define OPUS_GET_MAX_BANDWIDTH_REQUEST 4005
#define OPUS_SET_VBR_REQUEST 4006
#define OPUS_GET_VBR_REQUEST 4007
#define OPUS_SET_VBR_CONSTRAINT_REQUEST 4020
#define OPUS_GET_VBR_CONSTRAINT_REQUEST 4021
#define OPUS_SET_FORCE_CHANNELS_REQUEST 4022
#define OPUS_GET_FORCE_CHANNELS_REQUEST 4023
#define OPUS_SET_BANDWIDTH_REQUEST 4008
#define OPUS_GET_BANDWIDTH_REQUEST 4009
#define OPUS_SET_SIGNAL_REQUEST 4024
#define OPUS_GET_SIGNAL_REQUEST 4025
#define OPUS_SET_VOICE_RATIO_REQUEST 4018
#define OPUS_GET_VOICE_RATIO_REQUEST 4019
#define OPUS_SET_APPLICATION_REQUEST 4000
#define OPUS_GET_APPLICATION_REQUEST 4001
#define OPUS_GET_LOOKAHEAD_REQUEST 4027
#define OPUS_SET_COMPLEXITY_REQUEST 4010
#define OPUS_GET_COMPLEXITY_REQUEST 4011
#define OPUS_SET_INBAND_FEC_REQUEST 4012
#define OPUS_GET_INBAND_FEC_REQUEST 4013
#define OPUS_SET_PACKET_LOSS_PERC_REQUEST 4014
#define OPUS_GET_PACKET_LOSS_PERC_REQUEST 4015
#define OPUS_SET_DTX_REQUEST 4016
#define OPUS_GET_DTX_REQUEST 4017
#define OPUS_SET_VOICE_RATIO_REQUEST 4018
#define OPUS_GET_VOICE_RATIO_REQUEST 4019
#define OPUS_SET_VBR_CONSTRAINT_REQUEST 4020
#define OPUS_GET_VBR_CONSTRAINT_REQUEST 4021
#define OPUS_SET_FORCE_CHANNELS_REQUEST 4022
#define OPUS_GET_FORCE_CHANNELS_REQUEST 4023
#define OPUS_SET_SIGNAL_REQUEST 4024
#define OPUS_GET_SIGNAL_REQUEST 4025
#define OPUS_GET_LOOKAHEAD_REQUEST 4027
/* #define OPUS_RESET_STATE 4028 */
#define OPUS_GET_FINAL_RANGE_REQUEST 4031
#define OPUS_GET_PITCH_REQUEST 4033
...
...
This diff is collapsed.
Click to expand it.
src/opus_encoder.c
+
26
−
0
View file @
9ba17435
...
...
@@ -60,6 +60,7 @@ struct OpusEncoder {
int
force_channels
;
int
signal_type
;
int
user_bandwidth
;
int
max_bandwidth
;
int
user_forced_mode
;
int
voice_ratio
;
opus_int32
Fs
;
...
...
@@ -202,6 +203,7 @@ int opus_encoder_init(OpusEncoder* st, opus_int32 Fs, int channels, int applicat
st
->
application
=
application
;
st
->
signal_type
=
OPUS_AUTO
;
st
->
user_bandwidth
=
OPUS_AUTO
;
st
->
max_bandwidth
=
OPUS_BANDWIDTH_FULLBAND
;
st
->
force_channels
=
OPUS_AUTO
;
st
->
user_forced_mode
=
OPUS_AUTO
;
st
->
voice_ratio
=
-
1
;
...
...
@@ -673,6 +675,9 @@ int opus_encode_float(OpusEncoder *st, const opus_val16 *pcm, int frame_size,
st
->
bandwidth
=
OPUS_BANDWIDTH_WIDEBAND
;
}
if
(
st
->
bandwidth
>
st
->
max_bandwidth
)
st
->
bandwidth
=
st
->
max_bandwidth
;
if
(
st
->
user_bandwidth
!=
OPUS_AUTO
)
st
->
bandwidth
=
st
->
user_bandwidth
;
...
...
@@ -1268,6 +1273,27 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...)
*
value
=
st
->
force_channels
;
}
break
;
case
OPUS_SET_MAX_BANDWIDTH_REQUEST
:
{
opus_int32
value
=
va_arg
(
ap
,
opus_int32
);
if
(
value
<
OPUS_BANDWIDTH_NARROWBAND
||
value
>
OPUS_BANDWIDTH_FULLBAND
)
return
OPUS_BAD_ARG
;
st
->
max_bandwidth
=
value
;
if
(
st
->
max_bandwidth
==
OPUS_BANDWIDTH_NARROWBAND
)
{
st
->
silk_mode
.
maxInternalSampleRate
=
8000
;
}
else
if
(
st
->
max_bandwidth
==
OPUS_BANDWIDTH_MEDIUMBAND
)
{
st
->
silk_mode
.
maxInternalSampleRate
=
12000
;
}
else
{
st
->
silk_mode
.
maxInternalSampleRate
=
16000
;
}
}
break
;
case
OPUS_GET_MAX_BANDWIDTH_REQUEST
:
{
opus_int32
*
value
=
va_arg
(
ap
,
opus_int32
*
);
*
value
=
st
->
max_bandwidth
;
}
break
;
case
OPUS_SET_BANDWIDTH_REQUEST
:
{
opus_int32
value
=
va_arg
(
ap
,
opus_int32
);
...
...
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