decompressing multiple blocks with a single frame?

296 views
Skip to first unread message

compdecomp7

unread,
Oct 18, 2018, 9:35:01 PM10/18/18
to LZ4c
So I have multiple blocks which are not independent of each other and I create a single frame for the multiple blocks and I try to decompress. But I run into some problem. Should the following method work?


  This is what I add in the frame:

Magic number (shown in hex) -> 0x184D2204 (hex)

FLG (shown in binary)  ->  $version="01" , $b_ind="0" , $b_csum="0" , $c_size="0" , $c_csum=”1” , $rsvd ="0", $dict_id="0"

BD (shown in decimal) ->  Block_max_size= 6 (The original uncompressed file is much less than 1MB)

HC = calculated using the xxhash that came with the LZ4.

Then I add the two blocks

 <block_size0,block_data0><block_size1,block_data1>

 The I add the

  End Mark (shown in hex) = 0000_0000

  Check sum = calculated using the xxhash

Now if I try to decompress using the lz4 -d , I get a Error 66 : Decompression error : ERROR_decompressionFailed


I usually have independent blocks and I create frames for each blocks and concatenate the frames. Then I decompress using the lz4 utility. In that case I never have a problem.

Cyan

unread,
Oct 22, 2018, 4:20:23 PM10/22/18
to LZ4c
Interesting.

So you state that, using exactly the same code structure, it works fine when block are independent.
It's only when they are related that you get a decompression error ?

Error 66 happens here : 

So it's an error from the frame decompression library,
which can only be generated here : 

which means it comes from the block decompression library.

Without more information (such as a faulty frame for example), I can only speculate.
Maybe the decoder fails, because it detects that the 2nd block needs data from 1st block, and consider it to be an error ?
In other words, it still acts as if blocks where supposed to be independent ?

In which case, is the proper flag correctly set ?

In your example, `$b_ind="0"` seems to indicate that this flag is set appropriately.
But since this is just pseudo code, I have no idea how it's effectively translated at binary level,
so cannot be completely sure that it is set as advertised.


Note : I've checked that the decoder is able to decompress frames with related blocks.

compdecomp7

unread,
Nov 5, 2018, 10:13:37 AM11/5/18
to LZ4c
Hi Yann,

Thanks for the reply. As usual it was a mistake on my part. I was adding an extra block size on top of the individual block sizes.


<WRONG BLOCK SIZE WHICH WAS SUM OF block_size0 and block_size1> <block_size0,block_data0><block_size1,block_data1>

This was confusing the de-compressor and hence the error.

thanks
for your help.
Reply all
Reply to author
Forward
0 new messages