CN109586729B - Infrared code compression method and device - Google Patents

Infrared code compression method and device Download PDF

Info

Publication number
CN109586729B
CN109586729B CN201811238222.1A CN201811238222A CN109586729B CN 109586729 B CN109586729 B CN 109586729B CN 201811238222 A CN201811238222 A CN 201811238222A CN 109586729 B CN109586729 B CN 109586729B
Authority
CN
China
Prior art keywords
code
array
values
infrared
converting
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
CN201811238222.1A
Other languages
Chinese (zh)
Other versions
CN109586729A (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 Gongshang University
Original Assignee
Zhejiang Gongshang University
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 Gongshang University filed Critical Zhejiang Gongshang University
Priority to CN201811238222.1A priority Critical patent/CN109586729B/en
Publication of CN109586729A publication Critical patent/CN109586729A/en
Application granted granted Critical
Publication of CN109586729B publication Critical patent/CN109586729B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03MCODING; DECODING; CODE CONVERSION IN GENERAL
    • H03M7/00Conversion of a code where information is represented by a given sequence or number of digits to a code where the same, similar or subset of information is represented by a different sequence or number of digits
    • H03M7/30Compression; Expansion; Suppression of unnecessary data, e.g. redundancy reduction
    • H03M7/40Conversion to or from variable length codes, e.g. Shannon-Fano code, Huffman code, Morse code
    • H03M7/4006Conversion to or from arithmetic code
    • H03M7/4012Binary arithmetic codes

Abstract

The invention discloses an infrared coding compression method and an infrared coding compression device, wherein the method comprises the following steps: grouping the infrared coded data pairwise in sequence, and converting the infrared coded data into coded arrays; sequentially judging whether all values of the coding array are within the error range of all values of the reference array, and if not, adding corresponding values in the coding array into the reference array; otherwise, calculating the average value of the coding array and the corresponding value of the reference array, and replacing the corresponding value in the reference array with the average value; counting the number of all values in the reference array, and taking the corresponding values of the first two counted numbers as 0 codes and 1 codes; converting the coding array into an improved binary string; converting the improved binary character string into a hexadecimal character string, and converting the hexadecimal character string into infrared coding encapsulation data; the method and the device realize the compression of the infrared coding data of any structure.

Description

Infrared code compression method and device
Technical Field
The present invention relates to the field of infrared communication technologies, and in particular, to a method and an apparatus for compressing infrared codes.
Background
At present, many resident families all use intelligent house and electrical apparatus, generally control terminal equipment such as intelligent house and electrical apparatus through infrared remote controller, terminal equipment producer all carries out the one-to-one with infrared remote controller and terminal equipment when the product dispatches from the factory, the only terminal equipment who corresponds is discerned through terminal ID promptly, terminal equipment is controlled to an infrared remote controller, even omnipotent remote controller in the market also can only realize controlling specific several kinds of products, and can't control all products.
Some solutions identify an infrared code sent by a terminal device by internally installing an infrared communication module in a device such as a smart phone, and control the terminal device. However, there are many infrared encoding protocols, each protocol has its own encoding format, if the infrared communication module embeds all the infrared encoding protocols, it will obviously occupy the memory of the mobile phone, so most terminal devices only embed part of the infrared encoding protocols, so when the infrared encoding format of the controlled terminal device is not embedded in the infrared communication module, it is necessary to send the infrared encoding of the device to the infrared communication module, at this time, if the decimal infrared encoding is directly sent, the risk of memory overflow is increased, so the infrared encoding can be sent after being compressed, but the method in the prior art only considers one encoding combination mode, namely, the guidance code, 01 code combination, and end code, and does not consider the infrared encoding of the 01 code combination, which is frequently encountered in practice, repeatedly and alternately, so how to design an infrared encoding compression method with stronger universality, is a main problem facing at present.
Disclosure of Invention
The invention aims to provide an infrared code compression method and device, and solves the problem that the current infrared code compression method can only be suitable for infrared codes under specific conditions and can not be suitable for infrared code data with any structure.
In order to achieve the above object, the present invention provides an infrared code compression method, which comprises the following steps:
grouping the infrared coded data pairwise in sequence, converting the infrared coded data into coded arrays, and taking the last value in the coded arrays as an end code;
sequentially judging whether all values in the coding array are within an error range of the values of the reference array, and if not, adding the corresponding values in the coding array into the reference array; otherwise, calculating the average value of the coding array and the corresponding value in the reference array, and replacing the corresponding value in the reference array with the average value;
taking a first value in the reference array as a guide code, counting the number of all values in the reference array, and respectively taking the values in the corresponding reference arrays with the counted number of the first two bits as a 0 code and a 1 code;
converting the coded array into a modified binary string, the modified binary string consisting of a bootstrap code, a 0, a 1, a decimal code, and an end code;
and converting the improved binary character string into a hexadecimal character string, and converting the hexadecimal character string into infrared coding packaging data.
Preferably, the converting the coding array into the improved binary character string is specifically to sequentially judge whether all values in the coding array, which do not include the end code, are within error ranges of 0 code, 1 code and the guide code, and if the values are within the error ranges of 0 code, 1 code and the guide code, convert the values in the coding array into 0 code, 1 code and the guide code correspondingly; otherwise, the decimal code is converted into a decimal code representation.
Preferably, the modified binary string is converted into a hexadecimal string, specifically, all consecutive 0 and 1 in the modified binary string are sequentially converted into a 16-ary number every 4 bits, and if the last remaining number of bits is less than 4 bits, 0 is filled in the last bit and then the last bit is converted into the 16-ary number.
Preferably, the error range is a range between the current value minus 100 and the current value plus 100.
In order to achieve the above object, the present invention further provides an infrared encoding compression apparatus, including:
the coded data grouping module is used for sequentially grouping the infrared coded data pairwise, converting the infrared coded data into a coded array, and taking the last value in the coded array as an end code;
the reference array adjusting module is used for sequentially judging whether all values in the coding array are within the error range of the values of the reference array, and if not, adding the corresponding values in the coding array into the reference array; otherwise, calculating the average value of the coding array and the corresponding value in the reference array, and replacing the corresponding value in the reference array with the average value;
the statistical module is used for taking a first value in the reference array as a guide code, counting the number of all values in the reference array, and respectively taking the values in the reference array corresponding to the first two counted numbers as a 0 code and a 1 code;
a first conversion module for converting the coding array into an improved binary string, the improved binary string consisting of a guide code, a 0, a 1, a decimal code, and an end code;
and the second conversion module is used for converting the improved binary character string into a hexadecimal character string and then converting the hexadecimal character string into infrared code packaging data.
Preferably, the first conversion module sequentially judges whether all values in the code array, which do not include the end code, are within the error ranges of the 0 code, the 1 code and the pilot code, and if the values are within the error ranges of the 0 code, the 1 code and the pilot code, correspondingly converts the values in the code array into the 0 code, the 1 code and the pilot code; otherwise, the decimal code is converted into a decimal code representation.
Preferably, the second conversion module converts all consecutive 0's and 1's in the modified binary string into 16-ary numbers in 4-bit sequence, and if the last remaining number of bits is less than 4-bit number, then fills 0's in the sequence and converts into 16-ary numbers.
Preferably, the error range is a range between the current value minus 100 and the current value plus 100.
Compared with the prior art, the invention has the following advantages and prominent effects:
the infrared code compression method and the infrared code compression device provided by the invention have the advantages that the reference of the guide code, the 0 code, the 1 code and the end code is found firstly, then the coding array corresponding to the infrared coded data is converted into the improved binary character string by utilizing the reference, and the improved binary character string is converted into the hexadecimal character string to obtain the infrared code packaging data.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the embodiments or the prior art descriptions will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 is a schematic flowchart of an infrared code compression method according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of an infrared encoding and compressing apparatus according to a second embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and do not limit the invention.
As shown in fig. 1, an embodiment of the present invention discloses an infrared coding compression method, including the following steps:
s101, grouping the infrared coded data pairwise in sequence, converting the infrared coded data into a coded array, and taking the last value in the coded array as an end code; specifically, the following infrared encoded data is exemplified:
[9018,4482,662,1644,662,544,688,518,658,1644,686,1624,660,544,660,546,660,548,662,1648,660,544,632,572,662,1650,660,546,656,546,686,520,664,546,686,518,660,542,688,518,662,548,662,542,690,516,656,544,658,544,658,546,688,516,662,548,660,544,658,1644,660,548,634,1674,658,544,660,546,662,1644,686,520,664,19964,664,546,656,544,660,546,658,546,660,550,686,518,660,544,662,548,660,520,682,546,662,544,662,544,656,546,660,548,688,518,660,544,658,522,684,546,664,542,686,516,688,516,686,518,662,546,660,542,660,544,692,516,662,544,660,542,658,548,662,546,662,1644,630,1668,662,39954,9016,4488,662,1640,658,548,690,518,660,1644,660,1650,662,542,660,544,632,574,662,1640,688,520,662,542,630,1676,662,544,662,546,688,516,658,544,660,546,662,546,658,544,688,518,662,546,660,544,660,542,632,574,662,546,660,546,660,544,658,548,662,1646,686,1622,688,1616,662,546,686,516,662,1648,662,548,660,19954,684,546,632,572,660,544,662,544,662,544,664,546,688,518,660,544,660,544,688,492,686,546,662,546,660,544,660,544,662,544,664,546,662,544,660,544,662,542,664,544,662,1642,660,546,662,544,632,572,662,546,690,516,656,546,688,518,690,1620,688,516,660,1626,686,1640,690];
after the infrared coded data are grouped in pairs in sequence, the coded arrays obtained by conversion are as follows:
[[9018,4482],[662,1644],[662,544],[688,518],[658,1644],[686,1624],[660,544],[660,546],[660,548],[662,1648],[660,544],[632,572],[662,1650],[660,546],[656,546],[686,520],[664,546],[686,518],[660,542],[688,518],[662,548],[662,542],[690,516],[656,544],[658,544],[658,546],[688,516],[662,548],[660,544],[658,1644],[660,548],[634,1674],[658,544],[660,546],[662,1644],[686,520],[664,19964],[664,546],[656,544],[660,546],[658,546],[660,550],[686,518],[660,544],[662,548],[660,520],[682,546],[662,544],[662,544],[656,546],[660,548],[688,518],[660,544],[658,522],[684,546],[664,542],[686,516],[688,516],[686,518],[662,546],[660,542],[660,544],[692,516],[662,544],[660,542],[658,548],[662,546],[662,1644],[630,1668],[662,39954],[9016,4488],[662,1640],[658,548],[690,518],[660,1644],[660,1650],[662,542],[660,544],[632,574],[662,1640],[688,520],[662,542],[630,1676],[662,544],[662,546],[688,516],[658,544],[660,546],[662,546],[658,544],[688,518],[662,546],[660,544],[660,542],[632,574],[662,546],[660,546],[660,544],[658,548],[662,1646],[686,1622],[688,1616],[662,546],[686,516],[662,1648],[662,548],[660,19954],[684,546],[632,572],[660,544],[662,544],[662,544],[664,546],[688,518],[660,544],[660,544],[688,492],[686,546],[662,546],[660,544],[660,544],[662,544],[664,546],[662,544],[660,544],[662,542],[664,544],[662,1642],[660,546],[662,544],[632,572],[662,546],[690,516],[656,546],[688,518],[690,1620],[688,516],[660,1626],[686,1640],[690]]。
the last value [690] is used as the end code in this embodiment.
S102, sequentially judging whether all values in the coding array are within the error range of the values of the reference array, and if not, adding the corresponding values in the coding array to the reference array; otherwise, calculating the average value of the values in the coding array and the corresponding values in the reference array, and replacing the corresponding values in the reference array with the average value. It should be noted that the reference array is generated as a null array during initialization, and then in conjunction with the coding array in step S101, specifically, the first element to which the reference array is added is [9018,4482]. In this embodiment, the error range is determined as the range between the current value minus 100 and the current value plus 100. The second element [662,1644] of the encoded array is then compared with the first element [9018,4482] of the reference array, and [662,1644] is added to the reference array since 662 is not within the error range of 9018 and 1644 is not within the error range of 4482; then comparing the third element [662,544] of the encoded array with the elements [9018,4482] and [662,1644] in the reference array in turn, it can be seen that neither [662,544] is within the error range of [9018,4482] and [662,1644], so [662,544] is added to the reference array; then, it is judged that [688,518] is within the error range of the reference array element [662,544], so that the average value of the elements [662,544] and [688,518] is calculated to obtain the average value [675,531], and the element [662,544] is replaced by [675,531], so that the reference array is [ [9018,4482], [662,1644], [675,531] ].
Comparing the fourth elements [658,1644] of the coding array with all the elements of the reference array, it can be seen that [658,1644] is in the error range of the elements [662,1644], so the average value of [658,1644] and [662,1644] is found to be [660,1644], then the elements [662,1644] in the reference array are replaced by [660,1644], at this time, the reference array becomes [ [9018,4482], [660,1644], [675,531] ], and the judgment is continued according to the principle until all the elements in the coding array are judged to be completed, and the final reference array is obtained.
S103, the first value in the finally obtained reference array is used as a guide code, and the first value in the reference array is [9017,4485], so that the guide code is [9017,4485]. And counting the number of all values in the reference array, respectively taking the values of the counted numbers in the reference array corresponding to the first two bits as 0 codes and 1 codes, and taking the first value in the reference array as a guide code. In this embodiment, in the reference array obtained in step S102, the corresponding element values of the first two digits are counted as [653,516] and [657,1639], so that the 0 code is [653,516], the 1 code is [657,1639], and the bootstrap code, i.e., the S code, is [9017,4485].
And S104, converting the coding array into an improved binary character string, wherein the improved binary character string consists of a guide code, 0,1, a decimal code and an end code, and the decimal code refers to the coding data which cannot be identified and judged as the guide code, the 0 code, the 1 code and the end code and are reserved in the coding array. Specifically, whether all values which do not contain the end code in the coding array are in the error ranges of the 0 code, the 1 code and the guide code is sequentially judged, and if the values are in the error ranges of the 0 code, the 1 code and the guide code, the values in the coding array are correspondingly converted into the 0 code, the 1 code and the guide code; otherwise, the decimal code is converted into a decimal code representation. To illustrate with the encoding array in step S101 in this embodiment, the first value [9018,4482] in the encoding array is within the error range of the boot code [9017,4485] so that the value is identified as the boot code, i.e., the S-code, and the second value [662,1644] is within the error range of the 1-code so that the second value is converted to 1; the third value [662,544] is within the error range of the 0 code, so the third value is converted to 0; the value 664,19964 is not within the error range of the 0 code, the 1 code and the guide code, so represented in the modified binary string in the form of a decimal code { dec:664-19964 }. In this way, all values in the code array are converted into a modified binary string consisting of a boot code, 0,1, decimal code and an end code, the corresponding result of this embodiment being:
"s,1,0,0,1,1,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,1,0,{dec:664-19964},0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,{dec:662-39954},s,1,0,0,1,1,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,1,0,{dec:660-19954},0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,1,1,e"。
and S105, converting the improved binary character string into a hexadecimal character string, and converting the hexadecimal character string into infrared coded packaging data, specifically, converting all continuous 0 and 1 in the improved binary character string into 16-ary numbers in 4 bits in sequence, respectively, and if the last residual number of bits is less than 4, filling 0 in the back and converting the number into the 16-ary numbers. In the modified binary string of this embodiment, the four-bit value after the s code is 1001, the corresponding 16-ary number is 9, the next four-bit value is 1000, the corresponding 16-ary number is 8, 0 and 1 between the s code and the decimal code { dec:664-19964}, and finally, a three-bit value 010 remains, at this time, 0 is filled later, 0100 is filled later, and the corresponding 16-ary number is 4. In this embodiment, the hexadecimal character string which does not include the start code and the end code after conversion by the method is:
"hex_00":["0x9890000a4","3"],"dec_00":"664,1996","hex_01":["0x00000003","0"],"hex_10":["0x9890000e4","3"],"dec_10":"660,1995","hex_11":["0x0000080b","0"]。
in the process, the leading code former bit value of the non-leading position in the improved binary character string is used as the connection code, and the leading code of the non-leading position is not processed.
Then, the hexadecimal character string is converted into infrared encoded encapsulation data, and in this embodiment, the obtained infrared encoded encapsulation data is:
{"header":"9017,4485","one":"657,1639","zero":"653,516","ptrail":"690","hex_00":["0x9890000a4","3"],"dec_00":"664,19964","hex_01":["0x00000003","0"],"repeat":"662,39954","hex_10":["0x9890000e4","3"],"dec_10":"660,19954","hex_11":["0x0000080b","0"]}。
example two
As shown in fig. 2, a second embodiment of the present invention discloses an infrared encoding compression apparatus, including:
the encoded data grouping module 201 is configured to group the ir encoded data two by two in sequence, convert the ir encoded data into an encoded array, and use the last value in the encoded array as an end code, specifically, taking the ir encoded data in the first embodiment as an example, the result of the encoded array obtained after grouping is the same as that in the first embodiment, and the last value [690] of the encoded array is used as the end code.
A reference array adjusting module 202, configured to sequentially determine whether all values in the encoded array are within an error range of the values in the reference array, and if not, add the corresponding values in the encoded array to the reference array; otherwise, calculating the average value of the values in the coding array and the corresponding values in the reference array, and replacing the corresponding values in the reference array with the average values. It should be noted that the reference array is generated as a null array during initialization, and then in particular, in conjunction with the coding array in embodiment one, the first element to which the reference array is added is [9018,4482]. In this embodiment, the error range is determined as the range between the current value minus 100 and the current value plus 100. Then the second element [662,1644] of the encoded array is compared with the first element [9018,4482] of the reference array, and [662,1644] is added to the reference array since 662 is not within the error range of 9018 and 1644 is not within the error range of 4482; then comparing the third element [662,544] of the encoded array with the elements [9018,4482] and [662,1644] in the reference array in turn, it can be seen that neither [662,544] is within the error range of [9018,4482] and [662,1644], so [662,544] is added to the reference array; then, it is judged that [688,518] is within the error range of the reference array element [662,544], so that the average value of the elements [662,544] and [688,518] is calculated to obtain the average value [675,531], and the element [662,544] is replaced by [675,531], so that the reference array is [ [9018,4482], [662,1644], [675,531] ].
Comparing the fourth elements [658,1644] of the coding array with all the elements of the reference array, it can be seen that [658,1644] is in the error range of the elements [662,1644], so the average value of [658,1644] and [662,1644] is found to be [660,1644], then the elements [662,1644] in the reference array are replaced by [660,1644], at this time, the reference array becomes [ [9018,4482], [660,1644], [675,531] ], and the judgment is continued according to the principle until all the elements in the coding array are judged to be completed, and the final reference array is obtained.
And the statistic module 203 is configured to use a first value in the finally obtained reference array as a bootstrap code, where the first value in the reference array is [9017,4485], so that the bootstrap code is [9017,4485]. And counting the number of all values in the reference array, respectively taking the values in the reference array corresponding to the first two bits of the counted number as 0 codes and 1 codes, and taking the first value in the reference array as a guide code. In this embodiment, in the reference array obtained by the reference array adjustment module 202, the corresponding element values of the first two counted bits are [653,516] and [657,1639], so that the 0 code is [653,516], the 1 code is [657,1639], and the bootstrap code is [9017,4485].
A first conversion module 204, configured to convert the code array into an improved binary string, where the improved binary string is composed of a leading code, 0,1, a decimal code and an ending code, and the decimal code refers to the code data in the code array that cannot be identified and judged as the leading code, 0 code, 1 code and ending code and is reserved. Specifically, the first conversion module 204 sequentially determines whether all values in the code array, which do not include the end code, are within error ranges of the 0 code, the 1 code, and the pilot code, and if the values are within the error ranges of the 0 code, the 1 code, and the pilot code, correspondingly converts the values in the code array into the 0 code, the 1 code, and the pilot code; otherwise, the decimal code is converted into decimal code representation. To illustrate with the encoding array in embodiment one, the first value [9018,4482] in the encoding array is within the error range of the boot code [9017,4485] so that the value is identified as the boot code, i.e., the s-code, and the second value [662,1644] is within the error range of the 1-code so that the second value is converted to 1; the third value [662,544] is within the error range of the 0 code, so the third value is converted to 0; the value [664,19964] is not within the error range of the 0 code, the 1 code and the pilot code, and is therefore represented in the form of a decimal code, { dec:664-19964}, in the modified binary string. All values in the coding array are converted into an improved binary string consisting of a bootstrap code, 0,1, a decimal code and an end code according to the above principle, and the corresponding result of this embodiment is:
"s,1,0,0,1,1,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,1,0,{dec:664-19964},0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,{dec:662-39954},s,1,0,0,1,1,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,1,0,{dec:660-19954},0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,1,1,e"。
the second conversion module 205 is configured to convert the modified binary string into a hexadecimal string, and then convert the hexadecimal string into the infrared encoded encapsulated data, specifically, the second conversion module 205 converts all consecutive 0's and 1's in the modified binary string into 16-ary numbers in 4-bit sequence, respectively, and if the last remaining number of bits is less than 4, fills 0's in the following bits, and then converts the remaining number of bits into 16-ary numbers. In the modified binary string of this embodiment, the four-bit value after the s code is 1001, the corresponding 16-ary number is 9, the next four-bit value is 1000, the corresponding 16-ary number is 8, 0 and 1 between the s code and the decimal code { dec:664-19964}, and finally, a three-bit value 010 remains, at this time, 0 is filled later, 0100 is filled later, and the corresponding 16-ary number is 4. In this embodiment, the hexadecimal character string which does not include the boot code and the end code after conversion according to the above principle is:
"hex_00":["0x9890000a4","3"],"dec_00":"664,1996","hex_01":["0x00000003","0"],"hex_10":["0x9890000e4","3"],"dec_10":"660,1995","hex_11":["0x0000080b","0"]。
in the process, the leading code former bit value of the non-leading position in the improved binary character string is used as the connection code, and the leading code of the non-leading position is not processed.
Then, the hexadecimal character string is converted into infrared encoded encapsulation data, and in this embodiment, the obtained infrared encoded encapsulation data is:
{"header":"9017,4485","one":"657,1639","zero":"653,516","ptrail":"690","hex_00":["0x9890000a4","3"],"dec_00":"664,19964","hex_01":["0x00000003","0"],"repeat":"662,39954","hex_10":["0x9890000e4","3"],"dec_10":"660,19954","hex_11":["0x0000080b","0"]}。
the infrared code compression method and the infrared code compression device disclosed by the embodiment of the invention are suitable for infrared coded data of any structure and do not need to consider the combination format of the infrared codes.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the present invention, and it should be understood that the above-mentioned embodiments are only exemplary embodiments of the present invention, and are not intended to limit the present invention, and any modifications, equivalents, improvements and the like made within the principle of the present invention should be included in the protection scope of the present invention.

Claims (8)

1. An infrared code compression method is characterized by comprising the following steps:
grouping the infrared coded data pairwise in sequence, converting the infrared coded data into a coded array, and taking the last value in the coded array as an end code;
sequentially judging whether all values in the coding array are within the error range of the values of the reference array, and if not, adding the corresponding values in the coding array into the reference array; otherwise, calculating the average value of the coding array and the corresponding value in the reference array, and replacing the corresponding value in the reference array with the average value;
taking a first value in the reference array as a guide code, counting the number of all values in the reference array, and respectively taking the values in the corresponding reference arrays with the counted number of the first two bits as a 0 code and a 1 code;
converting the coded array into a modified binary string, the modified binary string consisting of a bootstrap code, a 0, a 1, a decimal code, and an end code;
and converting the improved binary character string into a hexadecimal character string, and converting the hexadecimal character string into infrared coding packaging data.
2. The infrared code compression method as claimed in claim 1, wherein the converting of the code array into the improved binary string is performed by sequentially determining whether all values in the code array, which do not include the end code, are within the error ranges of 0 code, 1 code and the guide code, and if so, correspondingly converting the values in the code array into 0 code, 1 code and the guide code; otherwise, the decimal code is converted into a decimal code representation.
3. The ir-coded compression method as claimed in claim 1, wherein the modified binary string is converted into hexadecimal string by sequentially converting every 4 bits of all consecutive 0 and 1 in the modified binary string into 16-ary number, and if the last remaining less than 4 bits are, filling 0 in the later stage and converting into 16-ary number.
4. A method of ir code compression as claimed in claim 2 in which the error range is between the current value minus 100 and the current value plus 100.
5. An infrared code compression apparatus, comprising:
the coded data grouping module is used for sequentially grouping the infrared coded data pairwise, converting the infrared coded data into a coded array, and taking the last value in the coded array as an end code;
the reference array adjusting module is used for sequentially judging whether all values in the coding array are within the error range of the values of the reference array, and if not, adding the corresponding values in the coding array into the reference array; otherwise, calculating the average value of the coding array and the corresponding value in the reference array, and replacing the corresponding value in the reference array with the average value;
the statistical module is used for taking a first value in the reference array as a guide code, counting the number of all values in the reference array, and respectively taking the values in the reference array corresponding to the first two counted numbers as a 0 code and a 1 code;
a first conversion module for converting the coding array into an improved binary string, the improved binary string consisting of a bootstrap code, 0,1, a decimal code, and an end code;
and the second conversion module is used for converting the improved binary character string into a hexadecimal character string and then converting the hexadecimal character string into infrared code packaging data.
6. The IR code compression device as claimed in claim 5, wherein the first converting module sequentially determines whether all values in the code array not containing the end code are within the error ranges of 0 code, 1 code and the guide code, and if so, converts the values in the code array into 0,1 and guide codes correspondingly; otherwise, the decimal code is converted into decimal code representation.
7. The IR code compression device as claimed in claim 5, wherein the second conversion module converts all consecutive 0's and 1's in the modified binary string into 16-ary numbers in 4 bits, respectively, and if the last remaining less than 4 bits, then fills in the 0's and converts them into 16-ary numbers.
8. An ir code compression device as claimed in claim 5, wherein the error range is between the current value minus 100 and the current value plus 100.
CN201811238222.1A 2018-10-23 2018-10-23 Infrared code compression method and device Active CN109586729B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811238222.1A CN109586729B (en) 2018-10-23 2018-10-23 Infrared code compression method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811238222.1A CN109586729B (en) 2018-10-23 2018-10-23 Infrared code compression method and device

Publications (2)

Publication Number Publication Date
CN109586729A CN109586729A (en) 2019-04-05
CN109586729B true CN109586729B (en) 2023-01-17

Family

ID=65920410

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811238222.1A Active CN109586729B (en) 2018-10-23 2018-10-23 Infrared code compression method and device

Country Status (1)

Country Link
CN (1) CN109586729B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH07236063A (en) * 1994-02-23 1995-09-05 Kyocera Corp Device and method for compressing data
WO2004110027A1 (en) * 2003-06-06 2004-12-16 Computer Associates Think, Inc. System and method for compressing url request parameters
CN101840394B (en) * 2010-03-04 2012-12-19 英华达(南昌)科技有限公司 Data decoding method
CN105791527A (en) * 2014-12-26 2016-07-20 北京奇虎科技有限公司 Method and device for transmitting contacts of mobile terminal

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH07236063A (en) * 1994-02-23 1995-09-05 Kyocera Corp Device and method for compressing data
WO2004110027A1 (en) * 2003-06-06 2004-12-16 Computer Associates Think, Inc. System and method for compressing url request parameters
CN101840394B (en) * 2010-03-04 2012-12-19 英华达(南昌)科技有限公司 Data decoding method
CN105791527A (en) * 2014-12-26 2016-07-20 北京奇虎科技有限公司 Method and device for transmitting contacts of mobile terminal

Also Published As

Publication number Publication date
CN109586729A (en) 2019-04-05

Similar Documents

Publication Publication Date Title
US11323551B2 (en) Method and device for processing data packets
JP2004517585A5 (en)
CN105103459A (en) System and method for low data-rate communication over a carrier current
CN109586729B (en) Infrared code compression method and device
CN103220428A (en) Audio signal data communication method for cell phone
CN101383618B (en) Encoding method for cyclic redundancy check code of transmission block
JPH08242177A (en) Binary arithmetic coding of input symbol and its device
CN102707339A (en) Method for correcting error of telemetry rainwater condition data by general conditions
KR102223031B1 (en) Differential signal processing device using for advanced braid clock signaling
CN116033034B (en) Data processing system for wireless receiving and transmitting platform
CN107564266A (en) A kind of remote controller codes learning method and remote control learning device
CN103365814B (en) A kind of serial data transmission method and system thereof
CN102385795B (en) Method and device for controlling multiple systems based on single group of infrared receiving devices
CN102339529A (en) Radio frequency remote control device with infrared learning function
CN112532618A (en) Non-transparent protocol conversion method and device for joint debugging test of stability control test system
CN104579573A (en) Coding method, decoding method, sending end and receiving end for feedback information of data transmission
CN111917491A (en) Signal transmission method and device
CN213302791U (en) Intelligent household appliance system with voice control function
CN101296056A (en) Method, device and network element for decoding an information word from a coded word
CN103944690A (en) Bitmap compression and decompression method in RLC data retransmission system
CN104113940A (en) Wireless sensor information transmission device and method for building and industrial control
CN105471512A (en) Photon receiving end and decoding method
CN104678840A (en) Signal collection and transmission method of soybean milk machine
CN117118456B (en) Magnetic control switch control data processing method based on depth fusion
CN218129913U (en) Game controller

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
GR01 Patent grant
GR01 Patent grant