mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-13 17:38:59 +00:00
Numerous little changes to spandsp that haven't been pushed to Freeswitch for a
while. The only big changes are a majorly rewritten V.42 and V.42bis which are now basically functional.
This commit is contained in:
@@ -56,7 +56,7 @@
|
||||
/* This is a simple set of direct digital synthesis (DDS) functions to generate sine
|
||||
waves. This version uses a 128 entry sin/cos table to cover one quadrant. */
|
||||
|
||||
static const int16_t sine_table[DDS_STEPS] =
|
||||
static const int16_t sine_table[DDS_STEPS + 1] =
|
||||
{
|
||||
201,
|
||||
603,
|
||||
@@ -186,6 +186,7 @@ static const int16_t sine_table[DDS_STEPS] =
|
||||
32753,
|
||||
32762,
|
||||
32767,
|
||||
32767
|
||||
};
|
||||
|
||||
SPAN_DECLARE(int32_t) dds_phase_rate(float frequency)
|
||||
@@ -220,7 +221,7 @@ SPAN_DECLARE(int16_t) dds_lookup(uint32_t phase)
|
||||
phase >>= DDS_SHIFT;
|
||||
step = phase & (DDS_STEPS - 1);
|
||||
if ((phase & DDS_STEPS))
|
||||
step = (DDS_STEPS - 1) - step;
|
||||
step = DDS_STEPS - step;
|
||||
amp = sine_table[step];
|
||||
if ((phase & (2*DDS_STEPS)))
|
||||
amp = -amp;
|
||||
@@ -254,7 +255,7 @@ SPAN_DECLARE(int16_t) dds_mod(uint32_t *phase_acc, int32_t phase_rate, int16_t s
|
||||
{
|
||||
int16_t amp;
|
||||
|
||||
amp = (int16_t) (((int32_t) dds_lookup(*phase_acc + phase)*(int32_t) scale) >> 15);
|
||||
amp = (int16_t) (((int32_t) dds_lookup(*phase_acc + phase)*scale) >> 15);
|
||||
*phase_acc += phase_rate;
|
||||
return amp;
|
||||
}
|
||||
@@ -280,8 +281,8 @@ SPAN_DECLARE(complexi_t) dds_complexi_mod(uint32_t *phase_acc, int32_t phase_rat
|
||||
{
|
||||
complexi_t amp;
|
||||
|
||||
amp = complex_seti(((int32_t) dds_lookup(*phase_acc + phase + (1 << 30))*(int32_t) scale) >> 15,
|
||||
((int32_t) dds_lookup(*phase_acc + phase)*(int32_t) scale) >> 15);
|
||||
amp = complex_seti(((int32_t) dds_lookup(*phase_acc + phase + (1 << 30))*scale) >> 15,
|
||||
((int32_t) dds_lookup(*phase_acc + phase)*scale) >> 15);
|
||||
*phase_acc += phase_rate;
|
||||
return amp;
|
||||
}
|
||||
@@ -307,8 +308,8 @@ SPAN_DECLARE(complexi16_t) dds_complexi16_mod(uint32_t *phase_acc, int32_t phase
|
||||
{
|
||||
complexi16_t amp;
|
||||
|
||||
amp = complex_seti16((int16_t) (((int32_t) dds_lookup(*phase_acc + phase + (1 << 30))*(int32_t) scale) >> 15),
|
||||
(int16_t) (((int32_t) dds_lookup(*phase_acc + phase)*(int32_t) scale) >> 15));
|
||||
amp = complex_seti16((int16_t) (((int32_t) dds_lookup(*phase_acc + phase + (1 << 30))*scale) >> 15),
|
||||
(int16_t) (((int32_t) dds_lookup(*phase_acc + phase)*scale) >> 15));
|
||||
*phase_acc += phase_rate;
|
||||
return amp;
|
||||
}
|
||||
@@ -334,8 +335,8 @@ SPAN_DECLARE(complexi32_t) dds_complexi32_mod(uint32_t *phase_acc, int32_t phase
|
||||
{
|
||||
complexi32_t amp;
|
||||
|
||||
amp = complex_seti32(((int32_t) dds_lookup(*phase_acc + phase + (1 << 30))*(int32_t) scale) >> 15,
|
||||
((int32_t) dds_lookup(*phase_acc + phase)*(int32_t) scale) >> 15);
|
||||
amp = complex_seti32(((int32_t) dds_lookup(*phase_acc + phase + (1 << 30))*scale) >> 15,
|
||||
((int32_t) dds_lookup(*phase_acc + phase)*scale) >> 15);
|
||||
*phase_acc += phase_rate;
|
||||
return amp;
|
||||
}
|
||||
|
Reference in New Issue
Block a user