Broken LZ4 algorithm! The decompression seems to work now (needs improvement?) but the conversion tools emit 64K block sizes which is unhelpfull for us
This commit is contained in:
@@ -21,13 +21,14 @@ struct CommandLine {
|
||||
|
||||
#[derive(Subcommand)]
|
||||
enum SubCommands {
|
||||
Nothing,
|
||||
SimpleTIM(reduced_tim::Arguments)
|
||||
}
|
||||
|
||||
fn run_main() -> Result<(), Error> {
|
||||
match CommandLine::try_parse() {
|
||||
Ok(cmd) => {
|
||||
let input = tool_helper::open_input(cmd.input_file)?;
|
||||
let mut input = tool_helper::open_input(cmd.input_file)?;
|
||||
let mut buffer = Vec::<u8>::new();
|
||||
let mut output_file = tool_helper::open_output(cmd.output_file)?;
|
||||
let dst_buffer = {
|
||||
@@ -41,6 +42,9 @@ fn run_main() -> Result<(), Error> {
|
||||
};
|
||||
|
||||
match cmd.sub_command {
|
||||
SubCommands::Nothing => {
|
||||
std::io::copy(&mut input, dst_buffer)?;
|
||||
},
|
||||
SubCommands::SimpleTIM(args) => {
|
||||
reduced_tim::convert(args, input, dst_buffer)?;
|
||||
}
|
||||
@@ -48,10 +52,7 @@ fn run_main() -> Result<(), Error> {
|
||||
|
||||
// We encoded the file to a temporary buffer and now need to write it
|
||||
if cmd.compress_lz4 {
|
||||
println!("Buffer-Size: {} ({} Sectors)", buffer.len(), (buffer.len() + 2047)/2048);
|
||||
let buffer = tool_helper::compress::lz4(&buffer, 16)?;
|
||||
println!("New buffer-Size: {} ({} Sectors)", buffer.len(), (buffer.len() + 2047)/2048);
|
||||
|
||||
output_file.write(&buffer)?;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user