/*********************************************/ /* Encode quantization indices of excitation */ /*********************************************/
static OPUS_INLINE opus_int combine_and_check( /* return ok */
opus_int *pulses_comb, /* O */ const opus_int *pulses_in, /* I */
opus_int max_pulses, /* I max value for sum of pulses */
opus_int len /* I number of output values */
)
{
opus_int k, sum;
for( k = 0; k < len; k++ ) {
sum = pulses_in[ 2 * k ] + pulses_in[ 2 * k + 1 ]; if( sum > max_pulses ) { return1;
}
pulses_comb[ k ] = sum;
}
return0;
}
/* Encode quantization indices of excitation */ void silk_encode_pulses(
ec_enc *psRangeEnc, /* I/O compressor data structure */ const opus_int signalType, /* I Signal type */ const opus_int quantOffsetType, /* I quantOffsetType */
opus_int8 pulses[], /* I quantization indices */ const opus_int frame_length /* I Frame length */
)
{
opus_int i, k, j, iter, bit, nLS, scale_down, RateLevelIndex = 0;
opus_int32 abs_q, minSumBits_Q5, sumBits_Q5;
VARDECL( opus_int, abs_pulses );
VARDECL( opus_int, sum_pulses );
VARDECL( opus_int, nRshifts );
opus_int pulses_comb[ 8 ];
opus_int *abs_pulses_ptr; const opus_int8 *pulses_ptr; const opus_uint8 *cdf_ptr; const opus_uint8 *nBits_ptr;
SAVE_STACK;
if( scale_down ) { /* We need to downscale the quantization signal */
nRshifts[ i ]++; for( k = 0; k < SHELL_CODEC_FRAME_LENGTH; k++ ) {
abs_pulses_ptr[ k ] = silk_RSHIFT( abs_pulses_ptr[ k ], 1 );
}
} else { /* Jump out of while(1) loop and go to next shell coding frame */ break;
}
}
abs_pulses_ptr += SHELL_CODEC_FRAME_LENGTH;
}
/**************/ /* Rate level */ /**************/ /* find rate level that leads to fewest bits for coding of pulses per block info */
minSumBits_Q5 = silk_int32_MAX; for( k = 0; k < N_RATE_LEVELS - 1; k++ ) {
nBits_ptr = silk_pulses_per_block_BITS_Q5[ k ];
sumBits_Q5 = silk_rate_levels_BITS_Q5[ signalType >> 1 ][ k ]; for( i = 0; i < iter; i++ ) { if( nRshifts[ i ] > 0 ) {
sumBits_Q5 += nBits_ptr[ SILK_MAX_PULSES + 1 ];
} else {
sumBits_Q5 += nBits_ptr[ sum_pulses[ i ] ];
}
} if( sumBits_Q5 < minSumBits_Q5 ) {
minSumBits_Q5 = sumBits_Q5;
RateLevelIndex = k;
}
}
ec_enc_icdf( psRangeEnc, RateLevelIndex, silk_rate_levels_iCDF[ signalType >> 1 ], 8 );
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.