CN101777366B - Stroke compression method and device based on RLE principle - Google Patents

Stroke compression method and device based on RLE principle Download PDF

Info

Publication number
CN101777366B
CN101777366B CN201010039585XA CN201010039585A CN101777366B CN 101777366 B CN101777366 B CN 101777366B CN 201010039585X A CN201010039585X A CN 201010039585XA CN 201010039585 A CN201010039585 A CN 201010039585A CN 101777366 B CN101777366 B CN 101777366B
Authority
CN
China
Prior art keywords
data
macro block
compression
compressed
macroblock
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.)
Expired - Fee Related
Application number
CN201010039585XA
Other languages
Chinese (zh)
Other versions
CN101777366A (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.)
Zhejiang University ZJU
Original Assignee
Zhejiang University ZJU
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 Zhejiang University ZJU filed Critical Zhejiang University ZJU
Priority to CN201010039585XA priority Critical patent/CN101777366B/en
Publication of CN101777366A publication Critical patent/CN101777366A/en
Application granted granted Critical
Publication of CN101777366B publication Critical patent/CN101777366B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Compression, Expansion, Code Conversion, And Decoders (AREA)

Abstract

The invention discloses a stroke compression method which is applied to a high-speed printing system and based on a RLE principle; and the compression method is based on RLE algorithm, increases a macroblock segmentation strategy and a compression threshold coefficient, and achieves the purposes of stable operation, real-time transmission and controllable compression. The macroblock segmentation strategy is adopted, the data coupling is eliminated, even if errors occur in a transmission process, the current macroblock is only affected, the fault performance is good, and the operation is stabler; the macroblock size can be set by a macroblock controller so as to adapt to different transmission environments and facilitate real-time transmission and processing; for encoding in the macroblock, the invention adopts the compression threshold coefficient to ensure the algorithm compression ratio, and realize controllable compression rate; the invention also discloses a stroke compression algorithm operation device based on the RLE principle; and being the operation environment of the compression method of the invention, the device well applies the macroblock segmentation strategy and the compression threshold coefficient.

Description

