Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
itdan3344
stb
提交
65edb64d
S
stb
项目概览
itdan3344
/
stb
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
stb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
65edb64d
编写于
4月 02, 2016
作者:
S
Sean Barrett
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' into working
上级
8420e20a
75c5908f
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
60 addition
and
26 deletion
+60
-26
stb.h
stb.h
+1
-1
stb_image.h
stb_image.h
+48
-24
stb_image_write.h
stb_image_write.h
+2
-1
stb_vorbis.c
stb_vorbis.c
+9
-0
未找到文件。
stb.h
浏览文件 @
65edb64d
...
...
@@ -11205,7 +11205,7 @@ int stb_arith_decode_byte(stb_arith *a)
// Threads
//
#ifndef WIN32
#ifndef
_
WIN32
#ifdef STB_THREADS
#error "threads not implemented except for Windows"
#endif
...
...
stb_image.h
浏览文件 @
65edb64d
...
...
@@ -201,10 +201,11 @@
Janez Zemva John Bartholomew Michal Cichon svdijk@github
Jonathan Blow Ken Hamada Tero Hanninen Baldur Karlsson
Laurent Gomila Cort Stratton Sergio Gonzalez romigrou@github
Aruelien Pocheville Thibault Reuille Cass Everitt
Aruelien Pocheville Thibault Reuille Cass Everitt
Ryamond Barbiero Paul Du Bois Engin Manap
Michaelangel007@github Oriol Ferrer Mesia
Blazej Dariusz Roszkowski
Michaelangel007@github
Oriol Ferrer Mesia
LICENSE
...
...
@@ -3425,10 +3426,13 @@ static stbi_uc *load_jpeg_image(stbi__jpeg *z, int *out_x, int *out_y, int *comp
static
unsigned
char
*
stbi__jpeg_load
(
stbi__context
*
s
,
int
*
x
,
int
*
y
,
int
*
comp
,
int
req_comp
)
{
stbi__jpeg
j
;
j
.
s
=
s
;
stbi__setup_jpeg
(
&
j
);
return
load_jpeg_image
(
&
j
,
x
,
y
,
comp
,
req_comp
);
unsigned
char
*
result
;
stbi__jpeg
*
j
=
(
stbi__jpeg
*
)
stbi__malloc
(
sizeof
(
stbi__jpeg
));
j
->
s
=
s
;
stbi__setup_jpeg
(
j
);
result
=
load_jpeg_image
(
j
,
x
,
y
,
comp
,
req_comp
);
STBI_FREE
(
j
);
return
result
;
}
static
int
stbi__jpeg_test
(
stbi__context
*
s
)
...
...
@@ -3456,9 +3460,12 @@ static int stbi__jpeg_info_raw(stbi__jpeg *j, int *x, int *y, int *comp)
static
int
stbi__jpeg_info
(
stbi__context
*
s
,
int
*
x
,
int
*
y
,
int
*
comp
)
{
stbi__jpeg
j
;
j
.
s
=
s
;
return
stbi__jpeg_info_raw
(
&
j
,
x
,
y
,
comp
);
int
result
;
stbi__jpeg
*
j
=
(
stbi__jpeg
*
)
(
stbi__malloc
(
sizeof
(
stbi__jpeg
)));
j
->
s
=
s
;
result
=
stbi__jpeg_info_raw
(
j
,
x
,
y
,
comp
);
STBI_FREE
(
j
);
return
result
;
}
#endif
...
...
@@ -3749,7 +3756,7 @@ static int stbi__compute_huffman_codes(stbi__zbuf *a)
return
1
;
}
static
int
stbi__parse_uncomp
er
ssed_block
(
stbi__zbuf
*
a
)
static
int
stbi__parse_uncomp
re
ssed_block
(
stbi__zbuf
*
a
)
{
stbi_uc
header
[
4
];
int
len
,
nlen
,
k
;
...
...
@@ -3815,7 +3822,7 @@ static int stbi__parse_zlib(stbi__zbuf *a, int parse_header)
final
=
stbi__zreceive
(
a
,
1
);
type
=
stbi__zreceive
(
a
,
2
);
if
(
type
==
0
)
{
if
(
!
stbi__parse_uncomp
er
ssed_block
(
a
))
return
0
;
if
(
!
stbi__parse_uncomp
re
ssed_block
(
a
))
return
0
;
}
else
if
(
type
==
3
)
{
return
0
;
}
else
{
...
...
@@ -5447,6 +5454,21 @@ static stbi_uc *stbi__psd_load(stbi__context *s, int *x, int *y, int *comp, int
}
}
if
(
channelCount
>=
3
)
{
for
(
i
=
0
;
i
<
w
*
h
;
++
i
)
{
unsigned
char
*
pixel
=
out
+
4
*
i
;
if
(
pixel
[
3
]
!=
0
&&
pixel
[
3
]
!=
255
)
{
// remove weird white matte from PSD
float
a
=
pixel
[
3
]
/
255
.
0
f
;
float
ra
=
1
.
0
f
/
a
;
float
inv_a
=
255
.
0
f
*
(
1
-
ra
);
pixel
[
0
]
=
(
unsigned
char
)
(
pixel
[
0
]
*
ra
+
inv_a
);
pixel
[
1
]
=
(
unsigned
char
)
(
pixel
[
1
]
*
ra
+
inv_a
);
pixel
[
2
]
=
(
unsigned
char
)
(
pixel
[
2
]
*
ra
+
inv_a
);
}
}
}
if
(
req_comp
&&
req_comp
!=
4
)
{
out
=
stbi__convert_format
(
out
,
4
,
req_comp
,
w
,
h
);
if
(
out
==
NULL
)
return
out
;
// stbi__convert_format frees input on failure
...
...
@@ -5759,13 +5781,15 @@ static int stbi__gif_header(stbi__context *s, stbi__gif *g, int *comp, int is_in
static
int
stbi__gif_info_raw
(
stbi__context
*
s
,
int
*
x
,
int
*
y
,
int
*
comp
)
{
stbi__gif
g
;
if
(
!
stbi__gif_header
(
s
,
&
g
,
comp
,
1
))
{
stbi__gif
*
g
=
(
stbi__gif
*
)
stbi__malloc
(
sizeof
(
stbi__gif
));
if
(
!
stbi__gif_header
(
s
,
g
,
comp
,
1
))
{
STBI_FREE
(
g
);
stbi__rewind
(
s
);
return
0
;
}
if
(
x
)
*
x
=
g
.
w
;
if
(
y
)
*
y
=
g
.
h
;
if
(
x
)
*
x
=
g
->
w
;
if
(
y
)
*
y
=
g
->
h
;
STBI_FREE
(
g
);
return
1
;
}
...
...
@@ -6018,20 +6042,20 @@ static stbi_uc *stbi__gif_load_next(stbi__context *s, stbi__gif *g, int *comp, i
static
stbi_uc
*
stbi__gif_load
(
stbi__context
*
s
,
int
*
x
,
int
*
y
,
int
*
comp
,
int
req_comp
)
{
stbi_uc
*
u
=
0
;
stbi__gif
g
;
memset
(
&
g
,
0
,
sizeof
(
g
));
stbi__gif
*
g
=
(
stbi__gif
*
)
stbi__malloc
(
sizeof
(
stbi__gif
))
;
memset
(
g
,
0
,
sizeof
(
*
g
));
u
=
stbi__gif_load_next
(
s
,
&
g
,
comp
,
req_comp
);
u
=
stbi__gif_load_next
(
s
,
g
,
comp
,
req_comp
);
if
(
u
==
(
stbi_uc
*
)
s
)
u
=
0
;
// end of animated gif marker
if
(
u
)
{
*
x
=
g
.
w
;
*
y
=
g
.
h
;
*
x
=
g
->
w
;
*
y
=
g
->
h
;
if
(
req_comp
&&
req_comp
!=
4
)
u
=
stbi__convert_format
(
u
,
4
,
req_comp
,
g
.
w
,
g
.
h
);
u
=
stbi__convert_format
(
u
,
4
,
req_comp
,
g
->
w
,
g
->
h
);
}
else
if
(
g
.
out
)
STBI_FREE
(
g
.
out
);
else
if
(
g
->
out
)
STBI_FREE
(
g
->
out
);
STBI_FREE
(
g
);
return
u
;
}
...
...
stb_image_write.h
浏览文件 @
65edb64d
...
...
@@ -736,7 +736,7 @@ unsigned char * stbi_zlib_compress(unsigned char *data, int data_len, int *out_l
unsigned
int
bitbuf
=
0
;
int
i
,
j
,
bitcount
=
0
;
unsigned
char
*
out
=
NULL
;
unsigned
char
**
hash_table
[
stbiw__ZHASH
];
// 64KB on the stack!
unsigned
char
**
*
hash_table
=
(
unsigned
char
***
)
STBIW_MALLOC
(
stbiw__ZHASH
*
sizeof
(
char
**
));
if
(
quality
<
5
)
quality
=
5
;
stbiw__sbpush
(
out
,
0x78
);
// DEFLATE 32K window
...
...
@@ -808,6 +808,7 @@ unsigned char * stbi_zlib_compress(unsigned char *data, int data_len, int *out_l
for
(
i
=
0
;
i
<
stbiw__ZHASH
;
++
i
)
(
void
)
stbiw__sbfree
(
hash_table
[
i
]);
STBIW_FREE
(
hash_table
);
{
// compute adler32 on input
...
...
stb_vorbis.c
浏览文件 @
65edb64d
...
...
@@ -552,6 +552,9 @@ enum STBVorbisError
#include <math.h>
#if !(defined(__APPLE__) || defined(MACOSX) || defined(macintosh) || defined(Macintosh))
#include <malloc.h>
#if defined(__linux__) || defined(__linux)
#include <alloca.h>
#endif
#endif
#else // STB_VORBIS_NO_CRT
#define NULL 0
...
...
@@ -2246,6 +2249,11 @@ static void decode_residue(vorb *f, float *residue_buffers[], int ch, int n, int
}
done:
CHECK
(
f
);
#ifndef STB_VORBIS_DIVIDES_IN_RESIDUE
temp_free
(
f
,
part_classdata
);
#else
temp_free
(
f
,
classifications
);
#endif
temp_alloc_restore
(
f
,
temp_alloc_point
);
}
...
...
@@ -2891,6 +2899,7 @@ static void inverse_mdct(float *buffer, int n, vorb *f, int blocktype)
}
}
temp_free
(
f
,
buf2
);
temp_alloc_restore
(
f
,
save_point
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录