Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mathis Rosenhauer
libaec
Commits
79136519
Commit
79136519
authored
Aug 22, 2012
by
Mathis Rosenhauer
Browse files
Szip decompression error be gone
parent
d1f7331a
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/Makefile
View file @
79136519
...
...
@@ -39,11 +39,11 @@ clean:
*
.gcno
*
.gcda
*
.gcov gmon.out
check
:
encode decode test_szcomp
./encode
-c
-b1
-B8
-
S
128
../data/example_data
>
../data/test.aee
./decode
-b1
-B8
-
S
128
../data/test.aee
./encode
-c
-b1
-B8
-
R
128
../data/example_data
>
../data/test.aee
./decode
-b1
-B8
-
R
128
../data/test.aee
diff ../data/test ../data/example_data
./encode
-c
-b1024
-B8
-
S
128
../data/example_data
>
../data/test.aee
./decode
-b1024
-B8
-
S
128
../data/test.aee
./encode
-c
-b1024
-B8
-
R
128
../data/example_data
>
../data/test.aee
./decode
-b1024
-B8
-
R
128
../data/test.aee
diff ../data/test ../data/example_data
./test_szcomp 65536 ../data/example_data_16
...
...
src/aed.c
View file @
79136519
...
...
@@ -302,7 +302,7 @@ int ae_decode_init(ae_streamp strm)
state
->
xmax
=
(
1ULL
<<
strm
->
bit_per_sample
)
-
1
;
}
state
->
ref_int
=
strm
->
block_size
*
strm
->
segment_size
;
state
->
ref_int
=
strm
->
block_size
*
strm
->
rsi
;
state
->
in_blklen
=
(
strm
->
block_size
*
strm
->
bit_per_sample
+
state
->
id_len
)
/
8
+
1
;
...
...
@@ -431,7 +431,7 @@ int ae_decode(ae_streamp strm, int flush)
{
case
M_ID
:
if
(
state
->
pp
&&
(
state
->
samples_out
/
strm
->
block_size
)
%
strm
->
segment_size
==
0
)
&&
(
state
->
samples_out
/
strm
->
block_size
)
%
strm
->
rsi
==
0
)
state
->
ref
=
1
;
else
state
->
ref
=
0
;
...
...
@@ -513,9 +513,9 @@ int ae_decode(ae_streamp strm, int flush)
if
(
zero_blocks
==
ROS
)
{
zero_blocks
=
strm
->
segment_size
-
(
zero_blocks
=
64
-
(
(
state
->
samples_out
/
strm
->
block_size
)
%
strm
->
segment_size
);
%
strm
->
rsi
%
64
);
}
else
if
(
zero_blocks
>
ROS
)
{
...
...
src/aee.c
View file @
79136519
...
...
@@ -182,11 +182,8 @@ int ae_encode_init(ae_streamp strm)
return
AE_MEM_ERROR
;
}
/* Zero blocks can span a segment and thus need up to segment_size
bits in encoded block */
blklen
=
MAX
(
strm
->
block_size
*
strm
->
bit_per_sample
,
strm
->
segment_size
+
10
);
blklen
=
(
blklen
+
state
->
id_len
)
/
8
+
3
;
/* Largest possible block according to specs */
blklen
=
(
5
+
16
*
32
)
/
8
+
3
;
state
->
block_out
=
(
uint8_t
*
)
malloc
(
blklen
);
if
(
state
->
block_out
==
NULL
)
{
...
...
@@ -380,7 +377,7 @@ int ae_encode(ae_streamp strm, int flush)
/* If this is the first block in a segment
then we need to insert a reference sample.
*/
if
(
state
->
total_blocks
%
strm
->
segment_size
==
1
)
if
(
state
->
total_blocks
%
strm
->
rsi
==
1
)
{
state
->
ref
=
1
;
state
->
last_in
=
state
->
block_in
[
0
];
...
...
@@ -430,7 +427,7 @@ int ae_encode(ae_streamp strm, int flush)
state
->
zero_blocks
++
;
if
(
state
->
total_blocks
%
strm
->
segment_size
==
0
)
if
(
state
->
total_blocks
%
strm
->
rsi
%
64
==
0
)
{
#ifdef PROFILE
state
->
prof
[
0
]
+=
state
->
zero_blocks
;
...
...
src/decode.c
View file @
79136519
...
...
@@ -22,11 +22,11 @@ int main(int argc, char *argv[])
chunk
=
CHUNK
;
strm
.
bit_per_sample
=
8
;
strm
.
block_size
=
8
;
strm
.
segment_size
=
2
;
strm
.
rsi
=
2
;
strm
.
flags
=
AE_DATA_MSB
|
AE_DATA_PREPROCESS
;
opterr
=
0
;
while
((
c
=
getopt
(
argc
,
argv
,
"cb:B:
S
:"
))
!=
-
1
)
while
((
c
=
getopt
(
argc
,
argv
,
"cb:B:
R
:"
))
!=
-
1
)
switch
(
c
)
{
case
'b'
:
...
...
@@ -35,8 +35,8 @@ int main(int argc, char *argv[])
case
'B'
:
strm
.
bit_per_sample
=
atoi
(
optarg
);
break
;
case
'
S
'
:
strm
.
segment_size
=
atoi
(
optarg
);
case
'
R
'
:
strm
.
rsi
=
atoi
(
optarg
);
break
;
case
'c'
:
cflag
=
1
;
...
...
src/encode.c
View file @
79136519
...
...
@@ -22,11 +22,11 @@ int main(int argc, char *argv[])
chunk
=
CHUNK
;
strm
.
bit_per_sample
=
8
;
strm
.
block_size
=
8
;
strm
.
segment_size
=
2
;
strm
.
rsi
=
2
;
strm
.
flags
=
AE_DATA_MSB
|
AE_DATA_PREPROCESS
;
opterr
=
0
;
while
((
c
=
getopt
(
argc
,
argv
,
"cb:B:
S
:"
))
!=
-
1
)
while
((
c
=
getopt
(
argc
,
argv
,
"cb:B:
R
:"
))
!=
-
1
)
switch
(
c
)
{
case
'b'
:
...
...
@@ -35,8 +35,8 @@ int main(int argc, char *argv[])
case
'B'
:
strm
.
bit_per_sample
=
atoi
(
optarg
);
break
;
case
'
S
'
:
strm
.
segment_size
=
atoi
(
optarg
);
case
'
R
'
:
strm
.
rsi
=
atoi
(
optarg
);
break
;
case
'c'
:
cflag
=
1
;
...
...
src/libae.h
View file @
79136519
...
...
@@ -18,8 +18,9 @@ typedef struct _ae_stream
uint32_t
bit_per_sample
;
/* resolution in bits per sample (n =
* 1,..., 32) */
uint32_t
block_size
;
/* block size in samples (J = 8 or 16) */
uint32_t
segment_size
;
/* set of blocks between consecutive
* reference samples */
uint32_t
rsi
;
/* Reference sample interval, the number of
blocks between consecutive reference
samples. */
uint32_t
flags
;
struct
internal_state
*
state
;
...
...
src/sz_compat.c
View file @
79136519
...
...
@@ -8,7 +8,7 @@ int SZ_BufftoBuffCompress(void *dest, size_t *destLen, const void *source, size_
strm
.
bit_per_sample
=
param
->
bits_per_pixel
;
strm
.
block_size
=
param
->
pixels_per_block
;
strm
.
segment_size
=
param
->
pixels_per_scanline
/
param
->
pixels_per_block
;
strm
.
rsi
=
param
->
pixels_per_scanline
/
param
->
pixels_per_block
;
strm
.
flags
=
param
->
options_mask
;
strm
.
avail_in
=
sourceLen
;
strm
.
avail_out
=
*
destLen
;
...
...
@@ -36,7 +36,7 @@ int SZ_BufftoBuffDecompress(void *dest, size_t *destLen, const void *source, siz
strm
.
bit_per_sample
=
param
->
bits_per_pixel
;
strm
.
block_size
=
param
->
pixels_per_block
;
strm
.
segment_size
=
param
->
pixels_per_scanline
/
param
->
pixels_per_block
;
strm
.
rsi
=
param
->
pixels_per_scanline
/
param
->
pixels_per_block
;
strm
.
flags
=
param
->
options_mask
;
strm
.
avail_in
=
sourceLen
;
strm
.
avail_out
=
*
destLen
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment