mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-13 07:45:26 +00:00
Lots of little cosmetic cleanups
This commit is contained in:
parent
16289ce9a4
commit
d163c6338e
@ -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;
|
||||
|
@ -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
|
||||
};
|
||||
|
||||
|
@ -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 --------------------------------------------------------*/
|
||||
|
@ -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++)
|
||||
{
|
||||
|
@ -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.
|
||||
|
||||
|
@ -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++)
|
||||
{
|
||||
|
@ -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
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
#define GSM0610_FRAME_LEN 160
|
||||
|
||||
#define GSM0610_MAGIC 0xD
|
||||
#define GSM0610_MAGIC 0xD
|
||||
|
||||
#include "spandsp/private/gsm0610.h"
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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 --------------------------------------------------------*/
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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>
|
||||
|
@ -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;
|
||||
|
@ -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] =
|
||||
¬ch_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*/
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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>
|
||||
*
|
||||
|
@ -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);
|
||||
|
@ -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."
|
||||
|
@ -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>
|
||||
*
|
||||
|
@ -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,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>
|
||||
*
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
};
|
||||
|
@ -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>
|
||||
*
|
||||
|
@ -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. */
|
||||
|
@ -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 */
|
||||
|
@ -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,
|
||||
|
@ -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?
|
||||
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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. */
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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},
|
||||
|
@ -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 --------------------------------------------------------*/
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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++)
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -210,7 +210,7 @@ static void set_pixel_range(uint8_t buf[], int row, int start, int end)
|
||||
static void clear_pixel_range(uint8_t buf[], int row, int start, int end)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
for (i = start; i <= end; i++)
|
||||
clear_pixel(buf, row, i);
|
||||
}
|
||||
@ -602,11 +602,11 @@ int main(int argc, char *argv[])
|
||||
TIFFSetField(tiff_file, TIFFTAG_XRESOLUTION, floorf(x_resolution*2.54f + 0.5f));
|
||||
TIFFSetField(tiff_file, TIFFTAG_YRESOLUTION, floorf(y_resolution*2.54f + 0.5f));
|
||||
TIFFSetField(tiff_file, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH);
|
||||
|
||||
|
||||
TIFFSetField(tiff_file, TIFFTAG_SOFTWARE, "spandsp");
|
||||
if (gethostname(buf, sizeof(buf)) == 0)
|
||||
TIFFSetField(tiff_file, TIFFTAG_HOSTCOMPUTER, buf);
|
||||
|
||||
|
||||
TIFFSetField(tiff_file, TIFFTAG_IMAGEDESCRIPTION, "Blank test image");
|
||||
TIFFSetField(tiff_file, TIFFTAG_MAKE, "soft-switch.org");
|
||||
TIFFSetField(tiff_file, TIFFTAG_MODEL, "test data");
|
||||
|
@ -29,7 +29,7 @@
|
||||
This program generates an A4 sized FAX image of a fine checkerboard. This doesn't
|
||||
compress well, so it results in a rather large file for a single page. This is
|
||||
good for testing the handling of extreme pages.
|
||||
|
||||
|
||||
Note that due to a bug in FAX image handling, versions of libtiff up to 3.8.2 fail
|
||||
to handle this complex image properly, if 2-D compression is used. The bug should
|
||||
be fixed in CVS at the time of writing, and so should be fixed in released versions
|
||||
|
@ -83,189 +83,189 @@ struct
|
||||
T4_X_RESOLUTION_R8,
|
||||
T4_Y_RESOLUTION_FINE,
|
||||
T4_WIDTH_R8_A4,
|
||||
2200
|
||||
1100*2
|
||||
},
|
||||
{
|
||||
"R8_77_B4.tif",
|
||||
T4_X_RESOLUTION_R8,
|
||||
T4_Y_RESOLUTION_FINE,
|
||||
T4_WIDTH_R8_B4,
|
||||
2400
|
||||
1200*2
|
||||
},
|
||||
{
|
||||
"R8_77_A3.tif",
|
||||
T4_X_RESOLUTION_R8,
|
||||
T4_Y_RESOLUTION_FINE,
|
||||
T4_WIDTH_R8_A3,
|
||||
3111
|
||||
1556*2
|
||||
},
|
||||
{
|
||||
"R8_154_A4.tif",
|
||||
T4_X_RESOLUTION_R8,
|
||||
T4_Y_RESOLUTION_SUPERFINE,
|
||||
T4_WIDTH_R8_A4,
|
||||
4400
|
||||
1100*4
|
||||
},
|
||||
{
|
||||
"R8_154_B4.tif",
|
||||
T4_X_RESOLUTION_R8,
|
||||
T4_Y_RESOLUTION_SUPERFINE,
|
||||
T4_WIDTH_R8_B4,
|
||||
4800
|
||||
1200*4
|
||||
},
|
||||
{
|
||||
"R8_154_A3.tif",
|
||||
T4_X_RESOLUTION_R8,
|
||||
T4_Y_RESOLUTION_SUPERFINE,
|
||||
T4_WIDTH_R8_A3,
|
||||
6222
|
||||
1556*4
|
||||
},
|
||||
{
|
||||
"R300_300_A4.tif",
|
||||
T4_X_RESOLUTION_300,
|
||||
T4_Y_RESOLUTION_300,
|
||||
T4_WIDTH_300_A4,
|
||||
4400
|
||||
1100*3
|
||||
},
|
||||
{
|
||||
"R300_300_B4.tif",
|
||||
T4_X_RESOLUTION_300,
|
||||
T4_Y_RESOLUTION_300,
|
||||
T4_WIDTH_300_B4,
|
||||
4800
|
||||
1200*3
|
||||
},
|
||||
{
|
||||
"R300_300_A3.tif",
|
||||
T4_X_RESOLUTION_300,
|
||||
T4_Y_RESOLUTION_300,
|
||||
T4_WIDTH_300_A3,
|
||||
6222
|
||||
1556*3
|
||||
},
|
||||
{
|
||||
"R300_600_A4.tif",
|
||||
T4_X_RESOLUTION_300,
|
||||
T4_Y_RESOLUTION_600,
|
||||
T4_WIDTH_300_A4,
|
||||
4400
|
||||
1100*6
|
||||
},
|
||||
{
|
||||
"R300_600_B4.tif",
|
||||
T4_X_RESOLUTION_300,
|
||||
T4_Y_RESOLUTION_600,
|
||||
T4_WIDTH_300_B4,
|
||||
4800
|
||||
1200*6
|
||||
},
|
||||
{
|
||||
"R300_600_A3.tif",
|
||||
T4_X_RESOLUTION_300,
|
||||
T4_Y_RESOLUTION_600,
|
||||
T4_WIDTH_300_A3,
|
||||
6222
|
||||
1556*6
|
||||
},
|
||||
{
|
||||
"R16_154_A4.tif",
|
||||
T4_X_RESOLUTION_R16,
|
||||
T4_Y_RESOLUTION_SUPERFINE,
|
||||
T4_WIDTH_R16_A4,
|
||||
4400
|
||||
1100*4
|
||||
},
|
||||
{
|
||||
"R16_154_B4.tif",
|
||||
T4_X_RESOLUTION_R16,
|
||||
T4_Y_RESOLUTION_SUPERFINE,
|
||||
T4_WIDTH_R16_B4,
|
||||
4800
|
||||
1200*4
|
||||
},
|
||||
{
|
||||
"R16_154_A3.tif",
|
||||
T4_X_RESOLUTION_R16,
|
||||
T4_Y_RESOLUTION_SUPERFINE,
|
||||
T4_WIDTH_R16_A3,
|
||||
6222
|
||||
1556*4
|
||||
},
|
||||
{
|
||||
"R16_800_A4.tif",
|
||||
T4_X_RESOLUTION_R16,
|
||||
T4_Y_RESOLUTION_800,
|
||||
T4_WIDTH_R16_A4,
|
||||
4400
|
||||
1100*8
|
||||
},
|
||||
{
|
||||
"R16_800_B4.tif",
|
||||
T4_X_RESOLUTION_R16,
|
||||
T4_Y_RESOLUTION_800,
|
||||
T4_WIDTH_R16_B4,
|
||||
4800
|
||||
1200*8
|
||||
},
|
||||
{
|
||||
"R16_800_A3.tif",
|
||||
T4_X_RESOLUTION_R16,
|
||||
T4_Y_RESOLUTION_800,
|
||||
T4_WIDTH_R16_A3,
|
||||
6222
|
||||
1556*8
|
||||
},
|
||||
{
|
||||
"R600_600_A4.tif",
|
||||
T4_X_RESOLUTION_600,
|
||||
T4_Y_RESOLUTION_600,
|
||||
T4_WIDTH_600_A4,
|
||||
4400
|
||||
1100*6
|
||||
},
|
||||
{
|
||||
"R600_600_B4.tif",
|
||||
T4_X_RESOLUTION_600,
|
||||
T4_Y_RESOLUTION_600,
|
||||
T4_WIDTH_600_B4,
|
||||
4800
|
||||
1200*6
|
||||
},
|
||||
{
|
||||
"R600_600_A3.tif",
|
||||
T4_X_RESOLUTION_600,
|
||||
T4_Y_RESOLUTION_600,
|
||||
T4_WIDTH_600_A3,
|
||||
6222
|
||||
1556*6
|
||||
},
|
||||
{
|
||||
"R600_1200_A4.tif",
|
||||
T4_X_RESOLUTION_600,
|
||||
T4_Y_RESOLUTION_1200,
|
||||
T4_WIDTH_600_A4,
|
||||
4400
|
||||
1100*12
|
||||
},
|
||||
{
|
||||
"R600_1200_B4.tif",
|
||||
T4_X_RESOLUTION_600,
|
||||
T4_Y_RESOLUTION_1200,
|
||||
T4_WIDTH_600_B4,
|
||||
4800
|
||||
1200*12
|
||||
},
|
||||
{
|
||||
"R600_1200_A3.tif",
|
||||
T4_X_RESOLUTION_600,
|
||||
T4_Y_RESOLUTION_1200,
|
||||
T4_WIDTH_600_A3,
|
||||
6222
|
||||
1556*12
|
||||
},
|
||||
{
|
||||
"R1200_1200_A4.tif",
|
||||
T4_X_RESOLUTION_1200,
|
||||
T4_Y_RESOLUTION_1200,
|
||||
T4_WIDTH_1200_A4,
|
||||
4400
|
||||
1100*12
|
||||
},
|
||||
{
|
||||
"R1200_1200_B4.tif",
|
||||
T4_X_RESOLUTION_1200,
|
||||
T4_Y_RESOLUTION_1200,
|
||||
T4_WIDTH_1200_B4,
|
||||
4800
|
||||
1200*12
|
||||
},
|
||||
{
|
||||
"R1200_1200_A3.tif",
|
||||
T4_X_RESOLUTION_1200,
|
||||
T4_Y_RESOLUTION_1200,
|
||||
T4_WIDTH_1200_A3,
|
||||
6222
|
||||
1556*12
|
||||
},
|
||||
{
|
||||
NULL,
|
||||
@ -291,7 +291,7 @@ int main(int argc, char *argv[])
|
||||
int compression;
|
||||
int photo_metric;
|
||||
int fill_order;
|
||||
|
||||
|
||||
compression = T4_COMPRESSION_ITU_T6;
|
||||
photo_metric = PHOTOMETRIC_MINISWHITE;
|
||||
fill_order = FILLORDER_LSB2MSB;
|
||||
@ -336,17 +336,17 @@ int main(int argc, char *argv[])
|
||||
TIFFSetField(tiff_file, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
|
||||
TIFFSetField(tiff_file, TIFFTAG_PHOTOMETRIC, photo_metric);
|
||||
TIFFSetField(tiff_file, TIFFTAG_FILLORDER, fill_order);
|
||||
|
||||
|
||||
x_resolution = sequence[i].x_res/100.0f;
|
||||
y_resolution = sequence[i].y_res/100.0f;
|
||||
TIFFSetField(tiff_file, TIFFTAG_XRESOLUTION, floorf(x_resolution*2.54f + 0.5f));
|
||||
TIFFSetField(tiff_file, TIFFTAG_YRESOLUTION, floorf(y_resolution*2.54f + 0.5f));
|
||||
TIFFSetField(tiff_file, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH);
|
||||
|
||||
|
||||
TIFFSetField(tiff_file, TIFFTAG_SOFTWARE, "spandsp");
|
||||
if (gethostname(buf, sizeof(buf)) == 0)
|
||||
TIFFSetField(tiff_file, TIFFTAG_HOSTCOMPUTER, buf);
|
||||
|
||||
|
||||
TIFFSetField(tiff_file, TIFFTAG_IMAGEDESCRIPTION, "Blank test image");
|
||||
TIFFSetField(tiff_file, TIFFTAG_MAKE, "soft-switch.org");
|
||||
TIFFSetField(tiff_file, TIFFTAG_MODEL, "test data");
|
||||
@ -362,7 +362,7 @@ int main(int argc, char *argv[])
|
||||
tm->tm_min,
|
||||
tm->tm_sec);
|
||||
TIFFSetField(tiff_file, TIFFTAG_DATETIME, buf);
|
||||
|
||||
|
||||
TIFFSetField(tiff_file, TIFFTAG_IMAGELENGTH, sequence[i].length);
|
||||
TIFFSetField(tiff_file, TIFFTAG_PAGENUMBER, 0, 1);
|
||||
TIFFSetField(tiff_file, TIFFTAG_CLEANFAXDATA, CLEANFAXDATA_CLEAN);
|
||||
|
@ -240,7 +240,7 @@ static int end_to_end_tests(void)
|
||||
samples = ademco_contactid_receiver_tx(receiver, amp, SAMPLES_PER_CHUNK);
|
||||
for (j = samples; j < SAMPLES_PER_CHUNK; j++)
|
||||
amp[j] = 0;
|
||||
|
||||
|
||||
/* We add AWGN and codec impairments to the signal, to stress the tone detector. */
|
||||
codec_munge(munge, amp, SAMPLES_PER_CHUNK);
|
||||
for (j = 0; j < SAMPLES_PER_CHUNK; j++)
|
||||
|
@ -233,7 +233,7 @@ static void put_adsi_msg(void *user_data, const uint8_t *msg, int len)
|
||||
int field_len;
|
||||
int message_type;
|
||||
uint8_t body[256];
|
||||
|
||||
|
||||
printf("Good message received (%d bytes)\n", len);
|
||||
good_message_received = TRUE;
|
||||
for (i = 0; i < len; i++)
|
||||
@ -784,7 +784,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
outhandle = NULL;
|
||||
|
||||
|
||||
tdd_character_set_tests();
|
||||
|
||||
if (decode_test_file)
|
||||
|
@ -60,7 +60,7 @@ int v14_test_async_tx_get_bit(void *user_data)
|
||||
async_tx_state_t *s;
|
||||
int bit;
|
||||
static int destuff = 0;
|
||||
|
||||
|
||||
/* Special routine to test V.14 rate adaption, by randomly skipping
|
||||
stop bits. */
|
||||
s = (async_tx_state_t *) user_data;
|
||||
@ -110,7 +110,7 @@ int v14_test_async_tx_get_bit(void *user_data)
|
||||
static int test_get_async_byte(void *user_data)
|
||||
{
|
||||
int byte;
|
||||
|
||||
|
||||
byte = tx_async_chars & 0xFF;
|
||||
tx_async_chars++;
|
||||
return byte;
|
||||
@ -150,7 +150,7 @@ int main(int argc, char *argv[])
|
||||
printf("Test failed.\n");
|
||||
exit(2);
|
||||
}
|
||||
|
||||
|
||||
printf("Test with async 7E1\n");
|
||||
async_tx_init(&tx_async, 7, ASYNC_PARITY_EVEN, 1, FALSE, test_get_async_byte, NULL);
|
||||
async_rx_init(&rx_async, 7, ASYNC_PARITY_EVEN, 1, FALSE, test_put_async_byte, NULL);
|
||||
|
@ -244,7 +244,7 @@ static const struct command_response_s general_test_seq[] =
|
||||
{"AT+FIT=?\r", "\r\n+FIT:(0-255),(0-1)\r\n\r\nOK\r\n"}, /* T.31 8.5.4 - DTE inactivity timeout */
|
||||
{"AT+FIT?\r", "\r\n+FIT:0,0\r\n\r\nOK\r\n"},
|
||||
{"AT+FLO=?\r", "\r\n+FLO:(0-2)\r\n\r\nOK\r\n"}, /* T.31 says to implement something similar to +IFC */
|
||||
{"AT+FLO?\r", "\r\n+FLO:2\r\n\r\nOK\r\n"},
|
||||
{"AT+FLO?\r", "\r\n+FLO:2\r\n\r\nOK\r\n"},
|
||||
{"AT+FMI?\r", "\r\n" MANUFACTURER "\r\n\r\nOK\r\n"}, /* T.31 says to duplicate +GMI */
|
||||
{"AT+FMM?\r", "\r\n" PACKAGE "\r\n\r\nOK\r\n"}, /* T.31 says to duplicate +GMM */
|
||||
{"AT+FMR?\r", "\r\n" VERSION "\r\n\r\nOK\r\n"}, /* T.31 says to duplicate +GMR */
|
||||
@ -279,7 +279,7 @@ static const struct command_response_s general_test_seq[] =
|
||||
{"AT+ICLOK?\r", "\r\n+ICLOK:0\r\n\r\nOK\r\n"}, /* V.250 6.2.14 - Select sync transmit clock source */
|
||||
{"AT+IDSR?\r", "\r\n+IDSR:0\r\n\r\nOK\r\n"}, /* V.250 6.2.16 - Select data set ready option */
|
||||
{"AT+IFC=?\r", "\r\n+IFC:(0-2),(0-2)\r\n\r\nOK\r\n"}, /* V.250 6.2.12 - DTE-DCE local flow control */
|
||||
{"AT+IFC?\r", "\r\n+IFC:2,2\r\n\r\nOK\r\n"},
|
||||
{"AT+IFC?\r", "\r\n+IFC:2,2\r\n\r\nOK\r\n"},
|
||||
{"AT+ILRR\r", "\r\nOK\r\n"}, /* V.250 6.2.13 - DTE-DCE local rate reporting */
|
||||
{"AT+ILSD=?\r", "\r\n+ILSD:(0,1)\r\n\r\nOK\r\n"}, /* V.250 6.2.15 - Select long space disconnect option */
|
||||
{"AT+ILSD?\r", "\r\n+ILSD:0\r\n\r\nOK\r\n"},
|
||||
@ -459,13 +459,13 @@ static int at_send_hdlc(at_state_t *s, uint8_t *t, int len)
|
||||
static int general_test(at_state_t *s)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
for (i = 0; general_test_seq[i].command[0]; i++)
|
||||
{
|
||||
response_buf_ptr = 0;
|
||||
response_buf[0] = '\0';
|
||||
command_response_test_step = i;
|
||||
at_send(s, general_test_seq[i].command);
|
||||
at_send(s, general_test_seq[i].command);
|
||||
if (strcmp(general_test_seq[command_response_test_step].response, response_buf) != 0)
|
||||
{
|
||||
printf("Incorrect response\n");
|
||||
@ -544,7 +544,7 @@ static int at_tx_handler(at_state_t *s, void *user_data, const uint8_t *buf, siz
|
||||
putchar(buf[i]);
|
||||
}
|
||||
response_buf[response_buf_ptr] = '\0';
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
@ -552,7 +552,7 @@ static int at_tx_handler(at_state_t *s, void *user_data, const uint8_t *buf, siz
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
at_state_t *at_state;
|
||||
|
||||
|
||||
if ((at_state = at_init(NULL, at_tx_handler, NULL, modem_call_control, NULL)) == NULL)
|
||||
{
|
||||
fprintf(stderr, "Cannot start the AT interpreter\n");
|
||||
|
@ -134,7 +134,7 @@ int main(int argc, char *argv[])
|
||||
/* Now send it out for graphing. */
|
||||
printf("%6d %.7f %.7f\n", i - 32768, x, p);
|
||||
}
|
||||
|
||||
|
||||
printf("Tests passed.\n");
|
||||
return 0;
|
||||
}
|
||||
|
@ -236,14 +236,14 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Test 1: Mitel's test 1 isn't really a test. Its a calibration step,
|
||||
which has no meaning here. */
|
||||
printf ("Test 1: Calibration\n");
|
||||
printf (" Passed\n");
|
||||
printf("Test 1: Calibration\n");
|
||||
printf(" Passed\n");
|
||||
|
||||
/* Test 2: Decode check
|
||||
This is a sanity check, that all digits are reliably detected
|
||||
under ideal conditions. Each possible digit is repeated 10 times,
|
||||
with 68ms bursts. The level of each tone is about 6dB down from clip */
|
||||
printf ("Test 2: Decode check\n");
|
||||
printf("Test 2: Decode check\n");
|
||||
my_mf_gen_init(0.0, -3, 0.0, -3, 68, 68);
|
||||
s = ALL_POSSIBLE_DIGITS;
|
||||
digit[1] = '\0';
|
||||
@ -258,14 +258,14 @@ int main(int argc, char *argv[])
|
||||
actual = bell_mf_rx_get(mf_state, buf, 128);
|
||||
if (actual != 1 || buf[0] != digit[0])
|
||||
{
|
||||
printf (" Sent '%s'\n", digit);
|
||||
printf (" Received '%s' [%d]\n", buf, actual);
|
||||
printf (" Failed\n");
|
||||
exit (2);
|
||||
printf(" Sent '%s'\n", digit);
|
||||
printf(" Received '%s' [%d]\n", buf, actual);
|
||||
printf(" Failed\n");
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
printf (" Passed\n");
|
||||
printf(" Passed\n");
|
||||
|
||||
/* Test 3: Recognition bandwidth and channel centre frequency check.
|
||||
Use all digits. Each digit types requires four tests to complete
|
||||
@ -295,7 +295,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
The spec calls for +-1.5% +-10Hz of bandwidth.
|
||||
*/
|
||||
printf ("Test 3: Recognition bandwidth and channel centre frequency check\n");
|
||||
printf("Test 3: Recognition bandwidth and channel centre frequency check\n");
|
||||
s = ALL_POSSIBLE_DIGITS;
|
||||
digit[1] = '\0';
|
||||
j = 0;
|
||||
@ -320,17 +320,17 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
rrb = (float) (nplus + nminus)/10.0;
|
||||
rcfo = (float) (nplus - nminus)/10.0;
|
||||
printf (" %c (low) rrb = %5.2f%%, rcfo = %5.2f%%, max -ve = %5.2f, max +ve = %5.2f\n",
|
||||
digit[0],
|
||||
rrb,
|
||||
rcfo,
|
||||
(float) nminus/10.0,
|
||||
(float) nplus/10.0);
|
||||
printf(" %c (low) rrb = %5.2f%%, rcfo = %5.2f%%, max -ve = %5.2f, max +ve = %5.2f\n",
|
||||
digit[0],
|
||||
rrb,
|
||||
rcfo,
|
||||
(float) nminus/10.0,
|
||||
(float) nplus/10.0);
|
||||
|
||||
if (rrb < 3.0 + rcfo + (2.0*100.0*10.0/bell_mf_tones[j].f1) || rrb >= 15.0 + rcfo)
|
||||
{
|
||||
printf (" Failed\n");
|
||||
exit (2);
|
||||
printf(" Failed\n");
|
||||
exit(2);
|
||||
}
|
||||
|
||||
for (nplus = 0, i = 1; i <= 60; i++)
|
||||
@ -351,27 +351,27 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
rrb = (float) (nplus + nminus)/10.0;
|
||||
rcfo = (float) (nplus - nminus)/10.0;
|
||||
printf (" %c (high) rrb = %5.2f%%, rcfo = %5.2f%%, max -ve = %5.2f, max +ve = %5.2f\n",
|
||||
digit[0],
|
||||
rrb,
|
||||
rcfo,
|
||||
(float) nminus/10.0,
|
||||
(float) nplus/10.0);
|
||||
printf(" %c (high) rrb = %5.2f%%, rcfo = %5.2f%%, max -ve = %5.2f, max +ve = %5.2f\n",
|
||||
digit[0],
|
||||
rrb,
|
||||
rcfo,
|
||||
(float) nminus/10.0,
|
||||
(float) nplus/10.0);
|
||||
if (rrb < 3.0 + rcfo + (2.0*100.0*10.0/bell_mf_tones[j].f2) || rrb >= 15.0 + rcfo)
|
||||
{
|
||||
printf (" Failed\n");
|
||||
exit (2);
|
||||
printf(" Failed\n");
|
||||
exit(2);
|
||||
}
|
||||
j++;
|
||||
}
|
||||
printf (" Passed\n");
|
||||
printf(" Passed\n");
|
||||
|
||||
/* Test 4: Acceptable amplitude ratio (twist).
|
||||
Twist all digits in both directions, and check the maximum twist
|
||||
we can accept. The way this is done is styled after the Mitel DTMF
|
||||
test, and has good and bad points. */
|
||||
|
||||
printf ("Test 4: Acceptable amplitude ratio (twist)\n");
|
||||
printf("Test 4: Acceptable amplitude ratio (twist)\n");
|
||||
s = ALL_POSSIBLE_DIGITS;
|
||||
digit[1] = '\0';
|
||||
while (*s)
|
||||
@ -538,12 +538,12 @@ int main(int argc, char *argv[])
|
||||
if (!callback_ok)
|
||||
{
|
||||
printf(" Failed\n");
|
||||
exit (2);
|
||||
exit(2);
|
||||
}
|
||||
printf(" Passed\n");
|
||||
|
||||
duration = time (NULL) - now;
|
||||
printf ("Tests passed in %ds\n", duration);
|
||||
printf("Tests passed in %ds\n", duration);
|
||||
return 0;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
@ -37,7 +37,7 @@
|
||||
#include <time.h>
|
||||
|
||||
#include "spandsp.h"
|
||||
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
awgn_state_t *noise_source;
|
||||
|
@ -47,12 +47,12 @@
|
||||
|
||||
The DTMF detection test suite performs similar tests to the Mitel test tape,
|
||||
traditionally used for testing DTMF receivers. Mitel seem to have discontinued
|
||||
this product, but all it not lost.
|
||||
this product, but all it not lost.
|
||||
|
||||
The first side of the Mitel tape consists of a number of tone and tone+noise
|
||||
based tests. The test suite synthesizes equivalent test data. Being digitally
|
||||
generated, this data is rather more predictable than the test data on the nasty
|
||||
old stretchy cassette tapes which Mitel sold.
|
||||
old stretchy cassette tapes which Mitel sold.
|
||||
|
||||
The second side of the Mitel tape contains fragments of real speech from real
|
||||
phone calls captured from the North American telephone network. These are
|
||||
@ -62,14 +62,14 @@ copies of this seem to be unobtainable. However, Bellcore produce a much more
|
||||
aggressive set of three cassette tapes. All six side (about 30 minutes each) are
|
||||
filled with much tougher fragments of real speech from the North American
|
||||
telephone network. If you can do well in this test, nobody cares about your
|
||||
results against the Mitel test tape.
|
||||
results against the Mitel test tape.
|
||||
|
||||
A fresh set of tapes was purchased for these tests, and digitised, producing 6
|
||||
wave files of 16 bit signed PCM data, sampled at 8kHz. They were transcribed
|
||||
using a speed adjustable cassette player. The test tone at the start of the
|
||||
tapes is pretty accurate, and the new tapes should not have had much opportunity
|
||||
to stretch. It is believed these transcriptions are about as good as the source
|
||||
material permits.
|
||||
material permits.
|
||||
|
||||
PLEASE NOTE
|
||||
|
||||
@ -79,7 +79,7 @@ you also have no right to use this data. The original tapes are the copyright
|
||||
material of BellCore, and they charge over US$200 for a set. I doubt they sell
|
||||
enough copies to consider this much of a business. However, it is their data,
|
||||
and it is their right to do as they wish with it. Currently I see no indication
|
||||
they wish to give it away for free.
|
||||
they wish to give it away for free.
|
||||
*/
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
@ -460,7 +460,7 @@ static void mitel_cm7291_side_1_tests(void)
|
||||
printf(" Passed\n");
|
||||
|
||||
/* Test 4: Acceptable amplitude ratio (twist).
|
||||
Use only the diagonal pairs of tones (digits 1, 5, 9 and D).
|
||||
Use only the diagonal pairs of tones (digits 1, 5, 9 and D).
|
||||
There are eight sections to the test. Each section contains 200
|
||||
pulses with a 50ms duration for each pulse. Initially the amplitude
|
||||
of both tones is 6dB down from clip. The two sections to test one
|
||||
@ -477,7 +477,7 @@ static void mitel_cm7291_side_1_tests(void)
|
||||
|
||||
The Acceptable Amplitude Ratio in dB is equal to the number of
|
||||
responses registered in (a) or (b), divided by 10.
|
||||
|
||||
|
||||
TODO: This is supposed to work in 1/10dB steps, but here I used 1dB
|
||||
steps, as the current tone generator has its amplitude set in
|
||||
1dB steps.
|
||||
@ -527,7 +527,7 @@ static void mitel_cm7291_side_1_tests(void)
|
||||
clip. The amplitude of each is gradually attenuated by -35dB at a
|
||||
rate of 1dB per pulse. The Dynamic Range in dB is equal to the
|
||||
number of responses from the receiver during the test.
|
||||
|
||||
|
||||
Well not really, but that is the Mitel test. Lets sweep a bit further,
|
||||
and see what the real range is */
|
||||
printf("Test 5: Dynamic range\n");
|
||||
@ -555,7 +555,7 @@ static void mitel_cm7291_side_1_tests(void)
|
||||
are transmitted at an amplitude of -6dB from clip per frequency.
|
||||
Pulse duration starts at 49ms and is gradually reduced to 10ms.
|
||||
Guard time in ms is equal to (500 - number of responses)/10.
|
||||
|
||||
|
||||
That is the Mitel test, and we will follow it. Its totally bogus,
|
||||
though. Just what the heck is a pass or fail here? */
|
||||
|
||||
@ -580,7 +580,7 @@ static void mitel_cm7291_side_1_tests(void)
|
||||
level is -24dBV, the second -18dBV and the third -12dBV.. The
|
||||
acceptable signal to noise ratio is the lowest ratio of signal
|
||||
to noise in the test where the receiver responds to all 1000 pulses.
|
||||
|
||||
|
||||
Well, that is the Mitel test, but it doesn't tell you what the
|
||||
decoder can really do. Lets do a more comprehensive test */
|
||||
|
||||
@ -597,7 +597,7 @@ static void mitel_cm7291_side_1_tests(void)
|
||||
// TODO: Clip
|
||||
for (sample = 0; sample < len; sample++)
|
||||
amp[sample] = saturate(amp[sample] + awgn(&noise_source));
|
||||
|
||||
|
||||
codec_munge(munge, amp, len);
|
||||
dtmf_rx(dtmf_state, amp, len);
|
||||
|
||||
@ -735,10 +735,10 @@ static void dial_tone_tolerance_tests(void)
|
||||
printf(" Acceptable signal to dial tone ratio is %ddB\n", -15 - j);
|
||||
if ((use_dialtone_filter && (-15 - j) > -12)
|
||||
||
|
||||
(!use_dialtone_filter && (-15 - j) > 10))
|
||||
(!use_dialtone_filter && (-15 - j) > 10))
|
||||
{
|
||||
printf(" Failed\n");
|
||||
exit(2);
|
||||
exit(2);
|
||||
}
|
||||
printf(" Passed\n");
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ typedef struct
|
||||
fir_float_state_t *fir;
|
||||
float history[35*8];
|
||||
int pos;
|
||||
float factor;
|
||||
float factor;
|
||||
float power;
|
||||
float peak;
|
||||
} level_measurement_device_t;
|
||||
@ -361,7 +361,7 @@ static void print_results(void)
|
||||
{
|
||||
if (!quiet)
|
||||
printf("test model ERL time Max Rin Max Rout Max Sgen Max Sin Max Sout\n");
|
||||
printf("%-4s %-1d %-5.1f%6.2fs%9.2f%9.2f%9.2f%9.2f%9.2f\n",
|
||||
printf("%-4s %-1d %-5.1f%6.2fs%9.2f%9.2f%9.2f%9.2f%9.2f\n",
|
||||
test_name,
|
||||
chan_model.model_no,
|
||||
20.0f*log10f(-chan_model.erl + 1.0e-10f),
|
||||
@ -404,7 +404,7 @@ static int channel_model_create(channel_model_state_t *chan, int model, float er
|
||||
sizeof(line_model_d8_coeffs)/sizeof(line_model_d8_coeffs[0]),
|
||||
sizeof(line_model_d9_coeffs)/sizeof(line_model_d9_coeffs[0])
|
||||
};
|
||||
static const float ki[] =
|
||||
static const float ki[] =
|
||||
{
|
||||
3.05e-5f,
|
||||
LINE_MODEL_D2_GAIN,
|
||||
@ -488,13 +488,13 @@ static void write_log_files(int16_t rout, int16_t sin)
|
||||
fprintf(fdump,
|
||||
" %d %d %d %d %d %d %d %d %d %d\n",
|
||||
ctx->clean_nlp,
|
||||
ctx->Ltx,
|
||||
ctx->Ltx,
|
||||
ctx->Lrx,
|
||||
ctx->Lclean,
|
||||
ctx->Lclean,
|
||||
(ctx->nonupdate_dwell > 0),
|
||||
ctx->adapt,
|
||||
ctx->Lclean_bg,
|
||||
ctx->Pstates,
|
||||
ctx->Pstates,
|
||||
ctx->Lbgn_upper,
|
||||
ctx->Lbgn);
|
||||
#endif
|
||||
@ -616,7 +616,7 @@ static void run_test(echo_can_state_t *ctx, int16_t (*tx_source)(void), int16_t
|
||||
|
||||
static void print_test_title(const char *title)
|
||||
{
|
||||
if (quiet == FALSE)
|
||||
if (quiet == FALSE)
|
||||
printf(title);
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
@ -653,7 +653,7 @@ static int perform_test_sanity(void)
|
||||
echo_can_adaption_mode(ctx, ECHO_CAN_USE_ADAPTION | ECHO_CAN_USE_NLP | ECHO_CAN_USE_CNG);
|
||||
run_test(ctx, local_css_signal, silence, 5000);
|
||||
echo_can_adaption_mode(ctx, ECHO_CAN_USE_ADAPTION);
|
||||
|
||||
|
||||
for (i = 0; i < SAMPLE_RATE*10; i++)
|
||||
{
|
||||
tx = local_css_signal();
|
||||
@ -715,7 +715,7 @@ static int perform_test_sanity(void)
|
||||
//result_sound[result_cur++] = (ctx->narrowband_score)*5; // ? SAMPLE_RATE : -SAMPLE_RATE;
|
||||
//result_sound[result_cur++] = ctx->tap_rotate_counter*10;
|
||||
////result_sound[result_cur++] = ctx->vad;
|
||||
|
||||
|
||||
put_residue(clean - far_tx);
|
||||
if (result_cur >= RESULT_CHANNELS*SAMPLE_RATE)
|
||||
{
|
||||
@ -812,7 +812,7 @@ static int perform_test_2b(void)
|
||||
echo_can_flush(ctx);
|
||||
echo_can_adaption_mode(ctx, ECHO_CAN_USE_ADAPTION);
|
||||
signal_restart(&local_css, 0.0f);
|
||||
|
||||
|
||||
/* Test 2B (a) - Convergence test with NLP disabled */
|
||||
|
||||
/* Converge the canceller */
|
||||
@ -863,17 +863,17 @@ static int perform_test_2ca(void)
|
||||
print_test_title("Performing test 2C(a) - Convergence with background noise present\n");
|
||||
ctx = echo_can_init(TEST_EC_TAPS, 0);
|
||||
awgn_init_dbm0(&far_noise_source, 7162534, -50.0f);
|
||||
|
||||
|
||||
echo_can_flush(ctx);
|
||||
echo_can_adaption_mode(ctx, ECHO_CAN_USE_ADAPTION);
|
||||
|
||||
|
||||
/* Converge a canceller */
|
||||
signal_restart(&local_css, 0.0f);
|
||||
run_test(ctx, silence, silence, 200);
|
||||
|
||||
|
||||
awgn_init_dbm0(&far_noise_source, 7162534, -40.0f);
|
||||
run_test(ctx, local_css_signal, far_hoth_noise_signal, 5000);
|
||||
|
||||
|
||||
/* Now freeze adaption, and measure the echo. */
|
||||
echo_can_adaption_mode(ctx, 0);
|
||||
level_measurements_reset_peaks();
|
||||
@ -901,18 +901,18 @@ static int perform_test_3a(void)
|
||||
|
||||
echo_can_flush(ctx);
|
||||
echo_can_adaption_mode(ctx, ECHO_CAN_USE_ADAPTION);
|
||||
|
||||
|
||||
run_test(ctx, silence, silence, 200);
|
||||
signal_restart(&local_css, 0.0f);
|
||||
signal_restart(&far_css, -20.0f);
|
||||
|
||||
/* Apply double talk, with a weak far end signal */
|
||||
run_test(ctx, local_css_signal, far_css_signal, 5000);
|
||||
|
||||
|
||||
/* Now freeze adaption. */
|
||||
echo_can_adaption_mode(ctx, 0);
|
||||
run_test(ctx, local_css_signal, silence, 500);
|
||||
|
||||
|
||||
/* Now measure the echo */
|
||||
level_measurements_reset_peaks();
|
||||
run_test(ctx, local_css_signal, silence, 5000);
|
||||
@ -943,20 +943,20 @@ static int perform_test_3ba(void)
|
||||
run_test(ctx, silence, silence, 200);
|
||||
signal_restart(&local_css, 0.0f);
|
||||
signal_restart(&far_css, 0.0f);
|
||||
|
||||
|
||||
/* Converge the canceller */
|
||||
run_test(ctx, local_css_signal, silence, 5000);
|
||||
|
||||
|
||||
/* Apply double talk */
|
||||
run_test(ctx, local_css_signal, far_css_signal, 5000);
|
||||
|
||||
|
||||
/* Now freeze adaption. */
|
||||
echo_can_adaption_mode(ctx, 0);
|
||||
run_test(ctx, local_css_signal, far_css_signal, 1000);
|
||||
|
||||
|
||||
/* Turn off the double talk. */
|
||||
run_test(ctx, local_css_signal, silence, 500);
|
||||
|
||||
|
||||
/* Now measure the echo */
|
||||
level_measurements_reset_peaks();
|
||||
run_test(ctx, local_css_signal, silence, 5000);
|
||||
@ -983,20 +983,20 @@ static int perform_test_3bb(void)
|
||||
run_test(ctx, silence, silence, 200);
|
||||
signal_restart(&local_css, 0.0f);
|
||||
signal_restart(&far_css, -15.0f);
|
||||
|
||||
|
||||
/* Converge the canceller */
|
||||
run_test(ctx, local_css_signal, silence, 5000);
|
||||
|
||||
|
||||
/* Apply double talk */
|
||||
run_test(ctx, local_css_signal, far_css_signal, 5000);
|
||||
|
||||
|
||||
/* Now freeze adaption. */
|
||||
echo_can_adaption_mode(ctx, 0);
|
||||
run_test(ctx, local_css_signal, silence, 1000);
|
||||
|
||||
|
||||
/* Turn off the double talk. */
|
||||
run_test(ctx, local_css_signal, silence, 500);
|
||||
|
||||
|
||||
/* Now measure the echo */
|
||||
level_measurements_reset_peaks();
|
||||
run_test(ctx, local_css_signal, silence, 5000);
|
||||
@ -1082,7 +1082,7 @@ static int perform_test_4(void)
|
||||
static int perform_test_5(void)
|
||||
{
|
||||
echo_can_state_t *ctx;
|
||||
|
||||
|
||||
/* Test 5 - Infinite return loss convergence test */
|
||||
print_test_title("Performing test 5 - Infinite return loss convergence test\n");
|
||||
ctx = echo_can_init(TEST_EC_TAPS, 0);
|
||||
@ -1261,8 +1261,8 @@ static int perform_test_9(void)
|
||||
|
||||
echo_can_flush(ctx);
|
||||
echo_can_adaption_mode(ctx,
|
||||
ECHO_CAN_USE_ADAPTION
|
||||
| ECHO_CAN_USE_NLP
|
||||
ECHO_CAN_USE_ADAPTION
|
||||
| ECHO_CAN_USE_NLP
|
||||
| ECHO_CAN_USE_CNG);
|
||||
|
||||
/* Test 9 part 1 - matching */
|
||||
@ -1492,7 +1492,7 @@ static void simulate_ec(char *argv[], int two_channel_file, int mode)
|
||||
if (two_channel_file)
|
||||
{
|
||||
txfile = sf_open_telephony_read(argv[0], 1);
|
||||
rxfile = sf_open_telephony_read(argv[1], 1);
|
||||
rxfile = sf_open_telephony_read(argv[1], 1);
|
||||
ecfile = sf_open_telephony_write(argv[2], 1);
|
||||
}
|
||||
else
|
||||
@ -1524,7 +1524,7 @@ static void simulate_ec(char *argv[], int two_channel_file, int mode)
|
||||
exit(2);
|
||||
}
|
||||
if ((nrx = sf_readf_short(rxfile, &sin, 1)) < 0)
|
||||
{
|
||||
{
|
||||
fprintf(stderr, " Error reading rx sound file\n");
|
||||
exit(2);
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ static void print_frame(const char *io, const uint8_t *fr, int frlen)
|
||||
const char *country;
|
||||
const char *vendor;
|
||||
const char *model;
|
||||
|
||||
|
||||
fprintf(stderr, "%s %s:", io, t30_frametype(fr[2]));
|
||||
for (i = 2; i < frlen; i++)
|
||||
fprintf(stderr, " %02x", fr[i]);
|
||||
@ -545,7 +545,7 @@ int main(int argc, char *argv[])
|
||||
fprintf(stderr, "Failed to init\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
for (;;)
|
||||
{
|
||||
len = sf_readf_short(inhandle, amp, SAMPLES_PER_CHUNK);
|
||||
|
@ -102,7 +102,7 @@ static void hdlc_underflow_handler(void *user_data)
|
||||
uint8_t buf[400];
|
||||
|
||||
s = (faxtester_state_t *) user_data;
|
||||
|
||||
|
||||
if (s->image_buffer)
|
||||
{
|
||||
/* We are sending an ECM image */
|
||||
@ -172,7 +172,7 @@ static void tone_detected(void *user_data, int tone, int level, int delay)
|
||||
SPAN_LOG_FLOW,
|
||||
"Tone was on for %fs\n",
|
||||
(float) (s->timer - s->tone_on_time)/SAMPLE_RATE + 0.55);
|
||||
}
|
||||
}
|
||||
s->tone_state = tone;
|
||||
if (tone == MODEM_CONNECT_TONES_NONE)
|
||||
front_end_step_complete(s);
|
||||
@ -336,7 +336,7 @@ int faxtester_rx(faxtester_state_t *s, int16_t *amp, int len)
|
||||
int faxtester_tx(faxtester_state_t *s, int16_t *amp, int max_len)
|
||||
{
|
||||
int len;
|
||||
|
||||
|
||||
len = 0;
|
||||
if (s->transmit)
|
||||
{
|
||||
@ -350,7 +350,7 @@ int faxtester_tx(faxtester_state_t *s, int16_t *amp, int max_len)
|
||||
{
|
||||
/* Pad to the requested length with silence */
|
||||
memset(amp + len, 0, (max_len - len)*sizeof(int16_t));
|
||||
len = max_len;
|
||||
len = max_len;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -362,7 +362,7 @@ int faxtester_tx(faxtester_state_t *s, int16_t *amp, int max_len)
|
||||
{
|
||||
/* Pad to the requested length with silence */
|
||||
memset(amp, 0, max_len*sizeof(int16_t));
|
||||
len = max_len;
|
||||
len = max_len;
|
||||
}
|
||||
}
|
||||
return len;
|
||||
|
@ -343,7 +343,7 @@ static void phase_e_handler(t30_state_t *s, void *user_data, int result)
|
||||
int i;
|
||||
t30_stats_t t;
|
||||
char tag[20];
|
||||
|
||||
|
||||
i = (int) (intptr_t) user_data;
|
||||
snprintf(tag, sizeof(tag), "%c: Phase E", i + 'A');
|
||||
printf("%c: Phase E handler - (%d) %s\n", i + 'A', result, t30_completion_code_to_str(result));
|
||||
@ -363,7 +363,7 @@ static void real_time_frame_handler(t30_state_t *s,
|
||||
int len)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
i = (intptr_t) user_data;
|
||||
printf("%c: Real time frame handler - %s, %s, length = %d\n",
|
||||
i + 'A',
|
||||
@ -376,7 +376,7 @@ static void real_time_frame_handler(t30_state_t *s,
|
||||
static int document_handler(t30_state_t *s, void *user_data, int event)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
i = (intptr_t) user_data;
|
||||
printf("%c: Document handler - event %d\n", i + 'A', event);
|
||||
return FALSE;
|
||||
@ -400,7 +400,7 @@ static void real_time_gateway_frame_handler(t38_gateway_state_t *s,
|
||||
int len)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
i = (intptr_t) user_data;
|
||||
printf("%c: Real time gateway frame handler - %s, %s, length = %d\n",
|
||||
i + 'A',
|
||||
@ -674,7 +674,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
memset(silence, 0, sizeof(silence));
|
||||
|
||||
|
||||
srand48(0x1234567);
|
||||
/* Set up the nodes */
|
||||
input_wave_handle = NULL;
|
||||
@ -858,6 +858,7 @@ int main(int argc, char *argv[])
|
||||
| T30_SUPPORT_300_600_RESOLUTION
|
||||
| T30_SUPPORT_400_800_RESOLUTION
|
||||
| T30_SUPPORT_600_1200_RESOLUTION);
|
||||
//t30_set_rx_encoding(t30_state[i], T4_COMPRESSION_ITU_T85);
|
||||
t30_set_ecm_capability(t30_state[i], use_ecm);
|
||||
if (use_ecm)
|
||||
{
|
||||
@ -1096,7 +1097,7 @@ int main(int argc, char *argv[])
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Check how many pages should have been transferred */
|
||||
expected_pages = get_tiff_total_pages(input_tiff_file_name);
|
||||
if (end_page >= 0 && expected_pages > end_page + 1)
|
||||
|
@ -41,7 +41,7 @@
|
||||
void fax_log_tx_parameters(t30_state_t *s, const char *tag)
|
||||
{
|
||||
const char *u;
|
||||
|
||||
|
||||
if ((u = t30_get_tx_ident(s)))
|
||||
printf("%s: Local ident '%s'\n", tag, u);
|
||||
if ((u = t30_get_tx_sub_address(s)))
|
||||
|
@ -174,7 +174,7 @@ int main(int argc, char *argv[])
|
||||
int16_t out_amp[2*BLOCK_LEN];
|
||||
SNDFILE *inhandle;
|
||||
SNDFILE *outhandle;
|
||||
int outframes;
|
||||
int outframes;
|
||||
int i;
|
||||
int j;
|
||||
int samples;
|
||||
@ -350,14 +350,14 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
off_at = i;
|
||||
printf("Carrier on at %d, off at %d\n", on_at, off_at);
|
||||
if (on_at < -29 || on_at > -26
|
||||
if (on_at < -29 || on_at > -26
|
||||
||
|
||||
off_at < -35 || off_at > -31)
|
||||
{
|
||||
printf("Tests failed.\n");
|
||||
exit(2);
|
||||
}
|
||||
|
||||
|
||||
printf("Test with BERT\n");
|
||||
test_bps = preset_fsk_specs[modem_under_test_1].baud_rate;
|
||||
if (modem_under_test_1 >= 0)
|
||||
@ -426,7 +426,7 @@ int main(int argc, char *argv[])
|
||||
out_amp[2*i + 1] = answerer_model_amp[i];
|
||||
for ( ; i < BLOCK_LEN; i++)
|
||||
out_amp[2*i + 1] = 0;
|
||||
|
||||
|
||||
if (log_audio)
|
||||
{
|
||||
outframes = sf_writef_short(outhandle, out_amp, BLOCK_LEN);
|
||||
@ -468,7 +468,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* Put a little silence between the chunks in the file. */
|
||||
memset(out_amp, 0, sizeof(out_amp));
|
||||
if (log_audio)
|
||||
|
@ -173,7 +173,7 @@ static void compliance_tests(int log_audio)
|
||||
printf("Tests failed\n");
|
||||
exit(2);
|
||||
}
|
||||
|
||||
|
||||
printf("Cyclic conversion repeatability tests.\n");
|
||||
/* Find what happens to every possible linear value after a round trip. */
|
||||
for (i = 0; i < 65536; i++)
|
||||
@ -200,7 +200,7 @@ static void compliance_tests(int log_audio)
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
printf("Reference power level tests.\n");
|
||||
power_meter_init(&power_meter, 7);
|
||||
|
||||
@ -274,7 +274,7 @@ static void compliance_tests(int log_audio)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
enc_state = g711_init(NULL, G711_ALAW);
|
||||
transcode = g711_init(NULL, G711_ALAW);
|
||||
dec_state = g711_init(NULL, G711_ULAW);
|
||||
|
@ -136,7 +136,7 @@ static const char *decode_test_files[] =
|
||||
TESTDATA_DIR "T3L3.RC2",
|
||||
TESTDATA_DIR "T3L3.RC3",
|
||||
TESTDATA_DIR "T3H3.RC0",
|
||||
|
||||
|
||||
NULL
|
||||
};
|
||||
|
||||
@ -197,13 +197,13 @@ static int get_test_vector(const char *file, uint16_t buf[], int max_len)
|
||||
int octets;
|
||||
int i;
|
||||
FILE *infile;
|
||||
|
||||
|
||||
if ((infile = fopen(file, "r")) == NULL)
|
||||
{
|
||||
fprintf(stderr, " Failed to open '%s'\n", file);
|
||||
exit(2);
|
||||
}
|
||||
octets = 0;
|
||||
octets = 0;
|
||||
while ((i = get_vector(infile, buf + octets)) > 0)
|
||||
octets += i;
|
||||
fclose(infile);
|
||||
@ -232,7 +232,7 @@ static void itu_compliance_tests(void)
|
||||
for (file = 0; encode_test_files[file]; file += 2)
|
||||
{
|
||||
printf("Testing %s -> %s\n", encode_test_files[file], encode_test_files[file + 1]);
|
||||
|
||||
|
||||
/* Get the input data */
|
||||
len_data = get_test_vector(encode_test_files[file], (uint16_t *) itu_data, MAX_TEST_VECTOR_LEN);
|
||||
|
||||
@ -322,7 +322,7 @@ static void itu_compliance_tests(void)
|
||||
len = j - i;
|
||||
for (k = 0; k < len; k++)
|
||||
compressed[k] = itu_data[k + i] >> ((mode == 3) ? 10 : (mode == 2) ? 9 : 8);
|
||||
|
||||
|
||||
dec_state = g722_decode_init(NULL, (mode == 3) ? 48000 : (mode == 2) ? 56000 : 64000, 0);
|
||||
dec_state->itu_test_mode = TRUE;
|
||||
len2 = g722_decode(dec_state, decompressed, compressed, len);
|
||||
|
@ -157,7 +157,7 @@ Algorithm Input Intermediate Output Input Intermediate Output
|
||||
HN40FA.I HN40FX.O HV40FA.I HV40FX.O
|
||||
*/
|
||||
|
||||
#define G726_ENCODING_NONE 9999
|
||||
#define G726_ENCODING_NONE 9999
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@ -1043,13 +1043,13 @@ static int get_test_vector(const char *file, uint8_t buf[], int max_len)
|
||||
int i;
|
||||
int sum;
|
||||
FILE *infile;
|
||||
|
||||
|
||||
if ((infile = fopen(file, "r")) == NULL)
|
||||
{
|
||||
fprintf(stderr, " Failed to open '%s'\n", file);
|
||||
exit(2);
|
||||
}
|
||||
octets = 0;
|
||||
octets = 0;
|
||||
while ((i = get_vector(infile, buf + octets)) > 0)
|
||||
octets += i;
|
||||
fclose(infile);
|
||||
@ -1253,7 +1253,7 @@ int main(int argc, char *argv[])
|
||||
printf("ADPCM packing is %d\n", packing);
|
||||
g726_init(&enc_state, bit_rate, G726_ENCODING_LINEAR, packing);
|
||||
g726_init(&dec_state, bit_rate, G726_ENCODING_LINEAR, packing);
|
||||
|
||||
|
||||
while ((frames = sf_readf_short(inhandle, amp, 159)))
|
||||
{
|
||||
adpcm = g726_encode(&enc_state, adpcmdata, amp, frames);
|
||||
|
@ -92,7 +92,7 @@ copied to etsitests/gsm0610/unpacked so the files are arranged in the following
|
||||
./fr_sync_A:
|
||||
Seqsync_A.inp
|
||||
Sync000_A.cod --to-- Sync159_A.cod
|
||||
|
||||
|
||||
./fr_sync_L:
|
||||
Bitsync.inp
|
||||
Seqsync.inp
|
||||
@ -153,7 +153,7 @@ static int get_test_vector(int full, int disk, const char *name)
|
||||
int in;
|
||||
int len;
|
||||
int i;
|
||||
|
||||
|
||||
if (full)
|
||||
{
|
||||
sprintf(buf, "%s%c/%s.inp", TESTDATA_DIR, 'L', name);
|
||||
@ -189,7 +189,7 @@ static int get_test_vector(int full, int disk, const char *name)
|
||||
{
|
||||
vector_len = len;
|
||||
}
|
||||
|
||||
|
||||
sprintf(buf, "%s%c/%s.cod", TESTDATA_DIR, 'L', name);
|
||||
if ((in = open(buf, O_RDONLY)) < 0)
|
||||
{
|
||||
@ -221,9 +221,9 @@ static int get_law_test_vector(int full, int law, const char *name)
|
||||
int len;
|
||||
int i;
|
||||
int law_uc;
|
||||
|
||||
|
||||
law_uc = toupper(law);
|
||||
|
||||
|
||||
if (full)
|
||||
{
|
||||
sprintf(buf, "%s%c/%s-%c.inp", TESTDATA_DIR, law_uc, name, law_uc);
|
||||
@ -286,7 +286,7 @@ static int get_law_test_vector(int full, int law, const char *name)
|
||||
len /= sizeof(int16_t);
|
||||
for (i = 0; i < len; i++)
|
||||
decoder_code_vector[i] = code_vector_buf[i];
|
||||
|
||||
|
||||
return len;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
@ -368,7 +368,7 @@ static int perform_law_test(int full, int law, const char *name)
|
||||
printf("Performing A-law test '%s'\n", name);
|
||||
else
|
||||
printf("Performing u-law test '%s'\n", name);
|
||||
|
||||
|
||||
get_law_test_vector(full, law, name);
|
||||
|
||||
if (full)
|
||||
@ -448,9 +448,9 @@ static int repack_gsm0610_voip_to_wav49(uint8_t c[], const uint8_t d[])
|
||||
{
|
||||
gsm0610_frame_t frame[2];
|
||||
int n;
|
||||
|
||||
n = gsm0610_unpack_voip(&frame[0], d);
|
||||
gsm0610_unpack_voip(&frame[1], d + n);
|
||||
|
||||
n = gsm0610_unpack_voip(&frame[0], d);
|
||||
gsm0610_unpack_voip(&frame[1], d + n);
|
||||
n = gsm0610_pack_wav49(c, frame);
|
||||
return n;
|
||||
}
|
||||
@ -479,7 +479,7 @@ static int perform_pack_unpack_test(void)
|
||||
printf("Performing packing/unpacking tests (not part of the ETSI conformance tests).\n");
|
||||
/* Try trans-packing a lot of random data looking for before/after mismatch. */
|
||||
for (j = 0; j < 1000; j++)
|
||||
{
|
||||
{
|
||||
for (i = 0; i < 65; i++)
|
||||
a[i] = rand();
|
||||
repack_gsm0610_wav49_to_voip(b, a);
|
||||
@ -583,13 +583,13 @@ int main(int argc, char *argv[])
|
||||
fprintf(stderr, " Cannot create audio file '%s'\n", OUT_FILE_NAME);
|
||||
exit(2);
|
||||
}
|
||||
|
||||
|
||||
if ((gsm0610_enc_state = gsm0610_init(NULL, packing)) == NULL)
|
||||
{
|
||||
fprintf(stderr, " Cannot create encoder\n");
|
||||
exit(2);
|
||||
}
|
||||
|
||||
|
||||
if ((gsm0610_dec_state = gsm0610_init(NULL, packing)) == NULL)
|
||||
{
|
||||
fprintf(stderr, " Cannot create decoder\n");
|
||||
@ -602,7 +602,7 @@ int main(int argc, char *argv[])
|
||||
gsm0610_decode(gsm0610_dec_state, post_amp, gsm0610_data, bytes);
|
||||
sf_writef_short(outhandle, post_amp, frames);
|
||||
}
|
||||
|
||||
|
||||
if (sf_close_telephony(inhandle))
|
||||
{
|
||||
fprintf(stderr, " Cannot close audio file '%s'\n", IN_FILE_NAME);
|
||||
|
@ -818,7 +818,7 @@ static void decode_bitstream(const char *in_file_name)
|
||||
int num;
|
||||
hdlc_rx_state_t rx;
|
||||
FILE *in;
|
||||
|
||||
|
||||
if ((in = fopen(in_file_name, "r")) == NULL)
|
||||
{
|
||||
fprintf(stderr, "Failed to open '%s'\n", in_file_name);
|
||||
|
@ -136,7 +136,7 @@ int main(int argc, char *argv[])
|
||||
fprintf(stderr, " Cannot create encoder\n");
|
||||
exit(2);
|
||||
}
|
||||
|
||||
|
||||
if ((ima_dec_state = ima_adpcm_init(NULL, variant, enc_chunk_size)) == NULL)
|
||||
{
|
||||
fprintf(stderr, " Cannot create decoder\n");
|
||||
@ -203,7 +203,7 @@ int main(int argc, char *argv[])
|
||||
printf("Tests failed.\n");
|
||||
exit(2);
|
||||
}
|
||||
|
||||
|
||||
printf("Tests passed.\n");
|
||||
return 0;
|
||||
}
|
||||
|
@ -196,7 +196,7 @@ static int test_dithered_50_by_50(int row, int width, uint8_t buf[])
|
||||
" 46: @ @ @ @ @ @ @@ @ @ @@ @@ @@ @@@@@ @ @@ @@@@@@@@@@",
|
||||
" 47: @ @ @ @ @ @@ @ @ @@@@ @@@@ @@@@@ @@@@@@@@@@@ @@@@@",
|
||||
" 48: @ @ @ @@ @ @@ @@ @ @@ @ @@@ @ @@@@@ @@@@@@@@@@@@@",
|
||||
" 49: @ @ @ @ @ @@ @@ @@ @@ @@@@ @@@@@@@ @@@@@@ @@@@@@@@"
|
||||
" 49: @ @ @ @ @ @@ @@ @@ @@ @@@@ @@@@@@@ @@@@@@ @@@@@@@@"
|
||||
};
|
||||
int i;
|
||||
int match;
|
||||
|
@ -241,7 +241,7 @@ int main(int argc, char *argv[])
|
||||
pk = peak(noise_sound, 8192);
|
||||
ms = rms(noise_sound, 8192);
|
||||
printf("Filtered noise level = %.2fdB, crest factor = %.2fdB\n", rms_to_dbm0(ms), rms_to_db(pk/ms));
|
||||
|
||||
|
||||
for (i = 0; i < 8192; i++)
|
||||
silence_sound[i] = 0.0;
|
||||
|
||||
|
@ -130,7 +130,7 @@ static int preamble_get_bit(void *user_data)
|
||||
{
|
||||
static int bit_no = 0;
|
||||
int bit;
|
||||
|
||||
|
||||
/* Generate a section of HDLC flag octet preamble. Then generate some random
|
||||
bits, which should not look like preamble. */
|
||||
if (++preamble_count < 255)
|
||||
|
@ -27,12 +27,12 @@
|
||||
\section modem_echo_can_tests_page_sec_1 What does it do?
|
||||
Currently the echo cancellation tests only provide simple exercising of the
|
||||
cancellor in the way it might be used for line echo cancellation. The test code
|
||||
is in echotests.c.
|
||||
is in echotests.c.
|
||||
|
||||
The goal is to test the echo cancellor again the G.16X specs. Clearly, that also
|
||||
means the goal for the cancellor itself is to comply with those specs. Right
|
||||
now, the only aspect of these tests implemented is the line impulse response
|
||||
models in g168tests.c.
|
||||
models in g168tests.c.
|
||||
|
||||
\section modem_echo_can_tests_page_sec_2 How does it work?
|
||||
The current test consists of feeding an audio file of real speech to the echo
|
||||
@ -42,7 +42,7 @@ real speech is also used to simulate a signal received form the far end of the
|
||||
line. This is gated so it is only placed for one second every 10 seconds,
|
||||
simulating the double talk condition. The resulting echo cancelled signal can
|
||||
either be store in a file for further analysis, or played back as the data is
|
||||
processed.
|
||||
processed.
|
||||
|
||||
A number of modified versions of this test have been performed. The signal level
|
||||
of the two speech sources has been varied. Several simple models of the
|
||||
@ -53,7 +53,7 @@ is very loud (with earlier versions, well, ....:) ). The lack of saturating
|
||||
arithmetic in general purpose CPUs is a huge disadvantage here, as software
|
||||
saturation logic would cause a major slow down. Floating point would be good,
|
||||
but is not usable in the Linux kernel. Anyway, the bottom line seems to be the
|
||||
current design is genuinely useful, if imperfect.
|
||||
current design is genuinely useful, if imperfect.
|
||||
|
||||
\section modem_echo_can_tests_page_sec_2 How do I use it?
|
||||
|
||||
@ -69,7 +69,7 @@ echo_tests.c is commented out with a \#if. If this is enabled, detailed
|
||||
information about the results of the echo cancellation will be written to
|
||||
stdout. By saving this into a file, Grace (recommended), GnuPlot, or some other
|
||||
plotting package may be used to graphically display the functioning of the
|
||||
cancellor.
|
||||
cancellor.
|
||||
*/
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
@ -266,7 +266,7 @@ int main(int argc, char *argv[])
|
||||
#if defined(ENABLE_GUI)
|
||||
int16_t amp[2];
|
||||
#endif
|
||||
|
||||
|
||||
line_model_no = 0;
|
||||
use_gui = FALSE;
|
||||
for (i = 1; i < argc; i++)
|
||||
@ -305,7 +305,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
power_meter_init(&power_before, 5);
|
||||
power_meter_init(&power_after, 5);
|
||||
|
||||
|
||||
/* Measure the echo power before adaption */
|
||||
modem_echo_can_adaption_mode(ctx, FALSE);
|
||||
for (i = 0; i < 8000*5; i++)
|
||||
@ -319,7 +319,7 @@ int main(int argc, char *argv[])
|
||||
unadapted_output_power = power_meter_current_dbm0(&power_before);
|
||||
unadapted_echo_power = power_meter_current_dbm0(&power_after);
|
||||
printf("Pre-adaption: output power %10.5fdBm0, echo power %10.5fdBm0\n", unadapted_output_power, unadapted_echo_power);
|
||||
|
||||
|
||||
/* Converge the canceller */
|
||||
signal_restart(&local_css);
|
||||
modem_echo_can_adaption_mode(ctx, TRUE);
|
||||
@ -364,7 +364,7 @@ int main(int argc, char *argv[])
|
||||
adapted_output_power = power_meter_current_dbm0(&power_before);
|
||||
adapted_echo_power = power_meter_current_dbm0(&power_after);
|
||||
printf("Post-adaption: output power %10.5fdBm0, echo power %10.5fdBm0\n", adapted_output_power, adapted_echo_power);
|
||||
|
||||
|
||||
if (fabsf(adapted_output_power - unadapted_output_power) > 0.1f
|
||||
||
|
||||
adapted_echo_power > unadapted_echo_power - 30.0f)
|
||||
|
@ -202,7 +202,7 @@ int main (int argc, char *argv[])
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
quality = 7;
|
||||
printf("Generating Hoth noise at -15dBOv to file\n");
|
||||
level = -15;
|
||||
@ -224,7 +224,7 @@ int main (int argc, char *argv[])
|
||||
fprintf(stderr, " Cannot close audio file '%s'\n", OUT_FILE_NAME);
|
||||
exit(2);
|
||||
}
|
||||
|
||||
|
||||
printf("Tests passed.\n");
|
||||
return 0;
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ struct iphdr
|
||||
uint32_t daddr;
|
||||
/*The options start here. */
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/* We define our own structures for Ethernet Header and IPv6 Header as they are not available on CYGWIN.
|
||||
@ -287,6 +287,9 @@ int pcap_scan_pkts(const char *file,
|
||||
fprintf(stderr, "Truncated packet - total len = %d, captured len = %d\n", pkthdr->len, pkthdr->caplen);
|
||||
exit(2);
|
||||
}
|
||||
#if 0
|
||||
printf("%d:%d -> %d:%d\n", ntohl(iphdr->saddr), ntohs(udphdr->source), ntohl(iphdr->daddr), ntohs(udphdr->dest));
|
||||
#endif
|
||||
body = (const uint8_t *) udphdr;
|
||||
body += sizeof(struct udphdr);
|
||||
body_len = pktlen - sizeof(struct udphdr);
|
||||
|
@ -260,7 +260,7 @@ static void static_buffer_tests(void)
|
||||
fr,
|
||||
type,
|
||||
len,
|
||||
next_scheduled_send,
|
||||
next_scheduled_send,
|
||||
next_actual_receive);
|
||||
switch (ret)
|
||||
{
|
||||
|
@ -101,7 +101,7 @@ static int power_surge_detector_tests(void)
|
||||
if (prev_signal_present != signal_present)
|
||||
{
|
||||
signal_power = power_surge_detector_current_dbm0(sig);
|
||||
if (signal_present)
|
||||
if (signal_present)
|
||||
{
|
||||
if (ok == 0 && i >= 0 && i < 25)
|
||||
ok = 1;
|
||||
@ -120,7 +120,7 @@ static int power_surge_detector_tests(void)
|
||||
if (extremes[3] < i)
|
||||
extremes[3] = i;
|
||||
printf("Off at %f (%fdBm0)\n", (sample + i)/8000.0, signal_power);
|
||||
}
|
||||
}
|
||||
prev_signal_present = signal_present;
|
||||
}
|
||||
amp_out[2*i] = amp[i];
|
||||
|
@ -546,7 +546,7 @@ static void functional_message_tests(void)
|
||||
uint8_t buf[MSG_LEN];
|
||||
int i;
|
||||
int len;
|
||||
|
||||
|
||||
total_in = 0;
|
||||
total_out = 0;
|
||||
|
||||
|
@ -149,7 +149,7 @@ static void my_mf_gen_init(float low_fudge,
|
||||
{
|
||||
const mf_digit_tones_t *tone;
|
||||
int i;
|
||||
|
||||
|
||||
for (i = 0; i < 15; i++)
|
||||
{
|
||||
if (fwd)
|
||||
@ -190,7 +190,7 @@ static void codec_munge(int16_t amp[], int len)
|
||||
{
|
||||
int i;
|
||||
uint8_t alaw;
|
||||
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
alaw = linear_to_alaw (amp[i]);
|
||||
@ -245,15 +245,15 @@ static int test_a_tone_set(int fwd)
|
||||
/* Test 1: Mitel's test 1 isn't really a test. Its a calibration step,
|
||||
which has no meaning here. */
|
||||
|
||||
printf ("Test 1: Calibration\n");
|
||||
printf (" Passed\n");
|
||||
printf("Test 1: Calibration\n");
|
||||
printf(" Passed\n");
|
||||
|
||||
/* Test 2: Decode check
|
||||
This is a sanity check, that all digits are reliably detected
|
||||
under ideal conditions. Each possible digit is repeated 10 times,
|
||||
with 68ms bursts. The level of each tone is about 6dB down from clip */
|
||||
|
||||
printf ("Test 2: Decode check\n");
|
||||
printf("Test 2: Decode check\n");
|
||||
my_mf_gen_init(0.0, -3, 0.0, -3, 68, fwd);
|
||||
s = r2_mf_tone_codes;
|
||||
while (*s)
|
||||
@ -267,14 +267,14 @@ static int test_a_tone_set(int fwd)
|
||||
actual = r2_mf_rx_get(mf_state);
|
||||
if (actual != digit)
|
||||
{
|
||||
printf (" Sent '%c'\n", digit);
|
||||
printf (" Received 0x%X\n", actual);
|
||||
printf (" Failed\n");
|
||||
exit (2);
|
||||
printf(" Sent '%c'\n", digit);
|
||||
printf(" Received 0x%X\n", actual);
|
||||
printf(" Failed\n");
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
printf (" Passed\n");
|
||||
printf(" Passed\n");
|
||||
|
||||
/* Test 3: Recognition bandwidth and channel centre frequency check.
|
||||
Use all digits. Each digit types requires four tests to complete
|
||||
@ -297,14 +297,14 @@ static int test_a_tone_set(int fwd)
|
||||
RRB% = (N+ + N-)/10
|
||||
Receiver Center Frequency Offset (RCFO) is calculated as follows:
|
||||
RCFO% = X + (N+ - N-)/20
|
||||
|
||||
|
||||
Note that this test doesn't test what it says it is testing at all,
|
||||
and the results are quite inaccurate, if not a downright lie! However,
|
||||
it follows the Mitel procedure, so how can it be bad? :)
|
||||
|
||||
|
||||
The spec calls for +-4 +-10Hz (ie +-14Hz) of bandwidth. */
|
||||
|
||||
printf ("Test 3: Recognition bandwidth and channel centre frequency check\n");
|
||||
printf("Test 3: Recognition bandwidth and channel centre frequency check\n");
|
||||
s = r2_mf_tone_codes;
|
||||
j = 0;
|
||||
while (*s)
|
||||
@ -330,17 +330,17 @@ static int test_a_tone_set(int fwd)
|
||||
}
|
||||
rrb = (float) (nplus + nminus)/10.0;
|
||||
rcfo = (float) (nplus - nminus)/10.0;
|
||||
printf (" %c (low) rrb = %5.2f%%, rcfo = %5.2f%%, max -ve = %5.2f, max +ve = %5.2f\n",
|
||||
digit,
|
||||
rrb,
|
||||
rcfo,
|
||||
(float) nminus/10.0,
|
||||
(float) nplus/10.0);
|
||||
printf(" %c (low) rrb = %5.2f%%, rcfo = %5.2f%%, max -ve = %5.2f, max +ve = %5.2f\n",
|
||||
digit,
|
||||
rrb,
|
||||
rcfo,
|
||||
(float) nminus/10.0,
|
||||
(float) nplus/10.0);
|
||||
|
||||
if (rrb < rcfo + (2.0*100.0*14.0/r2_mf_fwd_tones[j].f1) || rrb >= 15.0 + rcfo)
|
||||
{
|
||||
printf (" Failed\n");
|
||||
exit (2);
|
||||
printf(" Failed\n");
|
||||
exit(2);
|
||||
}
|
||||
|
||||
for (nplus = 0, i = 1; i <= 60; i++)
|
||||
@ -363,27 +363,27 @@ static int test_a_tone_set(int fwd)
|
||||
}
|
||||
rrb = (float) (nplus + nminus)/10.0;
|
||||
rcfo = (float) (nplus - nminus)/10.0;
|
||||
printf (" %c (high) rrb = %5.2f%%, rcfo = %5.2f%%, max -ve = %5.2f, max +ve = %5.2f\n",
|
||||
digit,
|
||||
rrb,
|
||||
rcfo,
|
||||
(float) nminus/10.0,
|
||||
(float) nplus/10.0);
|
||||
printf(" %c (high) rrb = %5.2f%%, rcfo = %5.2f%%, max -ve = %5.2f, max +ve = %5.2f\n",
|
||||
digit,
|
||||
rrb,
|
||||
rcfo,
|
||||
(float) nminus/10.0,
|
||||
(float) nplus/10.0);
|
||||
if (rrb < rcfo + (2.0*100.0*14.0/r2_mf_fwd_tones[j].f2) || rrb >= 15.0 + rcfo)
|
||||
{
|
||||
printf (" Failed\n");
|
||||
exit (2);
|
||||
printf(" Failed\n");
|
||||
exit(2);
|
||||
}
|
||||
j++;
|
||||
}
|
||||
printf (" Passed\n");
|
||||
printf(" Passed\n");
|
||||
|
||||
/* Test 4: Acceptable amplitude ratio (twist).
|
||||
Twist all digits in both directions, and check the maximum twist
|
||||
we can accept. The way this is done is styled after the Mitel DTMF
|
||||
test, and has good and bad points. */
|
||||
|
||||
printf ("Test 4: Acceptable amplitude ratio (twist)\n");
|
||||
printf("Test 4: Acceptable amplitude ratio (twist)\n");
|
||||
s = r2_mf_tone_codes;
|
||||
while (*s)
|
||||
{
|
||||
@ -398,11 +398,11 @@ static int test_a_tone_set(int fwd)
|
||||
if (r2_mf_rx_get(mf_state) == digit)
|
||||
nplus++;
|
||||
}
|
||||
printf (" %c normal twist = %.2fdB\n", digit, (float) nplus/10.0);
|
||||
printf(" %c normal twist = %.2fdB\n", digit, (float) nplus/10.0);
|
||||
if (nplus < 70)
|
||||
{
|
||||
printf (" Failed\n");
|
||||
exit (2);
|
||||
printf(" Failed\n");
|
||||
exit(2);
|
||||
}
|
||||
for (nminus = 0, i = -50; i >= -250; i--)
|
||||
{
|
||||
@ -414,21 +414,21 @@ static int test_a_tone_set(int fwd)
|
||||
if (r2_mf_rx_get(mf_state) == digit)
|
||||
nminus++;
|
||||
}
|
||||
printf (" %c reverse twist = %.2fdB\n", digit, (float) nminus/10.0);
|
||||
printf(" %c reverse twist = %.2fdB\n", digit, (float) nminus/10.0);
|
||||
if (nminus < 70)
|
||||
{
|
||||
printf (" Failed\n");
|
||||
exit (2);
|
||||
printf(" Failed\n");
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
printf (" Passed\n");
|
||||
printf(" Passed\n");
|
||||
|
||||
/* Test 5: Dynamic range
|
||||
This test sends all possible digits, with gradually increasing
|
||||
This test sends all possible digits, with gradually increasing
|
||||
amplitude. We determine the span over which we achieve reliable
|
||||
detection. */
|
||||
|
||||
printf ("Test 5: Dynamic range\n");
|
||||
|
||||
printf("Test 5: Dynamic range\n");
|
||||
for (nplus = nminus = -1000, i = -50; i <= 3; i++)
|
||||
{
|
||||
s = r2_mf_tone_codes;
|
||||
@ -458,19 +458,19 @@ static int test_a_tone_set(int fwd)
|
||||
nminus = i;
|
||||
}
|
||||
}
|
||||
printf (" Dynamic range = %ddB to %ddB\n", nplus, nminus - 1);
|
||||
printf(" Dynamic range = %ddB to %ddB\n", nplus, nminus - 1);
|
||||
if (nplus > -35 || nminus <= -5)
|
||||
{
|
||||
printf(" Failed\n");
|
||||
exit(2);
|
||||
}
|
||||
printf (" Passed\n");
|
||||
printf(" Passed\n");
|
||||
|
||||
/* Test 6: Guard time
|
||||
This test sends all possible digits, with a gradually reducing
|
||||
This test sends all possible digits, with a gradually reducing
|
||||
duration. */
|
||||
|
||||
printf ("Test 6: Guard time\n");
|
||||
printf("Test 6: Guard time\n");
|
||||
for (i = 30; i < 62; i++)
|
||||
{
|
||||
s = r2_mf_tone_codes;
|
||||
@ -493,19 +493,19 @@ static int test_a_tone_set(int fwd)
|
||||
if (j == 500)
|
||||
break;
|
||||
}
|
||||
printf (" Guard time = %dms\n", i);
|
||||
printf(" Guard time = %dms\n", i);
|
||||
if (i > 61)
|
||||
{
|
||||
printf(" Failed\n");
|
||||
exit(2);
|
||||
}
|
||||
printf (" Passed\n");
|
||||
printf(" Passed\n");
|
||||
|
||||
/* Test 7: Acceptable signal to noise ratio
|
||||
We send all possible digits at -6dBm from clip, mixed with AWGN.
|
||||
We gradually reduce the noise until we get clean detection. */
|
||||
|
||||
printf ("Test 7: Acceptable signal to noise ratio\n");
|
||||
printf("Test 7: Acceptable signal to noise ratio\n");
|
||||
my_mf_gen_init(0.0, -3, 0.0, -3, 68, fwd);
|
||||
for (i = -3; i > -50; i--)
|
||||
{
|
||||
@ -563,7 +563,7 @@ static int test_a_tone_set(int fwd)
|
||||
if (!callback_ok)
|
||||
{
|
||||
printf(" Failed\n");
|
||||
exit (2);
|
||||
exit(2);
|
||||
}
|
||||
printf(" Passed\n");
|
||||
|
||||
@ -571,7 +571,7 @@ static int test_a_tone_set(int fwd)
|
||||
meaningless for R2 MF. However the decoder's tolerance of
|
||||
out of band noise is significant. */
|
||||
/* TODO: add a OOB tolerance test. */
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
@ -587,7 +587,7 @@ int main(int argc, char *argv[])
|
||||
printf("R2 backward tones\n");
|
||||
test_a_tone_set(FALSE);
|
||||
duration = time(NULL) - now;
|
||||
printf ("Tests passed in %lds\n", duration);
|
||||
printf("Tests passed in %lds\n", duration);
|
||||
return 0;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
@ -183,7 +183,7 @@ int main(int argc, char *argv[])
|
||||
if ((len = rfc2198_sim_put(s, put_pkt, put_pkt_len, i, (double) i*0.001*PACKET_INTERVAL)) > 0)
|
||||
packets_really_put++;
|
||||
packets_put++;
|
||||
#if 0
|
||||
#if 0
|
||||
if (i == 5)
|
||||
rfc2198_sim_queue_dump(s);
|
||||
#endif
|
||||
|
@ -287,7 +287,7 @@ int main(int argc, char *argv[])
|
||||
||
|
||||
saturated_mul16_32(32767, 32767) != 2147352578
|
||||
||
|
||||
saturated_mul16_32(-32768, -32768) != -2147483648)
|
||||
saturated_mul16_32(-32768, -32768) != INT32_MAX)
|
||||
{
|
||||
printf("Test failed.\n");
|
||||
exit(2);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user