Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Libpng
提交
18c5cfaf
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,发现更多精彩内容 >>
提交
18c5cfaf
编写于
11月 16, 2011
作者:
J
John Bowler
提交者:
Glenn Randers-Pehrson
11月 16, 2011
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[libpng15] Multiple transform bug fixes plus a work-round for double gamma
correction.
上级
36f58843
变更
5
展开全部
隐藏空白更改
内联
并排
Showing
5 changed file
with
477 addition
and
45 deletion
+477
-45
ANNOUNCE
ANNOUNCE
+8
-0
CHANGES
CHANGES
+8
-0
pngread.c
pngread.c
+401
-39
pngrtran.c
pngrtran.c
+49
-1
pngwrite.c
pngwrite.c
+11
-5
未找到文件。
ANNOUNCE
浏览文件 @
18c5cfaf
...
...
@@ -70,6 +70,14 @@ Version 1.5.7beta03 [November 16, 2011]
Added run-time detection of NEON support.
Added contrib/libtests; includes simplified API test and timing test and
a color conversion utility for rapid checking of failed 'pngstest' results.
Multiple transform bug fixes plus a work-round for double gamma correction.
libpng does not support more than one transform that requires linear data
at once - if this is tried typically the results is double gamma
correction. Since the simplified APIs can need rgb to gray combined with
a compose operation it is necessary to do one of these outside the main
libpng transform code. This check-in also contains fixes to various bugs
in the simplified APIs themselves and to some bugs in compose and rgb to
gray (on palette) itself.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net:
(subscription required; visit
...
...
CHANGES
浏览文件 @
18c5cfaf
...
...
@@ -3715,6 +3715,14 @@ Version 1.5.7beta03 [November 16, 2011]
Added run-time detection of NEON support.
Added contrib/libtests; includes simplified API test and timing test and
a color conversion utility for rapid checking of failed 'pngstest' results.
Multiple transform bug fixes plus a work-round for double gamma correction.
libpng does not support more than one transform that requires linear data
at once - if this is tried typically the results is double gamma
correction. Since the simplified APIs can need rgb to gray combined with
a compose operation it is necessary to do one of these outside the main
libpng transform code. This check-in also contains fixes to various bugs
in the simplified APIs themselves and to some bugs in compose and rgb to
gray (on palette) itself.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
...
...
pngread.c
浏览文件 @
18c5cfaf
此差异已折叠。
点击以展开。
pngrtran.c
浏览文件 @
18c5cfaf
...
...
@@ -1465,6 +1465,28 @@ png_init_read_transformations(png_structp png_ptr)
}
#endif
/* PNG_READ_BACKGROUND_SUPPORTED && PNG_READ_EXPAND_16_SUPPORTED */
#if defined(PNG_READ_BACKGROUND_SUPPORTED) && \
(defined(PNG_READ_SCALE_16_TO_8_SUPPORTED) || \
defined(PNG_READ_STRIP_16_TO_8_SUPPORTED))
if
((
png_ptr
->
transformations
&
(
PNG_16_TO_8
|
PNG_SCALE_16_TO_8
))
&&
(
png_ptr
->
transformations
&
PNG_COMPOSE
)
&&
!
(
png_ptr
->
transformations
&
PNG_BACKGROUND_EXPAND
)
&&
png_ptr
->
bit_depth
==
16
)
{
/* On the other hand, if a 16-bit file is to be reduced to 8-bits per
* component this will also happen after PNG_COMPOSE and so the background
* color must be pre-expanded here.
*
* TODO: fix this too.
*/
png_ptr
->
background
.
red
=
(
png_uint_16
)(
png_ptr
->
background
.
red
*
257
);
png_ptr
->
background
.
green
=
(
png_uint_16
)(
png_ptr
->
background
.
green
*
257
);
png_ptr
->
background
.
blue
=
(
png_uint_16
)(
png_ptr
->
background
.
blue
*
257
);
png_ptr
->
background
.
gray
=
(
png_uint_16
)(
png_ptr
->
background
.
gray
*
257
);
}
#endif
/* NOTE: below 'PNG_READ_ALPHA_MODE_SUPPORTED' is presumed to also enable the
* background support (see the comments in scripts/pnglibconf.dfa), this
* allows pre-multiplication of the alpha channel to be implemented as
...
...
@@ -1512,6 +1534,16 @@ png_init_read_transformations(png_structp png_ptr)
#ifdef PNG_READ_BACKGROUND_SUPPORTED
if
(
png_ptr
->
transformations
&
PNG_COMPOSE
)
{
/* Issue a warning about this combination: because RGB_TO_GRAY is
* optimized to do the gamma transform if present yet do_background has
* to do the same thing if both options are set a
* double-gamma-correction happens. This is true in all versions of
* libpng to date.
*/
if
(
png_ptr
->
transformations
&
PNG_RGB_TO_GRAY
)
png_warning
(
png_ptr
,
"libpng does not support gamma+background+rgb_to_gray"
);
if
(
png_ptr
->
color_type
==
PNG_COLOR_TYPE_PALETTE
)
{
/* We don't get to here unless there is a tRNS chunk with non-opaque
...
...
@@ -1726,7 +1758,13 @@ png_init_read_transformations(png_structp png_ptr)
else
/* Transformation does not include PNG_BACKGROUND */
#endif
/* PNG_READ_BACKGROUND_SUPPORTED */
if
(
png_ptr
->
color_type
==
PNG_COLOR_TYPE_PALETTE
)
if
(
png_ptr
->
color_type
==
PNG_COLOR_TYPE_PALETTE
#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
/* RGB_TO_GRAY needs to have non-gamma-corrected values! */
&&
((
png_ptr
->
transformations
&
PNG_EXPAND
)
==
0
||
(
png_ptr
->
transformations
&
PNG_RGB_TO_GRAY
)
==
0
)
#endif
)
{
png_colorp
palette
=
png_ptr
->
palette
;
int
num_palette
=
png_ptr
->
num_palette
;
...
...
@@ -2165,12 +2203,22 @@ png_do_read_transformations(png_structp png_ptr, png_row_infop row_info)
#ifdef PNG_READ_GAMMA_SUPPORTED
if
((
png_ptr
->
transformations
&
PNG_GAMMA
)
&&
#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
/* Because RGB_TO_GRAY does the gamma transform. */
!
(
png_ptr
->
transformations
&
PNG_RGB_TO_GRAY
)
&&
#endif
#if (defined PNG_READ_BACKGROUND_SUPPORTED) ||\
(defined PNG_READ_ALPHA_MODE_SUPPORTED)
/* Because PNG_COMPOSE does the gamma transform if there is something to
* do (if there is an alpha channel or transparency.)
*/
!
((
png_ptr
->
transformations
&
PNG_COMPOSE
)
&&
((
png_ptr
->
num_trans
!=
0
)
||
(
png_ptr
->
color_type
&
PNG_COLOR_MASK_ALPHA
)))
&&
#endif
/* Because png_init_read_transformations transforms the palette, unless
* RGB_TO_GRAY will do the transform.
*/
(
png_ptr
->
color_type
!=
PNG_COLOR_TYPE_PALETTE
))
png_do_gamma
(
row_info
,
png_ptr
->
row_buf
+
1
,
png_ptr
);
#endif
...
...
pngwrite.c
浏览文件 @
18c5cfaf
...
...
@@ -1878,7 +1878,7 @@ png_write_image_8bit(png_voidp argument)
/* Need 32 bit accuracy in the sRGB tables */
png_uint_32
component
=
*
in_ptr
++
;
/* The following gives
65535
for an alpha of 0, which is fine,
/* The following gives
1.0
for an alpha of 0, which is fine,
* otherwise if 0/0 is represented as some other value there is
* more likely to be a discontinuity which will probably damage
* compression when moving from a fully transparent area to a
...
...
@@ -1891,11 +1891,17 @@ png_write_image_8bit(png_voidp argument)
/* component<alpha, so component/alpha is less than one and
* component*reciprocal is less than 2^31.
*/
else
if
(
component
>
0
&&
alpha
<
65535
)
else
if
(
component
>
0
)
{
component
*=
reciprocal
;
component
+=
64
;
/* round to nearest */
component
>>=
7
;
if
(
alpha
<
65535
)
{
component
*=
reciprocal
;
component
+=
64
;
/* round to nearest */
component
>>=
7
;
}
else
component
*=
255
;
/* Convert the component to sRGB. */
*
out_ptr
++
=
(
png_byte
)
PNG_sRGB_FROM_LINEAR
(
component
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录