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

gitlab.xiph.org/xiph/opus.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJean-Marc Valin <jean-marc.valin@octasic.com>2010-07-20 20:19:00 +0400
committerJean-Marc Valin <jean-marc.valin@octasic.com>2010-07-20 20:19:00 +0400
commit862e18256a4a90338b083c655fe3b7e529f9947e (patch)
treedfed07c8b3666dcf100f5032ea49dd2af03a287f /src
parent67008d23cd569595409703b8341533e8ced01baf (diff)
SILK encoder control struct no longer part of the state
Diffstat (limited to 'src')
-rw-r--r--src/hybrid_encoder.c44
-rw-r--r--src/hybrid_encoder.h1
2 files changed, 24 insertions, 21 deletions
diff --git a/src/hybrid_encoder.c b/src/hybrid_encoder.c
index 2acf3eb5..fd9f599d 100644
--- a/src/hybrid_encoder.c
+++ b/src/hybrid_encoder.c
@@ -45,9 +45,12 @@ HybridEncoder *hybrid_encoder_create(int Fs)
{
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 @@ HybridEncoder *hybrid_encoder_create(int Fs)
}
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,27 +89,35 @@ int hybrid_encode(HybridEncoder *st, const short *pcm, int frame_size,
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);
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 */
diff --git a/src/hybrid_encoder.h b/src/hybrid_encoder.h
index 6e4c62a8..adb5f1df 100644
--- a/src/hybrid_encoder.h
+++ b/src/hybrid_encoder.h
@@ -43,7 +43,6 @@ struct HybridEncoder {
CELTMode *celt_mode;
CELTEncoder *celt_enc;
void *silk_enc;
- SKP_SILK_SDK_EncControlStruct encControl;
int mode;
int bandwidth;