Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
itdan3344
stb
提交
50479cb0
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,发现更多精彩内容 >>
提交
50479cb0
编写于
3月 26, 2016
作者:
S
Sean Barrett
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
stb_image: allow jpegs that are rgb not YCrCb
上级
8aa9afb3
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
869 addition
and
3 deletion
+869
-3
stb_image.h
stb_image.h
+20
-3
tests/stb.dsw
tests/stb.dsw
+12
-0
tools/unicode.c
tools/unicode.c
+749
-0
tools/unicode/unicode.dsp
tools/unicode/unicode.dsp
+88
-0
未找到文件。
stb_image.h
浏览文件 @
50479cb0
...
@@ -1506,6 +1506,7 @@ typedef struct
...
@@ -1506,6 +1506,7 @@ typedef struct
int
succ_high
;
int
succ_high
;
int
succ_low
;
int
succ_low
;
int
eob_run
;
int
eob_run
;
int
rgb
;
int
scan_n
,
order
[
4
];
int
scan_n
,
order
[
4
];
int
restart_interval
,
todo
;
int
restart_interval
,
todo
;
...
@@ -2717,11 +2718,17 @@ static int stbi__process_frame_header(stbi__jpeg *z, int scan)
...
@@ -2717,11 +2718,17 @@ static int stbi__process_frame_header(stbi__jpeg *z, int scan)
if
(
Lf
!=
8
+
3
*
s
->
img_n
)
return
stbi__err
(
"bad SOF len"
,
"Corrupt JPEG"
);
if
(
Lf
!=
8
+
3
*
s
->
img_n
)
return
stbi__err
(
"bad SOF len"
,
"Corrupt JPEG"
);
z
->
rgb
=
0
;
for
(
i
=
0
;
i
<
s
->
img_n
;
++
i
)
{
for
(
i
=
0
;
i
<
s
->
img_n
;
++
i
)
{
static
unsigned
char
rgb
[
3
]
=
{
'R'
,
'G'
,
'B'
};
z
->
img_comp
[
i
].
id
=
stbi__get8
(
s
);
z
->
img_comp
[
i
].
id
=
stbi__get8
(
s
);
if
(
z
->
img_comp
[
i
].
id
!=
i
+
1
)
// JFIF requires
if
(
z
->
img_comp
[
i
].
id
!=
i
+
1
)
// JFIF requires
if
(
z
->
img_comp
[
i
].
id
!=
i
)
// some version of jpegtran outputs non-JFIF-compliant files!
if
(
z
->
img_comp
[
i
].
id
!=
i
)
{
// some version of jpegtran outputs non-JFIF-compliant files!
return
stbi__err
(
"bad component ID"
,
"Corrupt JPEG"
);
// somethings output this (see http://fileformats.archiveteam.org/wiki/JPEG#Color_format)
if
(
z
->
img_comp
[
i
].
id
!=
rgb
[
i
])
return
stbi__err
(
"bad component ID"
,
"Corrupt JPEG"
);
++
z
->
rgb
;
}
q
=
stbi__get8
(
s
);
q
=
stbi__get8
(
s
);
z
->
img_comp
[
i
].
h
=
(
q
>>
4
);
if
(
!
z
->
img_comp
[
i
].
h
||
z
->
img_comp
[
i
].
h
>
4
)
return
stbi__err
(
"bad H"
,
"Corrupt JPEG"
);
z
->
img_comp
[
i
].
h
=
(
q
>>
4
);
if
(
!
z
->
img_comp
[
i
].
h
||
z
->
img_comp
[
i
].
h
>
4
)
return
stbi__err
(
"bad H"
,
"Corrupt JPEG"
);
z
->
img_comp
[
i
].
v
=
q
&
15
;
if
(
!
z
->
img_comp
[
i
].
v
||
z
->
img_comp
[
i
].
v
>
4
)
return
stbi__err
(
"bad V"
,
"Corrupt JPEG"
);
z
->
img_comp
[
i
].
v
=
q
&
15
;
if
(
!
z
->
img_comp
[
i
].
v
||
z
->
img_comp
[
i
].
v
>
4
)
return
stbi__err
(
"bad V"
,
"Corrupt JPEG"
);
...
@@ -3383,7 +3390,17 @@ static stbi_uc *load_jpeg_image(stbi__jpeg *z, int *out_x, int *out_y, int *comp
...
@@ -3383,7 +3390,17 @@ static stbi_uc *load_jpeg_image(stbi__jpeg *z, int *out_x, int *out_y, int *comp
if
(
n
>=
3
)
{
if
(
n
>=
3
)
{
stbi_uc
*
y
=
coutput
[
0
];
stbi_uc
*
y
=
coutput
[
0
];
if
(
z
->
s
->
img_n
==
3
)
{
if
(
z
->
s
->
img_n
==
3
)
{
z
->
YCbCr_to_RGB_kernel
(
out
,
y
,
coutput
[
1
],
coutput
[
2
],
z
->
s
->
img_x
,
n
);
if
(
z
->
rgb
==
3
)
{
for
(
i
=
0
;
i
<
z
->
s
->
img_x
;
++
i
)
{
out
[
0
]
=
y
[
i
];
out
[
1
]
=
coutput
[
1
][
i
];
out
[
2
]
=
coutput
[
2
][
i
];
out
[
3
]
=
255
;
out
+=
n
;
}
}
else
{
z
->
YCbCr_to_RGB_kernel
(
out
,
y
,
coutput
[
1
],
coutput
[
2
],
z
->
s
->
img_x
,
n
);
}
}
else
}
else
for
(
i
=
0
;
i
<
z
->
s
->
img_x
;
++
i
)
{
for
(
i
=
0
;
i
<
z
->
s
->
img_x
;
++
i
)
{
out
[
0
]
=
out
[
1
]
=
out
[
2
]
=
y
[
i
];
out
[
0
]
=
out
[
1
]
=
out
[
2
]
=
y
[
i
];
...
...
tests/stb.dsw
浏览文件 @
50479cb0
...
@@ -123,6 +123,18 @@ Package=<4>
...
@@ -123,6 +123,18 @@ Package=<4>
###############################################################################
###############################################################################
Project: "unicode"=..\tools\unicode\unicode.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "vorbseek"=.\vorbseek\vorbseek.dsp - Package Owner=<4>
Project: "vorbseek"=.\vorbseek\vorbseek.dsp - Package Owner=<4>
Package=<5>
Package=<5>
...
...
tools/unicode.c
0 → 100644
浏览文件 @
50479cb0
此差异已折叠。
点击以展开。
tools/unicode/unicode.dsp
0 → 100644
浏览文件 @
50479cb0
# Microsoft Developer Studio Project File - Name="unicode" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=unicode - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "unicode.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "unicode.mak" CFG="unicode - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "unicode - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "unicode - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "unicode - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
!ELSEIF "$(CFG)" == "unicode - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "unicode - Win32 Release"
# Name "unicode - Win32 Debug"
# Begin Source File
SOURCE=..\unicode.c
# End Source File
# End Target
# End Project
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录