ref: bce1dd0d7516aa38d511ff96611867600d0fb1bb
parent: d13cd1568d42abe06c227e15282ac3a22a19d72c
author: Jean-Marc Valin <[email protected]>
date: Fri Aug 27 12:10:39 EDT 2010
Remove check_mode()
--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -106,13 +106,6 @@
{
CELTEncoder *st;
- if (check_mode(mode) != CELT_OK)
- {
- if (error)
- *error = CELT_INVALID_MODE;
- return NULL;
- }
-
if (channels < 0 || channels > 2)
{
celt_warning("Only mono and stereo supported");
@@ -566,9 +559,6 @@
int effEnd;
SAVE_STACK;
- if (check_mode(st->mode) != CELT_OK)
- return CELT_INVALID_MODE;
-
if (nbCompressedBytes<0 || pcm==NULL)
return CELT_BAD_ARG;
@@ -925,9 +915,6 @@
VARDECL(celt_int16, in);
SAVE_STACK;
- if (check_mode(st->mode) != CELT_OK)
- return CELT_INVALID_MODE;
-
if (pcm==NULL)
return CELT_BAD_ARG;
@@ -964,9 +951,6 @@
VARDECL(celt_sig, in);
SAVE_STACK;
- if (check_mode(st->mode) != CELT_OK)
- return CELT_INVALID_MODE;
-
if (pcm==NULL)
return CELT_BAD_ARG;
@@ -1026,8 +1010,6 @@
va_list ap;
va_start(ap, request);
- if ((request!=CELT_GET_MODE_REQUEST) && (check_mode(st->mode) != CELT_OK))
- goto bad_mode;
switch (request)
{
case CELT_GET_MODE_REQUEST:
@@ -1122,9 +1104,6 @@
}
va_end(ap);
return CELT_OK;
-bad_mode:
- va_end(ap);
- return CELT_INVALID_MODE;
bad_arg:
va_end(ap);
return CELT_BAD_ARG;
@@ -1175,13 +1154,6 @@
int C;
CELTDecoder *st;
- if (check_mode(mode) != CELT_OK)
- {
- if (error)
- *error = CELT_INVALID_MODE;
- return NULL;
- }
-
if (channels < 0 || channels > 2)
{
celt_warning("Only mono and stereo supported");
@@ -1434,9 +1406,6 @@
int effEnd;
SAVE_STACK;
- if (check_mode(st->mode) != CELT_OK)
- return CELT_INVALID_MODE;
-
if (pcm==NULL)
return CELT_BAD_ARG;
@@ -1601,9 +1570,6 @@
VARDECL(celt_int16, out);
SAVE_STACK;
- if (check_mode(st->mode) != CELT_OK)
- return CELT_INVALID_MODE;
-
if (pcm==NULL)
return CELT_BAD_ARG;
@@ -1634,9 +1600,6 @@
VARDECL(celt_sig, out);
SAVE_STACK;
- if (check_mode(st->mode) != CELT_OK)
- return CELT_INVALID_MODE;
-
if (pcm==NULL)
return CELT_BAD_ARG;
@@ -1679,8 +1642,6 @@
va_list ap;
va_start(ap, request);
- if ((request!=CELT_GET_MODE_REQUEST) && (check_mode(st->mode) != CELT_OK))
- goto bad_mode;
switch (request)
{
case CELT_GET_MODE_REQUEST:
@@ -1732,9 +1693,6 @@
}
va_end(ap);
return CELT_OK;
-bad_mode:
- va_end(ap);
- return CELT_INVALID_MODE;
bad_arg:
va_end(ap);
return CELT_BAD_ARG;
--- a/libcelt/header.c
+++ b/libcelt/header.c
@@ -53,9 +53,6 @@
int celt_header_init(CELTHeader *header, const CELTMode *m, int channels)
{
-
- if (check_mode(m) != CELT_OK)
- return CELT_INVALID_MODE;
if (header==NULL)
return CELT_BAD_ARG;
@@ -66,7 +63,7 @@
header->header_size = 56;
header->sample_rate = m->Fs;
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->overlap = m->overlap;
header->bytes_per_packet = -1;
--- a/libcelt/modes.c
+++ b/libcelt/modes.c
@@ -57,8 +57,6 @@
int celt_mode_info(const CELTMode *mode, int request, celt_int32 *value)
{
- if (check_mode(mode) != CELT_OK)
- return CELT_INVALID_MODE;
switch (request)
{
case CELT_GET_LOOKAHEAD:
@@ -468,17 +466,4 @@
mode->marker_end = MODEFREED;
celt_free((CELTMode *)mode);
#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;
}
--- a/libcelt/modes.h
+++ b/libcelt/modes.h
@@ -105,8 +105,6 @@
celt_uint32 marker_end;
};
-int check_mode(const CELTMode *mode);
-
/* 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_float(CELTEncoder * restrict st, const float * pcm, float * optional_resynthesis, int frame_size, unsigned char *compressed, int nbCompressedBytes, ec_enc *enc);