WO2014019551A1 - 解码处理方法、装置及编解码系统 - Google Patents

解码处理方法、装置及编解码系统 Download PDF

Info

Publication number
WO2014019551A1
WO2014019551A1 PCT/CN2013/080772 CN2013080772W WO2014019551A1 WO 2014019551 A1 WO2014019551 A1 WO 2014019551A1 CN 2013080772 W CN2013080772 W CN 2013080772W WO 2014019551 A1 WO2014019551 A1 WO 2014019551A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
matrix
original data
small
generation matrix
Prior art date
Application number
PCT/CN2013/080772
Other languages
English (en)
French (fr)
Inventor
李莉
Original Assignee
中兴通讯股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2014019551A1 publication Critical patent/WO2014019551A1/zh

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/004Arrangements for detecting or preventing errors in the information received by using forward error control
    • H04L1/0045Arrangements at the receiver end

Definitions

  • Cloud storage refers to a combination of a plurality of different types of storage devices in a network through application software, such as a cluster application, a grid technology, or a distributed file system, to jointly provide data storage and service access functions.
  • application software such as a cluster application, a grid technology, or a distributed file system
  • a system In a cloud computing environment, files are typically sliced and stored in multiple cloud storage servers. In data communication, the data that needs to be communicated is also divided into multiple fragments and transmitted to each other one by one.
  • RS Reed-Solomon
  • EC Erasure Codes
  • RS codes Reed-Solomon codes
  • An (n, k) erasure code encodes k source data into n(n>k) data, so that any k data of the n data can be used to reconstruct the original k source data.
  • the erasure code system using m slices and n check slices is (m+n, m) erasure code.
  • the key to the implementation of the RS erasure code is to find a generator matrix G, in which any k columns are linearly independent.
  • the more commonly used generator matrices are van dermund matrices and Cauchy matrices.
  • the code generated using the Vandermonde matrix is called the Vandermond Code
  • the code generated by the Cauchy matrix is called the Cauchy Code.
  • the coding principle is as follows: The original data D[D1, D2, ..Dm] is multiplied by the generator matrix G to generate m raw data D[D1, D2, ..Dm] and n check data P[P1, P2, ..., Pn].
  • the decoding principle is: arbitrarily obtain m data in m+n original data and check data, and compose data D to be decoded, for example, [Dl, ... Di, Pl..Pj].
  • the operation is instead limited to the Galois field G(2) or G(2 6).
  • G(2 6) In the Galois field, to speed up the operation
  • multiplication operations generally use the double table method.
  • a multiplication operation is equivalent to five basic operations; addition and subtraction use an exclusive OR (XOR) operation.
  • the codec function is generally implemented by using dedicated hardware to improve the encoding and decoding speed.
  • Another disadvantage is that the current RS erasure code system uses the double table method for Galois field multiplication calculation, which is performed by checking the log-antilog table. The double table method requires 5 basic operations to complete the Galois. Domain multiplication, resulting in slower calculations. If all Galois field multiplication data is moved into memory, 8G of memory is required. In the current computer hardware configuration, the cost is too high.
  • the RS erasure code system can significantly improve storage and transmission reliability in computer storage and computer communication, but its software codec speed is slow, and it grows exponentially as the fragmentation m increases.
  • the codec method based on the RS erasure code has a problem that the codec calculation amount is large, the speed is slow, and the effective utilization of the system storage is low.
  • the present invention provides a decoding processing method, apparatus, and codec system to solve at least the encoding and decoding method based on the RS erasure code in the related art, which has a large amount of codec calculation, slow speed, and effective utilization of system storage. Low problem.
  • a decoding processing method including: determining data to be decoded including partial original data and parity data, wherein the verification data corresponds to lost original data; And a first generation matrix for encoding, obtaining a small generation matrix corresponding to the lost original data, and new to-be-decoded data corresponding to the lost original data; according to the new data to be decoded and the The small generation matrix is obtained, and the lost original data is obtained.
  • obtaining a small generation matrix corresponding to the lost original data according to the verification data and the first generation matrix for encoding includes: normalizing processing the data to be decoded, where The normalization process includes: retaining a position of the part of the original data in the data to be decoded, and a position of the part of the original data in the original data before the encoding, and filling the check data into the to-be-processed data Decoding a remaining position in the data; acquiring a second generation matrix corresponding to the data to be decoded after the normalization process; acquiring, according to the second generation matrix and the verification data, a small corresponding to the lost original data Generate a matrix.
  • acquiring the second generation matrix corresponding to the data to be decoded after the normalization process comprises: retaining column data of a column corresponding to the original data in an identity matrix of the first generation matrix; The check data is filled in a check column of the unit matrix of the first generation matrix.
  • acquiring the small generation matrix corresponding to the lost original data according to the second generation matrix and the verification data comprises: extracting, in the second generation matrix, the occurrence of the verification data Rows and columns; the rows and columns in which the extracted check data appear are composed of the small generation matrix corresponding to the lost original data.
  • the method further includes: determining, according to a relationship between the verification data included in the small generation matrix and the corresponding lost original data, the corresponding small generation matrix Whether the inverse matrix file exists; if the determination result is yes, obtaining an inverse matrix of the small generation matrix by reading the small generation matrix inverse matrix file; and/or, if the determination result is negative, calculating the The inverse matrix of the small matrix is generated, and the inverse matrix of the small generator matrix is written to the small matrix inverse matrix file.
  • the method further includes: establishing an inverse matrix Galois field formed by each element in the inverse matrix of the small generator matrix and 0 to 65535 in the Galois field Array.
  • acquiring a small generation matrix corresponding to the lost original data according to the verification data and the first generation matrix for encoding acquiring a new one corresponding to the lost original data by using the following formula Wait
  • the number of input data for encoding, the parity data used for decoding, Dj is the data input at the time of encoding, ⁇ is the column of the parity data in the second generation matrix, and ® is an exclusive OR operation.
  • the data to be decoded is obtained by the following encoding manner: establishing, by the first generation matrix, each element except the unit matrix and the gamma An array of generated matrix Galois fields consisting of 0 to 65535 in the Rowa domain; determining whether there is storage of the first Generating a file corresponding to a multiplication operation result of each element other than the unit matrix in the matrix from 0 to 65535 in the Galois field; if the determination is YES, reading the generation matrix Galois from the file The result of the multiplication operation stored in the array of fields.
  • the method further includes: if the determination is negative Obtaining a multiplication operation result of each element in the first generation matrix except the unit matrix and 0 to 65535 in the Galois field; and acquiring each element of the first generation matrix except the unit matrix and the gamma
  • the result of the multiplication operation from 0 to 65535 in the Rowa field is stored in the array of generated matrix Galois fields.
  • a decoding processing apparatus including: a first determining module, configured to determine data to be decoded including a portion of original data and parity data, wherein the verification data corresponds to a lost original a first acquisition module, configured to acquire, according to the verification data and a first generation matrix for encoding, a small generation matrix corresponding to the lost original data, and a new corresponding to the lost original data
  • the data to be decoded; the second obtaining module is configured to acquire the lost original data according to the new data to be decoded and the small generation matrix.
  • the first obtaining module includes: a first processing unit, configured to perform normalization processing on the to-be-decoded data, where the normalization processing includes: retaining the part of original data in the to-be-decoded data a position in the original data in the original data before encoding, and filling the check data into the remaining position in the data to be decoded; the first obtaining unit is set to obtain and pass specifications a second generation matrix corresponding to the data to be decoded after the processing; the second obtaining unit is configured to acquire a small generation matrix corresponding to the lost original data according to the second generation matrix and the verification data.
  • the normalization processing includes: retaining the part of original data in the to-be-decoded data a position in the original data in the original data before encoding, and filling the check data into the remaining position in the data to be decoded; the first obtaining unit is set to obtain and pass specifications a second generation matrix corresponding to the data to be decoded after the processing; the second obtaining unit is configured to acquire a
  • the first obtaining unit includes: a reserved subunit, configured to retain column data of a column corresponding to the original data in an identity matrix of the first generation matrix; and a filler subunit, configured to be at the first The check data is filled in a check column of the unit matrix of the generation matrix.
  • the second obtaining unit includes: an extracting subunit, configured to extract rows and columns in which the check data appears in the second generation matrix; and form a subunit, and set the extracted checksum The rows and columns in which the data appear constitute the small generation matrix corresponding to the lost original data.
  • the method further includes: a first determining module, configured to determine, according to a relationship between the verification data included in the small generation matrix and the corresponding missing original data, whether the corresponding small generation matrix inverse matrix file exists; a module, configured to obtain an inverse matrix of the small generator matrix by reading the small generator matrix inverse matrix file if the judgment result is YES; and/or, the first write module is set to be a result of the determination In case Calculating an inverse matrix of the small generator matrix, and writing an inverse matrix of the small generator matrix to the small generator matrix inverse matrix file.
  • the method further includes: a first establishing module, configured to establish an inverse matrix Galois field array formed by each element in the inverse matrix of the small generation matrix and 0 to 65535 in the Galois field.
  • a codec system comprising the apparatus and the encoding apparatus according to any one of the preceding claims, wherein the encoding apparatus comprises: a second establishing module, configured to be established by the first Generating a matrix of generated matrix Galois fields composed of elements other than the unit matrix and 0 to 65535 in the Galois field; a second determining module, configured to determine whether there is a unit other than storing the first generating matrix a corresponding file of each of the elements outside the matrix and a multiplication operation result of 0 to 65535 in the Galois field; a reading module, configured to read from the file if the judgment result of the determination module is YES The resulting multiplication operation result stored in the matrix Galois field array.
  • the data to be decoded including the partial original data and the check data is determined, wherein the check data corresponds to the lost original data; according to the check data and the first generation matrix used for encoding, obtaining and a small generation matrix corresponding to the lost original data, and new to-be-decoded data corresponding to the lost original data; acquiring the lost original data according to the new to-be-decoded data and the small generation matrix
  • the invention solves the problem that the encoding and decoding method based on the RS erasure code in the related art has a large amount of codec calculation, a slow speed, and a low effective utilization rate of the system storage, thereby achieving the number of input data in the process of decoding processing.
  • FIG. 1 is a flowchart of a decoding processing method according to an embodiment of the present invention
  • FIG. 2 is a block diagram showing a structure of a decoding processing apparatus according to an embodiment of the present invention
  • FIG. 3 is a decoding processing apparatus according to an embodiment of the present invention.
  • FIG. 4 is a block diagram showing a preferred structure of the first obtaining unit 34 in the first obtaining module 24 in the decoding processing apparatus according to the embodiment of the present invention
  • 5 is a block diagram showing a preferred structure of the second obtaining unit 36 in the first obtaining module 24 in the decoding processing apparatus according to the embodiment of the present invention
  • FIG. 6 is a block diagram showing a preferred structure of the decoding processing apparatus according to the embodiment of the present invention
  • FIG. 8 is a block diagram showing a structure of a codec system according to an embodiment of the present invention
  • FIG. 9 is a block diagram of a file fast encoding method based on an RS erasure code according to an embodiment of the present invention
  • FIG. 10 is a flowchart of a file fast decoding method based on an RS erasure code according to an embodiment of the present invention.
  • BEST MODE FOR CARRYING OUT THE INVENTION the present invention will be described in detail with reference to the accompanying drawings. It should be noted that the embodiments in the present application and the features in the embodiments may be combined with each other without conflict.
  • FIG. 1 is a flowchart of a decoding processing method according to an embodiment of the present invention. As shown in FIG.
  • Step S102 determining to include part of original data and And verifying data to be decoded, wherein the check data corresponds to the lost original data
  • Step S104 acquiring a small generator matrix corresponding to the lost original data according to the check data and the first generation matrix used for encoding (and an inverse matrix of the small generator matrix), and new data to be decoded corresponding to the lost original data
  • Step S106 according to the new data to be decoded and the small generation matrix (or inverse matrix of the small generator matrix) , get the lost original data.
  • Obtaining a small generator matrix corresponding to the lost original data according to the check data and the first generation matrix used for encoding may adopt more processing manners, for example, for some simple small generator matrices, according to reasonable mathematical logic Inference, the small generation matrix can be extracted from the artificially generated first generation matrix for the verification data and the first generation matrix described above.
  • normalizing processing the data to be decoded wherein the normalization processing includes: retaining a position of the original data in the data to be decoded and a position of the original data in the original data before encoding, and The data is filled in the remaining position in the data to be decoded (wherein, the order of filling may be filled in order, or may be filled in reverse order, and the specific operation is not limited); and the first corresponding to the data to be decoded after normalization is obtained.
  • Second generation matrix where, the data input at the time of encoding
  • the second generator matrix multiplication can be obtained decoded data after normalization processing, and a generation matrix based on the second check data, acquires the original data corresponding to the loss of the small generator matrix.
  • the second generation matrix may be obtained according to the following simple processing manner: the column data of the column corresponding to the original data in the unit matrix of the first generation matrix is retained; The check column of the unit matrix of the matrix is filled with the check data after the column corresponding to the original data is retained.
  • the step of obtaining the small generator matrix corresponding to the lost original data may also adopt the following simple processing manner: extracting rows and columns in which the check data appears in the second generation matrix
  • the small generation matrix corresponding to the missing original data is formed by the row and column in which the extracted verification data appears.
  • an inverse matrix Galois field array composed of each element in the inverse matrix of the small generator matrix and 0 to 65535 in the Galois field may be established for subsequent decoding.
  • a new new to-be-corresponding data corresponding to the lost original data may also be obtained in various manners. Decode the data.
  • m is the number of input data at the time of encoding, and is the check data used for decoding
  • Dj is the code.
  • is the column of the check data in the second generation matrix
  • ® is the XOR operation.
  • the decoding method provided in the embodiment of the present invention is specifically reduced in comparison with the related art, and the decoding processing efficiency is high.
  • a generator matrix Galois field memory data structure consisting of elements other than the unit matrix in the first generation matrix and 0 to 65535 in the Galois field, such as an array or a hash table, is defined as an array.
  • each element except the unit matrix in the first generation matrix and 0 to 65535 of the Galois field are obtained.
  • the result of the multiplication operation that is, calculating the multiplication operation result of each element except the unit matrix in the first generation matrix and 0 to 65535 in the Galois field; each element of the obtained first generation matrix except the unit matrix
  • the result of the multiplication operation with 0 to 65535 in the Galois field is saved into the above-described generation matrix Galois field array.
  • the Galois field multiplication data consisting of each element except the unit matrix in the first generation matrix and 0 to 65535 in the Galois field, except by the array
  • the mode is saved and addressed in memory, and can also be saved and addressed in memory according to the Hash table.
  • other more convenient storage methods are equally applicable to the present invention.
  • a decoding processing device is also provided, which is used to implement the above-mentioned embodiments and preferred embodiments, and has not been described again.
  • the term "module” may implement a combination of software and/or hardware of a predetermined function.
  • the apparatus described in the following embodiments is preferably implemented in software, hardware, or a combination of software and hardware, is also possible and conceivable.
  • 2 is a structural block diagram of a decoding processing apparatus according to an embodiment of the present invention. As shown in FIG. 2, the apparatus includes a first determining module 22, a first obtaining module 24, and a second acquiring module 26. .
  • the first determining module 22 is configured to determine to be decoded data including a part of the original data and the check data, where the check data corresponds to the lost original data; the first obtaining module 24 is connected to the first determining module 22, and is configured. Obtaining a niche corresponding to the lost original data according to the above verification data and the first generation matrix for encoding Forming a matrix, and new data to be decoded corresponding to the lost original data; the second obtaining module 26 is connected to the first obtaining module 24, and configured to acquire the lost according to the new data to be decoded and the small generation matrix. raw data.
  • FIG. 3 is a block diagram showing a preferred structure of the first obtaining module 24 in the decoding processing apparatus according to the embodiment of the present invention. As shown in FIG.
  • the first acquiring module 24 includes a first processing unit 32, a first acquiring unit 34, and a second.
  • the obtaining unit 36, the first acquiring module 24 will be described below.
  • the first processing unit 32 is configured to perform normalization processing on the to-be-decoded data, where the normalization process includes: retaining a position of the original data in the to-be-decoded data and the original data of the part of the original data before encoding The positions are consistent, and the check data is filled into the remaining positions in the data to be decoded;
  • the first obtaining unit 34 is connected to the first processing unit 32, and is configured to acquire the data corresponding to the data to be decoded after the normalization process.
  • the second generation matrix 36 is connected to the first acquisition unit 34, and is configured to acquire a small generation matrix corresponding to the lost original data according to the second generation matrix and the verification data.
  • FIG. 4 is a block diagram showing a preferred structure of the first obtaining unit 34 in the first obtaining module 24 in the decoding processing apparatus according to the embodiment of the present invention. As shown in FIG. 4, the first obtaining unit 34 includes a reserved subunit 42 and a padding subunit. 44. The first obtaining module 24 will be described below.
  • FIG. 5 is a block diagram showing a preferred structure of the second obtaining unit 36 in the first obtaining module 24 in the decoding processing apparatus according to the embodiment of the present invention. As shown in FIG. 5, the second obtaining unit 36 includes an extracting subunit 52 and a constituent subunit. 54, the second acquisition unit 36 will be described below.
  • the extracting subunit 52 is configured to extract rows and columns in which the check data appears in the second generation matrix; the compiling subunit 54 is connected to the extracting subunit 52, and is configured to set the extracted check data to appear The columns make up the small generator matrix corresponding to the missing raw data.
  • 6 is a block diagram of a preferred structure of a decoding processing apparatus according to an embodiment of the present invention. As shown in FIG. 6, the apparatus includes, in addition to all the modules in FIG. 2, a first judging module 62, a third obtaining module 64, and / or the first write module 66, the device will be described below.
  • the first determining module 62 is connected to the second obtaining module 24, and is configured to determine whether the corresponding small matrix inverse matrix file is stored according to the relationship between the check data included in the small generation matrix and the corresponding lost original data.
  • the third obtaining module 64 is connected to the foregoing determining module 62, and is configured to obtain an inverse matrix of the small generating matrix by reading the small generator matrix inverse matrix file if the determination result is yes; and/or, the first write
  • the ingress module 66 is connected to the third obtaining module 64, and is configured to calculate an inverse matrix of the small generator matrix when the determination result is no, and write the inverse matrix of the small generator matrix to the small matrix inverse matrix file.
  • FIG. 7 is a block diagram of a preferred structure of a decoding processing apparatus according to an embodiment of the present invention.
  • the apparatus includes a first establishing module 72, in addition to all the modules in FIG.
  • the setup module 72 is described.
  • the first establishing module 72 is configured to establish an inverse matrix Galois field array formed by each element in the inverse matrix of the small generator matrix and 0 to 65535 in the Galois field.
  • a coding and decoding system is also provided in this embodiment
  • FIG. 8 is a structural block diagram of a codec system according to an embodiment of the present invention. As shown in FIG. 8, the system includes the decoding processing device according to any one of the above items.
  • an encoding device is further included, wherein the encoding device comprises: a second establishing module 82, configured to establish a generation consisting of each element except the unit matrix in the first generation matrix and 0 to 65535 in the Galois field a matrix of Galois field arrays; a second determining module 84, coupled to the establishing module 82, configured to determine whether there are any elements in the first generation matrix other than the unit matrix and the Galois field in the array of generated matrix Galois fields The result of the multiplication operation from 0 to 65535; the reading module 86 is connected to the second judging module 84, and is set to read the generated matrix in the Galois field array if the judgment result of the judging module is YES. The result of the multiplication operation.
  • the method for fast encoding and fast decoding under the RS erasure code system proposed in the above embodiments and preferred embodiments can be implemented by software, effectively improving the encoding and decoding speed, and
  • the inverse matrix, file encoding, and the amount of computation for file decoding are independent of the number of slices m, and are only related to the number of verification slices n used in encoding and decoding.
  • this method by using normalization processing of data to be decoded, it can be used to generate an equivalent smaller generation matrix G1 under the RS erasure code system, the size of the generation matrix is n*n, which can be much smaller than the original m.
  • the m value can be effectively improved under the Reed-Solomon (m+n, m) erasure code system, thereby improving the utilization of the storage space, or reducing Verify the data ratio and increase the communication speed during data communication.
  • the support m is as high as 64 to 128, and the corresponding coding rate reaches 91.4% and 95.5%, and m, n can satisfy the RS erasure correction.
  • the present invention has no limitation on the generation matrix. Both the Van Dermund matrix and the Cauchy matrix can be applied.
  • the fast coding and decoding method provided in this embodiment is composed of two methods of data fast coding and fast data decoding while maintaining the principle of using the RS erasure code. These two methods are independent and related. They can be used alone or in combination for fast data encoding and fast data decoding.
  • the data fast decoding method generally includes the following processing: (1) normalizing the data to be decoded, and buffering the inverse matrix data through the file; (2) quickly solving and generating The inverse matrix of the equivalent small matrix of the matrix; (3) Decoding and replacing the parity data.
  • the above-mentioned fast codec method adopts no limitation on the generation matrix, and the Vandermonde matrix, the Cauchy matrix or another generation matrix can be applied, and is not limited thereto, but the Cauchy matrix can be used to obtain better. effect.
  • the generation matrix is taken as a Cauchy matrix as an example.
  • a total of 3 columns of check matrices are used, and ⁇ denotes the jth row element of the i-th column data except the unit matrix in the Cauchy matrix.
  • the generation matrix G is also determined, and the data is incremented according to the column elements of the Cauchy matrix G, for a total of m*n elements, numbered from 0 to m*nl. Create a coded two-dimensional array Code[][] for m*n elements, and calculate the multiplication operation result for each element ⁇ from 0 to 65535 in the Galois field, pre-stored in the file, file name and! ⁇ ⁇ related.
  • the generation matrix at the time of encoding is independent of the file to be encoded, and is only related to m, n. Therefore, the generation matrix Galois field cache file under specific parameters can be generated in advance.
  • the corresponding generation matrix Galois field cache file is first read. If the file does not exist, the required array elements are evaluated and written to the file for later reading. Calculating the total multiplication result of an element ⁇ in the Galois field, is to read 65,536 words in a proper position ( ⁇ *65536*2 bytes) in Galois.dat, for a total of 128K bytes. Table 1 below shows the composition of the generated matrix Galois field array Code[m*n][65536].
  • each validation block data requires m Galois field multiplication and m-1 additions. Since 1 Galois field multiplication is equal to 5 bases This operation, therefore, the calculation amount of each validation block data is about 6m. The total calculation is 6mn.
  • the array method is used instead of the Galois field multiplication. The first Galois field multiplication only needs to check the memory operation of the array once. Therefore, the calculation amount of each valid block data is about 2 m. The calculation amount is 2mn, which is 2/3 less than the original operation, and the encoding speed is increased by two times. The size of the Code array used is m*n* 128KB.
  • the Code array size is 81.92 Mbytes.
  • L For files of length L, encode m words (two bytes) at a time.
  • the word encoding rather than the byte encoding, is calculated in the Galois field G (2 6), and the word encoding is adapted to the word length of the computer system itself to improve the encoding and decoding speed. If L is not an integer multiple of m, the last complement 0 is added to a multiple of m. Therefore, it is necessary to calculate L/m times in a loop, the original calculation amount is 6Ln, and the calculated amount is 2Ln after improvement.
  • the total code calculation amount of the file is independent of the number m of slices, and is only related to the check block n and the file length L. Therefore, increasing the number of m does not cause the file encoding speed to drop. On the contrary, since the size of the additional data generated and written to the disk is reduced in proportion to the original file after the number of slices m is increased, the encoding performance is rather improved.
  • Table 2 below shows the coding test results in the Dell E6420 notebook in seconds: Table 2
  • the fast decoding method includes the following steps: (1) normalizing the data to be decoded, and calculating the data to be decoded D in this case and the corresponding small generation matrix G, through the file Read 'the inverse matrix number According to. (2) If the inverse matrix file does not exist, calculate the inverse matrix of the small generator matrix and write the inverse matrix data to the file. (3) Quickly decode the check data. The above steps will be described below.
  • the block-to-decode data D' is represented by a matrix as [D . . . Dj, P x ..P y ], and the data to be decoded is normalized as follows to generate a unique permutation.
  • This normalized data uses the original data block and the check data.
  • the block combination is uniquely arranged according to this rule.
  • the principle of calculating the data to be decoded D" is:
  • Dj and ⁇ represent the column of the input data and the check data in the generation matrix G. If the jth position is not the original data, but the data ⁇ ⁇ is checked , it is skipped when the multiplication is calculated.
  • ® indicates an XOR operation. In the Galois field, addition and subtraction are XOR operations.
  • Table 3 shows the generation of small generator matrices, as shown in the following table:
  • the generator matrix the data consisting of the rows and columns in which the check data appears, constitutes the small generator matrix G lt)
  • P 1 ' P 1 ⁇ D 2 *P L2 ⁇ D 5 *P l5o
  • the final small generator matrix G1 is shown in Table 4.
  • a unique file name can be constructed.
  • the position where the verification data appears (shown in italics in bold in Table 3) is the number of the lost original data block.
  • the file is read. If the file exists, read the contents of the file into the inverse matrix ', and directly complete the calculation of the inverse matrix, and proceed to step (3). If the file does not exist, mark it, wait for step (2) to complete, and generate the inverse matrix, then write the inverse matrix data into the file. It is also possible to pre-calculate a number of inverse matrix files corresponding to a typical arrangement and store them in the storage system for direct use by the system.
  • Step (2) Calculating the inverse matrix
  • a small generator matrix is obtained, but there is no corresponding cache file, and the conventional code is used.
  • the inverse algorithm of the inverse matrix method is used to obtain the inverse matrix of the small generator matrix.
  • the commonly used algorithms for calculating the inverse matrix of the square matrix are the Gauss-Jordan elimination method and the adjoint matrix method.
  • the Gauss-Jordan elimination method the inverse matrix of the square matrix m is calculated to be 0 (m). Since the size of the generated matrix is now reduced to n * n elements, the amount of calculation drops to 0 ( ⁇ ⁇ 3).
  • the mechanism of the preferred embodiment calculating and saving the inverse matrix data on the first encounter. Since the normalization method is adopted, the data block damage position and the used verification slice number can be uniquely determined. Therefore, in the future, when the combination of the same situation is encountered, the inverse matrix can be obtained by reading the inverse matrix file. As the system continues to run, more and more combinations of inverse matrix data are generated and saved, and system performance is getting better and better. According to the method provided by the foregoing embodiment and the preferred embodiment, since the calculation of the inverse matrix workload is much smaller than the original, the value of the verification block number n can be effectively increased during the actual coding. After the decoded data is calculated, these elements are numbered from 0 in columns.
  • the n*n elements of the inverse matrix corresponding to numbers 0 to n*nl.
  • the Galois field multiplication results corresponding to these inverse matrix elements are read from the Galois field full file Galois.dat.
  • the Galois field multiplication result for each element ⁇ has 128K, which is located at Galois.dat from x*65536*2 bytes.
  • the Decode matrix size is n*n*128k. If the decoding supports up to 10 parity slices, the Decode matrix size is 12.8 Mbytes.
  • Step (3) Quickly Decoding Check Data
  • the decoding system used in the embodiment of the present invention only k check block data needs to be restored, and the rest are original data, and the positions are also the same.
  • three valid block data Pi, P 2 , P 3 are used, and when decoding, the remaining D 2 and D 5 can be directly used, and the position is also the same in the original data D.
  • Di, D 3 , D 4 are calculated based on the previous data preparation and inverse matrix multiplication.
  • the Decode matrix is used for Galois field multiplication. For example, to calculate the multiplication of the value and the inverse matrix , first find the number of ', then return De CO d e [x][ ⁇ ]. The decoding calculation amount is 0 (mk), which is lower than the original 0 ( ⁇ ⁇ 2), and is reduced to the original k/m. Calculated by a Galois field equal to 5 basic operations, the original decoding calculation amounted to 6 mm.
  • the decoding calculation amount is 0 (mk), which is lower than the original 0 ( ⁇ ⁇ 2) to the original k/m.
  • the original decoding calculation amount is 6 mm in total; using the decoding method of the present invention, the Galois field multiplication is all changed to the memory mode, and the calculation amount is decreased to 2 mk.
  • the decoding speed is increased by 3m/k times.
  • the embodiment of the present invention can reduce the calculation amount of 2/3 by using the encoding buffer matrix Code[][] and the decoding buffer matrix Decode[][].
  • m words are decoded each time.
  • Table 5 shows the memory data required for codec under different parameter settings and the ratio of the check data to the total file at the time of codec.
  • the Code array is calculated as m+n-1 different elements. It can be seen that in the case of 10 check shards, when the number of shards does not exceed 128, at most only 30.336M of memory is required, and all Galois field multiplication data encountered during encoding and decoding can be loaded. To memory, you don't need 8G RAM.
  • the amount of RS erasure correction code is not related to m at the time of encoding and decoding, it is only related to the number of parity blocks, but the larger m is, the smaller the proportion of data additionally written to the disk, and the better the encoding and decoding performance.
  • the method for fast coding and fast decoding in the RS erasure coding system provided by the embodiment of the present invention can be implemented by software, effectively improving the encoding and decoding speed, and the matrix inversion and the file encoding and decoding speed are both Regardless of m, it is only related to the number of check fragments n used for encoding and decoding.
  • the normalization method of the data to be decoded it can be used to quickly calculate the inverse matrix of the equivalent small generation matrix under the RS erasure coding system, and fast decoding. Reduce the inverse matrix calculation from the previous 0 ( m ) to 0 ( ⁇ ⁇ 3).
  • the Galois multiplication data is put into the memory, and when the Galois field multiplication is calculated, the method of checking the memory array is used instead of the previous double table method, thereby further improving the encoding and decoding speed.
  • the codec speed and the m value can be effectively improved under the Reed-Solomon (m+n, m) erasure code system, thereby improving the storage space utilization rate, or reducing Verify the proportion of data in the total data and increase the communication speed during data communication.
  • the support m is as high as 64 to 128, and the corresponding coding rate is 91.4% and 95.5%
  • m, n can satisfy the RS erasure code condition. Arbitrarily set under the conditions of limitations and computer computing power limitations.
  • the matrix element ⁇ 1/( ⁇ + ).
  • all can be loaded into memory.
  • the matrix of the generator matrix 0 can be obtained through the Vandermonde matrix or the Cauchy matrix.
  • the input data to be encoded is represented by D ⁇ D ⁇ D ⁇ D Ds], and the generated matrix G is used, the left side is the unit matrix I, and the right side is the 3*5 matrix containing three columns.
  • the generated encoded data is [D 1 , D 2 , D 3 , D 4 , D 5 , P 1 , P 2 , P 3 ], wherein the first 5 are original data fragments, and the last 3 are redundant. The remaining pieces.
  • the data is decoded:
  • D' is normalized by: homing the original data slice Di and returning it to the original position. Then use the check block data for the remaining vacancies in order.
  • D' [P1, D2, P2, P3, D5] after normalization is obtained by the following processing.
  • the method is to fill in the column data of the unit matrix I using the check data with the corresponding check column data in the original generator matrix.
  • the characteristics of the generator matrix G are: those columns x that use the original data block, or the corresponding column x in the unit matrix, the Xth element of the column is 1, and the rest is 0. For example, in this embodiment:
  • ⁇ ' ⁇ ® ⁇ Z) * ⁇ , where 1 ⁇ is used when the i-th bit in D' is the original data, otherwise it is skipped.
  • the P3 small generator matrix is the n*n column in the original generator matrix G.
  • n is the used check block
  • Gi, i, je s 0 is the data composed of the rows and columns in which the check data appears in the generator matrix, and constitutes a small generator matrix.
  • the matrix is k*k in the case of using k check data.
  • the normalization process of inputting data to be decoded is the core idea of the "fast codec method based on RS erasure code" in the embodiment of the present invention.
  • the data to be decoded is generally arranged according to the original data and the post-verification data, that is, D' ⁇ Di, D 2 , D 5 , Pi, P 3 ].
  • the small generation matrix corresponding to the arrangement and its inverse can be quickly and uniquely determined by recording the position and number of the verification data.
  • the matrix file name, and read the contents of the inverse matrix file directly generate the inverse matrix through the file cache mode, avoiding the matrix calculation in the case of repeated cases, improving the performance.
  • the inverse matrix can be quickly calculated. Since the matrix has only k*k size, k ⁇ m is smaller than the original generator matrix m*m, so the inverse matrix calculation amount is significantly reduced from O(m) to 0(k).
  • the formatted representation of the data to be decoded used in the embodiment of the present invention is independent of the generator matrix algorithm, and may be used by either a Vandermonde matrix, a Cauchy matrix, or another generation matrix.
  • the inverse matrix of the small matrix is calculated, and the algorithm for calculating the inverse matrix is also irrelevant, regardless of the Gaussian elimination method.
  • using the codec method of the embodiment of the present invention can increase the speed of calculating the inverse matrix.
  • FIG. 9 is a flowchart of a file fast encoding method based on an RS erasure code according to an embodiment of the present invention. As shown in FIG. 9, the method includes the following steps: Step S902: The system prepares an 8G Galois field multiplication data file in advance.
  • the full Galois field multiplication data of the i-th element is placed at the beginning of the file i*128k, consecutively 128k bytes. For ease of reading, these data can be stored in several files to logically form a unified 8G Galois field multiplication data file.
  • the encoder is initialized according to the given m, n value, and the generator matrix is calculated according to the system generation matrix algorithm, and the Galois field multiplication two-dimensional array Code[m*n][65536] use space is allocated according to the m, n value.
  • the Code array requires a total of m*n*128k bytes of memory. It is a two-dimensional array of m*n*64k, each element in the array is between 0 and 65535, corresponding to a word length of the computer system, or two bytes. If the generator matrix uses a Cauchy matrix, the Code size can be (m+n-1) *128k bytes.
  • Step S904 generating a Galois field multiplication cache file name according to m, n, and determining whether the file exists. If there is a step S908, there is. If not, proceed to step S906.
  • the system can pre-prepare a number of Galois field multiplication cache files in a typical m, n configuration for import into the Code array.
  • Step S906 the Galois field multiplication cache file does not exist, and the column data other than the unit matrix in the generation matrix is incremented by a total of m*n elements, and the Galois field multiplication result of each element pair 0 to 65535 is calculated.
  • step S910 the Galois field multiplication cache file exists, and the content of the file is directly read into the Code, and the process proceeds to step S912.
  • step S910 writing the contents of the Code array to the Galois field multiplication cache file corresponding to m, n, and proceeding to step S912.
  • step S912 after completing the encoding preparation task, open the file to be encoded? .
  • step S914 m data are sequentially read from the file: m words, 2m bytes are read.
  • step S916 when the reading is successful, the input data D is RS-coded. Among them, the first m data directly returns the original data. The last n data needs to be calculated. Each data requires m Galois field multiplication operations and m-1 addition (exclusive OR) operations. Among them, the Galois field multiplication method uses the Code array method to improve the efficiency. For the Galois field multiplication of ⁇ * ⁇ , the number ⁇ of the ⁇ is first determined, and then the CodetxlPi] element is returned.
  • Step S918 the encoded m original data and the n verification data are respectively written into m+n block files.
  • the m data under the file is continuously read.
  • step S920 the file reading fails, indicating that the file has been encoded. Close the file F and m+n block files to be encoded and end the encoding.
  • Step S1002 system Prepare the 8G Galois field multiplication data file Galois.dat in advance, initialize the decoder according to m, n, and calculate the original generation matrix 0. Since the m and n parameters may be different in the RS erasure code algorithm used in each file, only when decoding a specific file, m, n can be obtained according to the metadata or fragmentation information of the file, and the decoder is initialized and calculated. The original generation matrix.
  • Step S1008 If the inverse matrix file exists, the process proceeds to step S1008, otherwise, the process proceeds to step S1010. Step S1008, reading the contents of the inverse matrix file, restoring the inverse matrix G, and proceeding to step S1022.
  • Step S1010 Generate a generation matrix G of the inverse matrix to be inquired and a corresponding small generation matrix G lt according to the format matrix of the generation matrix and the data to be decoded .
  • Step S1012 whether the inverse matrix obtained by the Gaussian elimination method is used? If yes, go to step S1014, otherwise go to step S1016.
  • step S1014 the inverse matrix calculated by the Gaussian elimination method requires a total of 0 (k) calculation amount, and the flow proceeds to step S1018.
  • step S1016 the inverse matrix step S1018 is performed using the adjoint matrix method, and the calculated inverse matrix 'data is written into the small inverse matrix file corresponding to the formatted data, so that the inverse matrix data is directly read after the next encounter.
  • step S1020 the Galois field multiplication data of all the data in the inverse matrix G1' is read into the De CO de[][] array. If the file corresponding to the Decode array exists, read it directly, otherwise calculate the Decode[][] array by correspondingly reading the corresponding data in Galois.dat. Step S1022, the m block files corresponding to the formatted arrangement and the file F to be restored are opened.
  • step S1024 one data is read from the m file, for a total of m data. If some shard files have no data, they are padded with 0 and added to m data. In the case where the reading is successful, the process proceeds to step S1026, otherwise to step S1032. Step S1026, copying m data to be decoded into the output area, and then calculating new data to be decoded D". Calculation formula:
  • ⁇ * ⁇ use the Code array in the fast encoding method to replace the Galois field multiplication operation by checking the array method to increase the speed.
  • Will 1 ⁇ ? 1 'Data is organized into D", for example, D ⁇ PA ⁇ ' Step S1028, using matrix multiplication: D"*Gi', to generate k missing data. The multiplication is directly looked up using the Decode array.
  • step S1030 m data in the output area is written into the file F to be restored, and the process returns to step S1026.
  • step S1032 the reading of the file fails, indicating that the processing ends. Close all files and end decoding.
  • the fast decoding process of the file based on the RS erasure code shown in FIG. 10 is only for explaining the implementation principle of the fast coding process provided by the embodiment of the present invention. In the specific implementation, it is also necessary to provide exception processing, file processing by block, and processing of the last multi-zero by file metadata.
  • modules or steps of the present invention can be implemented by a general-purpose computing device, which can be concentrated on a single computing device or distributed over a network composed of multiple computing devices. Alternatively, they may be implemented by program code executable by the computing device, such that they may be stored in the storage device by the computing device and, in some cases, may be different from the order herein.
  • the steps shown or described are performed, or they are separately fabricated into individual integrated circuit modules, or a plurality of modules or steps are fabricated as a single integrated circuit module.
  • the invention is not limited to any specific combination of hardware and software.
  • the above is only the preferred embodiment of the present invention, and is not intended to limit the present invention, and various modifications and changes can be made to the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and scope of the present invention are intended to be included within the scope of the present invention.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Error Detection And Correction (AREA)

Abstract

本发明提供了一种解码处理方法、装置及编解码系统,该方法包括:确定包括部分原数据与校验数据的待解码数据,其中,校验数据对应丢失的原数据;根据校验数据以及用于编码的第一生成矩阵,获取与丢失的原数据对应的小生成矩阵,以及与丢失的原数据对应的新的待解码数据;根据新的待解码数据以及小生成矩阵,获取丢失的原数据,通过本发明,解决了相关技术中基于RS纠删码的编解码方法存在编解码计算量庞大,速度慢,以及系统存储的有效利用率低的问题,进而达到了大大减少了编解码的计算量,提高了编解码的处理效率以及系统存储的有效利用率的效果。

Description

解码处理方法、 装置及编解码系统 技术领域 本发明涉及通信领域, 具体而言, 涉及一种解码处理方法、 装置及编解码系统。 背景技术 云存储是指通过集群应用、 网格技术或分布式文件系统等功能, 将网络中大量各 种不同类型的存储设备通过应用软件集合起来协同工作, 共同对外提供数据存储和业 务访问功能的一个系统。 在云计算环境中, 文件一般被分片保存在多个云存储服务器 中。 在数据通讯时, 需要通讯的数据也会被分为多个分片, 逐片传送给对方。 在数据存储时和通讯时, 为了解决可靠性的问题, 一般采用里德-所罗门 (Reed-Solomon, 简称为 RS) 纠删码 (Erasure Codes, 简称为 EC) 技术, 将文件编 码后, 分为大小相同的 m个分片和 n个校验分片, 分别进行存储或通讯。 对于文件存 储或者通讯接收方,只要获得其中任意 m个分片,即可通过解码恢复原文件或者数据, 因此可以抗 n个分片损坏或者丢失, 大大提高了系统的可靠性。对于计算机文件存储, 纠删码系统的存储空间利用率为 m/ (m+n), 远远高于副本存储方式, 因此, RS纠删 码通过计算能力换取存储能力, 显著降低了存储成本和运维成本。
1960年, 里德 (I.S.Reed) 和所罗门 (GSolomon) 提出一种构造纠删码的方法, 使用该方法的纠删码被称作 Reed-Solomon码, 简称 RS码。 基于 RS编码技术构造的 纠删码则称作 RS纠删码。 一个 (n, k)纠删码是把 k个源数据编码为 n(n>k)个数据, 使 得用这 n个数据中任意 k个数据均可重构原来的 k个源数据。采用 m个分片和 n个校 验分片的纠删码体制就是 (m+n, m)纠删码。
RS纠删码的实现技术关键是寻找一个生成矩阵 G,该矩阵中任意 k列均线性无关。 RS编码技术中, 比较常用的生成矩阵是范德蒙矩阵和柯西矩阵。使用范德蒙矩阵生成 的编码叫范德蒙码 (Vandermond Code), 使用柯西矩阵生成的编码叫柯西码 (Cauchy Code)。 其编码原理是: 原始数据 D[D1, D2, ..Dm]乘以生成矩阵 G, 产生 m个原始 数据 D[D1, D2, ..Dm]和 n个校验数据 P[P1, P2, ..., Pn]。 解码原理是: 在 m+n个 原始数据和校验数据中任意获得m个数据,组成待解码数据D',例如[Dl,...Di,Pl..Pj]。 在生成矩阵中去掉 n个未出现数据对应的那一列, 组成一个新的生成矩阵 G, 然后计 算 G的逆矩阵 G', 最后 D'*G'=D。 为了使矩阵运算的结果保持在实数域, 运算改为 限定在伽罗瓦 (Galois)域 G(2 )或者 G(2 6)进行。 在伽罗瓦域运算, 为加快运算速度 起见, 乘法操作一般采用查双表法, 一个乘法操作相当于 5个基本操作; 加法和减法 则采用异或 (XOR) 操作。 RS和伽罗瓦域运算、 矩阵求逆等的具体运算流程和特性, 早已被研究透彻, 在相关数学书籍和刊物上可以查到, 因此在此不再赘述。 但无论范德蒙矩阵和柯西矩阵的 RS纠删码体制, 都有一个共同的缺点, 就是编 码、 解码速度慢, 时间复杂度均为 0(ιηΛ2)。 因此 RS编码的原始数据块和校验块数目 都不能太大, 目前商用系统中分片数量 m—般不超过 10, 校验片 n—般不超过 6。 为 了在计算机通讯领域更好地运用 RS纠删码体制, 一般采用专用硬件实现编解码功能, 提高编解码速度。 另一个缺点是, 目前的 RS纠删码体制, 都采用双表法进行伽罗瓦 域乘法计算, 通过查对数-反对数表进行, 而双表法需要 5个基本操作才能完成伽罗瓦 域乘法, 造成计算结果较慢。 如果把所有伽罗瓦域乘法数据都移入内存, 则需要 8G 内存。 在目前计算机硬件配置下, 成本太高。 一方面, RS纠删码体制在计算机存储和计算机通讯中能显著提高存储和传输可靠 性, 但是其软件编解码速度慢, 而且随着分片 m的增加而呈指数型增长。 另一方面, 为了提升系统可靠性, 校验分片 n不能过小, 商用系统应至少保持在 4~6为宜, 而 m 又不能增长很多, 这就限制了存储系统的有效利用率。 例如 m=10, n=6, 系统有效存 储即编码率只有 10/16=62.5%。 如果在 n=6时要求 90%的编码率, 则 m必须大于等于 54。 在现有 RS纠删码计算方式下, 单纯使用软件实现, 要么很难做到, 要么性能很 差不实用。 因此, 在相关技术中基于 RS纠删码的编解码方法存在编解码计算量庞大, 速度 慢, 以及系统存储的有效利用率低的问题。 发明内容 本发明提供了一种解码处理方法、 装置及编解码系统, 以至少解决相关技术中基 于 RS纠删码的编解码方法存在编解码计算量庞大, 速度慢, 以及系统存储的有效利 用率低的问题。 根据本发明的一个方面, 提供了一种解码处理方法, 包括: 确定包括部分原数据 与校验数据的待解码数据, 其中, 所述校验数据对应丢失的原数据; 根据所述校验数 据以及用于编码的第一生成矩阵, 获取与所述丢失的原数据对应的小生成矩阵, 以及 与所述丢失的原数据对应的新的待解码数据; 根据所述新的待解码数据以及所述小生 成矩阵, 获取所述丢失的原数据。 优选地, 根据所述校验数据以及用于编码的所述第一生成矩阵, 获取与所述丢失 的原数据对应的小生成矩阵包括: 对所述待解码数据进行规格化处理, 其中, 所述规 格化处理包括: 保留所述部分原数据在所述待解码数据中的位置与所述部分原数据在 编码之前的原始数据中的位置一致, 并将所述校验数据填充到所述待解码数据中的剩 余位置; 获取与经过规格化处理之后的待解码数据对应的第二生成矩阵; 根据所述第 二生成矩阵以及所述校验数据, 获取与所述丢失的原数据对应的小生成矩阵。 优选地, 获取与经过所述规格化处理之后的待解码数据对应的所述第二生成矩阵 包括: 保留所述第一生成矩阵的单位矩阵中与所述原数据对应列的列数据; 在所述第 一生成矩阵的单位矩阵的校验列中填充所述校验数据。 优选地, 根据所述第二生成矩阵以及所述校验数据, 获取与所述丢失的原数据对 应的所述小生成矩阵包括: 在所述第二生成矩阵中提取所述校验数据出现的行与列; 将提取的所述校验数据出现的行与列组成所述丢失的原始数据对应的所述小生成矩 阵。 优选地, 在获取与所述丢失的原数据对应的小生成矩阵之后, 还包括: 根据所述 小生成矩阵包含的校验数据和对应丢失的原始数据之间的关系, 判断对应的小生成矩 阵逆矩阵文件是否存在; 在判断结果为是的情况下, 通过读取所述小生成矩阵逆矩阵 文件获取小生成矩阵的逆矩阵; 和 /或, 在判断结果为否的情况下, 计算所述小生成矩 阵的逆矩阵, 并把所述小生成矩阵的逆矩阵写入到所述小生成矩阵逆矩阵文件。 优选地, 在获取到所述小生成矩阵的逆矩阵后, 还包括: 建立所述小生成矩阵的 逆矩阵中的各个元素与伽罗瓦域中的 0到 65535构成的逆矩阵伽罗瓦域数组。 优选地, 在根据所述校验数据以及用于编码的第一生成矩阵, 获取与所述丢失的 原数据对应的小生成矩阵之后, 通过以下公式获取与所述丢失的原数据对应的新的待
Pj ' = Pj ® ^Dj * Pi]
解码数据: ^ , j=l ..m, 其中, 如果第 j个位置不是原数据 1¾而是 校验数据 Px, 则计算乘法时把它略过, 为所述新的待解码数据, m为编码时输入数 据的数量, 为解码时使用的校验数据, Dj为编码时输入的数据, Ρ 为所述第二生成 矩阵中的校验数据的列, ®为异或操作。 优选地, 在确定包括所述部分原数据与校验数据的待解码数据之前, 通过以下编 码方式得到所述待解码数据: 建立由所述第一生成矩阵中除单位矩阵外的各个元素与 伽罗瓦域中的 0到 65535构成的生成矩阵伽罗瓦域数组; 判断是否存在存储所述第一 生成矩阵中除单位矩阵外的各个元素与伽罗瓦域中的 0到 65535的乘法操作结果对应 的文件; 在判断为是的情况下, 从所述文件中读取所述生成矩阵伽罗瓦域数组中所存 储的乘法操作结果。 优选地, 在判断是否存在存储所述第一生成矩阵除单位矩阵外的各个元素与伽罗 瓦域中的 0到 65535的乘法操作结果对应的文件之后,还包括: 在判断为否的情况下, 获取所述第一生成矩阵中除单位矩阵外的各个元素与伽罗瓦域中的 0到 65535的乘法 操作结果; 将获取的所述第一生成矩阵中除单位矩阵外的各个元素与伽罗瓦域中的 0 到 65535的乘法操作结果保存在所述生成矩阵伽罗瓦域数组中。 根据本发明的另一方面, 提供了一种解码处理装置, 包括: 第一确定模块, 设置 为确定包括部分原数据与校验数据的待解码数据, 其中, 所述校验数据对应丢失的原 数据; 第一获取模块, 设置为根据所述校验数据以及用于编码的第一生成矩阵, 获取 与所述丢失的原数据对应的小生成矩阵, 以及与所述丢失的原数据对应的新的待解码 数据; 第二获取模块, 设置为根据所述新的待解码数据以及所述小生成矩阵, 获取所 述丢失的原数据。 优选地, 所述第一获取模块包括: 第一处理单元, 设置为对所述待解码数据进行 规格化处理, 其中, 所述规格化处理包括: 保留所述部分原数据在所述待解码数据中 的位置与所述部分原数据在编码之前的原始数据中的位置一致, 并将所述校验数据填 充到所述待解码数据中的剩余位置; 第一获取单元, 设置为获取与经过规格化处理之 后的待解码数据对应的第二生成矩阵; 第二获取单元, 设置为根据所述第二生成矩阵 以及所述校验数据, 获取与所述丢失的原数据对应的小生成矩阵。 优选地, 所述第一获取单元包括: 保留子单元, 设置为保留所述第一生成矩阵的 单位矩阵中与所述原数据对应列的列数据; 填充子单元, 设置为在所述第一生成矩阵 的单位矩阵的校验列中填充所述校验数据。 优选地, 所述第二获取单元包括: 提取子单元, 设置为在所述第二生成矩阵中提 取所述校验数据出现的行与列; 组成子单元, 设置为将提取的所述校验数据出现的行 与列组成所述丢失的原始数据对应的所述小生成矩阵。 优选地, 还包括: 第一判断模块, 设置为根据所述小生成矩阵包含的校验数据和 对应丢失的原始数据之间的关系, 判断对应的小生成矩阵逆矩阵文件是否存在; 第三 获取模块, 设置为在判断结果为是的情况下, 通过读取所述小生成矩阵逆矩阵文件获 取小生成矩阵的逆矩阵; 和 /或, 第一写入模块, 设置为在判断结果为否的情况下, 计 算所述小生成矩阵的逆矩阵, 并把所述小生成矩阵的逆矩阵写入到所述小生成矩阵逆 矩阵文件。 优选地, 还包括: 第一建立模块, 设置为建立所述小生成矩阵的逆矩阵中的各个 元素与伽罗瓦域中的 0到 65535构成的逆矩阵伽罗瓦域数组。 根据本发明的另一方面, 提供了一种编解码系统, 包括上述任一项所述的装置和 编码装置, 其中, 所述编码装置包括: 第二建立模块, 设置为建立由所述第一生成矩 阵中除单位矩阵外的各个元素与伽罗瓦域中的 0到 65535构成的生成矩阵伽罗瓦域数 组; 第二判断模块, 设置为判断是否存在存储所述第一生成矩阵中除单位矩阵外的各 个元素与伽罗瓦域中的 0到 65535的乘法操作结果的对应文件; 读取模块, 设置为在 所述判断模块的判断结果为是的情况下, 从所述文件中读取所述生成矩阵伽罗瓦域数 组中所存储的乘法操作结果。 通过本发明, 采用确定包括部分原数据与校验数据的待解码数据, 其中, 所述校 验数据对应丢失的原数据; 根据所述校验数据以及用于编码的第一生成矩阵, 获取与 所述丢失的原数据对应的小生成矩阵, 以及与所述丢失的原数据对应的新的待解码数 据; 根据所述新的待解码数据以及所述小生成矩阵, 获取所述丢失的原数据, 解决了 相关技术中基于 RS纠删码的编解码方法存在编解码计算量庞大, 速度慢, 以及系统 存储的有效利用率低的问题,进而达到了在解码处理的过程中与输入数据的数量无关, 大大减少了编解码的计算量, 提高了编解码的处理效率以及系统存储的有效利用率的 效果。 附图说明 此处所说明的附图用来提供对本发明的进一步理解, 构成本申请的一部分, 本发 明的示意性实施例及其说明用于解释本发明, 并不构成对本发明的不当限定。 在附图 中: 图 1是根据本发明实施例的解码处理方法的流程图; 图 2是根据本发明实施例的解码处理装置的结构框图; 图 3是根据本发明实施例的解码处理装置中第一获取模块 24的优选结构框图; 图 4是根据本发明实施例的解码处理装置中第一获取模块 24中第一获取单元 34 的优选结构框图; 图 5是根据本发明实施例的解码处理装置中第一获取模块 24中第二获取单元 36 的优选结构框图; 图 6是根据本发明实施例的解码处理装置的优选结构框图一; 图 7是根据本发明实施例的解码处理装置的优选结构框图二; 图 8是根据本发明实施例的编解码系统的结构框图; 图 9是根据本发明实施例的基于 RS纠删码的文件快速编码方法的流程图; 图 10是根据本发明实施例的基于 RS纠删码的文件快速解码方法的流程图。 具体实施方式 下文中将参考附图并结合实施例来详细说明本发明。 需要说明的是, 在不冲突的 情况下, 本申请中的实施例及实施例中的特征可以相互组合。 在本实施例中提供了一种解码处理方法, 图 1是根据本发明实施例的解码处理方 法的流程图, 如图 1所示, 该流程包括如下步骤: 步骤 S102, 确定包括部分原数据与校验数据的待解码数据, 其中, 该校验数据对 应丢失的原数据; 步骤 S104, 根据上述校验数据以及用于编码的第一生成矩阵, 获取与上述丢失的 原数据对应的小生成矩阵(以及该小生成矩阵的逆矩阵), 以及与上述丢失的原数据对 应的新的待解码数据; 步骤 S106, 根据上述新的待解码数据以及上述小生成矩阵(或者小生成矩阵的逆 矩阵), 获取丢失的原数据。 通过上述步骤, 只针对丢失的数据获取对应的小生成矩阵, 以及对应的新的待解 码数据, 从而得到丢失的数据, 即在计算逆矩阵的过程中与数据分片的数量无关, 只 和使用的校验分片数量有关, 并且在编码和解码过程中, 使用内存缓存伽罗瓦域乘法 取代原有的双表法。 相对于原有方法, 不仅解决了相关技术中基于 RS纠删码的编解 码方法存在编解码计算量庞大, 速度慢, 以及系统存储的有效利用率低的问题, 而且, 达到了提高了编解码的处理效率以及系统存储的有效利用率的效果。 在根据校验数据以及用于编码的上述第一生成矩阵, 获取与丢失的原数据对应的 小生成矩阵可以采用较多的处理方式, 例如, 对于一些简单的小生成矩阵, 按照合理 的数学逻辑推理, 可以针对校验数据以及上述第一生成矩阵, 人为地第一生成矩阵中 提取出小生成矩阵, 当然对于一些复杂的小生成矩阵, 还需要按照严密的数学规则获 得, 较优地, 可以采用以下处理方式: 对待解码数据进行规格化处理, 其中, 该规格 化处理包括: 保留部分原数据在待解码数据中的位置与部分原数据在编码之前的原始 数据中的位置一致, 并将校验数据填充到待解码数据中的剩余位置 (其中, 上述填充 的顺序可以是依次填充, 也可以倒序来填充, 具体操作并不限定); 获取与经过规格化 处理之后的待解码数据对应的第二生成矩阵; 其中, 编码时输入的数据与该第二生成 矩阵相乘可以得到规格化处理之后的待解码数据, 根据上述第二生成矩阵以及校验数 据, 获取与丢失的原数据对应的小生成矩阵。 采用这样的处理方式, 可以适用于多种 场景, 并且操作原理简单, 处理时也较为容易。 在实施时, 采用上述严密的数学规则处理时, 获取第二生成矩阵也可以按照以下 较为简单的处理方式: 保留第一生成矩阵的单位矩阵中与原数据对应列的列数据; 在 第一生成矩阵的单位矩阵的校验列中填充上述保留完原数据对应列之后的校验数据。 另外, 根据第二生成矩阵以及校验数据, 获取与丢失的原数据对应的小生成矩阵的步 骤也可以采用以下较为简单的处理方式: 在第二生成矩阵中提取校验数据出现的行与 列; 将提取的校验数据出现的行与列组成丢失的原始数据对应的小生成矩阵。 在获取小生成矩阵后, 可以根据小生成矩阵包含的校验数据和对应丢失的原始数 据之间的关系, 判断对应的小生成矩阵逆矩阵文件是否存在, 如果存在, 通过读取该 文件, 直接获得小生成矩阵的逆矩阵; 如果不存在, 通过逆矩阵计算方法, 计算出小 生成矩阵的逆矩阵, 并把逆矩阵内容写入到对应文件中。 较优地, 在获得小生成矩阵 逆矩阵数据后, 还可以建立小生成矩阵逆矩阵中各个元素与伽罗瓦域中的 0到 65535 构成的逆矩阵伽罗瓦域数组, 用于随后的解码。 优选地, 在根据校验数据以及用于编码的第一生成矩阵, 获取与丢失的原数据对 应的小生成矩阵之后, 也可以通过各种方式获得新的与丢失的原数据对应的新的待解 码数据。 本发明实施例提供了一种处理方式, 即通过以下公式获取与丢失的原数据对 应的新的待解码数据: Pd ®†^*^, j=l ..m, 其中, 如果第 j个位置不是原数 据 Dj而是校验数据 Px, 则计算乘法时把它略过, 为该新的待解码数据, m为编码 时输入数据的数量, 为解码时使用的校验数据, Dj为编码时输入的数据, Ρ 为第二 生成矩阵中的校验数据的列, ®为异或操作。 优选地,由于本发明实施例中所提供的解码方法具体相对于相关技术计算量减少, 以及解码处理效率高的特点, 因此, 在对待解码数据进行编码时, 可以采用以下编码 方式得到该待解码数据: 首先, 建立由第一生成矩阵中除单位矩阵外的各个元素与伽 罗瓦域中的 0到 65535构成的生成矩阵伽罗瓦域内存数据结构, 例如数组或者 Hash 表, 以下以数组为例说明; 在进行编码时, 先判断生成矩阵伽罗瓦域数组中是否存在 第一生成矩阵中除单位矩阵外的各个元素与伽罗瓦域中的 0到 65535的乘法操作结果, 较简单地, 可以判断存储该操作结果的文件是否存在; 在判断为是的情况下, 直接读 取该生成矩阵伽罗瓦域数组中所存储的乘法操作结果。 采用这样的处理方式, 只需要 简单的判断以及读取操作, 相比于现有技术中伽罗瓦乘法的多次连续操作, 其操作量 大大减少, 在一定程度上提高了解码的效率。 另外, 在该数组中不存在第一生成矩阵与伽罗瓦域中从 0到 65535的乘法操作结 果时, 获取第一生成矩阵中除单位矩阵外的各个元素与伽罗瓦域的 0到 65535的乘法 操作结果, 即计算第一生成矩阵中除单位矩阵外的的各个元素与伽罗瓦域中的 0 到 65535 的乘法操作结果; 将获取的第一生成矩阵中除单位矩阵外的各个元素与所述伽 罗瓦域中的 0到 65535的乘法操作结果保存到上述生成矩阵伽罗瓦域数组中。 生成矩 阵伽罗瓦域数组中的数据, 不仅用于编码, 而且用于解码过程中计算新的待解码数据 的步骤中, 采用这样的处理之后, 在之后采用相同的第一生成矩阵对输入数据进行编 码时, 就可以直接读取相应的乘法操作结果, 节约处理时间, 提高效率。 需要说明的是, 在上述实施例及优选实施方式中, 由第一生成矩阵中除单位矩阵 外的各个元素与伽罗瓦域中的 0到 65535构成的伽罗瓦域乘法数据, 除了按数组方式 在内存中保存和寻址外, 还可按照 Hash表方式在内存中保存和寻址。 当然, 其它较为 便利的存储方式也同样适用于本发明。 在本实施例中还提供了一种解码处理装置, 该装置用于实现上述实施例及优选实 施方式, 已经进行过说明的不再赘述。 如以下所使用的, 术语"模块"可以实现预定功 能的软件和 /或硬件的组合。 尽管以下实施例所描述的装置较佳地以软件来实现, 但是 硬件, 或者软件和硬件的组合的实现也是可能并被构想的。 图 2是根据本发明实施例的解码处理装置的结构框图, 如图 2所示, 该装置包括 第一确定模块 22、 第一获取模块 24和第二获取模块 26, 下面对该装置进行说明。 第一确定模块 22, 设置为确定包括部分原数据与校验数据的待解码数据, 其中, 该校验数据对应丢失的原数据; 第一获取模块 24, 连接至上述第一确定模块 22, 设置 为根据上述校验数据以及用于编码的第一生成矩阵, 获取与丢失的原数据对应的小生 成矩阵, 以及与丢失的原数据对应的新的待解码数据; 第二获取模块 26, 连接至上述 第一获取模块 24, 设置为根据该新的待解码数据以及上述小生成矩阵, 获取丢失的原 数据。 图 3是根据本发明实施例的解码处理装置中第一获取模块 24的优选结构框图,如 图 3所示, 该第一获取模块 24包括第一处理单元 32、 第一获取单元 34和第二获取单 元 36, 下面对该第一获取模块 24进行说明。 第一处理单元 32, 设置为对上述待解码数据进行规格化处理, 其中, 该规格化处 理包括: 保留部分原数据在上述待解码数据中的位置与该部分原数据在编码之前的原 始数据中的位置一致, 并将校验数据填充到该待解码数据中的剩余位置; 第一获取单 元 34,连接至上述第一处理单元 32, 设置为获取与经过规格化处理之后的待解码数据 对应的第二生成矩阵; 第二获取单元 36, 连接至上述第一获取单元 34, 设置为根据上 述第二生成矩阵以及校验数据, 获取与丢失的原数据对应的小生成矩阵。 图 4是根据本发明实施例的解码处理装置中第一获取模块 24中第一获取单元 34 的优选结构框图, 如图 4所示, 该第一获取单元 34包括保留子单元 42和填充子单元 44, 下面对该第一获取模块 24进行说明。 保留子单元 42, 设置为保留第一生成矩阵的单位矩阵中与原数据对应列的列数 据; 填充子单元 44, 连接至上述保留子单元 42, 设置为在上述第一生成矩阵的单位矩 阵的校验列中填充校验数据。 图 5是根据本发明实施例的解码处理装置中第一获取模块 24中第二获取单元 36 的优选结构框图, 如图 5所示, 该第二获取单元 36包括提取子单元 52和组成子单元 54, 下面对该第二获取单元 36进行说明。 提取子单元 52, 设置为在第二生成矩阵中提取上述校验数据出现的行与列; 组成 子单元 54,连接至上述提取子单元 52, 设置为将提取的上述校验数据出现的行与列组 成丢失的原始数据对应的小生成矩阵。 图 6是根据本发明实施例的解码处理装置的优选结构框图一, 如图 6所示, 该装 置除包括图 2中的所有模块外, 还包括第一判断模块 62、 第三获取模块 64和 /或第一 写入模块 66, 下面对该装置进行说明。 第一判断模块 62,连接至上述第二获取模块 24, 设置为根据小生成矩阵包含的校 验数据和对应丢失的原始数据之间的关系, 判断对应的小生成矩阵逆矩阵文件是否存 在; 第三获取模块 64, 连接至上述判断模块 62, 设置为在判断结果为是的情况下, 通 过读取小生成矩阵逆矩阵文件获取小生成矩阵的逆矩阵; 和 /或, 第一写入模块 66, 连 接至上述第三获取模块 64, 设置为在判断结果为否的情况下, 计算小生成矩阵的逆矩 阵, 并把小生成矩阵的逆矩阵写入到小生成矩阵逆矩阵文件。 图 7是根据本发明实施例的解码处理装置的优选结构框图二, 如图 7所示, 该装 置除包括图 6中的所有模块外, 还包括第一建立模块 72, 下面对该第一建立模块 72 进行说明。 第一建立模块 72, 设置为建立小生成矩阵的逆矩阵中的各个元素与伽罗瓦域中的 0到 65535构成的逆矩阵伽罗瓦域数组。 在本实施例中还提供了一种编解码系统, 图 8是根据本发明实施例的编解码系统 的结构框图, 如图 8所示, 该系统除包括上述任一项所述的解码处理装置外, 还包括 一编码装置, 其中, 该编码装置包括: 第二建立模块 82, 设置为建立由第一生成矩阵 中除单位矩阵外的各个元素与伽罗瓦域中的 0到 65535构成的生成矩阵伽罗瓦域数组; 第二判断模块 84,连接至上述建立模块 82, 设置为判断生成矩阵伽罗瓦域数组中是否 存在第一生成矩阵中除单位矩阵外的各个元素与伽罗瓦域中的 0到 65535的乘法操作 结果; 读取模块 86, 连接至上述第二判断模块 84, 设置为在判断模块的判断结果为是 的情况下, 读取生成矩阵伽罗瓦域数组中所存储的乘法操作结果。 上述实施例及优选实施方式所提出的在文件存储或数据通讯时, 基于 RS纠删码 体制下快速编码和快速解码的方法, 该方法可以通过软件实现, 有效地提升编码和解 码速度, 并且求逆矩阵、 文件编码, 以及文件解码的运算量都和分片数目 m无关, 只 和编码、 解码时使用的校验分片数 n有关。 在该方法中, 通过使用待解码数据的规格 化处理, 可以用来生成 RS纠删码体制下等效的较小生成矩阵 Gl, 该生成矩阵大小为 n*n, 可以远远小于原来的 m*m的生成矩阵 G, 因此可以快速计算它的逆矩阵, 并用 于快速解码。 另外, 将所有伽罗瓦域乘法由双表法改为查内存法, 且内存消耗很小, 可以应用于现有的计算机系统中。 采用上述实施例及优选实施方式所提出的快速编解 码方法, 可以在里德-所罗门 (m+n, m)纠删码体制下, 有效地提高 m值, 从而提高存 储空间利用率, 或者降低校验数据比例, 在数据通讯时提高通讯速度。 例如, 在 n=6, 并且解码时使用全部 6块校验分片的情况下,支持 m高达 64到 128,相应的编码率达 到 91.4%和 95.5%, 且 m, n可在满足 RS纠删码条件限制和计算机运算能力限制的条 件下任意设置。由于求逆矩阵、文件编解码均和分片数量 m无关,因此 m无上限约束, 只要保证 m+n小于 2 或 2^16伽罗瓦域计算限制即可。本发明对生成矩阵没有限制, 范德蒙矩阵和柯西矩阵均可适用, 任何别的符合 RS纠删码体制的生成矩阵也可适用, 但使用柯西矩阵可以减少内存使用,获得更佳效果。 通过上述实施例及优选实施方式, 极大地改善了 RS纠删码体制下的生成矩阵求 逆矩阵和编解码性能, 不仅在理论上有突破, 而且具有较大的实用价值, 适用于云存 储和数据通讯领域中使用 RS纠删码的体系中。 在本实施例中所提供的快速编码解码方法, 在保持使用 RS纠删码技术原理的情 况下, 由数据快速编码和数据快速解码两种方法组成。 这两种方法既相互独立, 又有 联系。 它们可以单独使用或者联合使用, 分别用于数据快速编码和数据快速解码。 数据快速解码方法与相关技术中的数据解码存在较大差异, 该数据快速解码方法 大致包含以下处理: (1 ) 将待解码数据规格化, 并通过文件缓存逆矩阵数据; (2) 快 速求解生成矩阵的等效小矩阵的逆矩阵; (3 ) 解码并替换校验数据。 需要说明的是, 上述所采用上述快速编解码方法, 对生成矩阵没有限制, 范德蒙 矩阵、 柯西矩阵或者别的生成矩阵均可适用, 并不对此进行限定, 但使用柯西矩阵可 获得更佳效果。 在本实施例中以生成矩阵为柯西矩阵为例进行说明。 对于给定的 m, n参数, 系统生成矩阵 G使用柯西矩阵,例如, m=5, n=3, BP(8,5) 纠删码,生成矩阵 G为单位阵 I和柯西矩阵 Q的组合。如下显示,共使用 3列校验矩阵, Ρ 表示柯西矩阵中除单位矩阵外的第 i列数据的第 j行元素。
Figure imgf000013_0001
如果输入数据为包含 m个元素的 D, 用矩阵表示为 D=[Di, D2, .Dm], 使用 P 表示校验数据, 用矩阵表示为 [P^P^P , 则 RS编码方式为:
D * [I, Q] = [D, P], 或者: [D D2, ....Dm]*G=[ Di, D2, ...Dm, Pi,P2...Pn] 下面分别针对快速编码和快速解码方法进行说明。 1、 快速编码方法: 系统预先准备好伽罗瓦域 G(2 6)中所有乘法 X*Y数据,其中 X, Υ从 0到 65535。 这些数据大小是 65536*65536*2=8GB, 存放在文件 Galois.dat中。 实际使用时为读取 方便, 这些数据可放在若干文件中, 在逻辑上组成单个 Galois.dat文件。 由于 m, n确定后, 生成矩阵 G也就确定, 按照其中柯西矩阵 G的列元素对这些 数据进行递增计数, 共计 m*n个元素, 编号从 0到 m*n-l。 为 m*n个元素建立编码二 维数组 Code[][], 对每个元素 Ρ 计算其在伽罗瓦域中对 0到 65535的乘法操作结果, 预先保存在文件中, 文件名与!^ η相关。 编码时的生成矩阵和具体要编码的文件无 关, 只和 m, n有关, 因此可以预先生成好特定参数下的生成矩阵伽罗瓦域缓存文件。 这样, 系统初始化时, 首先读取相应的生成矩阵伽罗瓦域缓存文件。 如果该文件不存 在, 则将需要的数组元素计算出来并写入文件中, 以便以后读取。 计算某个元素 Ρ 在伽罗瓦域的全部乘法结果, 就是在 Galois.dat中适当位置 (Ρ *65536*2字节处) 读 取连续 65536个字, 共计 128K字节。 下表 1为生成矩阵伽罗瓦域数组 Code[m*n][65536]组成示意。 Code[i][k]中第一维 度所有元素 i均为生成矩阵 G中出现的元素编号, 第二维度元素 k从 0到 63335, Code[i][k]存放 G中元素 Ρ 与 k的伽罗瓦域乘法结果。 根据生成矩阵算法获得生成矩 阵中所有元素后, 当需要计算 乘以 Ρ 时, 只需要找到 Ρ 的编号 χ, 然后返回数组 Code [χ]^]的值即可。 只需要 1次操作, 比原来伽罗瓦域乘法的 5次操作节约 4次。 表 1
Figure imgf000014_0001
对于 RS编码, 每次需要保存原数据时, 都要额外保存 n个效验块, 每个效验块 数据计算时需要 m次伽罗瓦域乘法和 m-1次加法。由于 1次伽罗瓦域乘法等于 5次基 本操作, 因此, 每个效验块数据计算量大约 6m。 总计算量为 6mn。采用上述实施例的 快速编码方法后, 使用查数组法代替伽罗瓦域乘法, 一次伽罗瓦域乘法只需要 1次查 数组的内存操作, 因此, 每个效验块数据计算量大约 2m, 总计算量为 2mn, 比原来减 少 2/3的操作量, 编码速度提高两倍。 使用的 Code数组大小为 m*n* 128KB。 典型的, m=64, n=10时, Code数组大小为 81.92M字节。 对于长度为 L的文件, 每次取 m个字(两字节)进行编码。 按字编码而不是按字 节编码, 是因为在伽罗瓦域 G(2 6)中计算, 且按字编解码适应计算机系统本身的字 长, 可提高编解码速度。 如果 L不是 m整数倍数, 则最后补 0补齐到 m的倍数。 因此, 需要循环计算 L/m 次, 原计算量为 6Ln, 改进后计算量为 2Ln。 文件总的编码计算量和分片数 m无关, 只和校验块 n和文件长度 L有关。 因此, 提高 m数量不会造成文件编码速度下降。 相 反由于提高分片 m数量后,额外生成和写入磁盘的校验数据大小占原文件的比例下降, 因此编码性能反而提高。 下表 2是 Dell E6420笔记本下的编码测试结果, 单位为秒: 表 2
Figure imgf000015_0001
可以看出, 相同大小文件的编码, 校验分片相同时, 随着 m的增大, 编码速度反 而加快。 由于柯西生成矩阵的性质, 可以通过适当的参数设置, 使得在生成矩阵中的 m*n 个元素,只出现 m+n-1个不同的元素,这样可以将 Code数组大小,从 Code[m*n][65536] 变为 Code[m+n-l][65536], 即大约是原来的 l/n。 2、 快速解码方法: 本实施例所提供的快速解码方法包含以下步骤: (1 ) 将待解码数据规格化, 并计 算该情况下的待解码数据 D"和对应的小生成矩阵 G , 通过文件读取 '的逆矩阵数 据。 (2) 如果逆矩阵文件不存在, 则计算该小生成矩阵的逆矩阵, 并把逆矩阵数据写 入文件。 (3 ) 快速解码校验数据。 下面对上述步骤进行说明。
( 1 ): 将待解码数据规格化, 并计算该情况下的待解码数据 D"和对应的小生成矩 阵 '文件名, 通过文件读取 '的逆矩阵数据。 对于一个给定了包含 m个分块的待解码数据 D', 用矩阵表示为 [D . . .Dj,Px..Py], 将待解码数据按如下方法进行规格化, 生成唯一的排列。 其方法是: 对于待解码数据 D'= [D,, . . .Dj,Px..Py], 对于其中的原文件数据 Ι , 使之位于 D' 中第 i位, 即它原来出现的位置。 对于 D'中剩余的位置, 使用多个校验块 P数据, 从 左到右 (即按照原来校验块的顺序) 对 D'进行顺序填充。 例如, m=5, n=3 , 使用待 解码数据块 D2, D5和 PL P2, P3, 则规格化后的 D'^P D2, P2, P3, D5]。 这种规 格化数据, 是使用原数据块和校验数据块组合按此规则的唯一排列。 计算待解码数据 D"的原理是:
Figure imgf000016_0001
其中, Dl D3, D4是未知数据, Pl P2
D1P11+D3P13+D4P14 = Pi - D2Pi2-D5Pi5=Pi'
DiP2i+D3P23+D4P24 = P2 - D2P22-D5P25=P2'
D1P31+D3P33+D4P34 = P3 - D2P32-D5P35=P3' 即:
Figure imgf000016_0002
作为一般情况下的通用公式: P1' = P1®†jDj*Pi] , j=l..m。
J=l 其中, 表示解码时使用的校验数据, Dj和 Ρ 表示输入数据和生成矩阵 G中的校 验数据那一列。 如果第 j个位置不是原数据 Α而是校验数据 Ρχ, 则计算乘法时把它略 过。 ®表示是异或操作。 在伽罗瓦域中, 加减都是异或操作。 小生成矩阵 是原生成矩阵 G中的 n*n个数据。 n为使用的校验块数量。 如果 S={1, 3, 4}是校验块出现的位置, 则生成矩阵中的 Ρ 组成小生成矩阵 Gi, i, jes。 表 3示意了小生成矩阵的生成, 如下表所示: 那些生成矩阵中, 校验数据出现的 行、 列组成的数据, 组成小生成矩阵 Glt) P1'=P1©D2*Pl2©D5*Pl5o 最终的小生成矩 阵 G1如表 4所示。 表 3
Pi D2 P2 P3 D5
Figure imgf000017_0001
表 4:
Figure imgf000017_0002
只要记录分片 m数和各个校验数据出现位置和编号, 即可构成唯一的文件名。 校 验数据出现位置 (表 3中斜体加粗显示) 就是丢失的原数据分块的编号。 获得了小生成矩阵 G1 的逆矩阵文件名后, 读取该文件。 如果该文件存在, 读取 该文件内容到逆矩阵 '中, 直接完成逆矩阵的计算工作, 进入到步骤 (3 )。 如果该 文件不存在, 则做标志, 等步骤(2)完成, 生成了逆矩阵后, 再将逆矩阵数据写入该 文件中。 也可以预先计算好若干典型排列对应的逆矩阵文件, 保存在存储系统中, 以 供系统遇到后直接使用。 步骤 (2): 计算逆矩阵 对于上面举例的, 上述实施例所使用的规格化排列例子 [D^^P^P^Ds] , 获得了 小生成矩阵 , 但没有对应的缓存文件, 则使用常规的计算逆矩阵方法, 获得小生成 矩阵 的逆矩阵 计算方阵逆矩阵的常用算法有高斯-若当消元法和伴随矩阵法。 对于高斯-若当消元法, 计算方阵 m的逆矩阵计算量为 0(m )。 由于现在生成矩 阵大小下降为 n*n个元素, 计算量下降为 0(ι Λ3)。 相关原理和具体实现早已被研究清 楚, 在此不再赘述。 上述实施例的优点是, 可将生成矩阵从 m*m降低为等效的 η*η, 在使用的校验分片 η小于原分片 m时, 可以大大减少计算逆矩阵的工作量。 只有在使 用校验分片 n=m时, 才和原来计算量相等。 使用伴随矩阵法求逆矩阵, 计算量高于高斯-若当消元法。无论采用何种求逆矩阵 方法, 求出逆矩阵后, 都将逆矩阵数据写入规格化列对应的小逆矩阵 D'所对应的文件 中。 以后遇到使用相同的原数据块和校验块组合, 即可直接从文件中读出和生成逆矩 阵。 一个逆矩阵文件包含 n*n*2字节, 对于 n=6, 逆矩阵文件大小为 72字节, 在当前 计算机处理能力下, 读取文件时间小到可以忽略不计。 因此, 采用逆矩阵数据缓存机 制后, 只有第一次遇到此规格化数据排列时, 需要计算逆矩阵, 以后就不再需要计算。 由于逆矩阵数据取决于损坏的数据位置和使用的校验分片排列, 因此逆矩阵数据和实 际使用情况有关, 在 m, n较大情况下不可能预先全部计算出来, 因此采用本发明实 施例及优选实施方式的机制, 在第一次遇到时计算和保存逆矩阵数据。 由于采用了规 格化方法, 可以唯一确定数据块损坏位置和使用的校验分片编号, 因此, 以后遇到相 同情况的组合, 就可以通过读取逆矩阵文件的方式获得逆矩阵。随着系统的不断运行, 会生成和保存越来越多组合下的逆矩阵数据, 系统性能也就越来越好。 采用上述实施例及优选实施方式所提供的方法, 由于计算逆矩阵工作量比原来缩 小很多, 因此, 实际编码时可以有效增加校验分块数量 n的值。 计算出解码数据后, 将这些元素按列从 0进行编号。 逆矩阵的 n*n个元素, 对应 编号为 0到 n*n-l。 建立解码数组 Decode[n*n][65536], 存放逆矩阵所有元素对伽罗瓦 域的乘法数据。从伽罗瓦域全量文件 Galois.dat中读取这些逆矩阵元素对应的伽罗瓦域 乘法结果。每个元素 Χ对应的伽罗瓦域乘法结果有 128K,位于 Galois.dat从 x*65536*2 字节开始处。 Decode矩阵大小为 n*n*128k。 如果解码最多支持 10 个校验分片, 则 Decode矩阵大小为 12.8M字节。由于解逆矩阵消耗时间很多而需要保存的字节数很少, 逆矩阵伽罗瓦域乘法数组数据量很大而生成时间很少, 因此, 不用保存逆矩阵伽罗瓦 域乘法结果, 只需要保存逆矩阵数据即可。 步骤 (3 ), 快速解码校验数据 对于本发明实施例中所采用的解码体制, 只需要恢复 k个校验块数据, 其余均为 原数据, 且位置也相同。 例如, 例子中使用了 3个效验块数据 Pi, P2, P3, 则解码时, 剩余 D2, D5都可直 接使用, 且在原数据 D中位置也相同。 而 Di, D3, D4根据前面的数据准备和逆矩阵 乘法计算而来。 解码时, 使用 Decode矩阵进行伽罗瓦域乘法。 例如, 要计算 '值与 逆矩阵 Χ 的乘法时, 首先查出 '的编号 χ, 然后返回 DeCOde[x][ Ρ ] 。 解码计算量 为 0(mk), 比原来的 0(ιηΛ2), 下降为原来的 k/m。 按一个伽罗瓦域等于 5个基本操作 计算, 原解码计算量总计为 6mm。 使用 k个校验块 (k<=n)时, 解码计算量为 0(mk), 比原来的 0(ιηΛ2), 下降为原来 的 k/m。 按一个伽罗瓦域等于 5个基本操作计算, 原解码计算量总计为 6mm; 使用本 发明的解码方法,伽罗瓦域乘法全部变为查内存方式,计算量下降为 2mk。当 m>k时, 解码速度提高 3m/k倍。 快速解码校验数据, 具体包括如下步骤:
1 ) 数据准备阶段 如果解码时使用 k个校验数据, 则需要计算 k个数据, 每个数据需要计算 m-k个 伽罗瓦域乘法和 m-k个异或加法。 由于每个伽罗瓦域乘法是 Dj乘以 Ρ, 而 Ρ 是生成 矩阵元素, 因此, 可以利用前述快速编码方法中的"生成矩阵伽罗瓦域数组 Code", 将 乘法操作改为直接查数组操作, 当计算 Dj乘以 Ρ 时, 只需要找到 Ρ 的编号 χ, 然后 返回数组 Code[X][Dj]的值即可。 只需要 1次操作, 加上异或加法, 数据准备阶段共需 要 2(m-k)k操作。 2) 解码阶段 解码阶段是 k个 IV乘以 的逆矩阵 Gi', 该矩阵大小为 k*k。 由于计算时直接使 用查 DeCOde[][]数组方式, 加上异或的加法运算, 需要 2kk个操作。 因此解码总计需 要 2(m-k)k+2kk=2mk操作, 计算量和编码相同。 显然, 和以前的 2mm操作相比, 本 发明实施例在使用的校验块 k小于数据分片 m时, 总操作数量大大减少。 即使和改进 型的解码 6mk计算量相比, 本发明实施例由于利用了编码缓存矩阵 Code[][]和解码缓 存矩阵 Decode[][], 也可减少 2/3的计算量。 对于长度为 L的文件,每次取 m个字进行解码。共需要循环 L/m次,总计算量为: 0(mk)*L/m = O(Lk), 具体而言是略大于 2Lk。 因此, 采用本发明实施例的快速解码方法, 总计算量只和文件长度和使用的冗余 块 k (k<=n) 有关, 和分片 m无关。 逆矩阵计算时, 也只和使用的冗余分片 k有关, 和 m无关。 因此, 提高分片数 m值不会影响解码速度。 相反,由于 m增大后校验数据占原文件的比例下降,因此解码性能反而略有提高。 在支持 10个校验分片的情况下, 解码时需要使用 12.8M字节内存存放 Decode矩阵数 据, 在 m=64的情况下, 需要 81.92M字节内存存放 Code矩阵数据。 如果生成矩阵只 出现 m+n-l=73个不同元素, 则需要 73*128K=9.344M字节存放 Code编码数组数据。 下表 5为不同参数设置下的编解码所需内存数据以及编解码时校验数据占总文件 的比例。 Code数组按照 m+n-1个不同元素计算。 可以看出, 在 10个校验分片的情况 下, 在分片数量不超过 128时, 最多只需要 30.336M的内存, 即可将编解码时遇到的 所有伽罗瓦域乘法数据全部加载到内存, 并不需要 8G内存。
表 5
Figure imgf000021_0001
编码时, 需要将校验数据写入文件。 解码时, 需要将校验数据恢复为原来数据写 入文件。 因此, 校验数据在编解码时的比例越低越好。 从上表可以看出, 在校验分片 n不变的情况下, m越大, 编码、 解码时校验数据占的比例就越低, 需要额外写入文 件的编码数据和解码数据就越少。 因此虽然编解码时 RS纠删码计算量和 m无关, 只 和校验块数有关, 但 m越大, 额外写入磁盘的数据比例就越少, 编码、 解码性能也就 越好。 综上所述, 本发明实施例所提供的 RS纠删码体制下快速编码和快速解码的方法, 可以通过软件实现, 有效地提升编码和解码速度, 并且矩阵求逆和文件的编解码速度 都和 m无关, 只和编码、 解码时使用的校验分片数 n有关。 通过使用待解码数据的规 格化方法, 可以用来快速计算 RS纠删码体制下的等效小生成矩阵的逆矩阵, 以及快 速解码。 将逆矩阵计算量从以前的 0 ( m ) 降低为 0(ι Λ3)。 通过使用很少的内存, 将伽罗瓦乘法数据放入内存, 计算伽罗瓦域乘法时, 使用查内存数组的方法取代以前 的双表法, 进一步提高了编解码速度。 使用本发明实施例提出的快速编解码方法, 可以在里德-所罗门 (m+n, m)纠删码 体制下, 有效地提高编解码速度和 m值, 从而提高存储空间利用率, 或者降低校验数 据在总数据中的比例, 并且在数据通讯时提高通讯速度。 在 n=6, 并且解码时使用全 部 6块校验分片的情况下,支持 m高达 64到 128,相应的编码率达到 91.4%和 95.5%, 且 m, n可在满足 RS纠删码条件限制和计算机运算能力限制的条件下任意设置。本发 明对生成矩阵没有限制, 范德蒙矩阵、 柯西矩阵或者别的生成矩阵均可适用。 但使用 柯西矩阵时, 可以通过设置参数, 减少生成矩阵乘法数组 Code 的大小, 从而降低内 存消耗, 获得更优的效果。 在本实施例中提供了一种基于 RS纠删码的快速编解码的方法, 其中, 包括对数 据的编码及解码, 下面详细说明。 在说明对数据的编码与解码之前, 首先对快速编码中的柯西生成矩阵进行说明。
Figure imgf000022_0001
+) A) + ¾) ...
G=| ++) ΙΛ))
Figure imgf000022_0002
++ V¾i)) ......
1/( 5 +yi) 1/( 5 + ¾) 1/( 5 + ¾) ... 1/( 5 + )
Figure imgf000022_0003
1 1/2 1/3 ... \ln
1/2 1/3 1/4 ... l/(w+l)
1/3 1/4 1/5 … l/(w+2)
1/4 1/5 1/6 ... \/(n+3)
1/5 1/6 1/7 ... l/(w+4)
\lm l/(m+l) l/(m+2) ... l/(m+w-l) 由公开的数学知识可知, 生成矩阵除去单位方阵 I后的柯西生成矩阵如上述矩阵
G的上半部分所示, 矩阵元素 Ρ =1/(Χι+ )。 根据公开知识, 柯西矩阵元素限制为: 对于 X={xi,x2,...xm}, Y={yi,y2,...yn},
1) 对任意 i和 j, 有 Xi+yj!=0;
2) 对 X中任意两个元素 XlXj, 有 i!=j 时, Xl!=Xj
3) 对 Y中任意两个元素 yi, yj, 有 i!=j 时, yi!=yj 因此, 选 Xl=i, yrj-1 , 其中 i从 l ... m, j从 l ..n, 获得柯西矩阵上述矩阵 G的下 半部分。 这样, 该柯西生成矩阵中只出现 m+n-1个不同元素。 将这些元素转化为伽罗 瓦域对应元素, 并按列进行编号, 从 0到 m+n-2。 这样可以确定, 每列第一个元素 Ρ 对应的数组编号为 j-l, 该列其它元素对应的数组编号递增。 下表 6为改进后的伽罗瓦域生成矩阵缓存数据 Code[m+n-l][65536]示例。
表 6
Figure imgf000023_0002
对于 m=64, n=10, Code数组大小为 (m+n-1)* 128k=9.344M字节。 对于现有的计 算机系统, 可全部加载进内存。 在获得柯西生成矩阵之后, 通过以下步骤对数据进行编码操作:
Sl, 对需要编码的数据进行编码: 对于 RS纠删码中, 确定了分片数目 m和校验 数据 n后, 即可通过范德蒙德矩阵或者柯西矩阵, 通过计算获得生成矩阵0。 在本实 施例中以 m=5, n=3为例。
Z)* G = [£»!, Z)2,Z)3,Z)4,Z)5] - [D D2,D„D4,D5,P P2,P,]
Figure imgf000023_0001
其中, 输入待编码数据用 D^D^D^D^D Ds]表示, 使用的生成矩阵 G, 左边是单 位阵 I, 右边是包含三列的 3 *5 矩阵。 经过编码运算, 产生的编码数据为 [D1,D2,D3,D4,D5,P1,P2,P3], 其中前 5个为原数据分片, 后 3个为冗余分片。 在数据接收方, 对数据进行解码: 在本发明实施例"基于 RS纠删码的快速编解码 方法"中, 在快速解码时, 对待解码数据进行格式化处理: 即当需要解码时, 首先要任 给 5个分片, 用 D'表示, 例如 D'=[D2, D5, P I , P2, P3]。 然后采用本发明的规格化 方法, 对 D'进行规格化, 其方法是: 将原数据分片 Di归位, 放回原始位置。 然后对 剩余缺位使用校验块数据按顺序填入。 例如, 在本实施例中: 通过以下处理获得规格 化以后的 D'=[P1,D2,P2,P3,D5]。 格式化输入
解码给定 D' =[D2,D5,Pi,P2,P3 D, =[P1,D2,P2,P3,D:
S2, 根据规格化的 D', 计算此情况下的生成矩阵 G。 方法是将单位矩阵 I中使用 校验数据的那些列数据, 用原生成矩阵中对应的校验列数据填入。 生成矩阵 G的特点 是: 那些使用了原有数据块的列 x, 还是单位阵中对应的列 x, 该列第 X个元素为 1, 其余为 0。 例如, 在本实施例中:
D *G = [Dx,D2,D ,D4,Dt
Figure imgf000024_0001
在获得生成矩阵 G后, 可以计算新的待解码数据 ΙΤ^ΡΛ Ρ2', Ρ3']。 计算公式如
^ ' = ^ ®∑Z) *^ , 其中, 当 D'中第 i位是原数据时使用 1^, 否则略过。
=1 其中 表示解码时使用的校验数据, Dj和 Ρ 表示输入数据和生成矩阵 G中的校 验数据那一列。 如果第 j个位置不是原数据而是校验数据, 则计算时把它略过。 在计 算 Ι¾*Ρ 时, 可以使用快速编码方法中的 "生成矩阵伽罗瓦域数组 Code" , 通过查数组 方式取代伽罗瓦域乘法操作, 以便提高效率。 之后, 计算等效的小生成矩阵 Gl t) 方法如下:
Figure imgf000025_0001
其中, P P DiP^DsP , P2'=P2-D2P22-D5P25, P3'=P3-D2P32-D5P35, 由此获得新的待解码数据 D'^P , Ρ2', Ρ3'], 以及小生成矩阵
P3 小生成矩阵 是原生成矩阵 G中的 n*n列。 n为使用的校验块
Figure imgf000025_0002
:。 如果 S={ 1, 3, 4}是校验块出现的位置, 则生成矩阵中的 Ρ 组成小生成矩阵
Gi , i, je s0 即在生成矩阵中, 校验数据出现的行、 列组成的数据, 组成小生成矩阵 该矩阵在使用 k个校验数据的情况下是 k*k的。
(3 ) 计算 逆矩阵, 解码获得丢失的原数据 采用常规的求逆矩阵法计算 矩阵的逆矩阵 G1'之后, 获得逆矩阵数据后, 从伽 罗瓦域文件 Galois.dat中逐个读取逆矩阵元素对应的伽罗瓦域乘法数据, 放入"逆矩阵 伽罗瓦域数组 Decode"中。 使用 ΙΤ^Ρ ,Ρ^Ρ^]乘以逆矩阵 G , 即通过以下公式即可 获得丢失的原始数据 1^ D3, D4:
[P'l, P'2, P'3] = [Di, D DA],
Figure imgf000025_0003
并且, 解码时只需要计算 k个数据。 随后, 将丢失的原始数据取代原有输入数据 中的 Pi, P2, P3, 即可获得全部原始数据, 解码成功。 对输入待解码数据的进行规格化处理, 是本发明实施例"基于 RS纠删码的快速编 解码方法"的核心思想。 在以往的 RS纠删码解码算法中, 其待解码数据一般是按照先 原数据, 后校验数据方式排列, 即 D'^Di, D2, D5, Pi, P3]。 这样在计算逆矩阵、 解 码时原数据 位置不固定, 造成逆矩阵中对应的单位矩阵列、解码后原数据位置不固 定, 因此计算逆矩阵时无法确定究竟需要计算哪些列, 只能按照 m*m矩阵来看待; 在 解码时, 原数据 需要进行复制或者交换, 才能回到原有位置上, 造成大量判断和复 制工作, 因此, 无论是计算逆矩阵还是解码效率都不高。 此外这种方式无法直观的看 出丢失的原数据和使用的校验数据之间的对应关系, 因此无法确定唯一排列关系, 也 就无法使用文件缓存逆矩阵数据。 采用本发明实施例的输入待解码数据的规格化方法后, 可以获得以下至少四方面 的好处: 首先, 可以通过记录校验数据位置和编号, 快速唯一确定该排列对应的小生 成矩阵 及其逆矩阵文件名称, 并读取逆矩阵文件内容, 直接生成逆矩阵 通过 文件缓存方式, 在遇到重复情况下避免了矩阵计算, 提高了性能。 其次, 逆矩阵不存 在时, 可以根据 快速计算逆矩阵 '。 由于该矩阵只有 k*k大小, k<m时小于原来 的生成矩阵 m*m, 因此显著降低了逆矩阵计算量, 从 O(m )降低为 0(k )。 获得逆 矩阵后, 将所有逆矩阵元素乘法数据放入 DeCOde[][]数组。 再次, 在解码计算时, 只 需要计算 k个校验数据即可, 剩余 m-k个数据可直接使用原来位置上的数据, 提高了 解码效率。 并且数据准备时, 可以使用生成矩阵缓存的伽罗瓦域乘法数组, 从而更进 一步地提高了解码效率, 最后, 无论编码、 解码, 伽罗瓦域所有乘法操作都被放入内 存, 采用查内存数组的方式取代以前的双表法, 进一步提高了编解码速度。 需要说明的是, 本发明实施例所使用的待解码数据的格式化表示, 和生成矩阵算 法无关, 无论是范德蒙德矩阵、 柯西矩阵或别的生成矩阵皆可使用。 本发明实施例及 优选实施方式将生成矩阵由 m阶方阵降为等效的 k阶方阵后,再计算小矩阵的逆矩阵, 和计算逆矩阵的算法也无关, 无论是高斯消元法还是伴随矩阵法, 使用本发明实施例 的编解码方法, 均可提高计算逆矩阵的速度。 由于柯西矩阵的特性, 可以通过参数设 置, 将柯西矩阵中不同元素的个数从 m*n降低为 m+n-l , 从而可以减少 Code数组的 内存占用大小。 因此本发明中, 生成矩阵采用柯西矩阵可减少内存占用。 下面结合附图, 对本发明实施例进行说明。 图 9是根据本发明实施例的基于 RS纠删码的文件快速编码方法的流程图,如图 9 所示, 该方法包括如下步骤: 步骤 S902, 系统预先准备好 8G伽罗瓦域乘法数据文件 Galois.dat, 这些数据是伽 罗瓦域中的所有乘法 X*Y的结果, X, Υ从 0到 65535, 乘法结果也是 2字节, 共计 64k*64k*2=8GB。 第 i个元素的全部伽罗瓦域乘法数据放在文件的 i* 128k开始处, 连 续 128k字节。 为方便读取, 可以将这些数据保存在若干文件中, 在逻辑上构成统一的 8G伽罗瓦域乘法数据文件。 根据给定的 m, n值初始化编码器, 根据系统生成矩阵算法, 计算生成矩阵, 根 据 m, n值分配伽罗瓦域乘法二维数组 Code[m*n][65536]使用空间。 Code数组共需要分配 m*n*128k字节的内存。它是 m*n*64k的二维数组, 数组中 每个元素是 0到 65535之间, 对应计算机系统的一个字长度, 或者两个字节。 如果生成矩阵使用柯西矩阵, 则 Code大小可为 (m+n-1) *128k字节。 步骤 S904, 根据 m, n生成伽罗瓦域乘法缓存文件名称, 判断该文件是否存在。 如果存在转步骤 S908,。 如果不存在, 则继续步骤 S906。 较优地, 系统可以预先准备 若干典型 m, n配置下的伽罗瓦域乘法缓存文件, 以便导入到 Code数组中。 步骤 S906, 伽罗瓦域乘法缓存文件不存在, 对生成矩阵中除单位阵以外的那些列 数据, 总计 m*n个元素递增编号, 计算每个元素对 0到 65535的伽罗瓦域乘法结果, 保存在 Code中, 对元素 x, 也可以从 Galois.dat中第 X* 128k处, 读取该元素的乘法结 果, 共计 128K字节, 导入 Code数组中, 进行步骤 S910。 步骤 S908, 伽罗瓦域乘法缓存文件存在, 直接读取该文件内容到 Code中, 进入 步骤 S912。 步骤 S910, 将 Code数组内容写入到 m, n对应的伽罗瓦域乘法缓存文件, 进入 步骤 S912。 步骤 S912, 完成编码准备任务后, 打开待编码文件?。 步骤 S914, 从文件中顺序读入 m个数据: 读入 m个字, 2m个字节。 如果读入的数据不足 m个, 则说明到了文件末尾, 补若干 0后补齐到 m的倍数。 在读取成功的情况下, 进入步骤 S916, 否则进入步骤 S920。 步骤 S916, 读取成功时, 对输入数据 D进行 RS编码。其中, 前 m个数据直接返 回原数据。后 n个数据需要计算。每个数据需要 m次伽罗瓦域乘法操作和 m-1次加法 (异或) 操作。 其中, 伽罗瓦域乘法采用查 Code数组方法以提高效率, 其方法是, 对于 Ι *Ρ 的伽罗瓦域乘法, 首先确定 Ρ 的编号 χ, 然后返回 CodetxlPi]元素。 只需 要两次操作, 而原来伽罗瓦域乘法需要 5次操作。 步骤 S918, 将编码后的 m个原数据和 n个校验数据均分别写入 m+n个分块文件 中。 返回步骤 S914, 继续读取文件下 m个数据。 步骤 S920, 读取文件失败, 说明文件已经编码完毕。 关闭待编码文件 F和 m+n 个分块文件, 结束编码。 需要指出的是, 上述图 9所示的基于 RS纠删码的文件快速编码流程只是为了说 明本发明实施例所提供的快速编码流程的实现原理。具体实现时还需要提供异常处理、 文件按块处理、 记录文件元数据等功能。 图 10是根据本发明实施例的基于 RS纠删码的文件快速解码方法的流程图, 如图 10所示, 该基于 RS纠删码的文件快速解码方法的流程包括如下步骤: 步骤 S1002, 系统预先准备好 8G伽罗瓦域乘法数据文件 Galois.dat, 根据 m, n 初始化解码器, 计算原生成矩阵0。 由于每个文件采用的 RS纠删码算法中, m, n参数可能不一样, 因此只有在解码 具体文件时, 才能根据该文件的元数据或者分片信息获得 m, n, 初始化解码器, 计算 原生成矩阵。 这样做, 可以使编码功能和解码功能互相独立。 如前所述, 在计算生成矩阵后, 要将生成矩阵伽罗瓦域数组数据, 从文件导入到 Code[][]中。 如果文件不存在, 则需要计算, 也可直接从 Galois.dat文件中读取数据。 步骤 S1004, 根据待解码数据块编号, 对待解码数据进行格式化排列, 产生生成 矩阵 G对应的小生成矩阵 的逆矩阵文件名。 假定待解码数据块中,包含 k个校验数据, 0<k<=n。则小生成矩阵 大小为 k*k。 步骤 S1006, 读取逆矩阵文件。 如果逆矩阵文件存在, 进入步骤 S1008, 否则进 入步骤 S1010。 步骤 S1008, 读取逆矩阵文件内容, 恢复逆矩阵 G , 进入步骤 S1022。 步骤 S1010, 根据生成矩阵和待解码数据的格式化排列, 生成待求逆矩阵的生成 矩阵 G和对应的小生成矩阵 Gl t) 步骤 S1012, 是否使用高斯消元法求 的逆矩阵? 如果是, 进入步骤 S1014, 否 则进入步骤 S1016。 步骤 S1014, 采用高斯消元法计算 的逆矩阵 共需要 0 (k )计算量, 进 入步骤 S1018。 步骤 S1016, 使用伴随矩阵法求逆矩阵 步骤 S1018, 将计算出的逆矩阵 '数据写入该格式化数据对应的小逆矩阵文件 中, 以便下次遇到后直接读取逆矩阵数据。 步骤 S1020,读取逆矩阵 G1'中所有数据的伽罗瓦域乘法数据到 DeCOde[][]数组中。 如果 Decode数组对应的文件存在, 则直接读取, 否则通过对应读取 Galois.dat中相应 数据的方式, 计算 Decode[][]数组。 步骤 S1022, 打开格式化排列对应的 m个分块文件和待恢复文件 F。 步骤 S1024, 分别从 m文件中读取 1个数据, 共计 m个数据。 如果有些分片文件 没有数据, 则补 0, 补齐到 m个数据。 在读取成功的情况下, 进入步骤 S1026, 否则 进入步骤 S1032。 步骤 S1026,将待解码的 m个数据复制到输出区内,然后计算新的待解码数据 D"。 计算公式:
^' = ^®¾Z) *^ , j=l..m, 其中, 表示解密时使用的校验数据, D」和 Ρ 表示 输入数据和生成矩阵 G中的校验数据那一列。如果第 j个位置不是原数据 Dj而是校验 数据 Px, 则计算时把它略过。 ®表示是异或操作。 在计算 Ι *Ρ 时, 使用快速编码方 法中的 Code数组, 通过查数组方式取代伽罗瓦域乘法操作, 以便提高速度。 将 1^个?1 '数据组织成 D", 例如, D^P A^' 步骤 S1028,使用矩阵乘法: D"*Gi',生成 k个丢失的数据。其中乘法使用 Decode 数组直接查找。 解码完毕后逐个替换输出区数据中原来 k个校验码的位置, 即可获得 全部的原数据码。 步骤 S1030, 将输出区内的 m个数据写入到待恢复文件 F中, 返回步骤 S1026。 步骤 S1032, 读文件失败, 表明处理结束。 关闭所有文件, 结束解码。 同样需要说明的是, 图 10所示的基于 RS纠删码的文件快速解码流程只是为了说 明本发明实施例所提供的快速编码流程的实现原理。具体实现时还需要提供异常处理、 文件按块处理、 按文件元数据处理最后多补的零等功能。 显然, 本领域的技术人员应该明白, 上述的本发明的各模块或各步骤可以用通用 的计算装置来实现, 它们可以集中在单个的计算装置上, 或者分布在多个计算装置所 组成的网络上, 可选地, 它们可以用计算装置可执行的程序代码来实现, 从而, 可以 将它们存储在存储装置中由计算装置来执行, 并且在某些情况下, 可以以不同于此处 的顺序执行所示出或描述的步骤, 或者将它们分别制作成各个集成电路模块, 或者将 它们中的多个模块或步骤制作成单个集成电路模块来实现。 这样, 本发明不限制于任 何特定的硬件和软件结合。 以上所述仅为本发明的优选实施例而已, 并不用于限制本发明, 对于本领域的技 术人员来说, 本发明可以有各种更改和变化。 凡在本发明的精神和原则之内, 所作的 任何修改、 等同替换、 改进等, 均应包含在本发明的保护范围之内。

Claims

权 利 要 求 书
1. 一种解码处理方法, 包括:
确定包括部分原数据与校验数据的待解码数据, 其中, 所述校验数据对应 丢失的原数据;
根据所述校验数据以及用于编码的第一生成矩阵, 获取与所述丢失的原数 据对应的小生成矩阵, 以及与所述丢失的原数据对应的新的待解码数据;
根据所述新的待解码数据以及所述小生成矩阵, 获取所述丢失的原数据。
2. 根据权利要求 1所述的方法, 其中, 根据所述校验数据以及用于编码的所述第 一生成矩阵, 获取与所述丢失的原数据对应的小生成矩阵包括:
对所述待解码数据进行规格化处理, 其中, 所述规格化处理包括: 保留所 述部分原数据在所述待解码数据中的位置与所述部分原数据在编码之前的原始 数据中的位置一致, 并将所述校验数据填充到所述待解码数据中的剩余位置; 获取与经过规格化处理之后的待解码数据对应的第二生成矩阵; 根据所述第二生成矩阵以及所述校验数据, 获取与所述丢失的原数据对应 的小生成矩阵。
3. 根据权利要求 2所述的方法, 其中, 获取与经过所述规格化处理之后的待解码 数据对应的所述第二生成矩阵包括:
保留所述第一生成矩阵的单位矩阵中与所述原数据对应列的列数据; 在所述第一生成矩阵的单位矩阵的校验列中填充所述校验数据。
4. 根据权利要求 2所述的方法,其中,根据所述第二生成矩阵以及所述校验数据, 获取与所述丢失的原数据对应的所述小生成矩阵包括:
在所述第二生成矩阵中提取所述校验数据出现的行与列;
将提取的所述校验数据出现的行与列组成所述丢失的原始数据对应的所述 小生成矩阵。
5. 根据权利要求 1至 4中任一项所述的方法, 其中, 在获取与所述丢失的原数据 对应的小生成矩阵之后, 还包括: 根据所述小生成矩阵包含的校验数据和对应丢失的原始数据之间的关系, 判断对应的小生成矩阵逆矩阵文件是否存在;
在判断结果为是的情况下, 通过读取所述小生成矩阵逆矩阵文件获取小生 成矩阵的逆矩阵; 和 /或,
在判断结果为否的情况下, 计算所述小生成矩阵的逆矩阵, 并把所述小生 成矩阵的逆矩阵写入到所述小生成矩阵逆矩阵文件。
6. 根据权利要求 5所述的方法, 其中, 在获取到所述小生成矩阵的逆矩阵后, 还 包括:
建立所述小生成矩阵的逆矩阵中的各个元素与伽罗瓦域中的 0到 65535构 成的逆矩阵伽罗瓦域数组。
7. 根据权利要求 1至 4中任一项所述的方法, 其中, 在根据所述校验数据以及用 于编码的第一生成矩阵, 获取与所述丢失的原数据对应的小生成矩阵之后, 通 过以下公式获取与所述丢失的原数据对应的新的待解码数据:
P1 ' = P1 ®†jDj * Pi] , j=l ..m, 其中, 如果第 j个位置不是原数据 Dj而是校验数据 Px, 则计算乘法时把它 略过, 为所述新的待解码数据, m为编码时输入数据的数量, 为解码时使 用的校验数据, Dj为编码时输入的数据, Ρ 为所述第二生成矩阵中的校验数据 的列, ®为异或操作。
8. 根据权利要求 1至 4中任一项所述的方法, 其中, 在确定包括所述部分原数据 与校验数据的待解码数据之前, 通过以下编码方式得到所述待解码数据: 建立由所述第一生成矩阵中除单位矩阵外的各个元素与伽罗瓦域中的 0到 65535构成的生成矩阵伽罗瓦域数组; 判断是否存在存储所述第一生成矩阵中除单位矩阵外的各个元素与伽罗瓦 域中的 0到 65535的乘法操作结果对应的文件;
在判断为是的情况下, 从所述文件中读取所述生成矩阵伽罗瓦域数组中所 存储的乘法操作结果。
9. 根据权利要求 8所述的方法, 其中, 在判断是否存在存储所述第一生成矩阵除 单位矩阵外的各个元素与伽罗瓦域中的 0到 65535的乘法操作结果对应的文件 之后, 还包括:
在判断为否的情况下, 获取所述第一生成矩阵中除单位矩阵外的各个元素 与伽罗瓦域中的 0到 65535的乘法操作结果;
将获取的所述第一生成矩阵中除单位矩阵外的各个元素与伽罗瓦域中的 0 到 65535的乘法操作结果保存在所述生成矩阵伽罗瓦域数组中。
10. 一种解码处理装置, 包括:
第一确定模块, 设置为确定包括部分原数据与校验数据的待解码数据, 其 中, 所述校验数据对应丢失的原数据;
第一获取模块, 设置为根据所述校验数据以及用于编码的第一生成矩阵, 获取与所述丢失的原数据对应的小生成矩阵, 以及与所述丢失的原数据对应的 新的待解码数据;
第二获取模块, 设置为根据所述新的待解码数据以及所述小生成矩阵, 获 取所述丢失的原数据。
11. 根据权利要求 10所述的装置, 其中, 所述第一获取模块包括:
第一处理单元, 设置为对所述待解码数据进行规格化处理, 其中, 所述规 格化处理包括: 保留所述部分原数据在所述待解码数据中的位置与所述部分原 数据在编码之前的原始数据中的位置一致, 并将所述校验数据填充到所述待解 码数据中的剩余位置;
第一获取单元, 设置为获取与经过规格化处理之后的待解码数据对应的第 二生成矩阵;
第二获取单元, 设置为根据所述第二生成矩阵以及所述校验数据, 获取与 所述丢失的原数据对应的小生成矩阵。
12. 根据权利要求 11所述的装置, 其中, 所述第一获取单元包括:
保留子单元, 设置为保留所述第一生成矩阵的单位矩阵中与所述原数据对 应列的列数据;
填充子单元, 设置为在所述第一生成矩阵的单位矩阵的校验列中填充所述 校验数据。
13. 根据权利要求 11所述的装置, 其中, 所述第二获取单元包括: 提取子单元, 设置为在所述第二生成矩阵中提取所述校验数据出现的行与 列;
组成子单元, 设置为将提取的所述校验数据出现的行与列组成所述丢失的 原始数据对应的所述小生成矩阵。
14. 根据权利要求 10至 13中任一项所述的装置, 其中, 还包括: 第一判断模块, 设置为根据所述小生成矩阵包含的校验数据和对应丢失的 原始数据之间的关系, 判断对应的小生成矩阵逆矩阵文件是否存在;
第三获取模块, 设置为在判断结果为是的情况下, 通过读取所述小生成矩 阵逆矩阵文件获取小生成矩阵的逆矩阵; 和 /或,
第一写入模块, 设置为在判断结果为否的情况下, 计算所述小生成矩阵的 逆矩阵, 并把所述小生成矩阵的逆矩阵写入到所述小生成矩阵逆矩阵文件。
15. 根据权利要求 14所述的装置, 其中, 还包括: 第一建立模块, 设置为建立所述小生成矩阵的逆矩阵中的各个元素与伽罗 瓦域中的 0到 65535构成的逆矩阵伽罗瓦域数组。
16. 一种编解码系统, 包括权利要求 10至 15中任一项所述的装置和编码装置, 其 中, 所述编码装置包括:
第二建立模块, 设置为建立由所述第一生成矩阵中除单位矩阵外的各个元 素与伽罗瓦域中的 0到 65535构成的生成矩阵伽罗瓦域数组;
第二判断模块, 设置为判断是否存在存储所述第一生成矩阵中除单位矩阵 外的各个元素与伽罗瓦域中的 0到 65535的乘法操作结果对应的文件是否存在; 读取模块, 设置为在所述判断模块的判断结果为是的情况下, 从所述文件 中读取所述生成矩阵伽罗瓦域数组中所存储的乘法操作结果。
PCT/CN2013/080772 2012-08-03 2013-08-02 解码处理方法、装置及编解码系统 WO2014019551A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201210275426.9A CN102833040B (zh) 2012-08-03 2012-08-03 解码处理方法、装置及编解码系统
CN201210275426.9 2012-08-03

