ref: 862e18256a4a90338b083c655fe3b7e529f9947e
parent: 67008d23cd569595409703b8341533e8ced01baf
author: Jean-Marc Valin <[email protected]>
date: Tue Jul 20 08:19:00 EDT 2010
SILK encoder control struct no longer part of the state
--- a/src/hybrid_encoder.c
+++ b/src/hybrid_encoder.c
@@ -45,9 +45,12 @@
{
HybridEncoder *st;
int ret, encSizeBytes;
+ SKP_SILK_SDK_EncControlStruct encControl;
st = calloc(sizeof(HybridEncoder), 1);
+ st->Fs = Fs;
+
/* Create SILK encoder */
ret = SKP_Silk_SDK_Get_Encoder_Size( &encSizeBytes );
if( ret ) {
@@ -55,23 +58,16 @@
}
st->silk_enc = malloc(encSizeBytes);
- ret = SKP_Silk_SDK_InitEncoder( st->silk_enc, &st->encControl );
+ /*encControl.API_sampleRate = st->Fs;
+ encControl.packetLossPercentage = 0;
+ encControl.useInBandFEC = 0;
+ encControl.useDTX = 0;
+ encControl.complexity = 2;*/
+ ret = SKP_Silk_SDK_InitEncoder( st->silk_enc, &encControl );
if( ret ) {
/* Handle error */
}
- st->Fs = Fs;
-
- /* Set Encoder parameters */
- st->encControl.API_sampleRate = Fs;
- st->encControl.maxInternalSampleRate = 16000;
- st->encControl.packetSize = Fs/50;
- st->encControl.packetLossPercentage = 0;
- st->encControl.useInBandFEC = 0;
- st->encControl.useDTX = 0;
- st->encControl.complexity = 2;
- st->encControl.bitRate = 18000;
-
/* Create CELT encoder */
/* We should not have to create a CELT mode for each encoder state */
st->celt_mode = celt_mode_create(Fs, Fs/50, NULL);
@@ -93,6 +89,7 @@
SKP_int16 nBytes;
ec_enc enc;
ec_byte_buffer buf;
+ SKP_SILK_SDK_EncControlStruct encControl;
ec_byte_writeinit_buffer(&buf, data, bytes_per_packet);
ec_enc_init(&enc,&buf);
@@ -99,21 +96,28 @@
if (st->mode != MODE_CELT_ONLY)
{
- st->encControl.bitRate = (bytes_per_packet*50*8+6000)/2;
+ /* Set Encoder parameters */
+ encControl.API_sampleRate = st->Fs;
+ encControl.packetLossPercentage = 0;
+ encControl.useInBandFEC = 0;
+ encControl.useDTX = 0;
+ encControl.complexity = 2;
+
+ encControl.bitRate = (bytes_per_packet*50*8+6000)/2;
if (st->Fs / frame_size == 100)
- st->encControl.bitRate += 5000;
- st->encControl.packetSize = frame_size;
+ encControl.bitRate += 5000;
+ encControl.packetSize = frame_size;
if (st->bandwidth == BANDWIDTH_NARROWBAND)
- st->encControl.maxInternalSampleRate = 8000;
+ encControl.maxInternalSampleRate = 8000;
else if (st->bandwidth == BANDWIDTH_MEDIUMBAND)
- st->encControl.maxInternalSampleRate = 12000;
+ encControl.maxInternalSampleRate = 12000;
else
- st->encControl.maxInternalSampleRate = 16000;
+ encControl.maxInternalSampleRate = 16000;
/* Call SILK encoder for the low band */
nBytes = bytes_per_packet;
- ret = SKP_Silk_SDK_Encode( st->silk_enc, &st->encControl, pcm, frame_size, &enc, &nBytes );
+ ret = SKP_Silk_SDK_Encode( st->silk_enc, &encControl, pcm, frame_size, &enc, &nBytes );
if( ret ) {
fprintf (stderr, "SILK encode error\n");
/* Handle error */
--- a/src/hybrid_encoder.h
+++ b/src/hybrid_encoder.h
@@ -43,7 +43,6 @@
CELTMode *celt_mode;
CELTEncoder *celt_enc;
void *silk_enc;
- SKP_SILK_SDK_EncControlStruct encControl;
int mode;
int bandwidth;