Summary of the invention
The present invention provides the RS coding redundancy packet distribution method and sending device of a kind of real-time video transmission, compiles using RS
During code carries out asymmetric redundancy protecting to real time video data, by being allocated optimization processing to redundancy packet, protecting
While demonstrate,proving the transmission reliability of real time video data, the quality of real time video data is improved, lower distortion journey is made it have
Degree.
The present invention provides a kind of RS coding redundancy packet distribution method of real-time video transmission, comprising:
Video sequence is generated, includes the data frame of preset quantity in the video sequence, includes size in each data frame
Fixed multiple data packets;
According to current network availability bandwidth and video code rate, the redundancy packet sum for distributing to the video sequence is determined;
The data packet number of each data frame according to the video sequence, the redundancy packet are total and described each
The Y-PSNR of data frame calculates the redundancy packet allocation vector in the video sequence, and the redundancy packet allocation vector makes described
The distortion factor of video sequence is minimum, and the redundancy packet allocation vector describes the distribution condition to the redundancy packet sum;
RS based on extended window coding is carried out to the video sequence using the redundancy packet allocation vector, and sends volume
Video sequence after code.
The present invention provides a kind of sending device, comprising:
Generation module includes the data frame of preset quantity, each data for generating video sequence, in the video sequence
It include fixed-size multiple data packets in frame;
Determining module, for according to current network availability bandwidth and video code rate, the video sequence to be distributed in determination
Redundancy packet sum;
Computing module, for the data packet number of each data frame according to the video sequence, the redundancy packet
The Y-PSNR of total and described each data frame calculates the redundancy packet allocation vector in the video sequence, the redundancy packet
Allocation vector keeps the distortion factor of the video sequence minimum, and the redundancy packet allocation vector is described to the redundancy packet sum
Distribution condition;
Coding module, for carrying out the RS based on extended window to the video sequence using the redundancy packet allocation vector
Coding;
Sending module, for sending the video sequence after encoding.
The RS coding redundancy packet distribution method and sending device of real-time video transmission provided by the invention, the terminal of transmitting terminal
It is arranged in after each video sequence for generating video data to be sent, by combining current network availability bandwidth and video codes
Rate distributes to the redundancy packet sum of video sequence to determine.And then with the minimum constraint of the distortion factor of video sequence, according to video
The Y-PSNR of the data packet number of each data frame, redundancy packet sum and each data frame calculates in video sequence in sequence
Redundancy packet allocation vector.During carrying out the RS coding based on extended window to video sequence, using the redundancy packet point
With the redundancy packet allocation processing in cataloged procedure is carried out to the distribution condition of redundancy packet sum described in vector, due to the redundancy
Packet distribution condition is obtained with the minimum constraint determination of the distortion factor of above-mentioned video sequence, therefore, is distributed based on the redundancy packet
RS coding can greatly improve the transmission reliability and video frequency data quality of real time video data.
Specific embodiment
In order to make the object, technical scheme and advantages of the embodiment of the invention clearer, below in conjunction with the embodiment of the present invention
In attached drawing, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment is
A part of the embodiment of the present invention, instead of all the embodiments.Based on the embodiments of the present invention, those of ordinary skill in the art
Every other embodiment obtained without making creative work, shall fall within the protection scope of the present invention.
Fig. 1 is the flow chart that the RS coding redundancy packet distribution method of one real-time video transmission of the embodiment of the present invention provides,
The method provided in this embodiment can be executed by the sending device of video data.As shown in Figure 1, this method comprises:
Step 101 generates video sequence, includes the data frame of preset quantity in the video sequence, in each data frame
Including fixed-size multiple data packets.
Specifically, video sending device is when needing to carry out the transmission of video image data content, first to generation
H.264, video image data is encoded, the process H.264 encoded with it is consistent in the prior art, do not repeat.To H.264 encode
Later, video sequence division is carried out to by the video image data H.264 encoded, obtains each video sequence.Due to right
The treatment process of each video sequence is similar, therefore, in the present embodiment only by taking the processing to a current video sequence as an example
It is illustrated.
In the present embodiment, a video sequence is all frames between two I frames, realizes that real-time is applied here
Video sequence does not include B frame.Being comprising 30 frame images in each video sequence includes 30 data frames, and composition structure is IPPP ...
Video sequence.Each data frame cutting is the data packet of fixed size, and router will not occur when guaranteeing network transmission
Subpackage.It is worth noting that the size for the data packet for including in each data frame is fixed, it is same size, still,
The size of each data frame be it is unfixed, i.e., each data frame can have different sizes.
Step 102, according to current network availability bandwidth and video code rate, determine the redundancy for distributing to the video sequence
Packet sum.
Since the real-time of radio network information channel environment changes, the network availability bandwidth of different moments is different, in addition,
Different network environments also has certain influence, transmission of the different video code rates for video to the selection of transmission of video code rate
And video image quality also has great influence.Therefore, in the present embodiment, according to current network availability bandwidth and video codes
Rate determines the redundancy packet sum for distributing to current video sequence.
When specific implementation, the superfluous of current video sequence is distributed to according to current network availability bandwidth and video code rate determination
Remaining packet sum, comprising:
According to current network availability bandwidth C and video code rate B, the maximum redundancy rate u that network can load is determined are as follows: u
=(C-B)/B;
According to the maximum redundancy rate u, the redundancy packet sum R for distributing to the video sequence is determined are as follows:
Wherein, kgFor the data packet number for including in g-th of data frame in the video sequence.
Step 103, the data packet number of each data frame according to the video sequence, the redundancy packet sum and
The Y-PSNR of each data frame calculates the redundancy packet allocation vector in the video sequence, the redundancy packet distribute to
Amount keeps the distortion factor of the video sequence minimum, and the redundancy packet allocation vector describes the distribution feelings to the redundancy packet sum
Condition.
In the present embodiment, it is above-mentioned calculated available maximum redundancy packet quantity after, it is optimal in order to determine
The redundancy packet method of salary distribution, a kind of optimization method of minimum constraint condition of the distortion factor with video sequence is provided.Video sequence
The distortion factor by data frame each in video sequence data packet number, that is, video sequence data packet distribution, redundancy packet sum
With the influence of the Y-PSNR of each data frame.
According to the characteristic that the RS of extended window is encoded, if a certain data frame can decode, all data of the front
Frame all can necessarily decode.Therefore there is no the distortion propagation problems between data frame.The distortion of each data frame is by the data frame
It is distorted and measures caused by when frame losing individually occurs, measurement standard used is Y-PSNR.The meter of the Y-PSNR of data frame
It calculates and is calculated according to the calculation formula of Y-PSNR in the prior art.
Under given network bandwidth conditions, the redundancy packet that each video sequence can distribute in the video of a constant bit rate is total
Be it is fixed, these redundancy packets can be assigned arbitrarily on each data frame of the video sequence.Have in these distribution methods
A kind of whole distortion factor minimum can be realized above-mentioned video sequence, therefore, solves this most within the acceptable time
Excellent redundancy packet distribution is the main purpose of the present embodiment.A kind of fairly simple but relatively high complexity mode is that traversal is whole
A solution space therefrom determines optimal solution, the optimal solution, that is, corresponding optimal redundancy packet method of salary distribution.
Relative to entire solution space is traversed, the present embodiment proposes a kind of greedy algorithm of suboptimum --- hill-climbing algorithm makes to ask
Solution preocess is reduced to linear complexity by exponential complexity.Specifically, by the data of data frame each in current video sequence
Input parameter of the Y-PSNR of packet quantity, redundancy packet sum and each data frame as hill-climbing algorithm, using hill-climbing algorithm
Calculate the redundancy packet allocation vector in video sequence.
Specifically, during calculating, the redundancy packet allocation vector in video sequence is calculated according to the following formula:
Wherein,For the distortion factor of the video sequence,For the redundancy packet allocation vector, and
N is the number for the data frame for including in the video sequence, and γ (n) indicates that the Y-PSNR of nth data frame, P (n) indicate
The drop probabilities of nth data frame;Wherein, P (n) is determined according to the following formula:
Wherein, r1The redundancy packet quantity of first data frame is distributed in expression;k1Indicate the number for including in first data frame
According to packet quantity;rnIndicate the redundancy packet quantity of n data frame before distributing to;knIndicate the number-of-packet for including in nth data frame
Amount;F(k1+r1, i, p) and it indicates in the case where packet loss is the Network status of p, in k1+r1Packet loss quantity is the probability of i in a packet, according to
Formula determines;For the equivalent packet loss of each data packet in preceding n-1 data frame, according to
FormulaIt determines.
Total redundancy packet quantity is by r1Be added to rnAdduction determine.
In corresponding P (n) formula of above-mentioned n=1, the upper limit for summing it up part is r1, this is that RS coding techniques can be solved successfully
The condition of code.To k1A source data packet increases r1After a redundancy packet, as long as recipient has successfully received this k1+r1In a packet
Any k1A packet or more (either source data packet or redundancy packet is ok), can be successfully decoded out original k1A source number
According to packet.
In corresponding P (n) formula in above-mentioned n > 1, the meaning of the part F of first adduction and meaning class when n=1 above
Seemingly, are as follows: in the case where packet loss is the Network status of p, in all kn+rnPacket loss quantity is the probability of q in a data packet.Third adds
The 1 total data packet number for arriving n-1 data frame, that is, cumulative k are meant with partz, so the meaning of the latter F is exactly
1 probability that packet loss quantity is m into n-1 data frame.It is equivalent packet loss, r it is noted that having used P here1
To rn-1Influence be integrated into the inside.Then intermediate adduction part is added up to all acceptable packet loss quantity, here
That meet is q+m≤rn。
When specific implementation, hill-climbing algorithm is started from scratch adds redundancy packet one by one, and being added to can make video sequence whole every time
On the smallest frame of the distortion factor, until redundancy packet sum reaches the upper limit.Algorithm logic is as follows:
Simplicity of explanation are as follows: algorithm maintains a redundancy packet allocation vectorAnd be initialized as (0,0).Each round increases
Add a redundancy packet, this redundancy packet attempts addition on each data frame respectively and calculates corresponding total distortion value
Taking can make the smallest position of total distortion value place this redundancy packet and updateUntil the total quantity of redundancy packet reaches upper limit R.
Step 104 carries out the coding of the RS based on extended window to the video sequence using the redundancy packet allocation vector,
And send the video sequence after coding.
Finally, being based on optimal redundancy packet allocation vector obtained above, the RS based on extended window is carried out to video sequence
Coding, and send the video sequence after coding.Receiving end carries out after receiving the video sequence after the coding based on expanded window
The RS of mouth is decoded and is H.264 decoded, and the video sequence can be obtained.
In the present embodiment, the terminal of transmitting terminal is arranged in after each video sequence for generating video data to be sent, leads to
It crosses in conjunction with current network availability bandwidth and video code rate and determines the redundancy packet for distributing to video sequence sum.And then with video
The minimum constraint of the distortion factor of sequence, it is total and each according to the data packet number of data frame each in video sequence, redundancy packet
The Y-PSNR of data frame calculates the redundancy packet allocation vector in video sequence.It carries out to video sequence based on extended window
RS coding during, using encoded to the progress of the distribution condition of redundancy packet sum described in the redundancy packet allocation vector
Redundancy packet allocation processing in journey, since the redundancy packet distribution condition is true with the minimum constraint of the distortion factor of above-mentioned video sequence
Surely obtain, therefore, based on the redundancy packet distribution RS coding can greatly improve real time video data transmission reliability and
Video frequency data quality.
Fig. 2 is the structural schematic diagram of sending device provided by Embodiment 2 of the present invention, as shown in Fig. 2, the sending device packet
It includes:
Generation module 11 includes the data frame of preset quantity, every number for generating video sequence, in the video sequence
According in frame include fixed-size multiple data packets;
Determining module 12, for according to current network availability bandwidth and video code rate, the video sequence to be distributed in determination
The redundancy packet sum of column;
Computing module 13, for the data packet number of each data frame according to the video sequence, the redundancy
The Y-PSNR of packet sum and each data frame calculates the redundancy packet allocation vector in the video sequence, the redundancy
Packet allocation vector keeps the distortion factor of the video sequence minimum, and the redundancy packet allocation vector is described to the redundancy packet sum
Distribution condition;
Coding module 14, for being carried out the video sequence based on extended window using the redundancy packet allocation vector
RS coding;
Sending module 15, for sending the video sequence after encoding.
Further, the generation module 11 is also used to:
Video image data is generated, H.264 the video image data of generation is encoded;
Video sequence division is carried out to by the video image data H.264 encoded, obtains each video sequence.
Further, the determining module 12 is also used to:
According to current network availability bandwidth C and video code rate B, the maximum redundancy rate u that network can load is determined are as follows: u
=(C-B)/B;
According to the maximum redundancy rate u, the redundancy packet sum R for distributing to the video sequence is determined are as follows:
Wherein, kgFor the data packet number for including in g-th of data frame in the video sequence.
Further, the computing module 13 is also used to:
By the data packet number of each data frame described in the video sequence, redundancy packet sum and every number
Input parameter according to the Y-PSNR of frame as hill-climbing algorithm, is calculated superfluous in the video sequence using the hill-climbing algorithm
Remaining packet allocation vector.
Further, the computing module 13 is also used to:
The redundancy packet allocation vector in the video sequence is calculated according to the following formula:
Wherein,For the distortion factor of the video sequence,For the redundancy packet allocation vector, andN
Number for the data frame for including in the video sequence, γ (n) indicate that the Y-PSNR of nth data frame, P (n) indicate
The drop probabilities of nth data frame;Wherein, P (n) is determined according to the following formula:
Wherein, r1The redundancy packet quantity of first data frame is distributed in expression;k1Indicate the number for including in first data frame
According to packet quantity;rnIndicate the redundancy packet quantity of n data frame before distributing to;knIndicate the number-of-packet for including in nth data frame
Amount;F(k1+r1, i, p) and it indicates in the case where packet loss is the Network status of p, in k1+r1Packet loss quantity is the probability of i in a packet, according to
Formula determines;For the equivalent packet loss of each data packet in preceding n-1 data frame, according to
FormulaIt determines.
The sending device of the present embodiment can be used for executing the technical solution of embodiment of the method shown in Fig. 1, realization principle
Similar with technical effect, details are not described herein again.
Those of ordinary skill in the art will appreciate that: realize that all or part of the steps of above method embodiment can pass through
The relevant hardware of program instruction is completed, and program above-mentioned can be stored in a computer readable storage medium, the program
When being executed, step including the steps of the foregoing method embodiments is executed;And storage medium above-mentioned includes: ROM, RAM, magnetic disk or light
The various media that can store program code such as disk.
Finally, it should be noted that the above embodiments are merely illustrative of the technical solutions of the present invention, rather than its limitations;Although
Present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that: it still may be used
To modify the technical solutions described in the foregoing embodiments or equivalent replacement of some of the technical features;
And these are modified or replaceed, technical solution of various embodiments of the present invention that it does not separate the essence of the corresponding technical solution spirit and
Range.