1 /* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2 // vim: expandtab:ts=8:sw=4:softtabstop=4:
3 ///////////////////////////////////////////////////////////////////////////////
4 //
5 /// \file memusage.c
6 /// \brief Calculates memory usage using lzma_memory_usage()
7 //
8 // Author: Lasse Collin
9 //
10 // This file has been put into the public domain.
11 // You can do whatever you want with this file.
12 //
13 ///////////////////////////////////////////////////////////////////////////////
14
15 #include "sysdefs.h"
16 #include "lzma.h"
17 #include <stdio.h>
18
19 int
main(void)20 main(void)
21 {
22 lzma_options_lzma lzma = {
23 .dict_size = (1U << 30) + (1U << 29),
24 .lc = 3,
25 .lp = 0,
26 .pb = 2,
27 .preset_dict = NULL,
28 .preset_dict_size = 0,
29 .mode = LZMA_MODE_NORMAL,
30 .nice_len = 48,
31 .mf = LZMA_MF_BT4,
32 .depth = 0,
33 };
34
35 /*
36 lzma_options_filter filters[] = {
37 { LZMA_FILTER_LZMA1,
38 (lzma_options_lzma *)&lzma_preset_lzma[6 - 1] },
39 { UINT64_MAX, NULL }
40 };
41 */
42 lzma_filter filters[] = {
43 { LZMA_FILTER_LZMA1, &lzma },
44 { UINT64_MAX, NULL }
45 };
46
47 printf("Encoder: %10" PRIu64 " B\n", lzma_memusage_encoder(filters));
48 printf("Decoder: %10" PRIu64 " B\n", lzma_memusage_decoder(filters));
49
50 return 0;
51 }
52