CN107393291A - A kind of compression of red outer code data and decompression method - Google Patents
A kind of compression of red outer code data and decompression method Download PDFInfo
- Publication number
- CN107393291A CN107393291A CN201710550255.9A CN201710550255A CN107393291A CN 107393291 A CN107393291 A CN 107393291A CN 201710550255 A CN201710550255 A CN 201710550255A CN 107393291 A CN107393291 A CN 107393291A
- Authority
- CN
- China
- Prior art keywords
- array
- data
- level
- high level
- template
- 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.)
- Pending
Links
- 238000007906 compression Methods 0.000 title claims abstract description 55
- 230000006835 compression Effects 0.000 title claims abstract description 54
- 238000000034 method Methods 0.000 title claims abstract description 38
- 230000006837 decompression Effects 0.000 title claims abstract description 34
- 238000013144 data compression Methods 0.000 claims abstract description 11
- 230000005611 electricity Effects 0.000 claims description 3
- 238000003491 array Methods 0.000 claims 1
- 230000005540 biological transmission Effects 0.000 abstract description 8
- 238000005516 engineering process Methods 0.000 description 5
- 238000005498 polishing Methods 0.000 description 2
- 241001269238 Data Species 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 230000009189 diving Effects 0.000 description 1
- 238000005265 energy consumption Methods 0.000 description 1
- 238000005194 fractionation Methods 0.000 description 1
- 230000006870 function Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G08—SIGNALLING
- G08C—TRANSMISSION SYSTEMS FOR MEASURED VALUES, CONTROL OR SIMILAR SIGNALS
- G08C23/00—Non-electrical signal transmission systems, e.g. optical systems
- G08C23/04—Non-electrical signal transmission systems, e.g. optical systems using light waves, e.g. infrared
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/41—Structure of client; Structure of client peripherals
- H04N21/422—Input-only peripherals, i.e. input devices connected to specially adapted client devices, e.g. global positioning system [GPS]
- H04N21/42204—User interfaces specially adapted for controlling a client device through a remote control device; Remote control devices therefor
- H04N21/42206—User interfaces specially adapted for controlling a client device through a remote control device; Remote control devices therefor characterized by hardware details
- H04N21/42221—Transmission circuitry, e.g. infrared [IR] or radio frequency [RF]
Abstract
The invention discloses a kind of compression of red outer code data and decompression method, this method to include:Red outer code data is split as two groups of data of high level array and low level array first;Then data compression is carried out, different pieces of information in high level array can be stored in template array, template array is encoded to obtain high level template byte stream, then by each data element in high level array, corresponding subscript is stored in subscript array in template array, subscript array is encoded to obtain high level data byte stream, finally high level template byte stream and high level data byte stream are merged, high-level compression byte stream is obtained, next carries out low level array compression according to the compression method of high level array;Finally high-level compression byte stream is merged with low level packed byte stream, obtains the compressed data of infrared code.The data compression of the present invention and decompression method, improve the transmission speed of red outer code data and the security of data transfer.
Description
Technical field
The present invention relates to data compression and decompression technical field, the compression of more particularly to a kind of red outer code data and decompression
Compression method.
Background technology
With the popularization of intelligent television, TV remote controller also upgrades to blue Tooth remote controller from traditional IR remote controller.
The development of bluetooth low energy consumption technologies, make to be risen by original infrared unidirectional unreliable communication between TV remote controller and TV main frame
Level is two-way reliable communicating, and television main can reliably send data to remote control, and remote control also can reliably be sent
Data are to television set.At present, in order to realize by the use of blue Tooth remote controller as family control centre control parlor in all household electrics
The function of device, television manufacturer is generally by the use of intelligent television as carrier, each household electrical appliance gathered by the Internet download
Red outer code data corresponding to remote control, and the red outer code data being collected into is sent to blue Tooth remote controller from intelligent television end, lead to
The infrared module crossed on blue Tooth remote controller converts data to the infrared waves sent out, to realize the control of household electrical appliance.
In the prior art, for the consideration to blue Tooth remote controller power saving, between intelligent television main frame and blue Tooth remote controller
Data transmission bauds is slower, generally 400~500 byte per seconds, and the red outer code data of a most common NEC agreement has 180
Byte or so, it is necessary to transmit the data of 180 integral multiple byte or so so when set top box diving tower is controlled, spend compared with
More transmission times, user can experience obvious delay of feedback.If during the data volume increase of transmission, transmission time
It can become big, cause delay of feedback to increase, Consumer's Experience becomes worse.
Based on the problem of data transfer is slow between current intelligent TV set and remote control, it is contemplated that red outer code data is compressed
Be transmitted again afterwards, blue Tooth remote controller receive compression red outer code data it is decompressed after be transmitted again.It is conventional at present
Data compression algorithm have the general-purpose algorithms such as LZ77, RLE, but these algorithms are all more complicated, internal memory to remote controller chip,
CPU and power consumption have higher requirement.In addition, existing data compression algorithm is mostly disclosed algorithm, easily entered by hacker
Row targetedly cracks, and influences the security of infrared data.
The content of the invention
The present invention provides compression and the decompression method of a kind of red outer code data, improve red outer code data transmission speed and
The security of data transfer.
In order to solve the above technical problems, the present invention adopts the following technical scheme that:
The compression method of red outer code data provided by the invention, including following operation:
S1, data are split, and red outer code data is split as into two groups of data of high level array and low level array, wherein, institute
The red outer code data stated is a positive integer array, and the array element of positive integer array is that high and low level is staggered;
S2:Compress high level array:The different pieces of information in high level array is stored in template array first, to template
Array encodes to obtain high level template byte stream, then corresponds to each data element in high level array in template array
Subscript be stored in subscript array, subscript array is encoded to obtain high level data byte stream, finally by high level template word
Throttling and high level data byte stream merge, and obtain high-level compression byte stream;
S3:Compress low level array:Operation to the Data duplication previous step in low level array, obtains low level template
Byte stream and low-level data byte stream, and obtain low level packed byte stream;
S4:Compressed data merges:High-level compression byte stream is merged with low level packed byte stream, obtains infrared code
Compressed data.
In the S2 and S3 of above-mentioned compression method, the step of compressing high and low level array, is identical, and compression sequence can exchange,
Specifically by taking high level as an example, compression step is discussed in detail, including:
S2-1:High level array is traveled through, different pieces of information all in high level array is stored in a template array
In, while the corresponding subscript in template array of each data in high level array is recorded, and subscript is stored under one
Mark in array;
S2-2:According to the length of template array, the bit number for representing that a level data takes is calculated;
S2-3:High level template array is encoded, the length of template array is deposited with first character section, is then traveled through
Template array, by each element of template array with 2 byte representations, obtain high level template byte stream;
S2-4:High level subscript array is encoded, the length of subscript array is deposited with the first two byte, is then traveled through
Subscript array, according to the bit number that each level data takes in S2-2, calculate the individual of the index data that 1 byte packet contains
Number, encodes according to byte boundary, obtains high level data byte stream;
S2-5:By high level template byte stream with merging before and after high level data byte stream, high-level compression byte is obtained
Stream.
The compression method of red outer code data as described above, in the S2-1, by the different pieces of information in high level array
During being stored in template array, a numerical bias, such as 3% can be set, if two data in high level array
Difference within the scope of the numerical bias, then it can be assumed that to be same data.Meanwhile in high level array is recorded
Data element in template array corresponding lower timestamp, can record identical, data of the data within numerical bias in template
Subscript in array, subscript is stored in subscript array.
The compression method of red outer code data as described above, in the S2-2, in the length computation one according to template array
During the bit number that individual level data takes, if the length of template array is 1~2, a level number is represented using 1 bit
According to, if length be 3~4, using 2 bits represent a level data, if length be 5~16, use 4 bits represent
One level data, if length is 17~256, a level data is represented using 8 bits.
The decompression method of red outer code data provided by the invention, including following operation:
S1:Decompress high level array:The size of high level template array is obtained according to high-level compression data first, is solved
Code goes out high level template array, and the bit number of a level data occupancy, decoding are then calculated according to the size of template array
Go out high level subscript array, finally according to high level template array and high level subscript array, the high level after being decompressed
Array;
S2:Decompress low level array:The operation of previous step is repeated to low level compressed data, decodes low level template
Array and low level subscript array, and the low level array after being decompressed;
S3:Low and high level data merge:By the number in the data and low level array in the high level array after decompression
Staggeredly merge according to according to order during compression, the data in high level array correspond to infrared respectively with the data in low level array
The odd bits or even bit element of yardage group, the red outer code data decompressed.
The decompression method of red outer code data as described above, in described S1, S2, decompress the step of high and low level array
Rapid identical, decompression order can exchange, and specifically by taking high level as an example, decompression step is discussed in detail, including:
S1-1:The length of high level template array is obtained according to the first character section of high level template compressed data, then
Using every 2 bytes as an integer data, decoding obtains high level template array;
S1-2:According to the length of template array, the bit number for representing that a level data takes is calculated;
S1-3:The length of high level subscript array is obtained according to the first two byte of high level subscript compressed data, then
The bit number taken according to each level data in S1-2, the number for the index data that 1 byte packet contains is calculated, according to byte
Border decodes, and obtains high level subscript array;
S1-4:According to the high level template array of decoding and high level subscript array, the height after reduction is decompressed is electric
Flat array.
The decompression method of red outer code data as described above, in the S1-2, in the length computation according to template array
It is identical with the compression method of red outer code data during the bit number that one level data takes, i.e., when template array length for 1~
When 2, a level data is represented using 1 bit, when length is 3~4, a level data is represented using 2 bits, works as length
For 5~16 when, using 4 bits represent a level data, when length be 17~256 when, use 8 bits represent a level number
According to.
The beneficial effects of the present invention are:
1st, the compression method of red outer code data provided by the invention, is compressed for the data characteristics of infrared code, can
The red outer code data of common NEC agreements is compressed to 1/4 or so original size, compared to traditional compression method, this pressure
Compression method can substantially reduce the requirement of the internal memory to remote controller chip, CPU and power consumption.
2nd, the compression and decompression operation that the present invention is carried out to red outer code data, enter equivalent to original red outer code data
Go once privately owned encryption, improve the security of red outer code data transmission.
3rd, compression method provided by the invention, transmitted after realizing the first compression of red outer code data, solve intelligent television
The problem of data transmission bauds is slow between main frame and blue Tooth remote controller, reduce feedback delay, improve Consumer's Experience.
Brief description of the drawings
In order to illustrate more clearly about the embodiment of the present invention or technical scheme of the prior art, below will be to embodiment or existing
There is the required accompanying drawing used in technology description to make a simply introduction.
Fig. 1 is the compression step flow chart of red outer code data in the embodiment of the present invention one;
Fig. 2 is the compression step flow chart of low and high level array in the embodiment of the present invention one;
Fig. 3 is the decompression step flow chart of red outer code data in the embodiment of the present invention two;
Fig. 4 is the decompression step flow chart of low and high level array in the embodiment of the present invention two.
Embodiment
To make the object, technical solutions and advantages of the present invention clearer, below in conjunction with embodiment and embodiment
Accompanying drawing, technical scheme is clearly and completely described, it is clear that described embodiment is a part of the invention
Embodiment, rather than whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art are not making wound
The every other embodiment obtained under the premise of the property made work, belongs to the scope of protection of the invention.
Understanding to embodiment for convenience, makes an explanation and illustrates to the technical name being related in this method.
Infrared code:The digitlization form of expression of infrared waves;
Infrared high level:There is existing for infrared carrier wave the cycle in infrared code;
Infrared low level:There is no existing for infrared carrier wave the cycle in infrared code.
Embodiment one
As shown in figure 1, the present embodiment provides a kind of compression method of red outer code data, including:
S1:Data are split:Red outer code data is split as two groups of data of high level array and low level array, wherein, it is red
Outer code data is a positive integer array, and first element of array is high level, and second element is low level, Zhi Houwei
High and low level is staggered;
S2:Compress high level array:The different pieces of information in high level array is stored in template array first, to template
Array encodes to obtain high level template byte stream, then corresponds to each data element in high level array in template array
Subscript be stored in subscript array, subscript array is encoded to obtain high level data byte stream, finally by high level template word
Throttling and high level data byte stream merge, and obtain high-level compression byte stream;
S3:Compress low level array:Operation to the Data duplication previous step in low level array, obtains low level template
Byte stream and low-level data byte stream, and obtain low level packed byte stream;
S4:Compressed data merges:High-level compression byte stream is merged with low level packed byte stream, obtains infrared code
Compressed data.
Specifically, as shown in Fig. 2 in S2, S3 of above-mentioned red outer code data compression method, high and low level array is compressed
The step of it is identical, below by taking high level array as an example, introduce the compression step of high level array, including:
S2-1:High level array is traveled through, different pieces of information all in high level array is stored in a template array
In, it is simplified operation, a numerical bias, such as 3% can be set, if the difference of two data is in number in high level array
It is worth within the scope of deviation, then it can be assumed that to be same data, while records each data in high level array in mould
The subscript of corresponding data in plate array or the identical, data in the range of numerical bias in template array, and subscript is deposited
In a subscript array;
S2-2:According to the length of template array, the bit number for representing that a level data takes is calculated, if template array
Length be 1~2 when, using 1 bit represent a level data, if length be 3~4, use 2 bits represent an electricity
Flat data, if length is 5~16, a level data is represented using 4 bits, if length is 17~256, uses 8
Bit represents a level data;
S2-3:High level template array is encoded, the length of template array is deposited with first character section, is then traveled through
Template array, by each element of template array with 2 byte representations, obtain high level template byte stream;
S2-4:High level subscript array is encoded, the length of subscript array is deposited with the first two byte, is then traveled through
Subscript array, according to the bit number that each level data takes in S2-2, calculate the individual of the index data that 1 byte packet contains
Number, encodes according to byte boundary, obtains high level data byte stream;
S2-5:By high level template byte stream with merging before and after high level data byte stream, high-level compression byte is obtained
Stream.
The compression step of low level array refers to the compression process of above-mentioned high level array.
Specifically, by taking Qingdao as an example, the infrared code of the limited set-top box keys 1 in Qingdao is:
342,171,21,63,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,63,
21,63,21,63,21,63,21,63,21,63,21,63,21,21,21,21,21,63,21,63,21,63,21,21,21,
21,21,21,21,63,21,63,21,21,21,21,21,21,21,63,21,63,21,63,21,1526
First data 342 is high level, and length is 342 infrared wave periods of frequency 38K, and second data 171 is low
Level, length are 171 infrared wave periods of frequency 38K, are subsequently staggered for low and high level, the like.
According to the compression method of red outer code data, data fractionation is carried out first, red outer code data is split as high level number
Group
{342,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,
21,21,21,21,21,21,21,21,21,21,21,21}
And low level array
{171,63,21,21,21,21,21,21,21,21,63,63,63,63,63,63,63,21,21,63,63,63,
21,21,21,63,63,21,21,21,63,63,63,1526};
Compress high level array:Different pieces of information in high level array is stored in template array, obtains template array
For { 342,21 };Each data in high level array corresponding subscript, subscript in template array is recorded to start counting up from 0,
Subscript array for 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1}.The length of template array is 2, therefore only needs 1bit to represent an index data.Coding templet array, uses first character
Section represents the length of template array, i.e. first character section is 0x02, template array is then traveled through, by each element of template array
With 2 byte representations, i.e., 342 using big end pattern-coding be that two bytes 0x01,0x56,21 using pattern-coding is held greatly are two
Individual byte 0x00,0x15, it is 0x02,0x01,0x56,0x00,0x15 to merge to obtain high level template byte stream.Coding
Subscript array, subscript array length are 34, and the length of subscript array is deposited with the first two byte, using big end pattern-coding, are obtained
1st byte and the 2nd byte are respectively 0x00,0x22, then travel through subscript array, due to 1 bit represent an index data, one
Individual byte can represent 8 subscripts, then need 34/8=5 byte representation altogether, the 3rd byte is 0,1,1,1,1,1,1,1, is compiled
Code obtains 0x7F, and the 4th byte is 1,1,1,1,1,1,1,1, and coding obtains 0xFF, and the 5th byte is 1,1,1,1,1,1,1,
1, coding obtains 0xFF, and the 6th byte is 1,1,1,1,1,1,1,1, and coding obtains 0xFF, and the 7th byte is 1,1, only two
Position effectively, behind with 60 come polishing 8, encode and obtain 0xC0, it is 0x00 to merge to obtain high level data byte stream,
0x22,0x7F,0xFF,0xFF,0xFF,0xC0.By high level template byte stream with merging before and after high level data byte stream, obtain
It is 0x02,0x01,0x56,0x00,0x15,0x00,0x22,0x7F, 0xFF, 0xFF, 0xFF to high-level compression byte stream,
0xC0。
Compress low level array:The different pieces of information 171,63,21 and 1526 in low level array is found out, is placed the data in
In template data, it is { 171,63,21,1526 } to obtain template array;Each data in low level array are recorded in template number
Corresponding subscript, subscript start counting up from 0 in group, obtain subscript array for 0,1,2,2,2,2,2,2,2,2,1,1,1,1,1,1,
1,2,2,1,1,1,2,2,2,1,1,2,2,2,1,1,1,3}.Template array length is 4, it is therefore desirable to which 2bit represents a subscript
Data.Coding templet array, the length of template array is represented with first character section, i.e. first character section is 0x04, is then traveled through
Template array, by each element of template array with 2 byte representations, i.e., 171 using big end pattern-coding be two bytes
0x00,0xAB, 63 be that two bytes 0x00,0x3F, 21 using pattern-coding is held greatly are two bytes using big end pattern-coding
0x00,0x15,1526 are two bytes 0x05,0xF6 using big end pattern-coding, merge to obtain low level template word
Throttle as 0x04,0x00,0xAB, 0x00,0x3F, 0x00,0x15,0x05,0xF6.Encode subscript array, subscript array length
For 34, the length of subscript array is deposited with the first two byte, using big end pattern-coding, i.e. the 1st byte and the 2nd byte is respectively
0x00,0x22, subscript array is then traveled through, because 2 bits represent an index data, a byte can represent 4 subscripts, that
34/4=9 byte representation is needed altogether, the 3rd byte is 0,1,2,2, and coding obtains 0x1A, and the 4th byte is 2,2,2,2,
Coding obtains 0xAA, and the 5th byte is 2,2,1,1, and coding obtains 0xA5, and the 6th byte is 1,1,1,1, and coding obtains 0x55,
7th byte is 1,2,2,1, and coding obtains 0x69, and the 8th byte is 1,1,2,2, and coding obtains 0x5A, and the 9th byte is 2,
1,1,2, coding obtains 0x96, and the 10th byte is 2,2,1,1, and coding obtains 0xA5, and the 11st byte is 1,3, only two
Effectively, with 20 come polishing 4 behind, coding obtains 0x70, merges as 0x00,0x22,0x1A, 0xAA, 0xA5,
0x55,0x69,0x5A,0x96,0xA5,0x70.By low level template byte stream with merging before and after high level data byte stream, obtain
It is 0x04,0x00,0xAB, 0x00,0x3F, 0x00,0x15,0x05,0xF6,0x00,0x22 to low level packed byte stream,
0x1A,0xAA,0xA5,0x55,0x69,0x5A,0x96,0xA5,0x70。
High-level compression byte stream is merged with low level packed byte stream, the compressed data for obtaining infrared code is 0x02,
0x01,0x56,0x00,0x15,0x00,0x22,0x7F,0xFF,0xFF,0xFF,0xC0,0x04,0x00,0xAB,0x00,
0x3F,0x00,0x15,0x05,0xF6,0x00,0x22,0x1A,0xAA,0xA5,0x55,0x69,0x5A,0x96,0xA5,
Result after the red outer code data compression of 0x70, as Qingdao cable set top box 1 key of numeral.
Embodiment two
As shown in figure 3, the present embodiment provides a kind of decompression method of red outer code data, including:
S1:Decompress high level array:The size of high level template array is obtained according to high-level compression data first, is solved
Code goes out high level template array, and the bit number of a level data occupancy, decoding are then calculated according to the size of template array
Go out high level subscript array, finally according to high level template array and high level subscript array, the high level after being decompressed
Array;
S2:Decompress low level array:The operation of previous step is repeated to low level compressed data, decodes low level template
Array and low level subscript array, and the low level array after being decompressed;
S3:Low and high level data merge:By the number in the data and low level array in the high level array after decompression
According to staggeredly merging, the data in high level array are the odd bits element of infrared yardage group, and the data in low level array are red
The even bit element of outer code array, the red outer code data decompressed.
Specifically, as shown in figure 4, in S1, S2 of above-mentioned red outer code data decompression method, high and low level is decompressed
The step of array, is identical, specifically by taking high level as an example, introduces the step of decompressing high level array, including:
S1-1:The length of high level template array is obtained according to the first character section of high level template compressed data, then
Using every 2 bytes as an integer data, decoding obtains high level template array;
S1-2:According to the length of template array, the bit number for representing that a level data takes is calculated, with red outer code data
Compression method it is identical, when template array length be 1~2 when, using 1 bit represent a level data, when length be 3~
When 4, a level data is represented using 2 bits, when length is 5~16, a level data is represented using 4 bits, works as length
Spend for 17~256 when, use 8 bits represent a level data;
S1-3:The length of high level subscript array is obtained according to the first two byte of high level subscript compressed data, then
The bit number taken according to each level data in S1-2, the number for the index data that 1 byte packet contains is calculated, according to byte
Border decodes, and obtains high level subscript array;
S1-4:According to the high level template array of decoding and high level subscript array, the height after reduction is decompressed is electric
Flat array.
The decompression step of low level array refers to the decompression process of above-mentioned high level array.
Specifically, with embodiment one, the result after the red outer code data compression of Qingdao cable set top box 1 key of numeral is
Example, carries out infrared code decompression operation.In embodiment one, the compressed data of infrared code is 0x02,0x01,0x56,0x00,
0x15,0x00,0x22,0x7F,0xFF,0xFF,0xFF,0xC0,0x04,0x00,0xAB,0x00,0x3F,0x00,0x15,
0x05,0xF6,0x00,0x22,0x1A,0xAA,0xA5,0x55,0x69,0x5A,0x96,0xA5,0x70。
Decompress high level array:According to the first character section 0x02 of high level template compressed data, high level template is obtained
The length of array is 2, then decodes to obtain 342,0x00 as an integer data, follow-up 0x01,0x56 using every 2 bytes,
0x15 decodes to obtain 21, and it is { 342,21 } to obtain high level template array.The length of template array is 2, therefore only needs 1bit
An index data is represented, the length of high level subscript array is obtained according to the first two byte 0x00,0x22 of subscript compressed data
Spend for 34, because 1bit represents an index data, a byte can represent 8 subscripts, be learnt by 34/8=5, subsequently there are 5
Coding of the byte packet containing index data.Follow-up 5 bytes 0x7F, 0xFF, 0xFF, 0xFF, 0xC0 are decoded successively, obtain subscript
Array { 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 }.Root
According to the high level template array and subscript array of decoding, reduction decompress after high level array be 342,21,21,21,
21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,
21,21,21,21,21}。
Decompress low level array:According to the first character section 0x04 of low level template compressed data, high level template is obtained
The length of array is 4, then decodes to obtain 171,0x00 as an integer data, follow-up 0x00,0xAB using every 2 bytes,
0x3F, which decodes to obtain 63,0x00,0x15 and decodes to obtain 21,0x05,0xF6, to be decoded to obtain 1526, obtains low level template array
{171,63,21,1526}.The length of template array is 4, therefore represents a subscript with 2bit, according to subscript compressed data
The first two byte 0x00, the length that 0x22 obtains high level subscript array are 34, because 2 bits represent a subscript, 1 byte
4 index datas can be represented, are learnt by 34/4=9, follow-up coding of 9 byte packets containing index data.Follow-up 9 are decoded successively
Byte 0x1A, 0xAA, 0xA5,0x55,0x69,0x5A, 0x96,0xA5,0x70, obtain subscript array 0,1,2,2,2,2,2,
2,2,2,1,1,1,1,1,1,1,2,2,1,1,1,2,2,2,1,1,2,2,2,1,1,1,3}.According to the low level template number of decoding
Group and subscript array, reduction decompress after low level array be 171,63,21,21,21,21,21,21,21,21,
63,63,63,63,63,63,63,21,21,63,63,63,21,21,21,63,63,21,21,21,63,63,63,1526}。
Data in data and low level array in high level array after decompression are staggeredly merged, high level array
In data be infrared yardage group odd bits element, the data in low level array are the even bit element of infrared yardage group,
The red outer code data decompressed is 342,171,21,63,21,21,21,21,21,21,21,21,21,21,21,21,21,
21,21,21,21,63,21,63,21,63,21,63,21,63,21,63,21,63,21,21,21,21,21,63,21,63,
21,63,21,21,21,21,21,21,21,63,21,63,21,21,21,21,21,21,21,63,21,63,21,63,21,
1526。
The technology contents of the not detailed description of the present invention are known technology.
Claims (10)
1. a kind of compression method of red outer code data, it is characterised in that comprise the following steps:
S1, data are split, and red outer code data is split as into two groups of data of high level array and low level array, wherein, it is described
Red outer code data is a positive integer array, and the array element of positive integer array is that high and low level is staggered;
S2, data compression, data compression include compression high level array and compression low level array;
High level array is compressed, the different pieces of information in high level array is stored in template array first, template array is compiled
Code obtain high level template byte stream, then by each data element in high level array in template array corresponding subscript
Be stored in subscript array, subscript array encoded to obtain high level data byte stream, finally by high level template byte stream and
High level data byte stream merges, and obtains high-level compression byte stream;
Low level array is compressed, the operation to the Data duplication high level array in low level array, obtains low level template word
Throttling and low-level data byte stream, and obtain low level packed byte stream;
S3, compressed data merge, and high-level compression byte stream is merged with low level packed byte stream, obtains the compression of infrared code
Data.
2. the compression method of red outer code data according to claim 1, it is characterised in that in the S2, compress high level
The step of array, includes:
S2-1, high level array is traveled through, different pieces of information all in high level array is stored in a template array, together
Each data in Shi Jilu high level arrays corresponding subscript in template array, and subscript is stored in a subscript array
In;
S2-2, the length according to template array, calculate the bit number for representing that a level data takes;
S2-3, high level template array is encoded, the length of template array is deposited with first character section, then travels through template
Array, by each element of template array with 2 byte representations, obtain high level template byte stream;
S2-4, high level subscript array is encoded, the length of subscript array is deposited with the first two byte, then travels through subscript
Array, according to the bit number that each level data takes in S2-2, the number for the index data that 1 byte packet contains is calculated, is pressed
Encoded according to byte boundary, obtain high level data byte stream;
S2-5, by high level template byte stream with merging before and after high level data byte stream, obtain high-level compression byte stream.
3. the compression method of red outer code data according to claim 2, it is characterised in that in the S2-1, will high electricity
During different pieces of information in flat array is stored in template array, a numerical bias can be set, if high level array
In two data difference within the scope of numerical bias, then it can be assumed that to be same data.
4. the compression method of red outer code data according to claim 3, it is characterised in that high in record in the S2-1
Data element in the level array corresponding lower timestamp in template array, can record the data being equal within numerical bias
Subscript of the data in template array.
5. the compression method of red outer code data according to claim 2, it is characterised in that in the S2-2, according to mould
During the bit number that one level data of length computation of plate array takes, if the length of template array is 1~2,1 ratio is used
Spy represents a level data, if length is 3~4, a level data is represented using 2 bits, if length is 5~16
When, a level data is represented using 4 bits, if length is 17~256, a level data is represented using 8 bits.
6. the compression method of red outer code data according to claim 1, it is characterised in that in the S1, infrared yardage group
Odd bits element be high level, even bit element is low level.
7. a kind of decompression method of red outer code data, it is characterised in that comprise the following steps:
S1, decompression data, including decompression high level array and decompression low level array;
High level array is decompressed, the size of high level template array is obtained according to high-level compression data first, decodes height
Level template array, the bit number of a level data occupancy is then calculated according to the size of template array, decode high electricity
Flat subscript array, finally according to high level template array and high level subscript array, the high level array after being decompressed;
Decompress low level array, to low level compressed data repeat previous step operation, decode low level template array and
Low level subscript array, and the low level array after being decompressed;
S2, low and high level data merge, and the data in the data and low level array in the high level array after decompression are handed over
Misfit simultaneously, the red outer code data decompressed.
8. the decompression method of red outer code data according to claim 7, it is characterised in that in the S1, decompression is high
The step of level array, includes:
S1-1, the length of high level template array obtained according to the first character section of high level template compressed data, then with every 2
Individual byte is an integer data, and decoding obtains high level template array;
S1-2, the length according to template array, calculate the bit number for representing that a level data takes;
S1-3, the length of high level subscript array obtained according to the first two byte of high level subscript compressed data, then basis
The bit number that each level data takes in S1-2, the number for the index data that 1 byte packet contains is calculated, according to byte boundary
Decoding, obtains high level subscript array;
S1-4, high level template array and high level subscript array according to decoding, reduce the high level number after being decompressed
Group.
9. the decompression method of red outer code data according to claim 8, it is characterised in that in the S1-2, in basis
During the bit number that one level data of length computation of template array takes, if the length of template array is 1~2, make
A level data is represented with 1 bit, if length is 3~4, a level data is represented using 2 bits, if length
For 5~16 when, then using 4 bits represent a level data, if length be 17~256, use 8 bits represent one
Level data.
10. the decompression method of red outer code data according to claim 7, it is characterised in that in the S2, high level number
Data in group for the red outer code data of decompression odd bits element, data in low level array for decompression infrared code
The even bit element of data.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710550255.9A CN107393291A (en) | 2017-07-07 | 2017-07-07 | A kind of compression of red outer code data and decompression method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710550255.9A CN107393291A (en) | 2017-07-07 | 2017-07-07 | A kind of compression of red outer code data and decompression method |
Publications (1)
Publication Number | Publication Date |
---|---|
CN107393291A true CN107393291A (en) | 2017-11-24 |
Family
ID=60334243
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710550255.9A Pending CN107393291A (en) | 2017-07-07 | 2017-07-07 | A kind of compression of red outer code data and decompression method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107393291A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109872522A (en) * | 2019-03-25 | 2019-06-11 | 河北棣烨信息技术有限公司 | The algorithm that infrared code is decompressed based on sample index |
CN116505952A (en) * | 2023-06-27 | 2023-07-28 | 厦门立林科技有限公司 | Infrared code compression method and device, intelligent equipment and storage medium |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2003216189A (en) * | 2002-10-21 | 2003-07-30 | Sony Corp | Encoder and decoder |
CN101989379A (en) * | 2009-07-31 | 2011-03-23 | 宁波家天下智能系统有限公司 | Learning method and transmitting method of infrared cod signal and remote controller |
CN101989376A (en) * | 2009-07-31 | 2011-03-23 | 宁波家天下智能系统有限公司 | Intelligent home control system |
CN103795421A (en) * | 2014-02-26 | 2014-05-14 | 活点信息技术有限公司 | Method for data compression and decompression i |
CN104217576A (en) * | 2014-07-10 | 2014-12-17 | 广州市河东电子有限公司 | Decoding/coding method of infrared pulse signal |
-
2017
- 2017-07-07 CN CN201710550255.9A patent/CN107393291A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2003216189A (en) * | 2002-10-21 | 2003-07-30 | Sony Corp | Encoder and decoder |
CN101989379A (en) * | 2009-07-31 | 2011-03-23 | 宁波家天下智能系统有限公司 | Learning method and transmitting method of infrared cod signal and remote controller |
CN101989376A (en) * | 2009-07-31 | 2011-03-23 | 宁波家天下智能系统有限公司 | Intelligent home control system |
CN103795421A (en) * | 2014-02-26 | 2014-05-14 | 活点信息技术有限公司 | Method for data compression and decompression i |
CN104217576A (en) * | 2014-07-10 | 2014-12-17 | 广州市河东电子有限公司 | Decoding/coding method of infrared pulse signal |
Non-Patent Citations (1)
Title |
---|
曾炼成,周小云: "基于波形存储型红外学习的数据压缩方法", 《计算机与现代化》 * |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109872522A (en) * | 2019-03-25 | 2019-06-11 | 河北棣烨信息技术有限公司 | The algorithm that infrared code is decompressed based on sample index |
CN109872522B (en) * | 2019-03-25 | 2021-01-01 | 河北棣烨信息技术有限公司 | Algorithm for decompressing infrared code based on sample index |
CN116505952A (en) * | 2023-06-27 | 2023-07-28 | 厦门立林科技有限公司 | Infrared code compression method and device, intelligent equipment and storage medium |
CN116505952B (en) * | 2023-06-27 | 2023-09-08 | 厦门立林科技有限公司 | Infrared code compression method and device, intelligent equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103858433B (en) | Layered entropy encoding and decoding | |
CN103763696B (en) | Energy-saving sensor data collection method based on cross layer safe compression | |
CN105070035B (en) | The real-time compression method and device of infrared remote control code stream | |
CN107046646A (en) | Video encoding/decoding apparatus and method based on depth autocoder | |
CN107393291A (en) | A kind of compression of red outer code data and decompression method | |
CN103702133B (en) | A kind of compression of images methods of exhibiting and its device | |
CN102905128B (en) | Codec processor is the method for Rate Control during wireless video transmission | |
CN104081701B (en) | Communication means, system and the device of optical network system | |
CN107483059A (en) | A kind of multichannel data decoding method and device based on dynamic Hofman tree | |
CN102396222A (en) | Adaptive entropy coding for images and videos using set partitioning in generalized hierarchical trees | |
WO2012119463A1 (en) | Coding method, decoding method, and equipments for transform coefficients | |
CN103795421A (en) | Method for data compression and decompression i | |
CN104125475B (en) | Multi-dimensional quantum data compressing and uncompressing method and apparatus | |
CN104394415B (en) | A kind of method of video big data distribution decoding | |
WO2009158456A3 (en) | Compression scheme for interval data | |
WO2011137841A1 (en) | Method and device for compression encoding, method and device for decompression decoding, and communication system | |
CN105120276A (en) | Adaptive Motion JPEG coding method and system | |
CN105281777A (en) | Compression method of remote controller learning data, system and remote controller | |
CN103731241B (en) | Encoding system and method for improving spectrum efficiency of communication system | |
CN202385119U (en) | Zigbee based multimedia intelligent household network | |
CN111479286B (en) | Data processing method for reducing communication flow of edge computing system | |
CN103999490B (en) | The terminable position encoded and decoded method and apparatus based on space tree | |
CN106850142A (en) | The polar code constructing methods of the code word Optimal Distribution encoded using Homophonic under memory channel | |
CN106559668B (en) | A kind of low code rate image compression method based on intelligent quantization technology | |
CN101980466A (en) | Bit stream transmission method combing SPIHT compression and unequal error protection coding |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20171124 |