summaryrefslogtreecommitdiff
path: root/silk/structs.h
diff options
context:
space:
mode:
authorJean-Marc Valin <jmvalin@jmvalin.ca>2011-10-07 08:38:27 -0400
committerJean-Marc Valin <jmvalin@jmvalin.ca>2011-10-07 11:46:01 -0400
commitb5972388d7c9b0d5f5a780da23ba00dce6a2628d (patch)
tree674e0a7515fa77ae620d4cb7028f34d769e25c54 /silk/structs.h
parenta5e96b84302f2008ec32e8664356dc83efd72c17 (diff)
downloadopus-b5972388d7c9b0d5f5a780da23ba00dce6a2628d.tar.gz
Proper SILK delay compensation for resampling
Adds SILK delay compensation that depends on encode and decode sampling rate, as well as SILK internal coding rate. This ensures that the SILK part of Opus is always in sync with the CELT part no matter what the sampling rates are. It also increases the resampling delay to 1.15 ms (was previously 0.48 ms).
Diffstat (limited to 'silk/structs.h')
-rw-r--r--silk/structs.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/silk/structs.h b/silk/structs.h
index eda8173b..70c81bae 100644
--- a/silk/structs.h
+++ b/silk/structs.h
@@ -149,6 +149,7 @@ typedef struct {
opus_int minInternal_fs_Hz; /* Minimum internal sampling frequency (Hz) */
opus_int desiredInternal_fs_Hz; /* Soft request for internal sampling frequency (Hz) */
opus_int fs_kHz; /* Internal sampling frequency (kHz) */
+ opus_int delay; /* Number of samples of delay to apply */
opus_int nb_subfr; /* Number of 5 ms subframes in a frame */
opus_int frame_length; /* Frame length (samples) */
opus_int subfr_length; /* Subframe length (samples) */
@@ -192,6 +193,7 @@ typedef struct {
/* Input/output buffering */
opus_int16 inputBuf[ MAX_FRAME_LENGTH + 2 ]; /* Buffer containing input signal */
+ opus_int16 delayBuf[MAX_ENCODER_DELAY];
opus_int inputBufIx;
opus_int nFramesPerPacket;
opus_int nFramesEncoded; /* Number of frames analyzed in current packet */
@@ -257,6 +259,8 @@ typedef struct {
opus_int32 sLPC_Q14[ MAX_SUB_FRAME_LENGTH + MAX_LPC_ORDER ];
opus_int32 exc_Q10[ MAX_FRAME_LENGTH ];
opus_int16 outBuf[ 2 * MAX_FRAME_LENGTH ]; /* Buffer for output signal */
+ opus_int16 delayBuf[ MAX_DECODER_DELAY ]; /* Buffer for delaying the SILK output prior to resampling */
+ opus_int delay; /* How much decoder delay to add */
opus_int lagPrev; /* Previous Lag */
opus_int8 LastGainIndex; /* Previous gain index */
opus_int fs_kHz; /* Sampling frequency in kHz */