Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Libpng
提交
91acd4ba
T
Third Party Libpng
项目概览
OpenHarmony
/
Third Party Libpng
大约 1 年 前同步成功
通知
4
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Libpng
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
91acd4ba
编写于
1月 15, 2017
作者:
V
Vadim Barkov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Implemented png_read_filter_up_vsx
上级
6ff408d4
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
41 addition
and
16 deletion
+41
-16
powerpc/filter_vsx_intrinsics.c
powerpc/filter_vsx_intrinsics.c
+41
-16
未找到文件。
powerpc/filter_vsx_intrinsics.c
浏览文件 @
91acd4ba
...
...
@@ -18,18 +18,20 @@
/* This code requires -maltivec and -mabi=altivec on the command line: */
#if PNG_POWERPC_VSX_IMPLEMENTATION == 1
/* intrinsics code from pngpriv.h */
/* libpng row pointers are not necessarily aligned to any particular boundary,
* however this code will only work with appropriate alignment. arm/arm_init.c
* checks for this (and will not compile unless it is done). This code uses
* variants of png_aligncast to avoid compiler warnings.
*/
#define png_ptr(type,pointer) png_aligncast(type *,pointer)
#define png_ptrc(type,pointer) png_aligncastconst(const type *,pointer)
/*#include <altivec.h>*/
#include <altivec.h>
#if PNG_POWERPC_VSX_OPT > 0
/* Functions in this file look at most 3 pixels (a,b,c) to predict the 4th (d).
* They're positioned like this:
* prev: c b
* row: a d
* The Sub filter predicts d=a, Avg d=(a+b)/2, and Paeth predicts d to be
* whichever of a, b, or c is closest to p=a+b-c.
* ( this is taken from ../intel/filter_sse2_intrinsics.c )
*/
void
png_read_filter_row_up_vsx
(
png_row_infop
row_info
,
png_bytep
row
,
png_const_bytep
prev_row
)
{
...
...
@@ -38,27 +40,50 @@ void png_read_filter_row_up_vsx(png_row_infop row_info, png_bytep row,
png_bytep
rp
=
row
;
png_const_bytep
pp
=
prev_row
;
for
(
i
=
0
;
i
<
istop
;
i
++
)
vector
unsigned
char
rp_vec
;
vector
unsigned
char
pp_vec
;
/* Using SIMD while we can */
while
(
istop
>=
16
)
{
*
rp
=
(
png_byte
)(((
int
)(
*
rp
)
+
(
int
)(
*
pp
++
))
&
0xff
);
rp
++
;
rp_vec
=
vec_ld
(
0
,
rp
);
pp_vec
=
vec_ld
(
0
,
pp
);
rp_vec
=
vec_add
(
rp_vec
,
pp_vec
);
vec_st
(
rp_vec
,
0
,
rp
);
pp
+=
16
;
rp
+=
16
;
istop
-=
16
;
}
if
(
istop
%
16
>
0
)
{
/* If byte count of row is not divisible by 16
* we will process remaining part as usual
*/
for
(
i
=
0
;
i
<
istop
;
i
++
)
{
*
rp
=
(
png_byte
)(((
int
)(
*
rp
)
+
(
int
)(
*
pp
++
))
&
0xff
);
rp
++
;
}
}
}
void
png_read_filter_row_sub4_vsx
(
png_row_infop
row_info
,
png_bytep
row
,
png_const_bytep
prev_row
)
{
const
unsigned
int
bpp
=
4
;
png_size_t
i
;
png_size_t
istop
=
row_info
->
rowbytes
;
unsigned
int
bpp
=
(
row_info
->
pixel_depth
+
7
)
>>
3
;
png_bytep
rp
=
row
+
bpp
;
PNG_UNUSED
(
prev_row
)
for
(
i
=
bpp
;
i
<
istop
;
i
++
)
{
*
rp
=
(
png_byte
)(((
int
)(
*
rp
)
+
(
int
)(
*
(
rp
-
bpp
)))
&
0xff
);
*
rp
=
(
png_byte
)(((
int
)(
*
rp
)
+
(
int
)(
*
(
rp
-
4
)))
&
0xff
);
rp
++
;
}
}
...
...
@@ -66,16 +91,16 @@ void png_read_filter_row_sub4_vsx(png_row_infop row_info, png_bytep row,
void
png_read_filter_row_sub3_vsx
(
png_row_infop
row_info
,
png_bytep
row
,
png_const_bytep
prev_row
)
{
const
unsigned
int
bpp
=
4
;
png_size_t
i
;
png_size_t
istop
=
row_info
->
rowbytes
;
unsigned
int
bpp
=
(
row_info
->
pixel_depth
+
7
)
>>
3
;
png_bytep
rp
=
row
+
bpp
;
PNG_UNUSED
(
prev_row
)
for
(
i
=
bpp
;
i
<
istop
;
i
++
)
{
*
rp
=
(
png_byte
)(((
int
)(
*
rp
)
+
(
int
)(
*
(
rp
-
bpp
)))
&
0xff
);
*
rp
=
(
png_byte
)(((
int
)(
*
rp
)
+
(
int
)(
*
(
rp
-
3
)))
&
0xff
);
rp
++
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录