Commit Graph

1661 Commits

Author SHA1 Message Date
gingerBill
1c76577918 Add slice.sort_by_cmp Ordering based sorting algorithms 2021-07-03 15:16:44 +01:00
gingerBill
4285b58aaa Add #no_bounds_check to linalg procedures 2021-07-03 14:38:41 +01:00
gingerBill
9cc366de97 Be more consistent with runtime intrinsics usage 2021-07-03 14:38:15 +01:00
gingerBill
212d294b84 Deprecate sort.slice and sort.reverse_slice 2021-07-03 14:37:55 +01:00
gingerBill
ad22eda87c Improve linalg.transpose type determination for square matrices 2021-06-28 13:23:28 +01:00
Jeroen van Rijn
87aaa9c3f0 ZLIB: Fix edge case where initial buffer < 258 bytes. 2021-06-27 18:44:36 +02:00
Jeroen van Rijn
6836b501af Merge branch 'master' into zlib_optimize 2021-06-27 16:50:27 +02:00
Jeroen van Rijn
d949d5a046 ZLIB: cleanup. 2021-06-27 16:48:12 +02:00
Jeroen van Rijn
064516bf0b PNG: Inform inflate about expected output size for extra speed. 2021-06-27 13:57:12 +02:00
Jeroen van Rijn
eaf88bcc4d PNG: Let PNG use the new compress I/O routines. 2021-06-27 13:51:52 +02:00
Jeroen van Rijn
02f9668185 ZLIB: Split up input from stream and memory into own code paths. 2021-06-27 13:19:24 +02:00
gingerBill
abda75feee Add bufio.Lookahead_Reader 2021-06-26 23:45:45 +01:00
Jeroen van Rijn
4689a6b341 Refactor compress.Context struct. 2021-06-26 22:25:55 +02:00
Jeroen van Rijn
30a5808460 ZLIB: Moar faster. 2021-06-26 20:40:39 +02:00
Jeroen van Rijn
8ba1c9a6cd ZLIB: Remove superfluous code. 2021-06-26 17:44:12 +02:00
Jeroen van Rijn
65b78b1aa9 So far, so good. 2021-06-26 15:11:15 +02:00
Jeroen van Rijn
c369719362 Merge branch 'master' into zlib_optimize 2021-06-26 13:40:22 +02:00
Jeroen van Rijn
40a12cca53 ZLIB: If output size is known, reserve that much. 2021-06-26 13:17:14 +02:00
gingerBill
f1cf724bd4 Add bufio.Scanner 2021-06-25 14:31:35 +01:00
Jeroen van Rijn
ab12ca69af Merge pull request #1040 from Kelimion/zlib_optimize
Adler32 speedup.
2021-06-24 19:15:22 +02:00
Jeroen van Rijn
17748f18b9 Adler32 speedup. 2021-06-24 19:06:39 +02:00
gingerBill
3803bdff5f Allow bufio.Reader and bufio.Writer to have a configurable max_consecutive_empty_(reads|writes) field 2021-06-24 15:56:58 +01:00
gingerBill
0a94a67190 Merge branch 'master' of https://github.com/odin-lang/Odin 2021-06-24 15:55:50 +01:00
gingerBill
8dcb14fbc2 Add helper procedures for strings.Reader creation 2021-06-24 15:55:42 +01:00
Jeroen van Rijn
980aa37bee ZLIB: Another 10%+ faster. 2021-06-24 14:56:28 +02:00
gingerBill
1e9cc058a0 Update hash.crc32 to use slicing-by-8 algorithm to improve throughput by ~3.5x 2021-06-24 00:03:59 +01:00
Jeroen van Rijn
1cfe226686 ZLIB: More faster. 2021-06-23 22:18:17 +02:00
Jeroen van Rijn
342adb627d All reads now skip stream if in memory. 2021-06-23 16:32:48 +02:00
Jeroen van Rijn
a70635d2f6 Most reads now go through buffer for zlib. 2021-06-23 16:32:48 +02:00
Jeroen van Rijn
5cb16c4cd1 All reads now go through read_slice. 2021-06-23 16:32:48 +02:00
Jeroen van Rijn
538004ba5f Introduce read_slice, make read_u8 use it. 2021-06-23 16:32:48 +02:00
Jeroen van Rijn
8663c64e47 Refactor ZLIB structs. 2021-06-23 16:32:47 +02:00
Jeroen van Rijn
ae0b8fce44 Move bytes utils back to EXR code for the time being.
Also, allow PNG example to be run directly from `core:image/png` directory.
2021-06-22 16:39:00 +02:00
Jeroen van Rijn
d5e2b387fa PNG: Fix leak if you don't ask for metadata. 2021-06-21 22:47:54 +02:00
Jeroen van Rijn
922b511a24 Merge pull request #1031 from Kelimion/zlib_fix
ZLIB: fix.
2021-06-21 22:16:56 +02:00
Jeroen van Rijn
9de9111082 ZLIB: fix. 2021-06-21 22:15:04 +02:00
Jeroen van Rijn
1e8c12c2a3 Comment out tracy imports. 2021-06-21 21:41:56 +02:00
Jeroen van Rijn
352494cbb4 ZLIB: Start optimization. 2021-06-21 21:05:52 +02:00
Jeroen van Rijn
e036a321a0 Replace core:image's sidecar with explicit metadata_ptr and metadata_type.
To unpack, use:
```odin

v: ^png.Info;

if img.metadata_ptr != nil && img.metadata_type == png.Info {
	v = (^png.Info)(img.metadata_ptr);
	...
}
```
2021-06-21 16:32:42 +02:00
Jeroen van Rijn
55d09251d8 Change PNG's img.sidecar to ^Info, make img.depth an int.
For compatibility with the upcoming OpenEXR code, img.depth is now an int.
Like OpenEXR's code, it will now also return metadata as ^Info instead of Info.

