Update Files
This commit is contained in:
		
							
								
								
									
										175
									
								
								Kha/Backends/Kinc-HL/hl/libs/fmt/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										175
									
								
								Kha/Backends/Kinc-HL/hl/libs/fmt/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,175 @@ | ||||
| set(MINIMP3_INCLUDE_DIR ${INCLUDES_BASE_DIR}/minimp3) | ||||
| set(MIKKTSPACE_INCLUDE_DIR ${INCLUDES_BASE_DIR}/mikktspace) | ||||
|  | ||||
| if(WIN32) | ||||
|     set(ZLIB_INCLUDE_DIRS ${INCLUDES_BASE_DIR}/zlib) | ||||
|     set(PNG_INCLUDE_DIRS ${INCLUDES_BASE_DIR}/png) | ||||
|     set(VORBIS_INCLUDE_DIR ${INCLUDES_BASE_DIR}/vorbis) | ||||
|  | ||||
|     if(CMAKE_SIZEOF_VOID_P EQUAL 8) | ||||
|         set(TurboJPEG_INCLUDE_DIRS ${INCLUDES_BASE_DIR}/turbojpeg ${INCLUDES_BASE_DIR}/turbojpeg/x64) | ||||
|         find_library(TurboJPEG_LIBRARIES simd PATHS ${INCLUDES_BASE_DIR}/turbojpeg/x64) | ||||
|     else() | ||||
|         set(TurboJPEG_INCLUDE_DIRS ${INCLUDES_BASE_DIR}/turbojpeg ${INCLUDES_BASE_DIR}/turbojpeg/x86) | ||||
|         find_library(TurboJPEG_LIBRARIES simd PATHS ${INCLUDES_BASE_DIR}/turbojpeg/x86) | ||||
|     endif() | ||||
|  | ||||
|     add_library(fmt.hdll SHARED | ||||
|         ${INCLUDES_BASE_DIR}/png/png.c | ||||
|         ${INCLUDES_BASE_DIR}/png/pngerror.c | ||||
|         ${INCLUDES_BASE_DIR}/png/pngget.c | ||||
|         ${INCLUDES_BASE_DIR}/png/pngmem.c | ||||
|         ${INCLUDES_BASE_DIR}/png/pngpread.c | ||||
|         ${INCLUDES_BASE_DIR}/png/pngread.c | ||||
|         ${INCLUDES_BASE_DIR}/png/pngrio.c | ||||
|         ${INCLUDES_BASE_DIR}/png/pngrtran.c | ||||
|         ${INCLUDES_BASE_DIR}/png/pngrutil.c | ||||
|         ${INCLUDES_BASE_DIR}/png/pngset.c | ||||
|         ${INCLUDES_BASE_DIR}/png/pngtrans.c | ||||
|         ${INCLUDES_BASE_DIR}/png/pngwio.c | ||||
|         ${INCLUDES_BASE_DIR}/png/pngwrite.c | ||||
|         ${INCLUDES_BASE_DIR}/png/pngwtran.c | ||||
|         ${INCLUDES_BASE_DIR}/png/pngwutil.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jaricom.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jcapimin.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jcapistd.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jcarith.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jccoefct.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jccolor.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jcdctmgr.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jchuff.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jcinit.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jcmainct.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jcmarker.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jcmaster.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jcomapi.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jcparam.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jcphuff.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jcprepct.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jcsample.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jctrans.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jdapimin.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jdapistd.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jdarith.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jdatadst-tj.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jdatadst.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jdatasrc-tj.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jdatasrc.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jdcoefct.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jdcolor.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jddctmgr.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jdhuff.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jdinput.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jdmainct.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jdmarker.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jdmaster.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jdmerge.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jdphuff.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jdpostct.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jdsample.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jdtrans.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jerror.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jfdctflt.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jfdctfst.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jfdctint.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jidctflt.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jidctfst.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jidctint.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jidctred.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jmemmgr.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jmemnobs.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jquant1.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jquant2.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jsimd.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/jutils.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/transupp.c | ||||
|         ${INCLUDES_BASE_DIR}/turbojpeg/turbojpeg.c | ||||
|         ${INCLUDES_BASE_DIR}/zlib/adler32.c | ||||
|         ${INCLUDES_BASE_DIR}/zlib/crc32.c | ||||
|         ${INCLUDES_BASE_DIR}/zlib/deflate.c | ||||
|         ${INCLUDES_BASE_DIR}/zlib/inffast.c | ||||
|         ${INCLUDES_BASE_DIR}/zlib/inflate.c | ||||
|         ${INCLUDES_BASE_DIR}/zlib/inftrees.c | ||||
|         ${INCLUDES_BASE_DIR}/zlib/trees.c | ||||
|         ${INCLUDES_BASE_DIR}/zlib/zutil.c | ||||
|         ${INCLUDES_BASE_DIR}/vorbis/bitrate.c | ||||
|         ${INCLUDES_BASE_DIR}/vorbis/bitwise.c | ||||
|         ${INCLUDES_BASE_DIR}/vorbis/block.c | ||||
|         ${INCLUDES_BASE_DIR}/vorbis/codebook.c | ||||
|         ${INCLUDES_BASE_DIR}/vorbis/envelope.c | ||||
|         ${INCLUDES_BASE_DIR}/vorbis/floor0.c | ||||
|         ${INCLUDES_BASE_DIR}/vorbis/floor1.c | ||||
|         ${INCLUDES_BASE_DIR}/vorbis/framing.c | ||||
|         ${INCLUDES_BASE_DIR}/vorbis/info.c | ||||
|         ${INCLUDES_BASE_DIR}/vorbis/lookup.c | ||||
|         ${INCLUDES_BASE_DIR}/vorbis/lpc.c | ||||
|         ${INCLUDES_BASE_DIR}/vorbis/lsp.c | ||||
|         ${INCLUDES_BASE_DIR}/vorbis/mapping0.c | ||||
|         ${INCLUDES_BASE_DIR}/vorbis/mdct.c | ||||
|         ${INCLUDES_BASE_DIR}/vorbis/psy.c | ||||
|         ${INCLUDES_BASE_DIR}/vorbis/registry.c | ||||
|         ${INCLUDES_BASE_DIR}/vorbis/res0.c | ||||
|         ${INCLUDES_BASE_DIR}/vorbis/sharedbook.c | ||||
|         ${INCLUDES_BASE_DIR}/vorbis/smallft.c | ||||
|         ${INCLUDES_BASE_DIR}/vorbis/synthesis.c | ||||
|         ${INCLUDES_BASE_DIR}/vorbis/vorbisfile.c | ||||
|         ${INCLUDES_BASE_DIR}/vorbis/window.c | ||||
|         fmt.c | ||||
|         sha1.c | ||||
|         dxt.c | ||||
|         mikkt.c | ||||
|         ${MIKKTSPACE_INCLUDE_DIR}/mikktspace.c | ||||
|     ) | ||||
| else() | ||||
|     find_package(ZLIB REQUIRED) | ||||
|     find_package(PNG REQUIRED) | ||||
|  | ||||
|     find_package(TurboJPEG QUIET) | ||||
|     if(NOT TurboJPEG_FOUND) | ||||
|         pkg_check_modules(TurboJPEG REQUIRED libjpeg) | ||||
|     endif() | ||||
|  | ||||
|     find_package(OggVorbis QUIET) | ||||
|     if(NOT OGGVORBIS_FOUND) | ||||
|         pkg_check_modules(OGGVORBIS REQUIRED vorbis vorbisenc vorbisfile) | ||||
|     endif() | ||||
|  | ||||
|     add_library(fmt.hdll SHARED | ||||
|         fmt.c | ||||
|         sha1.c | ||||
|         dxt.c | ||||
|         mikkt.c | ||||
|         ${MIKKTSPACE_INCLUDE_DIR}/mikktspace.c | ||||
|     ) | ||||
| endif() | ||||
|  | ||||
| set_as_hdll(fmt) | ||||
|  | ||||
| target_include_directories(fmt.hdll | ||||
|     PRIVATE | ||||
|     ${ZLIB_INCLUDE_DIRS} | ||||
|     ${PNG_INCLUDE_DIRS} | ||||
|     ${TurboJPEG_INCLUDE_DIRS} | ||||
|     ${VORBIS_INCLUDE_DIR} | ||||
|     ${MINIMP3_INCLUDE_DIR} | ||||
|     ${MIKKTSPACE_INCLUDE_DIR} | ||||
| ) | ||||
|  | ||||
| target_link_libraries(fmt.hdll | ||||
|     libhl | ||||
|     ${ZLIB_LIBRARIES} | ||||
|     ${PNG_LIBRARIES} | ||||
|     ${TurboJPEG_LIBRARIES} | ||||
|     ${OGGVORBIS_LIBRARIES} | ||||
| ) | ||||
|  | ||||
| target_compile_definitions(fmt.hdll | ||||
|     PRIVATE | ||||
|     ${PNG_DEFINITIONS} | ||||
| ) | ||||
|  | ||||
| install( | ||||
|     TARGETS | ||||
|         fmt.hdll | ||||
|     DESTINATION ${HDLL_DESTINATION} | ||||
| ) | ||||
							
								
								
									
										169
									
								
								Kha/Backends/Kinc-HL/hl/libs/fmt/dxt.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										169
									
								
								Kha/Backends/Kinc-HL/hl/libs/fmt/dxt.c
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,169 @@ | ||||
| #define HL_NAME(n) fmt_##n | ||||
| #include <hl.h> | ||||
|  | ||||
| static const int BIT5[] = { 0, 8, 16, 25, 33, 41, 49, 58, 66, 74, 82, 90, 99, 107, 115, 123, 132, 140, 148, 156, 165, 173, 181, 189, 197, 206, 214, 222, 230, 239, 247, 255 }; | ||||
| static const int BIT6[] = { 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 130, 134, 138, 142, 146, 150, 154, 158, 162, 166, 170, 174, 178, 182, 186, 190, 194, 198, 202, 206, 210, 215, 219, 223, 227, 231, 235, 239, 243, 247, 251, 255 }; | ||||
|  | ||||
| #define MK_COLOR(r,g,b,a) (((a)<<24) | ((b)<<16) | ((g)<<8) | (r)) | ||||
|  | ||||
| #define DXT_COLOR1(c,a) MK_COLOR( \ | ||||
| 	BIT5[(c & 0xFC00) >> 11], \ | ||||
| 	BIT6[(c & 0x07E0) >> 5], \ | ||||
| 	BIT5[(c & 0x001F)], \ | ||||
| 	a) | ||||
|  | ||||
| #define DXT_COLOR2(c0,c1,a) MK_COLOR( \ | ||||
| 	(BIT5[(c0 & 0xFC00) >> 11] + BIT5[(c1 & 0xFC00) >> 11]) / 2, \ | ||||
| 	(BIT6[(c0 & 0x07E0) >> 5] + BIT6[(c1 & 0x07E0) >> 5]) / 2, \ | ||||
| 	(BIT5[c0 & 0x001F] + BIT5[c1 & 0x001F]) / 2, \ | ||||
| 	a) | ||||
|  | ||||
| #define DXT_COLOR3(c0,c1,a) MK_COLOR( \ | ||||
| 	(2 * BIT5[(c0 & 0xFC00) >> 11] + BIT5[(c1 & 0xFC00) >> 11]) / 3, \ | ||||
| 	(2 * BIT6[(c0 & 0x07E0) >> 5] + BIT6[(c1 & 0x07E0) >> 5]) / 3, \ | ||||
| 	(2 * BIT5[c0 & 0x001F] + BIT5[c1 & 0x001F]) / 3, \ | ||||
| 	a) | ||||
|  | ||||
| static int dxtAlpha(int a0, int a1, int t) { | ||||
| 	if (a0 > a1) switch (t) { | ||||
| 	case 0: return a0; | ||||
| 	case 1: return a1; | ||||
| 	case 2: return (6 * a0 + a1) / 7; | ||||
| 	case 3: return (5 * a0 + 2 * a1) / 7; | ||||
| 	case 4: return (4 * a0 + 3 * a1) / 7; | ||||
| 	case 5: return (3 * a0 + 4 * a1) / 7; | ||||
| 	case 6: return (2 * a0 + 5 * a1) / 7; | ||||
| 	case 7: return (a0 + 6 * a1) / 7; | ||||
| 	} | ||||
| 	else switch (t) { | ||||
| 	case 0: return a0; | ||||
| 	case 1: return a1; | ||||
| 	case 2: return (4 * a0 + a1) / 5; | ||||
| 	case 3: return (3 * a0 + 2 * a1) / 5; | ||||
| 	case 4: return (2 * a0 + 3 * a1) / 5; | ||||
| 	case 5: return (a0 + 4 * a1) / 5; | ||||
| 	case 6: return 0; | ||||
| 	case 7: return 255; | ||||
| 	} | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
| static int dxtColor(int c0, int c1, int a, int t) { | ||||
| 	switch (t) { | ||||
| 	case 0: return DXT_COLOR1(c0, a); | ||||
| 	case 1: return DXT_COLOR1(c1, a); | ||||
| 	case 2: return (c0 > c1) ? DXT_COLOR3(c0, c1, a) : DXT_COLOR2(c0, c1, a); | ||||
| 	case 3: return (c0 > c1) ? DXT_COLOR3(c1, c0, a) : 0; | ||||
| 	} | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
| HL_PRIM bool HL_NAME(dxt_decode)( vbyte *data, int *out, int width, int height, int format ) { | ||||
| 	int x,y,k; | ||||
| 	int index = 0; | ||||
| 	int write = 0; | ||||
| 	int alpha[16]; | ||||
| 	switch( format ) { | ||||
| 	case 1: | ||||
| 		for(y=0;y<height>>2;y++) { | ||||
| 			for(x=0;x<width>>2;x++) { | ||||
| 				int c0 = data[index] | (data[index + 1] << 8); index += 2; | ||||
| 				int c1 = data[index] | (data[index + 1] << 8); index += 2; | ||||
| 				for(k=0;k<4;k++) { | ||||
| 					unsigned char c = data[index++]; | ||||
| 					int t0 = c & 0x03; | ||||
| 					int t1 = (c & 0x0C) >> 2; | ||||
| 					int t2 = (c & 0x30) >> 4; | ||||
| 					int t3 = (c & 0xC0) >> 6; | ||||
| 					int w = write + k * width; | ||||
| 					out[w++] = dxtColor(c0, c1, 0xFF, t0); | ||||
| 					out[w++] = dxtColor(c0, c1, 0xFF, t1); | ||||
| 					out[w++] = dxtColor(c0, c1, 0xFF, t2); | ||||
| 					out[w++] = dxtColor(c0, c1, 0xFF, t3); | ||||
| 				} | ||||
| 				write += 4; | ||||
| 			} | ||||
| 			write += 3 * width; | ||||
| 		} | ||||
| 		return true; | ||||
| 	case 2: | ||||
| 		for(y=0;y<height>>2;y++) { | ||||
| 			for(x=0;x<width>>2;x++) { | ||||
| 				int ap = 0; | ||||
| 				for(k=0;k<4;k++) { | ||||
| 					int a0 = data[index++]; | ||||
| 					int a1 = data[index++]; | ||||
| 					alpha[ap++] = 17 * ((a0 & 0xF0) >> 4); | ||||
| 					alpha[ap++] = 17 * (a0 & 0x0F); | ||||
| 					alpha[ap++] = 17 * ((a1 & 0xF0) >> 4); | ||||
| 					alpha[ap++] = 17 * (a1 & 0x0F); | ||||
| 				} | ||||
| 				ap = 0; | ||||
| 				int c0 = data[index] | (data[index + 1] << 8); index += 2; | ||||
| 				int c1 = data[index] | (data[index + 1] << 8); index += 2; | ||||
| 				for (int k = 0; k<4; k++) { | ||||
| 					int c = data[index++]; | ||||
| 					int t0 = c & 0x03; | ||||
| 					int t1 = (c & 0x0C) >> 2; | ||||
| 					int t2 = (c & 0x30) >> 4; | ||||
| 					int t3 = (c & 0xC0) >> 6; | ||||
| 					int w = write + k * width; | ||||
| 					out[w++] = dxtColor(c0, c1, alpha[ap++], t0); | ||||
| 					out[w++] = dxtColor(c0, c1, alpha[ap++], t1); | ||||
| 					out[w++] = dxtColor(c0, c1, alpha[ap++], t2); | ||||
| 					out[w++] = dxtColor(c0, c1, alpha[ap++], t3); | ||||
| 				} | ||||
| 				write += 4; | ||||
| 			} | ||||
| 			write += 3 * width; | ||||
| 		} | ||||
| 		return true; | ||||
| 	case 3: | ||||
| 		for(y=0;y<height>>2;y++) { | ||||
| 			for(x=0;x<width>>2;x++) { | ||||
| 				int a0 = data[index++]; | ||||
| 				int a1 = data[index++]; | ||||
| 				int b0 = data[index] | (data[index + 1] << 8) | (data[index + 2] << 16); index += 3; | ||||
| 				int b1 = data[index] | (data[index + 1] << 8) | (data[index + 2] << 16); index += 3; | ||||
| 				alpha[0] = b0 & 0x07; | ||||
| 				alpha[1] = (b0 >> 3) & 0x07; | ||||
| 				alpha[2] = (b0 >> 6) & 0x07; | ||||
| 				alpha[3] = (b0 >> 9) & 0x07; | ||||
| 				alpha[4] = (b0 >> 12) & 0x07; | ||||
| 				alpha[5] = (b0 >> 15) & 0x07; | ||||
| 				alpha[6] = (b0 >> 18) & 0x07; | ||||
| 				alpha[7] = (b0 >> 21) & 0x07; | ||||
| 				alpha[8] = b1 & 0x07; | ||||
| 				alpha[9] = (b1 >> 3) & 0x07; | ||||
| 				alpha[10] = (b1 >> 6) & 0x07; | ||||
| 				alpha[11] = (b1 >> 9) & 0x07; | ||||
| 				alpha[12] = (b1 >> 12) & 0x07; | ||||
| 				alpha[13] = (b1 >> 15) & 0x07; | ||||
| 				alpha[14] = (b1 >> 18) & 0x07; | ||||
| 				alpha[15] = (b1 >> 21) & 0x07; | ||||
| 				int c0 = data[index] | (data[index + 1] << 8); index += 2; | ||||
| 				int c1 = data[index] | (data[index + 1] << 8); index += 2; | ||||
| 				int ap = 0; | ||||
| 				for (int k = 0; k<4; k++) { | ||||
| 					int c = data[index++]; | ||||
| 					int t0 = c & 0x03; | ||||
| 					int t1 = (c & 0x0C) >> 2; | ||||
| 					int t2 = (c & 0x30) >> 4; | ||||
| 					int t3 = (c & 0xC0) >> 6; | ||||
| 					int w = write + k * width; | ||||
| 					out[w++] = dxtColor(c0, c1, dxtAlpha(a0, a1, alpha[ap++]), t0); | ||||
| 					out[w++] = dxtColor(c0, c1, dxtAlpha(a0, a1, alpha[ap++]), t1); | ||||
| 					out[w++] = dxtColor(c0, c1, dxtAlpha(a0, a1, alpha[ap++]), t2); | ||||
| 					out[w++] = dxtColor(c0, c1, dxtAlpha(a0, a1, alpha[ap++]), t3); | ||||
| 				} | ||||
| 				write += 4; | ||||
| 			} | ||||
| 			write += 3 * width; | ||||
| 		} | ||||
| 		return true; | ||||
| 	default: | ||||
| 		return false; | ||||
| 	} | ||||
| } | ||||
|  | ||||
| DEFINE_PRIM(_BOOL, dxt_decode, _BYTES _BYTES _I32 _I32 _I32); | ||||
							
								
								
									
										788
									
								
								Kha/Backends/Kinc-HL/hl/libs/fmt/fmt.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										788
									
								
								Kha/Backends/Kinc-HL/hl/libs/fmt/fmt.c
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,788 @@ | ||||
| #define HL_NAME(n) fmt_##n | ||||
| //#include <png.h> | ||||
| #include <hl.h> | ||||
|  | ||||
| #if defined(HL_CONSOLE) && !defined(HL_XBO) | ||||
| //extern bool sys_jpg_decode( vbyte *data, int dataLen, vbyte *out, int width, int height, int stride, int format, int flags ); | ||||
| #else | ||||
| //#	include <turbojpeg.h> | ||||
| #endif | ||||
|  | ||||
| #include <zlib.h> | ||||
| //#include <vorbis/vorbisfile.h> | ||||
|  | ||||
| //#define MINIMP3_IMPLEMENTATION | ||||
| //#define MINIMP3_FLOAT_OUTPUT | ||||
| //#include <minimp3.h> | ||||
|  | ||||
| /* ------------------------------------------------- IMG --------------------------------------------------- */ | ||||
|  | ||||
| typedef struct { | ||||
| 	unsigned char a,r,g,b; | ||||
| } pixel; | ||||
|  | ||||
| /*HL_PRIM bool HL_NAME(jpg_decode)( vbyte *data, int dataLen, vbyte *out, int width, int height, int stride, int format, int flags ) { | ||||
| #if defined(HL_CONSOLE) && !defined(HL_XBO) | ||||
| 	hl_blocking(true); | ||||
| 	bool b = sys_jpg_decode(data, dataLen, out, width, height, stride, format, flags); | ||||
| 	hl_blocking(false); | ||||
| 	return b; | ||||
| #else | ||||
| 	hl_blocking(true); | ||||
| 	tjhandle h = tjInitDecompress(); | ||||
| 	int result; | ||||
| 	result = tjDecompress2(h,data,dataLen,out,width,stride,height,format,(flags & 1 ? TJFLAG_BOTTOMUP : 0)); | ||||
| 	tjDestroy(h); | ||||
| 	hl_blocking(false); | ||||
| 	return result == 0; | ||||
| #endif | ||||
| } | ||||
|  | ||||
| HL_PRIM bool HL_NAME(png_decode)( vbyte *data, int dataLen, vbyte *out, int width, int height, int stride, int format, int flags ) { | ||||
| #	ifdef PNG_IMAGE_VERSION | ||||
| 	png_image img; | ||||
| 	hl_blocking(true); | ||||
| 	memset(&img, 0, sizeof(img)); | ||||
| 	img.version = PNG_IMAGE_VERSION; | ||||
| 	if( png_image_begin_read_from_memory(&img,data,dataLen) == 0 ) { | ||||
| 		hl_blocking(false); | ||||
| 		png_image_free(&img); | ||||
| 		return false; | ||||
| 	} | ||||
| 	switch( format ) { | ||||
| 	case 0: | ||||
| 		img.format = PNG_FORMAT_RGB; | ||||
| 		break; | ||||
| 	case 1: | ||||
| 		img.format = PNG_FORMAT_BGR; | ||||
| 		break; | ||||
| 	case 7: | ||||
| 		img.format = PNG_FORMAT_RGBA; | ||||
| 		break; | ||||
| 	case 8: | ||||
| 		img.format = PNG_FORMAT_BGRA; | ||||
| 		break; | ||||
| 	case 9: | ||||
| 		img.format = PNG_FORMAT_ABGR; | ||||
| 		break; | ||||
| 	case 10: | ||||
| 		img.format = PNG_FORMAT_ARGB; | ||||
| 		break; | ||||
| 	case 12: | ||||
| 		img.format = PNG_FORMAT_LINEAR_Y; | ||||
| 		break; | ||||
| 	case 13: | ||||
| 		img.format = PNG_FORMAT_LINEAR_RGB; | ||||
| 		break; | ||||
| 	case 14: | ||||
| 		img.format = PNG_FORMAT_LINEAR_RGB_ALPHA; | ||||
| 		break; | ||||
| 	case 15: | ||||
| 		img.format = PNG_FORMAT_LINEAR_Y_ALPHA; | ||||
| 		break; | ||||
| 	default: | ||||
| 		hl_blocking(false); | ||||
| 		png_image_free(&img); | ||||
| 		hl_error("Unsupported format"); | ||||
| 		break; | ||||
| 	} | ||||
| 	if( img.width != width || img.height != height ) { | ||||
| 		hl_blocking(false); | ||||
| 		png_image_free(&img); | ||||
| 		return false; | ||||
| 	} | ||||
| 	if( png_image_finish_read(&img,NULL,out,stride * (flags & 1 ? -1 : 1),NULL) == 0 ) { | ||||
| 		hl_blocking(false); | ||||
| 		png_image_free(&img); | ||||
| 		return false; | ||||
| 	} | ||||
| 	hl_blocking(false); | ||||
| 	png_image_free(&img); | ||||
| #	else | ||||
| 	hl_error("PNG support is missing for this libPNG version"); | ||||
| #	endif | ||||
| 	return true; | ||||
| }*/ | ||||
|  | ||||
| HL_PRIM void HL_NAME(img_scale)( vbyte *out, int outPos, int outStride, int outWidth, int outHeight, vbyte *in, int inPos, int inStride, int inWidth, int inHeight, int flags ) { | ||||
| 	int x, y; | ||||
| 	float scaleX = outWidth <= 1 ? 0.0f : (float)((inWidth - 1.001f) / (outWidth - 1)); | ||||
| 	float scaleY = outHeight <= 1 ? 0.0f : (float)((inHeight - 1.001f) / (outHeight - 1)); | ||||
| 	out += outPos; | ||||
| 	in += inPos; | ||||
| 	hl_blocking(true); | ||||
| 	for(y=0;y<outHeight;y++) { | ||||
| 		for(x=0;x<outWidth;x++) { | ||||
| 			float fx = x * scaleX; | ||||
| 			float fy = y * scaleY; | ||||
| 			int ix = (int)fx; | ||||
| 			int iy = (int)fy; | ||||
| 			if( (flags & 1) == 0 ) { | ||||
| 				// nearest | ||||
| 				vbyte *rin = in + iy * inStride; | ||||
| 				*(pixel*)out = *(pixel*)(rin + (ix<<2)); | ||||
| 				out += 4; | ||||
| 			} else { | ||||
| 				// bilinear | ||||
| 				float rx = fx - ix; | ||||
| 				float ry = fy - iy; | ||||
| 				float rx1 = 1.0f - rx; | ||||
| 				float ry1 = 1.0f - ry; | ||||
| 				int w1 = (int)(rx1 * ry1 * 256.0f); | ||||
| 				int w2 = (int)(rx * ry1 * 256.0f); | ||||
| 				int w3 = (int)(rx1 * ry * 256.0f); | ||||
| 				int w4 = (int)(rx * ry * 256.0f); | ||||
| 				vbyte *rin = in + iy * inStride; | ||||
| 				pixel p1 = *(pixel*)(rin + (ix<<2)); | ||||
| 				pixel p2 = *(pixel*)(rin + ((ix + 1)<<2)); | ||||
| 				pixel p3 = *(pixel*)(rin + inStride + (ix<<2)); | ||||
| 				pixel p4 = *(pixel*)(rin + inStride + ((ix + 1)<<2)); | ||||
| 				*out++ = (unsigned char)((p1.a * w1 + p2.a * w2 + p3.a * w3 + p4.a * w4 + 128)>>8); | ||||
| 				*out++ = (unsigned char)((p1.r * w1 + p2.r * w2 + p3.r * w3 + p4.r * w4 + 128)>>8); | ||||
| 				*out++ = (unsigned char)((p1.g * w1 + p2.g * w2 + p3.g * w3 + p4.g * w4 + 128)>>8); | ||||
| 				*out++ = (unsigned char)((p1.b * w1 + p2.b * w2 + p3.b * w3 + p4.b * w4 + 128)>>8); | ||||
| 			} | ||||
| 		} | ||||
| 		out += outStride - (outWidth << 2); | ||||
| 	} | ||||
| 	hl_blocking(false); | ||||
| } | ||||
|  | ||||
|  | ||||
| DEFINE_PRIM(_BOOL, jpg_decode, _BYTES _I32 _BYTES _I32 _I32 _I32 _I32 _I32); | ||||
| DEFINE_PRIM(_BOOL, png_decode, _BYTES _I32 _BYTES _I32 _I32 _I32 _I32 _I32); | ||||
| DEFINE_PRIM(_VOID, img_scale, _BYTES _I32 _I32 _I32 _I32 _BYTES _I32 _I32 _I32 _I32 _I32); | ||||
|  | ||||
|  | ||||
| /* ------------------------------------------------- ZLIB --------------------------------------------------- */ | ||||
|  | ||||
| typedef struct _fmt_zip fmt_zip; | ||||
| struct _fmt_zip { | ||||
| 	void (*finalize)( fmt_zip * ); | ||||
| 	z_stream *z; | ||||
| 	int flush; | ||||
| 	bool inflate; | ||||
| }; | ||||
|  | ||||
| static void free_stream_inf( fmt_zip *v ) { | ||||
| 	if( v->inflate ) | ||||
| 		inflateEnd(v->z); // no error | ||||
| 	else | ||||
| 		deflateEnd(v->z); | ||||
| 	free(v->z); | ||||
| 	v->z = NULL; | ||||
| 	v->finalize = NULL; | ||||
| } | ||||
|  | ||||
| static void zlib_error( z_stream *z, int err ) { | ||||
| 	hl_buffer *b = hl_alloc_buffer(); | ||||
| 	vdynamic *d; | ||||
| 	hl_buffer_cstr(b, "ZLib Error : "); | ||||
| 	if( z && z->msg ) { | ||||
| 		hl_buffer_cstr(b,z->msg); | ||||
| 		hl_buffer_cstr(b," ("); | ||||
| 	} | ||||
| 	d = hl_alloc_dynamic(&hlt_i32); | ||||
| 	d->v.i = err; | ||||
| 	hl_buffer_val(b,d); | ||||
| 	if( z && z->msg ) | ||||
| 		hl_buffer_char(b,')'); | ||||
| 	d = hl_alloc_dynamic(&hlt_bytes); | ||||
| 	d->v.ptr = hl_buffer_content(b,NULL); | ||||
| 	hl_throw(d); | ||||
| } | ||||
|  | ||||
| HL_PRIM fmt_zip *HL_NAME(inflate_init)( int wbits ) { | ||||
| 	z_stream *z; | ||||
| 	int err; | ||||
| 	fmt_zip *s; | ||||
| 	if( wbits == 0 ) | ||||
| 		wbits = MAX_WBITS; | ||||
| 	z = (z_stream*)malloc(sizeof(z_stream)); | ||||
| 	memset(z,0,sizeof(z_stream)); | ||||
| 	if( (err = inflateInit2(z,wbits)) != Z_OK ) { | ||||
| 		free(z); | ||||
| 		zlib_error(NULL,err); | ||||
| 	} | ||||
| 	s = (fmt_zip*)hl_gc_alloc_finalizer(sizeof(fmt_zip)); | ||||
| 	s->finalize = free_stream_inf; | ||||
| 	s->flush = Z_NO_FLUSH; | ||||
| 	s->z = z; | ||||
| 	s->inflate = true; | ||||
| 	return s; | ||||
| } | ||||
|  | ||||
| HL_PRIM fmt_zip *HL_NAME(deflate_init)( int level ) { | ||||
| 	z_stream *z; | ||||
| 	int err; | ||||
| 	fmt_zip *s; | ||||
| 	z = (z_stream*)malloc(sizeof(z_stream)); | ||||
| 	memset(z,0,sizeof(z_stream)); | ||||
| 	if( (err = deflateInit(z,level)) != Z_OK ) { | ||||
| 		free(z); | ||||
| 		zlib_error(NULL,err); | ||||
| 	} | ||||
| 	s = (fmt_zip*)hl_gc_alloc_finalizer(sizeof(fmt_zip)); | ||||
| 	s->finalize = free_stream_inf; | ||||
| 	s->flush = Z_NO_FLUSH; | ||||
| 	s->z = z; | ||||
| 	s->inflate = false; | ||||
| 	return s; | ||||
| } | ||||
|  | ||||
| HL_PRIM void HL_NAME(zip_end)( fmt_zip *z ) { | ||||
| 	free_stream_inf(z); | ||||
| } | ||||
|  | ||||
| HL_PRIM void HL_NAME(zip_flush_mode)( fmt_zip *z, int flush ) { | ||||
| 	switch( flush ) { | ||||
| 	case 0: | ||||
| 		z->flush = Z_NO_FLUSH; | ||||
| 		break; | ||||
| 	case 1: | ||||
| 		z->flush = Z_SYNC_FLUSH; | ||||
| 		break; | ||||
| 	case 2: | ||||
| 		z->flush = Z_FULL_FLUSH; | ||||
| 		break; | ||||
| 	case 3: | ||||
| 		z->flush = Z_FINISH; | ||||
| 		break; | ||||
| 	case 4: | ||||
| 		z->flush = Z_BLOCK; | ||||
| 		break; | ||||
| 	default: | ||||
| 		hl_error("Invalid flush mode %d",flush); | ||||
| 		break; | ||||
| 	} | ||||
| } | ||||
|  | ||||
| HL_PRIM bool HL_NAME(inflate_buffer)( fmt_zip *zip, vbyte *src, int srcpos, int srclen, vbyte *dst, int dstpos, int dstlen, int *read, int *write ) { | ||||
| 	int slen, dlen, err; | ||||
| 	z_stream *z = zip->z; | ||||
| 	slen = srclen - srcpos; | ||||
| 	dlen = dstlen - dstpos; | ||||
| 	if( srcpos < 0 || dstpos < 0 || slen < 0 || dlen < 0 ) | ||||
| 		hl_error("Out of range"); | ||||
| 	hl_blocking(true); | ||||
| 	z->next_in = (Bytef*)(src + srcpos); | ||||
| 	z->next_out = (Bytef*)(dst + dstpos); | ||||
| 	z->avail_in = slen; | ||||
| 	z->avail_out = dlen; | ||||
| 	if( (err = inflate(z,zip->flush)) < 0 ) { | ||||
| 		hl_blocking(false); | ||||
| 		zlib_error(z,err); | ||||
| 	} | ||||
| 	z->next_in = NULL; | ||||
| 	z->next_out = NULL; | ||||
| 	*read = slen - z->avail_in; | ||||
| 	*write = dlen - z->avail_out; | ||||
| 	hl_blocking(false); | ||||
| 	return err == Z_STREAM_END; | ||||
| } | ||||
|  | ||||
| HL_PRIM bool HL_NAME(deflate_buffer)( fmt_zip *zip, vbyte *src, int srcpos, int srclen, vbyte *dst, int dstpos, int dstlen, int *read, int *write ) { | ||||
| 	int slen, dlen, err; | ||||
| 	z_stream *z = zip->z; | ||||
| 	slen = srclen - srcpos; | ||||
| 	dlen = dstlen - dstpos; | ||||
| 	if( srcpos < 0 || dstpos < 0 || slen < 0 || dlen < 0 ) | ||||
| 		hl_error("Out of range"); | ||||
| 	hl_blocking(true); | ||||
| 	z->next_in = (Bytef*)(src + srcpos); | ||||
| 	z->next_out = (Bytef*)(dst + dstpos); | ||||
| 	z->avail_in = slen; | ||||
| 	z->avail_out = dlen; | ||||
| 	if( (err = deflate(z,zip->flush)) < 0 ) { | ||||
| 		hl_blocking(false); | ||||
| 		zlib_error(z,err); | ||||
| 	} | ||||
| 	z->next_in = NULL; | ||||
| 	z->next_out = NULL; | ||||
| 	*read = slen - z->avail_in; | ||||
| 	*write = dlen - z->avail_out; | ||||
| 	hl_blocking(false); | ||||
| 	return err == Z_STREAM_END; | ||||
| } | ||||
|  | ||||
| HL_PRIM int HL_NAME(deflate_bound)( fmt_zip *zip, int size ) { | ||||
| 	return deflateBound(zip->z,size); | ||||
| } | ||||
|  | ||||
| #define _ZIP _ABSTRACT(fmt_zip) | ||||
|  | ||||
| DEFINE_PRIM(_ZIP, inflate_init, _I32); | ||||
| DEFINE_PRIM(_ZIP, deflate_init, _I32); | ||||
| DEFINE_PRIM(_I32, deflate_bound, _ZIP _I32); | ||||
| DEFINE_PRIM(_VOID, zip_end, _ZIP); | ||||
| DEFINE_PRIM(_VOID, zip_flush_mode, _ZIP _I32); | ||||
| DEFINE_PRIM(_BOOL, inflate_buffer, _ZIP _BYTES _I32 _I32 _BYTES _I32 _I32 _REF(_I32) _REF(_I32)); | ||||
| DEFINE_PRIM(_BOOL, deflate_buffer, _ZIP _BYTES _I32 _I32 _BYTES _I32 _I32 _REF(_I32) _REF(_I32)); | ||||
|  | ||||
| /* ----------------------------------------------- SOUND : OGG ------------------------------------------------ */ | ||||
|  | ||||
| /*typedef struct _fmt_ogg fmt_ogg; | ||||
| struct _fmt_ogg { | ||||
| 	void (*finalize)( fmt_ogg * ); | ||||
| 	OggVorbis_File f; | ||||
| 	char *bytes; | ||||
| 	int pos; | ||||
| 	int size; | ||||
| 	int section; | ||||
| }; | ||||
|  | ||||
| static void ogg_finalize( fmt_ogg *o ) { | ||||
| 	ov_clear(&o->f); | ||||
| } | ||||
|  | ||||
| static size_t ogg_memread( void *ptr, int size, int count, fmt_ogg *o ) { | ||||
| 	int len = size * count; | ||||
| 	if( o->pos + len > o->size ) | ||||
| 		len = o->size - o->pos; | ||||
| 	memcpy(ptr, o->bytes + o->pos, len); | ||||
| 	o->pos += len; | ||||
| 	return len; | ||||
| } | ||||
|  | ||||
| static int ogg_memseek( fmt_ogg *o, ogg_int64_t _offset, int mode ) { | ||||
| 	int offset = (int)_offset; | ||||
| 	switch( mode ) { | ||||
| 	case SEEK_SET: | ||||
| 		if( offset < 0 || offset > o->size ) return 1; | ||||
| 		o->pos = offset; | ||||
| 		break; | ||||
| 	case SEEK_CUR: | ||||
| 		if( o->pos + offset < 0 || o->pos + offset > o->size ) return 1; | ||||
| 		o->pos += offset; | ||||
| 		break; | ||||
| 	case SEEK_END: | ||||
| 		if( offset < 0 || offset > o->size ) return 1; | ||||
| 		o->pos = o->size - offset; | ||||
| 		break; | ||||
| 	} | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
| static long ogg_memtell( fmt_ogg *o ) { | ||||
| 	return o->pos; | ||||
| } | ||||
|  | ||||
| static ov_callbacks OV_CALLBACKS_MEMORY = { | ||||
|   (size_t (*)(void *, size_t, size_t, void *))  ogg_memread, | ||||
|   (int (*)(void *, ogg_int64_t, int))           ogg_memseek, | ||||
|   (int (*)(void *))                             NULL, | ||||
|   (long (*)(void *))                            ogg_memtell | ||||
| }; | ||||
|  | ||||
| HL_PRIM fmt_ogg *HL_NAME(ogg_open)( char *bytes, int size ) { | ||||
| 	fmt_ogg *o = (fmt_ogg*)hl_gc_alloc_finalizer(sizeof(fmt_ogg)); | ||||
| 	o->finalize = NULL; | ||||
| 	o->bytes = bytes; | ||||
| 	o->size = size; | ||||
| 	o->pos = 0; | ||||
| 	if( ov_open_callbacks(o,&o->f,NULL,0,OV_CALLBACKS_MEMORY) != 0 ) | ||||
| 		return NULL; | ||||
| 	o->finalize = ogg_finalize; | ||||
| 	return o; | ||||
| } | ||||
|  | ||||
| HL_PRIM void HL_NAME(ogg_info)( fmt_ogg *o, int *bitrate, int *freq, int *samples, int *channels ) { | ||||
| 	vorbis_info *i = ov_info(&o->f,-1); | ||||
| 	*bitrate = i->bitrate_nominal; | ||||
| 	*freq = i->rate; | ||||
| 	*channels = i->channels; | ||||
| 	*samples = (int)ov_pcm_total(&o->f, -1); | ||||
| } | ||||
|  | ||||
| HL_PRIM int HL_NAME(ogg_tell)( fmt_ogg *o ) { | ||||
| 	return (int)ov_pcm_tell(&o->f); // overflow at 12 hours @48 Khz | ||||
| } | ||||
|  | ||||
| HL_PRIM bool HL_NAME(ogg_seek)( fmt_ogg *o, int sample ) { | ||||
| 	return ov_pcm_seek(&o->f,sample) == 0; | ||||
| } | ||||
|  | ||||
| #define OGGFMT_I8			1 | ||||
| #define OGGFMT_I16			2 | ||||
| //#define OGGFMT_F32		3 | ||||
| #define OGGFMT_BIGENDIAN	128 | ||||
| #define OGGFMT_UNSIGNED		256 | ||||
|  | ||||
| HL_PRIM int HL_NAME(ogg_read)( fmt_ogg *o, char *output, int size, int format ) { | ||||
| 	int ret = -1; | ||||
| 	hl_blocking(true); | ||||
| 	switch( format&127 ) { | ||||
| 	case OGGFMT_I8: | ||||
| 	case OGGFMT_I16: | ||||
| 		ret = ov_read(&o->f, output, size, (format & OGGFMT_BIGENDIAN) != 0, format&3, (format & OGGFMT_UNSIGNED) == 0, &o->section); | ||||
| 		break; | ||||
| //	case OGGFMT_F32: | ||||
| //		-- this decodes separates channels instead of mixed single buffer one | ||||
| //		return ov_read_float(&o->f, output, size, (format & OGGFMT_BIGENDIAN) != 0, format&3, (format & OGGFMT_UNSIGNED) == 0, &o->section); | ||||
| 	default: | ||||
| 		break; | ||||
| 	} | ||||
| 	hl_blocking(false); | ||||
| 	return ret; | ||||
| } | ||||
|  | ||||
| #define _OGG _ABSTRACT(fmt_ogg) | ||||
|  | ||||
| DEFINE_PRIM(_OGG, ogg_open, _BYTES _I32); | ||||
| DEFINE_PRIM(_VOID, ogg_info, _OGG _REF(_I32) _REF(_I32) _REF(_I32) _REF(_I32)); | ||||
| DEFINE_PRIM(_I32, ogg_tell, _OGG); | ||||
| DEFINE_PRIM(_BOOL, ogg_seek, _OGG _I32); | ||||
| DEFINE_PRIM(_I32, ogg_read, _OGG _BYTES _I32 _I32);*/ | ||||
|  | ||||
| /* ----------------------------------------------- SOUND : MP3 ------------------------------------------------ */ | ||||
|  | ||||
| /*typedef struct _fmt_mp3 fmt_mp3; | ||||
| struct _fmt_mp3 { | ||||
| 	mp3dec_t dec; | ||||
| 	mp3dec_frame_info_t info; | ||||
| 	mp3d_sample_t pcm[MINIMP3_MAX_SAMPLES_PER_FRAME]; | ||||
| };*/ | ||||
|  | ||||
| // Allocate MP3 reader. | ||||
| /*HL_PRIM fmt_mp3 *HL_NAME(mp3_open)() { | ||||
| 	fmt_mp3 *o = (fmt_mp3*)hl_gc_alloc_noptr(sizeof(fmt_mp3)); | ||||
| 	mp3dec_init(&o->dec); | ||||
| 	return o; | ||||
| }*/ | ||||
|  | ||||
| /** | ||||
| 	Retreive last decoded frame information. | ||||
| 	@param bitrate_kbps Bitrate of the frame | ||||
| 	@param channels Total amount of channels in the frame. | ||||
| 	@param frame_bytes The size of the frame in the input stream, | ||||
| 	@param hz | ||||
| 	@param layer Mpeg Layer index (usually 3). | ||||
| **/ | ||||
| /*HL_PRIM void HL_NAME(mp3_frame_info)(fmt_mp3 *o, int *bitrate_kbps, int *channels, int *frame_bytes, int *hz, int *layer) { | ||||
| 	*bitrate_kbps = o->info.bitrate_kbps; | ||||
| 	*channels = o->info.channels; | ||||
| 	*frame_bytes = o->info.frame_bytes; | ||||
| 	*hz = o->info.hz; | ||||
| 	*layer = o->info.layer; | ||||
| }*/ | ||||
|  | ||||
| /** | ||||
| 	Decodes a single frame from input stream and writes result to output. | ||||
| 	Decoded samples are in Float32 format. Output bytes should contain enough space to fit entire frame in. | ||||
| 	To calculate required output size, follow next formula: `samples * channels * 4`. | ||||
| 	For Layer 1, amount of frames is 384, MPEG 2 Layer 2 is 576 and 1152 otherwise. Using 1152 samples is the safest. | ||||
| 	@param o Allocated MP3 reader. | ||||
| 	@param bytes Input stream. | ||||
| 	@param size Input stream size. | ||||
| 	@param position Input stream offset. | ||||
| 	@param output Output stream. | ||||
| 	@param outputSize Output stream size. | ||||
| 	@param offset Output stream write offset. | ||||
| 	@returns 0 if no MP3 data was found (end of stream/invalid data), -1 if either input buffer position invalid or output size is insufficent. | ||||
| 		Amount of decoded samples otherwise. | ||||
| **/ | ||||
| /*HL_PRIM int HL_NAME(mp3_decode_frame)( fmt_mp3 *o, char *bytes, int size, int position, char *output, int outputSize, int offset ) { | ||||
|  | ||||
| 	// Out of mp3 file bounds. | ||||
| 	if ( position < 0 || size <= position ) | ||||
| 		return -1; | ||||
|  | ||||
| 	int samples = 0; | ||||
| 	hl_blocking(true); | ||||
|  | ||||
| 	do { | ||||
| 		samples = mp3dec_decode_frame(&o->dec, (unsigned char*)bytes + position, size - position, o->pcm, &o->info); | ||||
| 		// Try to read until found mp3 data or EOF. | ||||
| 		if ( samples != 0 || o->info.frame_bytes == 0 ) | ||||
| 			break; | ||||
| 		position += o->info.frame_bytes; | ||||
| 	} while ( size > position ); | ||||
|  | ||||
| 	// No or invalid MP3 data. | ||||
| 	if ( samples == 0 || o->info.frame_bytes == 0 ) { | ||||
| 		hl_blocking(false); | ||||
| 		return 0; | ||||
| 	} | ||||
|  | ||||
| 	int decodedSize = samples * o->info.channels * sizeof(mp3d_sample_t); | ||||
| 	// Insufficent output buffer size. | ||||
| 	if ( outputSize - offset < decodedSize ) { | ||||
| 		hl_blocking(false); | ||||
| 		return -1; | ||||
| 	} | ||||
|  | ||||
| 	memcpy( (void *)(output + offset), (void *)o->pcm, decodedSize ); | ||||
|  | ||||
| 	hl_blocking(false); | ||||
| 	return samples; | ||||
| } | ||||
|  | ||||
| #define _MP3 _ABSTRACT(fmt_mp3) | ||||
|  | ||||
| DEFINE_PRIM(_MP3, mp3_open, _BYTES _I32); | ||||
| DEFINE_PRIM(_VOID, mp3_frame_info, _MP3 _REF(_I32) _REF(_I32) _REF(_I32) _REF(_I32) _REF(_I32)) | ||||
| DEFINE_PRIM(_I32, mp3_decode_frame, _MP3 _BYTES _I32 _I32 _BYTES _I32 _I32);*/ | ||||
|  | ||||
| /* ------------------------------------------------- CRYPTO --------------------------------------------------- */ | ||||
|  | ||||
| typedef unsigned int uint32; | ||||
| typedef unsigned char uint8; | ||||
|  | ||||
| typedef struct { | ||||
|     uint32 total[2]; | ||||
|     uint32 state[4]; | ||||
|     uint8 buffer[64]; | ||||
| } md5_context; | ||||
|  | ||||
| #define GET_UINT32(n,b,i)                       \ | ||||
| {                                               \ | ||||
|     (n) = ( (uint32) (b)[(i)    ]       )       \ | ||||
|         | ( (uint32) (b)[(i) + 1] <<  8 )       \ | ||||
|         | ( (uint32) (b)[(i) + 2] << 16 )       \ | ||||
|         | ( (uint32) (b)[(i) + 3] << 24 );      \ | ||||
| } | ||||
|  | ||||
| #define PUT_UINT32(n,b,i)                       \ | ||||
| {                                               \ | ||||
|     (b)[(i)    ] = (uint8) ( (n)       );       \ | ||||
|     (b)[(i) + 1] = (uint8) ( (n) >>  8 );       \ | ||||
|     (b)[(i) + 2] = (uint8) ( (n) >> 16 );       \ | ||||
|     (b)[(i) + 3] = (uint8) ( (n) >> 24 );       \ | ||||
| } | ||||
|  | ||||
| static void md5_starts( md5_context *ctx ) { | ||||
|     ctx->total[0] = 0; | ||||
|     ctx->total[1] = 0; | ||||
|     ctx->state[0] = 0x67452301; | ||||
|     ctx->state[1] = 0xEFCDAB89; | ||||
|     ctx->state[2] = 0x98BADCFE; | ||||
|     ctx->state[3] = 0x10325476; | ||||
| } | ||||
|  | ||||
| static void md5_process( md5_context *ctx, uint8 data[64] ) { | ||||
|     uint32 X[16], A, B, C, D; | ||||
|     GET_UINT32( X[0],  data,  0 ); | ||||
|     GET_UINT32( X[1],  data,  4 ); | ||||
|     GET_UINT32( X[2],  data,  8 ); | ||||
|     GET_UINT32( X[3],  data, 12 ); | ||||
|     GET_UINT32( X[4],  data, 16 ); | ||||
|     GET_UINT32( X[5],  data, 20 ); | ||||
|     GET_UINT32( X[6],  data, 24 ); | ||||
|     GET_UINT32( X[7],  data, 28 ); | ||||
|     GET_UINT32( X[8],  data, 32 ); | ||||
|     GET_UINT32( X[9],  data, 36 ); | ||||
|     GET_UINT32( X[10], data, 40 ); | ||||
|     GET_UINT32( X[11], data, 44 ); | ||||
|     GET_UINT32( X[12], data, 48 ); | ||||
|     GET_UINT32( X[13], data, 52 ); | ||||
|     GET_UINT32( X[14], data, 56 ); | ||||
|     GET_UINT32( X[15], data, 60 ); | ||||
|  | ||||
| #define S(x,n) ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n))) | ||||
|  | ||||
| #define P(a,b,c,d,k,s,t)                                \ | ||||
| {                                                       \ | ||||
|     a += F(b,c,d) + X[k] + t; a = S(a,s) + b;           \ | ||||
| } | ||||
|  | ||||
|     A = ctx->state[0]; | ||||
|     B = ctx->state[1]; | ||||
|     C = ctx->state[2]; | ||||
|     D = ctx->state[3]; | ||||
|  | ||||
| #define F(x,y,z) (z ^ (x & (y ^ z))) | ||||
|  | ||||
|     P( A, B, C, D,  0,  7, 0xD76AA478 ); | ||||
|     P( D, A, B, C,  1, 12, 0xE8C7B756 ); | ||||
|     P( C, D, A, B,  2, 17, 0x242070DB ); | ||||
|     P( B, C, D, A,  3, 22, 0xC1BDCEEE ); | ||||
|     P( A, B, C, D,  4,  7, 0xF57C0FAF ); | ||||
|     P( D, A, B, C,  5, 12, 0x4787C62A ); | ||||
|     P( C, D, A, B,  6, 17, 0xA8304613 ); | ||||
|     P( B, C, D, A,  7, 22, 0xFD469501 ); | ||||
|     P( A, B, C, D,  8,  7, 0x698098D8 ); | ||||
|     P( D, A, B, C,  9, 12, 0x8B44F7AF ); | ||||
|     P( C, D, A, B, 10, 17, 0xFFFF5BB1 ); | ||||
|     P( B, C, D, A, 11, 22, 0x895CD7BE ); | ||||
|     P( A, B, C, D, 12,  7, 0x6B901122 ); | ||||
|     P( D, A, B, C, 13, 12, 0xFD987193 ); | ||||
|     P( C, D, A, B, 14, 17, 0xA679438E ); | ||||
|     P( B, C, D, A, 15, 22, 0x49B40821 ); | ||||
|  | ||||
| #undef F | ||||
|  | ||||
| #define F(x,y,z) (y ^ (z & (x ^ y))) | ||||
|  | ||||
|     P( A, B, C, D,  1,  5, 0xF61E2562 ); | ||||
|     P( D, A, B, C,  6,  9, 0xC040B340 ); | ||||
|     P( C, D, A, B, 11, 14, 0x265E5A51 ); | ||||
|     P( B, C, D, A,  0, 20, 0xE9B6C7AA ); | ||||
|     P( A, B, C, D,  5,  5, 0xD62F105D ); | ||||
|     P( D, A, B, C, 10,  9, 0x02441453 ); | ||||
|     P( C, D, A, B, 15, 14, 0xD8A1E681 ); | ||||
|     P( B, C, D, A,  4, 20, 0xE7D3FBC8 ); | ||||
|     P( A, B, C, D,  9,  5, 0x21E1CDE6 ); | ||||
|     P( D, A, B, C, 14,  9, 0xC33707D6 ); | ||||
|     P( C, D, A, B,  3, 14, 0xF4D50D87 ); | ||||
|     P( B, C, D, A,  8, 20, 0x455A14ED ); | ||||
|     P( A, B, C, D, 13,  5, 0xA9E3E905 ); | ||||
|     P( D, A, B, C,  2,  9, 0xFCEFA3F8 ); | ||||
|     P( C, D, A, B,  7, 14, 0x676F02D9 ); | ||||
|     P( B, C, D, A, 12, 20, 0x8D2A4C8A ); | ||||
|  | ||||
| #undef F | ||||
|      | ||||
| #define F(x,y,z) (x ^ y ^ z) | ||||
|  | ||||
|     P( A, B, C, D,  5,  4, 0xFFFA3942 ); | ||||
|     P( D, A, B, C,  8, 11, 0x8771F681 ); | ||||
|     P( C, D, A, B, 11, 16, 0x6D9D6122 ); | ||||
|     P( B, C, D, A, 14, 23, 0xFDE5380C ); | ||||
|     P( A, B, C, D,  1,  4, 0xA4BEEA44 ); | ||||
|     P( D, A, B, C,  4, 11, 0x4BDECFA9 ); | ||||
|     P( C, D, A, B,  7, 16, 0xF6BB4B60 ); | ||||
|     P( B, C, D, A, 10, 23, 0xBEBFBC70 ); | ||||
|     P( A, B, C, D, 13,  4, 0x289B7EC6 ); | ||||
|     P( D, A, B, C,  0, 11, 0xEAA127FA ); | ||||
|     P( C, D, A, B,  3, 16, 0xD4EF3085 ); | ||||
|     P( B, C, D, A,  6, 23, 0x04881D05 ); | ||||
|     P( A, B, C, D,  9,  4, 0xD9D4D039 ); | ||||
|     P( D, A, B, C, 12, 11, 0xE6DB99E5 ); | ||||
|     P( C, D, A, B, 15, 16, 0x1FA27CF8 ); | ||||
|     P( B, C, D, A,  2, 23, 0xC4AC5665 ); | ||||
|  | ||||
| #undef F | ||||
|  | ||||
| #define F(x,y,z) (y ^ (x | ~z)) | ||||
|  | ||||
|     P( A, B, C, D,  0,  6, 0xF4292244 ); | ||||
|     P( D, A, B, C,  7, 10, 0x432AFF97 ); | ||||
|     P( C, D, A, B, 14, 15, 0xAB9423A7 ); | ||||
|     P( B, C, D, A,  5, 21, 0xFC93A039 ); | ||||
|     P( A, B, C, D, 12,  6, 0x655B59C3 ); | ||||
|     P( D, A, B, C,  3, 10, 0x8F0CCC92 ); | ||||
|     P( C, D, A, B, 10, 15, 0xFFEFF47D ); | ||||
|     P( B, C, D, A,  1, 21, 0x85845DD1 ); | ||||
|     P( A, B, C, D,  8,  6, 0x6FA87E4F ); | ||||
|     P( D, A, B, C, 15, 10, 0xFE2CE6E0 ); | ||||
|     P( C, D, A, B,  6, 15, 0xA3014314 ); | ||||
|     P( B, C, D, A, 13, 21, 0x4E0811A1 ); | ||||
|     P( A, B, C, D,  4,  6, 0xF7537E82 ); | ||||
|     P( D, A, B, C, 11, 10, 0xBD3AF235 ); | ||||
|     P( C, D, A, B,  2, 15, 0x2AD7D2BB ); | ||||
|     P( B, C, D, A,  9, 21, 0xEB86D391 ); | ||||
|  | ||||
| #undef F | ||||
|  | ||||
|     ctx->state[0] += A; | ||||
|     ctx->state[1] += B; | ||||
|     ctx->state[2] += C; | ||||
|     ctx->state[3] += D; | ||||
| } | ||||
|  | ||||
| static void md5_update( md5_context *ctx, uint8 *input, uint32 length ) { | ||||
|     uint32 left, fill; | ||||
|     if( !length ) | ||||
| 		return; | ||||
|     left = ctx->total[0] & 0x3F; | ||||
|     fill = 64 - left; | ||||
|  | ||||
|     ctx->total[0] += length; | ||||
|     ctx->total[0] &= 0xFFFFFFFF; | ||||
|  | ||||
|     if( ctx->total[0] < length ) | ||||
|         ctx->total[1]++; | ||||
|  | ||||
|     if( left && length >= fill ) { | ||||
|         memcpy( (void *) (ctx->buffer + left), | ||||
|                 (void *) input, fill ); | ||||
|         md5_process( ctx, ctx->buffer ); | ||||
|         length -= fill; | ||||
|         input  += fill; | ||||
|         left = 0; | ||||
|     } | ||||
|  | ||||
|     while( length >= 64 ) { | ||||
|         md5_process( ctx, input ); | ||||
|         length -= 64; | ||||
|         input  += 64; | ||||
|     } | ||||
|  | ||||
|     if( length ) { | ||||
|         memcpy( (void *) (ctx->buffer + left), | ||||
|                 (void *) input, length ); | ||||
|     } | ||||
| } | ||||
|  | ||||
| static uint8 md5_padding[64] = | ||||
| { | ||||
|  0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||||
|     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||||
|     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||||
|     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 | ||||
| }; | ||||
|  | ||||
| static void md5_finish( md5_context *ctx, uint8 digest[16] ) { | ||||
|     uint32 last, padn; | ||||
|     uint32 high, low; | ||||
|     uint8 msglen[8]; | ||||
|  | ||||
|     high = ( ctx->total[0] >> 29 ) | ||||
|          | ( ctx->total[1] <<  3 ); | ||||
|     low  = ( ctx->total[0] <<  3 ); | ||||
|  | ||||
|     PUT_UINT32( low,  msglen, 0 ); | ||||
|     PUT_UINT32( high, msglen, 4 ); | ||||
|  | ||||
|     last = ctx->total[0] & 0x3F; | ||||
|     padn = ( last < 56 ) ? ( 56 - last ) : ( 120 - last ); | ||||
|  | ||||
|     md5_update( ctx, md5_padding, padn ); | ||||
|     md5_update( ctx, msglen, 8 ); | ||||
|  | ||||
|     PUT_UINT32( ctx->state[0], digest,  0 ); | ||||
|     PUT_UINT32( ctx->state[1], digest,  4 ); | ||||
|     PUT_UINT32( ctx->state[2], digest,  8 ); | ||||
|     PUT_UINT32( ctx->state[3], digest, 12 ); | ||||
| } | ||||
|  | ||||
| #include "sha1.h" | ||||
|  | ||||
| HL_PRIM void HL_NAME(digest)( vbyte *out, vbyte *in, int length, int format ) { | ||||
| 	if( format & 256 ) { | ||||
| 		in = (vbyte*)hl_to_utf8((uchar*)in); | ||||
| 		length = (int)strlen((char*)in); | ||||
| 	} | ||||
| 	hl_blocking(true); | ||||
| 	switch( format & 0xFF ) { | ||||
| 	case 0: | ||||
| 		{ | ||||
| 			md5_context ctx; | ||||
| 			md5_starts(&ctx); | ||||
| 			md5_update(&ctx,in,(uint32)length); | ||||
| 			md5_finish(&ctx,out); | ||||
| 		} | ||||
| 		break; | ||||
| 	case 1: | ||||
| 		{ | ||||
| 			SHA1_CTX ctx; | ||||
| 			sha1_init(&ctx); | ||||
| 			sha1_update(&ctx,in,length); | ||||
| 			sha1_final(&ctx,out); | ||||
| 		} | ||||
| 		break; | ||||
| 	case 2: | ||||
| 		*((int*)out) = crc32(*(int*)out, in, length); | ||||
| 		break; | ||||
| 	case 3: | ||||
| 		*((int*)out) = adler32(*(int*)out, in, length); | ||||
| 		break; | ||||
| 	default: | ||||
| 		hl_blocking(false); | ||||
| 		hl_error("Unknown digest format %d",format&0xFF); | ||||
| 		break; | ||||
| 	} | ||||
| 	hl_blocking(false); | ||||
| } | ||||
|  | ||||
| DEFINE_PRIM(_VOID, digest, _BYTES _BYTES _I32 _I32); | ||||
							
								
								
									
										398
									
								
								Kha/Backends/Kinc-HL/hl/libs/fmt/fmt.vcxproj
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										398
									
								
								Kha/Backends/Kinc-HL/hl/libs/fmt/fmt.vcxproj
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,398 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||||
|   <ItemGroup Label="ProjectConfigurations"> | ||||
|     <ProjectConfiguration Include="Debug|Win32"> | ||||
|       <Configuration>Debug</Configuration> | ||||
|       <Platform>Win32</Platform> | ||||
|     </ProjectConfiguration> | ||||
|     <ProjectConfiguration Include="ReleaseVS2013|Win32"> | ||||
|       <Configuration>ReleaseVS2013</Configuration> | ||||
|       <Platform>Win32</Platform> | ||||
|     </ProjectConfiguration> | ||||
|     <ProjectConfiguration Include="ReleaseVS2013|x64"> | ||||
|       <Configuration>ReleaseVS2013</Configuration> | ||||
|       <Platform>x64</Platform> | ||||
|     </ProjectConfiguration> | ||||
|     <ProjectConfiguration Include="Debug|x64"> | ||||
|       <Configuration>Debug</Configuration> | ||||
|       <Platform>x64</Platform> | ||||
|     </ProjectConfiguration> | ||||
|     <ProjectConfiguration Include="Release|Win32"> | ||||
|       <Configuration>Release</Configuration> | ||||
|       <Platform>Win32</Platform> | ||||
|     </ProjectConfiguration> | ||||
|     <ProjectConfiguration Include="Release|x64"> | ||||
|       <Configuration>Release</Configuration> | ||||
|       <Platform>x64</Platform> | ||||
|     </ProjectConfiguration> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <ClCompile Include="..\..\include\mikktspace\mikktspace.c" /> | ||||
|     <ClCompile Include="..\..\include\png\png.c" /> | ||||
|     <ClCompile Include="..\..\include\png\pngerror.c" /> | ||||
|     <ClCompile Include="..\..\include\png\pngget.c" /> | ||||
|     <ClCompile Include="..\..\include\png\pngmem.c" /> | ||||
|     <ClCompile Include="..\..\include\png\pngpread.c" /> | ||||
|     <ClCompile Include="..\..\include\png\pngread.c" /> | ||||
|     <ClCompile Include="..\..\include\png\pngrio.c" /> | ||||
|     <ClCompile Include="..\..\include\png\pngrtran.c" /> | ||||
|     <ClCompile Include="..\..\include\png\pngrutil.c" /> | ||||
|     <ClCompile Include="..\..\include\png\pngset.c" /> | ||||
|     <ClCompile Include="..\..\include\png\pngtrans.c" /> | ||||
|     <ClCompile Include="..\..\include\png\pngwio.c" /> | ||||
|     <ClCompile Include="..\..\include\png\pngwrite.c" /> | ||||
|     <ClCompile Include="..\..\include\png\pngwtran.c" /> | ||||
|     <ClCompile Include="..\..\include\png\pngwutil.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jaricom.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jcapimin.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jcapistd.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jcarith.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jccoefct.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jccolor.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jcdctmgr.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jchuff.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jcinit.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jcmainct.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jcmarker.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jcmaster.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jcomapi.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jcparam.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jcphuff.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jcprepct.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jcsample.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jctrans.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jdapimin.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jdapistd.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jdarith.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jdatadst-tj.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jdatadst.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jdatasrc-tj.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jdatasrc.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jdcoefct.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jdcolor.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jddctmgr.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jdhuff.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jdinput.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jdmainct.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jdmarker.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jdmaster.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jdmerge.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jdphuff.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jdpostct.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jdsample.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jdtrans.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jerror.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jfdctflt.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jfdctfst.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jfdctint.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jidctflt.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jidctfst.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jidctint.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jidctred.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jmemmgr.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jmemnobs.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jquant1.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jquant2.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jsimd.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jutils.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\transupp.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\turbojpeg.c" /> | ||||
|     <ClCompile Include="..\..\include\vorbis\bitrate.c" /> | ||||
|     <ClCompile Include="..\..\include\vorbis\bitwise.c" /> | ||||
|     <ClCompile Include="..\..\include\vorbis\block.c" /> | ||||
|     <ClCompile Include="..\..\include\vorbis\codebook.c" /> | ||||
|     <ClCompile Include="..\..\include\vorbis\envelope.c" /> | ||||
|     <ClCompile Include="..\..\include\vorbis\floor0.c" /> | ||||
|     <ClCompile Include="..\..\include\vorbis\floor1.c" /> | ||||
|     <ClCompile Include="..\..\include\vorbis\framing.c" /> | ||||
|     <ClCompile Include="..\..\include\vorbis\info.c" /> | ||||
|     <ClCompile Include="..\..\include\vorbis\lookup.c" /> | ||||
|     <ClCompile Include="..\..\include\vorbis\lpc.c" /> | ||||
|     <ClCompile Include="..\..\include\vorbis\lsp.c" /> | ||||
|     <ClCompile Include="..\..\include\vorbis\mapping0.c" /> | ||||
|     <ClCompile Include="..\..\include\vorbis\mdct.c" /> | ||||
|     <ClCompile Include="..\..\include\vorbis\psy.c" /> | ||||
|     <ClCompile Include="..\..\include\vorbis\registry.c" /> | ||||
|     <ClCompile Include="..\..\include\vorbis\res0.c" /> | ||||
|     <ClCompile Include="..\..\include\vorbis\sharedbook.c" /> | ||||
|     <ClCompile Include="..\..\include\vorbis\smallft.c" /> | ||||
|     <ClCompile Include="..\..\include\vorbis\synthesis.c" /> | ||||
|     <ClCompile Include="..\..\include\vorbis\vorbisfile.c" /> | ||||
|     <ClCompile Include="..\..\include\vorbis\window.c" /> | ||||
|     <ClCompile Include="..\..\include\zlib\adler32.c" /> | ||||
|     <ClCompile Include="..\..\include\zlib\crc32.c" /> | ||||
|     <ClCompile Include="..\..\include\zlib\deflate.c" /> | ||||
|     <ClCompile Include="..\..\include\zlib\inffast.c" /> | ||||
|     <ClCompile Include="..\..\include\zlib\inflate.c" /> | ||||
|     <ClCompile Include="..\..\include\zlib\inftrees.c" /> | ||||
|     <ClCompile Include="..\..\include\zlib\trees.c" /> | ||||
|     <ClCompile Include="..\..\include\zlib\zutil.c" /> | ||||
|     <ClCompile Include="dxt.c" /> | ||||
|     <ClCompile Include="fmt.c" /> | ||||
|     <ClCompile Include="mikkt.c" /> | ||||
|     <ClCompile Include="sha1.c" /> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <ClInclude Include="..\..\include\mikktspace\mikktspace.h" /> | ||||
|     <ClInclude Include="..\..\include\png\png.h" /> | ||||
|     <ClInclude Include="..\..\include\png\pngconf.h" /> | ||||
|     <ClInclude Include="..\..\include\png\pngdebug.h" /> | ||||
|     <ClInclude Include="..\..\include\png\pnginfo.h" /> | ||||
|     <ClInclude Include="..\..\include\png\pnglibconf.h" /> | ||||
|     <ClInclude Include="..\..\include\png\pngpriv.h" /> | ||||
|     <ClInclude Include="..\..\include\png\pngstruct.h" /> | ||||
|     <ClInclude Include="..\..\include\vorbis\backends.h" /> | ||||
|     <ClInclude Include="..\..\include\vorbis\bitrate.h" /> | ||||
|     <ClInclude Include="..\..\include\vorbis\codebook.h" /> | ||||
|     <ClInclude Include="..\..\include\vorbis\codec_internal.h" /> | ||||
|     <ClInclude Include="..\..\include\vorbis\envelope.h" /> | ||||
|     <ClInclude Include="..\..\include\vorbis\highlevel.h" /> | ||||
|     <ClInclude Include="..\..\include\vorbis\lookup.h" /> | ||||
|     <ClInclude Include="..\..\include\vorbis\lookup_data.h" /> | ||||
|     <ClInclude Include="..\..\include\vorbis\lpc.h" /> | ||||
|     <ClInclude Include="..\..\include\vorbis\lsp.h" /> | ||||
|     <ClInclude Include="..\..\include\vorbis\masking.h" /> | ||||
|     <ClInclude Include="..\..\include\vorbis\mdct.h" /> | ||||
|     <ClInclude Include="..\..\include\vorbis\misc.h" /> | ||||
|     <ClInclude Include="..\..\include\vorbis\os.h" /> | ||||
|     <ClInclude Include="..\..\include\vorbis\psy.h" /> | ||||
|     <ClInclude Include="..\..\include\vorbis\registry.h" /> | ||||
|     <ClInclude Include="..\..\include\vorbis\scales.h" /> | ||||
|     <ClInclude Include="..\..\include\vorbis\smallft.h" /> | ||||
|     <ClInclude Include="..\..\include\vorbis\window.h" /> | ||||
|     <ClInclude Include="..\..\include\zlib\crc32.h" /> | ||||
|     <ClInclude Include="..\..\include\zlib\deflate.h" /> | ||||
|     <ClInclude Include="..\..\include\zlib\inffast.h" /> | ||||
|     <ClInclude Include="..\..\include\zlib\inffixed.h" /> | ||||
|     <ClInclude Include="..\..\include\zlib\inflate.h" /> | ||||
|     <ClInclude Include="..\..\include\zlib\inftrees.h" /> | ||||
|     <ClInclude Include="..\..\include\zlib\trees.h" /> | ||||
|     <ClInclude Include="..\..\include\zlib\zconf.h" /> | ||||
|     <ClInclude Include="..\..\include\zlib\zlib.h" /> | ||||
|     <ClInclude Include="..\..\include\minimp3\minimp3.h" /> | ||||
|     <ClInclude Include="sha1.h" /> | ||||
|   </ItemGroup> | ||||
|   <PropertyGroup Label="Globals"> | ||||
|     <ProjectGuid>{7DDA1414-6675-45C7-8254-42057901F865}</ProjectGuid> | ||||
|     <Keyword>Win32Proj</Keyword> | ||||
|     <RootNamespace>jpg</RootNamespace> | ||||
|     <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> | ||||
|     <ProjectName>fmt</ProjectName> | ||||
|   </PropertyGroup> | ||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | ||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> | ||||
|     <ConfigurationType>DynamicLibrary</ConfigurationType> | ||||
|     <UseDebugLibraries>true</UseDebugLibraries> | ||||
|     <PlatformToolset>v142</PlatformToolset> | ||||
|     <CharacterSet>Unicode</CharacterSet> | ||||
|   </PropertyGroup> | ||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> | ||||
|     <ConfigurationType>DynamicLibrary</ConfigurationType> | ||||
|     <UseDebugLibraries>false</UseDebugLibraries> | ||||
|     <PlatformToolset>v142</PlatformToolset> | ||||
|     <WholeProgramOptimization>true</WholeProgramOptimization> | ||||
|     <CharacterSet>Unicode</CharacterSet> | ||||
|   </PropertyGroup> | ||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseVS2013|Win32'" Label="Configuration"> | ||||
|     <ConfigurationType>DynamicLibrary</ConfigurationType> | ||||
|     <UseDebugLibraries>false</UseDebugLibraries> | ||||
|     <PlatformToolset>v120</PlatformToolset> | ||||
|     <WholeProgramOptimization>true</WholeProgramOptimization> | ||||
|     <CharacterSet>Unicode</CharacterSet> | ||||
|   </PropertyGroup> | ||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> | ||||
|     <ConfigurationType>DynamicLibrary</ConfigurationType> | ||||
|     <UseDebugLibraries>true</UseDebugLibraries> | ||||
|     <PlatformToolset>v142</PlatformToolset> | ||||
|     <CharacterSet>Unicode</CharacterSet> | ||||
|   </PropertyGroup> | ||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> | ||||
|     <ConfigurationType>DynamicLibrary</ConfigurationType> | ||||
|     <UseDebugLibraries>false</UseDebugLibraries> | ||||
|     <PlatformToolset>v142</PlatformToolset> | ||||
|     <WholeProgramOptimization>true</WholeProgramOptimization> | ||||
|     <CharacterSet>Unicode</CharacterSet> | ||||
|   </PropertyGroup> | ||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseVS2013|x64'" Label="Configuration"> | ||||
|     <ConfigurationType>DynamicLibrary</ConfigurationType> | ||||
|     <UseDebugLibraries>false</UseDebugLibraries> | ||||
|     <PlatformToolset>v120</PlatformToolset> | ||||
|     <WholeProgramOptimization>true</WholeProgramOptimization> | ||||
|     <CharacterSet>Unicode</CharacterSet> | ||||
|   </PropertyGroup> | ||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | ||||
|   <ImportGroup Label="ExtensionSettings"> | ||||
|   </ImportGroup> | ||||
|   <ImportGroup Label="Shared"> | ||||
|   </ImportGroup> | ||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||||
|   </ImportGroup> | ||||
|   <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> | ||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||||
|   </ImportGroup> | ||||
|   <ImportGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseVS2013|Win32'" Label="PropertySheets"> | ||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||||
|   </ImportGroup> | ||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||||
|   </ImportGroup> | ||||
|   <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> | ||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||||
|   </ImportGroup> | ||||
|   <ImportGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseVS2013|x64'" Label="PropertySheets"> | ||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||||
|   </ImportGroup> | ||||
|   <PropertyGroup Label="UserMacros" /> | ||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||||
|     <LinkIncremental>true</LinkIncremental> | ||||
|     <TargetExt>.hdll</TargetExt> | ||||
|     <IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);../../src;../../include/turbojpeg;../../include/zlib;../../include/png;../../include/vorbis;../../include/mikktspace;../../include/minimp3</IncludePath> | ||||
|     <LibraryPath>$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86;../../$(Configuration);../../include/turbojpeg/x86</LibraryPath> | ||||
|   </PropertyGroup> | ||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||||
|     <LinkIncremental>true</LinkIncremental> | ||||
|     <TargetExt>.hdll</TargetExt> | ||||
|     <IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);../../src;../../include/turbojpeg;../../include/zlib;../../include/png;../../include/vorbis;../../include/mikktspace;../../include/minimp3</IncludePath> | ||||
|     <LibraryPath>$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\um\x64;../../x64/$(Configuration);../../include/turbojpeg/x64</LibraryPath> | ||||
|   </PropertyGroup> | ||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||||
|     <LinkIncremental>false</LinkIncremental> | ||||
|     <TargetExt>.hdll</TargetExt> | ||||
|     <IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);../../src;../../include/turbojpeg;../../include/zlib;../../include/png;../../include/vorbis;../../include/mikktspace;../../include/minimp3</IncludePath> | ||||
|     <LibraryPath>$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86;../../$(Configuration);../../include/turbojpeg/x86</LibraryPath> | ||||
|   </PropertyGroup> | ||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseVS2013|Win32'"> | ||||
|     <LinkIncremental>false</LinkIncremental> | ||||
|     <TargetExt>.hdll</TargetExt> | ||||
|     <IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);../../src;../../include/turbojpeg;../../include/zlib;../../include/png;../../include/vorbis;../../include/mikktspace;../../include/minimp3</IncludePath> | ||||
|     <LibraryPath>$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86;../../$(Configuration);../../include/turbojpeg/x86</LibraryPath> | ||||
|   </PropertyGroup> | ||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||||
|     <LinkIncremental>false</LinkIncremental> | ||||
|     <TargetExt>.hdll</TargetExt> | ||||
|     <IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);../../src;../../include/turbojpeg;../../include/zlib;../../include/png;../../include/vorbis;../../include/mikktspace;../../include/minimp3</IncludePath> | ||||
|     <LibraryPath>$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\um\x64;../../x64/$(Configuration);../../include/turbojpeg/x64</LibraryPath> | ||||
|   </PropertyGroup> | ||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseVS2013|x64'"> | ||||
|     <LinkIncremental>false</LinkIncremental> | ||||
|     <TargetExt>.hdll</TargetExt> | ||||
|     <IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);../../src;../../include/turbojpeg;../../include/zlib;../../include/png;../../include/vorbis;../../include/mikktspace;../../include/minimp3</IncludePath> | ||||
|     <LibraryPath>$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\um\x64;../../x64/$(Configuration);../../include/turbojpeg/x64</LibraryPath> | ||||
|   </PropertyGroup> | ||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||||
|     <ClCompile> | ||||
|       <PrecompiledHeader> | ||||
|       </PrecompiledHeader> | ||||
|       <WarningLevel>Level3</WarningLevel> | ||||
|       <Optimization>Disabled</Optimization> | ||||
|       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;JPG_EXPORTS;%(PreprocessorDefinitions); _CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions> | ||||
|       <AdditionalOptions>/wd4996 %(AdditionalOptions)</AdditionalOptions> | ||||
|     </ClCompile> | ||||
|     <Link> | ||||
|       <SubSystem>Windows</SubSystem> | ||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> | ||||
|       <OutputFile>../../$(Configuration)/$(TargetName).hdll</OutputFile> | ||||
|       <AdditionalDependencies>libhl.lib;simd.lib</AdditionalDependencies> | ||||
|       <IgnoreSpecificDefaultLibraries>LIBCMT</IgnoreSpecificDefaultLibraries> | ||||
|     </Link> | ||||
|   </ItemDefinitionGroup> | ||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||||
|     <ClCompile> | ||||
|       <PrecompiledHeader> | ||||
|       </PrecompiledHeader> | ||||
|       <WarningLevel>Level3</WarningLevel> | ||||
|       <Optimization>Disabled</Optimization> | ||||
|       <PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;JPG_EXPORTS;%(PreprocessorDefinitions); _CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions> | ||||
|       <AdditionalOptions>/wd4996 %(AdditionalOptions)</AdditionalOptions> | ||||
|     </ClCompile> | ||||
|     <Link> | ||||
|       <SubSystem>Windows</SubSystem> | ||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> | ||||
|       <AdditionalDependencies>libhl.lib;simd.lib</AdditionalDependencies> | ||||
|     </Link> | ||||
|   </ItemDefinitionGroup> | ||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||||
|     <ClCompile> | ||||
|       <WarningLevel>Level3</WarningLevel> | ||||
|       <PrecompiledHeader> | ||||
|       </PrecompiledHeader> | ||||
|       <Optimization>MaxSpeed</Optimization> | ||||
|       <FunctionLevelLinking>true</FunctionLevelLinking> | ||||
|       <IntrinsicFunctions>true</IntrinsicFunctions> | ||||
|       <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;JPG_EXPORTS;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions> | ||||
|       <AdditionalOptions>/wd4996 %(AdditionalOptions)</AdditionalOptions> | ||||
|     </ClCompile> | ||||
|     <Link> | ||||
|       <SubSystem>Windows</SubSystem> | ||||
|       <EnableCOMDATFolding>true</EnableCOMDATFolding> | ||||
|       <OptimizeReferences>true</OptimizeReferences> | ||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> | ||||
|       <OutputFile>../../$(Configuration)/$(TargetName).hdll</OutputFile> | ||||
|       <AdditionalDependencies>libhl.lib;simd.lib</AdditionalDependencies> | ||||
|       <IgnoreSpecificDefaultLibraries>LIBCMT</IgnoreSpecificDefaultLibraries> | ||||
|     </Link> | ||||
|   </ItemDefinitionGroup> | ||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseVS2013|Win32'"> | ||||
|     <ClCompile> | ||||
|       <WarningLevel>Level3</WarningLevel> | ||||
|       <PrecompiledHeader> | ||||
|       </PrecompiledHeader> | ||||
|       <Optimization>MaxSpeed</Optimization> | ||||
|       <FunctionLevelLinking>true</FunctionLevelLinking> | ||||
|       <IntrinsicFunctions>true</IntrinsicFunctions> | ||||
|       <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;JPG_EXPORTS;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions> | ||||
|       <AdditionalOptions>/wd4996 %(AdditionalOptions)</AdditionalOptions> | ||||
|     </ClCompile> | ||||
|     <Link> | ||||
|       <SubSystem>Windows</SubSystem> | ||||
|       <EnableCOMDATFolding>true</EnableCOMDATFolding> | ||||
|       <OptimizeReferences>true</OptimizeReferences> | ||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> | ||||
|       <OutputFile>../../$(Configuration)/$(TargetName).hdll</OutputFile> | ||||
|       <AdditionalDependencies>libhl.lib;simd.lib</AdditionalDependencies> | ||||
|       <IgnoreSpecificDefaultLibraries>LIBCMT</IgnoreSpecificDefaultLibraries> | ||||
|     </Link> | ||||
|   </ItemDefinitionGroup> | ||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||||
|     <ClCompile> | ||||
|       <WarningLevel>Level3</WarningLevel> | ||||
|       <PrecompiledHeader> | ||||
|       </PrecompiledHeader> | ||||
|       <Optimization>MaxSpeed</Optimization> | ||||
|       <FunctionLevelLinking>true</FunctionLevelLinking> | ||||
|       <IntrinsicFunctions>true</IntrinsicFunctions> | ||||
|       <PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;JPG_EXPORTS;%(PreprocessorDefinitions); _CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions> | ||||
|       <AdditionalOptions>/wd4996 %(AdditionalOptions)</AdditionalOptions> | ||||
|     </ClCompile> | ||||
|     <Link> | ||||
|       <SubSystem>Windows</SubSystem> | ||||
|       <EnableCOMDATFolding>true</EnableCOMDATFolding> | ||||
|       <OptimizeReferences>true</OptimizeReferences> | ||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> | ||||
|       <AdditionalDependencies>libhl.lib;simd.lib</AdditionalDependencies> | ||||
|     </Link> | ||||
|   </ItemDefinitionGroup> | ||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseVS2013|x64'"> | ||||
|     <ClCompile> | ||||
|       <WarningLevel>Level3</WarningLevel> | ||||
|       <PrecompiledHeader> | ||||
|       </PrecompiledHeader> | ||||
|       <Optimization>MaxSpeed</Optimization> | ||||
|       <FunctionLevelLinking>true</FunctionLevelLinking> | ||||
|       <IntrinsicFunctions>true</IntrinsicFunctions> | ||||
|       <PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;JPG_EXPORTS;%(PreprocessorDefinitions); _CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions> | ||||
|       <AdditionalOptions>/wd4996 %(AdditionalOptions)</AdditionalOptions> | ||||
|     </ClCompile> | ||||
|     <Link> | ||||
|       <SubSystem>Windows</SubSystem> | ||||
|       <EnableCOMDATFolding>true</EnableCOMDATFolding> | ||||
|       <OptimizeReferences>true</OptimizeReferences> | ||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> | ||||
|       <AdditionalDependencies>libhl.lib;simd.lib</AdditionalDependencies> | ||||
|     </Link> | ||||
|   </ItemDefinitionGroup> | ||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | ||||
|   <ImportGroup Label="ExtensionTargets"> | ||||
|   </ImportGroup> | ||||
| </Project> | ||||
							
								
								
									
										443
									
								
								Kha/Backends/Kinc-HL/hl/libs/fmt/fmt.vcxproj.filters
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										443
									
								
								Kha/Backends/Kinc-HL/hl/libs/fmt/fmt.vcxproj.filters
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,443 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||||
|   <ItemGroup> | ||||
|     <ClCompile Include="fmt.c" /> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jaricom.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jcapimin.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jcapistd.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jcarith.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jccoefct.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jccolor.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jcdctmgr.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jchuff.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jcinit.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jcmainct.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jcmarker.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jcmaster.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jcomapi.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jcparam.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jcphuff.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jcprepct.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jcsample.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jctrans.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jdapimin.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jdapistd.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jdarith.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jdatadst.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jdatadst-tj.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jdatasrc.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jdatasrc-tj.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jdcoefct.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jdcolor.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jddctmgr.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jdhuff.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jdinput.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jdmainct.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jdmarker.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jdmaster.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jdmerge.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jdphuff.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jdpostct.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jdsample.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jdtrans.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jerror.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jfdctflt.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jfdctfst.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jfdctint.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jidctflt.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jidctfst.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jidctint.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jidctred.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jmemmgr.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jmemnobs.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jquant1.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jquant2.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jutils.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\transupp.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\jsimd.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\turbojpeg\turbojpeg.c"> | ||||
|       <Filter>turbojpeg</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\zlib\inflate.c"> | ||||
|       <Filter>zlib</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\zlib\adler32.c"> | ||||
|       <Filter>zlib</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\zlib\crc32.c"> | ||||
|       <Filter>zlib</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\zlib\inffast.c"> | ||||
|       <Filter>zlib</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\zlib\inftrees.c"> | ||||
|       <Filter>zlib</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\zlib\zutil.c"> | ||||
|       <Filter>zlib</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\zlib\deflate.c"> | ||||
|       <Filter>zlib</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\zlib\trees.c"> | ||||
|       <Filter>zlib</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\png\png.c"> | ||||
|       <Filter>png</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\png\pngerror.c"> | ||||
|       <Filter>png</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\png\pngget.c"> | ||||
|       <Filter>png</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\png\pngmem.c"> | ||||
|       <Filter>png</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\png\pngpread.c"> | ||||
|       <Filter>png</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\png\pngread.c"> | ||||
|       <Filter>png</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\png\pngrio.c"> | ||||
|       <Filter>png</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\png\pngrtran.c"> | ||||
|       <Filter>png</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\png\pngrutil.c"> | ||||
|       <Filter>png</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\png\pngset.c"> | ||||
|       <Filter>png</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\png\pngtrans.c"> | ||||
|       <Filter>png</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\png\pngwio.c"> | ||||
|       <Filter>png</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\png\pngwrite.c"> | ||||
|       <Filter>png</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\png\pngwtran.c"> | ||||
|       <Filter>png</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\png\pngwutil.c"> | ||||
|       <Filter>png</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\vorbis\bitrate.c"> | ||||
|       <Filter>vorbis</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\vorbis\bitwise.c"> | ||||
|       <Filter>vorbis</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\vorbis\block.c"> | ||||
|       <Filter>vorbis</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\vorbis\codebook.c"> | ||||
|       <Filter>vorbis</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\vorbis\envelope.c"> | ||||
|       <Filter>vorbis</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\vorbis\floor0.c"> | ||||
|       <Filter>vorbis</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\vorbis\floor1.c"> | ||||
|       <Filter>vorbis</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\vorbis\framing.c"> | ||||
|       <Filter>vorbis</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\vorbis\info.c"> | ||||
|       <Filter>vorbis</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\vorbis\lookup.c"> | ||||
|       <Filter>vorbis</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\vorbis\lpc.c"> | ||||
|       <Filter>vorbis</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\vorbis\lsp.c"> | ||||
|       <Filter>vorbis</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\vorbis\mapping0.c"> | ||||
|       <Filter>vorbis</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\vorbis\mdct.c"> | ||||
|       <Filter>vorbis</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\vorbis\psy.c"> | ||||
|       <Filter>vorbis</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\vorbis\registry.c"> | ||||
|       <Filter>vorbis</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\vorbis\res0.c"> | ||||
|       <Filter>vorbis</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\vorbis\sharedbook.c"> | ||||
|       <Filter>vorbis</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\vorbis\smallft.c"> | ||||
|       <Filter>vorbis</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\vorbis\synthesis.c"> | ||||
|       <Filter>vorbis</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\vorbis\vorbisfile.c"> | ||||
|       <Filter>vorbis</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\..\include\vorbis\window.c"> | ||||
|       <Filter>vorbis</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="sha1.c" /> | ||||
|     <ClCompile Include="mikkt.c" /> | ||||
|     <ClCompile Include="..\..\include\mikktspace\mikktspace.c"> | ||||
|       <Filter>mikkt</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="dxt.c" /> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <Filter Include="turbojpeg"> | ||||
|       <UniqueIdentifier>{7c911b77-37c7-4ceb-a8ff-e9b3f0c4b21c}</UniqueIdentifier> | ||||
|     </Filter> | ||||
|     <Filter Include="zlib"> | ||||
|       <UniqueIdentifier>{cc205701-f7b7-43f9-abac-942df6a44718}</UniqueIdentifier> | ||||
|     </Filter> | ||||
|     <Filter Include="png"> | ||||
|       <UniqueIdentifier>{4db0a874-5bbe-47bd-b1ec-e642ab7f5737}</UniqueIdentifier> | ||||
|     </Filter> | ||||
|     <Filter Include="vorbis"> | ||||
|       <UniqueIdentifier>{3f330839-1ff8-4160-8d74-6957d97e9e37}</UniqueIdentifier> | ||||
|     </Filter> | ||||
|     <Filter Include="mikkt"> | ||||
|       <UniqueIdentifier>{b16da6f5-be29-4433-b595-14badcd2cd06}</UniqueIdentifier> | ||||
|     </Filter> | ||||
|     <Filter Include="minimp3"> | ||||
|       <UniqueIdentifier>{1bfe5a7d-6015-497d-936d-1a92e8938ca7}</UniqueIdentifier> | ||||
|     </Filter> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <ClInclude Include="..\..\include\zlib\zconf.h"> | ||||
|       <Filter>zlib</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\include\zlib\zlib.h"> | ||||
|       <Filter>zlib</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\include\zlib\inffast.h"> | ||||
|       <Filter>zlib</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\include\zlib\inflate.h"> | ||||
|       <Filter>zlib</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\include\zlib\inftrees.h"> | ||||
|       <Filter>zlib</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\include\zlib\inffixed.h"> | ||||
|       <Filter>zlib</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\include\zlib\crc32.h"> | ||||
|       <Filter>zlib</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\include\zlib\deflate.h"> | ||||
|       <Filter>zlib</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\include\zlib\trees.h"> | ||||
|       <Filter>zlib</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\include\png\png.h"> | ||||
|       <Filter>png</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\include\png\pngconf.h"> | ||||
|       <Filter>png</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\include\png\pngdebug.h"> | ||||
|       <Filter>png</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\include\png\pnginfo.h"> | ||||
|       <Filter>png</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\include\png\pnglibconf.h"> | ||||
|       <Filter>png</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\include\png\pngpriv.h"> | ||||
|       <Filter>png</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\include\png\pngstruct.h"> | ||||
|       <Filter>png</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\include\vorbis\backends.h"> | ||||
|       <Filter>vorbis</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\include\vorbis\bitrate.h"> | ||||
|       <Filter>vorbis</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\include\vorbis\codebook.h"> | ||||
|       <Filter>vorbis</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\include\vorbis\codec_internal.h"> | ||||
|       <Filter>vorbis</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\include\vorbis\envelope.h"> | ||||
|       <Filter>vorbis</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\include\vorbis\highlevel.h"> | ||||
|       <Filter>vorbis</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\include\vorbis\lookup.h"> | ||||
|       <Filter>vorbis</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\include\vorbis\lookup_data.h"> | ||||
|       <Filter>vorbis</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\include\vorbis\lpc.h"> | ||||
|       <Filter>vorbis</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\include\vorbis\lsp.h"> | ||||
|       <Filter>vorbis</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\include\vorbis\masking.h"> | ||||
|       <Filter>vorbis</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\include\vorbis\mdct.h"> | ||||
|       <Filter>vorbis</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\include\vorbis\misc.h"> | ||||
|       <Filter>vorbis</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\include\vorbis\os.h"> | ||||
|       <Filter>vorbis</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\include\vorbis\psy.h"> | ||||
|       <Filter>vorbis</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\include\vorbis\registry.h"> | ||||
|       <Filter>vorbis</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\include\vorbis\scales.h"> | ||||
|       <Filter>vorbis</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\include\vorbis\smallft.h"> | ||||
|       <Filter>vorbis</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\include\vorbis\window.h"> | ||||
|       <Filter>vorbis</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="sha1.h" /> | ||||
|     <ClInclude Include="..\..\include\mikktspace\mikktspace.h"> | ||||
|       <Filter>mikkt</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\include\minimp3\minimp3.h"> | ||||
|       <Filter>minimp3</Filter> | ||||
|     </ClInclude> | ||||
|   </ItemGroup> | ||||
| </Project> | ||||
							
								
								
									
										84
									
								
								Kha/Backends/Kinc-HL/hl/libs/fmt/mikkt.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										84
									
								
								Kha/Backends/Kinc-HL/hl/libs/fmt/mikkt.c
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,84 @@ | ||||
| #define HL_NAME(n) fmt_##n | ||||
| #include <mikktspace.h> | ||||
| #include <hl.h> | ||||
|  | ||||
| typedef struct { | ||||
| 	hl_type *t; | ||||
| 	float *buffer; | ||||
| 	int stride; | ||||
| 	int xpos; | ||||
| 	int normalPos; | ||||
| 	int uvPos; | ||||
| 	float *tangents; | ||||
| 	int tangentsStride; | ||||
| 	int tangentPos; | ||||
| 	int *indexes; | ||||
| 	int indices; | ||||
| } user_info; | ||||
|  | ||||
| typedef const SMikkTSpaceContext Mikkt; | ||||
|  | ||||
| static int get_num_faces( Mikkt *ctx ) { | ||||
| 	user_info *i = (user_info*)ctx->m_pUserData; | ||||
| 	return i->indices / 3; | ||||
| } | ||||
|  | ||||
| static int get_num_vertices( Mikkt *ctx, int face ) { | ||||
| 	return 3; | ||||
| } | ||||
|  | ||||
| static void get_position( Mikkt *ctx, float fvPosOut[], const int iFace, const int iVert ) { | ||||
| 	user_info *i = (user_info*)ctx->m_pUserData; | ||||
| 	int idx = iFace * 3 + iVert; | ||||
| 	int v = i->indexes[idx]; | ||||
| 	int p = v * i->stride + i->xpos; | ||||
| 	fvPosOut[0] = i->buffer[p++]; | ||||
| 	fvPosOut[1] = i->buffer[p++]; | ||||
| 	fvPosOut[2] = i->buffer[p++]; | ||||
| } | ||||
|  | ||||
| static void get_normal( Mikkt *ctx, float fvPosOut[], const int iFace, const int iVert ) { | ||||
| 	user_info *i = (user_info*)ctx->m_pUserData; | ||||
| 	int idx = iFace * 3 + iVert; | ||||
| 	int v = i->indexes[idx]; | ||||
| 	int p = v * i->stride + i->normalPos; | ||||
| 	fvPosOut[0] = i->buffer[p++]; | ||||
| 	fvPosOut[1] = i->buffer[p++]; | ||||
| 	fvPosOut[2] = i->buffer[p++]; | ||||
| } | ||||
|  | ||||
| static void get_tcoord( Mikkt *ctx, float fvPosOut[], const int iFace, const int iVert ) { | ||||
| 	user_info *i = (user_info*)ctx->m_pUserData; | ||||
| 	int idx = iFace * 3 + iVert; | ||||
| 	int v = i->indexes[idx]; | ||||
| 	int p = v * i->stride + i->uvPos; | ||||
| 	fvPosOut[0] = i->buffer[p++]; | ||||
| 	fvPosOut[1] = i->buffer[p++];	 | ||||
| } | ||||
|  | ||||
| static void set_tangent( Mikkt *ctx, const float fvTangent[], const float fSign, const int iFace, const int iVert ) { | ||||
| 	user_info *i = (user_info*)ctx->m_pUserData; | ||||
| 	int idx = iFace * 3 + iVert; | ||||
| 	int p = idx * i->tangentsStride + i->tangentPos; | ||||
| 	i->tangents[p++] = fvTangent[0]; | ||||
| 	i->tangents[p++] = fvTangent[1]; | ||||
| 	i->tangents[p++] = fvTangent[2]; | ||||
| 	i->tangents[p++] = fSign; | ||||
| } | ||||
|  | ||||
| HL_PRIM bool HL_NAME(compute_mikkt_tangents)( user_info *inf, double threshold ) { | ||||
| 	SMikkTSpaceContext ctx; | ||||
| 	SMikkTSpaceInterface intf; | ||||
| 	intf.m_getNumFaces = get_num_faces; | ||||
| 	intf.m_getNumVerticesOfFace = get_num_vertices; | ||||
| 	intf.m_getPosition = get_position; | ||||
| 	intf.m_getNormal = get_normal; | ||||
| 	intf.m_getTexCoord = get_tcoord; | ||||
| 	intf.m_setTSpaceBasic = set_tangent; | ||||
| 	intf.m_setTSpace = NULL; | ||||
| 	ctx.m_pInterface = &intf; | ||||
| 	ctx.m_pUserData = inf; | ||||
| 	return genTangSpace(&ctx, (float)threshold); | ||||
| } | ||||
|  | ||||
| DEFINE_PRIM(_BOOL, compute_mikkt_tangents, _DYN _F64); | ||||
							
								
								
									
										128
									
								
								Kha/Backends/Kinc-HL/hl/libs/fmt/sha1.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										128
									
								
								Kha/Backends/Kinc-HL/hl/libs/fmt/sha1.c
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,128 @@ | ||||
| /* | ||||
|  * Copyright (C)2005-2016 Haxe Foundation | ||||
|  * | ||||
|  * Permission is hereby granted, free of charge, to any person obtaining a | ||||
|  * copy of this software and associated documentation files (the "Software"), | ||||
|  * to deal in the Software without restriction, including without limitation | ||||
|  * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||||
|  * and/or sell copies of the Software, and to permit persons to whom the | ||||
|  * Software is furnished to do so, subject to the following conditions: | ||||
|  * | ||||
|  * The above copyright notice and this permission notice shall be included in | ||||
|  * all copies or substantial portions of the Software. | ||||
|  * | ||||
|  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||
|  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||
|  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||||
|  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||
|  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||||
|  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||||
|  * DEALINGS IN THE SOFTWARE. | ||||
|  */ | ||||
| #include <hl.h> | ||||
| #include "sha1.h" | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
|  | ||||
| // original code by Steve Reid | ||||
|  | ||||
| #define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits)))) | ||||
| #ifdef HL_BIG_ENDIAN | ||||
| #	define blk0(i) block[i] | ||||
| #else | ||||
| #	define blk0(i) (block[i] = (rol(block[i],24)&0xFF00FF00) \ | ||||
| 		|(rol(block[i],8)&0x00FF00FF)) | ||||
| #endif | ||||
| #define blk(i) (block[i&15] = rol(block[(i+13)&15]^block[(i+8)&15] \ | ||||
|     ^block[(i+2)&15]^block[i&15],1)) | ||||
| /* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */ | ||||
| #define R0(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk0(i)+0x5A827999+rol(v,5);w=rol(w,30); | ||||
| #define R1(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v,5);w=rol(w,30); | ||||
| #define R2(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30); | ||||
| #define R3(v,w,x,y,z,i) z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v,5);w=rol(w,30); | ||||
| #define R4(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30); | ||||
|  | ||||
| static void sha1_transform( unsigned int state[5], unsigned char buffer[64] ) { | ||||
| 	unsigned int a, b, c, d, e; | ||||
| 	unsigned int block[16]; | ||||
| 	memcpy(block, buffer, 64); | ||||
| 	/* Copy context->state[] to working vars */ | ||||
| 	a = state[0]; | ||||
| 	b = state[1]; | ||||
| 	c = state[2]; | ||||
| 	d = state[3]; | ||||
| 	e = state[4]; | ||||
| 	/* 4 rounds of 20 operations each. Loop unrolled. */ | ||||
| 	R0(a,b,c,d,e, 0); R0(e,a,b,c,d, 1); R0(d,e,a,b,c, 2); R0(c,d,e,a,b, 3); | ||||
| 	R0(b,c,d,e,a, 4); R0(a,b,c,d,e, 5); R0(e,a,b,c,d, 6); R0(d,e,a,b,c, 7); | ||||
| 	R0(c,d,e,a,b, 8); R0(b,c,d,e,a, 9); R0(a,b,c,d,e,10); R0(e,a,b,c,d,11); | ||||
| 	R0(d,e,a,b,c,12); R0(c,d,e,a,b,13); R0(b,c,d,e,a,14); R0(a,b,c,d,e,15); | ||||
| 	R1(e,a,b,c,d,16); R1(d,e,a,b,c,17); R1(c,d,e,a,b,18); R1(b,c,d,e,a,19); | ||||
| 	R2(a,b,c,d,e,20); R2(e,a,b,c,d,21); R2(d,e,a,b,c,22); R2(c,d,e,a,b,23); | ||||
| 	R2(b,c,d,e,a,24); R2(a,b,c,d,e,25); R2(e,a,b,c,d,26); R2(d,e,a,b,c,27); | ||||
| 	R2(c,d,e,a,b,28); R2(b,c,d,e,a,29); R2(a,b,c,d,e,30); R2(e,a,b,c,d,31); | ||||
| 	R2(d,e,a,b,c,32); R2(c,d,e,a,b,33); R2(b,c,d,e,a,34); R2(a,b,c,d,e,35); | ||||
| 	R2(e,a,b,c,d,36); R2(d,e,a,b,c,37); R2(c,d,e,a,b,38); R2(b,c,d,e,a,39); | ||||
| 	R3(a,b,c,d,e,40); R3(e,a,b,c,d,41); R3(d,e,a,b,c,42); R3(c,d,e,a,b,43); | ||||
| 	R3(b,c,d,e,a,44); R3(a,b,c,d,e,45); R3(e,a,b,c,d,46); R3(d,e,a,b,c,47); | ||||
| 	R3(c,d,e,a,b,48); R3(b,c,d,e,a,49); R3(a,b,c,d,e,50); R3(e,a,b,c,d,51); | ||||
| 	R3(d,e,a,b,c,52); R3(c,d,e,a,b,53); R3(b,c,d,e,a,54); R3(a,b,c,d,e,55); | ||||
| 	R3(e,a,b,c,d,56); R3(d,e,a,b,c,57); R3(c,d,e,a,b,58); R3(b,c,d,e,a,59); | ||||
| 	R4(a,b,c,d,e,60); R4(e,a,b,c,d,61); R4(d,e,a,b,c,62); R4(c,d,e,a,b,63); | ||||
| 	R4(b,c,d,e,a,64); R4(a,b,c,d,e,65); R4(e,a,b,c,d,66); R4(d,e,a,b,c,67); | ||||
| 	R4(c,d,e,a,b,68); R4(b,c,d,e,a,69); R4(a,b,c,d,e,70); R4(e,a,b,c,d,71); | ||||
| 	R4(d,e,a,b,c,72); R4(c,d,e,a,b,73); R4(b,c,d,e,a,74); R4(a,b,c,d,e,75); | ||||
| 	R4(e,a,b,c,d,76); R4(d,e,a,b,c,77); R4(c,d,e,a,b,78); R4(b,c,d,e,a,79); | ||||
| 	/* Add the working vars back into context.state[] */ | ||||
| 	state[0] += a; | ||||
| 	state[1] += b; | ||||
| 	state[2] += c; | ||||
| 	state[3] += d; | ||||
| 	state[4] += e; | ||||
| } | ||||
|  | ||||
| void sha1_init( SHA1_CTX *context ) { | ||||
| 	/* SHA1 initialization constants */ | ||||
| 	context->state[0] = 0x67452301; | ||||
| 	context->state[1] = 0xEFCDAB89; | ||||
| 	context->state[2] = 0x98BADCFE; | ||||
| 	context->state[3] = 0x10325476; | ||||
| 	context->state[4] = 0xC3D2E1F0; | ||||
| 	context->count[0] = context->count[1] = 0; | ||||
| } | ||||
|  | ||||
| void sha1_update( SHA1_CTX *context, const unsigned char *data, unsigned int len ) { | ||||
| 	unsigned int i, j; | ||||
| 	j = (context->count[0] >> 3) & 63; | ||||
| 	if ((context->count[0] += len << 3) < (len << 3)) context->count[1]++; | ||||
| 	context->count[1] += (len >> 29); | ||||
| 	if ((j + len) > 63) { | ||||
| 		memcpy(&context->buffer[j], data, (i = 64-j)); | ||||
| 		sha1_transform(context->state, context->buffer); | ||||
| 		for ( ; i + 63 < len; i += 64 ) | ||||
| 			sha1_transform(context->state, (unsigned char *)&data[i]); | ||||
| 		j = 0; | ||||
| 	} else | ||||
| 		i = 0; | ||||
| 	memcpy(&context->buffer[j], &data[i], len - i); | ||||
| } | ||||
|  | ||||
| void sha1_final( SHA1_CTX *context, unsigned char digest[SHA1_SIZE] ) { | ||||
| 	unsigned int i; | ||||
| 	unsigned char finalcount[8]; | ||||
| 	for (i = 0; i < 8; i++) { | ||||
| 		finalcount[i] = (unsigned char)((context->count[(i >= 4 ? 0 : 1)] | ||||
| 			>> ((3-(i & 3)) * 8) ) & 255);  /* Endian independent */ | ||||
| 	} | ||||
| 	sha1_update(context, (unsigned char *)"\200", 1); | ||||
| 	while ((context->count[0] & 504) != 448) { | ||||
| 		sha1_update(context, (unsigned char *)"\0", 1); | ||||
| 	} | ||||
| 	sha1_update(context, finalcount, 8); | ||||
| 	for (i = 0; i < SHA1_SIZE; i++) { | ||||
| 		digest[i] = (unsigned char) | ||||
| 			((context->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255); | ||||
| 	} | ||||
| 	sha1_transform(context->state, context->buffer); | ||||
| } | ||||
|  | ||||
							
								
								
									
										40
									
								
								Kha/Backends/Kinc-HL/hl/libs/fmt/sha1.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								Kha/Backends/Kinc-HL/hl/libs/fmt/sha1.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,40 @@ | ||||
| /* | ||||
|  * Copyright (C)2005-2016 Haxe Foundation | ||||
|  * | ||||
|  * Permission is hereby granted, free of charge, to any person obtaining a | ||||
|  * copy of this software and associated documentation files (the "Software"), | ||||
|  * to deal in the Software without restriction, including without limitation | ||||
|  * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||||
|  * and/or sell copies of the Software, and to permit persons to whom the | ||||
|  * Software is furnished to do so, subject to the following conditions: | ||||
|  * | ||||
|  * The above copyright notice and this permission notice shall be included in | ||||
|  * all copies or substantial portions of the Software. | ||||
|  * | ||||
|  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||
|  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||
|  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||||
|  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||
|  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||||
|  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||||
|  * DEALINGS IN THE SOFTWARE. | ||||
|  */ | ||||
| #ifndef SHA1_H | ||||
| #define SHA1_H | ||||
|  | ||||
| #define SHA1_SIZE 20 | ||||
|  | ||||
| typedef unsigned char SHA1_DIGEST[SHA1_SIZE]; | ||||
|  | ||||
| typedef struct { | ||||
| 	unsigned int state[5]; | ||||
| 	unsigned int count[2]; | ||||
| 	unsigned char buffer[64]; | ||||
| } SHA1_CTX; | ||||
|  | ||||
| void sha1_init( SHA1_CTX *c ); | ||||
| void sha1_update( SHA1_CTX *c, const unsigned char *data, unsigned int len ); | ||||
| void sha1_final( SHA1_CTX *c, SHA1_DIGEST digest ); | ||||
|  | ||||
| #endif | ||||
| /* ************************************************************************ */ | ||||
		Reference in New Issue
	
	Block a user