From 5262a872f308b3b584c97d621992fb3877e392b8 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 05:10:08 +0200 Subject: Adding upstream version 5.6.1+really5.4.5. Signed-off-by: Daniel Baumann --- debug/memusage.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 debug/memusage.c (limited to 'debug/memusage.c') diff --git a/debug/memusage.c b/debug/memusage.c new file mode 100644 index 0000000..bd72b5a --- /dev/null +++ b/debug/memusage.c @@ -0,0 +1,51 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file memusage.c +/// \brief Calculates memory usage using lzma_memory_usage() +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "sysdefs.h" +#include "lzma.h" +#include + +int +main(void) +{ + lzma_options_lzma lzma = { + .dict_size = (1U << 30) + (1U << 29), + .lc = 3, + .lp = 0, + .pb = 2, + .preset_dict = NULL, + .preset_dict_size = 0, + .mode = LZMA_MODE_NORMAL, + .nice_len = 48, + .mf = LZMA_MF_BT4, + .depth = 0, + }; + +/* + lzma_options_filter filters[] = { + { LZMA_FILTER_LZMA1, + (lzma_options_lzma *)&lzma_preset_lzma[6 - 1] }, + { UINT64_MAX, NULL } + }; +*/ + lzma_filter filters[] = { + { LZMA_FILTER_LZMA1, &lzma }, + { UINT64_MAX, NULL } + }; + + printf("Encoder: %10" PRIu64 " B\n", + lzma_raw_encoder_memusage(filters)); + printf("Decoder: %10" PRIu64 " B\n", + lzma_raw_decoder_memusage(filters)); + + return 0; +} -- cgit v1.2.3