Three, summary of the invention
1, goal of the invention: the purpose of this invention is to provide a kind of rapid holographic code/decode method, it can be simplified traditional live streaming media, program request and utilize the P2P technology to carry out the Data Transmission Controlling in using such as live streaming media, ensure the reliable transmission of data effectively, and then improve the quality of sound and image.
2, technical scheme: a kind of rapid holographic code/decode method is characterized in that: it comprises coding method and coding/decoding method, and wherein coding method may further comprise the steps:
(A) generate random matrix, all of this matrix all constitute by 0 or 1;
(B) generate random number: each row by the matrix in the above-mentioned steps (A) generates random number;
(C) fast XOR generates intermediate object program: every by the delegation of the matrix in the above-mentioned steps (A), and XOR again after multiplying each other with the information source data generates intermediate object program:
(D) combination generates coding result: by the result combinations of above-mentioned steps (B) with step (C), generate coding result;
Coding/decoding method may further comprise the steps:
(E) disassembled coding result: corresponding with " combination generates coding result " in the above-mentioned coding step (D), coding result is split;
(F) XOR is asked triangular matrix fast: utilize quick XOR elimination approach, triangular matrix is tried to achieve in cancellation line by line;
(G) XOR is found the solution fast: utilize quick XOR elimination approach, diagonal matrix is tried to achieve in cancellation line by line, finally tries to achieve decoded result.
In said method, can also comprise the network re-encoding method, the steps include:
(H) generate random matrix, all of this matrix all constitute by 0 or 1;
(I) fast XOR generates the result: every by the delegation of the matrix in the above-mentioned steps (H), XOR again after multiplying each other with the data that receive generates network coding result again.
Describe using method of the present invention below again in detail.
(1) in conventional flow medium living broadcast or program request, uses rapid holographic code/decode.
As shown in Figure 3, in conventional flow medium living broadcast or VOD system, stream medium data is submitted to before the communication network by communication component, increase quick holographic this link of encoding, be that the information source end carries out the quick holographic coding to these data earlier, then, receiving terminal carries out the quick holographic decoding to the data of receiving.Because each blocks of data behind the information source end coding all contains the raw information amount of some, as long as it is enough that receiving terminal receives the piece number of data, just can decode complete initial data, its reason is to be critical chunk without any a blocks of data, and receiving terminal can can't not decoded because lacking critical chunk.Utilize the benefit of rapid holographic code/decode to be: if partial data is lost behind communication network, receiving terminal still might restore the initial data of Streaming Media, has ensured the reliable transmission of data, and then improves the quality of image and sound.
(2) in the P2P live streaming media, use rapid holographic code/decode.
When the P2P live streaming media, the sending and receiving end must be judged and where (comprises other sending and receiving ends or information source) and go to ask for which data block, and make these effectively and judge, be a very crucial and very complicated job.Utilize rapid holographic code/decode, can be with above-mentioned work simplification: the sending and receiving end only needs to judge and where (comprises other sending and receiving ends or information source) and go to ask for data block, and do not need care specifically to ask for which data block, reduced the complexity of this step key job significantly, make whole P2P system healthy and strong more, thereby ensure the reliable transmission of data effectively, and then improve the quality of image and sound.As shown in Figure 4, when using the P2P technology to carry out live streaming media, stream medium data is submitted to before the communication network by communication component, increasing quick holographic this link of encoding is that the information source end carries out the quick holographic coding to these data earlier, then, the data of receiving are carried out quick holographic decoding in the sending and receiving end and network is encoded again, obtain decoded result and with network again coded data forward.
3, beneficial effect: the present invention compared with prior art, its remarkable advantage is: utilize rapid holographic code/decode, the control of reduced data transmission effectively, ensure the reliable transmission of data.In the rapid holographic code/decode, " fast " is meant when carrying out encoding and decoding, main use the XOR that microprocessor can finish fast and do not need to use the big several multiplication and division computings that consume very much the microprocessor time, " holography " is meant each data block of coding output, all includes a part of amount of information of whole original data blocks.
Five, embodiment
Rapid holographic code/decode method as shown in Figure 3, Figure 4 (the fast holographic code/decode device of promptly expressing one's gratification) mainly is a functional module, can adopt the method for software or hardware to realize.It comprises quick holographic coding, quick holographic decoding and quick holographic network three parts of encoding again, and the performing step of this three part as detailed below.
For ease of describing, we are referred to as data source of stream media is information source, and suppose a part of information source by data block X1, X2, X3 ..., Xm constitutes, small letter English alphabet m, n, k, s, t, v etc. are the symbol subscript, be natural number, and n are more than or equal to m.
1, the implementation method of quick holographic coding.
(1) generate random matrix A:
Data A11 in the following matrix A, A12 ... A1m ... Ak1, Ak2, Ak3 ... Akm ... An1, An2, An3 ... Anm is chosen as 0 or be 1 at random.
(2) generate random number Ak:
Because A11, A12, A13 ..., Anm only is 0 or 1, so, the available capable information of k that m bit Ak comes representing matrix A.Such as, the highest order of Ak be Ak1, an inferior high position be Ak2 ... lowest order is Akm, for example, when A11=1, A12=1, A13=0 ... during A1m=1, A1 is a binary number 110 ... 1.
(3) XOR generates intermediate object program Pk fast:
Pk=(Ak1*X1)xor(Ak2*X2)xor(Ak3*X3)xor…xor(Akm*Xm)
Wherein xor is an xor operator, because Ak1, Ak2, Ak3 ... Akm can only be 0 or 1, so above-mentioned computing develops into the XOR that microprocessor can be finished fast.For example, A11=1, A12=0, A13=1, A14=0, A15 up to A1 (m-1) all be 0, A1m=1, then P1=X1 xor X3 xor Xm.
(4) combination generates coding result Yk:
With Ak and Pk combination, produce a new data block Yk.For example, A1 is a binary number 0001, and P1 is a binary number 01011111, one-tenth data block Y1=000101011111 then capable of being combined.
The implementation method that the quick holographic coding is concrete:
The first step: by the method for above-mentioned " generate random matrix A ", be provided with at random data A11, A12 in the above-mentioned matrix A ... Anm is 0 or 1, for ease of the quick holographic decoding, guarantee the validity of random algorithm.
Second step: by the method for above-mentioned " generate random number Ak ", generate n m bit binary data A1, A2, A3 ... An.
The 3rd step: by the method for above-mentioned " fast XOR generate intermediate object program Pk ", generate n data block P1, P2, P3 ... Pn.
The 4th step: by the method for above-mentioned " combination generate coding result Yk ", generate n data block Y1, Y2, Y3 ... Yn.
The output in above-mentioned the 4th step, the coding that is the quick holographic coding is exported the result.The m blocks of data X1 of information source, X2, X3 ..., Xm, through behind the quick holographic coding, output n blocks of data Y1, Y2, Y3 ..., Ym ..., Yn, the data block number n of output can be on demand more than the data block number m of input.
2, the implementation method of quick holographic decoding.
Transmitting terminal with m original source data block X1, X2, X3 ..., Xm, through quick holographic coding obtain n coding export as a result Y1, Y2, Y3 ..., Ym ..., Yn, and send it to receiving terminal by communication network, receiving terminal receive Y1, Y2, Y3 ..., Ys, because possibility obliterated data in the communication network transmission is so the data block number s that receiving terminal receives may be less than the number n of transmitting terminal transmission, but, guarantee that s is more than or equal to m in order to decode.
(1) disassembled coding Yk as a result:
Corresponding with transmitting terminal, receiving terminal with Y1, Y2, Y3 ..., each the data block Yk among the Ys splits into Ak and Pk, again m bit Ak is torn open for m be 0 or 1 value Ak1, Ak2, Ak3 ..., Akm.By A1, A2, A3 ..., As and P1, P2, P3 ..., Ps can be constructed as follows two matrixes.
(2) XOR is asked triangular matrix fast:
The XOR that adopts microprocessor to finish rapidly, it is as follows that every row of above-mentioned two matrixes is carried out identical processing:
From A11, A21 ..., Ak1 ..., Am1 ..., among the As1, an optional value is 1 number, and with its pairing row, comes the 1st row.Then, if the capable Ak1 of k is 0, it is capable then directly to come k, if the capable Ak1 of k is 1, then with k capable with the 1st row XOR after, arrange in k capablely again, obtain following two matrixes:
From B22, B32 ..., Bk2 ..., Bm2 ..., among the Bs2, an optional value is 1 number, and with its pairing row, is discharged to the 2nd row.Then, if the capable Bk2 of k is 0, it is capable then directly to come k, if the capable Bk2 of k is 1, then with k capable with the 2nd row XOR after, arrange in k capablely again, obtain following two matrixes:
Repeat above-mentioned steps m time altogether, m is capable in the matrix of the left side only has m to be 1, all the other are 0, (it may be linear correlation between some equation that its reason is similar in the system of linear equations to abandon unnecessary row, so solve the needed equational number s of m unit's once linear equation group, might be greater than m), finally obtain following two matrix E and T, matrix E is a triangular matrix:
(3) XOR is found the solution fast:
The XOR that adopts microprocessor to finish rapidly, it is as follows that every row of above-mentioned two matrix E and T is carried out identical processing:
For inverse the 2nd row of above-mentioned two matrixes,, behind the 2nd row then reciprocal and the 1st row XOR reciprocal, arrange again in the 2nd row reciprocal if E (m-1) is m=1; If E (m-1) is m=0, the 2nd row reciprocal remains unchanged, and obtains following two matrixes:
Adopt XOR, repeat above-mentioned similar step, can obtain following two matrix H and W at last
Thereby, solve m argument X1, X2, X3 ..., Xm value be: X1=W1, X2=W2, X3=W3 ..., Xm=Wm.
The implementation method that the quick holographic decoding is concrete:
The first step: the method by above-mentioned " disassembled coding is Yk as a result " splits into Ak and Pk with the Yk as a result that receives, and obtains two matrixes.
Second step: the method by above-mentioned " XOR is asked triangular matrix fast ", generate two matrix E and T, wherein, matrix E is a triangular matrix.
The 3rd step: by the method for above-mentioned " quick XOR find the solution ", generator matrix W, thus solve X1=W1, X2=W2, X3=W3 ..., Xm=Wm.
The output in above-mentioned the 3rd step as a result X1, X2, X3 ..., Xm, be the quick holographic decoded result.The s that the receiving terminal utilization receives data block Y1, a Y2, Y3 ..., Ys, restore m piece original source data X1, X2, X3 ..., Xm, because each row of the matrix that first step fractionation Yk obtains, possible some row is a linear correlation, so the data block number s that decodes required may be greater than the data block number m of original source.
3, the quick holographic network implementation method of encoding again.
The sending and receiving end receive several coding outputs that transmitting terminal (comprising other sending and receiving ends or information source) sends as a result Y1, Y2, Y3 ..., Yt, before transmitting, the sending and receiving end could be forwarded to the result in the communication network after need encoding to it again, this again cataloged procedure be called network and encode again.
(1) generate random matrix Q:
Data Q11, Q12 among the following matrix Q ... Q1t ... Qk1, Qk2, Qk3 ... Qkt ... Qv1, Qv2, Qv3 ... Qvt is chosen as 0 or 1 at random.
(2) XOR generates coding result Zk fast:
Zk=(Qk1*Y1)xor(Qk2*Y2)xor(Qk3*Y3)xor…xor(Qkt*Yt)
Wherein xor is an xor operator, because Qk1, Qk2, Qk3 ... Qkt can only be 0 or 1, so above-mentioned computing develops into the XOR that microprocessor can be finished fast.For example, Q11=1, Q12=0, Q13=1, Q14=0, Q15 up to Q1 (t-1) all be 0, Q1t=1, then Z1=Y1 xor Y3 xor Yt.
The quick holographic network concrete implementation method of encoding again:
The first step: by the method for above-mentioned " generate random matrix Q ", be provided with at random data Q11, Q12 among the above-mentioned matrix Q ... Qvt is 0 or 1, for ease of the quick holographic decoding, guarantee the validity of random algorithm.
Second step: by the method for above-mentioned " fast XOR generate coding result Zk ", generate v data block Z1, Z2, Z3 ..., Zv.
The output in above-mentioned second step is the output result that the quick holographic network is encoded again, and the data block number v of output can be on demand more than the data block number t that imports.
Above-mentioned quick holographic coding, decoding, network are encoded again, mainly are the XORs that has utilized microprocessor to finish rapidly, and do not use the big several multiplication and division computings that consume very much the microprocessor time, thereby have guaranteed the high efficiency of encoding and decoding.