Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
3b8bc35b
提交
3b8bc35b
authored
7月 22, 2014
作者:
Steve Underwood
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
More fixes for Coverity issues
上级
fb6ecb4c
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
53 行增加
和
26 行删除
+53
-26
super_tone_tx.h
libs/spandsp/src/spandsp/private/super_tone_tx.h
+5
-5
super_tone_tx.h
libs/spandsp/src/spandsp/super_tone_tx.h
+3
-0
vector_int.h
libs/spandsp/src/spandsp/vector_int.h
+18
-0
super_tone_tx.c
libs/spandsp/src/super_tone_tx.c
+11
-6
time_scale.c
libs/spandsp/src/time_scale.c
+15
-14
t81_t82_arith_coding_tests.c
libs/spandsp/tests/t81_t82_arith_coding_tests.c
+1
-1
没有找到文件。
libs/spandsp/src/spandsp/private/super_tone_tx.h
浏览文件 @
3b8bc35b
...
...
@@ -28,7 +28,7 @@
struct
super_tone_tx_step_s
{
tone_gen_tone_descriptor_t
tone
[
4
];
tone_gen_tone_descriptor_t
tone
[
SUPER_TONE_TX_MAX_TONES
];
int
tone_on
;
int
length
;
int
cycles
;
...
...
@@ -38,12 +38,12 @@ struct super_tone_tx_step_s
struct
super_tone_tx_state_s
{
tone_gen_tone_descriptor_t
tone
[
4
];
uint32_t
phase
[
4
];
tone_gen_tone_descriptor_t
tone
[
SUPER_TONE_TX_MAX_TONES
];
uint32_t
phase
[
SUPER_TONE_TX_MAX_TONES
];
int
current_position
;
int
level
;
super_tone_tx_step_t
*
levels
[
4
];
int
cycles
[
4
];
super_tone_tx_step_t
*
levels
[
SUPER_TONE_TX_MAX_LEVELS
];
int
cycles
[
SUPER_TONE_TX_MAX_LEVELS
];
};
#endif
...
...
libs/spandsp/src/spandsp/super_tone_tx.h
浏览文件 @
3b8bc35b
...
...
@@ -39,6 +39,9 @@ complex cadence patterns.
*/
#define SUPER_TONE_TX_MAX_LEVELS 4
#define SUPER_TONE_TX_MAX_TONES 4
typedef
struct
super_tone_tx_step_s
super_tone_tx_step_t
;
typedef
struct
super_tone_tx_state_s
super_tone_tx_state_t
;
...
...
libs/spandsp/src/spandsp/vector_int.h
浏览文件 @
3b8bc35b
...
...
@@ -49,6 +49,24 @@ static __inline__ void vec_copyi32(int32_t z[], const int32_t x[], int n)
}
/*- End of function --------------------------------------------------------*/
static
__inline__
void
vec_movei
(
int
z
[],
const
int
x
[],
int
n
)
{
memmove
(
z
,
x
,
n
*
sizeof
(
z
[
0
]));
}
/*- End of function --------------------------------------------------------*/
static
__inline__
void
vec_movei16
(
int16_t
z
[],
const
int16_t
x
[],
int
n
)
{
memmove
(
z
,
x
,
n
*
sizeof
(
z
[
0
]));
}
/*- End of function --------------------------------------------------------*/
static
__inline__
void
vec_movei32
(
int32_t
z
[],
const
int32_t
x
[],
int
n
)
{
memmove
(
z
,
x
,
n
*
sizeof
(
z
[
0
]));
}
/*- End of function --------------------------------------------------------*/
static
__inline__
void
vec_zeroi
(
int
z
[],
int
n
)
{
memset
(
z
,
0
,
n
*
sizeof
(
z
[
0
]));
...
...
libs/spandsp/src/super_tone_tx.c
浏览文件 @
3b8bc35b
...
...
@@ -170,7 +170,7 @@ SPAN_DECLARE(int) super_tone_tx(super_tone_tx_state_t *s, int16_t amp[], int max
float
xamp
;
super_tone_tx_step_t
*
tree
;
if
(
s
->
level
<
0
||
s
->
level
>
3
)
if
(
s
->
level
<
0
||
s
->
level
>
=
SUPER_TONE_TX_MAX_LEVELS
)
return
0
;
samples
=
0
;
tree
=
s
->
levels
[
s
->
level
];
...
...
@@ -182,7 +182,7 @@ SPAN_DECLARE(int) super_tone_tx(super_tone_tx_state_t *s, int16_t amp[], int max
if
(
s
->
current_position
==
0
)
{
/* New step - prepare the tone generator */
for
(
i
=
0
;
i
<
4
;
i
++
)
for
(
i
=
0
;
i
<
SUPER_TONE_TX_MAX_TONES
;
i
++
)
s
->
tone
[
i
]
=
tree
->
tone
[
i
];
}
len
=
tree
->
length
-
s
->
current_position
;
...
...
@@ -216,7 +216,7 @@ SPAN_DECLARE(int) super_tone_tx(super_tone_tx_state_t *s, int16_t amp[], int max
for
(
limit
=
len
+
samples
;
samples
<
limit
;
samples
++
)
{
xamp
=
0
.
0
f
;
for
(
i
=
0
;
i
<
4
;
i
++
)
for
(
i
=
0
;
i
<
SUPER_TONE_TX_MAX_TONES
;
i
++
)
{
if
(
s
->
tone
[
i
].
phase_rate
==
0
)
break
;
...
...
@@ -251,9 +251,14 @@ SPAN_DECLARE(int) super_tone_tx(super_tone_tx_state_t *s, int16_t amp[], int max
/* Nesting has priority... */
if
(
tree
->
nest
)
{
tree
=
tree
->
nest
;
s
->
levels
[
++
s
->
level
]
=
tree
;
s
->
cycles
[
s
->
level
]
=
tree
->
cycles
;
if
(
s
->
level
<
SUPER_TONE_TX_MAX_LEVELS
-
1
)
{
/* TODO: We have stopped an over-range value being used, but we really
ought to deal with the condition properly. */
tree
=
tree
->
nest
;
s
->
levels
[
++
s
->
level
]
=
tree
;
s
->
cycles
[
s
->
level
]
=
tree
->
cycles
;
}
}
else
{
...
...
libs/spandsp/src/time_scale.c
浏览文件 @
3b8bc35b
...
...
@@ -52,8 +52,9 @@
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/
time_scale
.h"
#include "spandsp/
vector_int
.h"
#include "spandsp/saturated.h"
#include "spandsp/time_scale.h"
#include "spandsp/private/time_scale.h"
...
...
@@ -190,46 +191,46 @@ SPAN_DECLARE(int) time_scale(time_scale_state_t *s, int16_t out[], int16_t in[],
if
(
s
->
fill
+
len
<
s
->
buf_len
)
{
/* Cannot continue without more samples */
memcpy
(
&
s
->
buf
[
s
->
fill
],
in
,
sizeof
(
int16_t
)
*
len
);
vec_copyi16
(
&
s
->
buf
[
s
->
fill
],
in
,
len
);
s
->
fill
+=
len
;
return
out_len
;
}
k
=
s
->
buf_len
-
s
->
fill
;
memcpy
(
&
s
->
buf
[
s
->
fill
],
in
,
sizeof
(
int16_t
)
*
k
);
vec_copyi16
(
&
s
->
buf
[
s
->
fill
],
in
,
k
);
in_len
+=
k
;
s
->
fill
=
s
->
buf_len
;
while
(
s
->
fill
==
s
->
buf_len
)
{
while
(
s
->
lcp
>=
s
->
buf_len
)
{
memcpy
(
&
out
[
out_len
],
s
->
buf
,
sizeof
(
int16_t
)
*
s
->
buf_len
);
vec_copyi16
(
&
out
[
out_len
],
s
->
buf
,
s
->
buf_len
);
out_len
+=
s
->
buf_len
;
if
(
len
-
in_len
<
s
->
buf_len
)
{
/* Cannot continue without more samples */
memcpy
(
s
->
buf
,
&
in
[
in_len
],
sizeof
(
int16_t
)
*
(
len
-
in_len
)
);
vec_copyi16
(
s
->
buf
,
&
in
[
in_len
],
len
-
in_len
);
s
->
fill
=
len
-
in_len
;
s
->
lcp
-=
s
->
buf_len
;
return
out_len
;
}
memcpy
(
s
->
buf
,
&
in
[
in_len
],
sizeof
(
int16_t
)
*
s
->
buf_len
);
vec_copyi16
(
s
->
buf
,
&
in
[
in_len
],
s
->
buf_len
);
in_len
+=
s
->
buf_len
;
s
->
lcp
-=
s
->
buf_len
;
}
if
(
s
->
lcp
>
0
)
{
memcpy
(
&
out
[
out_len
],
s
->
buf
,
sizeof
(
int16_t
)
*
s
->
lcp
);
vec_copyi16
(
&
out
[
out_len
],
s
->
buf
,
s
->
lcp
);
out_len
+=
s
->
lcp
;
memmove
(
s
->
buf
,
&
s
->
buf
[
s
->
lcp
],
sizeof
(
int16_t
)
*
(
s
->
buf_len
-
s
->
lcp
)
);
vec_movei16
(
s
->
buf
,
&
s
->
buf
[
s
->
lcp
],
s
->
buf_len
-
s
->
lcp
);
if
(
len
-
in_len
<
s
->
lcp
)
{
/* Cannot continue without more samples */
memcpy
(
&
s
->
buf
[
s
->
buf_len
-
s
->
lcp
],
&
in
[
in_len
],
sizeof
(
int16_t
)
*
(
len
-
in_len
)
);
vec_copyi16
(
&
s
->
buf
[
s
->
buf_len
-
s
->
lcp
],
&
in
[
in_len
],
len
-
in_len
);
s
->
fill
=
s
->
buf_len
-
s
->
lcp
+
len
-
in_len
;
s
->
lcp
=
0
;
return
out_len
;
}
memcpy
(
&
s
->
buf
[
s
->
buf_len
-
s
->
lcp
],
&
in
[
in_len
],
sizeof
(
int16_t
)
*
s
->
lcp
);
vec_copyi16
(
&
s
->
buf
[
s
->
buf_len
-
s
->
lcp
],
&
in
[
in_len
],
s
->
lcp
);
in_len
+=
s
->
lcp
;
s
->
lcp
=
0
;
}
...
...
@@ -259,21 +260,21 @@ SPAN_DECLARE(int) time_scale(time_scale_state_t *s, int16_t out[], int16_t in[],
{
/* Speed up - drop a chunk of data */
overlap_add
(
s
->
buf
,
&
s
->
buf
[
pitch
],
pitch
);
memcpy
(
&
s
->
buf
[
pitch
],
&
s
->
buf
[
2
*
pitch
],
sizeof
(
int16_t
)
*
(
s
->
buf_len
-
2
*
pitch
)
);
vec_copyi16
(
&
s
->
buf
[
pitch
],
&
s
->
buf
[
2
*
pitch
],
s
->
buf_len
-
2
*
pitch
);
if
(
len
-
in_len
<
pitch
)
{
/* Cannot continue without more samples */
memcpy
(
&
s
->
buf
[
s
->
buf_len
-
pitch
],
&
in
[
in_len
],
sizeof
(
int16_t
)
*
(
len
-
in_len
)
);
vec_copyi16
(
&
s
->
buf
[
s
->
buf_len
-
pitch
],
&
in
[
in_len
],
len
-
in_len
);
s
->
fill
+=
(
len
-
in_len
-
pitch
);
return
out_len
;
}
memcpy
(
&
s
->
buf
[
s
->
buf_len
-
pitch
],
&
in
[
in_len
],
sizeof
(
int16_t
)
*
pitch
);
vec_copyi16
(
&
s
->
buf
[
s
->
buf_len
-
pitch
],
&
in
[
in_len
],
pitch
);
in_len
+=
pitch
;
}
else
{
/* Slow down - insert a chunk of data */
memcpy
(
&
out
[
out_len
],
s
->
buf
,
sizeof
(
int16_t
)
*
pitch
);
vec_copyi16
(
&
out
[
out_len
],
s
->
buf
,
pitch
);
out_len
+=
pitch
;
overlap_add
(
&
s
->
buf
[
pitch
],
s
->
buf
,
pitch
);
}
...
...
libs/spandsp/tests/t81_t82_arith_coding_tests.c
浏览文件 @
3b8bc35b
...
...
@@ -226,7 +226,7 @@ int main(int argc, char *argv[])
}
printf
(
"Test passed
\n
"
);
t81_t82_arith_encode_free
(
se
);
t81_t82_arith_
en
code_free
(
sd
);
t81_t82_arith_
de
code_free
(
sd
);
printf
(
"Tests passed
\n
"
);
return
0
;
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论