Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
c6596b1b
提交
c6596b1b
authored
7月 30, 2015
作者:
Mike Jerris
提交者:
Michael Jerris
7月 30, 2015
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
attempt to optimize patch function
上级
06758f6f
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
34 行增加
和
29 行删除
+34
-29
switch_core_video.h
src/include/switch_core_video.h
+0
-18
switch_core_video.c
src/switch_core_video.c
+34
-11
没有找到文件。
src/include/switch_core_video.h
浏览文件 @
c6596b1b
...
@@ -285,20 +285,6 @@ SWITCH_DECLARE(void) switch_color_set_rgb(switch_rgb_color_t *color, const char
...
@@ -285,20 +285,6 @@ SWITCH_DECLARE(void) switch_color_set_rgb(switch_rgb_color_t *color, const char
*/
*/
SWITCH_DECLARE
(
void
)
switch_color_set_yuv
(
switch_yuv_color_t
*
color
,
const
char
*
color_str
);
SWITCH_DECLARE
(
void
)
switch_color_set_yuv
(
switch_yuv_color_t
*
color
,
const
char
*
color_str
);
/*!\brief Convert RGB color to YUV
*
* \param[in] rgb RGB color pointer
* \param[out] yuv YUV color pointer
*/
SWITCH_DECLARE
(
void
)
switch_color_rgb2yuv
(
switch_rgb_color_t
*
rgb
,
switch_yuv_color_t
*
yuv
);
/*!\brief Convert YUV color to RGB
*
* \param[in] yuv YUV color pointer
* \param[out] rgb RGB color pointer
*/
SWITCH_DECLARE
(
void
)
switch_color_yuv2rgb
(
switch_yuv_color_t
*
yuv
,
switch_rgb_color_t
*
rgb
);
/*!\brief Created a text handle
/*!\brief Created a text handle
*
*
* \param[out] handleP Pointer to the text handle pointer
* \param[out] handleP Pointer to the text handle pointer
...
@@ -345,10 +331,6 @@ SWITCH_DECLARE(switch_status_t) switch_img_write_png(switch_image_t *img, char *
...
@@ -345,10 +331,6 @@ SWITCH_DECLARE(switch_status_t) switch_img_write_png(switch_image_t *img, char *
SWITCH_DECLARE
(
switch_status_t
)
switch_png_open
(
switch_png_t
**
pngP
,
const
char
*
file_name
);
SWITCH_DECLARE
(
switch_status_t
)
switch_png_open
(
switch_png_t
**
pngP
,
const
char
*
file_name
);
SWITCH_DECLARE
(
void
)
switch_png_free
(
switch_png_t
**
pngP
);
SWITCH_DECLARE
(
void
)
switch_png_free
(
switch_png_t
**
pngP
);
SWITCH_DECLARE
(
void
)
switch_img_get_yuv_pixel
(
switch_image_t
*
img
,
switch_yuv_color_t
*
yuv
,
int
x
,
int
y
);
SWITCH_DECLARE
(
void
)
switch_img_get_rgb_pixel
(
switch_image_t
*
img
,
switch_rgb_color_t
*
rgb
,
int
x
,
int
y
);
/*!\brief put a small img over a big IMG at position x,y, with alpha transparency
/*!\brief put a small img over a big IMG at position x,y, with alpha transparency
*
*
* Both IMG and img must be non-NULL
* Both IMG and img must be non-NULL
...
...
src/switch_core_video.c
浏览文件 @
c6596b1b
...
@@ -48,6 +48,25 @@
...
@@ -48,6 +48,25 @@
#include <gd.h>
#include <gd.h>
#endif
#endif
static
inline
void
switch_img_get_yuv_pixel
(
switch_image_t
*
img
,
switch_yuv_color_t
*
yuv
,
int
x
,
int
y
);
static
inline
void
switch_img_get_rgb_pixel
(
switch_image_t
*
img
,
switch_rgb_color_t
*
rgb
,
int
x
,
int
y
);
/*!\brief Convert RGB color to YUV
*
* \param[in] rgb RGB color pointer
* \param[out] yuv YUV color pointer
*/
static
inline
void
switch_color_rgb2yuv
(
switch_rgb_color_t
*
rgb
,
switch_yuv_color_t
*
yuv
);
/*!\brief Convert YUV color to RGB
*
* \param[in] yuv YUV color pointer
* \param[out] rgb RGB color pointer
*/
static
inline
void
switch_color_yuv2rgb
(
switch_yuv_color_t
*
yuv
,
switch_rgb_color_t
*
rgb
);
struct
pos_el
{
struct
pos_el
{
switch_img_position_t
pos
;
switch_img_position_t
pos
;
const
char
*
name
;
const
char
*
name
;
...
@@ -249,12 +268,16 @@ SWITCH_DECLARE(void) switch_img_patch(switch_image_t *IMG, switch_image_t *img,
...
@@ -249,12 +268,16 @@ SWITCH_DECLARE(void) switch_img_patch(switch_image_t *IMG, switch_image_t *img,
switch_img_get_rgb_pixel
(
IMG
,
&
RGB
,
x
+
j
,
y
+
i
);
switch_img_get_rgb_pixel
(
IMG
,
&
RGB
,
x
+
j
,
y
+
i
);
rgb
=
(
switch_rgb_color_t
*
)(
img
->
planes
[
SWITCH_PLANE_PACKED
]
+
i
*
img
->
stride
[
SWITCH_PLANE_PACKED
]
+
j
*
4
);
rgb
=
(
switch_rgb_color_t
*
)(
img
->
planes
[
SWITCH_PLANE_PACKED
]
+
i
*
img
->
stride
[
SWITCH_PLANE_PACKED
]
+
j
*
4
);
RGB
.
a
=
255
;
if
(
alpha
<
255
)
{
RGB
.
r
=
((
RGB
.
r
*
(
255
-
alpha
))
>>
8
)
+
((
rgb
->
r
*
alpha
)
>>
8
);
RGB
.
a
=
255
;
RGB
.
g
=
((
RGB
.
g
*
(
255
-
alpha
))
>>
8
)
+
((
rgb
->
g
*
alpha
)
>>
8
);
RGB
.
r
=
((
RGB
.
r
*
(
255
-
alpha
))
>>
8
)
+
((
rgb
->
r
*
alpha
)
>>
8
);
RGB
.
b
=
((
RGB
.
b
*
(
255
-
alpha
))
>>
8
)
+
((
rgb
->
b
*
alpha
)
>>
8
);
RGB
.
g
=
((
RGB
.
g
*
(
255
-
alpha
))
>>
8
)
+
((
rgb
->
g
*
alpha
)
>>
8
);
RGB
.
b
=
((
RGB
.
b
*
(
255
-
alpha
))
>>
8
)
+
((
rgb
->
b
*
alpha
)
>>
8
);
switch_img_draw_pixel
(
IMG
,
x
+
j
,
y
+
i
,
&
RGB
);
switch_img_draw_pixel
(
IMG
,
x
+
j
,
y
+
i
,
&
RGB
);
}
else
{
switch_img_draw_pixel
(
IMG
,
x
+
j
,
y
+
i
,
rgb
);
}
}
}
}
}
}
}
...
@@ -509,7 +532,7 @@ SWITCH_DECLARE(void) switch_img_fill(switch_image_t *img, int x, int y, int w, i
...
@@ -509,7 +532,7 @@ SWITCH_DECLARE(void) switch_img_fill(switch_image_t *img, int x, int y, int w, i
#endif
#endif
}
}
SWITCH_DECLARE
(
void
)
switch_img_get_yuv_pixel
(
switch_image_t
*
img
,
switch_yuv_color_t
*
yuv
,
int
x
,
int
y
)
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
#ifdef SWITCH_HAVE_YUV
// switch_assert(img->fmt == SWITCH_IMG_FMT_I420);
// switch_assert(img->fmt == SWITCH_IMG_FMT_I420);
...
@@ -521,7 +544,7 @@ SWITCH_DECLARE(void) switch_img_get_yuv_pixel(switch_image_t *img, switch_yuv_co
...
@@ -521,7 +544,7 @@ SWITCH_DECLARE(void) switch_img_get_yuv_pixel(switch_image_t *img, switch_yuv_co
#endif
#endif
}
}
SWITCH_DECLARE
(
void
)
switch_img_get_rgb_pixel
(
switch_image_t
*
img
,
switch_rgb_color_t
*
rgb
,
int
x
,
int
y
)
static
inline
void
switch_img_get_rgb_pixel
(
switch_image_t
*
img
,
switch_rgb_color_t
*
rgb
,
int
x
,
int
y
)
{
{
#ifdef SWITCH_HAVE_YUV
#ifdef SWITCH_HAVE_YUV
if
(
x
<
0
||
y
<
0
||
x
>=
img
->
d_w
||
y
>=
img
->
d_h
)
return
;
if
(
x
<
0
||
y
<
0
||
x
>=
img
->
d_w
||
y
>=
img
->
d_h
)
return
;
...
@@ -544,7 +567,7 @@ SWITCH_DECLARE(void) switch_img_get_rgb_pixel(switch_image_t *img, switch_rgb_co
...
@@ -544,7 +567,7 @@ SWITCH_DECLARE(void) switch_img_get_rgb_pixel(switch_image_t *img, switch_rgb_co
SWITCH_DECLARE
(
void
)
switch_img_overlay
(
switch_image_t
*
IMG
,
switch_image_t
*
img
,
int
x
,
int
y
,
uint8_t
alpha
)
SWITCH_DECLARE
(
void
)
switch_img_overlay
(
switch_image_t
*
IMG
,
switch_image_t
*
img
,
int
x
,
int
y
,
uint8_t
alpha
)
{
{
int
i
,
j
,
len
,
max_h
;
int
i
,
j
,
len
,
max_h
;
switch_rgb_color_t
RGB
,
rgb
,
c
;
switch_rgb_color_t
RGB
=
{
0
},
rgb
=
{
0
}
,
c
;
int
xoff
=
0
,
yoff
=
0
;
int
xoff
=
0
,
yoff
=
0
;
switch_assert
(
IMG
->
fmt
==
SWITCH_IMG_FMT_I420
);
switch_assert
(
IMG
->
fmt
==
SWITCH_IMG_FMT_I420
);
...
@@ -666,7 +689,7 @@ SWITCH_DECLARE(void) switch_color_set_rgb(switch_rgb_color_t *color, const char
...
@@ -666,7 +689,7 @@ SWITCH_DECLARE(void) switch_color_set_rgb(switch_rgb_color_t *color, const char
}
}
}
}
SWITCH_DECLARE
(
void
)
switch_color_rgb2yuv
(
switch_rgb_color_t
*
rgb
,
switch_yuv_color_t
*
yuv
)
static
inline
void
switch_color_rgb2yuv
(
switch_rgb_color_t
*
rgb
,
switch_yuv_color_t
*
yuv
)
{
{
#ifdef SWITCH_HAVE_YUV
#ifdef SWITCH_HAVE_YUV
yuv
->
y
=
(
uint8_t
)(((
rgb
->
r
*
4897
)
>>
14
)
+
((
rgb
->
g
*
9611
)
>>
14
)
+
((
rgb
->
b
*
1876
)
>>
14
));
yuv
->
y
=
(
uint8_t
)(((
rgb
->
r
*
4897
)
>>
14
)
+
((
rgb
->
g
*
9611
)
>>
14
)
+
((
rgb
->
b
*
1876
)
>>
14
));
...
@@ -677,7 +700,7 @@ SWITCH_DECLARE(void) switch_color_rgb2yuv(switch_rgb_color_t *rgb, switch_yuv_co
...
@@ -677,7 +700,7 @@ SWITCH_DECLARE(void) switch_color_rgb2yuv(switch_rgb_color_t *rgb, switch_yuv_co
#define CLAMP(val) MAX(0, MIN(val, 255))
#define CLAMP(val) MAX(0, MIN(val, 255))
SWITCH_DECLARE
(
void
)
switch_color_yuv2rgb
(
switch_yuv_color_t
*
yuv
,
switch_rgb_color_t
*
rgb
)
static
inline
void
switch_color_yuv2rgb
(
switch_yuv_color_t
*
yuv
,
switch_rgb_color_t
*
rgb
)
{
{
#ifdef SWITCH_HAVE_YUV
#ifdef SWITCH_HAVE_YUV
#if 0
#if 0
...
@@ -879,7 +902,7 @@ static void draw_bitmap(switch_img_txt_handle_t *handle, switch_image_t *img, FT
...
@@ -879,7 +902,7 @@ static void draw_bitmap(switch_img_txt_handle_t *handle, switch_image_t *img, FT
if
(
handle
->
use_bgcolor
)
{
if
(
handle
->
use_bgcolor
)
{
switch_img_draw_pixel
(
img
,
i
,
j
,
&
handle
->
gradient_table
[
gradient
*
MAX_GRADIENT
/
256
]);
switch_img_draw_pixel
(
img
,
i
,
j
,
&
handle
->
gradient_table
[
gradient
*
MAX_GRADIENT
/
256
]);
}
else
{
}
else
{
switch_rgb_color_t
rgb_color
;
switch_rgb_color_t
rgb_color
=
{
0
}
;
switch_rgb_color_t
c
;
switch_rgb_color_t
c
;
switch_img_get_rgb_pixel
(
img
,
&
rgb_color
,
i
,
j
);
switch_img_get_rgb_pixel
(
img
,
&
rgb_color
,
i
,
j
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论