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
04cca289
Commit
04cca289
authored
13 years ago
by
Ralph Giles
Committed by
Jean-Marc Valin
13 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Expand tabs and regularize some conditionals.
parent
039a67b3
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
src/opus_encoder.c
+55
-55
55 additions, 55 deletions
src/opus_encoder.c
with
55 additions
and
55 deletions
src/opus_encoder.c
+
55
−
55
View file @
04cca289
...
@@ -85,16 +85,16 @@ struct OpusEncoder {
...
@@ -85,16 +85,16 @@ struct OpusEncoder {
middle (memoriless) threshold. The second column is the hysteresis
middle (memoriless) threshold. The second column is the hysteresis
(difference with the middle) */
(difference with the middle) */
static
const
int
voice_bandwidth_thresholds
[
10
]
=
{
static
const
int
voice_bandwidth_thresholds
[
10
]
=
{
11000
,
1000
,
/* NB<->MB */
11000
,
1000
,
/* NB<->MB */
14000
,
1000
,
/* MB<->WB */
14000
,
1000
,
/* MB<->WB */
21000
,
2000
,
/* WB<->SWB */
21000
,
2000
,
/* WB<->SWB */
29000
,
2000
,
/* SWB<->FB */
29000
,
2000
,
/* SWB<->FB */
};
};
static
const
int
audio_bandwidth_thresholds
[
10
]
=
{
static
const
int
audio_bandwidth_thresholds
[
10
]
=
{
30000
,
0
,
/* MB not allowed */
30000
,
0
,
/* MB not allowed */
20000
,
2000
,
/* MB<->WB */
20000
,
2000
,
/* MB<->WB */
26000
,
2000
,
/* WB<->SWB */
26000
,
2000
,
/* WB<->SWB */
33000
,
2000
,
/* SWB<->FB */
33000
,
2000
,
/* SWB<->FB */
};
};
...
@@ -103,7 +103,7 @@ int opus_encoder_get_size(int channels)
...
@@ -103,7 +103,7 @@ int opus_encoder_get_size(int channels)
int
silkEncSizeBytes
,
celtEncSizeBytes
;
int
silkEncSizeBytes
,
celtEncSizeBytes
;
int
ret
;
int
ret
;
ret
=
silk_Get_Encoder_Size
(
&
silkEncSizeBytes
);
ret
=
silk_Get_Encoder_Size
(
&
silkEncSizeBytes
);
if
(
ret
)
if
(
ret
)
return
0
;
return
0
;
silkEncSizeBytes
=
align
(
silkEncSizeBytes
);
silkEncSizeBytes
=
align
(
silkEncSizeBytes
);
celtEncSizeBytes
=
celt_encoder_get_size
(
channels
);
celtEncSizeBytes
=
celt_encoder_get_size
(
channels
);
...
@@ -117,7 +117,7 @@ OpusEncoder *opus_encoder_init(OpusEncoder* st, int Fs, int channels, int applic
...
@@ -117,7 +117,7 @@ OpusEncoder *opus_encoder_init(OpusEncoder* st, int Fs, int channels, int applic
int
err
;
int
err
;
int
ret
,
silkEncSizeBytes
;
int
ret
,
silkEncSizeBytes
;
if
(
channels
>
2
||
channels
<
1
)
if
(
channels
>
2
||
channels
<
1
)
return
NULL
;
return
NULL
;
if
(
application
<
OPUS_APPLICATION_VOIP
||
application
>
OPUS_APPLICATION_AUDIO
)
if
(
application
<
OPUS_APPLICATION_VOIP
||
application
>
OPUS_APPLICATION_AUDIO
)
return
NULL
;
return
NULL
;
...
@@ -127,9 +127,9 @@ OpusEncoder *opus_encoder_init(OpusEncoder* st, int Fs, int channels, int applic
...
@@ -127,9 +127,9 @@ OpusEncoder *opus_encoder_init(OpusEncoder* st, int Fs, int channels, int applic
memset
(
st
,
0
,
opus_encoder_get_size
(
channels
));
memset
(
st
,
0
,
opus_encoder_get_size
(
channels
));
/* Create SILK encoder */
/* Create SILK encoder */
ret
=
silk_Get_Encoder_Size
(
&
silkEncSizeBytes
);
ret
=
silk_Get_Encoder_Size
(
&
silkEncSizeBytes
);
if
(
ret
)
if
(
ret
)
return
NULL
;
return
NULL
;
silkEncSizeBytes
=
align
(
silkEncSizeBytes
);
silkEncSizeBytes
=
align
(
silkEncSizeBytes
);
st
->
silk_enc_offset
=
align
(
sizeof
(
OpusEncoder
));
st
->
silk_enc_offset
=
align
(
sizeof
(
OpusEncoder
));
st
->
celt_enc_offset
=
st
->
silk_enc_offset
+
silkEncSizeBytes
;
st
->
celt_enc_offset
=
st
->
silk_enc_offset
+
silkEncSizeBytes
;
silk_enc
=
(
char
*
)
st
+
st
->
silk_enc_offset
;
silk_enc
=
(
char
*
)
st
+
st
->
silk_enc_offset
;
...
@@ -140,7 +140,7 @@ OpusEncoder *opus_encoder_init(OpusEncoder* st, int Fs, int channels, int applic
...
@@ -140,7 +140,7 @@ OpusEncoder *opus_encoder_init(OpusEncoder* st, int Fs, int channels, int applic
st
->
Fs
=
Fs
;
st
->
Fs
=
Fs
;
ret
=
silk_InitEncoder
(
silk_enc
,
&
st
->
silk_mode
);
ret
=
silk_InitEncoder
(
silk_enc
,
&
st
->
silk_mode
);
if
(
ret
)
if
(
ret
)
goto
failure
;
goto
failure
;
/* default SILK parameters */
/* default SILK parameters */
...
@@ -165,7 +165,7 @@ OpusEncoder *opus_encoder_init(OpusEncoder* st, int Fs, int channels, int applic
...
@@ -165,7 +165,7 @@ OpusEncoder *opus_encoder_init(OpusEncoder* st, int Fs, int channels, int applic
/* Initialize CELT encoder */
/* Initialize CELT encoder */
celt_encoder_init
(
celt_enc
,
Fs
,
channels
,
&
err
);
celt_encoder_init
(
celt_enc
,
Fs
,
channels
,
&
err
);
if
(
err
!=
CELT_OK
)
if
(
err
!=
CELT_OK
)
goto
failure
;
goto
failure
;
celt_encoder_ctl
(
celt_enc
,
CELT_SET_SIGNALLING
(
0
));
celt_encoder_ctl
(
celt_enc
,
CELT_SET_SIGNALLING
(
0
));
st
->
mode
=
MODE_HYBRID
;
st
->
mode
=
MODE_HYBRID
;
...
@@ -225,15 +225,15 @@ OpusEncoder *opus_encoder_create(int Fs, int channels, int mode)
...
@@ -225,15 +225,15 @@ OpusEncoder *opus_encoder_create(int Fs, int channels, int mode)
{
{
char
*
raw_state
=
(
char
*
)
malloc
(
opus_encoder_get_size
(
channels
));
char
*
raw_state
=
(
char
*
)
malloc
(
opus_encoder_get_size
(
channels
));
if
(
raw_state
==
NULL
)
if
(
raw_state
==
NULL
)
return
NULL
;
return
NULL
;
return
opus_encoder_init
((
OpusEncoder
*
)
raw_state
,
Fs
,
channels
,
mode
);
return
opus_encoder_init
((
OpusEncoder
*
)
raw_state
,
Fs
,
channels
,
mode
);
}
}
#ifdef FIXED_POINT
#ifdef FIXED_POINT
int
opus_encode
(
OpusEncoder
*
st
,
const
opus_val16
*
pcm
,
int
frame_size
,
int
opus_encode
(
OpusEncoder
*
st
,
const
opus_val16
*
pcm
,
int
frame_size
,
unsigned
char
*
data
,
int
max_data_bytes
)
unsigned
char
*
data
,
int
max_data_bytes
)
#else
#else
int
opus_encode_float
(
OpusEncoder
*
st
,
const
opus_val16
*
pcm
,
int
frame_size
,
int
opus_encode_float
(
OpusEncoder
*
st
,
const
opus_val16
*
pcm
,
int
frame_size
,
unsigned
char
*
data
,
int
max_data_bytes
)
unsigned
char
*
data
,
int
max_data_bytes
)
#endif
#endif
{
{
void
*
silk_enc
;
void
*
silk_enc
;
...
@@ -510,7 +510,7 @@ int opus_encode_float(OpusEncoder *st, const opus_val16 *pcm, int frame_size,
...
@@ -510,7 +510,7 @@ int opus_encode_float(OpusEncoder *st, const opus_val16 *pcm, int frame_size,
pcm_silk
=
st
->
delay_buffer
;
pcm_silk
=
st
->
delay_buffer
;
#else
#else
for
(
i
=
0
;
i
<
st
->
encoder_buffer
*
st
->
channels
;
i
++
)
for
(
i
=
0
;
i
<
st
->
encoder_buffer
*
st
->
channels
;
i
++
)
pcm_silk
[
i
]
=
FLOAT2INT16
(
st
->
delay_buffer
[
i
]);
pcm_silk
[
i
]
=
FLOAT2INT16
(
st
->
delay_buffer
[
i
]);
#endif
#endif
silk_Encode
(
silk_enc
,
&
st
->
silk_mode
,
pcm_silk
,
st
->
encoder_buffer
,
NULL
,
&
zero
,
1
);
silk_Encode
(
silk_enc
,
&
st
->
silk_mode
,
pcm_silk
,
st
->
encoder_buffer
,
NULL
,
&
zero
,
1
);
}
}
...
@@ -519,7 +519,7 @@ int opus_encode_float(OpusEncoder *st, const opus_val16 *pcm, int frame_size,
...
@@ -519,7 +519,7 @@ int opus_encode_float(OpusEncoder *st, const opus_val16 *pcm, int frame_size,
pcm_silk
=
pcm
;
pcm_silk
=
pcm
;
#else
#else
for
(
i
=
0
;
i
<
frame_size
*
st
->
channels
;
i
++
)
for
(
i
=
0
;
i
<
frame_size
*
st
->
channels
;
i
++
)
pcm_silk
[
i
]
=
FLOAT2INT16
(
pcm
[
i
]);
pcm_silk
[
i
]
=
FLOAT2INT16
(
pcm
[
i
]);
#endif
#endif
ret
=
silk_Encode
(
silk_enc
,
&
st
->
silk_mode
,
pcm_silk
,
frame_size
,
&
enc
,
&
nBytes
,
0
);
ret
=
silk_Encode
(
silk_enc
,
&
st
->
silk_mode
,
pcm_silk
,
frame_size
,
&
enc
,
&
nBytes
,
0
);
if
(
ret
)
{
if
(
ret
)
{
...
@@ -555,9 +555,9 @@ int opus_encode_float(OpusEncoder *st, const opus_val16 *pcm, int frame_size,
...
@@ -555,9 +555,9 @@ int opus_encode_float(OpusEncoder *st, const opus_val16 *pcm, int frame_size,
endband
=
13
;
endband
=
13
;
break
;
break
;
case
OPUS_BANDWIDTH_MEDIUMBAND
:
case
OPUS_BANDWIDTH_MEDIUMBAND
:
case
OPUS_BANDWIDTH_WIDEBAND
:
case
OPUS_BANDWIDTH_WIDEBAND
:
endband
=
17
;
endband
=
17
;
break
;
break
;
case
OPUS_BANDWIDTH_SUPERWIDEBAND
:
case
OPUS_BANDWIDTH_SUPERWIDEBAND
:
endband
=
19
;
endband
=
19
;
break
;
break
;
...
@@ -652,7 +652,7 @@ int opus_encode_float(OpusEncoder *st, const opus_val16 *pcm, int frame_size,
...
@@ -652,7 +652,7 @@ int opus_encode_float(OpusEncoder *st, const opus_val16 *pcm, int frame_size,
redundancy_bytes
=
IMIN
(
257
,
st
->
bitrate_bps
/
1600
);
redundancy_bytes
=
IMIN
(
257
,
st
->
bitrate_bps
/
1600
);
ec_enc_bit_logp
(
&
enc
,
celt_to_silk
,
1
);
ec_enc_bit_logp
(
&
enc
,
celt_to_silk
,
1
);
if
(
st
->
mode
==
MODE_HYBRID
)
if
(
st
->
mode
==
MODE_HYBRID
)
ec_enc_uint
(
&
enc
,
redundancy_bytes
-
2
,
256
);
ec_enc_uint
(
&
enc
,
redundancy_bytes
-
2
,
256
);
}
}
start_band
=
17
;
start_band
=
17
;
}
}
...
@@ -714,13 +714,13 @@ int opus_encode_float(OpusEncoder *st, const opus_val16 *pcm, int frame_size,
...
@@ -714,13 +714,13 @@ int opus_encode_float(OpusEncoder *st, const opus_val16 *pcm, int frame_size,
if
(
frame_size
>
st
->
encoder_buffer
)
if
(
frame_size
>
st
->
encoder_buffer
)
{
{
for
(
i
=
0
;
i
<
st
->
encoder_buffer
*
st
->
channels
;
i
++
)
for
(
i
=
0
;
i
<
st
->
encoder_buffer
*
st
->
channels
;
i
++
)
st
->
delay_buffer
[
i
]
=
pcm
[(
frame_size
-
st
->
encoder_buffer
)
*
st
->
channels
+
i
];
st
->
delay_buffer
[
i
]
=
pcm
[(
frame_size
-
st
->
encoder_buffer
)
*
st
->
channels
+
i
];
}
else
{
}
else
{
int
tmp
=
st
->
encoder_buffer
-
frame_size
;
int
tmp
=
st
->
encoder_buffer
-
frame_size
;
for
(
i
=
0
;
i
<
tmp
*
st
->
channels
;
i
++
)
for
(
i
=
0
;
i
<
tmp
*
st
->
channels
;
i
++
)
st
->
delay_buffer
[
i
]
=
st
->
delay_buffer
[
i
+
frame_size
*
st
->
channels
];
st
->
delay_buffer
[
i
]
=
st
->
delay_buffer
[
i
+
frame_size
*
st
->
channels
];
for
(
i
=
0
;
i
<
frame_size
*
st
->
channels
;
i
++
)
for
(
i
=
0
;
i
<
frame_size
*
st
->
channels
;
i
++
)
st
->
delay_buffer
[
tmp
*
st
->
channels
+
i
]
=
pcm
[
i
];
st
->
delay_buffer
[
tmp
*
st
->
channels
+
i
]
=
pcm
[
i
];
}
}
...
@@ -790,19 +790,19 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...)
...
@@ -790,19 +790,19 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...)
{
{
case
OPUS_SET_APPLICATION_REQUEST
:
case
OPUS_SET_APPLICATION_REQUEST
:
{
{
opus_int32
value
=
va_arg
(
ap
,
opus_int32
);
opus_int32
value
=
va_arg
(
ap
,
opus_int32
);
st
->
application
=
value
;
st
->
application
=
value
;
}
}
break
;
break
;
case
OPUS_GET_APPLICATION_REQUEST
:
case
OPUS_GET_APPLICATION_REQUEST
:
{
{
opus_int32
*
value
=
va_arg
(
ap
,
opus_int32
*
);
opus_int32
*
value
=
va_arg
(
ap
,
opus_int32
*
);
*
value
=
st
->
mode
;
*
value
=
st
->
mode
;
}
}
break
;
break
;
case
OPUS_SET_BITRATE_REQUEST
:
case
OPUS_SET_BITRATE_REQUEST
:
{
{
opus_int32
value
=
va_arg
(
ap
,
opus_int32
);
opus_int32
value
=
va_arg
(
ap
,
opus_int32
);
if
(
value
!=
OPUS_BITRATE_AUTO
)
if
(
value
!=
OPUS_BITRATE_AUTO
)
{
{
if
(
value
<=
0
)
if
(
value
<=
0
)
...
@@ -815,27 +815,27 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...)
...
@@ -815,27 +815,27 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...)
break
;
break
;
case
OPUS_GET_BITRATE_REQUEST
:
case
OPUS_GET_BITRATE_REQUEST
:
{
{
opus_int32
*
value
=
va_arg
(
ap
,
opus_int32
*
);
opus_int32
*
value
=
va_arg
(
ap
,
opus_int32
*
);
*
value
=
st
->
bitrate_bps
;
*
value
=
st
->
bitrate_bps
;
}
}
break
;
break
;
case
OPUS_SET_FORCE_MONO_REQUEST
:
case
OPUS_SET_FORCE_MONO_REQUEST
:
{
{
opus_int32
value
=
va_arg
(
ap
,
opus_int32
);
opus_int32
value
=
va_arg
(
ap
,
opus_int32
);
st
->
force_mono
=
value
;
st
->
force_mono
=
value
;
}
}
break
;
break
;
case
OPUS_GET_FORCE_MONO_REQUEST
:
case
OPUS_GET_FORCE_MONO_REQUEST
:
{
{
opus_int32
*
value
=
va_arg
(
ap
,
opus_int32
*
);
opus_int32
*
value
=
va_arg
(
ap
,
opus_int32
*
);
*
value
=
!!
st
->
force_mono
;
*
value
=
!!
st
->
force_mono
;
}
}
break
;
break
;
case
OPUS_SET_BANDWIDTH_REQUEST
:
case
OPUS_SET_BANDWIDTH_REQUEST
:
{
{
opus_int32
value
=
va_arg
(
ap
,
opus_int32
);
opus_int32
value
=
va_arg
(
ap
,
opus_int32
);
if
(
value
<
OPUS_BANDWIDTH_AUTO
||
value
>
OPUS_BANDWIDTH_FULLBAND
)
if
(
value
<
OPUS_BANDWIDTH_AUTO
||
value
>
OPUS_BANDWIDTH_FULLBAND
)
return
OPUS_BAD_ARG
;
return
OPUS_BAD_ARG
;
st
->
user_bandwidth
=
value
;
st
->
user_bandwidth
=
value
;
if
(
st
->
user_bandwidth
==
OPUS_BANDWIDTH_NARROWBAND
)
{
if
(
st
->
user_bandwidth
==
OPUS_BANDWIDTH_NARROWBAND
)
{
st
->
silk_mode
.
maxInternalSampleRate
=
8000
;
st
->
silk_mode
.
maxInternalSampleRate
=
8000
;
...
@@ -848,50 +848,50 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...)
...
@@ -848,50 +848,50 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...)
break
;
break
;
case
OPUS_GET_BANDWIDTH_REQUEST
:
case
OPUS_GET_BANDWIDTH_REQUEST
:
{
{
opus_int32
*
value
=
va_arg
(
ap
,
opus_int32
*
);
opus_int32
*
value
=
va_arg
(
ap
,
opus_int32
*
);
*
value
=
st
->
bandwidth
;
*
value
=
st
->
bandwidth
;
}
}
break
;
break
;
case
OPUS_SET_DTX_REQUEST
:
case
OPUS_SET_DTX_REQUEST
:
{
{
opus_int32
value
=
va_arg
(
ap
,
opus_int32
);
opus_int32
value
=
va_arg
(
ap
,
opus_int32
);
st
->
silk_mode
.
useDTX
=
value
;
st
->
silk_mode
.
useDTX
=
value
;
}
}
break
;
break
;
case
OPUS_GET_DTX_REQUEST
:
case
OPUS_GET_DTX_REQUEST
:
{
{
opus_int32
*
value
=
va_arg
(
ap
,
opus_int32
*
);
opus_int32
*
value
=
va_arg
(
ap
,
opus_int32
*
);
*
value
=
st
->
silk_mode
.
useDTX
;
*
value
=
st
->
silk_mode
.
useDTX
;
}
}
break
;
break
;
case
OPUS_SET_COMPLEXITY_REQUEST
:
case
OPUS_SET_COMPLEXITY_REQUEST
:
{
{
opus_int32
value
=
va_arg
(
ap
,
opus_int32
);
opus_int32
value
=
va_arg
(
ap
,
opus_int32
);
st
->
silk_mode
.
complexity
=
value
;
st
->
silk_mode
.
complexity
=
value
;
celt_encoder_ctl
(
celt_enc
,
CELT_SET_COMPLEXITY
(
value
));
celt_encoder_ctl
(
celt_enc
,
CELT_SET_COMPLEXITY
(
value
));
}
}
break
;
break
;
case
OPUS_GET_COMPLEXITY_REQUEST
:
case
OPUS_GET_COMPLEXITY_REQUEST
:
{
{
opus_int32
*
value
=
va_arg
(
ap
,
opus_int32
*
);
opus_int32
*
value
=
va_arg
(
ap
,
opus_int32
*
);
*
value
=
st
->
silk_mode
.
complexity
;
*
value
=
st
->
silk_mode
.
complexity
;
}
}
break
;
break
;
case
OPUS_SET_INBAND_FEC_FLAG_REQUEST
:
case
OPUS_SET_INBAND_FEC_FLAG_REQUEST
:
{
{
opus_int32
value
=
va_arg
(
ap
,
opus_int32
);
opus_int32
value
=
va_arg
(
ap
,
opus_int32
);
st
->
silk_mode
.
useInBandFEC
=
value
;
st
->
silk_mode
.
useInBandFEC
=
value
;
}
}
break
;
break
;
case
OPUS_GET_INBAND_FEC_FLAG_REQUEST
:
case
OPUS_GET_INBAND_FEC_FLAG_REQUEST
:
{
{
opus_int32
*
value
=
va_arg
(
ap
,
opus_int32
*
);
opus_int32
*
value
=
va_arg
(
ap
,
opus_int32
*
);
*
value
=
st
->
silk_mode
.
useInBandFEC
;
*
value
=
st
->
silk_mode
.
useInBandFEC
;
}
}
break
;
break
;
case
OPUS_SET_PACKET_LOSS_PERC_REQUEST
:
case
OPUS_SET_PACKET_LOSS_PERC_REQUEST
:
{
{
opus_int32
value
=
va_arg
(
ap
,
opus_int32
);
opus_int32
value
=
va_arg
(
ap
,
opus_int32
);
if
(
value
<
0
||
value
>
100
)
if
(
value
<
0
||
value
>
100
)
return
OPUS_BAD_ARG
;
return
OPUS_BAD_ARG
;
st
->
silk_mode
.
packetLossPercentage
=
value
;
st
->
silk_mode
.
packetLossPercentage
=
value
;
...
@@ -900,26 +900,26 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...)
...
@@ -900,26 +900,26 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...)
break
;
break
;
case
OPUS_GET_PACKET_LOSS_PERC_REQUEST
:
case
OPUS_GET_PACKET_LOSS_PERC_REQUEST
:
{
{
opus_int32
*
value
=
va_arg
(
ap
,
opus_int32
*
);
opus_int32
*
value
=
va_arg
(
ap
,
opus_int32
*
);
*
value
=
st
->
silk_mode
.
packetLossPercentage
;
*
value
=
st
->
silk_mode
.
packetLossPercentage
;
}
}
break
;
break
;
case
OPUS_SET_VBR_REQUEST
:
case
OPUS_SET_VBR_REQUEST
:
{
{
opus_int32
value
=
va_arg
(
ap
,
opus_int32
);
opus_int32
value
=
va_arg
(
ap
,
opus_int32
);
st
->
use_vbr
=
value
;
st
->
use_vbr
=
value
;
st
->
silk_mode
.
useCBR
=
1
-
value
;
st
->
silk_mode
.
useCBR
=
1
-
value
;
}
}
break
;
break
;
case
OPUS_GET_VBR_REQUEST
:
case
OPUS_GET_VBR_REQUEST
:
{
{
opus_int32
*
value
=
va_arg
(
ap
,
opus_int32
*
);
opus_int32
*
value
=
va_arg
(
ap
,
opus_int32
*
);
*
value
=
st
->
use_vbr
;
*
value
=
st
->
use_vbr
;
}
}
break
;
break
;
case
OPUS_SET_VOICE_RATIO_REQUEST
:
case
OPUS_SET_VOICE_RATIO_REQUEST
:
{
{
opus_int32
value
=
va_arg
(
ap
,
opus_int32
);
opus_int32
value
=
va_arg
(
ap
,
opus_int32
);
if
(
value
>
100
||
value
<
0
)
if
(
value
>
100
||
value
<
0
)
goto
bad_arg
;
goto
bad_arg
;
st
->
voice_ratio
=
value
;
st
->
voice_ratio
=
value
;
...
@@ -927,37 +927,37 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...)
...
@@ -927,37 +927,37 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...)
break
;
break
;
case
OPUS_GET_VOICE_RATIO_REQUEST
:
case
OPUS_GET_VOICE_RATIO_REQUEST
:
{
{
opus_int32
*
value
=
va_arg
(
ap
,
opus_int32
*
);
opus_int32
*
value
=
va_arg
(
ap
,
opus_int32
*
);
*
value
=
st
->
voice_ratio
;
*
value
=
st
->
voice_ratio
;
}
}
break
;
break
;
case
OPUS_SET_VBR_CONSTRAINT_REQUEST
:
case
OPUS_SET_VBR_CONSTRAINT_REQUEST
:
{
{
opus_int32
value
=
va_arg
(
ap
,
opus_int32
);
opus_int32
value
=
va_arg
(
ap
,
opus_int32
);
st
->
vbr_constraint
=
value
;
st
->
vbr_constraint
=
value
;
}
}
break
;
break
;
case
OPUS_GET_VBR_CONSTRAINT_REQUEST
:
case
OPUS_GET_VBR_CONSTRAINT_REQUEST
:
{
{
opus_int32
*
value
=
va_arg
(
ap
,
opus_int32
*
);
opus_int32
*
value
=
va_arg
(
ap
,
opus_int32
*
);
*
value
=
st
->
vbr_constraint
;
*
value
=
st
->
vbr_constraint
;
}
}
break
;
break
;
case
OPUS_SET_SIGNAL_REQUEST
:
case
OPUS_SET_SIGNAL_REQUEST
:
{
{
opus_int32
value
=
va_arg
(
ap
,
opus_int32
);
opus_int32
value
=
va_arg
(
ap
,
opus_int32
);
st
->
signal_type
=
value
;
st
->
signal_type
=
value
;
}
}
break
;
break
;
case
OPUS_GET_SIGNAL_REQUEST
:
case
OPUS_GET_SIGNAL_REQUEST
:
{
{
opus_int32
*
value
=
va_arg
(
ap
,
opus_int32
*
);
opus_int32
*
value
=
va_arg
(
ap
,
opus_int32
*
);
*
value
=
st
->
signal_type
;
*
value
=
st
->
signal_type
;
}
}
break
;
break
;
case
OPUS_GET_LOOKAHEAD_REQUEST
:
case
OPUS_GET_LOOKAHEAD_REQUEST
:
{
{
opus_int32
*
value
=
va_arg
(
ap
,
opus_int32
*
);
opus_int32
*
value
=
va_arg
(
ap
,
opus_int32
*
);
*
value
=
st
->
delay_compensation
+
st
->
Fs
/
400
;
*
value
=
st
->
delay_compensation
+
st
->
Fs
/
400
;
}
}
break
;
break
;
...
...
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