CN105790768B - Date storage method and system - Google Patents

Date storage method and system Download PDF

Info

Publication number
CN105790768B
CN105790768B CN201410809119.3A CN201410809119A CN105790768B CN 105790768 B CN105790768 B CN 105790768B CN 201410809119 A CN201410809119 A CN 201410809119A CN 105790768 B CN105790768 B CN 105790768B
Authority
CN
China
Prior art keywords
bit stream
data
compressed
file
code
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN201410809119.3A
Other languages
Chinese (zh)
Other versions
CN105790768A (en
Inventor
向宏卫
陈小川
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Allwinner Technology Co Ltd
Original Assignee
Allwinner Technology Co Ltd
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 Allwinner Technology Co Ltd filed Critical Allwinner Technology Co Ltd
Priority to CN201410809119.3A priority Critical patent/CN105790768B/en
Publication of CN105790768A publication Critical patent/CN105790768A/en
Application granted granted Critical
Publication of CN105790768B publication Critical patent/CN105790768B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention discloses a kind of date storage method and systems, and wherein method includes the following steps: to parse media file, obtain the media information and the first bit stream data of media file, and save media information to the first default file;First bit stream data is compressed using hash algorithm compress mode and obtains the first compressed bit stream, and saves the first compressed bit stream to the first default file;It reads and exports the first bit stream data to decoder and be decoded, obtain the image information and the second bit stream data of media file, and save image information to the second default file;Second bit stream data is compressed using hash algorithm compress mode and obtains the second compressed bit stream, and saves the second compressed bit stream to the second default file.It is not by compressing media information in media file and image information, and the bit stream data of the overwhelming majority is compressed using hash algorithm, memory space is saved, solves the problems, such as that the existing compressed file of data storage compression method still occupies larger memory space.

Description

Date storage method and system
Technical field
The present invention relates to field of storage, more particularly to a kind of date storage method and system.
Background technique
In media automatic test, various media informations are required to handle and be saved, especially audio and video code stream, Data volume is very big.These a large amount of data have exceeded the storage and processing ability of computer, even more current file transmission rate Less than.How effectively to store and transmit these data and how from these data Rapid matching is to required letter Breath is all the problem that user faces.Therefore, in order to store, handle and transmit these data, it is necessary to use a kind of efficient data Storage method carries out compression storage to data.
The existing compression suitable for text file data is mainly lossless compression.And current lossless compression algorithm, all It is to be based on that identical, duplicate sequence is looked for be compressed hereof, even if the data relatively high to the repeatability such as text file It is compressed, under normal circumstances, using lossless compression, maximum compression ratio can only achieve 70% or so, i.e., compressed file Size is 30% of original or so.Its compressed file still occupies biggish memory space.
Summary of the invention
Based on this, it is necessary to it is empty still to occupy biggish storage for the existing compressed file of data storage compression method Between the problem of, a kind of date storage method and system are provided.
A kind of date storage method that purpose provides to realize the present invention, includes the following steps:
Media file is parsed, obtains the media information and the first bit stream data of the media file, and save the media Information is to the first default file;
First bit stream data is compressed using hash algorithm compress mode and obtains the first compressed bit stream, and saves described the One compressed bit stream is to first default file;
It reads and exports first bit stream data and be decoded to decoder, obtain the image information of the media file And second bit stream data, and described image information is saved to the second default file;
Second bit stream data is compressed using the hash algorithm compress mode and obtains the second compressed bit stream, and saves institute The second compressed bit stream is stated to second default file.
In one of the embodiments, further include following steps:
According to the cryptographic Hash obtained using the hash algorithm compress mode, it is respectively compared first compressed bit stream and the One preset reference file and second compressed bit stream and the second preset reference file obtain test result, determine described the Whether one compressed bit stream and second compressed bit stream are correct.
It is described in one of the embodiments, first bit stream data is compressed using hash algorithm compress mode to obtain the One compressed bit stream, includes the following steps:
For cryptographic Hash calculating and setting initialization value;
Cover filling is carried out to each code stream in first bit stream data, and filled described each to cover Code stream adds the original length value of each code stream;
Divide each code stream, obtains the first data block M of multiple same sizes0-Mn;Wherein, n takes positive integer;
Using first data block of each code stream described in compression function packet transaction, until the first code stream number All code streams in all complete by processing, obtains first compressed bit stream.
First number using each code stream described in compression function packet transaction in one of the embodiments, According to block, include the following steps:
First buffering area, second buffering area and third buffer area needed for mark calculates the cryptographic Hash;
Wherein, the first buffering area is the buffer area of 5 32 words;The second buffering area is the slow of 80 32 words Rush area;The third buffer area is the buffer area of 1 32 word;And
The first buffering area is identified as H0、H1、H2、H3、H4;The second buffering area is identified as W0-W79;The third is slow It rushes area and is identified as TEMP;
By each first data block MiIt is divided into 16 words: W0-W15;Wherein, W0For leftmost word;I is more than or equal to 0, And it is less than or equal to n;
16 are more than or equal to for i, and is less than or equal to 79, enables Wi=S1(Wi-3xor Wi-8xor Wi-14xor Wi-16);
Enable A=H0, B=H1, C=H2, D=H3, E=H4
0 is more than or equal to for i, and is less than or equal to 79, executes circulation TEMP=S5(A)+fi(B, C, D)+E+Wi+Ki;E= D;D=C;C=S30(B);B=A;A=TEMP;
Enable H0=H0+ A, H1=H1+ B, H2=H2+ C, H3=H3+ D, H4=H4+E;
Wherein, fi(B, C, D) is the compression function;KiFor constant word;A is the first intermediate variable, and B is to become among second Amount, C are third intermediate variable, and D is the 4th intermediate variable, and E is the 5th intermediate variable.
The compression function f in one of the embodiments,i(B, C, D) are as follows:
The constant word KiAre as follows:
It is described in one of the embodiments, that the second pressure is obtained using hash algorithm compression second bit stream data Contracting code stream, includes the following steps:
For cryptographic Hash calculating and setting initialization value;
Cover filling is carried out to each code stream in second bit stream data, and filled described each to cover Code stream adds the original length value of each code stream;
Divide each code stream, obtains the second data block M of multiple same sizes0’-Mn';Wherein, n round numbers;
Using second data block in each code stream described in compression function packet transaction, until second code stream All code streams in data all complete by processing, obtains second compressed bit stream.
Correspondingly, based on the same inventive concept, the present invention also provides a kind of data-storage systems, including parsing storage mould Block, reads preserving module, decoder and the second compression module at the first compression module;Wherein,
The parsing memory module, for parsing media file, obtain the media file media information and first yard Flow data, and the media information is saved to the first default file;
First compression module obtains first for compressing first bit stream data using hash algorithm compress mode Compressed bit stream, and first compressed bit stream is saved to first default file;
The reading preserving module, for reading and exporting first bit stream data to the decoder;
The decoder obtains the image information of the media file for being decoded to first bit stream data And second bit stream data;
The reading preserving module is also used to save described image information to the second default file;
Second compression module is obtained for compressing second bit stream data using the hash algorithm compress mode Second compressed bit stream, and second compressed bit stream is saved to second default file.
It in one of the embodiments, further include comparison module;
The comparison module, the cryptographic Hash for being obtained according to the hash algorithm compress mode are respectively compared described One compressed bit stream and corresponding first preset reference file and second compressed bit stream are literary with corresponding second preset reference Part obtains test result, determines whether first compressed bit stream and second compressed bit stream are correct.
First compression module is filled out including the first Initialize installation unit, the first cover in one of the embodiments, Fill unit, the first additional length value cell, the first cutting unit and first processing units;Wherein,
The first Initialize installation unit, for being the cryptographic Hash calculating and setting initialization value;
The first cover fills unit is filled out for carrying out cover to each code stream in first bit stream data It fills;
The first additional length value cell, for adding each pen to the filled each code stream of cover The original length value of code stream;
First cutting unit obtains the first data block of multiple same sizes for dividing each code stream M0-Mn;Wherein, n takes positive integer;
The first processing units, for using first number in each code stream described in compression function packet transaction According to block, until all code streams in first bit stream data all complete by processing, first compressed bit stream is obtained.
The first processing units include mark subelement, word subelement, first are divided to calculate in one of the embodiments, Subelement, assignment subunit, circulation subelement and the second computation subunit;Wherein,
The mark subelement, for identify calculate the cryptographic Hash needed for first buffering area, second buffering area and the Three buffer areas;
Wherein, the first buffering area is the buffer area of 5 32 words;The second buffering area is the slow of 80 32 words Rush area;The third buffer area is the buffer area of 1 32 word;And
The first buffering area is identified as H0、H1、H2、H3、H4;The second buffering area is identified as W0-W79;The third is slow It rushes area and is identified as TEMP;
Described point of word subelement is used for each first data block MiIt is divided into 16 words: W0-W15;Wherein, W0For most The word on the left side;I is more than or equal to 0, and is less than or equal to n;
First computation subunit for being more than or equal to 16 for i, and is less than or equal to 79, enables Wi=S1(Wi-3xor Wi-8xor Wi-14xor Wi-16);
The assignment subunit, for enabling A=H0, B=H1, C=H2, D=H3, E=H4
The circulation subelement for being more than or equal to 0 for i, and is less than or equal to 79, executes circulation TEMP=S5(A)+fi (B, C, D)+E+Wi+Ki;E=D;D=C;C=S30(B);B=A;A=TEMP;
Second computation subunit, for enabling H0=H0+ A, H1=H1+ B, H2=H2+ C, H3=H3+ D, H4=H4+E;
Wherein, fi(B, C, D) is the compression function;KiFor constant word;A is the first intermediate variable, and B is to become among second Amount, C are third intermediate variable, and D is the 4th intermediate variable, and E is the 5th intermediate variable.
Above-mentioned date storage method the utility model has the advantages that
In media automatic test, by parsing to media file, media information and the matchmaker of media file are obtained After first bit stream data of body file, media information is directly stored without compressing.Meanwhile using hash algorithm to first yard Flow data obtains the first compressed bit stream and stores into the first default file after being compressed, realize the first time to media file Compression.Then, the first bit stream data is input to decoder to be decoded, obtains the image information and second code of media file Flow data, wherein image information is directly stored without compressing, and the second bit stream data then uses hash algorithm compress To the second compressed bit stream and store to the second default file.It is by carrying out two second compressions, and two second compressions to media file Hash algorithm is all made of to realize, so that except only having a small amount of media information and image information not to compress in media file, The bit stream data of remaining overwhelming majority is compressed, and memory space has been effectively saved.It finally efficiently solves existing The compressed file of data storage compression method the problem of still occupying biggish memory space.
Detailed description of the invention
Fig. 1 is one specific embodiment flow chart of date storage method of the invention;
Fig. 2 is to compress the first bit stream data using hash algorithm in one specific embodiment of date storage method of the invention In each code stream flow chart;
Fig. 3 is one specific embodiment structural schematic diagram of data-storage system of the invention;
Fig. 4 is the first compression module structural schematic diagram in one specific embodiment of data-storage system of the invention.
Specific embodiment
To keep technical solution of the present invention clearer, the present invention is done further in detail below in conjunction with drawings and the specific embodiments It describes in detail bright.
It is surveyed as a specific embodiment of date storage method provided by the invention for being automated to media referring to Fig. 1 Media file in examination is handled, and is included the following steps:
Step S100 parses media file, after the media information and the first bit stream data that obtain media file, executes step S200 saves media information to the first default file.
Meanwhile step S300 is executed, the first bit stream data is compressed using hash algorithm compress mode and obtains the first compressed code Stream, and save the first compressed bit stream to the first default file.
In addition, be also performed simultaneously step S400, read and export the first bit stream data to decoder and be decoded, obtains matchmaker After the image information of body file and the second bit stream data, step S500 is executed, saves image information to the second default file.
Meanwhile step S600 is executed, the second bit stream data is compressed using hash algorithm compress mode and obtains the second compressed code Stream, and save the second compressed bit stream to the second default file.
It obtains the media letter of media file by being parsed in media automatic test course to media file Breath (information such as size, timestamp including audio, video, subtitle in media file etc.) and the first bit stream data (i.e. matchmaker Data before body compressing file).Wherein, media information is directly stored without any compression, and the first bit stream data then uses Hash algorithm obtains the first compressed bit stream and is stored again after being compressed.Meanwhile it exporting through the first bit stream data to decoder It is decoded, obtains image information (size, pixel ratio, width including image, height, the output pixel format of media file Etc. information) and the second bit stream data (i.e. the bit stream data of each frame image of media file).Wherein, image information without Compression directly stores, and the second bit stream data obtains the second compressed bit stream and deposited again after then hash algorithm being used to be compressed Storage.That is, to some essential informations of media file, if media information and image information are without compression, and media are literary The most data code stream of part stores again after then hash algorithm being used to be compressed.
When due to carrying out data compression using hash algorithm, the bit stream data that needs are compressed always is as a bit words Symbol string is to handle.It is assumed that code stream is that " 8ab " to be converted into a binary bit strings be 00,111,000 01100001 01100010, being expressed as hexadecimal bit strings is 0x386162.Therefore, using hash algorithm respectively to media file The first bit stream data and the second bit stream data compressed so that obtained the first compressed bit stream and the second compressed code after compression Stream is the compressed bit stream of less number of bits.That is, being finally obtained when carrying out media file compression using hash algorithm Compressed media file is the compressed bit stream of less number of bits, stores a large amount of codes using less number of bits to realize The purpose of flow data, therefore save memory space.Even if efficiently solving in the storage of existing data after compressing data again Stored the problem of still occupying larger space.
Also, compared to existing compression storing data, date storage method of the invention is pressed using hash algorithm When contracting, the bit stream data of each frame random length can save as the Bit String of a fixed length, can make full use of Hash calculation The anti-collision and hash of method such as are uniformly distributed at the characteristics.Wherein, any two different bit stream data, the identical probability of cryptographic Hash become It is bordering on 1/2N.The almost impossible cryptographic Hash having the same of bit stream data of i.e. any two frame, this also just improves data compression The reliability of storage, to ensure that the correctness of media automatic test result.
Meanwhile when carrying out data compression using hash algorithm, although the cryptographic Hash generated is identical probability, this is also Large space is mapped to the inevitable outcome of small confined space.But 2NQuantity it is still very huge, two different code streams data Cryptographic Hash collision (i.e. identical) probability still very little.Even if colliding, source code flow data can also be compared by turn again To further confirm that.Also, different cryptographic Hash centainly represents different bit stream datas, therefore in media automatic test, Compression storage is carried out to media file by using hash algorithm, wherein the cryptographic Hash generated by hash algorithm is as in test Preliminary judgment basis does not need to decompress compressed media file, so that the comparison rate in test process is accelerated, Have the characteristics that efficient and highly reliable.
It should be noted that needing in media automatic test course by compressed media file and preset ginseng It examines file and is compared test, it is whether accurate to detect compressed media file.Therefore, as data storage side of the invention One specific embodiment of method, further includes the steps that comparing detection.That is, step S700, according to using hash algorithm compress mode The cryptographic Hash of acquisition compares its corresponding first preset reference text of the first compressed bit stream being stored in the first default file Part, and compare its corresponding second preset reference file of the second compressed bit stream being stored in the second default file, thus Test result is obtained, to confirm whether the first compressed bit stream and the second compressed bit stream are correct.
It is specific:
When inputting the AVI video file of a 45MB, parsed by media formats, acquisition media information (including File size, timestamp etc.), the media information that will acquire is used for initializing decoder, and needs not move through hash algorithm pressure It contracts and directly writes in the first default file and save for test result comparison.Then, each code stream that will be parsed Reading data comes out and exports to decoder and is decoded, and the bit stream data that each pen is parsed passes through hash algorithm The first compressed bit stream is obtained after compression, and is saved and compared into the first default file for test result.
Then, each frame image information (including picture traverse, height, output pixel format etc.) decoding obtained, no It writes direct to save in the second default file by hash algorithm compression and be compared for test result.And then, it is calculated using Hash Bit stream data (i.e. the second bit stream data) after method compression coding obtains the second compressed bit stream, then saves to the second default text It is compared in part for test result.
Finally, the reference paper of the destination file of preservation corresponding thereto is compared respectively, i.e. the first compressed bit stream Its corresponding first preset reference file is compared, and its corresponding second preset reference file of the second compressed bit stream carries out Compare, to obtain test result.
Further, obtained test result can be saved into XML file, checks and inspect in order to subsequent.
In the above-described embodiments, it is only necessary to compress the first bit stream data and the second bit stream data, and not need to decompress Source code flow can be obtained, in media automatic test, the media information for the media file for needing to save and 12647 code streams Shared memory space is 2MB after data (i.e. all code streams in the first bit stream data) compression;Meanwhile the media text for needing to save Shared storage after the image information of part and corresponding 12467 frame bit stream data (i.e. all code streams in the second bit stream data) compression Space is 1.3MB.Compared with 93MB and 92MB before compression, the memory space needed is only 1.78% before compressing.Thus Show to dramatically save memory space using date storage method provided by the invention.Simultaneously as file is compared Time it is related with the size of file, and compressed code stream capacity is very small in date storage method of the invention, therefore phase Pair also just reduce the Documents Comparison time, accelerate testing process.
It should be noted that first having to execute step when carrying out the compression of the first bit stream data using hash algorithm S310 carries out a series of pretreatment to the first bit stream data, including segmentation, cover filling, additional length value and initial The operation such as change.It should be pointed out that when being pre-processed to the first bit stream data, it can be by respectively in the first bit stream data Each code stream carries out corresponding pretreatment to realize.Also, each code stream in the first bit stream data is pre-processed When, the execution sequence of the operations such as segmentation, cover filling, additional length and initialization can be replaced mutually.Not with institute of the present invention The sequence of offer is exclusive embodiment.
In addition, further, the second bit stream data obtained after being decoded by decoder to the first bit stream data is equally It is to be compressed using hash algorithm, execution step when hash algorithm being used to be compressed and use hash algorithm are to first The step of bit stream data is compressed is identical, therefore, below only to carry out boil down to the first bit stream data using hash algorithm Example, the compression process for carrying out data using hash algorithm is described in detail.
It is cryptographic Hash calculating and setting initialization value specifically, referring to fig. 2, step S311 is first carried out.Wherein, it initializes Value setting are as follows: H0=0x67452301, H1=0xEFCDAB89, H2=0x98BADCFE, H3=0x10325476, H4= 0xC3D2E1F0.That is, the compressed bit stream after each code stream compression in the first bit stream data is initialized as 5 The hexadecimal string of 32 words.Initial cryptographic Hash is arranged to each code stream to be compressed first, and will be set The initial cryptographic Hash set stores the first buffering area to needed for calculating cryptographic Hash.Wherein, first buffering area is 5 32 words Buffer area H0, H1, H2, H3, H4
Then cover filling and additional length value can be carried out to each code stream in the first bit stream data.
Herein, it should be noted that before carrying out cover filling and additional length value to each code stream, can preferentially hold Row step S312 is split each code stream according to default unit, obtains the first data block M of multiple same sizes0-Mn, N takes positive integer.Wherein, divide each first data block M of acquisitioni(i is more than or equal to 0, and the size being less than or equal to n) is 512, final each code stream can be divided into n group, and every group 512.When this also allows for handling each code stream, it can divide The first data block of each of each code stream is managed in other places, and then obtains compressed bit stream data.
Then, step S313 can be performed, cover filling is carried out to each code stream.I.e. to each code stream filling bit. When carrying out data compression using hash algorithm, code stream needs to carry out cover processing, so that the code stream length after its cover is to 512 Remainder after modulus is 448.Even if it is 448 that length, which has met to remainder after 512 modulus, cover is also required to carry out.Specifically Padding operation are as follows: first mend one 1, then mend 0 again, until the code stream length satisfaction of each code stream is to remainder after 512 modulus 448.That is, the number of cover is at least one, up to 512 when carrying out padding operation to each code stream.
Then, step S314 is executed, each code stream filled to cover adds the original length value of each code stream. I.e. to each code stream additional length value after cover.Length value attached by it fills it in progress cover for each code stream Preceding original length value.That is, being mended the code stream length for each code stream for not carrying out cover filling accordingly to Behind each code stream for carrying out cover filling.If the length of the code stream of original (not carrying out cover filling) is more than 512, then mended into 512 multiple.
Then, step S320 is executed, using each code stream of compression function packet transaction, until in the first bit stream data All code streams all after the completion of processing, obtain the first compressed bit stream.
In addition, when using each code stream of compression function packet transaction, since each code stream has been divided into multiple One data block Mi.Therefore, by handling each first data block M respectivelyi, to finally obtain each compressed word of code stream Symbol string.That is, when using each code stream of compression function packet transaction, it can be every in each code stream by handling respectively One the first data block MiTo realize.
By being divided into multiple first data block M to each code streami, wherein each first data block MiData length For 512 bits.Each code stream is handled as unit of 512 bits, needs a series of compression letter during processing Number fi(B, C, D).Wherein, i is more than or equal to 0, and is less than or equal to 79;The value of n is 79.Each compression function fi(B, C, D) is all grasped Make 32 words (B, C, D), and generates 32 words as output.Meanwhile it being needed when carrying out the calculating of cryptographic Hash to each code stream Want three buffer areas, respectively first buffering area, second buffering area and third buffer area.Wherein, first buffering area such as front institute Mention be 5 32 words buffer area.The buffer area of 5 32 words is identified as H0, H1, H2, H3, H4.Second buffering area Buffer area for the buffer area of 80 32 words, 80 32 words is identified as W0、W1、W2、……W79.Third buffer area is 1 The buffer area of a 32 words, the buffer area of 1 32 word are identified as TEMP.In addition, further include a series of constant word, and A series of constant word is then identified as Ki
Further, compression function fi(B, C, D) can be defined as follows:
Constant word KiHexadecimal representation is then used, are as follows:
Compressed 160 code streams of each code stream in order to obtain need the first data block M to each 5121, M2,...,MnIt is successively handled, handles each first data block MiInclude 80 steps.Handling each first data block Mi Before, first buffering area { Hi } is initialized to H0, H1, H2, H3, H4
Specifically, processing M1, M2... ..., MnWhen, it needs to carry out following steps:
Step S321, by each first data block MiIt is divided into 16 words: W0、W1、W2、W3、……W15, W0It is leftmost Word.
Step S322 enables W for i=16 to 79i=S1(Wi-3xor Wi-8xor Wi-14xor Wi-16)。
Step S323, enables A=H0, B=H1, C=H2, D=H3, E=H4
Step S324 executes following circulation TEMP=S for i=0 to 795(A)+fi(B, C, D)+E+Wi+Ki;E= D;D=C;C=S30(B);B=A;A=TEMP.
Step S325, enables H0=H0+ A, H1=H1+ B, H2=H2+ C, H3=H3+ D, H4=H4+E.Handling all After one data block, each code stream is the character string for being compressed into one 160.
Wherein, referring to fig. 2, it when handling each code stream using compression function, can be determined by judging twice each Whether code stream has been handled.Firstly, executing step S330, one first in this code stream that real-time judge is presently processing Data block MiWhether processing is completed.If it is not, then return step S320, continues with the current first data block M in this code streami。 If so, thening follow the steps S340, further judge whether the first data block of n group in this code stream being presently processing is handled It is complete;If so, ending processing operation.If it is not, then return step S310, continues to being presently processing in the first bit stream data This code stream be split and handle.
Further, when executing step S600, the second bit stream data is compressed using hash algorithm and obtains the second compressed code When stream, specific treatment process is identical with step S300.That is, specifically comprising the following steps:
Step S611 is cryptographic Hash calculating and setting initialization value;Wherein, initialization value are as follows: H0=0x67452301, H1= 0xEFCDAB89, H2=0x98BADCFE, H3=0x10325476, H4=0xC3D2E1F0.
Step S612 carries out cover filling to each code stream in the second bit stream data, and filled every to cover One code stream adds the original length value of each code stream.
Step S613 obtains the second data block M of multiple same sizes by default each code stream of unit0’–Mn'; Wherein, n takes positive integer.
Step S620, using each code stream of compression function packet transaction, until all code streams in the second bit stream data All after the completion of processing, the second compressed bit stream is obtained.
It should be noted that when due to being compressed to obtain the second compressed bit stream to the second bit stream data using hash algorithm Specific step it is identical with the process for using hash algorithm to compress the first bit stream data.Therefore, it no longer carries out herein It repeats.
Correspondingly, based on the same inventive concept, the present invention also provides a kind of data-storage systems.Since the present invention provides Data-storage system working principle and date storage method provided by the invention principle it is same or similar, therefore repeat it Place repeats no more.
Referring to Fig. 3, as a kind of data-storage system provided by the invention, for handling the matchmaker in media automatic test Body file, including parsing memory module 100, the first compression module 200, reading preserving module 300, decoder 400 and the second pressure Contracting module 500.Wherein,
It parses memory module 100 and obtains the media information and the first code stream number of media file for parsing media file According to, and media information is saved to the first default file.
First compression module 200 obtains the first compressed bit stream for compressing the first bit stream data using hash algorithm, and protects The first compressed bit stream is deposited to the first default file.
Preserving module 300 is read, for reading and exporting the first bit stream data to decoder 400.
Decoder 400 obtains the image information and the second code stream of media file for being decoded to the first bit stream data Data;
Preserving module 300 is read, is also used to save image information to the second default file.
Second compression module 500 obtains the second compressed bit stream for compressing the second bit stream data using hash algorithm, and protects The second compressed bit stream is deposited to the second default file.
It wherein, further include comparison module 600.Comparison module 600, for being respectively compared the first compressed bit stream and corresponding One preset reference file and the second compressed bit stream and corresponding second preset reference file, obtain test result.
As an embodiment, referring to fig. 4, the first compression module 200 include the first Initialize installation unit 210, First cover fills unit 220, the first additional length value cell 230, the first cutting unit 240 and first processing units 250.
Wherein, the first Initialize installation unit 210, for being cryptographic Hash calculating and setting initialization value;Wherein, initialization value Are as follows: H0=0x67452301, H1=0xEFCDAB89, H2=0x98BADCFE,
H3=0x10325476, H4=0xC3D2E1F0.
First cover fills unit 220, for carrying out cover filling to each code stream in the first bit stream data.
First additional length value cell 230, for adding the original of each code stream to the filled each code stream of cover Beginning length value.
First cutting unit 240 obtains the first data block M of multiple same sizes for dividing each code stream0-Mn; Wherein, n takes positive integer.
First processing units 250, for using each code stream of compression function packet transaction, until in the first bit stream data All code streams all processing after the completion of, obtain the first compressed bit stream.
It should be noted that first processing units 250 include mark subelement 251, word subelement 252, first are divided to calculate Subelement 253, assignment subunit 254, circulation subelement 255 and the second computation subunit 256.
Wherein, subelement 251 is identified, for first buffering area, second buffering area and the needed for identify calculating cryptographic Hash Three buffer areas.
Wherein, first buffering area is the buffer area of 5 32 words;Second buffering area is the buffer area of 80 32 words;The Three buffer areas are the buffer area of 1 32 word.Also, first buffering area is identified as H0、H1、H2、H3、H4、H5;Second buffering area mark Knowing is W0-W79;Third buffer area is identified as TEMP.
Divide word subelement 252, is used for each first data block MiIt is divided into 16 words: W0-W15;Wherein, W0It is leftmost Word, i is more than or equal to 0, and is less than or equal to n.
First computation subunit 253 for being more than or equal to 16 for i, and is less than or equal to 79, enables Wi=S1(Wi-3xor Wi- 8xor Wi-14xor Wi-16)。
Assignment subunit 254, for enabling A=H0, B=H1, C=H2, D=H3, E=H4
Subelement 255 is recycled, for being more than or equal to 0 for i, and is less than or equal to 79, executes circulation TEMP=S5(A)+fi (B, C, D)+E+Wi+Ki;E=D;D=C;C=S30(B);B=A;A=TEMP.
Second computation subunit 256, for enabling H0=H0+ A, H1=H1+ B, H2=H2+ C, H3=H3+ D, H4=H4+E。
Wherein, fi(B, C, D) is compression function;KiFor constant word;A is the first intermediate variable, and B is the second intermediate variable, C For third intermediate variable, D is the 4th intermediate variable, and E is the 5th intermediate variable.
In addition, it is necessary to, it is noted that be obtained since the second compression module 500 compresses the second bit stream data using hash algorithm The working principle of second compressed bit stream and the working principle of the first compression module 200 are same or similar.Therefore, correspondingly, second Compression module 500 includes the second Initialize installation unit, the second cover fills unit, the second additional length value cell, second point Cut the units such as unit and the second processing unit (being not shown in figure).Due to the compression process and first of the second compression module 500 Compression module 200 is identical, therefore details are not described herein again.
The embodiments described above only express several embodiments of the present invention, and the description thereof is more specific and detailed, but simultaneously Limitations on the scope of the patent of the present invention therefore cannot be interpreted as.It should be pointed out that for those of ordinary skill in the art For, without departing from the inventive concept of the premise, various modifications and improvements can be made, these belong to guarantor of the invention Protect range.Therefore, the scope of protection of the patent of the invention shall be subject to the appended claims.

Claims (7)

1. a kind of date storage method, which comprises the steps of:
Media file is parsed, obtains the media information and the first bit stream data of the media file, and save the media information To the first default file;The media information includes audio size, video size, size of caption, timestamp in media file;
First bit stream data is compressed using hash algorithm compress mode and obtains the first compressed bit stream, and saves first pressure Contracting code stream is to first default file;
It reads and exports first bit stream data and be decoded to decoder, obtain the image information and of the media file Two bit stream datas, and described image information is saved to the second default file;Described image information includes the size of image, pixel Than, width, height, output pixel format;
Second bit stream data is compressed using the hash algorithm compress mode and obtains the second compressed bit stream, and saves described the Two compressed bit streams are to second default file.
2. date storage method according to claim 1, which is characterized in that further include following steps:
According to the cryptographic Hash obtained using the hash algorithm compress mode, it is respectively compared first compressed bit stream and first in advance If reference paper and second compressed bit stream and the second preset reference file, test result is obtained, determines first pressure Whether contracting code stream and second compressed bit stream are correct.
3. date storage method according to claim 1, which is characterized in that described to be compressed using hash algorithm compress mode First bit stream data obtains the first compressed bit stream, includes the following steps:
For cryptographic Hash calculating and setting initialization value;
Cover filling is carried out to each code stream in first bit stream data, and to the filled each code of cover Stream adds the original length value of each code stream;
Divide each code stream, obtains the first data block M of multiple same sizes0-Mn;Wherein, n takes positive integer;
Using first data block of each code stream described in compression function packet transaction, until in first bit stream data All code streams all processing complete, obtain first compressed bit stream.
4. date storage method according to claim 1, which is characterized in that described using described in hash algorithm compression Second bit stream data obtains the second compressed bit stream, includes the following steps:
For cryptographic Hash calculating and setting initialization value;
Cover filling is carried out to each code stream in second bit stream data, and to the filled each code of cover Stream adds the original length value of each code stream;
Divide each code stream, obtains the second data block M of multiple same sizes0’-Mn';Wherein, n round numbers;
Using second data block in each code stream described in compression function packet transaction, until second bit stream data In all code streams all processing complete, obtain second compressed bit stream.
5. a kind of data-storage system, which is characterized in that including parsing memory module, the first compression module, read preserving module, Decoder and the second compression module;Wherein,
The parsing memory module obtains the media information and the first code stream number of the media file for parsing media file According to, and the media information is saved to the first default file;The media information includes audio size in media file, video Size, size of caption, timestamp;
First compression module obtains the first compression for compressing first bit stream data using hash algorithm compress mode Code stream, and first compressed bit stream is saved to first default file;
The reading preserving module, for reading and exporting first bit stream data to the decoder;
The decoder obtains the image information and of the media file for being decoded to first bit stream data Two bit stream datas;Described image information includes size, pixel ratio, width, the height, output pixel format of image;
The reading preserving module is also used to save described image information to the second default file;
Second compression module obtains second for compressing second bit stream data using the hash algorithm compress mode Compressed bit stream, and second compressed bit stream is saved to second default file.
6. data-storage system according to claim 5, which is characterized in that further include comparison module;
The comparison module, the cryptographic Hash for being obtained according to the hash algorithm compress mode are respectively compared first pressure Contracting code stream and corresponding first preset reference file and second compressed bit stream and corresponding second preset reference file, Test result is obtained, determines whether first compressed bit stream and second compressed bit stream are correct.
7. data-storage system according to claim 5, which is characterized in that first compression module includes first initial Change setting unit, the first cover fills unit, the first additional length value cell, the first cutting unit and first processing units;Its In,
The first Initialize installation unit, for being the cryptographic Hash calculating and setting initialization value;
The first cover fills unit, for carrying out cover filling to each code stream in first bit stream data;
The first additional length value cell, for adding each code stream to the filled each code stream of cover Original length value;
First cutting unit obtains the first data block M of multiple same sizes for dividing each code stream0-Mn; Wherein, n takes positive integer;
The first processing units, for using first data in each code stream described in compression function packet transaction Block obtains first compressed bit stream until all code streams in first bit stream data all complete by processing.
CN201410809119.3A 2014-12-19 2014-12-19 Date storage method and system Active CN105790768B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410809119.3A CN105790768B (en) 2014-12-19 2014-12-19 Date storage method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410809119.3A CN105790768B (en) 2014-12-19 2014-12-19 Date storage method and system

Publications (2)

Publication Number Publication Date
CN105790768A CN105790768A (en) 2016-07-20
CN105790768B true CN105790768B (en) 2018-12-25

Family

ID=56386497

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410809119.3A Active CN105790768B (en) 2014-12-19 2014-12-19 Date storage method and system

Country Status (1)

Country Link
CN (1) CN105790768B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107748794B (en) * 2017-11-03 2021-03-12 中国人民解放军陆军工程大学 Spatial data storage method
CN108494408B (en) * 2018-03-14 2021-07-13 电子科技大学 Hash dictionary-based underground high-speed real-time compression method for density logging while drilling instrument
CN110134500A (en) * 2019-04-15 2019-08-16 平安普惠企业管理有限公司 Method of data synchronization, device, equipment and storage medium based on multithreading
CN110113614B (en) * 2019-05-13 2022-04-12 格兰菲智能科技有限公司 Image processing method and image processing apparatus

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103346800A (en) * 2013-07-08 2013-10-09 沈阳东软医疗系统有限公司 Method and device for compressing data
CN103458244A (en) * 2013-08-29 2013-12-18 华为技术有限公司 Video compression method and video compressor
CN103546161A (en) * 2013-10-31 2014-01-29 江苏引跑网络科技有限公司 Lossless compression method based on binary processing
CN103916131A (en) * 2013-01-02 2014-07-09 三星电子株式会社 Data compression method and device for performing the same
CN104202054A (en) * 2014-09-16 2014-12-10 东南大学 Hardware LZMA (Lempel-Ziv-Markov chain-Algorithm) compression system and method

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7705753B2 (en) * 2005-10-22 2010-04-27 Sytex, Inc. Methods, systems and computer-readable media for compressing data
US7792877B2 (en) * 2007-05-01 2010-09-07 Microsoft Corporation Scalable minimal perfect hashing

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103916131A (en) * 2013-01-02 2014-07-09 三星电子株式会社 Data compression method and device for performing the same
CN103346800A (en) * 2013-07-08 2013-10-09 沈阳东软医疗系统有限公司 Method and device for compressing data
CN103458244A (en) * 2013-08-29 2013-12-18 华为技术有限公司 Video compression method and video compressor
CN103546161A (en) * 2013-10-31 2014-01-29 江苏引跑网络科技有限公司 Lossless compression method based on binary processing
CN104202054A (en) * 2014-09-16 2014-12-10 东南大学 Hardware LZMA (Lempel-Ziv-Markov chain-Algorithm) compression system and method

Also Published As

Publication number Publication date
CN105790768A (en) 2016-07-20

Similar Documents

Publication Publication Date Title
CN105790768B (en) Date storage method and system
US10212440B2 (en) Virtual frame buffer system and method
US8265407B2 (en) Method for coding and decoding 3D data implemented as a mesh model
CN103346800B (en) A kind of data compression method and device
US9462152B2 (en) System and method for hiding reversible information
CN106656195A (en) Data compression decompression method and data compression decompression system
Bioglio et al. Sparse image recovery using compressed sensing over finite alphabets
CN111061896B (en) Loading method, device, equipment and medium for 3D (three-dimensional) graph based on glTF (generalized likelihood TF)
CN105163122B (en) A kind of compression of images and decompression method based on image block similarity
CN106549730B (en) Data transmission method and system based on two-dimensional code
US11490134B2 (en) Method and system for codec of visual feature data
US8363885B2 (en) Method, device, and program for embedding, displaying, and recognizing data
US8849051B2 (en) Decoding variable length codes in JPEG applications
US10728356B2 (en) Communication device and communication system
US11742877B2 (en) File compression system
US11831886B2 (en) Methods, apparatuses, computer programs and computer-readable media for processing configuration data
CN110730277B (en) Information coding and method and device for acquiring coded information
CN105163124A (en) Image coding method, image decoding method, image coding device and image decoding device
CN112051974B (en) Electronic price tag information transmission method and system, electronic price tag and server
CN108989813A (en) A kind of high efficiency of compression/decompression method, computer installation and storage medium
CN101840498B (en) Bar code decoding device and security protection method thereof
CN107659815A (en) Image decompression method and the device for performing it
CN116192402B (en) Communication method with information coding
KR100728918B1 (en) System for compressing and decompressing binary image rapidly and method thereof
CN116939227A (en) Feature compression method and device and electronic equipment

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant