20 template<
typename slp_coder_t,
typename ipd_t = esp::StdUnorderedMapIPD>
24 Meta m(
"compressor",
"esp",
"ESP based grammar compression");
35 auto phase0 =
StatPhase(
"ESP Compressor");
37 EspContext<ipd_t> context { &
env(),
true };
41 auto phase1 =
StatPhase(
"Compress Phase");
43 auto phase2 =
StatPhase(
"Creating input view");
46 context.debug.input_string(in);
48 phase2.split(
"ESP Algorithm");
49 slp = context.generate_grammar(std::move(in));
52 phase0.log_stat(
"SLP size", slp.rules.size());
53 phase0.log_stat(
"ext_size2_total", context.ipd_stats.ext_size2_total);
54 phase0.log_stat(
"ext_size3_total", context.ipd_stats.ext_size3_total);
55 phase0.log_stat(
"ext_size3_unique", context.ipd_stats.ext_size3_unique);
56 phase0.log_stat(
"int_size2_total", context.ipd_stats.int_size2_total);
57 phase0.log_stat(
"int_size2_unique", context.ipd_stats.int_size2_unique);
62 auto phase2 =
StatPhase(
"Creating strategy");
65 phase2.split(
"Encode SLP");
66 strategy.encode(context.debug, std::move(slp), output);
69 context.debug.print_all();
73 auto phase0 =
StatPhase(
"ESP Decompressor");
75 auto phase1 =
StatPhase(
"Creating strategy");
77 phase1.split(
"Decode SLP");
78 auto slp = strategy.decode(input);
80 phase1.split(
"Create output stream");
83 phase1.split(
"Derive text");
Contains the text compression and encoding framework.
Env env_for_option(const std::string &option) const
Create the environment for a sub algorithm option.
Base for data compressors.
virtual void decompress(Input &input, Output &output) override
Decompress the given input to the given output.
Provides access to runtime and memory measurement in statistics phases.
Env & env()
Provides access to the environment that the algorithm works in.
OutputStream as_stream() const
Creates a stream that allows for character-wise output.
An abstraction layer for algorithm output.
virtual void compress(Input &input, Output &output) override
Compress the given input to the given output.
Compressor(Compressor const &)=default