# Patent

## Title
Systems, methods, apparatus and computer program products for highly reliable file delivery using compound and braided FEC encoding and decoding

## Abstract

Systems, methods, apparatus and computer program products provide highly reliable file delivery using a combination of packet-level FEC on source data packets which are arranged in matrices, where encoding is performed on both rows and columns or on rows, columns and diagonals.

## Background
CROSS REFERENCE TO RELATED APPLICATIONS
This application claims priority to, and the benefit of, U.S. Provisional Patent Application Ser. No. 61/027,401, filed Feb. 8, 2008, and U.S. Provisional Patent Application Ser. No. 61/055,198, filed May 22, 2008, both of which are hereby incorporated by reference in their entirety


BACKGROUND
1. Field
Example aspects of the present invention generally relate to providing reliable transfer of data, and more particularly to correction coding.
2. Related Art
The degradation in the quality of signals over satellite and terrestrial communication links as a result of long transmission delays and/or high-bit error links is a problem which continues to persist. Such transmission impairments make it difficult to broadcast large files to fixed or mobile locations. It is desirable, therefore, to provide a method and system for correction coding to ensure that large data files transmitted using one-way satellite broadcasting and/or terrestrial networks are received error-free despite the various transmission impairments which interfere with the communication signals
BRIEF DESCRIPTION
The example embodiments described herein meet the above-identified needs by providing systems, methods, apparatus and computer program products for highly reliable file delivery using a combination of packet-level FEC on source data packets which are arranged in matrices, where encoding is performed on both rows and columns or on rows, columns and diagonals.
The concept of performing row and column encoding is referred to herein as “compound” encoding and the concept of performing row, column and diagonal encoding is referred to herein as “braided” encoding. As a result of the example compound and braided encoding techniques described herein, the probability of successful delivery of all source data packets increases more than linearly when compared to encoding on columns but not rows, encoding on rows but not columns, or encoding on columns and rows but not diagonals.
In one embodiment of the present invention, a method for encoding a source file to be transmitted to a receiver is provided. The method includes dividing the source file into source packets, dividing the source packets into groups, generating a source packet matrix from the source packets in one of the groups, and calculating Forward Error Correction (FEC) packets for each column of the source packet matrix. The method further performs calculating FEC packets for each row of the source packet matrix and transmitting the source packets in the source packet matrix and the FEC packets for each row and column of the source packet matrix.
In another embodiment of the present invention, a method for reconstructing a source file is provided. The method includes receiving packets, where each packet is at least one of a source packet and an FEC packet and storing each source packet into a corresponding source packet matrix. In addition, each FEC packet is stored. The method further includes determining, for each row of the source packet matrix, whether at least one of the source packets has not been received and can be recovered based, in part, on a status information field of the row, recovering a source packet that has not been received for each row and updating a status information field of a column associated with the recovered packet. In addition, the method includes determining, for each column of the source packet matrix, whether at least one of the source packets has not been received and can be recovered based, in part, on a status information field of the column, and recovering a source packet that has not been received for each column. A status information field of a row associated with the recovered packet is then updated.
Another embodiment of the present invention provides an apparatus for encoding a source file to be transmitted to a receiver including a processor, a memory, an encoder and a transmitter. The processor divides the source file into source packets and divides the source packets into groups. The memory stores a source packet matrix including the source packets in one of the groups. The encoder generates Forward Error Correction (FEC) packets for each column of the source packet matrix and FEC packets for each row of the source packet matrix. The transmitter then transmits the source packet in the source packet matrix and the FEC packets for each row and column of the source packet matrix.
A further embodiment of the present invention provides an apparatus for reconstructing a source file including a receiver, a memory, a processor, and a decoder. The receiver receives packets, where each packet is at least one of a source packet and an FEC packet. The memory stores each source packet into a corresponding source packet matrix and stores each FEC packet. The processor determines, for each row of the source packet matrix, whether at least one of the source packets has not been received and can be recovered based, in part, on a status information field of the row. The decoder, in turn, recovers a source packet that has not been received for each row, and the processor updates a status information field of a column associated with the recovered packet. The processor also determines, for each column of the source packet matrix, whether at least one of the source packets has not been received and can be recovered based, in part, on a status information field of the column. The decoder, in turn, recovers a source packet that has not been received for each column and the decoder updates a status information field of a row associated with the recovered packet.
Another embodiment of the present invention provides a method for encoding a source file to be transmitted to a receiver including dividing the source file into source packets, dividing the source packets into groups, and generating a source packet matrix from the source packets in one of the groups. The method further includes calculating Forward Error Correction (FEC) packets for each column of the source packet matrix, calculating FEC packets for each row of the source packet matrix, calculating FEC packets for each diagonal of the source packet matrix, and transmitting the source packets in the source packet matrix and the FEC packets for each row, column and diagonal of the source packet matrix.
Yet another embodiment of the present invention provides a method for reconstructing a source file, including receiving packets, where each packet is at least one of a source packet and an FEC packet. The method further includes storing each source packet into a corresponding source packet matrix and storing each FEC packet. For each row of the source packet matrix a determination is made whether at least one of the source packets has not been received and can be recovered based, in part, on a status information field of the row. The method further includes recovering a source packet that has not been received for each row and updating a status information field of a column and a diagonal associated with the recovered packet. For each column of the source packet matrix, a determination is made whether at least one of the source packets has not been received and can be recovered based, in part, on a status information field of the column. A source packet that has not been received for each column is recovered and a status information field of a row and a diagonal associated with the recovered packet is updated. For each diagonal of the source packet matrix, a determination is made whether at least one of the source packets has not been received and can be recovered based, in part, on a status information field of the diagonal. A source packet that has not been received for each diagonal is recovered and a status information field of a row and a column associated with the recovered packet is updated.
Another embodiment of the present invention provides an apparatus for encoding a source file to be transmitted to a receiver, including a processor, a memory, an encoder, and a transmitter. The processor divides the source file into source packets and divides the source packets into groups. The memory stores a source packet matrix including the source packets in one of the groups. The encoder generates Forward Error Correction (FEC) packets for each column of the source packet matrix, FEC packets for each row of the source packet matrix, and FEC packets for each diagonal of the source packet matrix. The transmitter, in turn, transmits the source packet in the source packet matrix and the FEC packets for each row, column and diagonal of the source packet matrix.
In another embodiment of the present invention, an apparatus for reconstructing a source file is provided. The apparatus includes a receiver, a memory, a processor, and a decoder. The receiver receives packets, where each packet is at least one of a source packet and an FEC packet. The memory stores each source packet into a corresponding source packet matrix and each FEC packet. The processor determines, for each row of the source packet matrix, whether at least one of the source packets has not been received and can be recovered based, in part, on a status information field of the row. The decoder recovers a source packet that has not been received for each row, and the decoder updates a status information field of a column and a diagonal associated with the recovered packet. The decoder further determines, for each column of the source packet matrix, whether at least one of the source packets has not been received and can be recovered based, in part, on a status information field of the column. The decoder also recovers a source packet that has not been received for each column and the decoder updates a status information field of a row and a diagonal associated with the recovered packet. The decoder also determines, for each diagonal of the source packet matrix, whether at least one of the source packets has not been received and can be recovered based, in part, on a status information field of the diagonal. The decoder further recovers a source packet that has not been received for each diagonal and the decoder updates a status information field of a row and a column associated with the recovered packet.
Further features and advantages of the present invention as well as the structure and operation of various embodiments of the present invention are described in detail below with reference to the accompanying drawings.



