CN102523444B - A kind of monochrome bitmap compression method and system thereof - Google Patents

A kind of monochrome bitmap compression method and system thereof Download PDF

Info

Publication number
CN102523444B
CN102523444B CN201110372999.9A CN201110372999A CN102523444B CN 102523444 B CN102523444 B CN 102523444B CN 201110372999 A CN201110372999 A CN 201110372999A CN 102523444 B CN102523444 B CN 102523444B
Authority
CN
China
Prior art keywords
continuous
data
compression
threshold
designated symbol
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
CN201110372999.9A
Other languages
Chinese (zh)
Other versions
CN102523444A (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.)
Huizhou Desay SV Automotive Co Ltd
Original Assignee
Huizhou Desay SV Automotive 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 Huizhou Desay SV Automotive Co Ltd filed Critical Huizhou Desay SV Automotive Co Ltd
Priority to CN201110372999.9A priority Critical patent/CN102523444B/en
Publication of CN102523444A publication Critical patent/CN102523444A/en
Application granted granted Critical
Publication of CN102523444B publication Critical patent/CN102523444B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

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

Abstract

The present invention relates to compression method correlative technology field, particularly a kind of monochrome bitmap compression method and system thereof.Described monochrome bitmap adopts binary data to represent, described method comprises: scan the data of a monochrome bitmap, when run into exceed preset first threshold value continuous 1 or exceed preset first threshold value continuous 0 time, perform the compression step generating packed data, otherwise perform the uncompressed step generating unpacked data.The compression algorithm that the present invention passes through, has effect clearly for reducing mainboard central authorities processing single chip because of the time loss that produces of entirety display data retransmission, thus can improve the frequency refreshed at guiding aircraft interface, to arrive more smooth impression to client.

Description