RLE principle-based stroke compression method and device
Technical Field
The invention relates to the field of lossless compression and decompression processing of digital information, in particular to a stroke compression method and a stroke compression device based on an RLE principle, which are applied to a high-speed printing system.
Background
After the information is digitized, the data may be permanently stored in a device such as a magnetic tape drive or a hard disk, or may be transmitted via a network system distributed throughout the world. After the original information is digitally quantized, the total number of samples is finite, so that if there are consecutive identical sample values in a segment of digital information, a run length compression algorithm (RLE) can be used for compression. Compressed digital information occupies less storage space and less network bandwidth and is therefore commonly employed.
Currently, using the RLE principle, a number of specific run-length compression algorithms are derived: a PCX run-length compression algorithm, a BI RLE8, a BI RLE4, a compact bit compression algorithm, and the like, which encode digital information using a fixed rule, there is a possibility that the amount of data after compression is larger than the amount of data before compression for a specific number sequence. In addition, there are non-RLE principle algorithms such as huffman coding, arithmetic coding, LZW, etc., which are either highly complex or require all samples to be obtained for compression, and are not suitable for real-time transmission systems.
With the rapid development of digital printing machines, a front-end device with larger bandwidth is required to provide high-speed data transmission and processing, and data compression is a simple and feasible method.
Disclosure of Invention
The invention provides a stroke compression method based on an RLE principle, which is used for providing a controllable compression ratio and is suitable for network real-time transmission.
A stroke compression method based on RLE principle adopts a macro block division compression strategy and a compression threshold coefficient to achieve the purposes of stability, high efficiency and controllability; wherein,
the data compression process comprises the following steps:
a. reading original data into a cache;
b. dividing original data in a cache according to a preset macro block size to obtain macro block data;
c. precompression of macroblock data using the BI RLE8 algorithm;
d. the compression ratio of the pre-compressed macro block data is compared with a compression threshold coefficient, if the compression ratio of the pre-compressed macro block data is larger than the compression threshold coefficient, the macro block data is compressed and output after compression, otherwise, the original macro block is used for directly output;
e. returning to the step b, and performing the division compression of the next macro block data.
The data decompression process comprises the following steps:
a. receiving the macro block data output by the data compression process into a cache;
b. identifying whether the received macro block data in the cache is compressed, the size of the compressed data and the size of the decompressed data respectively to obtain macro block basic information;
c. and according to the basic information of the macro block, performing decompression operation, directly outputting the macro block if the macro block is not compressed, and performing decompression by using a BI RLE8 decompression algorithm if the macro block is compressed.
d. And c, returning to the step b, decompressing the data of the next macro block until all the macro block processing is finished.
The invention also provides a run-length compression method operating device based on the RLE principle, which comprises a data compression end, a data decompression end and a transmission device used for transmitting data from the data compression end to the data decompression end,
the data compression end comprises:
the original data reading interface is used for selecting an original file stored on a hard disk of the PC and storing the content of the selected file into an original data buffer;
the original data buffer is used for storing original data before compression;
the macro block divider provides a macro block size setting interface and controls the division of the data in the original data buffer by using the set macro block size value;
the macro block precompressor is used for precompressing original macro block data, wherein the precompression only carries out compression algorithm processing, and outputs the size of the compressed macro block but does not output compressed data;
a compression threshold coefficient counter for providing a compression threshold coefficient setting interface and providing a compression threshold coefficient to the macroblock compressor;
the macro block compressor is used for performing compression judgment according to an output result of the macro block preprocessor and an output result of the compression threshold coefficient counter, and generating two outputs according to the compression judgment result, wherein the first output is a macro block head + an uncompressed macro block, the second output is a macro block head + a compressed macro block, and the RLE algorithm adopted by the macro block compressor is a BI RLE8 algorithm;
the data decompression end comprises:
a compressed data receiver for receiving the compressed macroblock data from the transmission device and storing the compressed macroblock data in a compressed data buffer;
the compressed data buffer is used for storing data to be decompressed;
the macro block information extractor extracts the information in the macro block head and sends the information to the macro block decompressor;
and the macro block decompressor is used for decompressing according to the macro block information provided by the macro block information extractor, directly outputting macro block data to an output original data cache if the macro block information indicates that the macro block is not compressed, and decompressing by adopting a BI RLE8 algorithm if the macro block information indicates that the macro block is compressed, wherein the decompressing needs to be circularly performed until the whole compressed macro block is decompressed.
And outputting an original data buffer, and storing the decompressed original data, wherein the original data is the original data on the compression system.
Before data compression is carried out, the data of the macro block is firstly divided into the macro blocks, the size of the macro blocks can be set through a setting interface provided by a macro block divider, and the macro block mode is used, so that the dependency between the blocks is avoided, the follow-up data cannot be always subjected to error due to partial errors, and the reliability of the system is improved; by using the macro block mode, the large block data is divided into units with controllable sizes, so that the data transmission of a transmission system is facilitated, and the characteristics of real-time transmission and real-time processing are provided.
When the invention compresses the macro block data, a pre-compression strategy is introduced, the pre-compression only carries out compression algorithm processing, the size of the compressed macro block is output, but the compressed data is not output, the preset macro block compression size can be obtained through pre-compression, and the controllable data compression ratio can be obtained through the comparison with the compression threshold coefficient.
The invention also provides a journey compression method based on RLE principle for digital printing machine image data, which comprises two processes of data compression and data decompression,
the data compression process comprises the following steps:
a. reading image data to be printed of the digital printing machine into a cache;
b. dividing image data to be printed in a cache according to the size of a preset macro block to obtain macro block data;
c. precompression of macroblock data using the BI RLE8 algorithm;
d. the compression ratio of the pre-compressed macro block data is compared with a compression threshold coefficient, if the compression ratio of the pre-compressed macro block data is larger than the compression threshold coefficient, the macro block data is compressed and then output, otherwise, the original macro block is used for directly output;
e. returning to the step b, and performing the division compression of the next macro block data.
The data decompression process comprises the following steps:
a. receiving the macro block data output by the data compression process into a cache;
b. identifying whether the received macro block data in the cache is compressed, the size of the compressed data and the size of the decompressed data respectively to obtain macro block basic information;
c. and according to the basic information of the macro block, performing decompression operation, directly outputting the macro block if the macro block is not compressed, and performing decompression by using a BI RLE8 decompression algorithm if the macro block is compressed.
d. And c, returning to the step b, decompressing the data of the next macro block until all the macro block processing is finished.
Compared with the traditional RLE compression algorithm, the invention uses the strategy of macro blocks to divide large blocks into small blocks, ensures no coupling among the small blocks, has good fault tolerance and more stable system; by using a macro block strategy, large block data is divided into macro blocks with predictable sizes, so that a transmission system can conveniently transmit the macro blocks; and a threshold coefficient method is adopted in the macro block, the compression threshold is dynamically adjusted, and the processing is more flexible.
Drawings
FIG. 1 is a block diagram schematically showing the construction of an apparatus for operating a stroke compression method according to the present invention;
FIG. 2 is a block diagram of a macroblock divider and a compression threshold coefficient counter according to the present invention;
FIG. 3 is a schematic diagram of the data compression process of the present invention;
FIG. 4 is a schematic diagram of the data decompression process of the present invention.
Detailed Description
As shown in fig. 1, a stroke compression device based on RLE principle includes:
an original data reading interface 111 for selecting an original file stored on a hard disk of a PC and storing the content of the selected file in an original data buffer;
an original data buffer 113 for storing original data before compression;
a macroblock divider 112, which provides a macroblock size setting interface and controls the division of the data in the original data buffer by using the set macroblock size value;
the macro block precompressor 114 is used for precompressing original macro block data, wherein precompression only carries out compression algorithm processing, and outputs the size of the compressed macro block but does not output compressed data;
a compression threshold coefficient counter 115 providing a compression threshold coefficient setting interface and providing a compression threshold coefficient to the macroblock compressor;
the macro block compressor 116 is used for performing compression judgment according to the output result of the macro block preprocessor and the output result of the compression threshold coefficient counter, and generating two outputs according to the compression judgment result, wherein the first output is a macro block head + an uncompressed macro block, the second output is a macro block head + a compressed macro block, and the RLE algorithm adopted by the macro block compressor is a BI RLE8 algorithm;
a transmission device 120 for transmitting the compressed macroblock data from the data compression end 110 to the data decoding end 130;
a compressed data receiver 131, configured to receive the compressed macroblock data from the transmission apparatus and store the compressed macroblock data in a compressed data buffer;
a compressed data buffer 132 for storing data to be decompressed;
a macroblock information extractor 133 for extracting information in the macroblock header and sending the information to the macroblock decompressor;
the macroblock decompressor 134 performs decompression processing according to the macroblock information provided by the macroblock information extractor, directly outputs macroblock data to an output original data buffer if the macroblock information indicates that the macroblock is not compressed, and performs decompression processing by using a BI RLE8 algorithm if the macroblock information indicates that the macroblock is compressed, wherein the decompression needs to be performed circularly until the entire compressed macroblock is decompressed.
The output raw data buffer 135 stores decompressed raw data, which is raw data on the compression system.
The macroblock divider 210 sets a default macroblock size parameter by itself during initialization, as shown in fig. 2, during operation, an external device may set the macroblock size parameter through its setting interface 211, after receiving a setting request, the macroblock divider first determines whether the requested value is legal, if so, the parameter is stored in the macroblock size parameter storage area 212, and if not, returns a setting error result to the external device, and maintains the current macroblock size parameter. The newly set macroblock size parameter is output via the control interface 213 and is validated the next time the macroblock compressor fetches the macroblock data.
As shown in fig. 2, in the operation process, the external device may set a compression threshold coefficient through the setting interface 221, and after receiving the setting request, the compression threshold coefficient counter first determines whether the requested value is legal, if so, the coefficient is stored in the compression threshold parameter storage area 222, and if not, returns a setting error result to the external device, and maintains the current compression threshold parameter. The newly set compression threshold parameter is output through the control interface 223 and is validated at the next comparison by the macroblock compressor.
As shown in fig. 3, in the working process of the digital printing machine, the image data to be printed is generally located in the computer and needs to be transmitted to the digital printing machine through a network or a data line.
And the decompressed image data to be printed is rotated and the like according to the requirement and then is sent to a nozzle of the digital printing machine to print the image.
When data compression is carried out, original image data to be printed are read into a cache from a computer hard disk, the image data to be printed in the cache are divided according to the size of a preset macro block, and a plurality of macro block data are obtained through division.
The BI RLE8 macro block pre-compression is performed on the macro block data, the output of actual data is not generated in the compression process, and only the size of the macro block which is obtained after the current compression is recorded along with the progress of the compression algorithm.
After pre-compression is completed, a compression ratio result is calculated according to the actual size of the macro block and the size of the macro block after compression, the compression ratio result is compared with a preset compression threshold coefficient, and corresponding processing is carried out according to the comparison result.
And if the result of the compression rate after pre-compression is larger than the compression threshold coefficient, performing macro block compression, outputting the result as a macro block head + a compressed macro block, performing compression circularly by using a BI RLE8 algorithm until the whole macro block data is completely compressed, and transmitting the compressed data to a digital printing machine.
And if the result of the compression ratio after pre-compression is less than or equal to the compression threshold coefficient, the macro block is not compressed, and the output is directly output to a digital printing machine in the form of a macro block head and an uncompressed macro block.
As shown in fig. 4, the digital printer end receives the data sent by the computer and then decompresses the data, extracts the macroblock header written in the compressed data when the data is compressed, analyzes the macroblock header information, and identifies whether the data is compressed.
And removing the macro block header information of the uncompressed data to obtain the recovered image data to be printed.
For compressed data, the macroblock decoder executes a BI RLE8 decompression algorithm to decompress the data, and the decompressed image data to be printed is obtained.
And then, rotating and the like the image data to be printed according to the requirement, and sending the image data to a digital printing machine nozzle to print the image.

Claims (3)

1. A run-length compression method based on RLE principle comprises two processes of data compression and data decompression, and is characterized in that,
the data compression process comprises the following steps:
a. reading original data into an original data buffer;
b. dividing original data in an original data buffer according to a preset macro block size to obtain a plurality of macro block data;
c. precompression of the macroblock data using the BI _ RLE8 algorithm;
d. the compression ratio of the pre-compressed macro block data is compared with a compression threshold coefficient, if the compression ratio of the pre-compressed macro block data is larger than the compression threshold coefficient, the macro block data is compressed and output after compression, otherwise, the original macro block is used for directly output;
e. returning to the step b, compressing the data of the next macro block;
the data decompression process comprises the following steps:
a. receiving the macro block data output by the data compression process into a compressed data buffer;
b. identifying whether the received macro block data in the compressed data buffer is compressed, the size of the compressed data and the size of the decompressed data respectively to obtain macro block basic information;
c. according to the basic information of the macro block, carrying out decompression operation, if the macro block is not compressed, directly outputting, and if the macro block is compressed, carrying out decompression by using a BI _ RLE8 decompression algorithm;
d. and c, returning to the step b, decompressing the data of the next macro block until all the macro block processing is finished.
2. A run-length compression method operating device based on the RLE principle comprises a data compression end (110), a data decompression end (130) and a transmission device (120) used for transmitting data from the data compression end (110) to the data decompression end (130),
the data compression end (110) comprises:
the original data reading interface (111) is used for selecting original files stored on a hard disk of the PC;
a raw data buffer (113) for storing the raw file selected by the raw data reading interface (111);
a macro block divider (112) which provides a macro block size setting interface and divides the data of the original file in the original data buffer (113) into a plurality of macro block data by using the set macro block size value;
a macroblock precompressor (114) for precompressing all macroblock data in the raw data buffer (113) using the BI _ RLE8 algorithm;
a compression threshold coefficient counter (115) providing a compression threshold coefficient setting interface and providing a compression threshold coefficient;
the macro block compressor (116) performs compression judgment according to the output result of the macro block precompressor (114) and the output result of the compression threshold coefficient counter (115), performs data compression on the macro block if the compression rate after precompression is greater than the compression threshold coefficient, and outputs the compressed data, otherwise, directly outputs the compressed data by using the original macro block;
the data decompression end (130) comprises:
a compressed data receiver (131) for receiving the macro block data to be decompressed output by the data compression terminal (110) from the transmission device (120);
a compressed data buffer (132) for storing the macroblock data to be decompressed received by the compressed data receiver (131);
a macroblock information extractor (133) for extracting macroblock information of the macroblock data to be decompressed;
a macro block decompressor (134) for decompressing according to the macro block information provided by the macro block information extractor (133), if the macro block information indicates that the macro block is not compressed, directly outputting the macro block data to an output original data buffer, if the macro block information indicates that the macro block is compressed, decompressing by using a BI _ RLE8 decompression algorithm, wherein the decompression needs to be circularly performed until the whole compressed macro block is decompressed;
and an output original data buffer (135) for storing data outputted from the macroblock decompressor (134).
3. A journey compression method based on RLE principle for digital printing machine image data comprises two processes of data compression and data decompression,
the data compression process comprises the following steps:
a. reading image data to be printed of the digital printing machine into an original data buffer;
b. dividing image data to be printed in an original data buffer according to a preset macro block size to obtain a plurality of macro block data;
c. precompression of the macroblock data using the BI _ RLE8 algorithm;
d. the compression ratio of the pre-compressed macro block data is compared with a compression threshold coefficient, if the compression ratio of the pre-compressed macro block data is larger than the compression threshold coefficient, the macro block data is compressed and output after compression, otherwise, the original macro block is used for directly output;
e. returning to the step b, compressing the data of the next macro block;
the data decompression process comprises the following steps:
a. receiving the macro block data output by the data compression process into a compressed data buffer;
b. identifying whether the received macro block data in the compressed data buffer is compressed, the size of the compressed data and the size of the decompressed data respectively to obtain macro block basic information;
c. according to the basic information of the macro block, carrying out decompression operation, if the macro block is not compressed, directly outputting, and if the macro block is compressed, carrying out decompression by using a BI _ RLE8 decompression algorithm;
d. and c, returning to the step b, decompressing the data of the next macro block until all the macro block processing is finished.
CN201010039585XA 2010-01-07 2010-01-07 Stroke compression method and device based on RLE principle Expired - Fee Related CN101777366B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201010039585XA CN101777366B (en) 2010-01-07 2010-01-07 Stroke compression method and device based on RLE principle

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201010039585XA CN101777366B (en) 2010-01-07 2010-01-07 Stroke compression method and device based on RLE principle

