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
90461e49
Commit
90461e49
authored
Sep 27, 2012
by
Mathis Rosenhauer
Committed by
Thomas Jahns
Feb 19, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Boring MIN ist still faster, though
parent
fddd921e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
25 deletions
+25
-25
src/encode.c
src/encode.c
+25
-25
No files found.
src/encode.c
View file @
90461e49
...
...
@@ -125,15 +125,12 @@ static void preprocess_unsigned(struct aec_stream *strm)
{
int64_t
prev
,
d
,
t
;
uint32_t
*
buf
;
uint32_t
xmax
,
s
,
rsi
,
msb
,
bits
;
uint32_t
xmax
,
s
,
rsi
;
struct
internal_state
*
state
=
strm
->
state
;
buf
=
state
->
block_buf
;
prev
=
*
buf
++
;
xmax
=
state
->
xmax
;
msb
=
1UL
<<
(
strm
->
bit_per_sample
-
1
);
bits
=
32
-
strm
->
bit_per_sample
;
rsi
=
strm
->
rsi
*
strm
->
block_size
-
1
;
while
(
rsi
--
)
{
...
...
@@ -142,8 +139,7 @@ static void preprocess_unsigned(struct aec_stream *strm)
d
=
prev
-
*
buf
;
else
d
=
*
buf
-
prev
;
// t = MIN(prev, xmax - prev);
t
=
(
prev
^
((
int32_t
)((
prev
&
msb
)
<<
bits
)
>>
31
));
t
=
MIN
(
prev
,
xmax
-
prev
);
prev
=
*
buf
;
if
(
d
<=
t
)
*
buf
=
2
*
d
-
s
;
...
...
@@ -155,28 +151,32 @@ static void preprocess_unsigned(struct aec_stream *strm)
static
void
preprocess_signed
(
struct
aec_stream
*
strm
)
{
int
i
,
m
;
int64_t
theta
,
Delta
,
prev
,
sample
;
int64_t
prev
,
d
,
t
,
v
,
xmax
,
xmin
;
uint32_t
*
buf
;
uint32_t
s
,
rsi
,
m
;
struct
internal_state
*
state
=
strm
->
state
;
buf
=
state
->
block_buf
;
m
=
64
-
strm
->
bit_per_sample
;
prev
=
((
int64_t
)
state
->
block_buf
[
0
]
<<
m
)
>>
m
;
for
(
i
=
1
;
i
<
strm
->
rsi
*
strm
->
block_size
;
i
++
)
{
theta
=
MIN
(
prev
-
state
->
xmin
,
state
->
xmax
-
prev
);
sample
=
((
int64_t
)
state
->
block_buf
[
i
]
<<
m
)
>>
m
;
Delta
=
sample
-
prev
;
prev
=
sample
;
if
(
0
<=
Delta
&&
Delta
<=
theta
)
{
state
->
block_buf
[
i
]
=
2
*
Delta
;
}
else
if
(
-
theta
<=
Delta
&&
Delta
<
0
)
{
state
->
block_buf
[
i
]
=
2
*
(
Delta
<
0
?
-
(
uint64_t
)
Delta
:
Delta
)
-
1
;
}
else
{
state
->
block_buf
[
i
]
=
theta
+
(
Delta
<
0
?
-
(
uint64_t
)
Delta
:
Delta
);
}
prev
=
(((
int64_t
)
*
buf
++
)
<<
m
)
>>
m
;
xmax
=
state
->
xmax
;
xmin
=
state
->
xmin
;
rsi
=
strm
->
rsi
*
strm
->
block_size
-
1
;
while
(
rsi
--
)
{
v
=
(((
int64_t
)
*
buf
)
<<
m
)
>>
m
;
s
=
v
<
prev
;
if
(
s
)
d
=
prev
-
v
;
else
d
=
v
-
prev
;
t
=
MIN
(
prev
-
xmin
,
xmax
-
prev
);
prev
=
v
;
if
(
d
<=
t
)
*
buf
=
2
*
d
-
s
;
else
*
buf
=
t
+
d
;
buf
++
;
}
}
...
...
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