Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Mark Harris
Opus
Commits
c18fb1d0
Commit
c18fb1d0
authored
Sep 30, 2008
by
Jean-Marc Valin
Browse files
Added celt_encoder_ctl() and CELT_SET_COMPLEXITY
parent
c591e154
Changes
4
Hide whitespace changes
Inline
Side-by-side
libcelt/celt.c
View file @
c18fb1d0
...
...
@@ -711,6 +711,26 @@ int celt_encode(CELTEncoder * restrict st, celt_int16_t * restrict pcm, unsigned
}
#endif
int
celt_encoder_ctl
(
CELTEncoder
*
restrict
st
,
int
request
,
celt_int32_t
*
value
)
{
switch
(
request
)
{
case
CELT_SET_COMPLEXITY
:
{
if
(
*
value
<
0
||
*
value
>
10
)
return
CELT_BAD_ARG
;
if
(
*
value
<=
2
)
st
->
pitch_enabled
=
0
;
else
st
->
pitch_enabled
=
1
;
}
break
;
default:
return
CELT_BAD_REQUEST
;
}
return
CELT_OK
;
}
/****************************************************************************/
/* */
/* DECODER */
...
...
libcelt/celt.h
View file @
c18fb1d0
...
...
@@ -62,8 +62,12 @@ extern "C" {
#define CELT_INTERNAL_ERROR -3
/** The data passed (e.g. compressed data to decoder) is corrupted */
#define CELT_CORRUPTED_DATA -4
/** Invalid/unsupported request number */
#define CELT_BAD_REQUEST -5
/* Requests */
#define CELT_SET_COMPLEXITY 0
/** GET the frame size used in the current mode */
#define CELT_GET_FRAME_SIZE 1000
/** GET the lookahead used in the current mode */
...
...
@@ -119,7 +123,6 @@ EXPORT void celt_mode_destroy(CELTMode *mode);
/** Query information from a mode */
EXPORT
int
celt_mode_info
(
const
CELTMode
*
mode
,
int
request
,
celt_int32_t
*
value
);
/* Encoder stuff */
...
...
@@ -152,6 +155,14 @@ EXPORT void celt_encoder_destroy(CELTEncoder *st);
EXPORT
int
celt_encode_float
(
CELTEncoder
*
st
,
float
*
pcm
,
unsigned
char
*
compressed
,
int
nbCompressedBytes
);
EXPORT
int
celt_encode
(
CELTEncoder
*
st
,
celt_int16_t
*
pcm
,
unsigned
char
*
compressed
,
int
nbCompressedBytes
);
/** Query and set encoder parameters
@param st Encoder state
@param request Parameter to change or query
@param value Pointer to a 32-bit int value
@return Error code
*/
EXPORT
int
celt_encoder_ctl
(
CELTEncoder
*
restrict
st
,
int
request
,
celt_int32_t
*
value
);
/* Decoder stuff */
...
...
libcelt/modes.c
View file @
c18fb1d0
...
...
@@ -69,7 +69,7 @@ int celt_mode_info(const CELTMode *mode, int request, celt_int32_t *value)
*
value
=
CELT_BITSTREAM_VERSION
;
break
;
default:
return
CELT_BAD_
ARG
;
return
CELT_BAD_
REQUEST
;
}
return
CELT_OK
;
}
...
...
libcelt/quant_bands.c
View file @
c18fb1d0
...
...
@@ -229,7 +229,6 @@ static void unquant_fine_energy_mono(const CELTMode *m, celt_ener_t *eBands, cel
for
(
i
=
0
;
i
<
m
->
nbEBands
;
i
++
)
{
int
q2
;
celt_int16_t
frac
=
1
<<
fine_quant
[
i
];
celt_word16_t
offset
;
if
(
fine_quant
[
i
]
<=
0
)
continue
;
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment