Exemple #1
0
 /// <summary>
 /// Encode a BufferChunk array using RS algorithm
 /// and place the checksum(s) in a BufferChunk array
 /// </summary>
 /// <param name="data">Array of BufferChunk that represents the data to encode</param>
 /// <param name="checksum">Array of BufferChunk to store the generated checksum packets</param>
 public void Encode(BufferChunk[] data, BufferChunk[] checksum)
 {
     // Encode by multiplying the data BufferChunk array
     // with the encoding Vandermonde matrix. The operations are done over
     // GF16 (Galois Field 16 bits)
     FEC_BufferChunk.EncodeRS(data, checksum, enc);
 }
Exemple #2
0
        // write the data into the provided RtpPacket's BufferChunks in the recovery[]
        /// <summary>
        /// Decode and insert in place the recovered packet(s) lost in the data BufferChunk array
        /// </summary>
        /// <param name="data">Array of BufferChunk that represents the data received including
        /// checksum (with a null entrie for each packet lost)</param>
        /// <param name="checksum">Number of checksum used to encode</param>
        /// <param name="recovery">Array of BufferChunk to store the recovered data packets</param>
        public void Decode(BufferChunk[] data, int checksum, BufferChunk[] recovery)
        {
            // TODO: We should first validate that #null entries in data BufferChunk
            // array is equal to recovery.Length and is also equal to checksum

            // Generate a decoding matrix from the BufferChunk array of packet received
            GF16[,] mtxDecode = FEC_BufferChunk.DecodingMatrixGeneration(data, checksum);

            // Invert the decoding matrix
            // TODO: To optimize we could generate the invert matrix only with the
            // row needed for decoding missing packets instead of the full inverted matrix
            GF16[,] mtxDecodeInverted = FEC_Matrix.Invert(mtxDecode);

            // Decode by multiplying the received data BufferChunk array
            // with the inverted decoding matrix. The operations are done over
            // GF16 (Galois Field 16 bits)
            FEC_BufferChunk.DecodeRS(checksum, data, mtxDecodeInverted, recovery);
        }