mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-18 00:32:11 +01:00
Add a mimiclib scratch buffer
This commit is contained in:
1 parent
10e8ee5e79
commit
aa2d41e0a0
2 files changed
+9
-7
No files matched your search
@@ -20,13 +20,8 @@ mimic_png_decode(uint64_t* n_bytes_out,
|
||||
uint32_t wuffs_initialize_flags,
|
||||
wuffs_base__pixel_format pixfmt,
|
||||
wuffs_base__io_buffer* src) {
|
||||
static uint8_t dst_fallback_array_u8[64 * 1024 * 1024];
|
||||
wuffs_base__io_buffer dst_fallback = ((wuffs_base__io_buffer){
|
||||
.data = ((wuffs_base__slice_u8){
|
||||
.ptr = dst_fallback_array_u8,
|
||||
.len = 64 * 1024 * 1024,
|
||||
}),
|
||||
});
|
||||
wuffs_base__io_buffer dst_fallback =
|
||||
wuffs_base__slice_u8__writer(g_mimiclib_scratch_slice_u8);
|
||||
if (!dst) {
|
||||
dst = &dst_fallback;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define MIMICLIB_SCRATCH_BUFFER_ARRAY_SIZE (64 * 1024 * 1024)
|
||||
#define IO_BUFFER_ARRAY_SIZE (64 * 1024 * 1024)
|
||||
#define PIXEL_BUFFER_ARRAY_SIZE (64 * 1024 * 1024)
|
||||
#define TOKEN_BUFFER_ARRAY_SIZE (128 * 1024)
|
||||
@@ -31,6 +32,7 @@ uint8_t g_want_array_u8[IO_BUFFER_ARRAY_SIZE];
|
||||
uint8_t g_work_array_u8[IO_BUFFER_ARRAY_SIZE];
|
||||
uint8_t g_src_array_u8[IO_BUFFER_ARRAY_SIZE];
|
||||
|
||||
uint8_t g_mimiclib_scratch_array_u8[MIMICLIB_SCRATCH_BUFFER_ARRAY_SIZE];
|
||||
uint8_t g_pixel_array_u8[PIXEL_BUFFER_ARRAY_SIZE];
|
||||
|
||||
wuffs_base__token g_have_array_token[TOKEN_BUFFER_ARRAY_SIZE];
|
||||
@@ -41,6 +43,7 @@ wuffs_base__slice_u8 g_want_slice_u8;
|
||||
wuffs_base__slice_u8 g_work_slice_u8;
|
||||
wuffs_base__slice_u8 g_src_slice_u8;
|
||||
|
||||
wuffs_base__slice_u8 g_mimiclib_scratch_slice_u8;
|
||||
wuffs_base__slice_u8 g_pixel_slice_u8;
|
||||
|
||||
wuffs_base__slice_token g_have_slice_token;
|
||||
@@ -64,6 +67,10 @@ wuffs_testlib__initialize_global_xxx_slices() {
|
||||
.ptr = g_src_array_u8,
|
||||
.len = IO_BUFFER_ARRAY_SIZE,
|
||||
});
|
||||
g_mimiclib_scratch_slice_u8 = ((wuffs_base__slice_u8){
|
||||
.ptr = g_mimiclib_scratch_array_u8,
|
||||
.len = MIMICLIB_SCRATCH_BUFFER_ARRAY_SIZE,
|
||||
});
|
||||
g_pixel_slice_u8 = ((wuffs_base__slice_u8){
|
||||
.ptr = g_pixel_array_u8,
|
||||
.len = PIXEL_BUFFER_ARRAY_SIZE,
|
||||
|
||||
Reference in new issue
Block a user