spandsp  0.0.6
math_fixed.h
1 /*
2  * SpanDSP - a series of DSP components for telephony
3  *
4  * math_fixed.h
5  *
6  * Written by Steve Underwood <steveu@coppice.org>
7  *
8  * Copyright (C) 2010 Steve Underwood
9  *
10  * All rights reserved.
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU Lesser General Public License version 2.1,
14  * as published by the Free Software Foundation.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Lesser General Public License for more details.
20  *
21  * You should have received a copy of the GNU Lesser General Public
22  * License along with this program; if not, write to the Free Software
23  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24  */
25 
26 #if !defined(_MATH_FIXED_H_)
27 #define _MATH_FIXED_H_
28 
29 /*! \page math_fixed_page Fixed point math functions
30 
31 \section math_fixed_page_sec_1 What does it do?
32 
33 \section math_fixed_page_sec_2 How does it work?
34 */
35 
36 #if defined(__cplusplus)
37 extern "C"
38 {
39 #endif
40 
41 #if defined(SPANDSP_USE_FIXED_POINT)
42 SPAN_DECLARE(uint16_t) sqrtu32_u16(uint32_t x);
43 #endif
44 
45 SPAN_DECLARE(uint16_t) fixed_reciprocal16(uint16_t x, int *shift);
46 
47 SPAN_DECLARE(uint16_t) fixed_divide16(uint16_t y, uint16_t x);
48 
49 SPAN_DECLARE(uint16_t) fixed_divide32(uint32_t y, uint16_t x);
50 
51 SPAN_DECLARE(int16_t) fixed_log10_16(uint16_t x);
52 
53 SPAN_DECLARE(int32_t) fixed_log10_32(uint32_t x);
54 
55 SPAN_DECLARE(uint16_t) fixed_sqrt16(uint16_t x);
56 
57 SPAN_DECLARE(uint16_t) fixed_sqrt32(uint32_t x);
58 
59 /*! Evaluate an approximate 16 bit fixed point sine.
60  \brief Evaluate an approximate 16 bit fixed point sine.
61  \param x A 16 bit unsigned angle, in 360/65536 degree steps.
62  \return sin(x)*32767. */
63 SPAN_DECLARE(int16_t) fixed_sin(uint16_t x);
64 
65 /*! Evaluate an approximate 16 bit fixed point cosine.
66  \brief Evaluate an approximate 16 bit fixed point cosine.
67  \param x A 16 bit unsigned angle, in 360/65536 degree steps.
68  \return cos(x)*32767. */
69 SPAN_DECLARE(int16_t) fixed_cos(uint16_t x);
70 
71 /*! Evaluate an approximate 16 bit fixed point sine.
72  \brief Evaluate an approximate 16 bit fixed point sine.
73  \param y .
74  \param x .
75  \return The 16 bit unsigned angle, in 360/65536 degree steps. */
76 SPAN_DECLARE(uint16_t) fixed_atan2(int16_t y, int16_t x);
77 
78 #if defined(__cplusplus)
79 }
80 #endif
81 
82 #endif
83 /*- End of file ------------------------------------------------------------*/
lpc10_encode_state_s::ipoint
int32_t ipoint
???
Definition: private/lpc10.h:130
lpc10_encode_state_s::zpre
float zpre
???
Definition: private/lpc10.h:76
trie_t
Definition: make_at_dictionary.c:462
lpc10_encode_state_s::l2buf
float l2buf[16]
???
Definition: private/lpc10.h:86
lpc10_encode_state_s::awin
int32_t awin[3][2]
Initial value awin[2][0] = 307; awin[2][1] = 462;.
Definition: private/lpc10.h:68
lpc10_encode_state_s::slbue
int32_t slbue
???
Definition: private/lpc10.h:122
lpc10_encode_state_s::ofbue
int32_t ofbue
???
Definition: private/lpc10.h:116
lpc10_encode_state_s::z12
float z12
???
Definition: private/lpc10.h:44
lpc10_encode_state_s::rcbuf
float rcbuf[3][10]
???
Definition: private/lpc10.h:74
lpc10_encode_state_s::osptr
int32_t osptr
Initial value 1.
Definition: private/lpc10.h:62
lpc10_frame_t::irc
int32_t irc[10]
Definition: lpc10.h:54
lpc10_encode_state_s::alphax
float alphax
???
Definition: private/lpc10.h:132
lpc10_encode_state_s::sfbue
int32_t sfbue
???
Definition: private/lpc10.h:118
lpc10_encode_state_s::lbue
int32_t lbue
???
Definition: private/lpc10.h:110
lpc10_frame_t::ipitch
int32_t ipitch
Definition: lpc10.h:50
lpc10_decode_state_s
Definition: private/lpc10.h:144
lpc10_encode_state_s::dither
float dither
Initial value 20.0f.
Definition: private/lpc10.h:100
lpc10_encode_state_s
Definition: private/lpc10.h:34
lpc10_encode_state_s::n
float n
???
Definition: private/lpc10.h:80
lpc10_encode_state_s::z11
float z11
???
Definition: private/lpc10.h:40
lpc10_encode_state_s::z21
float z21
???
Definition: private/lpc10.h:42
awgn_state_s
Definition: private/awgn.h:33
lpc10_encode_state_s::p
int32_t p[2][60]
???
Definition: private/lpc10.h:128
trie_node_s
Definition: make_at_dictionary.c:452
lpc10_encode_state_s::vwin
int32_t vwin[3][2]
Initial value vwin[2][0] = 307; vwin[2][1] = 462;.
Definition: private/lpc10.h:66
complex_t::im
double im
Imaginary part.
Definition: complex.h:58
fixed_cos
int16_t fixed_cos(uint16_t x)
Evaluate an approximate 16 bit fixed point cosine.
Definition: math_fixed.c:188
lpc10_frame_t
Definition: lpc10.h:48
lpc10_encode_state_s::olbue
int32_t olbue
???
Definition: private/lpc10.h:120
complex.h
lpc10_encode_state_s::error_correction
int error_correction
???
Definition: private/lpc10.h:36
lpc10_encode_state_s::fbve
int32_t fbve
???
Definition: private/lpc10.h:112
lpc10_encode_state_s::rmsbuf
float rmsbuf[3]
???
Definition: private/lpc10.h:72
lpc10_encode_state_s::fbue
int32_t fbue
???
Definition: private/lpc10.h:114
css_c1
const int css_c1[]
Definition: g168models.h:263
lpc10_encode_state_s::pebuf
float pebuf[LPC10_SAMPLES_PER_FRAME *3]
???
Definition: private/lpc10.h:52
bit_operations.h
lpc10_encode_state_s::lbve
int32_t lbve
???
Definition: private/lpc10.h:108
lpc10_encode_state_s::bias
float bias
???
Definition: private/lpc10.h:58
lpc10_encode_state_s::snr
float snr
???
Definition: private/lpc10.h:102
lpc10_encode_state_s::l2sum1
float l2sum1
???
Definition: private/lpc10.h:88
dc_restore.h
g168models.h
lpc10_encode_state_s::ivbuf
float ivbuf[312]
???
Definition: private/lpc10.h:56
lpc10_encode_state_s::isync
int32_t isync
???
Definition: private/lpc10.h:136
spandsp-sim.h
lpc10_encode_state_s::hyst
int hyst
Initial value FALSE.
Definition: private/lpc10.h:96
lpc10_encode_state_s::s
float s[60]
???
Definition: private/lpc10.h:126
css_c3
const int css_c3[]
Definition: g168models.h:287
lpc10_encode_state_s::obound
int32_t obound[3]
???
Definition: private/lpc10.h:64
lpc10_encode_state_s::l2ptr1
int32_t l2ptr1
Initial value 1.
Definition: private/lpc10.h:90
lpc10_encode_state_s::z22
float z22
???
Definition: private/lpc10.h:46
complex_t
Definition: complex.h:54
lpc10_encode_state_s::lpbuf
float lpbuf[696]
???
Definition: private/lpc10.h:54
lpc10_frame_t::irms
int32_t irms
Definition: lpc10.h:52
lpc10_encode_state_s::voice
float voice[3][2]
Initial value is probably unnecessary.
Definition: private/lpc10.h:106
lpc10_encode_state_s::inbuf
float inbuf[LPC10_SAMPLES_PER_FRAME *3]
???
Definition: private/lpc10.h:50
complex_t::re
double re
Real part.
Definition: complex.h:56
lpc10_encode_state_s::d__
float d__
Initial value 1.0f.
Definition: private/lpc10.h:82
fixed_sin
int16_t fixed_sin(uint16_t x)
Evaluate an approximate 16 bit fixed point sine.
Definition: math_fixed.c:163
lpc10_encode_state_s::l2ptr2
int32_t l2ptr2
Initial value 9.
Definition: private/lpc10.h:92
lpc10_encode_state_s::maxmin
float maxmin
???
Definition: private/lpc10.h:104
lpc10_encode_state_s::voibuf
int32_t voibuf[4][2]
???
Definition: private/lpc10.h:70
fixed_atan2
uint16_t fixed_atan2(int16_t y, int16_t x)
Evaluate an approximate 16 bit fixed point sine.
Definition: math_fixed.c:214