mirror of
https://github.com/xiph/opus.git
synced 2025-05-27 21:59:12 +00:00
Store decoded SILK pulses as 16-bit vector
This saves 640 bytes on the peak stack usage.
This commit is contained in:
parent
ad8371d172
commit
dce69d2b9b
7 changed files with 17 additions and 17 deletions
|
@ -74,7 +74,7 @@ void silk_encode_signs(
|
||||||
/* Decodes signs of excitation */
|
/* Decodes signs of excitation */
|
||||||
void silk_decode_signs(
|
void silk_decode_signs(
|
||||||
ec_dec *psRangeDec, /* I/O Compressor data structure */
|
ec_dec *psRangeDec, /* I/O Compressor data structure */
|
||||||
opus_int pulses[], /* I/O pulse signal */
|
opus_int16 pulses[], /* I/O pulse signal */
|
||||||
opus_int length, /* I length of input */
|
opus_int length, /* I length of input */
|
||||||
const opus_int signalType, /* I Signal type */
|
const opus_int signalType, /* I Signal type */
|
||||||
const opus_int quantOffsetType, /* I Quantization offset type */
|
const opus_int quantOffsetType, /* I Quantization offset type */
|
||||||
|
@ -83,7 +83,7 @@ void silk_decode_signs(
|
||||||
{
|
{
|
||||||
opus_int i, j, p;
|
opus_int i, j, p;
|
||||||
opus_uint8 icdf[ 2 ];
|
opus_uint8 icdf[ 2 ];
|
||||||
opus_int *q_ptr;
|
opus_int16 *q_ptr;
|
||||||
const opus_uint8 *icdf_ptr;
|
const opus_uint8 *icdf_ptr;
|
||||||
|
|
||||||
icdf[ 1 ] = 0;
|
icdf[ 1 ] = 0;
|
||||||
|
|
|
@ -196,7 +196,7 @@ opus_int silk_Decode( /* O Returns error co
|
||||||
for( i = 0; i < channel_state[ 0 ].nFramesPerPacket; i++ ) {
|
for( i = 0; i < channel_state[ 0 ].nFramesPerPacket; i++ ) {
|
||||||
for( n = 0; n < decControl->nChannelsInternal; n++ ) {
|
for( n = 0; n < decControl->nChannelsInternal; n++ ) {
|
||||||
if( channel_state[ n ].LBRR_flags[ i ] ) {
|
if( channel_state[ n ].LBRR_flags[ i ] ) {
|
||||||
opus_int pulses[ MAX_FRAME_LENGTH ];
|
opus_int16 pulses[ MAX_FRAME_LENGTH ];
|
||||||
opus_int condCoding;
|
opus_int condCoding;
|
||||||
|
|
||||||
if( decControl->nChannelsInternal == 2 && n == 0 ) {
|
if( decControl->nChannelsInternal == 2 && n == 0 ) {
|
||||||
|
|
|
@ -39,7 +39,7 @@ void silk_decode_core(
|
||||||
silk_decoder_state *psDec, /* I/O Decoder state */
|
silk_decoder_state *psDec, /* I/O Decoder state */
|
||||||
silk_decoder_control *psDecCtrl, /* I Decoder control */
|
silk_decoder_control *psDecCtrl, /* I Decoder control */
|
||||||
opus_int16 xq[], /* O Decoded speech */
|
opus_int16 xq[], /* O Decoded speech */
|
||||||
const opus_int pulses[ MAX_FRAME_LENGTH ] /* I Pulse signal */
|
const opus_int16 pulses[ MAX_FRAME_LENGTH ] /* I Pulse signal */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
opus_int i, k, lag = 0, start_idx, sLTP_buf_idx, NLSF_interpolation_flag, signalType;
|
opus_int i, k, lag = 0, start_idx, sLTP_buf_idx, NLSF_interpolation_flag, signalType;
|
||||||
|
|
|
@ -47,13 +47,13 @@ opus_int silk_decode_frame(
|
||||||
{
|
{
|
||||||
VARDECL( silk_decoder_control, psDecCtrl );
|
VARDECL( silk_decoder_control, psDecCtrl );
|
||||||
opus_int L, mv_len, ret = 0;
|
opus_int L, mv_len, ret = 0;
|
||||||
VARDECL( opus_int, pulses );
|
VARDECL( opus_int16, pulses );
|
||||||
SAVE_STACK;
|
SAVE_STACK;
|
||||||
|
|
||||||
L = psDec->frame_length;
|
L = psDec->frame_length;
|
||||||
ALLOC( psDecCtrl, 1, silk_decoder_control );
|
ALLOC( psDecCtrl, 1, silk_decoder_control );
|
||||||
ALLOC( pulses, (L + SHELL_CODEC_FRAME_LENGTH - 1) &
|
ALLOC( pulses, (L + SHELL_CODEC_FRAME_LENGTH - 1) &
|
||||||
~(SHELL_CODEC_FRAME_LENGTH - 1), opus_int );
|
~(SHELL_CODEC_FRAME_LENGTH - 1), opus_int16 );
|
||||||
psDecCtrl->LTP_scale_Q14 = 0;
|
psDecCtrl->LTP_scale_Q14 = 0;
|
||||||
|
|
||||||
/* Safety checks */
|
/* Safety checks */
|
||||||
|
|
|
@ -36,7 +36,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
/*********************************************/
|
/*********************************************/
|
||||||
void silk_decode_pulses(
|
void silk_decode_pulses(
|
||||||
ec_dec *psRangeDec, /* I/O Compressor data structure */
|
ec_dec *psRangeDec, /* I/O Compressor data structure */
|
||||||
opus_int pulses[], /* O Excitation signal */
|
opus_int16 pulses[], /* O Excitation signal */
|
||||||
const opus_int signalType, /* I Sigtype */
|
const opus_int signalType, /* I Sigtype */
|
||||||
const opus_int quantOffsetType, /* I quantOffsetType */
|
const opus_int quantOffsetType, /* I quantOffsetType */
|
||||||
const opus_int frame_length /* I Frame length */
|
const opus_int frame_length /* I Frame length */
|
||||||
|
@ -44,7 +44,7 @@ void silk_decode_pulses(
|
||||||
{
|
{
|
||||||
opus_int i, j, k, iter, abs_q, nLS, RateLevelIndex;
|
opus_int i, j, k, iter, abs_q, nLS, RateLevelIndex;
|
||||||
opus_int sum_pulses[ MAX_NB_SHELL_BLOCKS ], nLshifts[ MAX_NB_SHELL_BLOCKS ];
|
opus_int sum_pulses[ MAX_NB_SHELL_BLOCKS ], nLshifts[ MAX_NB_SHELL_BLOCKS ];
|
||||||
opus_int *pulses_ptr;
|
opus_int16 *pulses_ptr;
|
||||||
const opus_uint8 *cdf_ptr;
|
const opus_uint8 *cdf_ptr;
|
||||||
|
|
||||||
/*********************/
|
/*********************/
|
||||||
|
@ -84,7 +84,7 @@ void silk_decode_pulses(
|
||||||
if( sum_pulses[ i ] > 0 ) {
|
if( sum_pulses[ i ] > 0 ) {
|
||||||
silk_shell_decoder( &pulses[ silk_SMULBB( i, SHELL_CODEC_FRAME_LENGTH ) ], psRangeDec, sum_pulses[ i ] );
|
silk_shell_decoder( &pulses[ silk_SMULBB( i, SHELL_CODEC_FRAME_LENGTH ) ], psRangeDec, sum_pulses[ i ] );
|
||||||
} else {
|
} else {
|
||||||
silk_memset( &pulses[ silk_SMULBB( i, SHELL_CODEC_FRAME_LENGTH ) ], 0, SHELL_CODEC_FRAME_LENGTH * sizeof( opus_int ) );
|
silk_memset( &pulses[ silk_SMULBB( i, SHELL_CODEC_FRAME_LENGTH ) ], 0, SHELL_CODEC_FRAME_LENGTH * sizeof( pulses[0] ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -116,7 +116,7 @@ void silk_encode_signs(
|
||||||
/* Decodes signs of excitation */
|
/* Decodes signs of excitation */
|
||||||
void silk_decode_signs(
|
void silk_decode_signs(
|
||||||
ec_dec *psRangeDec, /* I/O Compressor data structure */
|
ec_dec *psRangeDec, /* I/O Compressor data structure */
|
||||||
opus_int pulses[], /* I/O pulse signal */
|
opus_int16 pulses[], /* I/O pulse signal */
|
||||||
opus_int length, /* I length of input */
|
opus_int length, /* I length of input */
|
||||||
const opus_int signalType, /* I Signal type */
|
const opus_int signalType, /* I Signal type */
|
||||||
const opus_int quantOffsetType, /* I Quantization offset type */
|
const opus_int quantOffsetType, /* I Quantization offset type */
|
||||||
|
@ -161,7 +161,7 @@ void silk_shell_encoder(
|
||||||
|
|
||||||
/* Shell decoder, operates on one shell code frame of 16 pulses */
|
/* Shell decoder, operates on one shell code frame of 16 pulses */
|
||||||
void silk_shell_decoder(
|
void silk_shell_decoder(
|
||||||
opus_int *pulses0, /* O data: nonnegative pulse amplitudes */
|
opus_int16 *pulses0, /* O data: nonnegative pulse amplitudes */
|
||||||
ec_dec *psRangeDec, /* I/O Compressor data structure */
|
ec_dec *psRangeDec, /* I/O Compressor data structure */
|
||||||
const opus_int pulses4 /* I number of pulses per pulse-subframe */
|
const opus_int pulses4 /* I number of pulses per pulse-subframe */
|
||||||
);
|
);
|
||||||
|
@ -397,13 +397,13 @@ void silk_decode_core(
|
||||||
silk_decoder_state *psDec, /* I/O Decoder state */
|
silk_decoder_state *psDec, /* I/O Decoder state */
|
||||||
silk_decoder_control *psDecCtrl, /* I Decoder control */
|
silk_decoder_control *psDecCtrl, /* I Decoder control */
|
||||||
opus_int16 xq[], /* O Decoded speech */
|
opus_int16 xq[], /* O Decoded speech */
|
||||||
const opus_int pulses[ MAX_FRAME_LENGTH ] /* I Pulse signal */
|
const opus_int16 pulses[ MAX_FRAME_LENGTH ] /* I Pulse signal */
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Decode quantization indices of excitation (Shell coding) */
|
/* Decode quantization indices of excitation (Shell coding) */
|
||||||
void silk_decode_pulses(
|
void silk_decode_pulses(
|
||||||
ec_dec *psRangeDec, /* I/O Compressor data structure */
|
ec_dec *psRangeDec, /* I/O Compressor data structure */
|
||||||
opus_int pulses[], /* O Excitation signal */
|
opus_int16 pulses[], /* O Excitation signal */
|
||||||
const opus_int signalType, /* I Sigtype */
|
const opus_int signalType, /* I Sigtype */
|
||||||
const opus_int quantOffsetType, /* I quantOffsetType */
|
const opus_int quantOffsetType, /* I quantOffsetType */
|
||||||
const opus_int frame_length /* I Frame length */
|
const opus_int frame_length /* I Frame length */
|
||||||
|
|
|
@ -58,8 +58,8 @@ static OPUS_INLINE void encode_split(
|
||||||
}
|
}
|
||||||
|
|
||||||
static OPUS_INLINE void decode_split(
|
static OPUS_INLINE void decode_split(
|
||||||
opus_int *p_child1, /* O pulse amplitude of first child subframe */
|
opus_int16 *p_child1, /* O pulse amplitude of first child subframe */
|
||||||
opus_int *p_child2, /* O pulse amplitude of second child subframe */
|
opus_int16 *p_child2, /* O pulse amplitude of second child subframe */
|
||||||
ec_dec *psRangeDec, /* I/O Compressor data structure */
|
ec_dec *psRangeDec, /* I/O Compressor data structure */
|
||||||
const opus_int p, /* I pulse amplitude of current subframe */
|
const opus_int p, /* I pulse amplitude of current subframe */
|
||||||
const opus_uint8 *shell_table /* I table of shell cdfs */
|
const opus_uint8 *shell_table /* I table of shell cdfs */
|
||||||
|
@ -117,12 +117,12 @@ void silk_shell_encoder(
|
||||||
|
|
||||||
/* Shell decoder, operates on one shell code frame of 16 pulses */
|
/* Shell decoder, operates on one shell code frame of 16 pulses */
|
||||||
void silk_shell_decoder(
|
void silk_shell_decoder(
|
||||||
opus_int *pulses0, /* O data: nonnegative pulse amplitudes */
|
opus_int16 *pulses0, /* O data: nonnegative pulse amplitudes */
|
||||||
ec_dec *psRangeDec, /* I/O Compressor data structure */
|
ec_dec *psRangeDec, /* I/O Compressor data structure */
|
||||||
const opus_int pulses4 /* I number of pulses per pulse-subframe */
|
const opus_int pulses4 /* I number of pulses per pulse-subframe */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
opus_int pulses3[ 2 ], pulses2[ 4 ], pulses1[ 8 ];
|
opus_int16 pulses3[ 2 ], pulses2[ 4 ], pulses1[ 8 ];
|
||||||
|
|
||||||
/* this function operates on one shell code frame of 16 pulses */
|
/* this function operates on one shell code frame of 16 pulses */
|
||||||
silk_assert( SHELL_CODEC_FRAME_LENGTH == 16 );
|
silk_assert( SHELL_CODEC_FRAME_LENGTH == 16 );
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue