Application layer coding and decoding method for solving high burst
By adopting a new encoding and decoding method at the application layer, using GF(28) encoding and decoding recovery operations, combined with interleaving depth and encoding window size, the problem of high decoding failure probability of traditional FEC schemes in high burst environments is solved, and a lower decoding failure probability and better real-time performance are achieved.
Patent Information
- Application Number
- CN202510199121.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-22
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2045-02-22
AI Technical Summary
In high burst environments, traditional application-layer forward error correction encoding (FEC) schemes, such as RS code and CRLNC code, have the problem of high probability of decoding failure, and the retransmission mechanism will introduce a large delay in real-time communication scenarios.
A new application-layer codec is adopted to generate and process encoding packets by initializing encoder and decoder parameters, using GF(28) encoding and decoding recovery operations, combining interleaving depth and encoding window size, encoding packets are generated and processed to reduce the probability of decoding failure.
In a high burst channel environment, a lower probability of decoding failure than RS code and CRLNC code is achieved, which avoids retransmission delay and improves the real-time and reliability of data transmission.
Smart Images

Figure CN119945625A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of application layer data transmission, and in particular relates to an application layer coding and decoding method for solving high burst. Background Art
[0002] Ultra Reliable & Low Latency Communication (URLLC) is one of the three major scenarios of the 5G system. It has ultra-high reliability and extremely low transmission delay. It is an important communication technology for industrial automation, telemedicine industry and intelligent transportation. In the process of wireless data transmission, there are factors such as interference, multipath effect and attenuation, which lead to transmission errors. At the same time, problems such as network congestion, routing table expiration and cache overflow can also cause data packet loss. In order to ensure the high reliability of data transmission, the upper layer protocol usually adopts a retransmission mechanism to deal with data packet loss. However, in scenarios with high real-time requirements such as streaming media transmission and control signaling transmission, retransmission will introduce a large delay, which is particularly obvious in channels with high round-trip time (RTT). Therefore, in order to avoid retransmission delay, forward error correction coding (FEC) needs to be added to the upper layer protocol.
[0003] Traditional application layer FEC schemes, such as LDPC-staircase, RS code and CRLNC code, all have low reliability in high burst environments. Reliability can be improved by increasing the code length or coding window, but this will bring huge coding complexity. Summary of the invention
[0004] In view of this, and in view of the defects and shortcomings of the prior art, the purpose of the present invention is to provide an application layer encoding and decoding method for solving high-burst problems, which can have a lower decoding failure probability than traditional application layer FEC schemes such as RS code and CRLNC code in a high-burst environment.
[0005] The implementation of the scheme includes: step S1, initializing encoder parameters and sender socket parameters, caching the data packets sent from the upper layer into a queue, and the encoder continuously takes source data packets from the queue for header encapsulation and GF(2 8) encoding operation, and finally send the source data packet and the encoded packet through the socket. Step S2, initialize the decoder parameters and the receiving end socket parameters, cache the incoming data packets into the queue, the decoder continuously takes out data packets from the queue, and performs decoding and recovery operations according to the data packet header information, and finally sorts the recovered data packets and transmits them to the upper layer in sequence. This scheme can have a lower decoding failure probability than Reed-Solomon (RS) and sliding RLNC (CRLNC) in a high burst channel environment.
[0006] The technical solution specifically adopted by the present invention to solve the technical problem is:
[0007] A method for solving high burst application layer coding and decoding, at the application layer,
[0008] The encoder receives data transmitted by the upper layer through the first cache queue, and takes out the source data packet from the first cache queue for header encapsulation and GF(2 8 ), after the encoding operation of the source data packet and the encoded packet are sent through the sending end socket;
[0009] The data packet is obtained from the receiving end socket through the second cache queue, the decoder takes out the data packet from the second cache queue, and performs decoding and recovery operations according to the data packet header information, and sorts the recovered data packets and transmits them to the upper layer in sequence.
[0010] Furthermore, before the first cache queue receives data transmitted by the upper layer, initialization is performed, including:
[0011] Initialize encoder parameters: set the encoding window size w e , the coding interleaving depth v, the transmission step length l of the coded packet, and the code rate R are:
[0012] Initialize the sender socket parameters: set to UDP transmission, and bind the peer IP and port address entered by the terminal to the socket;
[0013] And initialize a queue Q s , as the first cache queue, is used to store the source data packets sent by the upper-layer application. The parameter of the semaphore sem_t is added to make the two operations of storing data at the end of the queue and retrieving data at the head of the queue mutually exclusive.
[0014] Furthermore, the encoder takes out the source data packet from the first buffer queue, performs header encapsulation and performs GF(2 8 ), the process of sending the source data packet and the encoded packet through the sending end socket is as follows:
[0015] The encoder determines the s Does the head point to a null pointer? If so, Q s The queue is empty, and the encoder continues to wait; if Q s If the head is not a null pointer, then take out Q s The data pointed to by the head pointer is put into the encoder;
[0016] The encoder encapsulates the corresponding information of the source data packet as the packet header according to the source data packet information; the encoder initializes a variable id source , assigned a value of 0; each time a source data packet is encapsulated, id source Add one; id when encapsulating source As the stream_id information in the source data packet header, the source data packet length is as the pl_size information in the header, and the rest of the parameters are set to -1;
[0017] Buffer source data packets into encoding window E w Among them, E w Implemented using deque container;
[0018] If E w Size S e satisfy:
[0019] S e >w e v
[0020] Then E w The source data packet at the starting position is removed, and then a new source data packet is cached; if it is not satisfied, the new source data packet is directly cached;
[0021] Send the source data packet to the corresponding port in the set peer IP through the sendto() function in the socket;
[0022] According to the set step length l, determine whether to generate a coded packet by calculating the following formula:
[0023] F=id source modl
[0024] If F≠0, re-execute from queue Q s Determine whether the header points to a null pointer; if F=0, generate a coded packet;
[0025] The encoder initializes a variable id repair , assigned a value of 0; each time a coded packet is encapsulated, id repair plus one; id repair As a random number seed, w is then randomly generated through the Mersenne selection algorithm eThe randomly generated coding coefficients are limited to 0-255 by taking the modulus 256, and the generated w is defined e The set of coding coefficients is M;
[0026] Initialize a character array R of size 2048 and assign it a value of 0; according to the interleaving depth v, take out E w The v-1th source data packet in the set M is GF(2 8 ) and then multiply it with R by GF(2 8 ) and the result is assigned to R; and so on, loop to take out E w The nv-1 source data packets in M perform the same operation with the nth coding coefficient in M until the following equation is satisfied, then the loop is exited;
[0027] S e <nv-1
[0028] After jumping out of the loop, the content of R is used as the payload part of the encoded packet to encapsulate the corresponding packet header, id repair As the repair_id information in the packet header, E w The source_id of the source data packet at the starting position is used as the first_pkt_id information in the packet header, the source_id of the source data packet at the ending position is used as the last_pkt_id information in the packet header, the corresponding position of the last non-zero element in the character array R is used as the pl_size information in the packet header, and the other parameters are set to -1;
[0029] Send the encoded packet to the corresponding port in the set peer IP through the sendto() function in the socket.
[0030] Furthermore, before the second cache queue obtains the data packet from the receiving end socket, initialization is performed, including:
[0031] Initialize decoder parameters: set the maximum size w of the decoding window d , interleaving depth v;
[0032] Initialize the receiving end socket parameters: set it to UDP transmission and bind the port number to be listened to to the socket;
[0033] Initialize a queue Q r , as the second cache queue, is used to store the data packets received by the receiving socket, and add the parameter of the semaphore sem_t to make the two operations of storing data at the end of the queue and retrieving data at the head of the queue mutually exclusive.
[0034] Furthermore, the decoder takes out the data packets from the second cache queue, performs decoding recovery operation according to the data packet header information, and sorts the recovered data packets and transmits them to the upper layer in sequence. The specific process is:
[0035] Set up a thread so that the receiving socket continuously receives data through the recv() function and caches it in the queue Q r middle;
[0036] If Q r If the head is not a null pointer, then take out Q r The data pointed to by the head pointer is placed in the decoder;
[0037] Extract the packet header information of the data packet. If repair_id=-1 and source_id≠-1, the received packet is the source packet. If repair_id≠-1 and source_id=-1, the received packet is the coded packet. If both are not -1 or both are -1, the packet is wrong and is discarded directly.
[0038] The decoder initializes a variable id inorder Variable, assigned value 0; if the received data packet is the source data packet, determine whether it satisfies the following formula;
[0039] source_id=id inorder
[0040] If satisfied, it is directly passed to the upper application, id inorder plus one;
[0041] If not satisfied, store in decoding window D w and generate the corresponding unit vector and insert it into D w The corresponding decoding matrix C d If the received packet is a coded packet, determine whether the following formula is satisfied;
[0042] last_pkt_id≤id inorder
[0043] If it is satisfied, the coded packet is useless and is discarded directly;
[0044] If not satisfied, store in decoding window D w And according to the first_pkt_id and last_pkt_id in the encoding packet header, the encoding coefficient length S is calculated r ;
[0045] S r =last_pkt_id-first_pkt_id+1
[0046] By S rand interleaving depth v to calculate the effective coding coefficient length S v ;
[0047]
[0048] Then repair_id is used as a random number seed to generate S through the Mersenne selection algorithm. v A random number is constrained to be between 0 and 255 by taking the modulo 256. r Insert v-1 zeros in the middle of the random numbers, and finally get a length of S r The coding coefficients of D w The corresponding decoding matrix C d middle;
[0049] If a new data packet is inserted, D w The size of w d Within, and C d If the rank is not full, repeat the above: take Q r The data pointed to by the head pointer is put into the following steps of the decoder;
[0050] If a new data packet is inserted into D w After, D w The size exceeds w d , then remove D w The packet at the starting position in C is removed d The corresponding coefficient in ;
[0051] If a new data packet is inserted into D w After that, C d Full rank; definition D w The set of data packets in is Y d , then the source data packet set X is recovered according to the following formula;
[0052]
[0053] Sort the source data packet set X by source_id and then pass it to the upper-layer application in order.
[0054] Furthermore, the receiving end is also provided with an array space for caching source data packets, which is used to cache the data packets that have been successfully resumed for uploading recently, so as to adjust the coding coefficients of the coding packets.
[0055] An application layer encoding and decoding system for solving high burst, arranged at the application layer of a computer system, comprising: a first cache queue, a second cache queue, an encoder and a decoder;
[0056] The first cache queue receives data transmitted by the upper layer, and the encoder takes out the source data packet from the first cache queue for header encapsulation and GF(2 8), after the encoding operation of the source data packet and the encoded packet are sent through the sending end socket;
[0057] The data packets are obtained from the receiving end socket through the second cache queue, the decoder takes out the data packets from the second cache queue, performs decoding and recovery operations according to the data packet header information, sorts the recovered data packets, and transmits them to the upper layer in sequence.
[0058] Furthermore, before the first cache queue receives data transmitted by the upper layer, initialization is performed, including:
[0059] Initialize encoder parameters: set the encoding window size w e , the coding interleaving depth v, the transmission step length l of the coded packet, and the code rate R are:
[0060] Initialize the sender socket parameters: set to UDP transmission, and bind the peer IP and port address entered by the terminal to the socket;
[0061] And initialize a queue Q s , as the first cache queue, used to store source data packets sent by the upper-layer application, add the parameter of the semaphore sem_t to make the two operations of storing data at the end of the queue and getting data at the head of the queue mutually exclusive;
[0062] The encoder determines the s Does the head point to a null pointer? If so, Q s The queue is empty, and the encoder continues to wait; if Q s If the head is not a null pointer, then take out Q s The data pointed to by the head pointer is put into the encoder;
[0063] The encoder encapsulates the corresponding information of the source data packet as the packet header according to the source data packet information; the encoder initializes a variable id source , assigned a value of 0; each time a source data packet is encapsulated, id source Add one; id when encapsulating source As the stream_id information in the source data packet header, the source data packet length is as the pl_size information in the header, and the rest of the parameters are set to -1;
[0064] Buffer source data packets into encoding window E w Among them, E w Implemented using deque container;
[0065] If E w Size S e satisfy:
[0066] S e >we v
[0067] Then E w The source data packet at the starting position is removed, and then a new source data packet is cached; if it is not satisfied, the new source data packet is directly cached;
[0068] Send the source data packet to the corresponding port in the set peer IP through the sendto() function in the socket;
[0069] According to the set step length l, determine whether to generate a coded packet by calculating the following formula:
[0070] F=id source modl
[0071] If F≠0, re-execute from queue Q s Determine whether the header points to a null pointer; if F=0, generate a coded packet;
[0072] The encoder initializes a variable id repair , assigned a value of 0; each time a coded packet is encapsulated, id repair plus one; id repair As a random number seed, w is then randomly generated through the Mersenne selection algorithm e The randomly generated coding coefficients are limited to 0-255 by taking the modulus 256, and the generated w is defined e The set of coding coefficients is M;
[0073] Initialize a character array R of size 2048 and assign it a value of 0; according to the interleaving depth v, take out E w The v-1th source data packet in the set M is GF(2 8 ) and then multiply it with R by GF(2 8 ) and the result is assigned to R; and so on, loop to take out E w The nv-1 source data packets in M perform the same operation with the nth coding coefficient in M until the following equation is satisfied, then the loop is exited;
[0074] S e <nv-1
[0075] After jumping out of the loop, the content of R is used as the payload part of the encoded packet to encapsulate the corresponding packet header, id repair As the repair_id information in the packet header, E wThe source_id of the source data packet at the starting position is used as the first_pkt_id information in the packet header, the source_id of the source data packet at the ending position is used as the last_pkt_id information in the packet header, the corresponding position of the last non-zero element in the character array R is used as the pl_size information in the packet header, and the other parameters are set to -1;
[0076] Send the encoded packet to the corresponding port in the set peer IP through the sendto() function in the socket.
[0077] Furthermore, before the second cache queue obtains the data packet from the receiving end socket, initialization is performed, including:
[0078] Initialize decoder parameters: set the maximum size w of the decoding window d , interleaving depth v;
[0079] Initialize the receiving end socket parameters: set it to UDP transmission, bind the port number to be listened to to the socket; initialize a queue Q r , as the second cache queue, used to store the data packets received by the receiving end socket, and add the parameter of the semaphore sem_t to make the two operations of storing data at the end of the queue and getting data at the head of the queue mutually exclusive;
[0080] The decoder takes out the data packets from the second buffer queue, performs decoding recovery operation according to the data packet header information, and sorts the recovered data packets and transmits them to the upper layer in sequence. The specific process is as follows:
[0081] Set up a thread so that the receiving socket continuously receives data through the recv() function and caches it in the queue Q r middle;
[0082] If Q r If the head is not a null pointer, then take out Q r The data pointed to by the head pointer is placed in the decoder;
[0083] Extract the packet header information of the data packet. If repair_id=-1 and source_id≠-1, the received packet is the source packet. If repair_id≠-1 and source_id=-1, the received packet is the coded packet. If both are not -1 or both are -1, the packet is wrong and is discarded directly.
[0084] The decoder initializes a variable id inorder Variable, assigned value 0; if the received data packet is the source data packet, determine whether it satisfies the following formula;
[0085] source_id=id inorder
[0086] If satisfied, it is directly passed to the upper application, id inorder plus one;
[0087] If not satisfied, store in decoding window D w and generate the corresponding unit vector and insert it into D w The corresponding decoding matrix C d If the received packet is a coded packet, determine whether the following formula is satisfied;
[0088] last_pkt_id≤id inorder
[0089] If it is satisfied, the coded packet is useless and is discarded directly;
[0090] If not satisfied, store in decoding window D w And according to the first_pkt_id and last_pkt_id in the encoding packet header, the encoding coefficient length S is calculated r ;
[0091] S r =last_pkt_id-first_pkt_id+1
[0092] By S r and interleaving depth v to calculate the effective coding coefficient length S v ;
[0093]
[0094] Then repair_id is used as a random number seed to generate S through the Mersenne selection algorithm. v A random number is constrained to be between 0 and 255 by taking the modulo 256. r Insert v-1 zeros in the middle of the random numbers, and finally get a length of S r The coding coefficients of D w The corresponding decoding matrix C d middle;
[0095] If a new data packet is inserted, D w The size of w d Within, and C d If the rank is not full, repeat the above: take Q r The data pointed to by the head pointer is put into the following steps of the decoder;
[0096] If a new data packet is inserted into D w After, D w The size exceeds w d , then remove D wThe packet at the starting position in C is removed d The corresponding coefficient in ;
[0097] If a new data packet is inserted into D w After that, C d Full rank; definition D w The set of data packets in is Y d , then the source data packet set X is recovered according to the following formula;
[0098]
[0099] Sort the source data packet set X by source_id and then pass it to the upper-layer application in order.
[0100] And, an electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of a method for solving high-burst application layer encoding and decoding as described above are implemented.
[0101] A non-transitory computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the above-mentioned application layer encoding and decoding method for solving high burst.
[0102] Compared with the prior art, the present invention and its preferred solution not only have a lower decoding failure probability than RS code and CRLNC code in a high burst environment, but also do not require feedback retransmission, and the coded packets are dispersed in the source data packets, so that they can have better real-time performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0103] The present invention is further described in detail below with reference to the accompanying drawings and specific embodiments:
[0104] Figure 1 A system block diagram for implementing the solution of an embodiment of the present invention;
[0105] Figure 2 A packet header design diagram for data packet encapsulation in an embodiment of the present invention;
[0106] Figure 3 Schematic diagram of a channel packet loss model simulated in an example of the present invention;
[0107] Figure 4 Schematic diagram of the variation of decoding failure probability with burst length relative to RS code in an embodiment of the present invention;
[0108] Figure 5 FIG. 1 is a schematic diagram showing how the probability of decoding failure varies with the bit rate relative to CRLNC in an embodiment of the present invention. DETAILED DESCRIPTION
[0109] In order to make the features and advantages of this patent more obvious and easy to understand, the following embodiments are specifically described in detail as follows:
[0110] It should be noted that the following detailed descriptions are illustrative and are intended to provide further explanation of the present application. Unless otherwise specified, all technical and scientific terms used in this specification have the same meanings as those commonly understood by those skilled in the art to which the present application belongs.
[0111] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit the exemplary embodiments according to the present application. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should be understood that when the terms "comprise" and / or "include" are used in this specification, it indicates the presence of features, steps, operations, devices, components and / or combinations thereof.
[0112] like Figure 1-Figure 4 As shown, this embodiment provides an application layer encoding and decoding method for solving high burst, including the following steps:
[0113] Step S1: Initialize the encoder parameters and the sender socket parameters. The data packets sent from the upper layer are cached into a queue. The encoder continuously takes source data packets from the queue for header encapsulation and GF(2 8 ) encoding operation, and finally sending the source data packet and the encoded packet through the socket;
[0114] Step S2: Initialize the decoder parameters and the receiving end socket parameters, cache the incoming data packets into a queue, the decoder continuously takes out data packets from the queue, and performs decoding and recovery operations based on the data packet header information, and finally sorts the recovered data packets and transmits them to the upper layer in order.
[0115] Preferably, during the actual transmission process, the receiving end also needs to cache the data packet that has been successfully restored and uploaded recently to adjust the coding coefficient of the coded packet to further reduce the probability of decoding failure.
[0116] In this embodiment, step S1 specifically includes the following steps:
[0117] Step S11: Initialize encoder parameters: set the encoding window size w e , the coding interleaving depth v, the transmission step length of the coding packet l, according to l, the code rate R can be calculated as
[0118]
[0119] Step S12: Initialize the sending end socket parameters: set to UDP transmission, and bind the peer IP and port address input by the terminal to the socket;
[0120] Step S13: Initialize a queue Q s , responsible for storing the source data packets sent by the upper-layer application, and adding the parameters of the semaphore sem_t to make the two operations of storing data at the end of the team and getting data at the head of the team mutually exclusive, that is, they cannot be performed at the same time;
[0121] Step S14: The encoder determines the s Does the head point to a null pointer? If so, Q s If the queue is empty, the encoder continues to wait;
[0122] Step S15: If Q s If the head is not a null pointer, then take out Q s The data pointed to by the head pointer is put into the encoder;
[0123] Step S16: The encoder encapsulates the source data packet with corresponding information as a packet header according to the source data packet information. The encoder initializes a variable id source , and the value is 0. After each source data packet is encapsulated, id source Will increase by 1. When encapsulating id source The source data packet length is used as the stream_id information in the source data packet header, the source data packet length is used as the pl_size information in the header, and the other parameters are set to -1;
[0124] Step S17: Cache the source data packet into encoding window E w Among them, E w Use deque container to implement. If E w Size S e satisfy
[0125] S e >w e v
[0126] Then E w Remove the source data packet at the starting position in the buffer, and then cache the new source data packet. If it is not satisfied, directly cache the new source data packet;
[0127] Step S18: Send the source data packet to the corresponding port in the set peer IP through the sendto() function in the socket;
[0128] Step S19: According to the set step length l, determine whether to generate a coding packet by calculating the following formula;
[0129] F=id source modl
[0130] If F≠0, repeat steps S4-S5. If F=0, generate a coded packet;
[0131] Step S110: The encoder initializes a variable id repair , and the value is 0. After each package is encapsulated, id repair Plus one. id repair As a random number seed, w is then randomly generated through the Mersenne selection algorithm e The randomly generated coding coefficients are limited to 0-255 by taking the modulus 256, and the generated w is defined e The set of coding coefficients is M;
[0132] Step S111: Initialize a character array R of size 2048 and assign a value of 0. According to the interleaving depth v, take out E w The v-1th source data packet in the set M is GF(2 8 ) and then multiply it with R by GF(2 8 ) and assign the result to R. Similarly, loop to take out E w The nv-1 source data packets in M perform the same operation with the nth coding coefficient in M until the following equation is satisfied, then the loop is exited;
[0133] S e <nv-1
[0134] Step S112: After exiting the loop, the content of R is used as the payload part of the encoded packet, and the corresponding packet header is encapsulated for this part, id repair As the repair_id information in the packet header, E w The source_id of the source data packet at the starting position is used as the first_pkt_id information in the packet header, the source_id of the source data packet at the ending position is used as the last_pkt_id information in the packet header, the corresponding position of the last non-zero element in the character array R is used as the pl_size information in the packet header, and the other parameters are set to -1;
[0135] Step S113: Send the encoded packet to the corresponding port in the set peer IP through the sendto() function in the socket.
[0136] In this embodiment, the header design of the source data packet and the coded packet encapsulation is as follows: Figure 2 shown.
[0137] In this embodiment, step S2 specifically includes the following steps:
[0138] Step S21: Initialize decoder parameters: set the maximum size w of the decoding window d , interleaving depth v;
[0139] Step S22: Initialize the receiving end socket parameters: set to UDP transmission, and bind the port number to be monitored to the socket;
[0140] Step S23: Initialize a queue Q r , responsible for storing the data packets received by the receiving end socket, and adding the parameters of the semaphore sem_t to make the operations of storing data at the end of the team and getting data at the head of the team mutually exclusive;
[0141] Step S24: Set up a thread so that the receiving end socket continuously receives data through the recv() function and caches it into the queue Q r middle;
[0142] Step S25: If Q r If the head is not a null pointer, then take out Q r The data pointed to by the head pointer is placed in the decoder;
[0143] Step S26: Extract the packet header information of the data packet. If repair_id=-1 and source_id≠-1, the received packet is a source packet. If repair_id≠-1 and source_id=-1, the received packet is a coded packet. If both are not -1 or are -1, the packet is wrong and is directly discarded.
[0144] Step S27: The decoder initializes a variable id inorder Variable, assigned value 0. If the received data packet is the source data packet, determine whether the following equation is satisfied;
[0145] source_id=id inorder
[0146] If satisfied, it is directly passed to the upper application, and id inorder plus one;
[0147] Step S28: If not satisfied, store in decoding window D w and generate the corresponding unit vector and insert it into D w The corresponding decoding matrix C d middle;
[0148] Step S29: If the received packet is a coded packet, determine whether the following equation is satisfied;
[0149] last_pkt_id≤id inorder
[0150] If it is satisfied, the coded packet is useless and is discarded directly;
[0151] Step S210: If not satisfied, store in decoding window D wAnd according to the first_pkt_id and last_pkt_id in the encoding packet header, the encoding coefficient length S is calculated r ;
[0152] S r =last_pkt_id-first_pkt_id+1
[0153] Step S211: Through S r and interleaving depth v to calculate the effective coding coefficient length S v ;
[0154]
[0155] Then repair_id is used as a random number seed to generate S through the Mersenne selection algorithm. v A random number is generated and is limited to 0-255 by taking the modulo 256. r Insert v-1 zeros in the middle of the random numbers, and finally get a length of S r The coding coefficients are inserted into D w The corresponding decoding matrix C d middle;
[0156] Step S212: If a new data packet is inserted, D w The size of w d Within, and C d If the rank is not full, repeat steps S25-S211;
[0157] Step S213: If a new data packet is inserted into D w After, D w The size exceeds w d , then remove D w The packet at the starting position in C is removed d The corresponding coefficient in ;
[0158] Step S214: If a new data packet is inserted into D w After that, C d Full rank. Definition D w The set of data packets in is Y d , then the source data packet set X can be recovered according to the following formula;
[0159]
[0160] Step S215: sort the source data packet set X by source_id, and then transmit them to the upper layer application in sequence.
[0161] Experimental simulation
[0162] In the simulation test of this example, the hardware is based on CPU i5-10400, and the software system is tested on the Ubuntu 20.04 platform. The content of the sent data packet is randomly generated, and the data packet size is kept at 200 bytes. Each test randomly generates 10 6 Each packet is passed to the encoder in sequence. Each data is tested 100 times and the final result is averaged.
[0163] The simulated bursty binary erasure channel in this example uses the Gilbert packet loss model. Figure 3 As shown in Figure 1, the model is a two-state Markov chain. State G represents the "good" state, in which no packet loss will occur; state B represents the "bad" state, in which packet loss will inevitably occur. β represents the transition probability from the "bad" state to the "good" state, and γ represents the transition probability from the "good" state to the "bad" state. The expectation E[B] of channel burst errors is:
[0164]
[0165] The overall packet loss rate ε of the channel is:
[0166]
[0167] Figure 4 The performance of this scheme is compared with that of RS code, and the code rate R is 4 / 5. The code length of RS code is 255, the number of source data packets per block is 204, and the number of coded packets is 51. In order to ensure that the number of source data packets protected by each coded packet is consistent with that of RS code, the coding window size w of this scheme is set e =204, step length l = 4. Different burst expected lengths E[B] are simulated to observe the changes in the probability of decoding failure. It can be seen that under different burst environments, the probability of decoding failure of this scheme is significantly lower than that of RS code, and the higher the interleaving depth v, the lower the probability of decoding failure.
[0168] Figure 5 The performance of this scheme is compared with that of CRLNC, keeping the coding window size w e =32, the maximum decoding window size w d =48. By setting different burst expected lengths E[B] (16, 32, 48 from left to right), the decoding failure probability under different code rates (code rates are 1 / 2, 2 / 3, 4 / 5, 8 / 9, 16 / 17) is tested. It can be seen that under different burst environments, the decoding failure probability of this scheme is significantly lower than that of the CRLNC code, and the higher the interleaving depth v, the lower the decoding failure probability.
[0169] In summary, it can be concluded that this scheme shows higher reliability than RS code and CRLNC code in different high-burst environments, and is an excellent encoding and decoding scheme for current URLLC application scenarios.
[0170] Based on the same inventive concept, the present invention also provides a computer device, which includes: one or more processors, and a memory for storing one or more computer programs; the program includes program instructions, and the processor is used to execute the program instructions stored in the memory. The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. It is the computing core and control core of the terminal, which is used to implement one or more instructions, specifically for loading and executing one or more instructions in a computer storage medium to implement the above method.
[0171] It needs to be further explained that, based on the same inventive concept, the present invention also provides a computer storage medium, on which a computer program is stored, and the computer program is executed by a processor to execute the above method. The storage medium can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electrical, magnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.
[0172] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the present invention should be understood by people with ordinary skills in the field to which the present invention belongs. The "first", "second" and similar words used in the present invention do not indicate any order, quantity or importance, but are only used to distinguish different components. "Include" or "comprise" and similar words mean that the elements or objects appearing before the word include the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0173] The above is only a preferred embodiment of the present invention, and does not limit the present invention in other forms. Any technician familiar with the profession may use the above disclosed technical content to change or modify it into an equivalent embodiment with equivalent changes. However, any simple modification, equivalent change and modification made to the above embodiment according to the technical essence of the present invention without departing from the technical solution of the present invention still belongs to the protection scope of the technical solution of the present invention.
[0174] This patent is not limited to the above-mentioned optimal implementation mode. Anyone can derive other forms of an application layer encoding and decoding method for solving high bursts under the inspiration of this patent. All equal changes and modifications made according to the scope of the patent application of the present invention should be covered by this patent.
Claims
1. A method for solving high burst application layer coding and decoding, characterized in that: At the application layer, The encoder receives data transmitted by the upper layer through the first cache queue, and takes out the source data packet from the first cache queue for header encapsulation and GF(2 8 ), after the encoding operation of the source data packet and the encoded packet are sent through the sending end socket; The data packet is obtained from the receiving end socket through the second cache queue, the decoder takes out the data packet from the second cache queue, and performs decoding and recovery operations according to the data packet header information, and sorts the recovered data packets and transmits them to the upper layer in sequence.
2. The method for solving high burst application layer coding and decoding according to claim 1, characterized in that: Before the first cache queue receives data transmitted by an upper layer, initialization is performed, including: Initialize encoder parameters: set the encoding window size w e , the coding interleaving depth v, the transmission step length l of the coded packet, and the code rate R are: Initialize the sender socket parameters: set to UDP transmission, and bind the peer IP and port address entered by the terminal to the socket; And initialize a queue Q s , as the first cache queue, is used to store the source data packets sent by the upper-layer application. The parameter of the semaphore sem_t is added to make the two operations of storing data at the end of the queue and retrieving data at the head of the queue mutually exclusive.
3. The method for solving high burst application layer coding and decoding according to claim 2, characterized in that: The encoder takes out the source data packet from the first buffer queue, performs header encapsulation and performs GF(2 8 ), the process of sending the source data packet and the encoded packet through the sending end socket is as follows: The encoder determines the s Does the head point to a null pointer? If so, Q s The queue is empty, and the encoder continues to wait; if Q s If the head is not a null pointer, then take out Q s The data pointed to by the head pointer is put into the encoder; The encoder encapsulates the corresponding information of the source data packet as the packet header according to the source data packet information; the encoder initializes a variable id source , assigned a value of 0; each time a source data packet is encapsulated, id source Add one; id when encapsulating source As the stream_id information in the source data packet header, the source data packet length is as the pl_size information in the header, and the rest of the parameters are set to -1; Buffer source data packets into encoding window E w Among them, E w Implemented using deque container; If E w Size S e satisfy: S e >w e v Then E w The source data packet at the starting position is removed, and then a new source data packet is cached; if it is not satisfied, the new source data packet is directly cached; Send the source data packet to the corresponding port in the set peer IP through the sendto() function in the socket; According to the set step length l, determine whether to generate a coded packet by calculating the following formula: F=id source modl If F≠0, re-execute from queue Q s Determine whether the header points to a null pointer; if F=0, generate a coded packet; The encoder initializes a variable id repair , assigned a value of 0; each time a coded packet is encapsulated, id repair plus one; id repair As a random number seed, w is then randomly generated through the Mersenne selection algorithm e The randomly generated coding coefficients are limited to 0-255 by taking the modulus 256, and the generated w is defined e The set of coding coefficients is M; Initialize a character array R of size 2048 and assign it a value of 0; according to the interleaving depth v, take out E w The v-1th source data packet in the set M is GF(2 8 ) and then multiply it with R by GF(2 8 ) and the result is assigned to R; and so on, loop to take out E w The nv-1 source data packets in M perform the same operation with the nth coding coefficient in M until the following equation is satisfied, then the loop is exited; S e <nv-1 After jumping out of the loop, the content of R is used as the payload part of the encoded packet to encapsulate the corresponding packet header, id repair As the repair_id information in the packet header, E w The source_id of the source data packet at the starting position is used as the first_pkt_id information in the packet header, the source_id of the source data packet at the ending position is used as the last_pkt_id information in the packet header, the corresponding position of the last non-zero element in the character array R is used as the pl_size information in the packet header, and the other parameters are set to -1; Send the encoded packet to the corresponding port in the set peer IP through the sendto() function in the socket.
4. The method for solving high burst application layer coding and decoding according to claim 1, characterized in that: Before the second buffer queue obtains a data packet from the receiving end socket, initialization is performed, including: Initialize decoder parameters: set the maximum size w of the decoding window d , interleaving depth v; Initialize the receiving end socket parameters: set it to UDP transmission and bind the port number to be listened to to the socket; Initialize a queue Q r , as the second cache queue, is used to store the data packets received by the receiving socket, and add the parameter of the semaphore sem_t to make the two operations of storing data at the end of the queue and retrieving data at the head of the queue mutually exclusive.
5. The method for solving high burst application layer coding and decoding according to claim 4, characterized in that: The decoder takes out the data packets from the second buffer queue, performs decoding recovery operation according to the data packet header information, and sorts the recovered data packets and transmits them to the upper layer in sequence. The specific process is as follows: Set up a thread so that the receiving socket continuously receives data through the recv() function and caches it in the queue Q r middle; If Q r If the head is not a null pointer, then take out Q r The data pointed to by the head pointer is placed in the decoder; Extract the packet header information of the data packet. If repair_id=-1 and source_id≠-1, the received packet is the source packet. If repair_id≠-1 and source_id=-1, the received packet is the coded packet. If both are not -1 or both are -1, the packet is wrong and is discarded directly. The decoder initializes a variable id inorder Variable, assigned value 0; if the received data packet is the source data packet, determine whether it satisfies the following formula; source_id=id inorder If satisfied, it is directly passed to the upper application, id inorder plus one; If not satisfied, store in decoding window D w and generate the corresponding unit vector and insert it into D w The corresponding decoding matrix C d middle; If the received packet is a coded packet, determine whether the following formula is satisfied; last_pkt_id≤id inorder If it is satisfied, the coded packet is useless and is discarded directly; If not satisfied, store in decoding window D w And according to the first_pkt_id and last_pkt_id in the encoding packet header, the encoding coefficient length S is calculated r ; S r =last_pkt_id-first_pkt_id+1 By S r and interleaving depth v to calculate the effective coding coefficient length S v ; Then repair_id is used as a random number seed to generate S through the Mersenne selection algorithm. v A random number is constrained to be between 0 and 255 by taking the modulo 256. r Insert v-1 zeros in the middle of the random numbers, and finally get a length of S r The coding coefficients of D w The corresponding decoding matrix C d middle; If a new data packet is inserted, D w The size of w d Within, and C d If the rank is not full, repeat the above: take Q r The data pointed to by the head pointer is put into the following steps of the decoder; If a new data packet is inserted into D w After, D w The size exceeds w d , then remove D w The packet at the starting position in C is removed. d The corresponding coefficient in ; If a new data packet is inserted into D w After that, C d Full rank; definition D w The set of data packets in is Y d , then the source data packet set X is recovered according to the following formula; Sort the source data packet set X by source_id and then pass it to the upper-layer application in order.
6. The method for solving high burst application layer coding and decoding according to claim 1, characterized in that: The receiving end is also provided with an array space for caching source data packets, which is used to cache the data packets that have been successfully resumed for uploading recently, so as to adjust the coding coefficients of the coding packets.
7. An application layer codec system for solving high burst, arranged at the application layer of a computer system, characterized in that: include: A first cache queue, a second cache queue, an encoder, and a decoder; The first cache queue receives data transmitted by the upper layer, and the encoder takes out the source data packet from the first cache queue for header encapsulation and GF(2 8 ), after the encoding operation of the source data packet and the encoded packet are sent through the sending end socket; The data packets are obtained from the receiving end socket through the second cache queue, the decoder takes out the data packets from the second cache queue, performs decoding and recovery operations according to the data packet header information, sorts the recovered data packets, and transmits them to the upper layer in sequence.
8. The application layer coding and decoding system for solving high burst problems according to claim 7, characterized in that: Before the first cache queue receives data transmitted by an upper layer, initialization is performed, including: Initialize encoder parameters: set the encoding window size w e , the coding interleaving depth v, the transmission step length l of the coded packet, and the code rate R are: Initialize the sender socket parameters: set to UDP transmission, and bind the peer IP and port address entered by the terminal to the socket; And initialize a queue Q s , as the first cache queue, used to store source data packets sent by the upper-layer application, add the parameter of the semaphore sem_t to make the two operations of storing data at the end of the queue and getting data at the head of the queue mutually exclusive; The encoder determines the s Does the head point to a null pointer? If so, Q s The queue is empty, and the encoder continues to wait; if Q s If the head is not a null pointer, then take out Q s The data pointed to by the head pointer is put into the encoder; The encoder encapsulates the corresponding information of the source data packet as the packet header according to the source data packet information; the encoder initializes a variable id source , assigned a value of 0; each time a source data packet is encapsulated, id source Add one; id when encapsulating source As the stream_id information in the source data packet header, the source data packet length is as the pl_size information in the header, and the rest of the parameters are set to -1; Buffer source data packets into encoding window E w Among them, E w Implemented using deque container; If E w Size S e satisfy: S e >w e v Then E w The source data packet at the starting position is removed, and then a new source data packet is cached; if it is not satisfied, the new source data packet is directly cached; Send the source data packet to the corresponding port in the set peer IP through the sendto() function in the socket; According to the set step length l, determine whether to generate a coded packet by calculating the following formula: F=id source modl If F≠0, re-execute from queue Q s Determine whether the header points to a null pointer; if F=0, generate a coded packet; The encoder initializes a variable id repair , assigned a value of 0; each time a coded packet is encapsulated, id repair plus one; id repair As a random number seed, w is then randomly generated through the Mersenne selection algorithm e The randomly generated coding coefficients are limited to 0-255 by taking the modulus 256, and the generated w is defined e The set of coding coefficients is M; Initialize a character array R of size 2048 and assign it a value of 0; according to the interleaving depth v, take out E w The v-1th source data packet in the set M is GF(2 8 ) and then multiply it with R by GF(2 8 ) and the result is assigned to R; and so on, loop to take out E w The nv-1 source data packets in M perform the same operation with the nth coding coefficient in M until the following equation is satisfied, then the loop is exited; S e <nv-1 After jumping out of the loop, the content of R is used as the payload part of the encoded packet to encapsulate the corresponding packet header, id repair As the repair_id information in the packet header, E w The source_id of the source data packet at the starting position is used as the first_pkt_id information in the packet header, the source_id of the source data packet at the ending position is used as the last_pkt_id information in the packet header, the corresponding position of the last non-zero element in the character array R is used as the pl_size information in the packet header, and the other parameters are set to -1; Send the encoded packet to the corresponding port in the set peer IP through the sendto() function in the socket.
9. The application layer coding and decoding system for solving high burst problems according to claim 7, characterized in that: Before the second buffer queue obtains a data packet from the receiving end socket, initialization is performed, including: Initialize decoder parameters: set the maximum size w of the decoding window d , interleaving depth v; Initialize the receiving end socket parameters: set it to UDP transmission, bind the port number to be listened to to the socket; initialize a queue Q r , as the second cache queue, used to store the data packets received by the receiving end socket, and add the parameter of the semaphore sem_t to make the two operations of storing data at the end of the queue and getting data at the head of the queue mutually exclusive; The decoder takes out the data packets from the second buffer queue, performs decoding recovery operation according to the data packet header information, and sorts the recovered data packets and transmits them to the upper layer in sequence. The specific process is as follows: Set up a thread so that the receiving socket continuously receives data through the recv() function and caches it in the queue Q r middle; If Q r If the head is not a null pointer, then take out Q r The data pointed to by the head pointer is placed in the decoder; Extract the packet header information of the data packet. If repair_id=-1 and source_id≠-1, the received packet is the source packet. If repair_id≠-1 and source_id=-1, the received packet is the coded packet. If both are not -1 or both are -1, the packet is wrong and is discarded directly. The decoder initializes a variable id inorder Variable, assigned value 0; if the received data packet is the source data packet, determine whether it satisfies the following formula; source_id=id inorder If satisfied, it is directly passed to the upper application, id inorder plus one; If not satisfied, store in decoding window D w and generate the corresponding unit vector and insert it into D w The corresponding decoding matrix C d middle; If the received packet is a coded packet, determine whether the following formula is satisfied; last_pkt_id≤id inorder If it is satisfied, the coded packet is useless and is discarded directly; If not satisfied, store in decoding window D w And according to the first_pkt_id and last_pkt_id in the encoding packet header, the encoding coefficient length S is calculated r ; S r =last_pkt_id-first_pkt_id+1 By S r and interleaving depth v to calculate the effective coding coefficient length S v ; Then repair_id is used as a random number seed to generate S through the Mersenne selection algorithm. v A random number is constrained to be between 0 and 255 by taking the modulo 256. r Insert v-1 zeros in the middle of the random numbers, and finally get a length of S r The coding coefficients of D w The corresponding decoding matrix C d middle; If a new data packet is inserted, D w The size of w d Within, and C d If the rank is not full, repeat the above: take Q r The data pointed to by the head pointer is put into the following steps of the decoder; If a new data packet is inserted into D w After, D w The size exceeds w d , then remove D w The packet at the starting position in C is removed. d The corresponding coefficient in ; If a new data packet is inserted into D w After that, C d Full rank; definition D w The set of data packets in is Y d , then the source data packet set X is recovered according to the following formula; Sort the source data packet set X by source_id and then pass it to the upper-layer application in order.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of a method for solving high-burst application layer encoding and decoding as described in any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Adaptive end-to-end network coding transmission method
CN107508655A
Packet splicing decoding system and method
CN113364862A
Network coding communication method for real-time reliable control
CN119341690A