Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
libaec
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mathis Rosenhauer
libaec
Commits
e85b4fe2
Commit
e85b4fe2
authored
12 years ago
by
Mathis Rosenhauer
Committed by
Thomas Jahns
12 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Simple zero block check
parent
0604e04b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
.gitignore
+6
-5
6 additions, 5 deletions
.gitignore
Makefile.am
+1
-1
1 addition, 1 deletion
Makefile.am
configure.ac
+2
-1
2 additions, 1 deletion
configure.ac
tests/Makefile.am
+5
-0
5 additions, 0 deletions
tests/Makefile.am
tests/check_aec.c
+116
-0
116 additions, 0 deletions
tests/check_aec.c
with
130 additions
and
7 deletions
.gitignore
+
6
−
5
View file @
e85b4fe2
Makefile
Makefile.in
aclocal.m4
config
/
src/
.libs
/
src/
.deps
/
config
.libs
.deps
src/aec
src/test_szcomp
*.o
...
...
@@ -13,5 +13,6 @@ config.log
config.status
configure
libtool
autom4te.cache/
m4/
autom4te.cache
m4
This diff is collapsed.
Click to expand it.
Makefile.am
+
1
−
1
View file @
e85b4fe2
ACLOCAL_AMFLAGS
=
-I
m4
SUBDIRS
=
src
SUBDIRS
=
src
tests
This diff is collapsed.
Click to expand it.
configure.ac
+
2
−
1
View file @
e85b4fe2
...
...
@@ -33,7 +33,8 @@ AC_FUNC_MALLOC
AC_CHECK_FUNCS([memset strstr])
AC_CONFIG_FILES([Makefile
src/Makefile])
src/Makefile
tests/Makefile])
AC_OUTPUT
# Checks compilers and preprocessors
...
...
This diff is collapsed.
Click to expand it.
tests/Makefile.am
0 → 100644
+
5
−
0
View file @
e85b4fe2
INCLUDES
=
-I
$(
top_srcdir
)
/src
TESTS
=
check_aec
check_PROGRAMS
=
check_aec
check_aec_SOURCES
=
check_aec.c
$(
top_builddir
)
/src/libaec.h
check_aec_LDADD
=
$(
top_builddir
)
/src/libaec-0.0.la
This diff is collapsed.
Click to expand it.
tests/check_aec.c
0 → 100644
+
116
−
0
View file @
e85b4fe2
#include
<stdio.h>
#include
<stdlib.h>
#include
<unistd.h>
#include
<inttypes.h>
#include
<string.h>
#include
"libaec.h"
#define BUF_SIZE 1024
int
encode_decode
(
struct
aec_stream
*
strm
,
uint8_t
*
ubuf
,
uint8_t
*
cbuf
,
uint8_t
*
obuf
,
size_t
n
)
{
int
status
;
strm
->
avail_in
=
n
;
strm
->
avail_out
=
n
;
strm
->
next_in
=
ubuf
;
strm
->
next_out
=
cbuf
;
status
=
aec_encode_init
(
strm
);
if
(
status
!=
AEC_OK
)
{
printf
(
"Init failed.
\n
"
);
return
99
;
}
status
=
aec_encode
(
strm
,
AEC_FLUSH
);
if
(
status
!=
AEC_OK
)
{
printf
(
"Encode failed.
\n
"
);
return
99
;
}
aec_encode_end
(
strm
);
strm
->
avail_in
=
strm
->
total_out
;
strm
->
avail_out
=
n
;
strm
->
next_in
=
cbuf
;
strm
->
next_out
=
obuf
;
status
=
aec_decode_init
(
strm
);
if
(
status
!=
AEC_OK
)
{
printf
(
"Init failed.
\n
"
);
return
99
;
}
status
=
aec_decode
(
strm
,
AEC_FLUSH
);
if
(
status
!=
AEC_OK
)
{
printf
(
"Decode failed.
\n
"
);
return
99
;
}
if
(
memcmp
(
ubuf
,
obuf
,
n
))
{
printf
(
"FAIL: Uncompressed output differs from input.
\n
"
);
return
99
;
}
aec_decode_end
(
strm
);
return
0
;
}
int
check_zero
(
struct
aec_stream
*
strm
,
uint8_t
*
ubuf
,
uint8_t
*
cbuf
,
uint8_t
*
obuf
,
size_t
n
)
{
int
bs
,
status
;
for
(
bs
=
8
;
bs
<=
64
;
bs
*=
2
)
{
memset
(
ubuf
,
0x55
,
n
);
strm
->
bit_per_sample
=
8
;
strm
->
block_size
=
bs
;
strm
->
rsi
=
n
/
bs
;
strm
->
flags
=
AEC_DATA_PREPROCESS
;
printf
(
"Checking zero blocks with block size %i ... "
,
bs
);
status
=
encode_decode
(
strm
,
ubuf
,
cbuf
,
obuf
,
n
);
if
(
status
)
return
status
;
if
((
cbuf
[
0
]
&
0xf0
)
!=
0
)
{
printf
(
"FAIL: Unexpected block created.
\n
"
);
return
99
;
}
printf
(
"OK
\n
"
);
}
return
0
;
}
int
main
(
void
)
{
int
status
;
uint8_t
*
ubuf
,
*
cbuf
,
*
obuf
;
struct
aec_stream
strm
;
ubuf
=
(
uint8_t
*
)
malloc
(
BUF_SIZE
);
cbuf
=
(
uint8_t
*
)
malloc
(
BUF_SIZE
);
obuf
=
(
uint8_t
*
)
malloc
(
BUF_SIZE
);
if
(
!
ubuf
||
!
cbuf
||
!
obuf
)
{
printf
(
"Not enough memory.
\n
"
);
return
99
;
}
status
=
check_zero
(
&
strm
,
ubuf
,
cbuf
,
obuf
,
BUF_SIZE
);
if
(
status
)
return
status
;
free
(
ubuf
);
free
(
cbuf
);
free
(
obuf
);
return
0
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment