Commit c18fb1d0 authored by Jean-Marc Valin's avatar Jean-Marc Valin
Browse files

Added celt_encoder_ctl() and CELT_SET_COMPLEXITY

parent c591e154
......@@ -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 */
......
......@@ -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 */
......
......@@ -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;
}
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment