Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
4cf0ff9a
提交
4cf0ff9a
authored
11月 17, 2016
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-9742
上级
a3a39f33
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
75 行增加
和
24 行删除
+75
-24
conference_video.c
src/mod/applications/mod_conference/conference_video.c
+52
-19
mod_conference.h
src/mod/applications/mod_conference/mod_conference.h
+1
-0
mod_cv.cpp
src/mod/applications/mod_cv/mod_cv.cpp
+22
-5
没有找到文件。
src/mod/applications/mod_conference/conference_video.c
浏览文件 @
4cf0ff9a
...
...
@@ -365,6 +365,33 @@ void conference_video_reset_layer(mcu_layer_t *layer)
switch_img_free
(
&
layer
->
cur_img
);
}
static
void
set_pan
(
mcu_layer_t
*
layer
,
int
crop_point
,
int
max_width
)
{
if
(
layer
->
crop_point
<=
0
||
layer
->
crop_point
>
max_width
)
{
layer
->
crop_point
=
crop_point
;
}
else
if
(
crop_point
>
layer
->
crop_point
)
{
if
(
crop_point
-
layer
->
crop_point
>
25
)
{
layer
->
crop_point
+=
5
;
}
else
{
layer
->
crop_point
++
;
}
if
(
crop_point
<
layer
->
crop_point
)
{
layer
->
crop_point
=
crop_point
;
}
}
else
if
(
crop_point
<
layer
->
crop_point
)
{
if
(
layer
->
crop_point
-
crop_point
>
25
)
{
layer
->
crop_point
-=
5
;
}
else
{
layer
->
crop_point
--
;
}
if
(
crop_point
>
layer
->
crop_point
)
{
layer
->
crop_point
=
crop_point
;
}
}
}
void
conference_video_scale_and_patch
(
mcu_layer_t
*
layer
,
switch_image_t
*
ximg
,
switch_bool_t
freeze
)
{
switch_image_t
*
IMG
,
*
img
;
...
...
@@ -421,7 +448,7 @@ void conference_video_scale_and_patch(mcu_layer_t *layer, switch_image_t *ximg,
if
(
layer
->
last_img_addr
!=
img_addr
&&
layer
->
geometry
.
zoom
)
{
uint32_t
new_w
=
0
,
new_h
=
0
;
int
crop
size
=
0
;
int
crop
_point
=
0
;
double
scale
=
1
;
if
(
screen_aspect
<
img_aspect
)
{
...
...
@@ -434,19 +461,23 @@ void conference_video_scale_and_patch(mcu_layer_t *layer, switch_image_t *ximg,
new_h
=
(
uint32_t
)((
double
)
layer
->
screen_h
/
scale
);
if
(
layer
->
bug_frame
.
geometry
.
w
)
{
cropsize
=
layer
->
bug_frame
.
geometry
.
x
-
(
new_w
/
2
);
//new_w = layer->bug_frame.geometry.w * 2;
//new_h = new_w / screen_aspect;
crop_point
=
switch_round_to_step
(
layer
->
bug_frame
.
geometry
.
x
-
(
new_w
/
2
),
25
);
}
else
{
crop
size
=
(
img
->
d_w
-
new_w
)
/
2
;
crop
_point
=
(
img
->
d_w
-
new_w
)
/
2
;
}
if
(
crop
size
<
1
)
{
crop
size
=
1
;
}
else
if
(
crop
size
>
img
->
d_w
-
new_w
)
{
crop
size
=
img
->
d_w
-
new_w
;
if
(
crop
_point
<
1
)
{
crop
_point
=
1
;
}
else
if
(
crop
_point
>
img
->
d_w
-
new_w
)
{
crop
_point
=
img
->
d_w
-
new_w
;
}
if
(
cropsize
>
0
)
{
switch_img_set_rect
(
img
,
cropsize
,
0
,
new_w
,
new_h
);
set_pan
(
layer
,
crop_point
,
img
->
d_w
-
new_w
);
if
(
layer
->
crop_point
>
0
)
{
switch_img_set_rect
(
img
,
layer
->
crop_point
,
0
,
new_w
,
new_h
);
img_aspect
=
(
double
)
img
->
d_w
/
img
->
d_h
;
}
...
...
@@ -460,20 +491,22 @@ void conference_video_scale_and_patch(mcu_layer_t *layer, switch_image_t *ximg,
new_w
=
(
uint32_t
)((
double
)
layer
->
screen_w
/
scale
);
new_h
=
(
uint32_t
)((
double
)
layer
->
screen_h
/
scale
);
if
(
layer
->
bug_frame
.
geometry
.
y
)
{
crop
size
=
layer
->
bug_frame
.
geometry
.
y
-
(
new_h
/
2
);
if
(
layer
->
bug_frame
.
geometry
.
w
)
{
crop
_point
=
layer
->
bug_frame
.
geometry
.
y
-
(
new_h
/
2
);
}
else
{
crop
size
=
(
img
->
d_h
-
new_h
)
/
2
;
crop
_point
=
(
img
->
d_h
-
new_h
)
/
2
;
}
if
(
crop
size
<
1
)
{
crop
size
=
1
;
}
else
if
(
crop
size
>
img
->
d_h
-
new_h
)
{
crop
size
=
img
->
d_h
-
new_h
;
if
(
crop
_point
<
1
)
{
crop
_point
=
1
;
}
else
if
(
crop
_point
>
img
->
d_h
-
new_h
)
{
crop
_point
=
img
->
d_h
-
new_h
;
}
if
(
cropsize
>
0
)
{
switch_img_set_rect
(
img
,
0
,
cropsize
,
(
unsigned
int
)(
layer
->
screen_w
/
scale
),
(
unsigned
int
)(
layer
->
screen_h
/
scale
));
set_pan
(
layer
,
crop_point
,
img
->
d_h
-
new_h
);
if
(
crop_point
>
0
)
{
switch_img_set_rect
(
img
,
0
,
crop_point
,
(
unsigned
int
)(
layer
->
screen_w
/
scale
),
(
unsigned
int
)(
layer
->
screen_h
/
scale
));
img_aspect
=
(
double
)
img
->
d_w
/
img
->
d_h
;
}
}
...
...
src/mod/applications/mod_conference/mod_conference.h
浏览文件 @
4cf0ff9a
...
...
@@ -446,6 +446,7 @@ typedef struct mcu_layer_s {
int
refresh
;
int
clear
;
int
is_avatar
;
int
crop_point
;
switch_size_t
last_img_addr
;
switch_img_position_t
logo_pos
;
switch_image_t
*
img
;
...
...
src/mod/applications/mod_cv/mod_cv.cpp
浏览文件 @
4cf0ff9a
...
...
@@ -693,7 +693,6 @@ void detectAndDraw(cv_context_t *context)
switch_mutex_unlock
(
context
->
mutex
);
}
static
switch_status_t
video_thread_callback
(
switch_core_session_t
*
session
,
switch_frame_t
*
frame
,
void
*
user_data
)
{
cv_context_t
*
context
=
(
cv_context_t
*
)
user_data
;
...
...
@@ -730,10 +729,27 @@ static switch_status_t video_thread_callback(switch_core_session_t *session, swi
switch_img_to_raw
(
frame
->
img
,
context
->
rawImage
->
imageData
,
context
->
rawImage
->
widthStep
,
SWITCH_IMG_FMT_RGB24
);
detectAndDraw
(
context
);
if
(
context
->
detect_event
&&
context
->
shape_idx
&&
abs
(
context
->
shape
[
0
].
cx
-
context
->
last_shape
[
0
].
cx
)
>
200
||
abs
(
context
->
shape
[
0
].
w
-
context
->
last_shape
[
0
].
w
)
>
200
)
{
context
->
detected
.
simo_count
=
0
;
context
->
detected
.
simo_miss_count
=
context
->
confidence_level
;
if
(
context
->
shape_idx
&&
context
->
shape
[
0
].
w
&&
context
->
last_shape
[
0
].
w
)
{
int
max
,
min
;
int
pct
;
if
(
context
->
shape
[
0
].
w
>
context
->
last_shape
[
0
].
w
)
{
max
=
context
->
shape
[
0
].
w
;
min
=
context
->
last_shape
[
0
].
w
;
}
else
{
max
=
context
->
last_shape
[
0
].
w
;
min
=
context
->
shape
[
0
].
w
;
}
pct
=
100
-
(((
double
)
min
/
(
double
)
max
)
*
100.0
f
);
if
(
pct
>
25
)
{
context
->
detected
.
simo_count
=
0
;
memset
(
context
->
last_shape
,
0
,
sizeof
(
context
->
last_shape
[
0
])
*
MAX_SHAPES
);
if
(
context
->
detect_event
)
{
context
->
detected
.
simo_miss_count
=
context
->
confidence_level
;
}
}
}
if
(
context
->
detected
.
simo_count
>
context
->
confidence_level
)
{
...
...
@@ -772,6 +788,7 @@ static switch_status_t video_thread_callback(switch_core_session_t *session, swi
memset
(
context
->
shape
,
0
,
sizeof
(
context
->
shape
[
0
])
*
MAX_SHAPES
);
memset
(
context
->
last_shape
,
0
,
sizeof
(
context
->
last_shape
[
0
])
*
MAX_SHAPES
);
switch_channel_execute_on
(
channel
,
"execute_on_cv_detect_off_primary"
);
reset_stats
(
&
context
->
nestDetected
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论