The example was updated to retrieve the metadata this way.

It regrettably does not fix: #1018. That seems to be a codegen issue in the test runner or elsewhere.
2021-06-20 18:27:23 +02:00
Jeroen van Rijn
d66fd71d21 Merge pull request #1024 from Kelimion/defer_fix
GZIP defer diverging fix in gzip example.
2021-06-20 17:40:15 +02:00
Jeroen van Rijn
055d8c5370 Fix Windows test runner. 2021-06-20 17:33:39 +02:00
Jeroen van Rijn
955472bd21 GZIP defer diverging fix in gzip example. 2021-06-20 17:21:18 +02:00
Jeroen van Rijn
8a4b9ddaa3 Fix comment. 2021-06-18 15:42:04 +02:00
Jeroen van Rijn
54a2b6f00e Add bytes.buffer_create_of_type and bytes.buffer_convert_to_type.
Convenience functions to reinterpret or cast one buffer to another type, or create a buffer of a specific type.

	Example:
```odin
	fmt.println("Convert []f16le (x2) to []f32 (x2).");
	b := []u8{0, 60, 0, 60}; // == []f16{1.0, 1.0}

	res, backing, had_to_allocate, err := bytes.buffer_convert_to_type(2, f32, f16le, b);
	fmt.printf("res      : %v\n", res);              // [1.000, 1.000]
	fmt.printf("backing  : %v\n", backing);          // &Buffer{buf = [0, 0, 128, 63, 0, 0, 128, 63], off = 0, last_read = Invalid}
	fmt.printf("allocated: %v\n", had_to_allocate);  // true
	fmt.printf("err      : %v\n", err);              // false

	if had_to_allocate { defer bytes.buffer_destroy(backing); }

	fmt.println("\nConvert []f16le (x2) to []u16 (x2).");

	res2: []u16;
	res2, backing, had_to_allocate, err = bytes.buffer_convert_to_type(2, u16, f16le, b);
	fmt.printf("res      : %v\n", res2);             // [15360, 15360]
	fmt.printf("backing  : %v\n", backing);          // Buffer.buf points to `b` because it could be converted in-place.
	fmt.printf("allocated: %v\n", had_to_allocate);  // false
	fmt.printf("err      : %v\n", err);              // false

	if had_to_allocate { defer bytes.buffer_destroy(backing); }

	fmt.println("\nConvert []f16le (x2) to []u16 (x2), force_convert=true.");

	res2, backing, had_to_allocate, err = bytes.buffer_convert_to_type(2, u16, f16le, b, true);
	fmt.printf("res      : %v\n", res2);             // [1, 1]
	fmt.printf("backing  : %v\n", backing);          // Buffer.buf points to `b` because it could be converted in-place.
	fmt.printf("allocated: %v\n", had_to_allocate);  // false
	fmt.printf("err      : %v\n", err);              // false

	if had_to_allocate { defer bytes.buffer_destroy(backing); }
```
2021-06-18 15:25:36 +02:00
gingerBill
abe728dbbb Add intrinsics.type_is_endian_platform 2021-06-17 20:39:00 +01:00
gingerBill
af95381bf8 Add missing -> ! annotation 2021-06-16 12:12:24 +01:00
gingerBill
41f2539484 Improve logic for diverging procedures by checking if it terminates 2021-06-16 12:07:24 +01:00
gingerBill
3e7aabe6d8 Change uses for parapoly records to use $ always 2021-06-14 11:43:35 +01:00
gingerBill
9f8a63cb43 More minor stylization changes (remove unneeded parentheses) 2021-06-14 11:34:31 +01:00