diff options
author | Evgenii Kliuchnikov <eustas@google.com> | 2023-08-28 07:20:13 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-08-28 07:20:49 -0700 |
commit | e7313b0c4e9d57a4655a7e306a06269124f509b4 (patch) | |
tree | db600837e04892ee2d8995494b00b41c7dee58b3 /c | |
parent | c1bd196833e4ce05ef49b82ec5e124bb79e095ff (diff) | |
download | brotli-e7313b0c4e9d57a4655a7e306a06269124f509b4.zip brotli-e7313b0c4e9d57a4655a7e306a06269124f509b4.tar.gz brotli-e7313b0c4e9d57a4655a7e306a06269124f509b4.tar.bz2 |
tune memory manager for BROTLI_EXPERIMENTAL
PiperOrigin-RevId: 560703386
Diffstat (limited to 'c')
-rw-r--r-- | c/enc/encode.c | 11 | ||||
-rw-r--r-- | c/enc/memory.h | 4 |
2 files changed, 5 insertions, 10 deletions
diff --git a/c/enc/encode.c b/c/enc/encode.c index 6ce8edd..95ff2ea 100644 --- a/c/enc/encode.c +++ b/c/enc/encode.c @@ -1836,15 +1836,8 @@ BROTLI_BOOL BrotliEncoderAttachPreparedDictionary(BrotliEncoderState* state, size_t BrotliEncoderEstimatePeakMemoryUsage(int quality, int lgwin, size_t input_size) { BrotliEncoderParams params; - size_t memory_manager_slots = 0; - size_t memory_manager_size = 0; -#if !defined(BROTLI_ENCODER_EXIT_ON_OOM) - memory_manager_slots = 256; -#if defined(BROTLI_EXPERIMENTAL) - memory_manager_slots = 32768; -#endif /* BROTLI_EXPERIMENTAL */ -#endif /* BROTLI_ENCODER_EXIT_ON_OOM */ - memory_manager_size = memory_manager_slots * sizeof(void*); + size_t memory_manager_slots = BROTLI_ENCODER_MEMORY_MANAGER_SLOTS; + size_t memory_manager_size = memory_manager_slots * sizeof(void*); BrotliEncoderInitParams(¶ms); params.quality = quality; params.lgwin = lgwin; diff --git a/c/enc/memory.h b/c/enc/memory.h index a958fdd..a4417df 100644 --- a/c/enc/memory.h +++ b/c/enc/memory.h @@ -26,10 +26,12 @@ extern "C" { #if !defined(BROTLI_ENCODER_EXIT_ON_OOM) #if defined(BROTLI_EXPERIMENTAL) -#define BROTLI_ENCODER_MEMORY_MANAGER_SLOTS 32768 +#define BROTLI_ENCODER_MEMORY_MANAGER_SLOTS (48*1024) #else /* BROTLI_EXPERIMENTAL */ #define BROTLI_ENCODER_MEMORY_MANAGER_SLOTS 256 #endif /* BROTLI_EXPERIMENTAL */ +#else /* BROTLI_ENCODER_EXIT_ON_OOM */ +#define BROTLI_ENCODER_MEMORY_MANAGER_SLOTS 0 #endif /* BROTLI_ENCODER_EXIT_ON_OOM */ typedef struct MemoryManager { |