2008-04-25 10:41:29 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
/// \file memusage.c
|
|
|
|
/// \brief Calculates memory usage using lzma_memory_usage()
|
|
|
|
///
|
|
|
|
// Copyright (C) 2008 Lasse Collin
|
|
|
|
//
|
|
|
|
// This library is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public
|
|
|
|
// License as published by the Free Software Foundation; either
|
|
|
|
// version 2.1 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "sysdefs.h"
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
int
|
|
|
|
main(void)
|
|
|
|
{
|
2008-08-28 19:53:15 +00:00
|
|
|
lzma_init();
|
2008-04-25 10:41:29 +00:00
|
|
|
|
|
|
|
lzma_options_lzma lzma = {
|
2008-11-19 18:46:52 +00:00
|
|
|
.dict_size = (1U << 30) + (1U << 29),
|
2008-09-27 16:09:21 +00:00
|
|
|
.lc = 3,
|
|
|
|
.lp = 0,
|
|
|
|
.pb = 2,
|
|
|
|
.preset_dict = NULL,
|
|
|
|
.preset_dict_size = 0,
|
2008-08-28 19:53:15 +00:00
|
|
|
.mode = LZMA_MODE_NORMAL,
|
2008-09-27 16:09:21 +00:00
|
|
|
.nice_len = 48,
|
|
|
|
.mf = LZMA_MF_BT4,
|
|
|
|
.depth = 0,
|
2008-04-25 10:41:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
lzma_options_filter filters[] = {
|
2008-09-27 16:09:21 +00:00
|
|
|
{ LZMA_FILTER_LZMA1,
|
2008-04-25 10:41:29 +00:00
|
|
|
(lzma_options_lzma *)&lzma_preset_lzma[6 - 1] },
|
|
|
|
{ UINT64_MAX, NULL }
|
|
|
|
};
|
|
|
|
*/
|
2008-08-28 19:53:15 +00:00
|
|
|
lzma_filter filters[] = {
|
2008-09-27 16:09:21 +00:00
|
|
|
{ LZMA_FILTER_LZMA1, &lzma },
|
2008-04-25 10:41:29 +00:00
|
|
|
{ UINT64_MAX, NULL }
|
|
|
|
};
|
|
|
|
|
2008-08-28 19:53:15 +00:00
|
|
|
printf("Encoder: %10" PRIu64 " B\n", lzma_memusage_encoder(filters));
|
|
|
|
printf("Decoder: %10" PRIu64 " B\n", lzma_memusage_decoder(filters));
|
2008-04-25 10:41:29 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|