Lots of little cosmetic cleanups

This commit is contained in:
Steve Underwood committed 2013-03-14 21:22:51 +08:00
1 parent 16289ce9a4
commit d163c6338e
110 files changed
+7259 -762

No files matched your search

+1 -1
View File
@@ -101,7 +101,7 @@ SPAN_DECLARE(void) cfilter_delete(cfilter_t *cfi)
SPAN_DECLARE(complexf_t) cfilter_step(cfilter_t *cfi, const complexf_t *z)
{
complexf_t cc;
cc.re = filter_step(cfi->ref, z->re);
cc.im = filter_step(cfi->imf, z->im);
return cc;
+31 -31
View File
@@ -39,37 +39,37 @@
static const uint32_t crc_itu32_table[] =
{
0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3,
0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91,
0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7,
0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5,
0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B,
0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59,
0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F,
0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D,
0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433,
0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01,
0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457,
0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65,
0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB,
0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9,
0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F,
0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD,
0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683,
0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1,
0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7,
0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5,
0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B,
0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79,
0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F,
0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D,
0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713,
0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21,
0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777,
0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45,
0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB,
0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9,
0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF,
0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3,
0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91,
0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7,
0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5,
0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B,
0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59,
0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F,
0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D,
0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433,
0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01,
0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457,
0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65,
0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB,
0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9,
0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F,
0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD,
0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683,
0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1,
0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7,
0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5,
0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B,
0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79,
0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F,
0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D,
0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713,
0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21,
0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777,
0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45,
0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB,
0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9,
0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF,
0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D
};
+1 -1
View File
@@ -348,7 +348,7 @@ SPAN_DECLARE(int16_t) dds_lookup(uint32_t phase)
step = DDS_STEPS - step;
amp = sine_table[step];
if ((phase & (2*DDS_STEPS)))
amp = -amp;
amp = -amp;
return amp;
}
/*- End of function --------------------------------------------------------*/
+2 -2
View File
@@ -22,7 +22,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*! \file */
#if defined(HAVE_CONFIG_H)
@@ -129,7 +129,7 @@ SPAN_DECLARE(int) dtmf_rx(dtmf_rx_state_t *s, const int16_t amp[], int samples)
limit = sample + (DTMF_SAMPLES_PER_BLOCK - s->current_sample);
else
limit = samples;
/* The following unrolled loop takes only 35% (rough estimate) of the
/* The following unrolled loop takes only 35% (rough estimate) of the
time of a rolled loop on the machine on which it was developed */
for (j = sample; j < limit; j++)
{
+6 -6
View File
@@ -50,13 +50,13 @@
/* The FIR taps must be adapted as 32 bit values, to get the necessary finesse
in the adaption process. However, they are applied as 16 bit values (bits 30-15
of the 32 bit values) in the FIR. For the working 16 bit values, we need 4 sets.
3 of the 16 bit sets are used on a rotating basis. Normally the canceller steps
round these 3 sets at regular intervals. Any time we detect double talk, we can go
back to the set from two steps ago with reasonable assurance it is a well adapted
set. We cannot just go back one step, as we may have rotated the sets just before
double talk or tone was detected, and that set may already be somewhat corrupted.
When narrowband energy is detected we need to continue adapting to it, to echo
cancel it. However, the adaption will almost certainly be going astray. Broadband
(or even complex sequences of narrowband) energy will normally lead to a well
@@ -129,7 +129,7 @@ static int narrowband_detect(echo_can_state_t *ec)
int score;
int len = 32;
int alen = 9;
k = ec->curr_pos;
for (i = 0; i < len; i++)
{
@@ -292,7 +292,7 @@ SPAN_DECLARE(int) echo_can_release(echo_can_state_t *ec)
SPAN_DECLARE(int) echo_can_free(echo_can_state_t *ec)
{
int i;
fir16_free(&ec->fir_state);
free(ec->fir_taps32);
for (i = 0; i < 4; i++)
@@ -361,7 +361,7 @@ static __inline__ int16_t echo_can_hpf(int32_t coeff[2], int16_t amp)
{
int32_t z;
/*
/*
Filter DC, 3dB point is 160Hz (I think), note 32 bit precision required
otherwise values do not track down to 0. Zero at DC, Pole at (1-Beta)
only real axis. Some chip sets (like Si labs) don't need
@@ -371,7 +371,7 @@ static __inline__ int16_t echo_can_hpf(int32_t coeff[2], int16_t amp)
Note: removes some low frequency from the signal, this reduces
the speech quality when listening to samples through headphones
but may not be obvious through a telephone handset.
Note that the 3dB frequency in radians is approx Beta, e.g. for
Beta = 2^(-3) = 0.125, 3dB freq is 0.125 rads = 159Hz.
+7 -7
View File
@@ -25,7 +25,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#if defined(HAVE_CONFIG_H)
#include "config.h"
#endif
@@ -55,7 +55,7 @@
#define TRUE (!FALSE)
#endif
#define MAXPZ 8192
#define MAXPZ 8192
#define SEQ_LEN 8192
#define MAX_FFT_LEN SEQ_LEN
@@ -139,7 +139,7 @@ void compute_raised_cosine_filter(double coeffs[],
int i;
int j;
int h;
f1 = (1.0 - beta)*alpha;
f2 = (1.0 + beta)*alpha;
tau = 0.5/alpha;
@@ -162,10 +162,10 @@ void compute_raised_cosine_filter(double coeffs[],
if (sinc_compensate)
{
for (i = 1; i <= SEQ_LEN/2; i++)
{
{
x = 3.1415926535*(double) i/(double) SEQ_LEN;
vec[i].re *= (x/sin(x));
}
vec[i].re *= (x/sin(x));
}
}
for (i = 0; i <= SEQ_LEN/2; i++)
vec[i].re *= tau;
@@ -228,7 +228,7 @@ void truncate_coeffs(double coeffs[], int len, int bits, int hilbert)
fac = pow(2.0, (double) (bits - 1.0));
h = (len - 1)/2;
max = (hilbert) ? coeffs[h - 1] : coeffs[h]; /* Max coeff */
max = (hilbert) ? coeffs[h - 1] : coeffs[h]; /* Max coeff */
scale = (fac - 1.0)/(fac*max);
for (i = 0; i < len; i++)
{
+10 -10
View File
@@ -37,42 +37,42 @@ extern "C"
#if !defined(HAVE_SINF)
static __inline__ float sinf(float x)
{
return (float) sin((double) x);
return (float) sin((double) x);
}
#endif
#if !defined(HAVE_COSF)
static __inline__ float cosf(float x)
{
return (float) cos((double) x);
return (float) cos((double) x);
}
#endif
#if !defined(HAVE_TANF)
static __inline__ float tanf(float x)
{
return (float) tan((double) x);
return (float) tan((double) x);
}
#endif
#if !defined(HAVE_ASINF)
static __inline__ float asinf(float x)
{
return (float) asin((double) x);
return (float) asin((double) x);
}
#endif
#if !defined(HAVE_ACOSF)
static __inline__ float acosf(float x)
{
return (float) acos((double) x);
return (float) acos((double) x);
}
#endif
#if !defined(HAVE_ATANF)
static __inline__ float atanf(float x)
{
return (float) atan((double) x);
return (float) atan((double) x);
}
#endif
@@ -80,7 +80,7 @@ static __inline__ float atanf(float x)
#if !defined(HAVE_ATAN2F)
static __inline__ float atan2f(float y, float x)
{
return (float) atan2((double) y, (double) x);
return (float) atan2((double) y, (double) x);
}
#endif
@@ -88,14 +88,14 @@ static __inline__ float atan2f(float y, float x)
#if !defined(HAVE_CEILF)
static __inline__ float ceilf(float x)
{
return (float) ceil((double) x);
return (float) ceil((double) x);
}
#endif
#if !defined(HAVE_FLOORF)
static __inline__ float floorf(float x)
{
return (float) floor((double) x);
return (float) floor((double) x);
}
#endif
@@ -117,7 +117,7 @@ static __inline__ float expf(float x)
#if !defined(HAVE_LOGF)
static __inline__ float logf(float x)
{
return (float) logf((double) x);
return (float) logf((double) x);
}
#endif
+3 -3
View File
@@ -144,7 +144,7 @@ SPAN_DECLARE(int) fsk_tx_restart(fsk_tx_state_t *s, const fsk_spec_t *spec)
s->phase_acc = 0;
s->baud_frac = 0;
s->current_phase_rate = s->phase_rates[1];
s->shutdown = FALSE;
return 0;
}
@@ -273,7 +273,7 @@ SPAN_DECLARE(int) fsk_rx_restart(fsk_rx_state_t *s, const fsk_spec_t *spec, int
/* Detect by correlating against the tones we want, over a period
of one baud. The correlation must be quadrature. */
/* First we need the quadrature tone generators to correlate
against. */
s->phase_rate[0] = dds_phase_rate((float) spec->freq_zero);
@@ -303,7 +303,7 @@ SPAN_DECLARE(int) fsk_rx_restart(fsk_rx_state_t *s, const fsk_spec_t *spec, int
s->frame_state = 0;
s->frame_bits = 0;
s->last_bit = 0;
/* Initialise a power detector, so sense when a signal is present. */
power_meter_init(&(s->power), 4);
s->signal_present = 0;
+23 -23
View File
@@ -170,32 +170,32 @@ SPAN_DECLARE(int) gsm0610_pack_wav49(uint8_t c[], const gsm0610_frame_t *s)
uint16_t sr;
int i;
sr = 0;
sr = (sr >> 6) | (s->LARc[0] << 10);
sr = (sr >> 6) | (s->LARc[1] << 10);
*c++ = (uint8_t) (sr >> 4);
sr = (sr >> 5) | (s->LARc[2] << 11);
*c++ = (uint8_t) (sr >> 7);
sr = (sr >> 5) | (s->LARc[3] << 11);
sr = (sr >> 4) | (s->LARc[4] << 12);
*c++ = (uint8_t) (sr >> 6);
sr = (sr >> 4) | (s->LARc[5] << 12);
sr = (sr >> 3) | (s->LARc[6] << 13);
*c++ = (uint8_t) (sr >> 7);
sr = (sr >> 3) | (s->LARc[7] << 13);
sr = 0;
sr = (sr >> 6) | (s->LARc[0] << 10);
sr = (sr >> 6) | (s->LARc[1] << 10);
*c++ = (uint8_t) (sr >> 4);
sr = (sr >> 5) | (s->LARc[2] << 11);
*c++ = (uint8_t) (sr >> 7);
sr = (sr >> 5) | (s->LARc[3] << 11);
sr = (sr >> 4) | (s->LARc[4] << 12);
*c++ = (uint8_t) (sr >> 6);
sr = (sr >> 4) | (s->LARc[5] << 12);
sr = (sr >> 3) | (s->LARc[6] << 13);
*c++ = (uint8_t) (sr >> 7);
sr = (sr >> 3) | (s->LARc[7] << 13);
for (i = 0; i < 4; i++)
{
sr = (sr >> 7) | (s->Nc[i] << 9);
*c++ = (uint8_t) (sr >> 5);
sr = (sr >> 2) | (s->bc[i] << 14);
sr = (sr >> 2) | (s->Mc[i] << 14);
sr = (sr >> 6) | (s->xmaxc[i] << 10);
*c++ = (uint8_t) (sr >> 3);
sr = (sr >> 3) | (s->xMc[i][0] << 13);
*c++ = (uint8_t) (sr >> 8);
sr = (sr >> 3) | (s->xMc[i][1] << 13);
sr = (sr >> 3) | (s->xMc[i][2] << 13);
sr = (sr >> 7) | (s->Nc[i] << 9);
*c++ = (uint8_t) (sr >> 5);
sr = (sr >> 2) | (s->bc[i] << 14);
sr = (sr >> 2) | (s->Mc[i] << 14);
sr = (sr >> 6) | (s->xmaxc[i] << 10);
*c++ = (uint8_t) (sr >> 3);
sr = (sr >> 3) | (s->xMc[i][0] << 13);
*c++ = (uint8_t) (sr >> 8);
sr = (sr >> 3) | (s->xMc[i][1] << 13);
sr = (sr >> 3) | (s->xMc[i][2] << 13);
sr = (sr >> 3) | (s->xMc[i][3] << 13);
*c++ = (uint8_t) (sr >> 7);
sr = (sr >> 3) | (s->xMc[i][4] << 13);
+1 -1
View File
@@ -31,7 +31,7 @@
#define GSM0610_FRAME_LEN 160
#define GSM0610_MAGIC 0xD
#define GSM0610_MAGIC 0xD
#include "spandsp/private/gsm0610.h"
+1 -1
View File
@@ -62,7 +62,7 @@ void lpc10_voicing(lpc10_encode_state_t *st,
int32_t half,
float *minamd,
float *maxamd,
int32_t *mintau,
int32_t *mintau,
float *ivrc,
int32_t *obound);
+2 -2
View File
@@ -180,7 +180,7 @@ SPAN_DECLARE(int16_t) fixed_sin(uint16_t x)
}
z = fixed_sine_table[step] + ((frac*(fixed_sine_table[step_after] - fixed_sine_table[step])) >> 6);
if ((x & 0x8000))
z = -z;
z = -z;
return z;
}
/*- End of function --------------------------------------------------------*/
@@ -206,7 +206,7 @@ SPAN_DECLARE(int16_t) fixed_cos(uint16_t x)
}
z = fixed_sine_table[step] + ((frac*(fixed_sine_table[step_after] - fixed_sine_table[step])) >> 6);
if ((x & 0x8000))
z = -z;
z = -z;
return z;
}
/*- End of function --------------------------------------------------------*/
+3 -3
View File
@@ -23,7 +23,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*! \file */
/* CNG is 0.5s+-15% of 1100+-38Hz, 3s+-15% off, repeating.
@@ -36,7 +36,7 @@
ANS/ is 3.3+-0.7s of 2100+-15Hz, with phase reversals (180+-10 degrees, hopping in <1ms) every 450+-25ms.
ANSam/ is 2100+-1Hz, with phase reversals (180+-10 degrees, hopping in <1ms) every 450+-25ms, and AM with a sinewave of 15+-0.1Hz.
ANSam/ is 2100+-1Hz, with phase reversals (180+-10 degrees, hopping in <1ms) every 450+-25ms, and AM with a sinewave of 15+-0.1Hz.
The modulated envelope ranges in amplitude between (0.8+-0.01) and (1.2+-0.01) times its average
amplitude. It lasts up to 5s, but will be stopped early if the V.8 protocol proceeds. */
@@ -702,7 +702,7 @@ SPAN_DECLARE_NONSTD(int) modem_connect_tones_rx_fillin(modem_connect_tones_rx_st
SPAN_DECLARE(int) modem_connect_tones_rx_get(modem_connect_tones_rx_state_t *s)
{
int x;
x = s->hit;
s->hit = MODEM_CONNECT_TONES_NONE;
return x;
+2 -2
View File
@@ -54,8 +54,8 @@
#endif
#endif // VC8+
// disable the following warnings
#pragma warning(disable:4100) // The formal parameter is not referenced in the body of the function. The unreferenced parameter is ignored.
// disable the following warnings
#pragma warning(disable:4100) // The formal parameter is not referenced in the body of the function. The unreferenced parameter is ignored.
#pragma warning(disable:4200) // Non standard extension C zero sized array
#pragma warning(disable:4706) // assignment within conditional expression
#pragma warning(disable:4244) // conversion from 'type1' to 'type2', possible loss of data
+2 -2
View File
@@ -48,10 +48,10 @@ typedef __int64 int64_t;
#endif
#if !defined(INT16_MAX)
#define INT16_MAX 0x7FFF
#define INT16_MAX 0x7FFF
#endif
#if !defined(INT16_MIN)
#define INT16_MIN (-INT16_MAX - 1)
#define INT16_MIN (-INT16_MAX - 1)
#endif
#if !defined(INT32_MAX)
+4
View File
@@ -98,9 +98,13 @@
#include <spandsp/v29tx.h>
#include <spandsp/v17rx.h>
#include <spandsp/v17tx.h>
#include <spandsp/v32bis.h>
#include <spandsp/v22bis.h>
#include <spandsp/v27ter_rx.h>
#include <spandsp/v27ter_tx.h>
#if defined(SPANDSP_SUPPORT_V34)
#include <spandsp/v34.h>
#endif
#include <spandsp/v18.h>
#include <spandsp/timezone.h>
#include <spandsp/t4_rx.h>
+3 -3
View File
@@ -159,7 +159,7 @@ static int16_t decode(oki_adpcm_state_t *s, uint8_t adpcm)
*
* x = adpcm & 0x07;
* e = (step_size[s->step_index]*(x + x + 1)) >> 3;
*
*
* Seems an obvious improvement on a modern machine, but remember
* the truncation errors do not come out the same. It would
* not, therefore, be an exact match for what this code is doing.
@@ -251,7 +251,7 @@ SPAN_DECLARE(oki_adpcm_state_t *) oki_adpcm_init(oki_adpcm_state_t *s, int bit_r
}
memset(s, 0, sizeof(*s));
s->bit_rate = bit_rate;
return s;
}
/*- End of function --------------------------------------------------------*/
@@ -281,7 +281,7 @@ SPAN_DECLARE(int) oki_adpcm_decode(oki_adpcm_state_t *s,
int samples;
float z;
#if (_MSC_VER >= 1400)
#if (_MSC_VER >= 1400)
__analysis_assume(s->phase >= 0 && s->phase <= 4);
#endif
samples = 0;
+9 -9
View File
@@ -117,11 +117,11 @@ static const sig_tone_flat_coeffs_t flat_coeffs[1] =
{
{
#if defined(SPANDSP_USE_FIXED_POINT)
{ 12900, -16384, -16384},
{ 12900, -16384, -16384},
{ 0, -8578, -11796},
15,
#else
{0.393676f, -0.5f, -0.5f},
{0.393676f, -0.5f, -0.5f},
{0.0f, -0.261778f, -0.359985f},
#endif
}
@@ -136,7 +136,7 @@ static const sig_tone_descriptor_t sig_tones[3] =
ms_to_samples(400), /* High to low timout - 300ms to 550ms */
ms_to_samples(225), /* Sharp to flat timeout */
ms_to_samples(225), /* Notch insertion timeout */
ms_to_samples(3), /* Tone on persistence check */
ms_to_samples(8), /* Tone off persistence check */
@@ -158,7 +158,7 @@ static const sig_tone_descriptor_t sig_tones[3] =
ms_to_samples(0),
ms_to_samples(0),
ms_to_samples(225),
ms_to_samples(3),
ms_to_samples(8),
@@ -168,7 +168,7 @@ static const sig_tone_descriptor_t sig_tones[3] =
NULL,
},
NULL,
15.6f,
-30.0f,
-30.0f
@@ -190,7 +190,7 @@ static const sig_tone_descriptor_t sig_tones[3] =
&notch_coeffs[NOTCH_COEFF_SET_2600HZ]
},
NULL,
15.6f,
-30.0f,
-30.0f
@@ -299,7 +299,7 @@ SPAN_DECLARE(void) sig_tone_tx_set_mode(sig_tone_tx_state_t *s, int mode, int du
{
int old_tones;
int new_tones;
old_tones = s->current_tx_tone & (SIG_TONE_1_PRESENT | SIG_TONE_2_PRESENT);
new_tones = mode & (SIG_TONE_1_PRESENT | SIG_TONE_2_PRESENT);
if (new_tones && old_tones != new_tones)
@@ -490,7 +490,7 @@ SPAN_DECLARE(int) sig_tone_rx(sig_tone_rx_state_t *s, int16_t amp[], int len)
#endif
}
flat_power = power_meter_update(&s->flat_power, bandpass_signal);
/* For the flat receiver we use a simple power threshold! */
if ((s->signalling_state & (SIG_TONE_1_PRESENT | SIG_TONE_2_PRESENT)))
{
@@ -634,7 +634,7 @@ SPAN_DECLARE(sig_tone_rx_state_t *) sig_tone_rx_init(sig_tone_rx_state_t *s, int
#if !defined(SPANDSP_USE_FIXED_POINT)
int j;
#endif
if (sig_update == NULL || tone_type < 1 || tone_type > 3)
return NULL;
/*endif*/
+3 -3
View File
@@ -381,7 +381,7 @@ static __inline__ complexf_t complex_divf(const complexf_t *x, const complexf_t
{
complexf_t z;
float f;
f = y->re*y->re + y->im*y->im;
z.re = ( x->re*y->re + x->im*y->im)/f;
z.im = (-x->re*y->im + x->im*y->re)/f;
@@ -393,7 +393,7 @@ static __inline__ complex_t complex_div(const complex_t *x, const complex_t *y)
{
complex_t z;
double f;
f = y->re*y->re + y->im*y->im;
z.re = ( x->re*y->re + x->im*y->im)/f;
z.im = (-x->re*y->im + x->im*y->re)/f;
@@ -406,7 +406,7 @@ static __inline__ complexl_t complex_divl(const complexl_t *x, const complexl_t
{
complexl_t z;
long double f;
f = y->re*y->re + y->im*y->im;
z.re = ( x->re*y->re + x->im*y->im)/f;
z.im = (-x->re*y->im + x->im*y->re)/f;
@@ -34,7 +34,7 @@ extern "C"
static __inline__ void cvec_copyf(complexf_t z[], const complexf_t x[], int n)
{
int i;
for (i = 0; i < n; i++)
z[i] = x[i];
}
@@ -43,7 +43,7 @@ static __inline__ void cvec_copyf(complexf_t z[], const complexf_t x[], int n)
static __inline__ void cvec_copy(complex_t z[], const complex_t x[], int n)
{
int i;
for (i = 0; i < n; i++)
z[i] = x[i];
}
@@ -53,7 +53,7 @@ static __inline__ void cvec_copy(complex_t z[], const complex_t x[], int n)
static __inline__ void cvec_copyl(complexl_t z[], const complexl_t x[], int n)
{
int i;
for (i = 0; i < n; i++)
z[i] = x[i];
}
@@ -63,7 +63,7 @@ static __inline__ void cvec_copyl(complexl_t z[], const complexl_t x[], int n)
static __inline__ void cvec_zerof(complexf_t z[], int n)
{
int i;
for (i = 0; i < n; i++)
z[i] = complex_setf(0.0f, 0.0f);
}
@@ -72,7 +72,7 @@ static __inline__ void cvec_zerof(complexf_t z[], int n)
static __inline__ void cvec_zero(complex_t z[], int n)
{
int i;
for (i = 0; i < n; i++)
z[i] = complex_set(0.0, 0.0);
}
@@ -82,7 +82,7 @@ static __inline__ void cvec_zero(complex_t z[], int n)
static __inline__ void cvec_zerol(complexl_t z[], int n)
{
int i;
for (i = 0; i < n; i++)
z[i] = complex_setl(0.0, 0.0);
}
@@ -92,7 +92,7 @@ static __inline__ void cvec_zerol(complexl_t z[], int n)
static __inline__ void cvec_setf(complexf_t z[], complexf_t *x, int n)
{
int i;
for (i = 0; i < n; i++)
z[i] = *x;
}
@@ -101,7 +101,7 @@ static __inline__ void cvec_setf(complexf_t z[], complexf_t *x, int n)
static __inline__ void cvec_set(complex_t z[], complex_t *x, int n)
{
int i;
for (i = 0; i < n; i++)
z[i] = *x;
}
@@ -111,7 +111,7 @@ static __inline__ void cvec_set(complex_t z[], complex_t *x, int n)
static __inline__ void cvec_setl(complexl_t z[], complexl_t *x, int n)
{
int i;
for (i = 0; i < n; i++)
z[i] = *x;
}
@@ -70,7 +70,7 @@ static __inline__ void cvec_zeroi32(complexi32_t z[], int n)
static __inline__ void cvec_seti(complexi_t z[], complexi_t *x, int n)
{
int i;
for (i = 0; i < n; i++)
z[i] = *x;
}
@@ -79,7 +79,7 @@ static __inline__ void cvec_seti(complexi_t z[], complexi_t *x, int n)
static __inline__ void cvec_seti16(complexi16_t z[], complexi16_t *x, int n)
{
int i;
for (i = 0; i < n; i++)
z[i] = *x;
}
@@ -88,7 +88,7 @@ static __inline__ void cvec_seti16(complexi16_t z[], complexi16_t *x, int n)
static __inline__ void cvec_seti32(complexi32_t z[], complexi32_t *x, int n)
{
int i;
for (i = 0; i < n; i++)
z[i] = *x;
}
+3 -3
View File
@@ -35,7 +35,7 @@
Telecoms signals often contain considerable DC, but DC upsets a lot of signal
processing functions. Placing a zero DC restorer at the front of the processing
chain can often simplify the downstream processing.
chain can often simplify the downstream processing.
\section dc_restore_page_sec_2 How does it work?
@@ -44,10 +44,10 @@ the DC bias in the signal. A 32 bit estimate is used for the 16 bit audio, so
the noise introduced by the estimation can be keep in the lower bits, and the 16
bit DC value, which is subtracted from the signal, is fairly clean. The
following code fragment shows the algorithm used. dc_bias is a 32 bit integer,
while the sample and the resulting clean_sample are 16 bit integers.
while the sample and the resulting clean_sample are 16 bit integers.
dc_bias += ((((int32_t) sample << 15) - dc_bias) >> 14);
clean_sample = sample - (dc_bias >> 15);
clean_sample = sample - (dc_bias >> 15);
*/
/*!
+3 -3
View File
@@ -31,7 +31,7 @@
The DTMF receiver detects the standard DTMF digits. It is compliant with
ITU-T Q.23, ITU-T Q.24, and the local DTMF specifications of most administrations.
Its passes the test suites. It also scores *very* well on the standard
talk-off tests.
talk-off tests.
The current design uses floating point extensively. It is not tolerant of DC.
It is expected that a DC restore stage will be placed before the DTMF detector.
@@ -66,7 +66,7 @@ TODO:
\section dtmf_tx_page_sec_1 What does it do?
The DTMF tone generation module provides for the generation of the
repertoire of 16 DTMF dual tones.
repertoire of 16 DTMF dual tones.
\section dtmf_tx_page_sec_2 How does it work?
*/
@@ -96,7 +96,7 @@ extern "C"
\param s The DTMF generator context.
\param amp The buffer for the generated signal.
\param max_samples The required number of generated samples.
\return The number of samples actually generated. This may be less than
\return The number of samples actually generated. This may be less than
max_samples if the input buffer empties. */
SPAN_DECLARE(int) dtmf_tx(dtmf_tx_state_t *s, int16_t amp[], int max_samples);
+7 -7
View File
@@ -2,8 +2,8 @@
* SpanDSP - a series of DSP components for telephony
*
* echo.h - An echo cancellor, suitable for electrical and acoustic
* cancellation. This code does not currently comply with
* any relevant standards (e.g. G.164/5/7/8).
* cancellation. This code does not currently comply with
* any relevant standards (e.g. G.164/5/7/8).
*
* Written by Steve Underwood <steveu@coppice.org>
*
@@ -43,7 +43,7 @@ the duration of that impulse response. The signal transmitted to the telephone l
is passed through the FIR filter. Once the FIR is properly adapted, the resulting
output is an estimate of the echo signal received from the line. This is subtracted
from the received signal. The result is an estimate of the signal which originated
at the far end of the line, free from echos of our own transmitted signal.
at the far end of the line, free from echos of our own transmitted signal.
The least mean squares (LMS) algorithm is attributed to Widrow and Hoff, and was
introduced in 1960. It is the commonest form of filter adaption used in things
@@ -67,7 +67,7 @@ complexity filter is adequate for this, so pre-whitening adds little to the
compute requirements of the echo canceller.
An FIR filter adapted using pre-whitened NLMS performs well, provided certain
conditions are met:
conditions are met:
- The transmitted signal has poor self-correlation.
- There is no signal being generated within the environment being cancelled.
@@ -95,7 +95,7 @@ adaption is only performed when we are transmitting a significant signal level,
and the environment is not, things will be OK. Clearly, it is easy to tell when
we are sending a significant signal. Telling, if the environment is generating a
significant signal, and doing it with sufficient speed that the adaption will
not have diverged too much more we stop it, is a little harder.
not have diverged too much more we stop it, is a little harder.
The key problem in detecting when the environment is sourcing significant energy
is that we must do this very quickly. Given a reasonably long sample of the
@@ -103,13 +103,13 @@ received signal, there are a number of strategies which may be used to assess
whether that signal contains a strong far end component. However, by the time
that assessment is complete the far end signal will have already caused major
mis-convergence in the adaption process. An assessment algorithm is needed which
produces a fairly accurate result from a very short burst of far end energy.
produces a fairly accurate result from a very short burst of far end energy.
\section echo_can_page_sec_3 How do I use it?
The echo cancellor processes both the transmit and receive streams sample by
sample. The processing function is not declared inline. Unfortunately,
cancellation requires many operations per sample, so the call overhead is only a
minor burden.
minor burden.
*/
#include "fir.h"
+9 -8
View File
@@ -273,16 +273,17 @@ extern "C"
__inline float rintf(float flt)
{
_asm
{ fld flt
frndint
}
_asm
{
fld flt
frndint
}
}
__inline double rint(double dbl)
{
_asm
{
_asm
{
fld dbl
frndint
}
@@ -318,12 +319,12 @@ extern "C"
__inline long int lrint(double x)
{
return (long int)_mm_cvtsd_si64x( _mm_loadu_pd ((const double*)&x) );
return (long int)_mm_cvtsd_si64x( _mm_loadu_pd ((const double*)&x) );
}
__inline long int lrintf(float x)
{
return _mm_cvt_ss2si( _mm_load_ss((const float*)&x) );
return _mm_cvt_ss2si( _mm_load_ss((const float*)&x) );
}
__inline long int lfastrint(double x)
+6 -6
View File
@@ -197,7 +197,7 @@ static __inline__ int16_t fir16(fir16_state_t *fir, int16_t sample)
y += fir->coeffs[i]*fir->history[i + offset2];
#endif
if (fir->curr_pos <= 0)
fir->curr_pos = fir->taps;
fir->curr_pos = fir->taps;
fir->curr_pos--;
return (int16_t) (y >> 15);
}
@@ -212,7 +212,7 @@ static __inline__ const int16_t *fir32_create(fir32_state_t *fir,
fir->coeffs = coeffs;
fir->history = (int16_t *) malloc(taps*sizeof(int16_t));
if (fir->history)
memset(fir->history, '\0', taps*sizeof(int16_t));
memset(fir->history, '\0', taps*sizeof(int16_t));
return fir->history;
}
/*- End of function --------------------------------------------------------*/
@@ -245,7 +245,7 @@ static __inline__ int16_t fir32(fir32_state_t *fir, int16_t sample)
for ( ; i >= 0; i--)
y += fir->coeffs[i]*fir->history[i + offset2];
if (fir->curr_pos <= 0)
fir->curr_pos = fir->taps;
fir->curr_pos = fir->taps;
fir->curr_pos--;
return (int16_t) (y >> 15);
}
@@ -253,7 +253,7 @@ static __inline__ int16_t fir32(fir32_state_t *fir, int16_t sample)
static __inline__ const float *fir_float_create(fir_float_state_t *fir,
const float *coeffs,
int taps)
int taps)
{
fir->taps = taps;
fir->curr_pos = taps - 1;
@@ -264,7 +264,7 @@ static __inline__ const float *fir_float_create(fir_float_state_t *fir,
return fir->history;
}
/*- End of function --------------------------------------------------------*/
static __inline__ void fir_float_free(fir_float_state_t *fir)
{
free(fir->history);
@@ -288,7 +288,7 @@ static __inline__ int16_t fir_float(fir_float_state_t *fir, int16_t sample)
for ( ; i >= 0; i--)
y += fir->coeffs[i]*fir->history[i + offset2];
if (fir->curr_pos <= 0)
fir->curr_pos = fir->taps;
fir->curr_pos = fir->taps;
fir->curr_pos--;
return (int16_t) y;
}
+5 -5
View File
@@ -29,7 +29,7 @@
\section fsk_page_sec_1 What does it do?
Most of the oldest telephony modems use incoherent FSK modulation. This module can
be used to implement both the transmit and receive sides of a number of these
modems. There are integrated definitions for:
modems. There are integrated definitions for:
- V.21
- V.23
@@ -38,7 +38,7 @@ modems. There are integrated definitions for:
- Weitbrecht (Used for TDD - Telecoms Device for the Deaf)
The audio output or input is a stream of 16 bit samples, at 8000 samples/second.
The transmit and receive sides can be used independantly.
The transmit and receive sides can be used independantly.
\section fsk_page_sec_2 The transmitter
@@ -48,7 +48,7 @@ switched, producing a clean spectrum. The symbols are not generally an integer
number of samples long. However, the symbol time for the fastest data rate
generally used (1200bps) is more than 7 samples long. The jitter resulting from
switching at the nearest sample is, therefore, acceptable. No interpolation is
used.
used.
\section fsk_page_sec_3 The receiver
@@ -60,7 +60,7 @@ one that matches the frequency being transmitted during the correlation
interval. Because the transmission is totally asynchronous, the demodulation
process must run sample by sample to find the symbol transitions. The
correlation is performed on a sliding window basis, so the computational load of
demodulating sample by sample is not great.
demodulating sample by sample is not great.
Two modes of symbol synchronisation are provided:
@@ -159,7 +159,7 @@ SPAN_DECLARE(fsk_tx_state_t *) fsk_tx_init(fsk_tx_state_t *s,
void *user_data);
SPAN_DECLARE(int) fsk_tx_restart(fsk_tx_state_t *s, const fsk_spec_t *spec);
SPAN_DECLARE(int) fsk_tx_release(fsk_tx_state_t *s);
SPAN_DECLARE(int) fsk_tx_free(fsk_tx_state_t *s);
+1 -1
View File
@@ -2,7 +2,7 @@
* SpanDSP - a series of DSP components for telephony
*
* g168models.h - line models for echo cancellation tests against the G.168
* spec.
* spec.
*
* Written by Steve Underwood <steveu@coppice.org>
*
+2 -2
View File
@@ -40,10 +40,10 @@ HDLC may not be a DSP function, but is needed to accompany several DSP component
#if !defined(_SPANDSP_HDLC_H_)
#define _SPANDSP_HDLC_H_
/*!
/*!
HDLC_MAXFRAME_LEN is the maximum length of a stuffed HDLC frame, excluding the CRC.
*/
#define HDLC_MAXFRAME_LEN 400
#define HDLC_MAXFRAME_LEN 400
typedef void (*hdlc_frame_handler_t)(void *user_data, const uint8_t *pkt, int len, int ok);
typedef void (*hdlc_underflow_handler_t)(void *user_data);
+1 -1
View File
@@ -37,7 +37,7 @@ AWGN. It is designed to be of sufficiently low complexity to generate large
volumes of reasonable quality noise, in real time.
Hoth noise is used to model indoor ambient noise when evaluating communications
systems such as telephones. It is named after D.F. Hoth, who made the first
systems such as telephones. It is named after D.F. Hoth, who made the first
systematic study of this. The official definition of Hoth noise is IEEE
standard 269-2001 (revised from 269-1992), "Draft Standard Methods for Measuring
Transmission Performance of Analog and Digital Telephone Sets, Handsets and Headsets."
+1 -1
View File
@@ -2,7 +2,7 @@
* SpanDSP - a series of DSP components for telephony
*
* oki_adpcm.h - Conversion routines between linear 16 bit PCM data and
* OKI (Dialogic) ADPCM format.
* OKI (Dialogic) ADPCM format.
*
* Written by Steve Underwood <steveu@coppice.org>
*
+1 -1
View File
@@ -51,7 +51,7 @@ enum
/* Frame types */
#define PLAYOUT_TYPE_CONTROL 0
#define PLAYOUT_TYPE_SILENCE 1
#define PLAYOUT_TYPE_SILENCE 1
#define PLAYOUT_TYPE_SPEECH 2
typedef int timestamp_t;
+1 -1
View File
@@ -1,7 +1,7 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* private/dtmf.h - DTMF tone generation and detection
* private/dtmf.h - DTMF tone generation and detection
*
* Written by Steve Underwood <steveu@coppice.org>
*
+7 -7
View File
@@ -2,8 +2,8 @@
* SpanDSP - a series of DSP components for telephony
*
* private/echo.h - An echo cancellor, suitable for electrical and acoustic
* cancellation. This code does not currently comply with
* any relevant standards (e.g. G.164/5/7/8).
* cancellation. This code does not currently comply with
* any relevant standards (e.g. G.164/5/7/8).
*
* Written by Steve Underwood <steveu@coppice.org>
*
@@ -44,11 +44,11 @@ struct echo_can_state_s
int nonupdate_dwell;
int curr_pos;
int taps;
int tap_mask;
int adaption_mode;
int32_t supp_test1;
int32_t supp_test2;
int32_t supp1;
@@ -78,14 +78,14 @@ struct echo_can_state_s
/* DC and near DC blocking filter states */
int32_t tx_hpf[2];
int32_t rx_hpf[2];
/* Parameters for the optional Hoth noise generator */
int cng_level;
int cng_rndnum;
int cng_filter;
/* Snapshot sample of coeffs used for development */
int16_t *snapshot;
int16_t *snapshot;
};
#endif
+1 -1
View File
@@ -129,7 +129,7 @@ struct hdlc_tx_state_s
int byte;
/*! \brief The number of bits remaining in byte. */
int bits;
/*! \brief TRUE if transmission should end on buffer underflow .*/
int tx_end;
};
+1 -1
View File
@@ -2,7 +2,7 @@
* SpanDSP - a series of DSP components for telephony
*
* private/oki_adpcm.h - Conversion routines between linear 16 bit PCM data
* and OKI (Dialogic) ADPCM format.
* and OKI (Dialogic) ADPCM format.
*
* Written by Steve Underwood <steveu@coppice.org>
*
+1 -1
View File
@@ -212,7 +212,7 @@ struct t31_state_s
/*! TRUE if DLE prefix just used */
int dled;
/*! \brief Samples of silence awaited, as specified in a "wait for silence" command */
/*! \brief Samples of silence awaited, as specified in a "wait for silence" command */
int silence_awaited;
/*! \brief The current bit rate for the FAX fast message transfer modem. */
+1 -1
View File
@@ -136,7 +136,7 @@ struct t85_decode_state_s
/*! The number of bit planes expected, according to the header. Always 1 for true T.85 */
uint8_t bit_planes;
uint8_t current_bit_plane;
/*! The width of the full image, in pixels */
uint32_t xd;
/*! The height of the full image, in pixels */
+1 -1
View File
@@ -43,7 +43,7 @@ If tones are close in frequency a single Goertzel set to the centre of the
frequency range will be used. This optimises the efficiency of the detector. The
Goertzel filters are applied without applying any special window functional
(i.e. they use a rectangular window), so they have a sinc like response.
However, for most tone patterns their rejection qualities are adequate.
However, for most tone patterns their rejection qualities are adequate.
The detector aims to meet the need of the standard call progress tones, to
ITU-T E.180/Q.35 (busy, dial, ringback, reorder). Also, the extended tones,
+1 -1
View File
@@ -33,7 +33,7 @@
The supervisory tone generator may be configured to generate most of the world's
telephone supervisory tones - things like ringback, busy, number unobtainable,
and so on. It uses tree structure tone descriptions, which can deal with quite
complex cadence patterns.
complex cadence patterns.
\section super_tone_tx_page_sec_2 How does it work?
+1 -1
View File
@@ -45,7 +45,7 @@ enum
/*! This option enables the regular repeat transmission of indicator signals,
during periods when no FAX signal transmission occurs. */
T38_TERMINAL_OPTION_REGULAR_INDICATORS = 0x02,
/*! This option enables the regular repeat transmission of indicator signals for the
/*! This option enables the regular repeat transmission of indicator signals for the
first 2s, during periods when no FAX signal transmission occurs. */
T38_TERMINAL_OPTION_2S_REPEATING_INDICATORS = 0x04,
/*! This option suppresses the transmission of indicators. This is usually used with
+2 -2
View File
@@ -51,13 +51,13 @@ extern "C"
SPAN_DECLARE(void) srgb_to_lab(lab_params_t *s, uint8_t lab[], const uint8_t srgb[], int pixels);
SPAN_DECLARE(void) lab_to_srgb(lab_params_t *s, uint8_t srgb[], const uint8_t lab[], int pixels);
SPAN_DECLARE(void) set_lab_illuminant(lab_params_t *s, float new_xn, float new_yn, float new_zn);
SPAN_DECLARE(void) set_lab_gamut(lab_params_t *s, int L_min, int L_max, int a_min, int a_max, int b_min, int b_max, int ab_are_signed);
SPAN_DECLARE(void) set_lab_gamut2(lab_params_t *s, int L_P, int L_Q, int a_P, int a_Q, int b_P, int b_Q);
SPAN_DECLARE(int) t42_itulab_to_itulab(logging_state_t *logging, tdata_t *dst, tsize_t *dstlen, tdata_t src, tsize_t srclen, uint32_t width, uint32_t height);
SPAN_DECLARE(int) t42_itulab_to_jpeg(logging_state_t *logging, lab_params_t *s, tdata_t *dst, tsize_t *dstlen, tdata_t src, tsize_t srclen);
+4 -4
View File
@@ -261,7 +261,7 @@ typedef struct
/*! \brief The size of the image on the line, in bytes */
int line_image_size;
} t4_stats_t;
#if defined(__cplusplus)
extern "C" {
#endif
@@ -369,19 +369,19 @@ SPAN_DECLARE(void) t4_rx_set_vendor(t4_rx_state_t *s, const char *vendor);
\param model The model string, or NULL. */
SPAN_DECLARE(void) t4_rx_set_model(t4_rx_state_t *s, const char *model);
/*! Get the current image transfer statistics.
/*! Get the current image transfer statistics.
\brief Get the current transfer statistics.
\param s The T.4 context.
\param t A pointer to a statistics structure. */
SPAN_DECLARE(void) t4_rx_get_transfer_statistics(t4_rx_state_t *s, t4_stats_t *t);
/*! Get the short text name of an encoding format.
/*! Get the short text name of an encoding format.
\brief Get the short text name of an encoding format.
\param encoding The encoding type.
\return A pointer to the string. */
SPAN_DECLARE(const char *) t4_encoding_to_str(int encoding);
/*! Get the short text name of an image format.
/*! Get the short text name of an image format.
\brief Get the short text name of an image format.
\param encoding The image format.
\return A pointer to the string. */
+2 -2
View File
@@ -42,7 +42,7 @@ extern "C" {
SPAN_DECLARE(int) t4_t6_encode_image_complete(t4_t6_encode_state_t *s);
/*! \brief Get the next bit of the current image. The image will
be padded for the current minimum scan line time.
be padded for the current minimum scan line time.
\param s The T.4/T.6 context.
\return The next bit (i.e. 0 or 1). SIG_STATUS_END_OF_DATA for no more data. */
SPAN_DECLARE(int) t4_t6_encode_get_bit(t4_t6_encode_state_t *s);
@@ -52,7 +52,7 @@ SPAN_DECLARE(int) t4_t6_encode_get_bit(t4_t6_encode_state_t *s);
\param s The T.4/T.6 context.
\param buf The buffer into which the chunk is to written.
\param max_len The maximum length of the chunk.
\return The actual length of the chunk. If this is less than max_len it
\return The actual length of the chunk. If this is less than max_len it
indicates that the end of the document has been reached. */
SPAN_DECLARE(int) t4_t6_encode_get(t4_t6_encode_state_t *s, uint8_t buf[], int max_len);
+2 -2
View File
@@ -277,7 +277,7 @@ SPAN_DECLARE(int) t4_tx_get_bit(t4_tx_state_t *s);
\param s The T.4 context.
\param buf The buffer into which the chunk is to written.
\param max_len The maximum length of the chunk.
\return The actual length of the chunk. If this is less than max_len it
\return The actual length of the chunk. If this is less than max_len it
indicates that the end of the document has been reached. */
SPAN_DECLARE(int) t4_tx_get(t4_tx_state_t *s, uint8_t buf[], size_t max_len);
@@ -383,7 +383,7 @@ SPAN_DECLARE(int) t4_tx_get_pages_in_file(t4_tx_state_t *s);
\return The page number, or -1 if there is an error. */
SPAN_DECLARE(int) t4_tx_get_current_page_in_file(t4_tx_state_t *s);
/*! Get the current image transfer statistics.
/*! Get the current image transfer statistics.
\brief Get the current transfer statistics.
\param s The T.4 context.
\param t A pointer to a statistics structure. */
@@ -63,7 +63,6 @@ SPAN_DECLARE(void) t81_t82_arith_encode(t81_t82_arith_encode_state_t *s, int cx,
SPAN_DECLARE(void) t81_t82_arith_encode_flush(t81_t82_arith_encode_state_t *s);
SPAN_DECLARE(t81_t82_arith_decode_state_t *) t81_t82_arith_decode_init(t81_t82_arith_decode_state_t *s);
SPAN_DECLARE(int) t81_t82_arith_decode_restart(t81_t82_arith_decode_state_t *s, int reuse_st);
+2 -2
View File
@@ -74,7 +74,7 @@ SPAN_DECLARE(int) t85_encode_image_complete(t85_encode_state_t *s);
\param s The T.85 context.
\param buf The buffer into which the chunk is to written.
\param max_len The maximum length of the chunk.
\return The actual length of the chunk. If this is less than max_len it
\return The actual length of the chunk. If this is less than max_len it
indicates that the end of the document has been reached. */
SPAN_DECLARE(int) t85_encode_get(t85_encode_state_t *s, uint8_t buf[], size_t max_len);
@@ -113,7 +113,7 @@ SPAN_DECLARE(t85_encode_state_t *) t85_encode_init(t85_encode_state_t *s,
SPAN_DECLARE(int) t85_encode_restart(t85_encode_state_t *s,
uint32_t image_width,
uint32_t image_length);
SPAN_DECLARE(int) t85_encode_release(t85_encode_state_t *s);
SPAN_DECLARE(int) t85_encode_free(t85_encode_state_t *s);
+1 -1
View File
@@ -191,7 +191,7 @@ static __inline__ void goertzel_samplex(goertzel_state_t *s, float amp)
*/
SPAN_DECLARE(int) periodogram_generate_coeffs(complexf_t coeffs[], float freq, int sample_rate, int window_len);
/*! Generate the phase offset to be expected between successive periodograms evaluated at the
/*! Generate the phase offset to be expected between successive periodograms evaluated at the
specified interval.
\param offset A point to the generated phase offset.
\param freq The frequency being matched by the periodogram, in Hz.
+1 -1
View File
@@ -22,7 +22,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*! \file */
/*! \page v8_page The V.8 modem negotiation protocol
+4 -4
View File
@@ -70,7 +70,7 @@ static __inline__ void vec_zeroi32(int32_t z[], int n)
static __inline__ void vec_seti(int z[], int x, int n)
{
int i;
for (i = 0; i < n; i++)
z[i] = x;
}
@@ -79,7 +79,7 @@ static __inline__ void vec_seti(int z[], int x, int n)
static __inline__ void vec_seti16(int16_t z[], int16_t x, int n)
{
int i;
for (i = 0; i < n; i++)
z[i] = x;
}
@@ -88,7 +88,7 @@ static __inline__ void vec_seti16(int16_t z[], int16_t x, int n)
static __inline__ void vec_seti32(int32_t z[], int32_t x, int n)
{
int i;
for (i = 0; i < n; i++)
z[i] = x;
}
@@ -117,7 +117,7 @@ SPAN_DECLARE(void) vec_circular_lmsi16(const int16_t x[], int16_t y[], int n, in
/*! \brief Find the minimum and maximum values in an int16_t vector.
\param x The vector to be searched.
\param n The number of elements in the vector.
\param out A two element vector. The first will receive the
\param out A two element vector. The first will receive the
maximum. The second will receive the minimum. This parameter
may be set to NULL.
\return The absolute maximum value. Since the range of negative numbers
+2 -3
View File
@@ -59,7 +59,7 @@
oddity amongst supervisory tones. It is designed to sound loud and nasty. Most
tones are one or two pure sine pitches, or one AM moduluated pitch. This alert
tone varies between countries, but AT&T are a typical example.
AT&T Receiver Off-Hook Tone is 1400 Hz, 2060 Hz, 2450 Hz and 2600 Hz at 0dBm0/frequency
on and off every .1 second. On some older space division switching systems
Receiver Off-Hook was 1400 Hz, 2060 Hz, 2450 Hz and 2600 Hz at +5 VU on and
@@ -82,7 +82,7 @@ SPAN_DECLARE(super_tone_tx_step_t *) super_tone_tx_make_step(super_tone_tx_step_
return NULL;
}
if (f1 >= 1.0f)
{
{
s->tone[0].phase_rate = dds_phase_ratef(f1);
s->tone[0].gain = dds_scaling_dbm0f(l1);
}
@@ -278,7 +278,6 @@ SPAN_DECLARE(int) super_tone_tx(super_tone_tx_state_t *s, int16_t amp[], int max
tree = s->levels[--s->level];
}
}
}
return samples;
}
+1 -1
View File
@@ -80,7 +80,7 @@ SPAN_DECLARE(int) swept_tone(swept_tone_state_t *s, int16_t amp[], int max_len)
int i;
int len;
int chunk_len;
for (len = 0; len < max_len; )
{
chunk_len = max_len - len;
+2 -2
View File
@@ -300,7 +300,7 @@ static const nsf_data_t vendor_00[] =
{"\x00\x41", 2, "Swasaki Communication", FALSE, NULL},
{"\x00\x45", 2, "Muratec", FALSE, Muratec45},
{"\x00\x46", 2, "Pheonix", FALSE, NULL},
{"\x00\x48", 2, "Muratec", FALSE, Muratec48}, /* Not registered */
{"\x00\x48", 2, "Muratec", FALSE, Muratec48}, /* Not registered */
{"\x00\x49", 2, "Japan Electric", FALSE, NULL},
{"\x00\x4D", 2, "Okura Electric", FALSE, NULL},
{"\x00\x51", 2, "Sanyo", FALSE, Sanyo},
@@ -502,7 +502,7 @@ static const nsf_data_t vendor_b5[] =
{"\x00\x6E", 2, "Microsoft", FALSE, NULL},
{"\x00\x72", 2, "Speaking Devices", FALSE, NULL},
{"\x00\x74", 2, "Compaq", FALSE, NULL},
{"\x00\x76", 2, "Microsoft", FALSE, NULL}, /* uses LSB for country but MSB for manufacturer */
{"\x00\x76", 2, "Microsoft", FALSE, NULL}, /* uses LSB for country but MSB for manufacturer */
{"\x00\x78", 2, "Cylink", FALSE, NULL},
{"\x00\x7A", 2, "Pitney Bowes", FALSE, NULL},
{"\x00\x7C", 2, "Digiboard", FALSE, NULL},
+11 -5
View File
@@ -422,7 +422,7 @@ SPAN_DECLARE(void) srgb_to_lab(lab_params_t *s, uint8_t lab[], const uint8_t srg
x /= s->x_n;
y /= s->y_n;
z /= s->z_n;
/* XYZ to Lab */
xx = (x <= 0.008856f) ? (7.787f*x + 0.1379f) : cbrtf(x);
yy = (y <= 0.008856f) ? (7.787f*y + 0.1379f) : cbrtf(y);
@@ -456,7 +456,7 @@ SPAN_DECLARE(void) lab_to_srgb(lab_params_t *s, uint8_t srgb[], const uint8_t la
itu_to_lab(s, &l, lab);
/* Lab to XYZ */
ll = (1.0f/116.0f)*(l.L + 16.0f);
ll = (1.0f/116.0f)*(l.L + 16.0f);
y = ll;
y = (y <= 0.2068f) ? (0.1284f*(y - 0.1379f)) : y*y*y;
x = ll + (1.0f/500.0f)*l.a;
@@ -668,7 +668,7 @@ SPAN_DECLARE(int) t42_itulab_to_jpeg(logging_state_t *logging, lab_params_t *s,
free(*dst);
fclose(out);
return FALSE;
}
}
fclose(out);
#endif
@@ -1054,7 +1054,7 @@ SPAN_DECLARE(int) t42_itulab_to_itulab(logging_state_t *logging, tdata_t *dst, t
free(*dst);
fclose(out);
return FALSE;
}
}
fclose(out);
#endif
@@ -1105,6 +1105,7 @@ SPAN_DECLARE(int) t42_itulab_to_srgb(logging_state_t *logging, lab_params_t *s,
span_log(logging, SPAN_LOG_FLOW, "%s\n", escape.error_message);
else
span_log(logging, SPAN_LOG_FLOW, "Unspecified libjpeg error.\n");
printf("Error %s.\n", escape.error_message);
if (scan_line_out)
free(scan_line_out);
fclose(in);
@@ -1134,14 +1135,17 @@ SPAN_DECLARE(int) t42_itulab_to_srgb(logging_state_t *logging, lab_params_t *s,
if (!is_itu_fax(logging, s, decompressor.marker_list))
{
span_log(logging, SPAN_LOG_FLOW, "Is not an ITU FAX.\n");
return FALSE;
printf("Is not an ITU FAX 1.\n");
//return FALSE;
}
/* Copy size, resolution, etc */
*width = decompressor.image_width;
*height = decompressor.image_height;
printf("Is %d x %d\n", decompressor.image_width, decompressor.image_height);
jpeg_start_decompress(&decompressor);
printf("Is %d x %d x %d.\n", decompressor.output_width, decompressor.output_height, decompressor.num_components);
if ((scan_line_in = (JSAMPROW) malloc(decompressor.output_width*decompressor.num_components)) == NULL)
return FALSE;
@@ -1151,6 +1155,7 @@ SPAN_DECLARE(int) t42_itulab_to_srgb(logging_state_t *logging, lab_params_t *s,
jpeg_read_scanlines(&decompressor, &scan_line_in, 1);
lab_to_srgb(s, scan_line_out, scan_line_in, decompressor.output_width);
}
printf("Next %d\n", decompressor.output_scanline);
free(scan_line_in);
jpeg_finish_decompress(&decompressor);
@@ -1159,6 +1164,7 @@ SPAN_DECLARE(int) t42_itulab_to_srgb(logging_state_t *logging, lab_params_t *s,
*dstlen = pos;
printf("Next2 %d\n", decompressor.output_scanline);
return TRUE;
}
/*- End of function --------------------------------------------------------*/
+10 -10
View File
@@ -31,23 +31,23 @@
* Copyright (c) 1990-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the names of
* Sam Leffler and Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Sam Leffler and Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*
* Decoder support is derived from code in Frank Cringle's viewfax program;
@@ -541,8 +541,8 @@ static int put_bits(t4_t6_decode_state_t *s, uint32_t bit_string, int quantity)
/* TODO: we really should record that something wasn't right at this point. */
s->a0 = old_a0;
break;
}
}
}
}
s->run_length += (s->a0 - old_a0);
add_run_to_row(s);
/* We need to move one step in one direction or the other, to change to the
+16 -16
View File
@@ -31,23 +31,23 @@
* Copyright (c) 1990-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the names of
* Sam Leffler and Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Sam Leffler and Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
@@ -508,7 +508,7 @@ static int row_to_run_lengths(uint32_t list[], const uint8_t row[], int width)
x <<= frag;
flip ^= 0xFF000000;
rem -= frag;
}
}
/* Save the remainder of the word */
span = (i << 3) + 8 - rem;
}
@@ -647,7 +647,7 @@ static void encode_2d_row(t4_t6_encode_state_t *s, const uint8_t *row_buf)
uint32_t *p;
/*
b1 b2
b1 b2
XX XX XX XX XX -- -- -- -- -- XX XX XX -- -- -- -- --
XX XX XX -- -- -- -- -- XX XX XX XX XX XX -- -- -- --
a0 a1 a2
@@ -657,18 +657,18 @@ static void encode_2d_row(t4_t6_encode_state_t *s, const uint8_t *row_buf)
This mode is identified when the position of b2 lies to the left of a1. When this mode
has been coded, a0 is set on the element of the coding line below b2 in preparation for
the next coding (i.e. on a0').
b1 b2
b1 b2
XX XX XX XX -- -- XX XX XX -- -- -- -- --
XX XX -- -- -- -- -- -- -- -- -- -- XX XX
XX XX -- -- -- -- -- -- -- -- -- -- XX XX
a0 a0' a1
Pass mode
However, the state where b2 occurs just above a1, as shown in the figure below, is not
considered as a pass mode.
b1 b2
b1 b2
XX XX XX XX -- -- XX XX XX -- -- -- -- --
XX XX -- -- -- -- -- -- -- XX XX XX XX XX
a0 a1
@@ -693,7 +693,7 @@ static void encode_2d_row(t4_t6_encode_state_t *s, const uint8_t *row_buf)
Vertical
<a1 b1>
b1 b2
b1 b2
-- XX XX XX XX XX -- -- -- -- -- -- -- -- XX XX XX XX -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- XX XX XX XX XX XX XX -- --
a0 a1 a2
+4 -4
View File
@@ -133,7 +133,7 @@ static void TIFFFXDefaultDirectory(TIFF *tif)
/* Since we may have overriddden another directory method, we call it now to
allow it to set up the rest of its own methods. */
if (_ParentExtender)
if (_ParentExtender)
(*_ParentExtender)(tif);
}
/*- End of function --------------------------------------------------------*/
@@ -141,11 +141,11 @@ static void TIFFFXDefaultDirectory(TIFF *tif)
SPAN_DECLARE(void) TIFF_FX_init(void)
{
static int first_time = TRUE;
if (!first_time)
return;
first_time = FALSE;
/* Grab the inherited method and install */
_ParentExtender = TIFFSetTagExtender(TIFFFXDefaultDirectory);
}
@@ -175,7 +175,7 @@ static int read_colour_map(t4_tx_state_t *s, int bits_per_sample)
map_z = NULL;
if (!TIFFGetField(s->tiff.tiff_file, TIFFTAG_COLORMAP, &map_L, &map_a, &map_b, &map_z))
return -1;
/* TODO: This only allows for 8 bit deep maps */
if ((s->colour_map = realloc(s->colour_map, 3*256)) == NULL)
return -1;
+37 -38
View File
@@ -75,7 +75,6 @@ static __inline__ int flag_is_changeable_p(uint32_t flag)
" popfl\n"
: "=&r" (f1), "=&r" (f2)
: "ir" (flag));
return ((f1^f2) & flag) != 0;
}
/*- End of function --------------------------------------------------------*/
@@ -96,21 +95,21 @@ int has_MMX(void)
/*endif*/
__asm__ __volatile__(
" push %%ebx;\n"
" mov $1,%%eax;\n"
" cpuid;\n"
" xor %%eax,%%eax;\n"
" test $0x800000,%%edx;\n"
" jz 1f;\n" /* no MMX support */
" inc %%eax;\n" /* MMX support */
" mov $1,%%eax;\n"
" cpuid;\n"
" xor %%eax,%%eax;\n"
" test $0x800000,%%edx;\n"
" jz 1f;\n" /* no MMX support */
" inc %%eax;\n" /* MMX support */
"1:\n"
" pop %%ebx;\n"
: "=a" (result)
:
: "=a" (result)
:
: "ecx", "edx");
return result;
}
/*- End of function --------------------------------------------------------*/
int has_SIMD(void)
{
int result;
@@ -120,16 +119,16 @@ int has_SIMD(void)
/*endif*/
__asm__ __volatile__(
" push %%ebx;\n"
" mov $1,%%eax;\n"
" cpuid;\n"
" xor %%eax,%%eax;\n"
" test $0x02000000,%%edx;\n"
" jz 1f;\n" /* no SIMD support */
" inc %%eax;\n" /* SIMD support */
" mov $1,%%eax;\n"
" cpuid;\n"
" xor %%eax,%%eax;\n"
" test $0x02000000,%%edx;\n"
" jz 1f;\n" /* no SIMD support */
" inc %%eax;\n" /* SIMD support */
"1:\n"
" pop %%ebx;\n"
: "=a" (result)
:
: "=a" (result)
:
: "ecx", "edx");
return result;
}
@@ -144,21 +143,21 @@ int has_SIMD2(void)
/*endif*/
__asm__ __volatile__(
" push %%ebx;\n"
" mov $1,%%eax;\n"
" cpuid;\n"
" xor %%eax,%%eax;\n"
" test $0x04000000,%%edx;\n"
" jz 1f;\n" /* no SIMD2 support */
" inc %%eax;\n" /* SIMD2 support */
" mov $1,%%eax;\n"
" cpuid;\n"
" xor %%eax,%%eax;\n"
" test $0x04000000,%%edx;\n"
" jz 1f;\n" /* no SIMD2 support */
" inc %%eax;\n" /* SIMD2 support */
"1:\n"
" pop %%ebx;\n"
: "=a" (result)
:
: "=a" (result)
:
: "ecx", "edx");
return result;
}
/*- End of function --------------------------------------------------------*/
int has_3DNow(void)
{
int result;
@@ -168,21 +167,21 @@ int has_3DNow(void)
/*endif*/
__asm__ __volatile__(
" push %%ebx;\n"
" mov $0x80000000,%%eax;\n"
" cpuid;\n"
" mov $0x80000000,%%eax;\n"
" cpuid;\n"
" xor %%ecx,%%ecx;\n"
" cmp $0x80000000,%%eax;\n"
" jbe 1f;\n" /* no extended MSR(1), so no 3DNow! */
" mov $0x80000001,%%eax;\n"
" cpuid;\n"
" cmp $0x80000000,%%eax;\n"
" jbe 1f;\n" /* no extended MSR(1), so no 3DNow! */
" mov $0x80000001,%%eax;\n"
" cpuid;\n"
" xor %%ecx,%%ecx;\n"
" test $0x80000000,%%edx;\n"
" jz 1f;\n" /* no 3DNow! support */
" inc %%ecx;\n" /* 3DNow! support */
" test $0x80000000,%%edx;\n"
" jz 1f;\n" /* no 3DNow! support */
" inc %%ecx;\n" /* 3DNow! support */
"1:\n"
" pop %%ebx;\n"
: "=c" (result)
:
: "=c" (result)
:
: "eax", "edx");
return result;
}
+1 -1
View File
@@ -86,7 +86,7 @@ static __inline__ void overlap_add(int16_t amp1[], int16_t amp2[], int len)
int i;
float weight;
float step;
step = 1.0f/len;
weight = 0.0f;
for (i = 0; i < len; i++)
+1 -1
View File
@@ -22,7 +22,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*! \file */
#if defined(HAVE_CONFIG_H)
+1 -1
View File
@@ -171,7 +171,7 @@ static complexf_t getbaud(v27ter_tx_state_t *s)
if (s->in_training)
{
/* Send the training sequence */
/* Send the training sequence */
if (++s->training_step <= V27TER_TRAINING_SEG_5)
{
if (s->training_step <= V27TER_TRAINING_SEG_4)
+4 -4
View File
@@ -246,7 +246,7 @@ static int tx_supervisory_frame(lapm_state_t *s, uint8_t addr, uint8_t ctrl, uin
{
v42_frame_t *f;
uint8_t *buf;
if ((f = get_next_free_ctrl_frame(s)) == NULL)
return -1;
buf = f->buf;
@@ -438,7 +438,7 @@ static void transmit_xid(v42_state_t *ss, uint8_t addr)
*buf++ = 2;
*buf++ = (param_val >> 8) & 0xFF;
*buf++ = (param_val & 0xFF);
*buf++ = PI_TX_WINDOW_SIZE;
*buf++ = 1;
*buf++ = ss->config.v42_tx_window_size_k;
@@ -466,7 +466,7 @@ static void transmit_xid(v42_state_t *ss, uint8_t addr)
*buf++ = '4';
*buf++ = '2';
/* V.42bis P0
/* V.42bis P0
00 Compression in neither direction (default);
01 Negotiation initiator-responder direction only;
10 Negotiation responder-initiator direction only;
@@ -1155,7 +1155,7 @@ static int lapm_config(v42_state_t *ss)
static void reset_lapm(v42_state_t *ss)
{
lapm_state_t *s;
s = &ss->lapm;
/* Reset the LAP.M state */
s->local_busy = FALSE;
+3 -7
View File
@@ -23,10 +23,6 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* THIS IS A WORK IN PROGRESS. IT IS NOT FINISHED.
Currently it performs the core compression and decompression functions OK.
However, a number of the bells and whistles in V.42bis are incomplete. */
/*! \file */
#if defined(HAVE_CONFIG_H)
@@ -59,7 +55,7 @@
/* Index number of first dictionary entry used to store a string */
#define V42BIS_N5 (V42BIS_N4 + V42BIS_N6)
/* Number of control codewords */
#define V42BIS_N6 3
#define V42BIS_N6 3
/* V.42bis/9.2 */
#define V42BIS_ESC_STEP 51
@@ -489,7 +485,7 @@ SPAN_DECLARE(int) v42bis_compress_flush(v42bis_state_t *ss)
{
v42bis_comp_state_t *s;
int len;
s = &ss->compress;
if (s->update_at)
return 0;
@@ -692,7 +688,7 @@ SPAN_DECLARE(int) v42bis_decompress_flush(v42bis_state_t *ss)
{
v42bis_comp_state_t *s;
int len;
s = &ss->decompress;
len = s->string_length;
send_string(s);
+9 -9
View File
@@ -22,7 +22,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*! \file */
#if defined(HAVE_CONFIG_H)
@@ -271,7 +271,7 @@ SPAN_DECLARE(void) v8_log_supported_modulations(v8_state_t *s, int modulation_sc
{
const char *comma;
int i;
comma = "";
span_log(&s->logging, SPAN_LOG_FLOW, "");
for (i = 0; i < 32; i++)
@@ -562,7 +562,7 @@ static void put_bit(void *user_data, int bit)
s->bit_cnt = 0;
s->rx_data_ptr = 0;
}
if (s->preamble_type != V8_SYNC_UNKNOWN)
{
/* Parse octets with 1 bit start, 1 bit stop */
@@ -654,13 +654,13 @@ static void send_cm_jm(v8_state_t *s)
int val;
unsigned int offered_modulations;
int bytes;
/* Send a CM, or a JM as appropriate */
v8_put_preamble(s);
v8_put_byte(s, V8_CM_JM_SYNC_OCTET);
/* Data call */
v8_put_byte(s, (s->result.call_function << 5) | V8_CALL_FUNCTION_TAG);
/* Supported modulations */
offered_modulations = s->result.modulations;
bytes = 0;
@@ -949,14 +949,14 @@ SPAN_DECLARE_NONSTD(int) v8_rx(v8_state_t *s, const int16_t *amp, int len)
if (s->got_cm_jm)
{
span_log(&s->logging, SPAN_LOG_FLOW, "CM recognised\n");
s->result.status = V8_STATUS_V8_OFFERED;
report_event(s);
/* Stop sending ANSam or ANSam/ and send JM instead */
fsk_tx_init(&s->v21tx, &preset_fsk_specs[FSK_V21CH2], get_bit, s);
/* Set the timeout for JM */
s->negotiation_timer = ms_to_samples(5000);
s->negotiation_timer = ms_to_samples(5000);
s->state = V8_JM_ON;
send_cm_jm(s);
s->modem_connect_tone_tx_on = ms_to_samples(75);
@@ -1101,7 +1101,7 @@ SPAN_DECLARE(int) v8_release(v8_state_t *s)
SPAN_DECLARE(int) v8_free(v8_state_t *s)
{
int ret;
ret = queue_free(s->tx_queue);
free(s);
return ret;
+26 -26
View File
@@ -52,7 +52,7 @@ SPAN_DECLARE(void) vec_copyf(float z[], const float x[], int n)
{
int i;
__m128 n1;
if ((i = n & ~3))
{
for (i -= 4; i >= 0; i -= 4)
@@ -76,7 +76,7 @@ SPAN_DECLARE(void) vec_copyf(float z[], const float x[], int n)
SPAN_DECLARE(void) vec_copyf(float z[], const float x[], int n)
{
int i;
for (i = 0; i < n; i++)
z[i] = x[i];
}
@@ -86,7 +86,7 @@ SPAN_DECLARE(void) vec_copyf(float z[], const float x[], int n)
SPAN_DECLARE(void) vec_copy(double z[], const double x[], int n)
{
int i;
for (i = 0; i < n; i++)
z[i] = x[i];
}
@@ -96,7 +96,7 @@ SPAN_DECLARE(void) vec_copy(double z[], const double x[], int n)
SPAN_DECLARE(void) vec_copyl(long double z[], const long double x[], int n)
{
int i;
for (i = 0; i < n; i++)
z[i] = x[i];
}
@@ -111,7 +111,7 @@ SPAN_DECLARE(void) vec_negatef(float z[], const float x[], int n)
static const float *fmask = (float *) &mask;
__m128 n1;
__m128 n2;
if ((i = n & ~3))
{
n2 = _mm_set1_ps(*fmask);
@@ -137,7 +137,7 @@ SPAN_DECLARE(void) vec_negatef(float z[], const float x[], int n)
SPAN_DECLARE(void) vec_negatef(float z[], const float x[], int n)
{
int i;
for (i = 0; i < n; i++)
z[i] = -x[i];
}
@@ -147,7 +147,7 @@ SPAN_DECLARE(void) vec_negatef(float z[], const float x[], int n)
SPAN_DECLARE(void) vec_negate(double z[], const double x[], int n)
{
int i;
for (i = 0; i < n; i++)
z[i] = -x[i];
}
@@ -157,7 +157,7 @@ SPAN_DECLARE(void) vec_negate(double z[], const double x[], int n)
SPAN_DECLARE(void) vec_negatel(long double z[], const long double x[], int n)
{
int i;
for (i = 0; i < n; i++)
z[i] = -x[i];
}
@@ -169,7 +169,7 @@ SPAN_DECLARE(void) vec_zerof(float z[], int n)
{
int i;
__m128 n1;
if ((i = n & ~3))
{
n1 = _mm_setzero_ps();
@@ -191,7 +191,7 @@ SPAN_DECLARE(void) vec_zerof(float z[], int n)
SPAN_DECLARE(void) vec_zerof(float z[], int n)
{
int i;
for (i = 0; i < n; i++)
z[i] = 0.0f;
}
@@ -201,7 +201,7 @@ SPAN_DECLARE(void) vec_zerof(float z[], int n)
SPAN_DECLARE(void) vec_zero(double z[], int n)
{
int i;
for (i = 0; i < n; i++)
z[i] = 0.0;
}
@@ -211,7 +211,7 @@ SPAN_DECLARE(void) vec_zero(double z[], int n)
SPAN_DECLARE(void) vec_zerol(long double z[], int n)
{
int i;
for (i = 0; i < n; i++)
z[i] = 0.0L;
}
@@ -223,7 +223,7 @@ SPAN_DECLARE(void) vec_setf(float z[], float x, int n)
{
int i;
__m128 n1;
if ((i = n & ~3))
{
n1 = _mm_set1_ps(x);
@@ -245,7 +245,7 @@ SPAN_DECLARE(void) vec_setf(float z[], float x, int n)
SPAN_DECLARE(void) vec_setf(float z[], float x, int n)
{
int i;
for (i = 0; i < n; i++)
z[i] = x;
}
@@ -255,7 +255,7 @@ SPAN_DECLARE(void) vec_setf(float z[], float x, int n)
SPAN_DECLARE(void) vec_set(double z[], double x, int n)
{
int i;
for (i = 0; i < n; i++)
z[i] = x;
}
@@ -265,7 +265,7 @@ SPAN_DECLARE(void) vec_set(double z[], double x, int n)
SPAN_DECLARE(void) vec_setl(long double z[], long double x, int n)
{
int i;
for (i = 0; i < n; i++)
z[i] = x;
}
@@ -278,7 +278,7 @@ SPAN_DECLARE(void) vec_addf(float z[], const float x[], const float y[], int n)
int i;
__m128 n1;
__m128 n2;
if ((i = n & ~3))
{
for (i -= 4; i >= 0; i -= 4)
@@ -339,7 +339,7 @@ SPAN_DECLARE(void) vec_scaledxy_addf(float z[], const float x[], float x_scale,
__m128 n2;
__m128 n3;
__m128 n4;
if ((i = n & ~3))
{
n3 = _mm_set1_ps(x_scale);
@@ -403,7 +403,7 @@ SPAN_DECLARE(void) vec_scaledy_addf(float z[], const float x[], const float y[],
__m128 n1;
__m128 n2;
__m128 n3;
if ((i = n & ~3))
{
n3 = _mm_set1_ps(y_scale);
@@ -464,7 +464,7 @@ SPAN_DECLARE(void) vec_subf(float z[], const float x[], const float y[], int n)
int i;
__m128 n1;
__m128 n2;
if ((i = n & ~3))
{
for (i -= 4; i >= 0; i -= 4)
@@ -552,7 +552,7 @@ SPAN_DECLARE(void) vec_scalar_mulf(float z[], const float x[], float y, int n)
int i;
__m128 n1;
__m128 n2;
if ((i = n & ~3))
{
n2 = _mm_set1_ps(y);
@@ -600,7 +600,7 @@ SPAN_DECLARE(void) vec_scalar_addf(float z[], const float x[], float y, int n)
int i;
__m128 n1;
__m128 n2;
if ((i = n & ~3))
{
n2 = _mm_set1_ps(y);
@@ -659,7 +659,7 @@ SPAN_DECLARE(void) vec_scalar_subf(float z[], const float x[], float y, int n)
int i;
__m128 n1;
__m128 n2;
if ((i = n & ~3))
{
n2 = _mm_set1_ps(y);
@@ -719,7 +719,7 @@ SPAN_DECLARE(void) vec_mulf(float z[], const float x[], const float y[], int n)
__m128 n1;
__m128 n2;
__m128 n3;
if ((i = n & ~3))
{
for (i -= 4; i >= 0; i -= 4)
@@ -781,7 +781,7 @@ SPAN_DECLARE(float) vec_dot_prodf(const float x[], const float y[], int n)
__m128 n2;
__m128 n3;
__m128 n4;
z = 0.0f;
if ((i = n & ~3))
{
@@ -869,7 +869,7 @@ SPAN_DECLARE(void) vec_lmsf(const float x[], float y[], int n, float error)
__m128 n2;
__m128 n3;
__m128 n4;
if ((i = n & ~3))
{
n3 = _mm_set1_ps(error);