A kind of monochrome bitmap compression method and system thereof
Technical field
The present invention relates to compression method correlative technology field, particularly a kind of monochrome bitmap compression method and system thereof.
Background technology
Car multimedia entertainment system, primarily of main frame (CD player), separate type display screen, separating type key plate, steering wheel controller composition.Wherein main frame transmits display data to separate type display screen by CGI communication mode.
Existing multi-functional navigation host can directly replace separate type display screen, can realize all Presentation Functions of former car separate type display screen.
But in the BMP monochrome bitmap data that the display data of the actual transmission of the CD player of automobile are 256*76 pixel, each two field picture is 2432 byte, display screen is sent to by Common Gateway Interface (CGI, the CAN Graphic Interface) communication mode of 625Kbps with the cycle of 70ms.For multi-functional navigation host, because function is complicated, the data processing pressure of this degree is very large, must be received and be transmitted to display module again after processing CGI data to carry out interface display by central processing module.In order to ensure the smooth degree at interface, the suitable refresh cycle must be ensured, and the data retransmission amount of every frame 2432byte, beyond doubt a difficult point.
Existing in computer realm, solve the transmission problem of big data quantity, generally have employed compression algorithm.As Chinese patent " the image compression " (patent No.: 00800959.7); disclose the method for compressing one group of rest image; comprise step: based on image color content similarities, according at least one Measurement of Similarity between Two Images, image is formed two clusters; at least one representational image is identified in each cluster; other images whole in each cluster are identified as non-representational image, use such as to damage (such as JPEG) or lossless coding algorithm and to encode independently this representational image of each cluster; Further, use this representational image from this cluster as a benchmark image each non-representational image forecasting encoding to each cluster.
But existing image compression algorithm is all comparatively complicated, and in embedded systems, due to the restriction of single-chip microcomputer performance, the compression algorithm that major part is complicated is all not suitable for running, and simple algorithm, generally also do not reach excellent compression ratio, the improvement degree transmitted for data is very little.Embedded system data compression difficult or compression effectiveness are not good, and cause interface to refresh slowly, central processing module resource consumption is serious, even affects overall performance.
Summary of the invention
The invention provides a kind of monochrome bitmap compression method and system thereof, to solve the technical problem that prior art exists.
A kind of monochrome bitmap compression method, described monochrome bitmap adopts binary data to represent, each pixel of described bitmap is only represented by a bit, and described method comprises:
The data of a monochrome bitmap are scanned, when run into do not exceed preset first threshold value continuous 1 or exceed preset first threshold value continuous 0 time, perform and generate the uncompressed step of unpacked data.When run into exceed preset first threshold value continuous 1 or exceed preset first threshold value continuous 0 time, judging whether to run into and exceed continuous 1 of default Second Threshold or exceed continuous 0 of default Second Threshold, is perform multibyte compression step; Otherwise perform the byte compression step generating packed data.
As a kind of preferred version, it is characterized in that carrying out compression process for redundant informations (namely occur continuously in a large number 1 or 0) a large amount of in view data, described compression step comprises:
The data that generation instruction generates are the compression designated symbol of packed data;
Generate and indicate the packed data generated for representing 01 designated symbols of continuous 1 or continuous 0;
Generate the number designated symbol indicating the packed data generated to comprise continuous 1 or continuous 0 number;
The combination of compression designated symbol, 01 designated symbols and number designated symbol, generate packed data.
As further preferred version, data reservation process is carried out in the interval for partial information more complicated in view data (namely occurring between pixel repeatedly changing), and described compression step comprises further:
When number when continuous 1 or continuous 0 is greater than default Second Threshold, perform following steps:
(1) data that generation instruction generates are the compression designated symbol of packed data;
(2) generation indicates the packed data generated for representing 01 designated symbols of continuous 1 or continuous 0;
(3) if continuous 1 or continuous 0 number be greater than Second Threshold, then generate the number designated symbol indicating the packed data that generates to comprise continuous 1 or continuous 0 number, the value of described number designated symbol is Second Threshold, performs step (5);
(4) if continuous 1 or continuous 0 number be less than or equal to Second Threshold, then generate the number designated symbol indicating the packed data generated to comprise continuous 1 or continuous 0 number, the value of described number designated symbol is the number of continuous 1 or continuous 0, performs step (5);
(5) the combination of compression designated symbol, 01 designated symbols and number designated symbol, generate packed data, if continuous 1 or continuous 0 number be greater than Second Threshold, then calculate continuous 1 or continuous 0 number deduct the surplus value after Second Threshold, using this surplus value as continuous 1 of next packed data or continuous 0 number, perform step (1), otherwise exit.
As further preferred version, use the unit that byte describes as packed data, described packed data is 8 bit binary data, comprise the 0th to the 7th, wherein the 7th is compression designated symbol, and the 6th is 01 designated symbols, and the 5th ~ the 0th is number designated symbol.
As a kind of preferred version, use byte to describe the consecutive identical data of 7 to 63 bits, described first threshold is 7
Further, when consecutive identical data are more than adopting packed compressed method when 63 bit, described Second Threshold is 63.
As a kind of preferred version, when scanning the position section of image information more complicated, adopt uncompressed step, described uncompressed step comprises:
The data that generation instruction generates are the uncompressed designated symbol of unpacked data;
Using being less than or equal to one or more binary characters of first threshold as uncompressed numerical symbol;
Uncompressed designated symbol and uncompressed numerical value symbol combination are produced unpacked data.
As further preferred version, use the unit that byte describes as unpacked data, described unpacked data is 8 bit binary data, and comprise the 0th to the 7th, wherein the 7th is uncompressed designated symbol, and the 6th ~ the 0th is uncompressed numerical symbol.
A kind of embedded system, the central processing module that described embedded system comprises acquisition monochrome bitmap data and compression monochrome bitmap data and the display module be connected with central processing module, described central processing module adopts the compression method described in any one of claim 1 ~ 8 to process obtained monochrome bitmap data, and treated packed data and unpacked data are transferred to display module process according to the display sequence of image, and be responsible for decompress(ion) and display by display module.Described central processing module adopts 16 chip microcontroller, and display module adopts 32 single-chip microcomputers and 24 true color screens to realize.
The compression algorithm that the present invention passes through, has effect clearly to reducing mainboard central authorities processing single chip because of the time loss that produces of entirety display data retransmission, thus can improve the frequency refreshed at guiding aircraft interface, to arrive more smooth impression to client.
Accompanying drawing explanation
Fig. 1 is algorithm example one;
Fig. 2 is algorithm example two;
Fig. 3 is algorithm example three;
Fig. 4 is schematic flow sheet of the present invention.
Embodiment
Below in conjunction with the drawings and specific embodiments, the present invention will be further described in detail.
Existing BI_RLE8 compression algorithm
WINDOWS3.0,3.1 bitmap file in have employed this compression method.This compression method is encoded with 2 byte as base unit.Wherein byte1 defines the color number of repetition of specifying with byte2.As the 0x0504 that encodes represents that display 5 color values are the pixel of 0x04 continuously from current location.
The algorithm that BI_RLE8 is derivative
BI_RLE8 compression algorithm is applicable to the compression of 256 color bitmaps, when its algorithm idea is applied to monochrome bitmap, can draw the arthmetic statement that BI_RLE8 is derivative:
By scan-data by turn, the data repeated are gone to describe with a word (2byte), and what bit15 showed compression is the number that continuous print 1 or continuous print 0, bit0 ~ bit15 describe continuous print 1 or 0.
Example: before compression: 0xFFFF 000000 FFFF 000000
After compression: 0x8,010 0,018 8,010 0018
But run into data when repeatedly changing, compression effectiveness is not obvious.The worst situation is the data that 2 bytes remove to describe 1bit.
The display data of the actual transmission of CD player of automobile are monochromatic BMP data bitmap, according to the feature (monochromatic BMP data bitmap) transmitting data, and the travel compression algorithm of design improvement, compressed by data bitmap, arthmetic statement is as follows:
byte compress mode:
Integral Thought is again resolve BMP data bitmap by describing continuous print 1 with the number of continuous print 0.Adopt byte for describing unit, form is:
Bit7: show whether data compression, 1 is compression, and 0 is uncompressed;
Bit6 ~ Bit0: what show to compress be continuous print 1 or continuous print 0,1 is 1 for what describe if bit7 is 1, bit6,0 be description 0, bit5 ~ bit0 totally 6 bits the number of continuous print 1 or 0 is described.; If bit7 be 0, bit6 and bit5 ~ bit0 totally 7 bits the data not needing to compress are described.
multibyte compress mode:
The situation (continuous position is greater than 64) that unit is not enough to describe a large amount of position is continuously described, with the continuous position that new description unit description is remaining if there is one.
Such as there are 85 continuous 1, then adopt the packed data of two bytes to represent, respectively:
0b1111111, represents continuous 63 1;
0b1010110, represents continuous 22 1.
In data upon compression, the data of compression and the data without the need to compression may be had simultaneously.
Such as:
Data of description=0b11001111, represents that this byte is packed data, and real data is occur 15 1 continuously;
Data of description=0b00101011, represent that this byte is uncompressed data, real data is 0b0101011;
compression algorithm simple process:
As shown in Figure 4,
Step S101, scanning initial data, the cumulative number (SUM) occurring continuous print 0 or 1;
Step S102, when SUM is less than or equal to first threshold 7, describes by uncompressed mode, performs step S101, otherwise, perform step S103;
Step S103, when SUM is greater than 7 and is less than or equal to Second Threshold 63, describe, and 1 byte can describe by compress mode, performs step S101, otherwise performs step S104;
Step S103, when SUM is greater than 63, describes by compress mode, and needs more than 1 byte to describe, and uses multiple description byte, until describe all continuous positions.After describing, return step 1, circulation.
By data bitmap being compressed with the travel compression algorithm improved voluntarily, ensure that higher compression ratio, and algorithm itself is applicable to single-chip microcomputer operation.The size of all interface datas is all the monochrome bitmap of 2432byte(resolution 256*76), use 16 single-chip microcomputers of running frequency 40M to compress.Use the channel of 280Kbps to carry out the transmission of packed data between central processing module and display module, use 32 single-chip microcomputers that running frequency is 500M to carry out decompress(ion) restoring data.Algorithm effect example is as follows:
As Fig. 1: after compression, size 1257byte, 13.5ms consuming time;
As Fig. 2: after compression, size 896byte, 10ms consuming time;
As Fig. 3, after compression, size 396byte, 3.5ms consuming time;
Compression effectiveness contrast before and after algorithm improvement, as shown in table 1.
Table 1: compression algorithm Contrast on effect
In the scheme of the CGI data retransmission of the travel compression algorithm after not using improvement, use the 280Kbps communication channel between central processing module and display module to carry out the forwarding of CGI data, need the time consuming 68ms.
The CGI data forwarding scheme of the travel compression algorithm after employing improvement, the distribution situation of time loss respectively in the interface data situation of such as figure 1 ﹑ 2 ﹑ 3 is as following table:
Table 2: the statistics of time loss under different interface conditions
Can find out, image is simpler, and compression ratio is higher, and compression time is fewer, and simultaneously the transmission time correspondingly also can reduce on year-on-year basis.The algorithm of decompress(ion) is relatively simple, and display module processing speed is fast, and time loss is far smaller than 1ms.And by the display interface analysis of a large amount of original-pack CD player, compression ratio all can ensureing more than 50%, contrasts with not adopting the CGI data forwarding scheme of the travel compression after improvement, forwarding the time average consumed and saving 36.1ms, saving the time of 53.1%.There is effect clearly for reducing mainboard central authorities processing single chip because of the time loss that produces of entirety display data retransmission, thus the frequency refreshed at guiding aircraft interface can be improved, to arrive more smooth impression to client.

