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
b55b6611
Commit
b55b6611
authored
14 years ago
by
Jean-Marc Valin
Browse files
Options
Downloads
Patches
Plain Diff
Adding constrained VBR mode
parent
d8571e4b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
celt
+1
-1
1 addition, 1 deletion
celt
src/opus.h
+5
-0
5 additions, 0 deletions
src/opus.h
src/opus_encoder.c
+13
-0
13 additions, 0 deletions
src/opus_encoder.c
src/opus_encoder.h
+1
-0
1 addition, 0 deletions
src/opus_encoder.h
src/test_opus.c
+5
-0
5 additions, 0 deletions
src/test_opus.c
with
25 additions
and
1 deletion
celt
@
6f6e8b39
Subproject commit
7c328c2d7a9bb28b837d935658ec05bfd7746aa6
Subproject commit
6f6e8b39842a7d175e89f47e4d37ad5de8143ad2
This diff is collapsed.
Click to expand it.
src/opus.h
+
5
−
0
View file @
b55b6611
...
...
@@ -125,6 +125,11 @@ extern "C" {
#define OPUS_GET_VOICE_RATIO_REQUEST 19
#define OPUS_GET_VOICE_RATIO(x) OPUS_GET_VOICE_RATIO_REQUEST, __check_int_ptr(x)
#define OPUS_SET_VBR_CONSTRAINT_REQUEST 20
#define OPUS_SET_VBR_CONSTRAINT(x) OPUS_SET_VBR_CONSTRAINT_REQUEST, __check_int(x)
#define OPUS_GET_VBR_CONSTRAINT_REQUEST 21
#define OPUS_GET_VBR_CONSTRAINT(x) OPUS_GET_VBR_CONSTRAINT_REQUEST, __check_int_ptr(x)
typedef
struct
OpusEncoder
OpusEncoder
;
typedef
struct
OpusDecoder
OpusDecoder
;
...
...
This diff is collapsed.
Click to expand it.
src/opus_encoder.c
+
13
−
0
View file @
b55b6611
...
...
@@ -360,6 +360,7 @@ int opus_encode(OpusEncoder *st, const short *pcm, int frame_size,
if
(
st
->
use_vbr
)
{
celt_encoder_ctl
(
st
->
celt_enc
,
CELT_SET_VBR
(
1
));
celt_encoder_ctl
(
st
->
celt_enc
,
CELT_SET_VBR_CONSTRAINT
(
st
->
vbr_constraint
));
celt_encoder_ctl
(
st
->
celt_enc
,
CELT_SET_BITRATE
(
st
->
bitrate_bps
));
nb_compr_bytes
=
max_data_bytes
-
1
;
}
else
{
...
...
@@ -616,6 +617,18 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...)
*
value
=
st
->
voice_ratio
;
}
break
;
case
OPUS_SET_VBR_CONSTRAINT_REQUEST
:
{
int
value
=
va_arg
(
ap
,
int
);
st
->
vbr_constraint
=
value
;
}
break
;
case
OPUS_GET_VBR_CONSTRAINT_REQUEST
:
{
int
*
value
=
va_arg
(
ap
,
int
*
);
*
value
=
st
->
vbr_constraint
;
}
break
;
default:
fprintf
(
stderr
,
"unknown opus_encoder_ctl() request: %d"
,
request
);
break
;
...
...
This diff is collapsed.
Click to expand it.
src/opus_encoder.h
+
1
−
0
View file @
b55b6611
...
...
@@ -51,6 +51,7 @@ struct OpusEncoder {
/* Sampling rate (at the API level) */
int
Fs
;
int
use_vbr
;
int
vbr_constraint
;
int
bitrate_bps
;
int
encoder_buffer
;
int
delay_compensation
;
...
...
This diff is collapsed.
Click to expand it.
src/test_opus.c
+
5
−
0
View file @
b55b6611
...
...
@@ -82,6 +82,7 @@ int main(int argc, char *argv[])
int
complexity
;
int
use_inbandfec
;
int
use_dtx
;
int
cvbr
=
0
;
int
packet_loss_perc
;
int
count
=
0
,
count_act
=
0
,
k
;
int
skip
;
...
...
@@ -169,6 +170,9 @@ int main(int argc, char *argv[])
}
else
if
(
STR_CASEINSENSITIVE_COMPARE
(
argv
[
args
],
"-inbandfec"
)
==
0
)
{
use_inbandfec
=
1
;
args
++
;
}
else
if
(
STR_CASEINSENSITIVE_COMPARE
(
argv
[
args
],
"-cvbr"
)
==
0
)
{
cvbr
=
1
;
args
++
;
}
else
if
(
STR_CASEINSENSITIVE_COMPARE
(
argv
[
args
],
"-dtx"
)
==
0
)
{
use_dtx
=
1
;
args
++
;
...
...
@@ -222,6 +226,7 @@ int main(int argc, char *argv[])
opus_encoder_ctl
(
enc
,
OPUS_SET_BITRATE
(
bitrate_bps
));
opus_encoder_ctl
(
enc
,
OPUS_SET_BANDWIDTH
(
bandwidth
));
opus_encoder_ctl
(
enc
,
OPUS_SET_VBR_FLAG
(
use_vbr
));
opus_encoder_ctl
(
enc
,
OPUS_SET_VBR_CONSTRAINT
(
cvbr
));
opus_encoder_ctl
(
enc
,
OPUS_SET_COMPLEXITY
(
complexity
));
opus_encoder_ctl
(
enc
,
OPUS_SET_INBAND_FEC_FLAG
(
use_inbandfec
));
opus_encoder_ctl
(
enc
,
OPUS_SET_DTX_FLAG
(
use_dtx
));
...
...
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