tune memory manager for BROTLI_EXPERIMENTAL

PiperOrigin-RevId: 560703386
This commit is contained in:
Evgenii Kliuchnikov 2023-08-28 07:20:13 -07:00 committed by Copybara-Service
parent c1bd196833
commit e7313b0c4e
2 changed files with 5 additions and 10 deletions

View File

@ -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(&params);
params.quality = quality;
params.lgwin = lgwin;

View File

@ -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 {