Remove check_mode()
This commit is contained in:
parent
d13cd1568d
commit
bce1dd0d75
4 changed files with 1 additions and 63 deletions
|
@ -106,13 +106,6 @@ CELTEncoder *celt_encoder_create(const CELTMode *mode, int channels, int *error)
|
||||||
{
|
{
|
||||||
CELTEncoder *st;
|
CELTEncoder *st;
|
||||||
|
|
||||||
if (check_mode(mode) != CELT_OK)
|
|
||||||
{
|
|
||||||
if (error)
|
|
||||||
*error = CELT_INVALID_MODE;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (channels < 0 || channels > 2)
|
if (channels < 0 || channels > 2)
|
||||||
{
|
{
|
||||||
celt_warning("Only mono and stereo supported");
|
celt_warning("Only mono and stereo supported");
|
||||||
|
@ -566,9 +559,6 @@ int celt_encode_with_ec_float(CELTEncoder * restrict st, const celt_sig * pcm, c
|
||||||
int effEnd;
|
int effEnd;
|
||||||
SAVE_STACK;
|
SAVE_STACK;
|
||||||
|
|
||||||
if (check_mode(st->mode) != CELT_OK)
|
|
||||||
return CELT_INVALID_MODE;
|
|
||||||
|
|
||||||
if (nbCompressedBytes<0 || pcm==NULL)
|
if (nbCompressedBytes<0 || pcm==NULL)
|
||||||
return CELT_BAD_ARG;
|
return CELT_BAD_ARG;
|
||||||
|
|
||||||
|
@ -925,9 +915,6 @@ int celt_encode_with_ec_float(CELTEncoder * restrict st, const float * pcm, floa
|
||||||
VARDECL(celt_int16, in);
|
VARDECL(celt_int16, in);
|
||||||
SAVE_STACK;
|
SAVE_STACK;
|
||||||
|
|
||||||
if (check_mode(st->mode) != CELT_OK)
|
|
||||||
return CELT_INVALID_MODE;
|
|
||||||
|
|
||||||
if (pcm==NULL)
|
if (pcm==NULL)
|
||||||
return CELT_BAD_ARG;
|
return CELT_BAD_ARG;
|
||||||
|
|
||||||
|
@ -964,9 +951,6 @@ int celt_encode_with_ec(CELTEncoder * restrict st, const celt_int16 * pcm, celt_
|
||||||
VARDECL(celt_sig, in);
|
VARDECL(celt_sig, in);
|
||||||
SAVE_STACK;
|
SAVE_STACK;
|
||||||
|
|
||||||
if (check_mode(st->mode) != CELT_OK)
|
|
||||||
return CELT_INVALID_MODE;
|
|
||||||
|
|
||||||
if (pcm==NULL)
|
if (pcm==NULL)
|
||||||
return CELT_BAD_ARG;
|
return CELT_BAD_ARG;
|
||||||
|
|
||||||
|
@ -1026,8 +1010,6 @@ int celt_encoder_ctl(CELTEncoder * restrict st, int request, ...)
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
va_start(ap, request);
|
va_start(ap, request);
|
||||||
if ((request!=CELT_GET_MODE_REQUEST) && (check_mode(st->mode) != CELT_OK))
|
|
||||||
goto bad_mode;
|
|
||||||
switch (request)
|
switch (request)
|
||||||
{
|
{
|
||||||
case CELT_GET_MODE_REQUEST:
|
case CELT_GET_MODE_REQUEST:
|
||||||
|
@ -1122,9 +1104,6 @@ int celt_encoder_ctl(CELTEncoder * restrict st, int request, ...)
|
||||||
}
|
}
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
return CELT_OK;
|
return CELT_OK;
|
||||||
bad_mode:
|
|
||||||
va_end(ap);
|
|
||||||
return CELT_INVALID_MODE;
|
|
||||||
bad_arg:
|
bad_arg:
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
return CELT_BAD_ARG;
|
return CELT_BAD_ARG;
|
||||||
|
@ -1175,13 +1154,6 @@ CELTDecoder *celt_decoder_create(const CELTMode *mode, int channels, int *error)
|
||||||
int C;
|
int C;
|
||||||
CELTDecoder *st;
|
CELTDecoder *st;
|
||||||
|
|
||||||
if (check_mode(mode) != CELT_OK)
|
|
||||||
{
|
|
||||||
if (error)
|
|
||||||
*error = CELT_INVALID_MODE;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (channels < 0 || channels > 2)
|
if (channels < 0 || channels > 2)
|
||||||
{
|
{
|
||||||
celt_warning("Only mono and stereo supported");
|
celt_warning("Only mono and stereo supported");
|
||||||
|
@ -1434,9 +1406,6 @@ int celt_decode_with_ec_float(CELTDecoder * restrict st, const unsigned char *da
|
||||||
int effEnd;
|
int effEnd;
|
||||||
SAVE_STACK;
|
SAVE_STACK;
|
||||||
|
|
||||||
if (check_mode(st->mode) != CELT_OK)
|
|
||||||
return CELT_INVALID_MODE;
|
|
||||||
|
|
||||||
if (pcm==NULL)
|
if (pcm==NULL)
|
||||||
return CELT_BAD_ARG;
|
return CELT_BAD_ARG;
|
||||||
|
|
||||||
|
@ -1601,9 +1570,6 @@ int celt_decode_with_ec_float(CELTDecoder * restrict st, const unsigned char *da
|
||||||
VARDECL(celt_int16, out);
|
VARDECL(celt_int16, out);
|
||||||
SAVE_STACK;
|
SAVE_STACK;
|
||||||
|
|
||||||
if (check_mode(st->mode) != CELT_OK)
|
|
||||||
return CELT_INVALID_MODE;
|
|
||||||
|
|
||||||
if (pcm==NULL)
|
if (pcm==NULL)
|
||||||
return CELT_BAD_ARG;
|
return CELT_BAD_ARG;
|
||||||
|
|
||||||
|
@ -1634,9 +1600,6 @@ int celt_decode_with_ec(CELTDecoder * restrict st, const unsigned char *data, in
|
||||||
VARDECL(celt_sig, out);
|
VARDECL(celt_sig, out);
|
||||||
SAVE_STACK;
|
SAVE_STACK;
|
||||||
|
|
||||||
if (check_mode(st->mode) != CELT_OK)
|
|
||||||
return CELT_INVALID_MODE;
|
|
||||||
|
|
||||||
if (pcm==NULL)
|
if (pcm==NULL)
|
||||||
return CELT_BAD_ARG;
|
return CELT_BAD_ARG;
|
||||||
|
|
||||||
|
@ -1679,8 +1642,6 @@ int celt_decoder_ctl(CELTDecoder * restrict st, int request, ...)
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
va_start(ap, request);
|
va_start(ap, request);
|
||||||
if ((request!=CELT_GET_MODE_REQUEST) && (check_mode(st->mode) != CELT_OK))
|
|
||||||
goto bad_mode;
|
|
||||||
switch (request)
|
switch (request)
|
||||||
{
|
{
|
||||||
case CELT_GET_MODE_REQUEST:
|
case CELT_GET_MODE_REQUEST:
|
||||||
|
@ -1732,9 +1693,6 @@ int celt_decoder_ctl(CELTDecoder * restrict st, int request, ...)
|
||||||
}
|
}
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
return CELT_OK;
|
return CELT_OK;
|
||||||
bad_mode:
|
|
||||||
va_end(ap);
|
|
||||||
return CELT_INVALID_MODE;
|
|
||||||
bad_arg:
|
bad_arg:
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
return CELT_BAD_ARG;
|
return CELT_BAD_ARG;
|
||||||
|
|
|
@ -53,9 +53,6 @@ _le_32 (celt_uint32 i)
|
||||||
|
|
||||||
int celt_header_init(CELTHeader *header, const CELTMode *m, int channels)
|
int celt_header_init(CELTHeader *header, const CELTMode *m, int channels)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (check_mode(m) != CELT_OK)
|
|
||||||
return CELT_INVALID_MODE;
|
|
||||||
if (header==NULL)
|
if (header==NULL)
|
||||||
return CELT_BAD_ARG;
|
return CELT_BAD_ARG;
|
||||||
|
|
||||||
|
@ -66,7 +63,7 @@ int celt_header_init(CELTHeader *header, const CELTMode *m, int channels)
|
||||||
header->header_size = 56;
|
header->header_size = 56;
|
||||||
header->sample_rate = m->Fs;
|
header->sample_rate = m->Fs;
|
||||||
header->nb_channels = channels;
|
header->nb_channels = channels;
|
||||||
/*FIXME: This won't work for fariable frame size */
|
/*FIXME: This won't work for variable frame size */
|
||||||
header->frame_size = m->shortMdctSize*m->nbShortMdcts;
|
header->frame_size = m->shortMdctSize*m->nbShortMdcts;
|
||||||
header->overlap = m->overlap;
|
header->overlap = m->overlap;
|
||||||
header->bytes_per_packet = -1;
|
header->bytes_per_packet = -1;
|
||||||
|
|
|
@ -57,8 +57,6 @@
|
||||||
|
|
||||||
int celt_mode_info(const CELTMode *mode, int request, celt_int32 *value)
|
int celt_mode_info(const CELTMode *mode, int request, celt_int32 *value)
|
||||||
{
|
{
|
||||||
if (check_mode(mode) != CELT_OK)
|
|
||||||
return CELT_INVALID_MODE;
|
|
||||||
switch (request)
|
switch (request)
|
||||||
{
|
{
|
||||||
case CELT_GET_LOOKAHEAD:
|
case CELT_GET_LOOKAHEAD:
|
||||||
|
@ -469,16 +467,3 @@ void celt_mode_destroy(CELTMode *mode)
|
||||||
celt_free((CELTMode *)mode);
|
celt_free((CELTMode *)mode);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int check_mode(const CELTMode *mode)
|
|
||||||
{
|
|
||||||
if (mode==NULL)
|
|
||||||
return CELT_INVALID_MODE;
|
|
||||||
if (mode->marker_start == MODEVALID && mode->marker_end == MODEVALID)
|
|
||||||
return CELT_OK;
|
|
||||||
if (mode->marker_start == MODEFREED || mode->marker_end == MODEFREED)
|
|
||||||
celt_warning("Using a mode that has already been freed");
|
|
||||||
else
|
|
||||||
celt_warning("This is not a valid CELT mode");
|
|
||||||
return CELT_INVALID_MODE;
|
|
||||||
}
|
|
||||||
|
|
|
@ -105,8 +105,6 @@ struct CELTMode {
|
||||||
celt_uint32 marker_end;
|
celt_uint32 marker_end;
|
||||||
};
|
};
|
||||||
|
|
||||||
int check_mode(const CELTMode *mode);
|
|
||||||
|
|
||||||
/* Prototypes for _ec versions of the encoder/decoder calls (not public) */
|
/* Prototypes for _ec versions of the encoder/decoder calls (not public) */
|
||||||
int celt_encode_with_ec(CELTEncoder * restrict st, const celt_int16 * pcm, celt_int16 * optional_resynthesis, int frame_size, unsigned char *compressed, int nbCompressedBytes, ec_enc *enc);
|
int celt_encode_with_ec(CELTEncoder * restrict st, const celt_int16 * pcm, celt_int16 * optional_resynthesis, int frame_size, unsigned char *compressed, int nbCompressedBytes, ec_enc *enc);
|
||||||
int celt_encode_with_ec_float(CELTEncoder * restrict st, const float * pcm, float * optional_resynthesis, int frame_size, unsigned char *compressed, int nbCompressedBytes, ec_enc *enc);
|
int celt_encode_with_ec_float(CELTEncoder * restrict st, const float * pcm, float * optional_resynthesis, int frame_size, unsigned char *compressed, int nbCompressedBytes, ec_enc *enc);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue