Disclosure of Invention
The invention aims to provide a method and a system for recovering stage lighting data under a weak network, which solve the problems of repeated retransmission of data packets and large bandwidth requirement when the stage lighting data packets are recovered by applying the existing data packet recovery technology.
The invention is realized by the following technical scheme:
in one aspect, a method for recovering stage lighting data under a weak network is provided, including the following steps:
S1, detecting network dimming data;
s2, judging whether the current stage lighting transmission network is in a weak network state according to the detection result of the network dimming data;
S3, if the current stage lighting transmission network is in a weak network state, executing S4, if the current stage lighting transmission network is in a non-weak network state, directly outputting network dimming data, and ending the current task;
S4, carrying out packet loss recovery on the current network dimming data in a retransmission mode to obtain the current packet loss recovery rate after retransmission;
S5, judging whether the current packet loss recovery rate reaches the expected packet loss recovery rate or not;
And S6, if the expected packet loss recovery rate is not reached, carrying out self-adaptive redundancy adjustment on the network dimming data subjected to retransmission to obtain the minimum redundancy of the network dimming data, adjusting the redundancy duty ratio of the network dimming data according to the minimum redundancy, taking the adjusted network dimming data as the current network dimming data, returning to S4, and if the expected packet loss recovery rate is reached, outputting the recovered network dimming data, and ending the current task.
Wherein S4 comprises the steps of:
s41, decoding a data packet of the current network dimming data at a receiving end;
S42, if the receiving end decodes the error, the data packet with the decoding error is stored in a buffer area, and the transmitting end is requested to retransmit the data packet corresponding to the data packet with the decoding error;
S43, combining the retransmitted data packet with the data packet in the buffer area at the receiving end, and decoding the combined data packet;
S44, if the combined data packet is not decoded correctly, returning to S42 until the combined data packet is decoded correctly or the maximum retransmission times are reached, ending retransmission, obtaining the current packet loss recovery rate when the combined data packet is decoded correctly, and emptying the data packet of the buffer area and discarding the current network dimming data when the maximum retransmission times are reached.
In S44, the method for obtaining the maximum retransmission times comprises the steps of adaptively obtaining the passive retransmission times by combining retransmission techniques according to the allowed packet loss recovery time and the expected packet loss recovery rate, and taking the passive retransmission times as the maximum retransmission times.
In S5, obtaining the minimum redundancy of the network dimming data includes the following steps:
S51, respectively calculating to obtain a probability value P mki and a probability value P nj, wherein the probability value P mki represents the probability that the receiving end receives i media packets after retransmitting m media packets in the network dimming data and reaching the maximum retransmission times k, and the probability value P nj represents the probability that the transmitting end transmits n redundant packets in the network dimming data to the receiving end and the receiving end receives j redundant packets;
s52, establishing a calculation model of a probability value P according to the probability value P mki and the probability value P nj, wherein the probability value P represents the probability that the current recovery rate of the network dimming data reaches the expected packet loss recovery rate after the m media packets are retransmitted and the maximum retransmission times k are reached under the condition that n redundant packets exist in the network dimming data;
And S53, calculating and obtaining a minimum redundant packet quantity when the current packet loss recovery rate of the network dimming data reaches the expected packet loss recovery rate according to a calculation model P-Sigma i+j≥mPmkiPnj of the probability value P.
On the other hand, the system for recovering stage lighting data under the weak network comprises a data detection module, a network state detection module, a logic control module, a packet loss recovery processing module, a data output module, a packet loss recovery rate detection module and a self-adaptive redundancy adjustment module. The system comprises a data detection module, a logic control module, a self-adaptive redundancy adjustment module and a dimming module, wherein the data detection module is used for detecting network dimming data, the network state detection module is used for judging whether a current stage lighting transmission network is in a weak network state according to the detection result of the network dimming data, the logic control module is used for driving a packet loss recovery processing module to work when the current stage lighting transmission network is in the weak network state, and driving a data output module to work when the current stage lighting transmission network is in the non-weak network state, the packet loss recovery processing module is used for carrying out packet loss recovery on the current network dimming data in a mode of combining and retransmitting to obtain the current packet loss recovery rate after combining and retransmitting, the data output module is used for directly outputting the network dimming data when the current stage lighting transmission network is in the non-weak network state, and ending the current task, the self-adaptive redundancy adjustment module is used for carrying out self-adaptive redundancy adjustment on the network dimming data after combining and retransmitting the network dimming data when the current packet loss recovery rate does not reach the expected packet loss recovery rate, and the redundancy adjustment module is used for outputting the current dimming data after the redundancy adjustment is used for completing the current dimming task when the current dimming data is in the state.
Further, the packet loss recovery processing module comprises a CRC decoding unit, a data packet buffer unit, a retransmission request unit, a data inclusion merging unit, a logic control unit, a recovery rate obtaining unit, a buffer emptying unit and a lamplight data encoding unit.
The CRC decoding unit is used for decoding a data packet of current network dimming data at a receiving end, the data packet buffer unit is used for storing the data packet with the decoding error into a buffer area under the condition of decoding error of the receiving end, the retransmission request unit is used for requesting a transmitting end to retransmit the data packet corresponding to the data packet with the decoding error under the condition of decoding error of the receiving end, the data inclusion merging unit is used for merging the retransmitted data packet with the data packet of the buffer area at the receiving end and decoding the merged data packet, the logic control unit is used for controlling the data packet buffer unit, the retransmission request unit and the data packet merging unit to work until the merged data packet is correctly decoded or reaches the maximum retransmission times, the retransmission is ended, the recovery rate acquisition unit is used for acquiring the current packet loss recovery rate when the merged data packet is correctly decoded, the buffer area is emptied and the current network dimming data is discarded when the retransmission times reach the maximum value, and the lamplight data encoding unit is used for carrying out CRC encoding on the data and transmission at the transmitting end.
The adaptive redundancy adjustment module comprises a probability calculation unit and a redundancy calculation unit. The probability calculation unit is used for calculating and obtaining a probability value P mki and a probability value P nj respectively, wherein the probability value P mki is used for representing the probability that m media packets in the network dimming data are retransmitted and the receiving end receives i media packets after the maximum retransmission times k are reached, the probability value P nj is used for representing the probability that the transmitting end transmits n redundant packets in the network dimming data to the receiving end and the receiving end receives j redundant packets, the probability calculation unit is also used for establishing a calculation model of the probability value P according to the probability value P mki and the probability value P nj, the probability value P is used for representing the probability that the current recovery rate of the network dimming data reaches the expected packet loss recovery rate when the n redundant packets exist in the network dimming data, and the redundancy calculation unit is used for calculating and obtaining the minimum value of the redundancy packet quantity when the current packet loss recovery rate of the network dimming data reaches the expected packet loss recovery rate according to the calculation model of the probability value P.
Compared with the prior art, the method has the advantages that on one hand, under the condition that the analysis of the data packet is wrong, a merging retransmission technology is adopted to request a transmitting end to retransmit the data packet with the analysis error, and the data packet received at present is merged with the data packet with the analysis error before, so that the merged data packet is more reliable compared with the data packet obtained by independent decoding, in addition, the maximum retransmission times are set according to the expected packet loss recovery rate and the packet loss recovery time, when the retransmission times reach the maximum value, if the data packet cannot be analyzed correctly, the data packet is selected to be discarded, the data retransmission times are reduced in this way, and the occurrence of data retransmission storm during high delay is avoided. On the other hand, under the condition that the expected packet loss recovery rate is not reached after the merging retransmission technology is adopted, the redundancy duty ratio in the network dimming data is continuously adaptively adjusted, so that the packet loss recovery time and the bandwidth requirement are reduced. In general, the invention adopts a mode of combining retransmission technology and self-adaptive adjustment technology to recover stage lighting data under a weak network, reduces retransmission times, improves data transmission rate, reduces redundancy duty ratio on the premise of ensuring packet loss recovery rate, and improves packet loss resistance recovery capability.
Detailed Description
For the purpose of making apparent the objects, technical solutions and advantages of the present invention, the present invention will be further described in detail with reference to the following examples and the accompanying drawings, wherein the exemplary embodiments of the present invention and the descriptions thereof are for illustrating the present invention only and are not to be construed as limiting the present invention.
Example 1
The embodiment provides a method for recovering stage lighting data under a weak network as shown in fig. 1. The method comprises the following steps:
and 1, detecting the transmission rate of the network dimming data.
And 2, judging whether the current stage lighting transmission network is in a weak network state according to the detected transmission rate of the network dimming data.
And step 3, if the current stage lighting transmission network is in a weak network state, executing step 4, and if the current stage lighting transmission network is in a non-weak network state, directly outputting network dimming data, and ending the current task.
And 4, carrying out packet loss recovery on the current network dimming data in a retransmission mode to obtain the current packet loss recovery rate after retransmission.
And 5, judging whether the current packet loss recovery rate reaches the expected packet loss recovery rate.
And 6, if the expected packet loss recovery rate is not reached, carrying out self-adaptive redundancy adjustment on the network dimming data subjected to retransmission to obtain the minimum redundancy of the network dimming data, adjusting the redundancy duty ratio of the network dimming data according to the minimum redundancy, taking the adjusted network dimming data as the current network dimming data, returning to the step 4, and if the expected packet loss recovery rate is reached, outputting the recovered network dimming data, and ending the current task.
Wherein, step 4 is realized by the following steps:
and 4.1, the sending end performs CRC encoding on the network dimming data and sends the encoded data to the receiving end.
And 4.2, decoding the data packet of the network dimming data at the receiving end.
And 4.3, if the decoding error occurs at the receiving end, storing the data packet with the decoding error into a buffer area, and requesting the transmitting end to retransmit the data packet corresponding to the data packet with the decoding error.
And 4.4, combining the retransmitted data packet with the data packet in the buffer area at the receiving end, wherein the combined data packet has better reliability compared with the independently decoded data packet. And decoding the combined data packet.
And 4.5, returning to the step 4.3 if the combined data packet is not decoded correctly, ending retransmission until the combined data packet is decoded correctly or the maximum retransmission times are reached, acquiring the current packet loss recovery rate when the combined data packet is decoded correctly, and emptying the data packet in the buffer area and discarding the current network dimming data when the maximum retransmission times are reached.
In step 4.5, the method for obtaining the maximum retransmission times includes adaptively obtaining the passive retransmission times by combining retransmission techniques according to the allowed packet loss recovery time and the expected packet loss recovery rate, and taking the passive retransmission times as the maximum retransmission times. For example, at the allowed packet loss recovery time T (customer demand), the value of the passive retransmission number k is adaptively obtained by combining retransmission techniques. For example, in 100 hausec packet loss recovery time, combining retransmission to obtain the minimum k_min when the packet loss recovery rate is equal to 90%, and taking the minimum k_min as the value of the retransmission times K.
Further, in S5, obtaining the minimum redundancy of the network dimming data includes the following steps:
And 5.1, respectively calculating to obtain a probability value P mki and a probability value P nj.
The probability value P mki represents the probability that the receiving end receives i media packets after retransmitting m media packets in the network dimming data and reaching the maximum retransmission frequency k, and the probability value P nj represents the probability that the transmitting end transmits n redundant packets in the network dimming data to the receiving end and the receiving end receives j redundant packets.
And 5.2, establishing a calculation model of the probability value P according to the probability value P mki and the probability value P nj. The expression of the calculation model of the probability value P is p= Σ i+j≥mPmkiPnj. The probability value P represents the probability that the current recovery rate of the network dimming data reaches the expected packet loss recovery rate after the m media packets are retransmitted and the maximum retransmission number k is reached in the case that n redundant packets exist in the network dimming data.
And 5.3, calculating and obtaining a minimum redundant packet number when the current packet loss recovery rate of the network dimming data reaches the expected packet loss recovery rate according to a calculation model of the probability value P.
Specifically, the transmitted network dimming data includes m data packets, and the maximum retransmission number is k within the allowed packet loss recovery time T. Wherein i and j are independent variables, and i+j is greater than or equal to m. The expected recovery of lost packets is 90%. And carrying out summation calculation by using the expression of the calculation model of the probability value P every time of self-increment, and taking the current redundancy packet number n as redundancy when the calculation result is equal to 90%, thereby obtaining the optimal redundancy proportion, the optimal delay loss and the optimal packet loss recovery rate.
In summary, in the method for recovering stage lighting data under a weak network provided in this embodiment, on the one hand, in the case of a data packet parsing error, a merging retransmission technology is adopted to request a transmitting end to retransmit the data packet with the parsing error, and combine the currently received data packet with the previously parsed data packet, so that the combined data packet is more reliable than the data packet obtained by independent decoding. On the other hand, under the condition that the expected packet loss recovery rate is not achieved after the combined retransmission technology is adopted, the redundancy duty ratio in the network dimming data is continuously adaptively adjusted, so that the packet loss recovery time and the bandwidth requirement are reduced.
Example 2
Corresponding to embodiment 1, the present embodiment provides a system for recovering stage lighting data under a weak network, which includes a data detection module, a network state detection module, a logic control module, a packet loss recovery processing module, a data output module, a packet loss recovery rate detection module, and an adaptive redundancy adjustment module.
The data detection module is used for detecting network dimming data.
And the network state detection module is used for judging whether the current stage lighting transmission network is in a weak network state according to the detection result of the network dimming data.
The logic control module is used for driving the packet loss recovery processing module to work when the current stage lighting transmission network is in a weak network state, and driving the data output module to work when the current stage lighting transmission network is in a non-weak network state.
The packet loss recovery processing module is used for carrying out packet loss recovery on the current network dimming data in a retransmission mode when the current stage lighting transmission network is in a weak network state, and obtaining the current packet loss recovery rate after retransmission.
And the data output module is used for directly outputting network dimming data when the current stage lighting transmission network is in a non-weak network state, and ending the current task.
And the packet loss recovery rate detection module is used for judging whether the current packet loss recovery rate reaches the expected packet loss recovery rate.
The self-adaptive redundancy adjustment module is used for carrying out self-adaptive redundancy adjustment on the network dimming data after the retransmission is combined under the condition that the current packet loss recovery rate does not reach the expected packet loss recovery rate, obtaining the minimum redundancy of the network dimming data, adjusting the redundancy duty ratio of the network dimming data according to the minimum redundancy, inputting the adjusted network dimming data as the current network dimming data into the packet loss recovery rate detection module, and outputting the recovered network dimming data under the condition that the current packet loss recovery rate reaches the expected packet loss recovery rate, thereby ending the current task.
Further, the packet loss recovery processing module comprises a CRC decoding unit, a data packet buffer unit, a retransmission request unit, a data inclusion merging unit, a logic control unit, a recovery rate obtaining unit, a buffer emptying unit and a lamplight data encoding unit.
The CRC decoding unit is used for decoding the data packet of the current network dimming data at the receiving end.
And the data packet buffer unit is used for storing the data packet with decoding error into the buffer area under the condition of decoding error of the receiving end.
And the retransmission request unit is used for requesting the transmitting end to retransmit the data packet corresponding to the data packet with the decoding error under the condition that the decoding error of the receiving end occurs.
And the data inclusion merging unit is used for merging the retransmitted data packet with the data packet in the buffer area at the receiving end and decoding the merged data packet.
And the logic control unit is used for controlling the data packet buffer unit, the retransmission request unit and the data packet merging unit to work under the condition that the merged data packet is not decoded correctly, until the merged data packet is decoded correctly or the maximum retransmission times are reached, and ending retransmission.
And the recovery rate acquisition unit is used for acquiring the current packet loss recovery rate when the combined data packets are correctly decoded.
The system comprises a buffer clearing unit, a lamplight data coding unit and a CRC check code, wherein the buffer clearing unit is used for clearing data packets of a buffer area and discarding current network dimming data when the retransmission times reach the maximum value, and the lamplight data coding unit is used for coding and transmitting the lamplight data and the CRC check code at a transmitting end.
Further, the adaptive redundancy adjustment module includes a probability calculation unit and a redundancy calculation unit.
Wherein, the probability calculation unit is used for calculating and obtaining a probability value P mki and a probability value P nj respectively. And is further configured to build a calculation model of the probability value P according to the probability value P mki and the probability value P nj.
The probability value P mki represents the probability that the receiving end receives i media packets after the m media packets in the network dimming data are retransmitted and the maximum retransmission number k is reached.
The probability value P nj represents the probability that the transmitting end transmits n redundant packets in the network dimming data to the receiving end, and the receiving end receives j redundant packets, and the probability value P represents the probability that the current recovery rate of the network dimming data reaches the expected packet loss recovery rate after the m media packets are retransmitted and the maximum retransmission times k are reached under the condition that n redundant packets exist in the network dimming data.
And the redundancy calculation unit is used for calculating and obtaining the minimum number of redundant packets when the current packet loss recovery rate of the network dimming data reaches the expected packet loss recovery rate according to the calculation model of the probability value P.
The foregoing description of the embodiments has been provided for the purpose of illustrating the general principles of the invention, and is not meant to limit the scope of the invention, but to limit the invention to the particular embodiments, and any modifications, equivalents, improvements, etc. that fall within the spirit and principles of the invention are intended to be included within the scope of the invention.