BRIEF DESCRIPTION OF THE DRAWINGS
The features and advantages of the present invention will become more apparent from the detailed description set forth below when taken in conjunction with the drawings.
FIGS. 1 and 2 depict an exemplary procedure for encoding data using compound FEC in accordance with an embodiment of the present invention.
FIGS. 3-6 depict an exemplary procedure for encoding data using braided FEC in accordance with an embodiment of the present invention.
FIG. 7 depicts an exemplary embodiment of a communication scheme 700 in accordance with the present invention.



DETAILED DESCRIPTION
Compound FEC
In one example embodiment, a file is divided into packets, where each packet has the same number of bytes, except for the last packet which may have fewer bytes. If the last packet has fewer bytes than the other packets, then stuff bytes (e.g., consisting of 0's) are added to the last packet to increase its size such that it has the same number of bytes (i.e., is the same size) as the other packets.
The resulting packets are arranged into groups of packets where different groups may have different number of packets. Stuff packets (e.g., consisting of 0's) also may be added to a group to increase its packet count.
The following example embodiments are described in terms of a single group. However, it should be understood that other groups are treated the same way.
FIGS. 1 and 2 depict the exemplary procedure for encoding data using compound FEC in accordance with an embodiment of the present invention. Referring to FIG. 1, initially, a matrix of packets is formed from file packets. A file has, for example, (256−K)×M packets, where K is a predefined small number (e.g., between 4 to 16). For a 256 GB file, with 1 KB packet size, M could be relatively large (e.g., 1,000,000). In this example a (256−K)×M source packets (p) matrix is created by placing the first packet of a file into matrix position (1, 1), placing the second packet into position (1, 2), and so on until the Mth packet in the file is placed into position (1, M). Then, the (M+1st) packet is placed into position (2, 1), and so on until the (M+M)th packet is placed into position (2, M). This procedure is continued until all packets in the file are placed into the matrix. The result will be a (256−K) by M source packets matrix as shown in FIG. 1.
Next, K FEC packets (n) are computed for each source packets column (i.e., the vertical boxes shown in FIG. 1). As a result, the arrangement of these (256−K)×M source packets forms a (256−K)×M matrix, where each row has M packets that are consecutive packets in the file, each column of the matrix has (256−K) packets, and K FEC packets are added to each column, as shown in FIG. 1.
Referring now to FIG. 2, one XOR FEC packet (x) is added for every 128 source packets and one XOR FEC packet (x) for the last q source packets on all source packets rows (i.e., the horizontal boxes shown in FIG. 2). Once this is accomplished, the resulting packets (ps, xs, ns) are transmitted. Particularly, first row 1 is transmitted, then row 2, etc., until all rows have been transmitted. Corresponding header information (e.g., sequence number and other info about the packet) is added to each packet when transmitting the packets.
Defining M=128*p+q, where p and q are integers, and 1=<q<=128, for every 128 consecutive source packets in each row, 1 FEC packet, which is an XOR of all these 128 source packets, is added to each row. For the last q source packets in each row, 1 FEC packet which is an XOR of all these q source packets is added, as shown in FIG. 2.
Every 128 packets of the 129 packets (i.e., 128 consecutive source packets in each row plus the 1 XOR FEC packet) can solve the 128 source packets. Every q packets of these (q+1) packets (i.e., the last q consecutive source packets in each row plus the 1 XOR FEC packet) can solve the last q source packets.
The decoding method is an iterative decoding method that is performed group by group. In this example, all the groups have (256−K)×128 source packets, except the last group has (256−K)×q source packets.
In another example embodiment, a group has (R×S) packets, where R and S are positive integers. These packets are arranged into an R×S matrix and the (R×S) packets are referred to as source packets. For each column of the matrix, K FEC packets are added for some positive integer K such that for each column, any R packets of these (R+K) packets (i.e., R source packets plus K added FEC packets) will solve for the R source packets in that column. Similarly, for each row of the matrix, L FEC packets are added for some positive integer L and such that for each row, any S packets of these (S+L) packets (i.e., S source packets plus L added FEC packets) will solve for the S source packets in that row.
The generation of K FEC packets for the R source packets in each column will now be described in detail. In an example embodiment, R+K<=256. As is well known, the numbers 0, 1, . . . , 255 (where each of these number is represented by a byte) form a Galois Field GF(256) under the bitwise XOR operation and well known Galois field multiplication as described in N. Jacobson, Basic Algebra, W H Freeman, 1985, and F. J. MacWilliams and N. J. A. Sloane, The Theory of Error-Correcting Codes, North-Holland Publishing Company, Amsterdam, N. Y., Oxford, 1977, both of which are hereby incorporated by reference in their entirety.
x$y means x to the power of y in this GF(256) and the following Vandermonde matrix is an R×(R+K) matrix:

















1
1
1
1
. . .
1


0
1
2
3
. . .
(R + K − 1)


0$2
1$2
2$2
3$2
. . .
(R + K − 1)$2


. . .


0$(R − 1)
1$(R − 1)
2$(R − 1)
3$(R − 1)
. . .
(R + K − 1)$(R − 1)









This Vandermonde matrix has the property that any of its R×R sub-matrices is invertible. Now, using only matrix row operations, the above matrix can be changed to

IG  (1)

where I is the R×R identity matrix, and G is R×K matrix, such that an R×(R+K) matrix [I G] still has the property that any of its R×R sub-matrices are invertible. Assuming the size of each packet is B bytes, then every packet can be defined as a vector of B elements in GF(256). The R source packets can be defined as R vectors, which can further be defined as an R×B matrix, denoted as matrix H. Then

GT*H  (2)

is a K×B matrix, where GT is the transpose matrix of G. The resulting K×B matrix consists of K vectors, each vector having B bytes. These K vectors are the K generated FEC packets and are the same size as the source packets. From the property of [I G], the R source packets can be solved from any R of the (R+K) packets (i.e., R source packets plus K FEC packets).

The generation of L FEC packets for the S source packets in each row is similar. The source packets are transmitted together with the generated FEC packets, for example, from one computer to other computers. Header information (e.g., sequence number and other information about the packet) is added to each packet upon their transmission.
Due to impairments which degrade the signal quality, some packets may be lost during the transmissions. The following is an algorithm running on the receiving devices (e.g., computers) to recover source packets from received packets. In one example embodiment, the recovery procedure is done group by group.
In the pseudo code that follows:
“N” denotes an R×S matrix where the matrix elements are 0 if the corresponding source packet is received and 1 if the corresponding source packet is missing;
“U” denotes an “R” elements vector where the ith element of U includes a variable “m” to denote the total missing source packets in the ith row, and a variable “t” to denote the total number of packets (i.e., source packets and FEC packets) received in the ith row; and

“V” denotes an “S” elements vector where the jth element of V includes a variable “m” to denote the total missing source packets in the jth column, and variable “t” to denote the total number of packets (i.e., source packets and FEC packets) received in the jth column.

“Missing” is a variable used to denote the total number of missing source packets in the (R×S) source packets.
An example recovery algorithm will now be described in detail. For simplicity only one group is processed in this example, however, it will be understood that other groups can be processed in the same way.












int flag;


flag = 1;


while (1)


{


  //for row processing


  for (i=0; i<R; i++)


  {


    if (U[i].m == 0) //this row is skipped


      continue;


    if (U[i].t < S)


      continue;


    //Since this row has received at least S packets


    solve the missing source packets in this row


    flag = 1;


    Missing −= U[i].m;


    U[i].m = 0; //next time, this row will be skipped


    for (j=0; j<S; j++)


    {


      if (N[i][j] == 1)


      {


        N[i][j] = 0;


        V[j].m−−; //update column status information


        V[j].t++; //update column status information


      }


    }


  }


  if (flag == 0) break;


  //for column processing


  for (j=0; j<S; j++)


  {


    if (V[j].m == 0) //this column is skipped


      continue;


    if (V[j].t < R)


      continue;


    //Since this column has received at least R packets


    solve the missing source packets in this column


    flag = 0;


    Missing −= V[j].m;


    V[j].m = 0; //next time, this column will be skipped


    for (i=0; i<R; i++)


    {


      if (N[i][j] == 1)


      {


        N[i][j] = 0;


        U[i].m−−; //update row status information


        U[i].t++; //update row status information


      }


    }


  }


  if (flag == 1)


    break;


}


if (Missing == 0)


  all the source packets in this group are recovered


else


  some source packets cannot be recovered by this decoding method









Under certain conditions, some source packets may not be capable of being recovered by processing the received packets using the above decoding algorithm. Other data recovery techniques can be used in addition to the above algorithm, however, to recover the remaining lost packets based on certain run-time information and user configurations.
In an example embodiment, the recovery technique uses Gaussian elimination method to recover lost symbols, using linear equations with unknowns. FEC packets can be represented as linear equations, where the source packets to be recovered are the unknowns.
The FEC packets generated in each row or column also can be generated by other FEC methods, for example the LDPC (Low Density Parity Check) method. In an example embodiment, the corresponding decoding method is a modified version of the above iterative decoding method.
FIG. 7 depicts an exemplary embodiment of a communication scheme 700 in accordance with the present invention. A transmitter component 701 encodes a source file and transmits the encoded data to a receiver component 715. As shown in FIG. 7, transmitter component 701 includes a processor 704, a memory 706, an encoder 710 and a packet transmitter 712. Transmitter component 702 receives data from a storage unit 702 in the form of an input file. The input file is fed to a processor 704 which packetizes the input file. Particularly, processor 704 divides the source file into source packets and divides the source packets into groups. Memory 706 stores a source packet matrix including the source packets in one of the groups. Encoder 710 generates Forward Error Correction (FEC) packets for each column of the source packet matrix and FEC packets for each row of the source packet matrix as described above with respect to generating compound FEC. Packet transmitter 708 then transmits the source packet in the source packet matrix and the FEC packets for each row and column of the source packet matrix.
Receiver component 715 reconstructs a source file. As shown in FIG. 7, receiver component 715 includes a packet receiver 716, a memory 720, a processor 718, and a decoder 722. Packet receiver 716 receives packets, where each packet is either a source packet or an FEC packet. Memory 720 stores each source packet into a corresponding source packet matrix and stores each FEC packet. Processor 718 determines, for each row of the source packet matrix, whether at least one of the source packets has not been received and can be recovered based, in part, on a status information field of the row. Decoder 722 recovers a source packet that has not been received for each row, where the processor updates a status information field of a column associated with the recovered packet. Processor 718 also determines, for each column of the source packet matrix, whether at least one of the source packets has not been received and can be recovered based, in part, on a status information field of the column. Decoder 722 recovers a source packet that has not been received for each column and processor 718 updates a status information field of a row associated with the recovered packet. The operations described above can be performed on a file to reconstruct the original input file, which is stored in recovery storage 724.
In an optional embodiment, each source packet can be stored in a corresponding source packet matrix in recovery storage 724 (i.e., recovery storage 724 replaces memory 720). Similarly, each FEC packet can be stored on recovery storage 724 without first being processed in memory 720.
Braided FEC
In one example aspect of the present invention provides higher reliability for broadcasting using an FEC algorithm referred to herein as a braided FEC. The braided FEC can be implemented in a system for content delivery of files of any size using a combination of packet-level FEC on source data packets which are arranged in a matrix form, where encoding is done on all rows, columns and diagonals.
In one example embodiment, a file is divided into packets, where each packet has the same number of bytes, except for the last packet which may have fewer bytes. If the last packet has fewer bytes than the other packets, then stuff bytes (e.g., consisting of 0's) are added to the last packet to increase its size such that it has the same number of bytes (i.e., is the same size) as the other packets.
The resulting packets are arranged into mutually disjoint groups of packets. Different groups may have different number of packets. Stuff packets (e.g., consisting of 0's) also may be added to a group to increase its packet count.
The following example embodiments are described in terms of a single group of packets. However, as with the compound FEC technique described above, it should be understood that other groups of packets are treated the same way.
FIGS. 3-6 depict an exemplary procedure for encoding data using braided FEC in accordance with an embodiment of the present invention. In this example, given a file with 12 (4×3) packets, a 4×3 source packets (p) matrix is created by placing the first packet in the file into matrix position (0, 0), placing the second packet into position (0, 1), and so on until the 3rd packet in the file is placed into position (0, 2). Then, the 4th packet is placed into position (1, 0), and so on until the 6th packet is placed into position (1, 2). This procedure continues until all 12 source packets in the file are placed into the matrix. The result will be a 4 by 3 source packets matrix as shown in FIG. 3.
Referring to FIG. 4, three FEC packets (n) for each column's 4 source packets (i.e., the vertical boxes) are generated. Next, with reference to FIG. 5, one XOR FEC packet (x) for each row's 3 source packets (i.e., the horizontal boxes) is calculated. One XOR FEC packet (d) for each diagonal's 4 source packets are then calculated as shown in FIG. 6 (i.e., the ps with the same subscript form a diagonal, and d with the same subscript is the corresponding XOR FEC packet).
The resulting packets (ps, ns, xs, ds) are then transmitted until all source packets and FEC packets have been transmitted. Add corresponding header info (sequence number and other information about the packet) in each packet when transmitting the packets.
In an example embodiment, a group has (R×S) packets, where R and S are positive integers. These packets are arranged into an R×S matrix form and the (R×S) packets are referred to as source packets. Each source packet is associated with a coordinate, such as coordinate (i, j), where the source packet is in ith row and jth column and 0<=i<=(R−1), 0<=j<=(S−1).
In addition, for a pair of integers x and y, where y is positive, a unique integer z is defined as:

z=x%y  (3)

such that z is between 0 and (y−1) and (x−z) is multiple of y.

For an integer u set between 0 and (R−1), the following S source packets form a row of the source packets matrix, called the uth row:

(u,v), where v is running from 0 to (S−1).  (4)

When u changes from 0 to (R−1), R rows of source packets are formed.
For an integer v set between 0 and (S−1), the following R source packets form a column of the source packets matrix, called the vth column:

(u,v), where u is running from 0 to (R−1).  (5)

When v changes from 0 to (S−1), S columns of source packets are formed.
For an integer k between 0 to (S−1), the following R source packets form a diagonal of the source packets matrix, called the kth diagonal:

(u,(u+k)%S), where u is running from 0 to (R−1).  (6)

When k changes from 0 to (S−1), S diagonals of source packets are formed.
For source packets in each column of the matrix, K FEC packets are generated for some positive integer K and such that for each column, any R packets of the (R+K) packets (i.e., R source packets in that column plus K generated FEC packets for that column) will solve for the R source packets in that column. Similarly, for source packets in each row of the matrix, L FEC packets are generated for some positive integer L and such that for each row, any S packets of these (S+L) packets (i.e., S source packets in that row plus L generated FEC packets for that row) will solve for the S source packets in that row. Similarly, for source packets in each diagonal of the matrix, M FEC packets are generated for some positive integer M and such that for each diagonal, any S packets of these (S+M) packets (i.e., S source packets in that diagonal plus M generated FEC packets for that diagonal) will solve for the S source packets in that diagonal.
As with the compound FEC technique described above, K FEC packets are generated for the R source packets in each column, where R+K<=256. The numbers 0, 1, . . . , 255 (where each being represented by a 8-bit byte) form a Galois Field GF(256) under the bitwise XOR operation and multiplication defined by an irreducible degree 8 polynomial over GF(2).
x$y means x to the power of y in this GF(256) and the following Vandermonde matrix is an R×(R+K) matrix:
















1
1
1
. . .
1


0
1
2
. . .
(R + K − 1)


0$2
1$2
2$2
. . .
(R + K − 1)$2


. . .


0$(R − 1)
1$(R − 1)
2$(R − 1)
. . .
(R + K − 1)$(R − 1)









This Vandermonde matrix has the property that any of its R×R sub-matrices is invertible. Now, using only matrix row operations, the above matrix can be changed to

IG  (7)

where I is the R×R identity matrix, and G is R×K matrix, such that an R×(R+K) matrix [I G] still has the property that any of its R×R sub-matrices are invertible. Assuming the size of each source packet is B bytes, then every packet can be defined as a vector of B elements in GF(256). The R source packets in a column can be defined as R vectors, which can further be defined as an R×B matrix, denoted as matrix H. Then

GT*H  (8)

is a K×B matrix, where GT is the transpose matrix of G. The resulting K×B matrix consists of K vectors, each vector having B bytes. These K vectors are the K generated FEC packets and are the same size as the source packets. From the property of [I G], the R source packets can be solved from any R of the (R+K) packets (i.e., R source packets plus K FEC packets).

The generation of L FEC packets for the S source packets in each row is similar to the generation of the above K FEC packets. The generation of M FEC packets for the S source packets in each diagonal is similar as well. The source packets together with the generated K, L and M FEC packets are then transmitted from one computer to other computers.
Header information, such as sequence number and other info about the packet is added to each packet upon transmission of these packets.
Some packets may get lost during the transmissions due to impairments which degrade the signal quality. One aspect of the present invention provides an algorithm runs on the receiving devices (e.g., computers) to recover lost source packets from the received packets. This recovery procedure is performed on a group by group basis. An exemplary implementation is described below in terms of pseudo code.
As described above, FIG. 7 includes a transmitter component 701 which encodes a source file and transmits the encoded data to a receiver component 715. In the braided FEC embodiment, processor 704 divides the source file into source packets and divides the source packets into groups. Memory 706 stores a source packet matrix including the source packets in one of the groups. Encoder 710 then generates Forward Error Correction (FEC) packets for each column of the source packet matrix, FEC packets for each row of the source packet matrix, and FEC packets for each diagonal of the source packet matrix. Packet transmitter 712 then transmits the source packet in the source packet matrix and the FEC packets for each row, column and diagonal of the source packet matrix.
At the receiver side, receiver component 715 reconstructs a source file that has been encoded using braided FEC. Particularly, packet receiver 716 receives packets, where each packet is either a source packet or an FEC packet. Memory 720 stores each source packet into a corresponding source packet matrix and each FEC packet. Processor 718 determines, for each row of the source packet matrix, whether at least one of the source packets has not been received and can be recovered based, in part, on a status information field of the row.
Decoder 722 recovers a source packet that has not been received for each row, and processor 718 updates a status information field of a column and a diagonal associated with the recovered packet. Processor 718 also determines, for each column of the source packet matrix, whether at least one of the source packets has not been received and can be recovered based, in part, on a status information field of the column. Decoder 722, in turn, also recovers a source packet that has not been received for each column and processor 718 updates a status information field of a row and a diagonal associated with the recovered packet.
Processor 718 also determines, for each diagonal of the source packet matrix, whether at least one of the source packets has not been received and can be recovered based, in part, on a status information field of the diagonal. In turn, decoder 722 also recovers a source packet that has not been received for each diagonal and processor 718 updates a status information field of a row and a column associated with the recovered packet.
As with compound FEC technique described above, the operations described above can be performed in-place on a file to reconstruct the original input file, which is stored in recovery storage 724.
As in the compound FEC embodiment described above, in an optional embodiment, each source packet can be stored in a corresponding source packet matrix in recovery storage 724 (i.e., recovery storage 724 replaces memory 720). Similarly, each FEC packet can be stored on recovery storage 724 without first being processed in memory 720.
In the pseudo code that follows:

    “N” is defined as a two dimensional vector, where N[i][j] is 0 if the source packet in the ith row and jth column is received and 1 if the corresponding source packet is missing;
    “U” is an “R” elements vector where U's ith element has variable “m” to denote the total missing source packets in the ith row, and variable “t” to denote the total number of packets (i.e., source packets and the FEC packets for the ith row) received in the ith row;
    “V” is an “S” elements vector where V's jth element has variable “m” to denote the total missing source packets in the jth column, and variable “t” to denote the total number of packets (i.e., source packets and the FEC packets for the jth column) received in the jth column; and
    “W” is an “S” elements vector where W's kth element has variable “m” to denote the total missing source packets in the kth diagonal, and variable “t” to denote the total number of packets (source packets and the FEC packets for the kth diagonal) received in the kth diagonal.


“Missing” is a variable to denote the total number of missing source packets in the (R×S) source packets.
The recovery algorithm is as follows. It should be understood that this example processes one group. However, other groups are treated the same way.












int flag;


flag = 1;


while (flag)


{


  flag = 0;


  //processing rows


  for (i=0; i<R; i++)


  {


    if (U[i].m == 0) //this row is skipped


      continue;


    if (U[i].t < S)


      continue;


    //Since this row has received at least S packets


    solve the missing source packet in this row;


    flag = 1;


    Missing −= U[i].m;


    U[i].m = 0; //next time, this row will be skipped


    for (j=0; j<S; j++)


    {


      if (N[i][j] ==1)


      {


        N[i][j] = 0;


        V[j].m−−; //update column status information


        V[j].t++; //update column status information


        W[(j−i)%S].m−−; //update diagonal status information


        W[(j−i)%S].t++; //update diagonal status information


      }


    }


  }


  //processing columns


  for (j=0; j<S; j++)


  {


    if (V[j].m == 0) //this column is skipped


      continue;


    if (V[j].t < R)


      continue;


    //Since this column has received at least R packets


    solve the missing source packet in this column;


    flag = 1;


    Missing −= V[j].m;


    V[j].m = 0; //next time, this column will be skipped


    for (i=0; i<R; i++)


    {


      if (N[i][j] == 1)


      {


        N[i][j] = 0;


        U[i].m−−; //update row status information


        U[i].t++; //update row status information


        W[(j−i)%S].m−−; //update diagonal status information


        W[(j−i)%S].t++; //update diagonal status information


      }


    }


  }


  //processing diagonals


  for (q=0; q<S; q++)


  {


    if (W[q].m == 0) //this diagonal is skipped


      continue;


    if (W[q].t < R)


      continue;


    //Since this diagonal has received at least R packets


    solve the missing source packet in this diagonal;


    flag = 1;


    Missing −= W[q].m;


    W[q].m = 0; //next time, this diagonal will be skipped


    for (p=0; p<R; p++)


    {


      int c;


      c = (p+q)%S;


      if (N[p][c] == 1)


      {


        N[p][c] = 0;


        U[p].m−−; //update row status information


        U[p].t++; //update row status information


        V[c].m−−; //update column status information


        V[c].t++; //update column status information


      }


    }


  }


}


if (Missing == 0)


  all the missing source packets in this group are recovered


else


  some missing source packets cannot be recovered by this


  decoding method









Under certain conditions, some missing source packets may not be capable of being recovered by processing the received packets using the above decoding algorithm. Other data recovery techniques can be used in addition to the above algorithm, however, to recover the remaining lost packets based on certain run-time information and user configurations.
In an example embodiment, the recovery technique uses the Gaussian elimination method to recover lost packets, using linear equations with unknowns. FEC packets can be represented as linear equations, where the source packets to be recovered are the unknowns.
The FEC packets generated in each row or column or diagonal also can be generated by other FEC methods, for example the LDPC (Low Density Parity Check) method. In an example embodiment, the corresponding decoding method is a modified version of the above iterative decoding method.
Additional groups of diagonal source packets also may be defined and used to generate new FEC packets. For example, for an integer number e, where e is co-prime with S, the following R packets form a diagonal of R source packets:

(u,(u+e*k)%S), where u is running from 0 to (R−1).  (9)

When k varies from 0 to (S−1), a group of S diagonals is formed. When e varies between 1 to (S−1), where e is again co-prime to S, several groups of diagonals are formed. These different groups of diagonals can be used to add new FEC packets or be used in retransmission of missing packets.
Another example of diagonals can be defined as following. For an integer number e, where e is co-prime with S, the following R packets form a diagonal of R source packets:

(u,(−u+e*k)%S), where u is running from 0 to (R−1).  (9)

When k varies from 0 to (S−1), a group of S diagonals is formed. When e varies between 1 to (S−1), where e is again co-prime to S, several groups of diagonals are formed.
The above braided FEC algorithm can be extended to an n-dimensional cube, where for each direction that is parallel to some edge of the cube, some FEC packets are generated by source packets in that direction similar to the two dimensional source packets matrix case discussed above. There can be several different diagonal directions of which some or all may be used. For each diagonal direction, some FEC packets are generated by source packets in that diagonal direction similar to a two dimensional source packets matrix case discussed above.
For an exemplary file having 16,129 (127*127) packets, the arrangement of these 16,129 source packets forms a 127 by 127 source packets matrix. Each row has 127 packets which are consecutive packets in the file. In addition, each column and each diagonal also have 127 packets. For each row, 1 XOR FEC packet is generated by XOR'ing all source packets in that row; for each column, 1 XOR FEC packet is generated by XOR'ing all source packets in that column; and for each diagonal, 1 XOR FEC packet is generated by XOR'ing all the source packets in that diagonal. These 381 FEC packets (i.e., 127 for rows, 127 for columns, 127 for diagonals) together with the 16,129 source packets are transmitted for this file delivery. In this example, the FEC rate is 381/(16,129+381)=2.31%.
In this document, the terms “computer program medium” and “computer usable medium” are used to generally refer to media such as removable storage drive, a hard disk installed in hard disk drive. These computer program products provide software to computer system.
Computer programs (also referred to as computer control logic) are stored in memory. Computer programs may also be received via a communications interface. Such computer programs, when executed, enable the computer system to perform the features of the present invention, as discussed herein. In particular, the computer programs, when executed, enable a processor to perform the features of the present invention. Accordingly, such computer programs represent controllers of the computer system.
In another embodiment, the invention is implemented primarily in hardware using, for example, hardware components such as application specific integrated circuits (ASICs). Implementation of the hardware state machine so as to perform the functions described herein will be apparent to persons skilled in the relevant art(s).
In yet another embodiment, the invention is implemented using a combination of both hardware and software.
While various example embodiments of the present invention have been described above, it should be understood that they have been presented by way of example, and not limitation. It will be apparent to persons skilled in the relevant art(s) that various changes in form and detail can be made therein. Thus, the present invention should not be limited by any of the above described example embodiments, but should be defined only in accordance with the following claims and their equivalents.
In addition, it should be understood that the FIGS. 1-7 and the pseudo code presented herein are presented for example purposes only. The architecture of the example embodiments presented herein is sufficiently flexible and configurable, such that it may be utilized in ways other than that shown in the accompanying figures and pseudo code.
Further, the purpose of the foregoing Abstract is to enable the U.S. Patent and Trademark Office and the public generally, and especially the scientists, engineers and practitioners in the art who are not familiar with patent or legal terms or phraseology, to determine quickly from a cursory inspection the nature and essence of the technical disclosure of the application. The Abstract is not intended to be limiting as to the scope of the example embodiments presented herein in any way. It is also to be understood that the procedures recited in the claims need not be performed in the order presented.

## Claims

1. A method for encoding a source file to be transmitted to a receiver, comprising the steps of:
dividing the source file into a plurality of source packets;
dividing the plurality of source packets into a plurality of groups;
generating a source packet matrix from the plurality of source packets in one of the plurality of groups;
calculating a plurality of Forward Error Correction (FEC) packets for each column of the source packet matrix;
calculating a plurality of FEC packets for each row of the source packet matrix;
calculating a plurality of FEC packets for each diagonal of the source packet matrix; and
transmitting the source packets in the source packet matrix and the plurality of FEC packets for each row, column and diagonal of the source packet matrix.

2. The method of claim 1, wherein transmitting further comprises,
adding corresponding header information to each packet; and
wherein the transmitting further includes transmitting the plurality of rows of the source packet matrix until all of the rows have been transmitted.

3. A computer-readable medium having stored thereon sequences of instructions, the sequences of instructions including instructions which when executed by a computer system cause the computer system to perform:
dividing a source file into a plurality of source packets;
dividing the plurality of source packets into a plurality of groups;
generating a source packet matrix from the plurality of source packets in one of the plurality of groups;
calculating a plurality of Forward Error Correction (FEC) packets for each column of the source packet matrix;
calculating a plurality of FEC packets for each row of the source packet matrix;
calculating a plurality of FEC packets for each diagonal of the source packet matrix; and
transmitting the source packets in the source packet matrix and the plurality of FEC packets for each row, column and diagonal of the source packet matrix.

4. The computer-readable medium according to claim 3, further having stored thereon sequences of instructions which when executed by a computer system cause the computer system to perform:
adding corresponding header information to each packet; and
wherein the transmitting further includes transmitting the plurality of rows of the source packet matrix until all of the rows have been transmitted.

5. An apparatus for encoding a source file to be transmitted to a receiver, comprising:
a processor configured to divide the source file into a plurality of source packets and divide the plurality of source packets into a plurality of groups;
a memory configured to store a source packet matrix including the plurality of source packets in one of the plurality of groups;
an encoder configured to generate a plurality of Forward Error Correction (FEC) packets for each column of the source packet matrix, a plurality of FEC packets for each row of the source packet matrix, and a plurality of FEC packets for each diagonal of the source packet matrix; and
a transmitter configured to transmit the source packet in the source packet matrix and the plurality of FEC packets for each row, column and diagonal of the source packet matrix.

6. The apparatus according to claim 5, wherein the transmitter is further configured to:
add corresponding header information to each packet; and
transmit the plurality of rows of the source packet matrix until all of the rows have been transmitted.