Now the present invention is described in detail in conjunction with the accompanying drawings.
For break the mode that reads of habitual view data at all, the present invention is the form of the hyte (byte) of definition coding earlier, shown in Figure 1A.In a hyte, identification code 11 is represented in preceding two positions, and count code 12 is then represented in back 6 positions.Identification code 11 has two positions, therefore 4 kinds of combinations can be arranged, shown in Figure 1B.Wherein, " 00 " represents the data that are all a high position coded in this hyte, i.e. " 1 "." 01 " is represented codedly in this hyte to be the data of low level, i.e. " 0 "." 10 " represent that the data in this hyte all are still uncoded data, i.e. initial data.For example, when the repeatability of view data is very low, just must can directly not export through coding." 11 " are then represented standby, and are still undefined.Certainly, these four kinds of possible combinations and definition can vary with each individual, as long as can represent a high position respectively, and low level, and coding does not wait three kinds to get final product.
The hyte of every coding has 8, after the identification code of removal front two, and 6 last positions, the number of continuous same nature coding when can be used to record coding.Therefore, 6 positions can write down 63 (2 at most
6-1) position of individual coding.For example, " 00111111 " just represents to have the view data of continuous 63 high positions (" 1 ").And " 01001111 " just represents to have the view data of continuous 30 low levels (" 0 ").
In addition, the present invention adopts the idea of " bit plane section " to handle the view data that each reads.According to the technology of " bit plane section ", be with 8 bit representations as if each pixel in the image, just the plane that image can be used as by eight 1 constituted, shown in Fig. 2 A.Its scope by least important bit plane 0 to most important bit plane 7.According to 8 binary bit group, plane 0 comprises forms two-symbol all lowest orders of image pixel, and 7 on plane comprises all and forms two-symbol all highest orders of image pixel.Shown in Fig. 2 B, each position of each hyte of reading in will lowly by height be handled respectively.Just, the order of processing position is [A7] [B7] [C7] ... [A6] [B6] [C6] ... [A5] [B5] [C5] ... [A4] [B4] [C4] ... [A3] [B3] [C3] ... [A2] [B2] [C2] ... [A1] [B1] [C1] ... [A0] [B0] [C0] ....
Principle according to this, image is if present with wherein a kind of bit-plane image, and then 8 bit planes will demonstrate diverse image.The compressibility of high bit plane is higher, and the data repeatability of low bit plane is less, and therefore compression is difficult.For the bit-plane data of last three low levels, can encode and directly transmission.Or after the data of transmitting high bit plane, replenish the data of low bit plane again in random number mode, with the distortion rate of data behind the reduction decompress(ion).This is the technology that those skilled in the art used always, and its purpose is only being compressed at the big image of compression efficiency.
According to the above-mentioned coded format and the processing method of bit plane, the data that method of the present invention reads at every turn mostly are most 63 hytes, because there are 6 positions can write down 63 data at most, and every data are used as 8 bit planes and are handled, so each block of handling just has 63 hytes.
The detailed step of compression method of the present invention is as shown in Figure 3: 301: read the data that the analog/digital conversion device is exported; 302: because treatment of picture is to handle item by item in regular turn, therefore with the image of each bar scanning,
With 63 hytes is a block, is divided into several and handles block; 303: handle the data of the block that is read in regular turn, its handling procedure is as follows: 3031: read 6 positions that the analog/digital conversion device is exported in regular turn; 3032: the attribute of judging these 6 positions? when these 6 positions are all " 1 ", execution in step 3033; When
When these 6 positions are all " 0 ", execution in step 3034; During other situation, execution in step 3035; 3033: the identification code of setting this hyte is " 00 ", and this count code is made as two-symbol " 11 ",
And execution in step 3036.3034: the identification code of setting this hyte is " 01 ", and this count code is made as two-symbol " 11 ",
And execution in step 3036.3035: the identification code of setting this hyte is " 10 ", and execution in step 3038; 3036: judge that whether next bit is with value, or six positions of this count code are all " 1 "? if,
Just execution in step 3037; Otherwise just execution in step 3038.3037: with this count code progression 1, and repeated execution of steps 3036.3038: export this hyte to one storage device.3039: judge whether to finish the processing of this block? if then execution in step 304; Otherwise, carry out
Step 3031; 304: judge whether to finish the processing of all blocks? if then execution in step 305; Otherwise execution in step 303.305: finish.
In step 3031,, can earlier binary code be converted to Ge Lei sign indicating number (gray code) for increasing the compressibility of data.The Ge Lei sign indicating number is that the computing of XOR is carried out in adjacent position.Because the Ge Lei sign indicating number has unique character, promptly, between the code word that links to each other a position difference is only arranged through after the conversion of Ge Lei sign indicating number.Therefore, utilize this characteristic, even GTG has very little variation, also can show at all bit planes, it is a sheet of complete black or complete white can not making picture.
Data after the compression are temporarily stored in the random access memory, handle for decompressing device.The method that decompresses is to carry out with respect to compression method, and its method is as follows, and decompression needs the data after the buffer stores of at least 63 hytes decompresses.The memory of buffer is arranged the arrangement that is equal to the preceding view data of compression.The detailed step of decompression of the present invention is as follows: 401: read coded data in regular turn, read a hyte at every turn.402:, judge the attribute of this hyte by the identification code of this hyte.403: when the identification code of this hyte is " 00 ",, comply with according to the number that counter write down of this hyte
Preface is inserted equivalent " 1 " corresponding position in buffer; Promptly according to
[A7] [B7] [C7] ... [A6] [B6] [C6] ... [A0] [B0] [C0] ... wait order, open by a high position to low level
Beginning is inserted " 1 " of equivalent.404: when the identification code of this hyte is " 01 ",, comply with according to the number that counter write down of this hyte
Preface is inserted equivalent " 1 " corresponding position in buffer; Promptly according to
[A7] [B7] [C7] ... [A6] [B6] [C6] ... [A0] [B0] [C0] ... wait order, open by a high position to low level
Beginning is inserted " 0 " of equivalent.405: when the identification code of this hyte is " 10 ", then, deposit in regular turn with the data of the count code of this hyte
Go into corresponding position in the buffer.Because this hyte is not encoded as yet, therefore as long as with count code
Data insert relative position and get final product.For example, if this hyte is " 10101010 ", and
Represent the 5th data, then in regular turn " 101010 " are inserted respectively
Among [A5] [B5] [C5] [D5] [E5] [F5].406: judge whether buffer fills up? if, execution in step 407; Otherwise, execution in step 401.407: the data in the output buffer.408: judge whether to finish the decompression of all data? if, execution in step 409; Otherwise, carry out
Step 401.409: finish.
So after the view data reduction of each block, just with the input of the data in buffer main frame, until the conversion of finishing all blocks.Wherein, if original binary code has been converted to the Ge Lei sign indicating number, when execution in step 407, be the Ge Lei sign indicating number owing to what decompress, must earlier the Ge Lei sign indicating number be converted to binary code, could be with the input of the data in buffer computer.Compression and the step that decompresses can be carried out simultaneously, must be unit with 63 hytes just.After condensing routine was 63 hytes with image encoding, is sent to storage device then, gunzip just can begin to carry out.Because compression the time is to be unit with 63 hytes, therefore, gunzip must be waited until that 63 hytes are all encoded and just can carry out after finishing.
Method of the present invention can software implementation, also program making can be become special integrated chip (ASIC), comes the compression and the decompression of carries out image.In sum, compressing/decompressing method of the present invention is a unit with position (bit) still when reading the data that the analog/digital conversion device exported, but not be that unit handles with hyte (byte), therefore not only has digital equable advantage, and seek easily with the value number, so the compression efficiency of image is higher.
In addition, compressing/decompressing method of the present invention is aspect image impairment (loss), because of taking other processing at one or two position, for example 255 rank are reduced to 128 rank or 64 rank, make image passivation etc., the user also is not easy to discover, and its change is comparatively soft, can not produce the phenomenon of well-known category like mosaic.Very and, compression method of the present invention can be selected the transmission of low level (low bit), transmits with a line (oneline) sampling, or rebuilds with the idea of responsibility cycle period (duty cycle), so the transmission quantity of visual image and deciding, and has very much elasticity.
The above only is preferred embodiment of the present invention, and has reached practical effect widely, and all equivalent variations and modifications of being done according to claim scope of the present invention all belong in the scope that claim of the present invention contains.