Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
audiowmark
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
audiowmark
Commits
ebe38f86
Commit
ebe38f86
authored
Jun 06, 2020
by
Stefan Westerfeld
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimize short code decoder performance.
Signed-off-by:
Stefan Westerfeld
<
stefan@space.twc.de
>
parent
12bb5090
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
9 deletions
+18
-9
shortcode.cc
src/shortcode.cc
+8
-4
testshortcode.cc
src/testshortcode.cc
+10
-5
No files found.
src/shortcode.cc
View file @
ebe38f86
...
...
@@ -24,7 +24,7 @@
using
std
::
vector
;
#if 0
/* codetables.de */
/* codetables.de
/ magma online calculator BKLC (GF(2), N, K)
*/
static vector<vector<int>> block_48_16_16 = {
{ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1 },
{ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0 },
...
...
@@ -148,7 +148,7 @@ short_decode_blk (const vector<int>& coded_bits)
vector
<
int
>
out_bits
;
for
(
size_t
c
=
0
;
c
<
(
1
<<
gen_in_count
);
c
++
)
{
vector
<
int
>
w
;
bool
match
=
true
;
for
(
size_t
j
=
0
;
j
<
gen_out_count
;
j
++
)
{
int
x
=
0
;
...
...
@@ -159,9 +159,13 @@ short_decode_blk (const vector<int>& coded_bits)
x
^=
gen_matrix
[
bit
][
j
];
}
}
w
.
push_back
(
x
);
if
(
coded_bits
[
j
]
!=
x
)
{
match
=
false
;
break
;
}
}
if
(
w
==
coded_bits
)
if
(
match
)
{
for
(
size_t
bit
=
0
;
bit
<
gen_in_count
;
bit
++
)
{
...
...
src/testshortcode.cc
View file @
ebe38f86
...
...
@@ -114,14 +114,14 @@ main (int argc, char **argv)
}
if
(
argc
==
2
&&
string
(
argv
[
1
])
==
"perf"
)
{
vector
<
int
>
in_bits
;
while
(
in_bits
.
size
()
!=
K
)
in_bits
.
push_back
(
rand
()
&
1
);
const
double
start_t
=
gettime
();
const
size_t
runs
=
2
0
;
const
size_t
runs
=
10
0
;
for
(
size_t
i
=
0
;
i
<
runs
;
i
++
)
{
vector
<
int
>
in_bits
;
while
(
in_bits
.
size
()
!=
K
)
in_bits
.
push_back
(
rand
()
&
1
);
vector
<
int
>
out_bits
=
short_decode_blk
(
short_encode_blk
(
in_bits
));
assert
(
out_bits
==
in_bits
);
}
...
...
@@ -155,6 +155,11 @@ main (int argc, char **argv)
if
(
weight
[
i
])
printf
(
"W %3zd %6d %20s
\n
"
,
i
,
weight
[
i
],
number_format
(
factorial
(
N
)
/
(
factorial
(
i
)
*
factorial
(
N
-
i
))
/
weight
[
i
]).
c_str
());
}
/* decoding test */
for
(
auto
it
:
table
)
{
assert
(
short_decode_blk
(
it
.
first
)
==
it
.
second
);
}
const
size_t
runs
=
50LL
*
1000
*
1000
*
1000
;
size_t
match
=
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