This commit is contained in:
Jorge Rodriguez
2016-02-09 19:37:07 -08:00
13 changed files with 871 additions and 537 deletions

View File

@ -7,7 +7,7 @@
#define STB_DEFINE
#include "stb.h"
#define PNGSUITE_PRIMARY
//#define PNGSUITE_PRIMARY
#if 0
void test_ycbcr(void)
@ -65,7 +65,7 @@ int main(int argc, char **argv)
int w,h;
//test_ycbcr();
#if 1
#if 0
// test hdr asserts
for (h=0; h < 100; h += 2)
for (w=0; w < 200; ++w)
@ -81,15 +81,17 @@ int main(int argc, char **argv)
for (i=1; i < argc; ++i) {
int res;
int w2,h2,n2;
unsigned char *data;
printf("%s\n", argv[i]);
res = stbi_info(argv[1], &w, &h, &n);
res = stbi_info(argv[1], &w2, &h2, &n2);
data = stbi_load(argv[i], &w, &h, &n, 4); if (data) free(data); else printf("Failed &n\n");
data = stbi_load(argv[i], &w, &h, 0, 1); if (data) free(data); else printf("Failed 1\n");
data = stbi_load(argv[i], &w, &h, 0, 2); if (data) free(data); else printf("Failed 2\n");
data = stbi_load(argv[i], &w, &h, 0, 3); if (data) free(data); else printf("Failed 3\n");
data = stbi_load(argv[i], &w, &h, 0, 4);
data = stbi_load(argv[i], &w, &h, &n, 4);
assert(data);
assert(w == w2 && h == h2 && n == n2);
assert(res);
if (data) {
char fname[512];

View File

@ -66,7 +66,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# 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 /MTd /W3 /GX /Zi /Od /I ".." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "VORBIS_TEST" /FR /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /GX /Zi /Od /I ".." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "MAIN_TEST" /FR /FD /GZ /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
@ -86,6 +86,10 @@ LINK32=link.exe
# Name "stb - Win32 Debug"
# Begin Source File
SOURCE=..\docs\other_libs.md
# End Source File
# Begin Source File
SOURCE=.\stb.c
# End Source File
# Begin Source File
@ -130,6 +134,10 @@ SOURCE=..\stb_leakcheck.h
# End Source File
# Begin Source File
SOURCE=..\stb_malloc.h
# End Source File
# Begin Source File
SOURCE=..\stb_perlin.h
# End Source File
# Begin Source File

View File

@ -8,10 +8,11 @@ extern void stb_vorbis_dumpmem(void);
int main(int argc, char **argv)
{
size_t memlen;
unsigned char *mem = stb_fileu("c:/x/theme_03.ogg", &memlen);
unsigned char *mem = stb_fileu("c:/x/sketch008.ogg", &memlen);
int chan, samplerate;
short *output;
int samples = stb_vorbis_decode_memory(mem, memlen, &chan, &samplerate, &output);
stb_filewrite("c:/x/sketch008.raw", output, samples*4);
return 0;
}
#endif