Publications (2)

Publication Number Publication Date
CN101777366A CN101777366A (en) 2010-07-14
CN101777366B true CN101777366B (en) 2011-12-07

Family

ID=42513791

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201010039585XA Expired - Fee Related CN101777366B (en) 2010-01-07 2010-01-07 Stroke compression method and device based on RLE principle

Country Status (1)

Country Link
CN (1) CN101777366B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101834236B1 (en) 2013-04-02 2018-03-06 주식회사 칩스앤미디어 Method and apparatus for processing video

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1855996A (en) * 2005-04-19 2006-11-01 展讯通信(上海)有限公司 Encoding method for static image compression
CN1920883A (en) * 2005-08-26 2007-02-28 乐金电子(昆山)电脑有限公司 Image compression and recovery method

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1855996A (en) * 2005-04-19 2006-11-01 展讯通信(上海)有限公司 Encoding method for static image compression
CN1920883A (en) * 2005-08-26 2007-02-28 乐金电子(昆山)电脑有限公司 Image compression and recovery method

Also Published As

Publication number Publication date
CN101777366A (en) 2010-07-14

Similar Documents

Publication Publication Date Title
RU2417518C2 (en) Efficient coding and decoding conversion units
KR101737294B1 (en) Methods and devices for source-coding and decoding of data involving symbol compression
US7257264B2 (en) Image processing apparatus and method for compression-encoding image area information
US8874531B2 (en) Methods and systems for encoding/decoding files and transmissions thereof
JP5583106B2 (en) Data decoding
US8456332B2 (en) Systems and methods for compression of logical data objects for storage
US9462285B2 (en) Video transmission system having reduced memory requirements
RU2503138C2 (en) Embedded graphics coding for images with sparse histograms
US10282863B2 (en) Lossless compression of fragmented image data
US11139827B2 (en) Conditional transcoding for encoded data
US10666289B1 (en) Data compression using dictionary encoding
KR101224397B1 (en) Data File Compressing Apparatus and Method, Image Forming Apparatus
KR20240078422A (en) Conditional transcoding for encoded data
US20020131505A1 (en) Method and apparatus for temporal wavelet compression
KR20150126858A (en) Entropy modifier and method
CN101777366B (en) Stroke compression method and device based on RLE principle
KR101667989B1 (en) Method and device for encoding an input bit sequence and corresponding decoding method and device
EP2381686A1 (en) Apparatus for parallel entropy encoding and decoding
US20230239470A1 (en) Video encoding and decoding methods, encoder, decoder, and storage medium
CN117082257A (en) Sub-stream interleaving method
KR20080045842A (en) Apparatus and method for image compression and restoring
EA044215B1 (en) ENTROPY CODING OF SIGNAL Amplification

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20111207

CF01 Termination of patent right due to non-payment of annual fee