Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
7f12385b
提交
7f12385b
authored
9月 30, 2015
作者:
Mike Jerris
提交者:
William King
9月 30, 2015
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-8236: fix ifdefs for building without libyuv
上级
1d82705d
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
12 行增加
和
6 行删除
+12
-6
switch_core_video.c
src/switch_core_video.c
+12
-6
没有找到文件。
src/switch_core_video.c
浏览文件 @
7f12385b
...
...
@@ -48,7 +48,9 @@
#include <gd.h>
#endif
#ifdef SWITCH_HAVE_YUV
static
inline
void
switch_img_get_yuv_pixel
(
switch_image_t
*
img
,
switch_yuv_color_t
*
yuv
,
int
x
,
int
y
);
#endif
static
inline
void
switch_img_get_rgb_pixel
(
switch_image_t
*
img
,
switch_rgb_color_t
*
rgb
,
int
x
,
int
y
);
...
...
@@ -58,14 +60,18 @@ static inline void switch_img_get_rgb_pixel(switch_image_t *img, switch_rgb_colo
* \param[in] rgb RGB color pointer
* \param[out] yuv YUV color pointer
*/
#ifdef SWITCH_HAVE_YUV
static
inline
void
switch_color_rgb2yuv
(
switch_rgb_color_t
*
rgb
,
switch_yuv_color_t
*
yuv
);
#endif
/*!\brief Convert YUV color to RGB
*
* \param[in] yuv YUV color pointer
* \param[out] rgb RGB color pointer
*/
#ifdef SWITCH_HAVE_YUV
static
inline
void
switch_color_yuv2rgb
(
switch_yuv_color_t
*
yuv
,
switch_rgb_color_t
*
rgb
);
#endif
/*!\brief Draw a pixel on an image
*
...
...
@@ -542,17 +548,17 @@ SWITCH_DECLARE(void) switch_img_fill(switch_image_t *img, int x, int y, int w, i
#endif
}
#ifdef SWITCH_HAVE_YUV
static
inline
void
switch_img_get_yuv_pixel
(
switch_image_t
*
img
,
switch_yuv_color_t
*
yuv
,
int
x
,
int
y
)
{
#ifdef SWITCH_HAVE_YUV
// switch_assert(img->fmt == SWITCH_IMG_FMT_I420);
if
(
x
<
0
||
y
<
0
||
x
>=
img
->
d_w
||
y
>=
img
->
d_h
)
return
;
yuv
->
y
=
*
(
img
->
planes
[
SWITCH_PLANE_Y
]
+
img
->
stride
[
SWITCH_PLANE_Y
]
*
y
+
x
);
yuv
->
u
=
*
(
img
->
planes
[
SWITCH_PLANE_U
]
+
img
->
stride
[
SWITCH_PLANE_U
]
*
y
/
2
+
x
/
2
);
yuv
->
v
=
*
(
img
->
planes
[
SWITCH_PLANE_V
]
+
img
->
stride
[
SWITCH_PLANE_V
]
*
y
/
2
+
x
/
2
);
#endif
}
#endif
static
inline
void
switch_img_get_rgb_pixel
(
switch_image_t
*
img
,
switch_rgb_color_t
*
rgb
,
int
x
,
int
y
)
{
...
...
@@ -699,20 +705,20 @@ SWITCH_DECLARE(void) switch_color_set_rgb(switch_rgb_color_t *color, const char
}
}
#ifdef SWITCH_HAVE_YUV
static
inline
void
switch_color_rgb2yuv
(
switch_rgb_color_t
*
rgb
,
switch_yuv_color_t
*
yuv
)
{
#ifdef SWITCH_HAVE_YUV
yuv
->
y
=
(
uint8_t
)(((
rgb
->
r
*
4897
)
>>
14
)
+
((
rgb
->
g
*
9611
)
>>
14
)
+
((
rgb
->
b
*
1876
)
>>
14
));
yuv
->
u
=
(
uint8_t
)(
-
((
rgb
->
r
*
2766
)
>>
14
)
-
((
5426
*
rgb
->
g
)
>>
14
)
+
rgb
->
b
/
2
+
128
);
yuv
->
v
=
(
uint8_t
)(
rgb
->
r
/
2
-
((
6855
*
rgb
->
g
)
>>
14
)
-
((
rgb
->
b
*
1337
)
>>
14
)
+
128
);
#endif
}
#endif
#define CLAMP(val) MAX(0, MIN(val, 255))
#ifdef SWITCH_HAVE_YUV
static
inline
void
switch_color_yuv2rgb
(
switch_yuv_color_t
*
yuv
,
switch_rgb_color_t
*
rgb
)
{
#ifdef SWITCH_HAVE_YUV
#if 0
int C = yuv->y - 16;
int D = yuv->u - 128;
...
...
@@ -727,8 +733,8 @@ static inline void switch_color_yuv2rgb(switch_yuv_color_t *yuv, switch_rgb_colo
rgb
->
r
=
CLAMP
(
yuv
->
y
+
((
22457
*
(
yuv
->
v
-
128
))
>>
14
));
rgb
->
g
=
CLAMP
((
yuv
->
y
-
((
715
*
(
yuv
->
v
-
128
))
>>
10
)
-
((
5532
*
(
yuv
->
u
-
128
))
>>
14
)));
rgb
->
b
=
CLAMP
((
yuv
->
y
+
((
28384
*
(
yuv
->
u
-
128
))
>>
14
)));
#endif
}
#endif
SWITCH_DECLARE
(
void
)
switch_color_set_yuv
(
switch_yuv_color_t
*
color
,
const
char
*
str
)
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论