Claims (9)

1. a monochrome bitmap compression method, described monochrome bitmap adopts binary data to represent, it is characterized in that each pixel of described bitmap is only represented by a bit, described method comprises:
The data of a monochrome bitmap are scanned, when run into do not exceed preset first threshold value continuous 1 or do not exceed preset first threshold value continuous 0 time, perform and generate the uncompressed step of unpacked data;
When run into exceed preset first threshold value continuous 1 or exceed preset first threshold value continuous 0 time, judging whether to run into and exceed continuous 1 of default Second Threshold or exceed continuous 0 of default Second Threshold, is perform multibyte compression step; Otherwise perform the byte compression step generating packed data;
Described multibyte compression step comprises:
(1) data that generation instruction generates are the compression designated symbol of packed data;
(2) generation indicates the packed data generated for representing 01 designated symbols of continuous 1 or continuous 0;
(3) if continuous 1 or continuous 0 number be greater than Second Threshold, then generate the number designated symbol indicating the packed data that generates to comprise continuous 1 or continuous 0 number, the value of described number designated symbol is Second Threshold, performs step (5);
(4) if continuous 1 or continuous 0 number be less than or equal to Second Threshold, then generate the number designated symbol indicating the packed data generated to comprise continuous 1 or continuous 0 number, the value of described number designated symbol is the number of continuous 1 or continuous 0, performs step (5);
(5) the combination of compression designated symbol, 01 designated symbols and number designated symbol, generate packed data, if continuous 1 or continuous 0 number be greater than Second Threshold, then calculate continuous 1 or continuous 0 number deduct the surplus value after Second Threshold, using this surplus value as continuous 1 of next packed data or continuous 0 number, perform step (1), otherwise exit.
2. compression method according to claim 1, described byte compression step comprises:
The data that generation instruction generates are the compression designated symbol of packed data;
Generate and indicate the packed data generated for representing 01 designated symbols of continuous 1 or continuous 0;
Generate the number designated symbol indicating the packed data generated to comprise continuous 1 or continuous 0 number;
The combination of compression designated symbol, 01 designated symbols and number designated symbol, generate packed data.
3. compression method according to claim 2, it is characterized in that the unit using byte to describe as packed data, described packed data is 8 bit binary data, comprise the 0th to the 7th, wherein the 7th is compression designated symbol, 6th is 01 designated symbols, and the 5th ~ the 0th is number designated symbol.
4. compression method according to claim 1, is characterized in that, use byte to describe the consecutive identical data of 7 to 63 bits, described first threshold is 7.
5. compression method according to claim 1, is characterized in that, described Second Threshold is 63.
6. compression method according to claim 1, is characterized in that, described uncompressed step comprises:
The data that generation instruction generates are the uncompressed designated symbol of unpacked data;
Using being less than or equal to one or more binary characters of first threshold as uncompressed numerical symbol;
Uncompressed designated symbol and uncompressed numerical value symbol combination are produced unpacked data.
7. compression method according to claim 6, is characterized in that, uses the unit that byte describes as unpacked data, described unpacked data is 8 bit binary data, comprise the 0th to the 7th, wherein the 7th is uncompressed designated symbol, and the 6th ~ the 0th is uncompressed numerical symbol.
8. one kind adopts the embedded system of the compression method described in any one of claim 1 ~ 7, it is characterized in that, the central processing module that described embedded system comprises acquisition monochrome bitmap data and compression monochrome bitmap data and the display module be connected with central processing module, described central processing module adopts the compression method described in any one of claim 1 ~ 7 to process obtained monochrome bitmap data, and treated packed data and unpacked data are transferred to display module process according to the display sequence of image, and be responsible for decompress(ion) and display by display module.
9. embedded system according to claim 8, is characterized in that, described central processing module adopts 16 chip microcontroller, and display module adopts 32 single-chip microcomputers and 24 true color screens to realize.
CN201110372999.9A 2011-11-22 2011-11-22 A kind of monochrome bitmap compression method and system thereof Active CN102523444B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201110372999.9A CN102523444B (en) 2011-11-22 2011-11-22 A kind of monochrome bitmap compression method and system thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201110372999.9A CN102523444B (en) 2011-11-22 2011-11-22 A kind of monochrome bitmap compression method and system thereof

Publications (2)

Publication Number Publication Date
CN102523444A CN102523444A (en) 2012-06-27
CN102523444B true CN102523444B (en) 2015-10-14

Family

ID=46294224

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201110372999.9A Active CN102523444B (en) 2011-11-22 2011-11-22 A kind of monochrome bitmap compression method and system thereof

Country Status (1)

Country Link
CN (1) CN102523444B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102855643A (en) * 2012-07-31 2013-01-02 北京天神互动科技有限公司 Method for compressing and decompressing font library files and monochrome images
CN104468044A (en) * 2014-12-05 2015-03-25 北京国双科技有限公司 Data compression method and device applied to network transmission
CN107147914A (en) * 2017-06-07 2017-09-08 广东工业大学 A kind of embedded system and monochrome bitmap compression method, main frame
CN108777800A (en) * 2018-06-25 2018-11-09 广州科政数码科技有限公司 The compression of electronic shelf label image data, decompression, processing method and system
CN108986179B (en) * 2018-07-11 2023-03-28 黑龙江天有为电子股份有限公司 ALPHA fusion method for single-color TFT multi-layer of automobile instrument
CN109039342B (en) * 2018-08-24 2022-12-06 国网河北省电力有限公司电力科学研究院 Compression method and system and decompression method and system of output data
CN114301983A (en) * 2021-11-18 2022-04-08 江西兴泰科技有限公司 Method and system for compressing bytes of electronic ink screen picture, electronic equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5689255A (en) * 1995-08-22 1997-11-18 Hewlett-Packard Company Method and apparatus for compressing and decompressing image data
CN101174328A (en) * 2006-11-01 2008-05-07 北京海尔集成电路设计有限公司 Binary image coding and decoding method
CN101272442A (en) * 2007-03-21 2008-09-24 杭州波导软件有限公司 Digital image nondestructive compression method and device, resolution method and image encoder

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7057770B2 (en) * 2003-01-30 2006-06-06 Case Robert M None-of-the-above digital halftone compression and decompression
JP2008035230A (en) * 2006-07-28 2008-02-14 Fujifilm Corp Data compression apparatus and data compression program

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5689255A (en) * 1995-08-22 1997-11-18 Hewlett-Packard Company Method and apparatus for compressing and decompressing image data
CN101174328A (en) * 2006-11-01 2008-05-07 北京海尔集成电路设计有限公司 Binary image coding and decoding method
CN101272442A (en) * 2007-03-21 2008-09-24 杭州波导软件有限公司 Digital image nondestructive compression method and device, resolution method and image encoder

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
游程长度编码算法的研究;刘冰;《天津理工学院学报》;20011231;第17卷(第4期);第77-81页 *

