Dynamic difference coding and coding/decoding method
Technical field
The invention belongs to the numerical information technical field of memory.
Summary of the invention
The object of the invention provides a kind of dynamic difference coding and coding/decoding method, it can be applicable to three-dimensional photon storer etc. and utilizes in the access device that page mode stores and read, the problem that effective information is difficult to aim at when solving charge coupled device ccd reception image, realize catching automatically effective information, and reducing because the error code that hot spot unevenness and other large scale noise cause, thereby the reduction bit error rate.
Technology of the present invention constitutes: when effective information is encoded, the significance bit of representing information with the grey scale change of adjacent definition block (being used as one or more pixels that an integral body is considered), the former is bright to be 0 in the latter, the latter is bright to be 1 in the former, or determines an effectively position with opposite relation; Behind effective information coding to computer documents, to adding four edges around every page the effective information code pattern, form dynamic difference coding figure, utilize memory device stores in storage medium; When reading, utilize CCD to receive to be stored in the dynamic difference coding figure in the storage medium, be adjusted to the size of picture, make the dynamic difference coding figure that receives area, receive on the bin at CCD and leave more than or equal to five pixels outside the dynamic difference coding figure less than CCD; At first the four edges of dynamic difference coding figure is judged during decoding, from the gray-scale value summation of four direction ecto-entad up and down to all pixels of every row/row, 3~10 times of the gray-scale value sum of outermost two all pixels of row/row as threshold value, can be obtained four threshold values corresponding to four edges like this.By adjacent two row/row gray scales and difference and pre-set threshold compare, the absolute value of ecto-entad difference is identified as the limit that adds when encoding greater than the first row/row of threshold value, promptly can determine the four edges of dynamic difference coding figure, judge the position on limit, the width and the height on limit, and then remove four edges and obtain the effective information code pattern, and obtain width, height and the position of effective information code pattern; Determine each significance bit of information at last the information reverting among the figure to be become computer documents according to the grey scale change of adjacent two definition blocks.
Concrete steps of the invention process:
When computer documents is encoded, the significance bit of representing information with the grey scale change of adjacent definition block, be that the former is bright in latter's (bright dark) expression 0 for adjacent two definition blocks, the latter is bright in the former (secretly bright) expression 1 (or represent significance bit with opposite relation), and the number of definition block is the twice of effective information bits number.For example every row contains 2M definition block, and every row comprise N definition block, and then the effective information figure behind the coding comprises MN effective information position.Around every page effective information figure, add four edges, the width/on limit is the same with the width/of definition block or have certain known relation, form dynamic difference coding figure, and utilize laser to be stored in the storage medium by spatial light modulator or by other storage meanss.
When reading, utilize CCD to receive to be stored in the code pattern in the storage medium.By being adjusted to the size of picture, make the area of dynamic difference coding figure, and they can both be received by CCD less than CCD, receive on the bin at CCD and leave more than or equal to five pixels outside the dynamic difference coding figure, carry out the identification of four edges to utilize them.Carry out the judgement of four edges earlier, from the gray-scale value summation of four direction ecto-entad up and down to all pixels of every row (row), 3~10 times of the gray-scale value sum of outermost two row (row) all pixels as threshold value, can be obtained four threshold values (corresponding to the four edges of dynamic difference coding figure) like this.By adjacent two row (row) gray scales and difference and pre-set threshold compare, the absolute value of ecto-entad difference is identified as the limit of when coding adding greater than first row (row) of threshold value, promptly can determine the four edges of dynamic difference coding figure.Number according to the inside definition block of making an appointment is removed four edges, thereby has obtained the effective information code pattern.
Secondly, the effective information code pattern is represented a position with grey scale change between the adjacent definition block, according to the comparison of the gray scale and the previous gray scale of current definition block, judge to be 0 or 1 in this position (hexadecimal representation as the ASCII character of " a " is 61, and Fig. 1 is seen in the expression behind the coding.Bright dark expression 0 among this figure, dark bright expression 1).In the effective information of effective information code pattern, preceding 12bytes is that file name information is (if adopt long filenames, then can select for use the respective length of agreement to represent filename), 2bytes then is file size information (also can adopt longer about measured length to represent), is the content of file then.The effective information that the effective information code pattern comprises is a MN significance bit, greater than MN bits, can store this document if the content of file adds the file name information of front and file size information with a plurality of code patterns.If be less than or equal to MN bits, a then available width of cloth code pattern represents, less than the time can behind file content, add garbage.Can judge that this file is made up of a few width of cloth figure according to the file size that obtains previously in when decoding, and the length of the actual effective content of file.At last the information reverting among the reproduction figure is become computer documents, and neglect garbage.If adjacent definition block gray-scale value equates that then this significance bit is read failure, can utilize CCD to read this two definition blocks again, and differentiate; Or assert and this significance bit mistake this significance bit is expressed as 1 (or 0), and there is the problem of reading in this significance bit of mark.
Description of drawings
Fig. 1 is the effective information code pattern of 61 (sexadecimals); Fig. 2 is the binary representation of file " 2.txt "; Fig. 3 is the code pattern of file " 2.txt "; Fig. 4 is the figure that goes out from recording medium reproducing; Fig. 5 is the effective information figure behind the removal four edges.
Embodiment
The present invention is described in detail as follows in conjunction with the accompanying drawings:
As shown in the figure, " 2.txt " encodes to file, and the content of this document is:
Effective information in the abcdfghijkabcdfghijkabcdfghijk code pattern comprises following information: preceding 12bytes is a file name information, and the 2bytes that follows is a file size information, is the content of file then.Fig. 2 is its binary representation, according to dark brightly be 0, bright secretly be 1 further to be encoded to the effective information code pattern, and adding that four edges forms dynamic difference coding figure, the figure behind the coding sees that (significance bit of the every row of code pattern is 16bits to Fig. 3, and then the definition block of the every row of effective information is 32.Preceding 6 behavior file names, the 7th behavior file length is file content then).Definition block is the square that 6 * 6 pixels constitute, and the width/on limit is the same with the width/of definition block.Dynamic difference coding figure behind the coding is outputed on the spatial light modulator by computing machine, and is stored in the recording medium by the mode or the alternate manner of holography, and experiment is to utilize holographic method to be recorded in the double-doped lithium niobate crystal.
Fig. 4 for the figure that from recording medium, reveals again (under the polarization configurations of our actual storage, just in time opposite when reproducing the expression of significance bit of figure and storage, dark bright expression 0, the bright dark expression 1 of adjacent definition block when therefore here we arrange to encode, and dark bright expression 1 among the figure, bright dark expression 0 after reproducing, originally the dark side around effective information has also become bright border), can see that original information encoded is all received, and around leave enough vacant pixels.
From left to right to the gray-scale value summation of all pixels of every row, with 6 times of gray-scale value sum of the most left two all pixels of row as threshold value, and by adjacent two row gray scales and difference and pre-set threshold compare, from left to right the absolute value of difference is identified as the limit, left side that when coding adds greater than first row of threshold value; From right to left similar, reach the four edges that promptly can determine dynamic difference coding figure from top to bottom from top to bottom.According to the inside effective information of making an appointment is 16, two adjacent definition blocks are represented a significance bit, two limits about adding, every row has 34 definition blocks, thereby obtain the developed width of each definition block according to the position of limit of judging above, left side and right edge, promptly can with about two limits remove.Similarly, we also have in advance agreement to the definition block number in every row, and effective information adds that two limits have 24 definition blocks up and down in the row.Thereby obtain the true altitude of each definition block according to the position of upper side edge of judging above and lower side, promptly two limits up and down can be removed, Fig. 5 is for the location and the effective information code pattern after removing four edges.
When four edges is judged, also obtained the size of definition block, can know number of picture elements that each definition block is contained and interior all pixels thereof gray scale and.According to the bright dark relation between adjacent two definition blocks (dark bright expression 1, bright dark expression 0) thus obtained the information of each significance bit.From the first six row we obtained should image filename, we have obtained the length of this document from the 7th row, in order to the actual effectively content of (after the 7th row) reduction of decoding to thereafter, effective content of this document is big or small consistent with code pattern just in time.At last file is deposited back computing machine by filename and file content that decoding obtains, finish decode procedure.
The present invention can be applicable to three-dimensional photon storer etc. and utilizes in the access device that page mode stores and read, its outstanding effect: 1, realized the automatic location of visual effective information, effective information is difficult to definite automatically problem when solving charge coupled device ccd reception image; 2, reduce because the error code that hot spot unevenness and other large scale noise cause, the preceding original bit error rate of coding is greater than 10
-2, the coding back bit error rate is lower than 10
-6