diff --git a/libcelt/celt.c b/libcelt/celt.c index df4097cdf67322eb38fa5c5a43bd68c976d26bb3..eb0268982a6942827c39ea2c8ae3a713220d1ba2 100644 --- a/libcelt/celt.c +++ b/libcelt/celt.c @@ -106,13 +106,6 @@ CELTEncoder *celt_encoder_create(const CELTMode *mode, int channels, int *error) { 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 celt_encode_with_ec_float(CELTEncoder * restrict st, const celt_sig * pcm, c 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 @@ int celt_encode_with_ec_float(CELTEncoder * restrict st, const float * pcm, floa 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 @@ int celt_encode_with_ec(CELTEncoder * restrict st, const celt_int16 * pcm, celt_ 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 @@ int celt_encoder_ctl(CELTEncoder * restrict st, int request, ...) 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 @@ int celt_encoder_ctl(CELTEncoder * restrict st, int request, ...) } 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 @@ CELTDecoder *celt_decoder_create(const CELTMode *mode, int channels, int *error) 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 celt_decode_with_ec_float(CELTDecoder * restrict st, const unsigned char *da 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 @@ int celt_decode_with_ec_float(CELTDecoder * restrict st, const unsigned char *da 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 @@ int celt_decode_with_ec(CELTDecoder * restrict st, const unsigned char *data, in 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 @@ int celt_decoder_ctl(CELTDecoder * restrict st, int request, ...) 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 @@ int celt_decoder_ctl(CELTDecoder * restrict st, int request, ...) } va_end(ap); return CELT_OK; -bad_mode: - va_end(ap); - return CELT_INVALID_MODE; bad_arg: va_end(ap); return CELT_BAD_ARG; diff --git a/libcelt/header.c b/libcelt/header.c index fd0261f7e83d195d4f20caee63ca5c994e79c14b..2816cd7ed899848cdb4a0971f01e84d0e88b36e2 100644 --- a/libcelt/header.c +++ b/libcelt/header.c @@ -53,9 +53,6 @@ _le_32 (celt_uint32 i) 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 @@ int celt_header_init(CELTHeader *header, const CELTMode *m, int channels) 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; diff --git a/libcelt/modes.c b/libcelt/modes.c index 44d195af79a744725ec22cba8cdca9d28eb41872..291f131671f184dddddea4a44024d65eaaf607a4 100644 --- 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: @@ -469,16 +467,3 @@ void celt_mode_destroy(CELTMode *mode) 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; -} diff --git a/libcelt/modes.h b/libcelt/modes.h index 842a0a4436edfa6c423566379c6e98419cddf4cb..c2a14c5f7c5b67b2f3538394434f3d80d7fee1d2 100644 --- a/libcelt/modes.h +++ b/libcelt/modes.h @@ -105,8 +105,6 @@ struct CELTMode { 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);