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
b3e52ccd
Commit
b3e52ccd
authored
Sep 03, 2012
by
Mathis Rosenhauer
Browse files
int64_t casts to make 32Bit samples work again
parent
bccdb29d
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/Makefile
View file @
b3e52ccd
...
...
@@ -40,10 +40,10 @@ clean:
*
.gcno
*
.gcda
*
.gcov gmon.out
check
:
encode decode test_szcomp
./encode
-c
-b1
-B8
-R128
-J
64
../data/example_data
>
../data/test.aee
./decode
-b1
-B8
-R128
-J
64
../data/test.aee
./encode
-c
-b1
-B8
-R128
-J
8
../data/example_data
>
../data/test.aee
./decode
-b1
-B8
-R128
-J
8
../data/test.aee
diff ../data/test ../data/example_data
./encode
-c
-b1024
-B
8
-R128
-J64
../data/example_data
>
../data/test.aee
./decode
-b1024
-B
8
-R128
-J64
../data/test.aee
./encode
-c
-b1024
-B
32
-R128
-J64
../data/example_data
>
../data/test.aee
./decode
-b1024
-B
32
-R128
-J64
../data/test.aee
diff ../data/test ../data/example_data
./test_szcomp 65536 ../data/example_data_16
src/aed.c
View file @
b3e52ccd
...
...
@@ -170,7 +170,7 @@ static inline int64_t u_get(ae_streamp strm, unsigned int n)
return
(
state
->
acc
>>
state
->
bitp
)
&
((
1ULL
<<
n
)
-
1
);
}
static
inline
int
u_get_fs
(
ae_streamp
strm
)
static
inline
int
64_t
u_get_fs
(
ae_streamp
strm
)
{
/**
Interpret a Fundamental Sequence from the input buffer.
...
...
@@ -179,7 +179,7 @@ static inline int u_get_fs(ae_streamp strm)
1 is encountered. TODO: faster version.
*/
int
fs
=
0
;
int
64_t
fs
=
0
;
while
(
u_get
(
strm
,
1
)
==
0
)
fs
++
;
...
...
src/aee_mutators.c
View file @
b3e52ccd
...
...
@@ -7,10 +7,10 @@ int64_t get_lsb_32(ae_streamp strm)
{
int64_t
data
;
data
=
(
strm
->
next_in
[
3
]
<<
24
)
|
(
strm
->
next_in
[
2
]
<<
16
)
|
(
strm
->
next_in
[
1
]
<<
8
)
|
strm
->
next_in
[
0
];
data
=
(
(
int64_t
)
strm
->
next_in
[
3
]
<<
24
)
|
(
(
int64_t
)
strm
->
next_in
[
2
]
<<
16
)
|
(
(
int64_t
)
strm
->
next_in
[
1
]
<<
8
)
|
(
int64_t
)
strm
->
next_in
[
0
];
strm
->
next_in
+=
4
;
strm
->
total_in
+=
4
;
...
...
@@ -22,7 +22,8 @@ int64_t get_lsb_16(ae_streamp strm)
{
int64_t
data
;
data
=
(
strm
->
next_in
[
1
]
<<
8
)
|
strm
->
next_in
[
0
];
data
=
((
int64_t
)
strm
->
next_in
[
1
]
<<
8
)
|
(
int64_t
)
strm
->
next_in
[
0
];
strm
->
next_in
+=
2
;
strm
->
total_in
+=
2
;
...
...
@@ -34,10 +35,10 @@ int64_t get_msb_32(ae_streamp strm)
{
int64_t
data
;
data
=
(
strm
->
next_in
[
0
]
<<
24
)
|
(
strm
->
next_in
[
1
]
<<
16
)
|
(
strm
->
next_in
[
2
]
<<
8
)
|
strm
->
next_in
[
3
];
data
=
(
(
int64_t
)
strm
->
next_in
[
0
]
<<
24
)
|
(
(
int64_t
)
strm
->
next_in
[
1
]
<<
16
)
|
(
(
int64_t
)
strm
->
next_in
[
2
]
<<
8
)
|
(
int64_t
)
strm
->
next_in
[
3
];
strm
->
next_in
+=
4
;
strm
->
total_in
+=
4
;
...
...
@@ -49,7 +50,8 @@ int64_t get_msb_16(ae_streamp strm)
{
int64_t
data
;
data
=
(
strm
->
next_in
[
0
]
<<
8
)
|
strm
->
next_in
[
1
];
data
=
((
int64_t
)
strm
->
next_in
[
0
]
<<
8
)
|
(
int64_t
)
strm
->
next_in
[
1
];
strm
->
next_in
+=
2
;
strm
->
total_in
+=
2
;
...
...
@@ -68,14 +70,14 @@ void get_block_msb_16_bs_8(ae_streamp strm)
{
int64_t
*
block
=
strm
->
state
->
in_block
;
block
[
0
]
=
(
strm
->
next_in
[
0
]
<<
8
)
|
strm
->
next_in
[
1
];
block
[
1
]
=
(
strm
->
next_in
[
2
]
<<
8
)
|
strm
->
next_in
[
3
];
block
[
2
]
=
(
strm
->
next_in
[
4
]
<<
8
)
|
strm
->
next_in
[
5
];
block
[
3
]
=
(
strm
->
next_in
[
6
]
<<
8
)
|
strm
->
next_in
[
7
];
block
[
4
]
=
(
strm
->
next_in
[
8
]
<<
8
)
|
strm
->
next_in
[
9
];
block
[
5
]
=
(
strm
->
next_in
[
10
]
<<
8
)
|
strm
->
next_in
[
11
];
block
[
6
]
=
(
strm
->
next_in
[
12
]
<<
8
)
|
strm
->
next_in
[
13
];
block
[
7
]
=
(
strm
->
next_in
[
14
]
<<
8
)
|
strm
->
next_in
[
15
];
block
[
0
]
=
(
(
int64_t
)
strm
->
next_in
[
0
]
<<
8
)
|
(
int64_t
)
strm
->
next_in
[
1
];
block
[
1
]
=
(
(
int64_t
)
strm
->
next_in
[
2
]
<<
8
)
|
(
int64_t
)
strm
->
next_in
[
3
];
block
[
2
]
=
(
(
int64_t
)
strm
->
next_in
[
4
]
<<
8
)
|
(
int64_t
)
strm
->
next_in
[
5
];
block
[
3
]
=
(
(
int64_t
)
strm
->
next_in
[
6
]
<<
8
)
|
(
int64_t
)
strm
->
next_in
[
7
];
block
[
4
]
=
(
(
int64_t
)
strm
->
next_in
[
8
]
<<
8
)
|
(
int64_t
)
strm
->
next_in
[
9
];
block
[
5
]
=
(
(
int64_t
)
strm
->
next_in
[
10
]
<<
8
)
|
(
int64_t
)
strm
->
next_in
[
11
];
block
[
6
]
=
(
(
int64_t
)
strm
->
next_in
[
12
]
<<
8
)
|
(
int64_t
)
strm
->
next_in
[
13
];
block
[
7
]
=
(
(
int64_t
)
strm
->
next_in
[
14
]
<<
8
)
|
(
int64_t
)
strm
->
next_in
[
15
];
strm
->
next_in
+=
16
;
strm
->
total_in
+=
16
;
...
...
@@ -89,8 +91,8 @@ void get_block_msb_16(ae_streamp strm)
for
(
i
=
0
;
i
<
strm
->
block_size
;
i
++
)
{
block
[
i
]
=
(
strm
->
next_in
[
2
*
i
]
<<
8
)
|
strm
->
next_in
[
2
*
i
+
1
];
block
[
i
]
=
(
(
int64_t
)
strm
->
next_in
[
2
*
i
]
<<
8
)
|
(
int64_t
)
strm
->
next_in
[
2
*
i
+
1
];
}
strm
->
next_in
+=
2
*
strm
->
block_size
;
strm
->
total_in
+=
2
*
strm
->
block_size
;
...
...
@@ -104,10 +106,10 @@ void get_block_msb_32(ae_streamp strm)
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
];
block
[
i
]
=
(
(
int64_t
)
strm
->
next_in
[
4
*
i
]
<<
24
)
|
(
(
int64_t
)
strm
->
next_in
[
4
*
i
+
1
]
<<
16
)
|
(
(
int64_t
)
strm
->
next_in
[
4
*
i
+
2
]
<<
8
)
|
(
int64_t
)
strm
->
next_in
[
4
*
i
+
3
];
}
strm
->
next_in
+=
4
*
strm
->
block_size
;
strm
->
total_in
+=
4
*
strm
->
block_size
;
...
...
src/decode.c
View file @
b3e52ccd
...
...
@@ -31,7 +31,7 @@ int main(int argc, char *argv[])
switch
(
c
)
{
case
'b'
:
chunk
=
2
*
atoi
(
optarg
);
chunk
=
atoi
(
optarg
);
break
;
case
'B'
:
strm
.
bit_per_sample
=
atoi
(
optarg
);
...
...
@@ -70,7 +70,7 @@ int main(int argc, char *argv[])
}
in
=
(
uint8_t
*
)
malloc
(
chunk
);
out
=
(
uint8_t
*
)
malloc
(
chunk
*
sizeof
(
uint8_t
)
);
out
=
(
uint8_t
*
)
malloc
(
chunk
);
if
(
in
==
NULL
||
out
==
NULL
)
return
1
;
...
...
src/encode.c
View file @
b3e52ccd
...
...
@@ -31,7 +31,7 @@ int main(int argc, char *argv[])
switch
(
c
)
{
case
'b'
:
chunk
=
2
*
atoi
(
optarg
);
chunk
=
atoi
(
optarg
);
break
;
case
'B'
:
strm
.
bit_per_sample
=
atoi
(
optarg
);
...
...
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