Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/quite/celt.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Marc Valin <jean-marc.valin@octasic.com>2011-03-21 18:32:50 +0300
committerJean-Marc Valin <jean-marc.valin@octasic.com>2011-03-21 18:32:50 +0300
commitff96b165feadf5c0bb5c75c3013d3447bd57298a (patch)
treed074ee4f37f7aa14d972aab65c0d2c37a0ecb8b1
parentd6bf19d22db8b4f758307cbb1666426254e22201 (diff)
Removes the celt_mode_info() call.
Adds a CELT_GET_LOOKAHEAD() ctl() call instead. Other uses of celt_mode_info() should not be needed anymore.
-rw-r--r--libcelt/celt.c8
-rw-r--r--libcelt/celt.h15
-rw-r--r--libcelt/header.c3
-rw-r--r--libcelt/modes.c32
-rw-r--r--libcelt/testcelt.c2
-rw-r--r--tools/celtdec.c4
-rw-r--r--tools/celtenc.c15
7 files changed, 23 insertions, 56 deletions
diff --git a/libcelt/celt.c b/libcelt/celt.c
index a6ca4ee..411ba45 100644
--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -2748,6 +2748,14 @@ int celt_decoder_ctl(CELTDecoder * restrict st, int request, ...)
st->error = 0;
}
break;
+ case CELT_GET_LOOKAHEAD_REQUEST:
+ {
+ int *value = va_arg(ap, int*);
+ if (value==NULL)
+ goto bad_arg;
+ *value = st->overlap/st->downsample;
+ }
+ break;
case CELT_RESET_STATE:
{
CELT_MEMSET((char*)&st->DECODER_RESET_START, 0,
diff --git a/libcelt/celt.h b/libcelt/celt.h
index 91dcc5e..b6f2e26 100644
--- a/libcelt/celt.h
+++ b/libcelt/celt.h
@@ -108,6 +108,9 @@ extern "C" {
#define CELT_GET_AND_CLEAR_ERROR_REQUEST 15
#define CELT_GET_AND_CLEAR_ERROR(x) CELT_GET_AND_CLEAR_ERROR_REQUEST, _celt_check_int_ptr(x)
+#define CELT_GET_LOOKAHEAD_REQUEST 17
+#define CELT_GET_LOOKAHEAD(x) CELT_GET_LOOKAHEAD_REQUEST, _celt_check_int_ptr(x)
+
/* Internal */
#define CELT_SET_START_BAND_REQUEST 10000
#define CELT_SET_START_BAND(x) CELT_SET_START_BAND_REQUEST, _celt_check_int(x)
@@ -121,15 +124,6 @@ extern "C" {
#define CELT_SET_SIGNALLING_REQUEST 10003
#define CELT_SET_SIGNALLING(x) CELT_SET_SIGNALLING_REQUEST, _celt_check_int(x)
-/** GET the lookahead used in the current mode */
-#define CELT_GET_LOOKAHEAD 1001
-/** GET the sample rate used in the current mode */
-#define CELT_GET_SAMPLE_RATE 1003
-
-/** GET the bit-stream version for compatibility check */
-#define CELT_GET_BITSTREAM_VERSION 2000
-
-
/** Contains the state of an encoder. One encoder state is needed
for each stream. It is initialised once at the beginning of the
stream. Do *not* re-initialise the state for every frame.
@@ -171,9 +165,6 @@ EXPORT CELTMode *celt_mode_create(celt_int32 Fs, int frame_size, int *error);
*/
EXPORT void celt_mode_destroy(CELTMode *mode);
-/** Query information from a mode */
-EXPORT int celt_mode_info(const CELTMode *mode, int request, celt_int32 *value);
-
/* Encoder stuff */
EXPORT int celt_encoder_get_size(int channels);
diff --git a/libcelt/header.c b/libcelt/header.c
index b31a5b7..37b11bf 100644
--- a/libcelt/header.c
+++ b/libcelt/header.c
@@ -55,7 +55,8 @@ int celt_header_init(CELTHeader *header, const CELTMode *m, int frame_size, int
CELT_COPY(header->codec_id, "CELT ", 8);
CELT_COPY(header->codec_version, "experimental ", 20);
- celt_mode_info(m, CELT_GET_BITSTREAM_VERSION, &header->version_id);
+ /* FIXME: Set that to zero when we freeze */
+ header->version_id = 0x80001000;
header->header_size = 56;
header->sample_rate = m->Fs;
header->nb_channels = channels;
diff --git a/libcelt/modes.c b/libcelt/modes.c
index 7aa6eba..968bc2f 100644
--- a/libcelt/modes.c
+++ b/libcelt/modes.c
@@ -74,25 +74,6 @@ static const unsigned char band_allocation[] = {
#endif
-int celt_mode_info(const CELTMode *mode, int request, celt_int32 *value)
-{
- switch (request)
- {
- case CELT_GET_LOOKAHEAD:
- *value = mode->overlap;
- break;
- case CELT_GET_BITSTREAM_VERSION:
- *value = CELT_BITSTREAM_VERSION;
- break;
- case CELT_GET_SAMPLE_RATE:
- *value = mode->Fs;
- break;
- default:
- return CELT_UNIMPLEMENTED;
- }
- return CELT_OK;
-}
-
#ifdef CUSTOM_MODES
/* Defining 25 critical bands for the full 0-20 kHz audio bandwidth
@@ -243,23 +224,12 @@ static void compute_allocation_table(CELTMode *mode)
CELTMode *celt_mode_create(celt_int32 Fs, int frame_size, int *error)
{
int i;
- CELTMode *mode=NULL;
#ifdef CUSTOM_MODES
+ CELTMode *mode=NULL;
int res;
celt_word16 *window;
celt_int16 *logN;
int LM;
-#endif
-#ifdef STDIN_TUNING
- scanf("%d ", &MIN_BINS);
- scanf("%d ", &BITALLOC_SIZE);
- band_allocation = celt_alloc(sizeof(int)*BARK_BANDS*BITALLOC_SIZE);
- for (i=0;i<BARK_BANDS*BITALLOC_SIZE;i++)
- {
- scanf("%d ", band_allocation+i);
- }
-#endif
-#ifdef CUSTOM_MODES
ALLOC_STACK;
#if !defined(VAR_ARRAYS) && !defined(USE_ALLOCA)
if (global_stack==NULL)
diff --git a/libcelt/testcelt.c b/libcelt/testcelt.c
index 72b70ba..d889a5b 100644
--- a/libcelt/testcelt.c
+++ b/libcelt/testcelt.c
@@ -78,7 +78,6 @@ int main(int argc, char *argv[])
return 1;
}
- celt_mode_info(mode, CELT_GET_LOOKAHEAD, &skip);
bytes_per_packet = atoi(argv[4]);
if (bytes_per_packet < 0 || bytes_per_packet > MAX_PACKET)
{
@@ -114,6 +113,7 @@ int main(int argc, char *argv[])
fprintf(stderr, "Failed to create the decoder: %s\n", celt_strerror(err));
return 1;
}
+ celt_decoder_ctl(dec, CELT_GET_LOOKAHEAD(&skip));
if (argc>7)
{
diff --git a/tools/celtdec.c b/tools/celtdec.c
index 5edbd48..30cc87d 100644
--- a/tools/celtdec.c
+++ b/tools/celtdec.c
@@ -304,8 +304,8 @@ static CELTDecoder *process_header(ogg_packet *op, celt_int32 enh_enabled, celt_
return NULL;
}
-
- celt_mode_info(*mode, CELT_GET_BITSTREAM_VERSION, &bitstream);
+ /* FIXME: Set that to zero when we freeze */
+ bitstream = 0x80001000;
if (bitstream!=header.version_id)
fprintf(stderr, "WARNING: Input was encoded with a CELT bitstream version %d. This decoder uses %d. Output will probably be corrupted.\n",header.version_id,bitstream);
diff --git a/tools/celtenc.c b/tools/celtenc.c
index 1f92607..685c62c 100644
--- a/tools/celtenc.c
+++ b/tools/celtenc.c
@@ -308,8 +308,7 @@ int main(int argc, char **argv)
celt_int32 lookahead = 0;
int bytes_per_packet=-1;
int complexity=-127;
- int prediction=2;
- int bitstream;
+ int prediction=2;
/*Process command-line options*/
@@ -483,9 +482,7 @@ int main(int argc, char **argv)
if (!mode)
return 1;
- celt_mode_info(mode,CELT_GET_BITSTREAM_VERSION,&bitstream);
-
- snprintf(vendor_string, sizeof(vendor_string), "Encoded with CELT %s (bitstream: %d)\n",CELT_VERSION,bitstream);
+ snprintf(vendor_string, sizeof(vendor_string), "Encoded with CELT %s\n",CELT_VERSION);
comment_init(&comments, &comments_length, vendor_string);
/*celt_mode_info(mode, CELT_GET_FRAME_SIZE, &frame_size);*/
@@ -499,11 +496,11 @@ int main(int argc, char **argv)
st_string="stereo";
if (!quiet)
if (with_cbr)
- fprintf (stderr, "Encoding %.0f kHz %s audio in %.0fms packets at %0.3fkbit/sec (%d bytes per packet, CBR) with bitstream version %d\n",
- header.sample_rate/1000., st_string, frame_size/(float)header.sample_rate*1000., bitrate, bytes_per_packet,bitstream);
+ fprintf (stderr, "Encoding %.0f kHz %s audio in %.0fms packets at %0.3fkbit/sec (%d bytes per packet, CBR)\n",
+ header.sample_rate/1000., st_string, frame_size/(float)header.sample_rate*1000., bitrate, bytes_per_packet);
else
- fprintf (stderr, "Encoding %.0f kHz %s audio in %.0fms packets at %0.3fkbit/sec (%d bytes per packet maximum) with bitstream version %d\n",
- header.sample_rate/1000., st_string, frame_size/(float)header.sample_rate*1000., bitrate, bytes_per_packet,bitstream);
+ fprintf (stderr, "Encoding %.0f kHz %s audio in %.0fms packets at %0.3fkbit/sec (%d bytes per packet maximum)\n",
+ header.sample_rate/1000., st_string, frame_size/(float)header.sample_rate*1000., bitrate, bytes_per_packet);
}
/*Initialize CELT encoder*/