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
4705d72f
Commit
4705d72f
authored
Feb 04, 2014
by
Mathis Rosenhauer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add support for restricted coding options
parent
73f386c3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
55 additions
and
21 deletions
+55
-21
README
README
+2
-0
src/aec.c
src/aec.c
+27
-19
src/decode.c
src/decode.c
+13
-1
src/encode.c
src/encode.c
+12
-1
src/libaec.h
src/libaec.h
+1
-0
No files found.
README
View file @
4705d72f
...
...
@@ -113,6 +113,8 @@ architectures.
AEC_DATA_3BYTE: the 24 bit input data is stored in three bytes.
AEC_DATA_RESTRICT: use a restricted set of code options.
Data size:
Except for the AEC_DATA_3BYTE case for 24 bit data, the following
...
...
src/aec.c
View file @
4705d72f
...
...
@@ -84,34 +84,37 @@ int main(int argc, char *argv[])
strm
.
flags
=
AEC_DATA_PREPROCESS
;
opterr
=
0
;
while
((
c
=
getopt
(
argc
,
argv
,
"
d3Mscb:B:R:J:
"
))
!=
-
1
)
while
((
c
=
getopt
(
argc
,
argv
,
"
3b:cdj:mn:r:st
"
))
!=
-
1
)
switch
(
c
)
{
case
'
d
'
:
dflag
=
1
;
case
'
3
'
:
strm
.
flags
|=
AEC_DATA_3BYTE
;
break
;
case
'b'
:
chunk
=
atoi
(
optarg
);
break
;
case
'n'
:
strm
.
bits_per_sample
=
atoi
(
optarg
);
case
'c'
:
cflag
=
1
;
break
;
case
'd'
:
dflag
=
1
;
break
;
case
'j'
:
strm
.
block_size
=
atoi
(
optarg
);
break
;
case
'm'
:
strm
.
flags
|=
AEC_DATA_MSB
;
break
;
case
'n'
:
strm
.
bits_per_sample
=
atoi
(
optarg
);
break
;
case
'r'
:
strm
.
rsi
=
atoi
(
optarg
);
break
;
case
'c'
:
cflag
=
1
;
break
;
case
's'
:
strm
.
flags
|=
AEC_DATA_SIGNED
;
break
;
case
'm'
:
strm
.
flags
|=
AEC_DATA_MSB
;
break
;
case
'3'
:
strm
.
flags
|=
AEC_DATA_3BYTE
;
case
't'
:
strm
.
flags
|=
AEC_DATA_RESTRICT
;
break
;
case
'?'
:
if
(
optopt
==
'b'
)
...
...
@@ -140,7 +143,8 @@ int main(int argc, char *argv[])
fprintf
(
stderr
,
"-m
\n
samples are MSB first. Default is LSB
\n
"
);
fprintf
(
stderr
,
"-n
\n
bits per sample
\n
"
);
fprintf
(
stderr
,
"-r
\n
reference sample interval in blocks
\n
"
);
fprintf
(
stderr
,
"-s
\n
samples are signed. Default is unsigned
\n\n
"
);
fprintf
(
stderr
,
"-s
\n
samples are signed. Default is unsigned
\n
"
);
fprintf
(
stderr
,
"-t
\n
use restricted set of code options
\n\n
"
);
exit
(
-
1
);
}
...
...
@@ -180,7 +184,7 @@ int main(int argc, char *argv[])
if
(
dflag
)
{
if
((
ext
=
strstr
(
infn
,
".rz"
))
==
NULL
)
{
fprintf
(
stderr
,
"E
rror
: input file needs to end with .rz
\n
"
);
fprintf
(
stderr
,
"E
RROR
: input file needs to end with .rz
\n
"
);
exit
(
-
1
);
}
strncpy
(
outfn
,
infn
,
ext
-
infn
);
...
...
@@ -193,11 +197,15 @@ int main(int argc, char *argv[])
}
if
(
dflag
)
{
if
(
aec_decode_init
(
&
strm
)
!=
AEC_OK
)
if
(
aec_decode_init
(
&
strm
)
!=
AEC_OK
)
{
fprintf
(
stderr
,
"ERROR: Initialization failed
\n
"
);
return
1
;
}
}
else
{
if
(
aec_encode_init
(
&
strm
)
!=
AEC_OK
)
if
(
aec_encode_init
(
&
strm
)
!=
AEC_OK
)
{
fprintf
(
stderr
,
"ERROR: Initialization failed
\n
"
);
return
1
;
}
}
while
(
input_avail
||
output_avail
)
{
...
...
@@ -214,7 +222,7 @@ int main(int argc, char *argv[])
status
=
aec_encode
(
&
strm
,
AEC_NO_FLUSH
);
if
(
status
!=
AEC_OK
)
{
fprintf
(
stderr
,
"
error is
%i
\n
"
,
status
);
fprintf
(
stderr
,
"
ERROR:
%i
\n
"
,
status
);
return
1
;
}
...
...
@@ -234,7 +242,7 @@ int main(int argc, char *argv[])
aec_decode_end
(
&
strm
);
}
else
{
if
((
status
=
aec_encode
(
&
strm
,
AEC_FLUSH
))
!=
AEC_OK
)
{
fprintf
(
stderr
,
"
error is
%i
\n
"
,
status
);
fprintf
(
stderr
,
"
ERROR:
%i
\n
"
,
status
);
return
1
;
}
...
...
src/decode.c
View file @
4705d72f
...
...
@@ -669,8 +669,20 @@ int aec_decode_init(struct aec_stream *strm)
else
state
->
flush_output
=
flush_lsb_16
;
}
else
{
if
(
strm
->
flags
&
AEC_DATA_RESTRICT
)
{
if
(
strm
->
bits_per_sample
<=
4
)
{
if
(
strm
->
bits_per_sample
<=
2
)
state
->
id_len
=
1
;
else
state
->
id_len
=
2
;
}
else
{
return
AEC_CONF_ERROR
;
}
}
else
{
state
->
id_len
=
3
;
}
state
->
bytes_per_sample
=
1
;
state
->
id_len
=
3
;
state
->
out_blklen
=
strm
->
block_size
;
state
->
flush_output
=
flush_8
;
}
...
...
src/encode.c
View file @
4705d72f
...
...
@@ -817,7 +817,18 @@ int aec_encode_init(struct aec_stream *strm)
}
}
else
{
/* 8 bit settings */
state
->
id_len
=
3
;
if
(
strm
->
flags
&
AEC_DATA_RESTRICT
)
{
if
(
strm
->
bits_per_sample
<=
4
)
{
if
(
strm
->
bits_per_sample
<=
2
)
state
->
id_len
=
1
;
else
state
->
id_len
=
2
;
}
else
{
return
AEC_CONF_ERROR
;
}
}
else
{
state
->
id_len
=
3
;
}
state
->
bytes_per_sample
=
1
;
state
->
get_sample
=
aec_get_8
;
...
...
src/libaec.h
View file @
4705d72f
...
...
@@ -94,6 +94,7 @@ struct aec_stream {
* of the host. Default is LSB.
*/
#define AEC_DATA_PREPROCESS 8
/* Set if preprocessor should be used */
#define AEC_DATA_RESTRICT 16
/* Use restricted set of code options */
/* Return codes of library functions */
#define AEC_OK 0
...
...
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