Publications (1)

Publication Number Publication Date
WO2014019551A1 true WO2014019551A1 (zh) 2014-02-06

Family

ID=47336023

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2013/080772 WO2014019551A1 (zh) 2012-08-03 2013-08-02 解码处理方法、装置及编解码系统

Country Status (2)

Country Link
CN (1) CN102833040B (zh)
WO (1) WO2014019551A1 (zh)

Families Citing this family (22)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102833040B (zh) * 2012-08-03 2016-10-26 南京中兴软件有限责任公司 解码处理方法、装置及编解码系统
CN103309742B (zh) * 2013-07-04 2016-07-06 清华大学 云存储系统数据高效编码方法
CN105007286B (zh) * 2014-04-23 2018-12-28 苏宁易购集团股份有限公司 解码方法和装置及云存储方法和系统
CN105338035B (zh) * 2014-08-07 2018-12-28 苏宁易购集团股份有限公司 基于rs纠删码的安全存储方法和装置
CN105335150B (zh) * 2014-08-13 2019-03-19 苏宁易购集团股份有限公司 纠删码数据的快速编解码方法和系统
CN104393960B (zh) * 2014-12-09 2017-08-11 南京邮电大学 一种基于纠删码的卫星网络星地多路径可靠传输方法
FR3031428A1 (fr) * 2015-01-07 2016-07-08 Orange Systeme de transmission de paquets de donnees selon un protocole d' acces multiple
CN104850468B (zh) * 2015-05-31 2018-04-27 上海交通大学 基于校验矩阵的纠删码解码方法
CN106201764B (zh) 2016-06-29 2019-03-12 北京三快在线科技有限公司 一种数据存储方法和装置、一种数据恢复方法和装置
CN108233946A (zh) * 2016-12-09 2018-06-29 富士通株式会社 极化码的编码装置、方法以及电子设备
CN106909470A (zh) * 2017-01-20 2017-06-30 深圳市中博科创信息技术有限公司 基于纠删码的分布式文件系统存储方法及装置
CN107135264B (zh) * 2017-05-12 2020-09-08 成都优孚达信息技术有限公司 用于嵌入式设备的数据编码方法
CN110244939B (zh) * 2019-05-20 2021-02-09 西安交通大学 一种基于OpenCL的RS码编解码方法
CN110502365B (zh) * 2019-07-11 2024-03-01 平安科技(深圳)有限公司 数据存储及恢复的方法、装置及计算机设备
US11576037B2 (en) * 2019-10-18 2023-02-07 Huawei Technologies Co., Ltd. Issuing offline PKI certificates in distributed V2X network
CN111191478B (zh) * 2019-12-31 2021-08-03 上海移为通信技术股份有限公司 耳标的读码方法及装置
CN111858157B (zh) * 2020-06-12 2023-06-02 苏州浪潮智能科技有限公司 基于纠删码的丢失数据恢复方法、系统、终端及存储介质
CN111858169B (zh) * 2020-07-10 2023-07-25 山东云海国创云计算装备产业创新中心有限公司 一种数据恢复方法、系统及相关组件
CN112181707B (zh) * 2020-08-21 2022-05-17 山东云海国创云计算装备产业创新中心有限公司 分布式存储数据恢复调度方法、系统、设备及存储介质
CN112052114B (zh) * 2020-08-27 2024-05-07 江苏超流信息技术有限公司 数据存储及恢复方法、编解码器及编解码系统
CN117349074A (zh) * 2022-06-29 2024-01-05 中兴通讯股份有限公司 Rs译码硬件实现方法、电子设备及存储介质
CN116560915B (zh) * 2023-07-11 2023-09-19 北京谷数科技股份有限公司 数据恢复方法、装置、电子设备及存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101674152A (zh) * 2008-09-08 2010-03-17 华为技术有限公司 基于前向纠错的数据传输方法、装置及系统
US8127212B2 (en) * 2007-09-26 2012-02-28 Hewlett-Packard Development Company, L.P. System and method for determining the fault-tolerance of an erasure code
CN102546087A (zh) * 2010-12-31 2012-07-04 联芯科技有限公司 一种业务数据的纠删方法、装置及系统
CN102833040A (zh) * 2012-08-03 2012-12-19 中兴通讯股份有限公司 解码处理方法、装置及编解码系统

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8127212B2 (en) * 2007-09-26 2012-02-28 Hewlett-Packard Development Company, L.P. System and method for determining the fault-tolerance of an erasure code
CN101674152A (zh) * 2008-09-08 2010-03-17 华为技术有限公司 基于前向纠错的数据传输方法、装置及系统
CN102546087A (zh) * 2010-12-31 2012-07-04 联芯科技有限公司 一种业务数据的纠删方法、装置及系统
CN102833040A (zh) * 2012-08-03 2012-12-19 中兴通讯股份有限公司 解码处理方法、装置及编解码系统