Also Published As

Publication number Publication date
CN102523444A (en) 2012-06-27

Similar Documents

Publication Publication Date Title
CN102523444B (en) A kind of monochrome bitmap compression method and system thereof
CN103858433B (en) Layered entropy encoding and decoding
CN102223526B (en) Method and related device for coding and decoding image
CN1332300C (en) Remote display processing method based on server end/client end structure
CN105191304B (en) Image encoding method and device and relevant picture decoding method and device according to pixel data execution position flat scanning coding
CN109842803B (en) Image compression method and device
CN101197578B (en) Run encoding method, run encoding and decoding system and color data storage method
CN106170922B (en) The source code of data and decoded device and method
CN101796842A (en) An efficient image compression scheme to minimize storage and bus bandwidth requirements
CN102821279A (en) Picture compression method keeping with alpha channel
CN104718754A (en) Image compression method and apparatus for encoding pixel data of frame into interleaved bit-stream, and related image decompression method and apparatus
CN102986217B (en) The method and apparatus to process frame of video by using the difference between pixel value
CN103124350A (en) Image compression method and device based on run-length encoding (RLE)
CN105187845A (en) Video data decoding device and method
CN103152054A (en) Method and apparatus for arithmetic coding
CN105635732A (en) Adaptive sampling point compensation coding method and device, and method and device for decoding video code stream
CN104575427A (en) High-compression-ratio lossless image compression method suitable for embedded system decoding
CN103997651A (en) Data compression method and device for composite images
US10368079B2 (en) Method and apparatus for image compression that employs multiple indexed color history buffers
CN106791855B (en) Method and system for reducing cost of agent management system
US6721456B1 (en) Color image data and control bit compression scheme with run length encoding
Kim et al. Design and implementation of display stream compression decoder with line buffer optimization
VidyaSagar et al. Modified run length encoding scheme for high data compression rate
CN105791819B (en) The decompression method and device of a kind of frame compression method of image, image
CN104021121A (en) Method, device and server for compressing text data

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C53 Correction of patent for invention or patent application
CB02 Change of applicant information

Address after: 516006 Guangdong province Huizhou Zhongkai hi tech Industrial Development Zone Pearl River Road No. 1

Applicant after: HUIZHOU DESAY SV AUTOMOTIVE CO., LTD.

Address before: 516006 Guangdong province Huizhou Zhongkai hi tech Industrial Development Zone Pearl River Road No. 1

Applicant before: Huizhou Desay SV Auto. Electronics Co., Ltd.

COR Change of bibliographic data

Free format text: CORRECT: APPLICANT; FROM: HUIZHOU DESAY SV AUTO. ELECTRONICS CO., LTD. TO: HUIZHOU DESAY SV AUTO ELECTRONICS CO., LTD.

C14 Grant of patent or utility model
GR01 Patent grant