Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
LARN
PRRT
Commits
b99dd6f1
Commit
b99dd6f1
authored
Feb 09, 2016
by
Andreas Schmidt
Browse files
Update block code sources.
parent
56c923be
Changes
2
Hide whitespace changes
Inline
Side-by-side
prrt/vdmcode/block_code.c
View file @
b99dd6f1
...
...
@@ -291,26 +291,6 @@ static void matmul(PrrtCoder *cod, gf *a, gf *b, gf *c, int n, int k, int m) {
}
}
#ifdef FECDEBUG
/*
* returns 1 if the square matrix is identiy
* (only for test)
*/
static
int
is_identity
(
gf
*
m
,
int
k
)
{
int
row
,
col
;
for
(
row
=
0
;
row
<
k
;
row
++
)
for
(
col
=
0
;
col
<
k
;
col
++
)
if
(
(
row
==
col
&&
*
m
!=
1
)
||
(
row
!=
col
&&
*
m
!=
0
)
)
return
0
;
else
m
++
;
return
1
;
}
#endif
/* debug */
/*
* invert_mat() takes a matrix and produces its inverse
* k is the size of the matrix.
...
...
@@ -530,7 +510,7 @@ static void init_fec(PrrtCoder *cod) {
* and then transforming it into a systematic matrix.
*/
int
P
rrt
C
oder_create
(
PrrtCoder
**
cod
,
int
k
,
int
n
);
int
p
rrt
_c
oder_create
(
PrrtCoder
**
cod
,
int
k
,
int
n
);
int
PrrtCoder_get_coder
(
PrrtCoder
**
cod
,
int
n
,
int
k
)
{
int
err
=
0
;
...
...
@@ -539,7 +519,7 @@ int PrrtCoder_get_coder(PrrtCoder **cod, int n, int k) {
(
*
cod
)
->
params
.
n
!=
n
||
(
*
cod
)
->
params
.
k
!=
k
)
{
PrrtCoder_destroy
(
*
cod
);
err
=
P
rrt
C
oder_create
(
cod
,
k
,
n
);
err
=
p
rrt
_c
oder_create
(
cod
,
k
,
n
);
}
return
err
;
...
...
@@ -565,7 +545,7 @@ void PrrtCoder_destroy(PrrtCoder *cod) {
free
(
cod
);
}
int
P
rrt
C
oder_create
(
PrrtCoder
**
cod
,
int
k
,
int
n
)
{
int
p
rrt
_c
oder_create
(
PrrtCoder
**
cod
,
int
k
,
int
n
)
{
int
row
,
col
;
gf
*
p
,
*
tmp_m
;
int
err
=
0
;
...
...
@@ -683,7 +663,7 @@ void PrrtCoder_encode(PrrtCoder *cod, gf **src, gf *fec, int index, int sz) {
* indexes. The matrix must be already allocated as
* a vector of k*k elements, in row-major order
*/
static
gf
*
P
rrt
C
oder_build_matrix
(
PrrtCoder
*
cod
,
int
*
index
)
{
static
gf
*
p
rrt
_c
oder_build_matrix
(
PrrtCoder
*
cod
,
int
*
index
)
{
int
i
,
k
=
cod
->
params
.
k
;
gf
*
p
,
*
matrix
=
NEW_GF_MATRIX
(
k
,
k
);
if
(
!
matrix
)
...
...
@@ -733,7 +713,7 @@ int PrrtCoder_decode(PrrtCoder *cod, gf **pkt, int *index, int sz) {
sz
/=
2
;
}
m_dec
=
P
rrt
C
oder_build_matrix
(
cod
,
index
);
m_dec
=
p
rrt
_c
oder_build_matrix
(
cod
,
index
);
if
(
!
m_dec
)
{
PERROR
(
"Could not build decode matrix
\n
"
);
...
...
prrt/vdmcode/block_code.h
View file @
b99dd6f1
...
...
@@ -108,10 +108,10 @@ void PrrtCoder_destroy(PrrtCoder *cod) ;
* We are using a (k,n) systematic block code. This function takes k packets as source (the first
* k) and creates one of the n-k remaining packets. Index is the number of the packet and therefore
* lies between k and n (k <= index < n).
* \param src an array of pointers to the source packets
* \param dst the pointer to a preallocate
t
space for the new packet.
* \param index this is the position of the new packet in the resulting set of encoded packets
* \param sz the size of the packets that should be encoded
* \param src
:
an array of pointers to the source packets
.
* \param dst
:
the pointer to a pre
viously
allocate
d
space for the new packet.
* \param index
:
this is the position of the new packet in the resulting set of encoded packets
.
* \param sz
:
the size of the packets that should be encoded
.
*/
void
PrrtCoder_encode
(
PrrtCoder
*
cod
,
gf
**
src
,
gf
*
dst
,
int
index
,
int
sz
)
;
...
...
@@ -122,9 +122,9 @@ void PrrtCoder_encode(PrrtCoder *cod, gf **src, gf *dst, int index, int sz) ;
* present it should be at position i-1 (e.g. packet 1 at 0, 2 at 1) and index[i-1] should be set
* to i-1. If data packet i is not present, but replacement packet (k < )j(<= n) is present, its
* data can be pointed to at pkt[i-1]. Index[i-1] should then be set to j-1.
* \param pkt these are the pointers to the data of the different packets.
* \param index this is the position of the packets in the block code.
* \param sz the size of the data of the packets
* \param pkt
:
these are the pointers to the data of the different packets.
* \param index
:
this is the position of the packets in the block code.
* \param sz
:
the size of the data of the packets
.
*/
int
PrrtCoder_decode
(
PrrtCoder
*
cod
,
gf
**
pkt
,
int
*
index
,
int
sz
)
;
...
...
Write
Preview
Supports
Markdown
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