ref: 0410e9ca817e7f9c05fed02bfcde6edcd5eb0401
parent: 02a3527aa4f2f752df495f20f8ff1613a91f2905
author: Jean-Marc Valin <[email protected]>
date: Fri Aug 27 12:02:30 EDT 2010
Removing check_decoder()
--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -925,9 +925,6 @@
VARDECL(celt_int16, in);
SAVE_STACK;
- if (check_encoder(st) != CELT_OK)
- return CELT_INVALID_STATE;
-
if (check_mode(st->mode) != CELT_OK)
return CELT_INVALID_MODE;
@@ -1151,7 +1148,6 @@
@brief Decoder state
*/
struct CELTDecoder {
- celt_uint32 marker;
const CELTMode *mode;
int overlap;
int channels;
@@ -1165,22 +1161,6 @@
celt_sig _decode_mem[1];
};
-int check_decoder(const CELTDecoder *st)
-{
- if (st==NULL)
- {
- celt_warning("NULL passed a decoder structure");
- return CELT_INVALID_STATE;
- }
- if (st->marker == DECODERVALID)
- return CELT_OK;
- if (st->marker == DECODERFREED)
- celt_warning("Referencing a decoder that has already been freed");
- else
- celt_warning("This is not a valid CELT decoder structure");
- return CELT_INVALID_STATE;
-}
-
int celt_decoder_get_size(const CELTMode *mode, int channels)
{
int size = sizeof(struct CELTDecoder)
@@ -1231,14 +1211,7 @@
if (error)
*error = CELT_OK;
- st->marker = DECODERVALID;
return st;
-
- /* If the setup fails for some reason deallocate it. */
- celt_decoder_destroy(st);
- if (error)
- *error = CELT_ALLOC_FAIL;
- return NULL;
}
void celt_decoder_destroy(CELTDecoder *st)
@@ -1461,9 +1434,6 @@
int effEnd;
SAVE_STACK;
- if (check_decoder(st) != CELT_OK)
- return CELT_INVALID_STATE;
-
if (check_mode(st->mode) != CELT_OK)
return CELT_INVALID_MODE;
@@ -1631,9 +1601,6 @@
VARDECL(celt_int16, out);
SAVE_STACK;
- if (check_decoder(st) != CELT_OK)
- return CELT_INVALID_STATE;
-
if (check_mode(st->mode) != CELT_OK)
return CELT_INVALID_MODE;
@@ -1667,9 +1634,6 @@
VARDECL(celt_sig, out);
SAVE_STACK;
- if (check_decoder(st) != CELT_OK)
- return CELT_INVALID_STATE;
-
if (check_mode(st->mode) != CELT_OK)
return CELT_INVALID_MODE;
@@ -1713,9 +1677,6 @@
int celt_decoder_ctl(CELTDecoder * restrict st, int request, ...)
{
va_list ap;
-
- if (check_decoder(st) != CELT_OK)
- return CELT_INVALID_STATE;
va_start(ap, request);
if ((request!=CELT_GET_MODE_REQUEST) && (check_mode(st->mode) != CELT_OK))