Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Mathis Rosenhauer
libaec
Commits
422bd247
Commit
422bd247
authored
Sep 23, 2012
by
Mathis Rosenhauer
Committed by
Thomas Jahns
Feb 19, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove skipping as it doesn't help much if any
parent
860ce5b5
Changes
1
Hide whitespace changes
Inline
Sidebyside
Showing
1 changed file
with
24 additions
and
48 deletions
+24
48
src/encode.c
src/encode.c
+24
48
No files found.
src/encode.c
View file @
422bd247
...
@@ 358,33 +358,20 @@ static int count_splitting_option(struct aec_stream *strm)
...
@@ 358,33 +358,20 @@ static int count_splitting_option(struct aec_stream *strm)
CDS length, we start with the k of the previous CDS. K is
CDS length, we start with the k of the previous CDS. K is
increased and the CDS length evaluated. If the CDS length gets
increased and the CDS length evaluated. If the CDS length gets
smaller, then we are moving towards the minimum. If the length
smaller, then we are moving towards the minimum. If the length
increases, then the minimum will be found with smaller k. Two
increases, then the minimum will be found with smaller k.
additional checks are used to speed up the process:
For increasing k we know that we will gain block_size bits in
1. If we are increasing k to find the minimum then we know that
length through the larger binary part. If the FS lenth is less
k+1 will at most eliminate the FS part. OTOH we gain block_size
than the block size then a reduced FS part can't compensate the
bits in length through the increased binary part. So if the FS
larger binary part. So we know that the CDS for k+1 will be
lenth is already less than the block size then the length of
larger than for k without actually computing the length. An
the CDS for k+1 will be larger than for k. The same can be done
analogue check can be done for decreasing k.
for decreasing k.
2. If 1. is not the case then we have to continue looking. The
next step would be to increase k by one and evaluate the CDS
length. A lower limit for the k+1 FS length is
0.5*(FS_lenblock_size). If half of that is more than
block_size then we can skip k+1 altogether. This reduces to the
condition:
if (fs_len > 5 * block_size)
k++;
We can be repeat this step while the condition is met to skip
several k.
*/
*/
int
k
,
k_min
;
int
k
,
k_min
;
int
this_bs
;
/* Block size of current block */
int
this_bs
;
/* Block size of current block */
int
min_dir
;
/* 1 if we s
aw a decrease in CDS length
*/
int
no_turn
;
/* 1 if we s
houldn't reverse
*/
int
dir
;
/* Direction, 1 means increasing k, 0 decreasing k */
int
dir
;
/* Direction, 1 means increasing k, 0 decreasing k */
uint64_t
len
;
/* CDS length for current k */
uint64_t
len
;
/* CDS length for current k */
uint64_t
len_min
;
/* CDS length minimum so far */
uint64_t
len_min
;
/* CDS length minimum so far */
...
@@ 395,8 +382,8 @@ static int count_splitting_option(struct aec_stream *strm)
...
@@ 395,8 +382,8 @@ static int count_splitting_option(struct aec_stream *strm)
this_bs
=
strm
>
block_size

state
>
ref
;
this_bs
=
strm
>
block_size

state
>
ref
;
len_min
=
UINT64_MAX
;
len_min
=
UINT64_MAX
;
k
=
k_min
=
state
>
k
;
k
=
k_min
=
state
>
k
;
no_turn
=
(
k
==
0
)
?
1
:
0
;
dir
=
1
;
dir
=
1
;
min_dir
=
0
;
for
(;;)
{
for
(;;)
{
fs_len
=
block_fs
(
strm
,
k
);
fs_len
=
block_fs
(
strm
,
k
);
...
@@ 404,43 +391,32 @@ static int count_splitting_option(struct aec_stream *strm)
...
@@ 404,43 +391,32 @@ static int count_splitting_option(struct aec_stream *strm)
if
(
len
<
len_min
)
{
if
(
len
<
len_min
)
{
if
(
len_min
<
UINT64_MAX
)
if
(
len_min
<
UINT64_MAX
)
min_dir
=
1
;
no_turn
=
1
;
len_min
=
len
;
len_min
=
len
;
k_min
=
k
;
k_min
=
k
;
if
(
dir
)
{
if
(
dir
)
{
if
(
fs_len
<
this_bs
)
{
if
(
fs_len
<
this_bs

k
>=
state
>
kmax
)
{
goto
reverse
;
if
(
no_turn
)
}
else
{
break
;
while
(
fs_len
>
5
*
this_bs
)
{
k
=
state
>
k

1
;
k
++
;
dir
=
0
;
fs_len
/=
5
;
no_turn
=
1
;
}
}
}
k
++
;
if
(
k
>=
state
>
kmax
)
goto
reverse
;
else
k
++
;
}
else
{
}
else
{
if
(
fs_len
>=
this_bs

k
==
0
)
if
(
fs_len
>=
this_bs

k
==
0
)
break
;
break
;
k

;
k

;
}
}
}
else
{
}
else
{
goto
reverse
;
if
(
no_turn
)
break
;
k
=
state
>
k

1
;
dir
=
0
;
no_turn
=
1
;
}
}
continue
;
reverse:
if
(
min_dir

state
>
k
==
0
)
break
;
k
=
state
>
k

1
;
dir
=
0
;
min_dir
=
1
;
}
}
state
>
k
=
k_min
;
state
>
k
=
k_min
;
...
...
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