Also Published As

Publication number Publication date
CN102833040A (zh) 2012-12-19
CN102833040B (zh) 2016-10-26

Similar Documents

Publication Publication Date Title
WO2014019551A1 (zh) 解码处理方法、装置及编解码系统
CN105335150B (zh) 纠删码数据的快速编解码方法和系统
US10680645B2 (en) System and method for data storage, transfer, synchronization, and security using codeword probability estimation
WO2016100767A2 (en) Method for file updating and version control for linear erasure coded and network coded storage
US11385794B2 (en) System and method for data compaction and security using multiple encoding algorithms
US10706018B2 (en) Bandwidth-efficient installation of software on target devices using reference code libraries
CN109792256A (zh) 用于对擦除码的对数据进行编码和解码的装置和相关方法
WO2014019549A1 (zh) 编解码处理方法及装置
US11762557B2 (en) System and method for data compaction and encryption of anonymized datasets
US11928335B2 (en) System and method for data compaction utilizing mismatch probability estimation
WO2015180038A1 (zh) 部分复制码的构建方法、装置及其数据修复的方法
US11733867B2 (en) System and method for multiple pass data compaction utilizing delta encoding
WO2019246527A1 (en) Method and apparatus for improved data recovery in data storage systems
CN107153661A (zh) 一种基于hdfs系统的数据的存储、读取方法及其装置
CN114510368A (zh) 一种基于rs纠删码的编解码加速方法及系统
US20240020006A1 (en) System and method for compaction of floating-point numbers within a dataset
US11782879B2 (en) System and method for secure, fast communications between processors on complex chips
US11741051B2 (en) System and methods for secure storage for data deduplication
CN110780813B (zh) 一种基于二元域上子空间码的分布式存储系统
US11838034B2 (en) System and method for blockchain data compaction
CN112486412A (zh) 一种基于分布式对象存储系统安全的信息分散方法及系统
US20230315288A1 (en) System and method for data compaction and security using multiple encoding algorithms with pre-coding and complexity estimation
CN113162629B (zh) 一种支持多码长多码率共模的多核极化码编码器
WO2011144170A1 (zh) 一种低密度奇偶校验码的译码方法和装置
Yin et al. A New Minimize Matrix Computation Coding Method for Distributed Storage Systems

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 13825719

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 13825719

Country of ref document: EP

Kind code of ref document: A1