Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
libaec
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Mathis Rosenhauer
libaec
Commits
bccdb29d
Commit
bccdb29d
authored
Aug 31, 2012
by
Mathis Rosenhauer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Additions from 121x0b2: option selection, larger blocks.
parent
4b97410f
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
70 additions
and
52 deletions
+70
-52
src/Makefile
src/Makefile
+4
-6
src/aed.c
src/aed.c
+7
-2
src/aee.c
src/aee.c
+20
-16
src/aee_mutators.c
src/aee_mutators.c
+28
-24
src/aee_mutators.h
src/aee_mutators.h
+3
-2
src/decode.c
src/decode.c
+4
-1
src/encode.c
src/encode.c
+4
-1
No files found.
src/Makefile
View file @
bccdb29d
...
...
@@ -40,12 +40,10 @@ clean:
*
.gcno
*
.gcda
*
.gcov gmon.out
check
:
encode decode test_szcomp
./encode
-c
-b1
-B8
-R128
../data/example_data
>
../data/test.aee
./decode
-b1
-B8
-R128
../data/test.aee
./encode
-c
-b1
-B8
-R128
-J64
../data/example_data
>
../data/test.aee
./decode
-b1
-B8
-R128
-J64
../data/test.aee
diff ../data/test ../data/example_data
./encode
-c
-b1024
-B8
-R128
../data/example_data
>
../data/test.aee
./decode
-b1024
-B8
-R128
../data/test.aee
./encode
-c
-b1024
-B8
-R128
-J64
../data/example_data
>
../data/test.aee
./decode
-b1024
-B8
-R128
-J64
../data/test.aee
diff ../data/test ../data/example_data
./test_szcomp 65536 ../data/example_data_16
src/aed.c
View file @
bccdb29d
...
...
@@ -42,7 +42,7 @@ typedef struct internal_state {
}
decode_state
;
/* decoding table for the second-extension option */
static
const
int
second_extension
[
36
][
2
]
=
{
static
const
int
second_extension
[
92
][
2
]
=
{
{
0
,
0
},
{
1
,
1
},
{
1
,
1
},
{
2
,
3
},
{
2
,
3
},
{
2
,
3
},
...
...
@@ -50,7 +50,12 @@ static const int second_extension[36][2] = {
{
4
,
10
},
{
4
,
10
},
{
4
,
10
},
{
4
,
10
},
{
4
,
10
},
{
5
,
15
},
{
5
,
15
},
{
5
,
15
},
{
5
,
15
},
{
5
,
15
},
{
5
,
15
},
{
6
,
21
},
{
6
,
21
},
{
6
,
21
},
{
6
,
21
},
{
6
,
21
},
{
6
,
21
},
{
6
,
21
},
{
7
,
28
},
{
7
,
28
},
{
7
,
28
},
{
7
,
28
},
{
7
,
28
},
{
7
,
28
},
{
7
,
28
},
{
7
,
28
}
{
7
,
28
},
{
7
,
28
},
{
7
,
28
},
{
7
,
28
},
{
7
,
28
},
{
7
,
28
},
{
7
,
28
},
{
7
,
28
},
{
8
,
36
},
{
8
,
36
},
{
8
,
36
},
{
8
,
36
},
{
8
,
36
},
{
8
,
36
},
{
8
,
36
},
{
8
,
36
},
{
8
,
36
},
{
9
,
45
},
{
9
,
45
},
{
9
,
45
},
{
9
,
45
},
{
9
,
45
},
{
9
,
45
},
{
9
,
45
},
{
9
,
45
},
{
9
,
45
},
{
9
,
45
},
{
10
,
55
},
{
10
,
55
},
{
10
,
55
},
{
10
,
55
},
{
10
,
55
},
{
10
,
55
},
{
10
,
55
},
{
10
,
55
},
{
10
,
55
},
{
10
,
55
},
{
10
,
55
},
{
11
,
66
},
{
11
,
66
},
{
11
,
66
},
{
11
,
66
},
{
11
,
66
},
{
11
,
66
},
{
11
,
66
},
{
11
,
66
},
{
11
,
66
},
{
11
,
66
},
{
11
,
66
},
{
11
,
66
},
{
12
,
78
},
{
12
,
78
},
{
12
,
78
},
{
12
,
78
},
{
12
,
78
},
{
12
,
78
},
{
12
,
78
},
{
12
,
78
},
{
12
,
78
},
{
12
,
78
},
{
12
,
78
},
{
12
,
78
},
{
12
,
78
}
};
enum
...
...
src/aee.c
View file @
bccdb29d
...
...
@@ -336,7 +336,7 @@ static inline int m_check_zero_block(ae_streamp strm)
static
inline
int
m_select_code_option
(
ae_streamp
strm
)
{
int
i
,
k
,
this_bs
,
looked_bothways
,
direction
;
int
i
,
j
,
k
,
this_bs
,
looked_bothways
,
direction
;
int64_t
d
,
split_len
,
uncomp_len
;
int64_t
split_len_min
,
se_len
,
fs_len
;
encode_state
*
state
=
strm
->
state
;
...
...
@@ -365,15 +365,9 @@ static inline int m_select_code_option(ae_streamp strm)
if
(
state
->
ref
==
0
)
fs_len
+=
(
state
->
in_block
[
0
]
>>
i
);
if
(
strm
->
block_size
==
16
)
fs_len
+=
(
state
->
in_block
[
8
]
>>
i
)
+
(
state
->
in_block
[
9
]
>>
i
)
+
(
state
->
in_block
[
10
]
>>
i
)
+
(
state
->
in_block
[
11
]
>>
i
)
+
(
state
->
in_block
[
12
]
>>
i
)
+
(
state
->
in_block
[
13
]
>>
i
)
+
(
state
->
in_block
[
14
]
>>
i
)
+
(
state
->
in_block
[
15
]
>>
i
);
if
(
strm
->
block_size
>
8
)
for
(
j
=
8
;
j
<
strm
->
block_size
;
j
++
)
fs_len
+=
state
->
in_block
[
j
]
>>
i
;
split_len
=
fs_len
+
this_bs
*
(
i
+
1
);
...
...
@@ -480,7 +474,7 @@ static inline int m_select_code_option(ae_streamp strm)
/* Decide which option to use */
if
(
split_len_min
<
uncomp_len
)
{
if
(
split_len_min
<
=
se_len
)
if
(
split_len_min
<
se_len
)
{
/* Splitting won - the most common case. */
return
m_encode_splitting
(
strm
);
...
...
@@ -622,9 +616,16 @@ int ae_encode_init(ae_streamp strm)
/* Some sanity checks */
if
(
strm
->
bit_per_sample
>
32
||
strm
->
bit_per_sample
==
0
)
{
return
AE_ERRNO
;
}
if
(
strm
->
block_size
!=
8
&&
strm
->
block_size
!=
16
&&
strm
->
block_size
!=
32
&&
strm
->
block_size
!=
64
)
return
AE_ERRNO
;
if
(
strm
->
rsi
>
4096
)
return
AE_ERRNO
;
/* Internal state for encoder */
state
=
(
encode_state
*
)
malloc
(
sizeof
(
encode_state
));
...
...
@@ -642,7 +643,10 @@ int ae_encode_init(ae_streamp strm)
state
->
in_blklen
=
4
*
strm
->
block_size
;
if
(
strm
->
flags
&
AE_DATA_MSB
)
{
state
->
get_sample
=
get_msb_32
;
state
->
get_block
=
get_block_msb_32
;
}
else
state
->
get_sample
=
get_lsb_32
;
}
...
...
@@ -659,7 +663,7 @@ int ae_encode_init(ae_streamp strm)
if
(
strm
->
block_size
==
8
)
state
->
get_block
=
get_block_msb_16_bs_8
;
else
state
->
get_block
=
get_block_msb_16
_bs_16
;
state
->
get_block
=
get_block_msb_16
;
}
else
state
->
get_sample
=
get_lsb_16
;
...
...
@@ -675,7 +679,7 @@ int ae_encode_init(ae_streamp strm)
if
(
strm
->
block_size
==
8
)
state
->
get_block
=
get_block_8_bs_8
;
else
state
->
get_block
=
get_block_8
_bs_16
;
state
->
get_block
=
get_block_8
;
}
if
(
strm
->
flags
&
AE_DATA_SIGNED
)
...
...
@@ -696,7 +700,7 @@ int ae_encode_init(ae_streamp strm)
}
/* Largest possible block according to specs */
state
->
out_blklen
=
(
5
+
16
*
32
)
/
8
+
3
;
state
->
out_blklen
=
(
5
+
64
*
32
)
/
8
+
3
;
state
->
out_block
=
(
uint8_t
*
)
malloc
(
state
->
out_blklen
);
if
(
state
->
out_block
==
NULL
)
{
...
...
src/aee_mutators.c
View file @
bccdb29d
...
...
@@ -82,7 +82,7 @@ void get_block_msb_16_bs_8(ae_streamp strm)
strm
->
avail_in
-=
16
;
}
void
get_block_msb_16
_bs_16
(
ae_streamp
strm
)
void
get_block_msb_16
(
ae_streamp
strm
)
{
int
i
;
int64_t
*
block
=
strm
->
state
->
in_block
;
...
...
@@ -92,9 +92,26 @@ void get_block_msb_16_bs_16(ae_streamp strm)
block
[
i
]
=
(
strm
->
next_in
[
2
*
i
]
<<
8
)
|
strm
->
next_in
[
2
*
i
+
1
];
}
strm
->
next_in
+=
32
;
strm
->
total_in
+=
32
;
strm
->
avail_in
-=
32
;
strm
->
next_in
+=
2
*
strm
->
block_size
;
strm
->
total_in
+=
2
*
strm
->
block_size
;
strm
->
avail_in
-=
2
*
strm
->
block_size
;
}
void
get_block_msb_32
(
ae_streamp
strm
)
{
int
i
;
int64_t
*
block
=
strm
->
state
->
in_block
;
for
(
i
=
0
;
i
<
strm
->
block_size
;
i
++
)
{
block
[
i
]
=
(
strm
->
next_in
[
4
*
i
]
<<
24
)
|
(
strm
->
next_in
[
4
*
i
+
1
]
<<
16
)
|
(
strm
->
next_in
[
4
*
i
+
2
]
<<
8
)
|
strm
->
next_in
[
4
*
i
+
3
];
}
strm
->
next_in
+=
4
*
strm
->
block_size
;
strm
->
total_in
+=
4
*
strm
->
block_size
;
strm
->
avail_in
-=
4
*
strm
->
block_size
;
}
void
get_block_8_bs_8
(
ae_streamp
strm
)
...
...
@@ -115,28 +132,15 @@ void get_block_8_bs_8(ae_streamp strm)
strm
->
avail_in
-=
8
;
}
void
get_block_8
_bs_16
(
ae_streamp
strm
)
void
get_block_8
(
ae_streamp
strm
)
{
int
i
;
int64_t
*
block
=
strm
->
state
->
in_block
;
block
[
0
]
=
strm
->
next_in
[
0
];
block
[
1
]
=
strm
->
next_in
[
1
];
block
[
2
]
=
strm
->
next_in
[
2
];
block
[
3
]
=
strm
->
next_in
[
3
];
block
[
4
]
=
strm
->
next_in
[
4
];
block
[
5
]
=
strm
->
next_in
[
5
];
block
[
6
]
=
strm
->
next_in
[
6
];
block
[
7
]
=
strm
->
next_in
[
7
];
block
[
8
]
=
strm
->
next_in
[
8
];
block
[
9
]
=
strm
->
next_in
[
9
];
block
[
10
]
=
strm
->
next_in
[
10
];
block
[
11
]
=
strm
->
next_in
[
11
];
block
[
12
]
=
strm
->
next_in
[
12
];
block
[
13
]
=
strm
->
next_in
[
13
];
block
[
14
]
=
strm
->
next_in
[
14
];
block
[
15
]
=
strm
->
next_in
[
15
];
for
(
i
=
0
;
i
<
strm
->
block_size
;
i
++
)
block
[
i
]
=
strm
->
next_in
[
i
];
strm
->
next_in
+=
16
;
strm
->
total_in
+=
16
;
strm
->
avail_in
-=
16
;
strm
->
next_in
+=
strm
->
block_size
;
strm
->
total_in
+=
strm
->
block_size
;
strm
->
avail_in
-=
strm
->
block_size
;
}
src/aee_mutators.h
View file @
bccdb29d
...
...
@@ -10,9 +10,10 @@ int64_t get_msb_32(ae_streamp);
int64_t
get_msb_16
(
ae_streamp
);
int64_t
get_8
(
ae_streamp
);
void
get_block_msb_32
(
ae_streamp
);
void
get_block_msb_16_bs_8
(
ae_streamp
);
void
get_block_msb_16
_bs_16
(
ae_streamp
);
void
get_block_msb_16
(
ae_streamp
);
void
get_block_8_bs_8
(
ae_streamp
);
void
get_block_8
_bs_16
(
ae_streamp
);
void
get_block_8
(
ae_streamp
);
#endif
src/decode.c
View file @
bccdb29d
...
...
@@ -27,7 +27,7 @@ int main(int argc, char *argv[])
strm
.
flags
=
AE_DATA_MSB
|
AE_DATA_PREPROCESS
;
opterr
=
0
;
while
((
c
=
getopt
(
argc
,
argv
,
"cb:B:R:"
))
!=
-
1
)
while
((
c
=
getopt
(
argc
,
argv
,
"cb:B:
J:
R:"
))
!=
-
1
)
switch
(
c
)
{
case
'b'
:
...
...
@@ -36,6 +36,9 @@ int main(int argc, char *argv[])
case
'B'
:
strm
.
bit_per_sample
=
atoi
(
optarg
);
break
;
case
'J'
:
strm
.
block_size
=
atoi
(
optarg
);
break
;
case
'R'
:
strm
.
rsi
=
atoi
(
optarg
);
break
;
...
...
src/encode.c
View file @
bccdb29d
...
...
@@ -27,7 +27,7 @@ int main(int argc, char *argv[])
strm
.
flags
=
AE_DATA_MSB
|
AE_DATA_PREPROCESS
;
opterr
=
0
;
while
((
c
=
getopt
(
argc
,
argv
,
"cb:B:R:"
))
!=
-
1
)
while
((
c
=
getopt
(
argc
,
argv
,
"cb:B:R:
J:
"
))
!=
-
1
)
switch
(
c
)
{
case
'b'
:
...
...
@@ -36,6 +36,9 @@ int main(int argc, char *argv[])
case
'B'
:
strm
.
bit_per_sample
=
atoi
(
optarg
);
break
;
case
'J'
:
strm
.
block_size
=
atoi
(
optarg
);
break
;
case
'R'
:
strm
.
rsi
=
atoi
(
optarg
);
break
;
...
...
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