WO2020206875A1 - 数据编码方法、解码方法、相关装置及存储介质 - Google Patents
数据编码方法、解码方法、相关装置及存储介质 Download PDFInfo
- Publication number
- WO2020206875A1 WO2020206875A1 PCT/CN2019/098115 CN2019098115W WO2020206875A1 WO 2020206875 A1 WO2020206875 A1 WO 2020206875A1 CN 2019098115 W CN2019098115 W CN 2019098115W WO 2020206875 A1 WO2020206875 A1 WO 2020206875A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- bit
- bit stream
- logical
- bits
- preset
- 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.)
- Ceased
Links
Classifications
-
- H—ELECTRICITY
- H03—ELECTRONIC CIRCUITRY
- H03M—CODING; DECODING; CODE CONVERSION IN GENERAL
- H03M5/00—Conversion of the form of the representation of individual digits
- H03M5/02—Conversion to or from representation by pulses
- H03M5/04—Conversion to or from representation by pulses the pulses having two levels
- H03M5/06—Code representation, e.g. transition, for a given bit cell depending only on the information in that bit cell
-
- H—ELECTRICITY
- H03—ELECTRONIC CIRCUITRY
- H03M—CODING; DECODING; CODE CONVERSION IN GENERAL
- H03M5/00—Conversion of the form of the representation of individual digits
- H03M5/02—Conversion to or from representation by pulses
- H03M5/04—Conversion to or from representation by pulses the pulses having two levels
- H03M5/14—Code representation, e.g. transition, for a given bit cell depending on the information in one or more adjacent bit cells, e.g. delay modulation code, double density code
-
- H—ELECTRICITY
- H03—ELECTRONIC CIRCUITRY
- H03K—PULSE TECHNIQUE
- H03K19/00—Logic circuits, i.e. having at least two inputs acting on one output; Inverting circuits
- H03K19/20—Logic circuits, i.e. having at least two inputs acting on one output; Inverting circuits characterised by logic function, e.g. AND, OR, NOR, NOT circuits
-
- H—ELECTRICITY
- H03—ELECTRONIC CIRCUITRY
- H03M—CODING; DECODING; CODE CONVERSION IN GENERAL
- H03M7/00—Conversion 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/30—Compression; Expansion; Suppression of unnecessary data, e.g. redundancy reduction
- H03M7/40—Conversion to or from variable length codes, e.g. Shannon-Fano code, Huffman code, Morse code
Definitions
- the present invention relates to the technical field of data coding, in particular to a data coding method, a decoding method, a related device and a storage medium.
- Digital signal coding technology aims to transform binary 0/1 digital data into a square wave with a certain polarity, amplitude, bit rate, and regular hopping.
- the transmitted data can be encoded into a code stream containing clock frequency components, so that the receiving end can extract clock synchronization information from the code stream, and the clock synchronization information can ensure that the receiving end receives data from the code stream at the correct timing.
- the original data is reproduced from the received signal.
- the receiving end is prone to phase shift or frequency deviation when data is restored. This error is It is called error code.
- the embodiments of the present invention provide a data encoding method, a decoding method, a related device, and a storage medium, which solves the problem of easy code errors during signal transmission, improves the reliability of encoding, and facilitates signal transmission.
- the present application provides a data encoding method, the method includes:
- the number of bits of the second bit stream is more than the number of bits of the first bit stream
- the target bit in the third bit stream is inverted and inserted into the first bit of the third bit stream as a flag bit to obtain encoded data.
- the method further includes:
- the first bit stream is 8-bit data
- the second bit stream is 9-bit data
- performing a preset logical operation according to the first bit stream to obtain the second bit stream includes:
- performing a preset logical operation according to the first bit stream to obtain the fifth, sixth, eighth and ninth bits of the second bit stream includes:
- the judging whether the logical values of consecutive multiple preset bits in the second bit stream are the same includes:
- the consecutive preset bits in the second bit stream are multiple consecutive preset bits in the middle of the second bit stream.
- the consecutive preset bits in the second bit stream are a plurality of consecutive preset bits in the lower bits of the second bit stream.
- this application provides a data decoding method, which includes:
- the number of bits of the decoded data is more than the number of bits of the second bit stream.
- the method further includes:
- the present application provides a data encoding device, and the data encoding device includes:
- a logical operation unit configured to perform a preset logical operation according to the first bit stream to obtain a second bit stream, where the number of bits of the second bit stream is more than the number of bits of the first bit stream;
- the encoding unit is used to determine whether the logical values of consecutive multiple preset bits in the second bit stream are the same, and if they are the same, perform the logical value of at least one bit in the middle position of the consecutive multiple preset bits Inversion processing is performed to obtain a third bit stream; the target bit in the third bit stream is inverted and inserted as a flag bit into the first bit of the third bit stream to obtain encoded data.
- the encoding unit is further configured to:
- the logical operation unit is specifically used for:
- the logical operation unit is specifically used for:
- the coding unit is specifically used for:
- the consecutive preset bits in the second bit stream are multiple consecutive preset bits in the middle of the second bit stream.
- the consecutive preset bits in the second bit stream are a plurality of consecutive preset bits in the lower bits of the second bit stream.
- the data encoding device includes:
- the first acquiring unit is configured to acquire the fourth bit stream corresponding to the original data to be decoded
- the second acquiring unit is configured to acquire flag information in the fourth bit stream
- the third acquiring unit is configured to acquire the preset bit in the fourth bit stream for inversion processing during encoding when the value of the flag bit is the inverted value of the target bit in the fourth bit stream information;
- the decoding unit is configured to perform inversion processing on preset bits in the fourth bit stream to obtain a fifth bit stream; perform a preset logical operation according to the fifth bit stream and remove the flag bit to obtain decoded data ,
- the number of bits of the decoded data is more than the number of bits of the fifth bit stream.
- the decoding unit is also used for:
- the preset bits in the fourth bit stream are multiple consecutive preset bits.
- the preset bit in the fourth bit stream is a plurality of consecutive preset bits with low bits.
- the present application provides a data decoding device, and the data decoding device includes:
- the first acquiring unit is configured to acquire the first bit stream corresponding to the original data to be decoded
- the second acquiring unit is configured to acquire flag bit information in the first bit stream
- the third acquiring unit is configured to acquire the preset bit in the first bit stream for inversion processing during encoding when the value of the flag bit is the inverted value of the target bit in the first bit stream information;
- the decoding unit is configured to perform inversion processing on preset bits in the first bit stream to obtain a second bit stream; perform preset logical operations according to the second bit stream and remove the flag bit to obtain decoded data ,
- the number of bits of the decoded data is more than the number of bits of the second bit stream.
- the decoding unit is also used for:
- the present application also provides a storage medium that stores a plurality of instructions, and the instructions are suitable for loading by a processor to execute the data encoding method in any one of the first aspect Or to perform the steps in the data decoding method described in any one of the second aspect.
- the first bit stream of the original coded data is converted into coded data, and the first bit stream of the original coded data is first subjected to a preset logical operation to obtain the second bit stream; then the signal is judged and reversed.
- Process and insert the corresponding flag bit to obtain a code with a certain jump amplitude and the number of consecutive 0 or 1 is lower than multiple preset bits, which solves the problem that the signal is prone to error in the transmission process and improves the reliability of the code It is convenient for signal transmission.
- Figure 1 is a schematic flowchart of an embodiment of a data encoding method provided by an embodiment of the present invention
- FIG. 2 is a schematic flowchart of an embodiment of a data decoding method provided by an embodiment of the present invention
- Figure 3 is a schematic structural diagram of an embodiment of a data encoding device provided by an embodiment of the present invention.
- Fig. 4 is a schematic structural diagram of an embodiment of a data decoding device provided by an embodiment of the present invention.
- first and second are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Therefore, the features defined with “first” and “second” may explicitly or implicitly include one or more of the features. In the description of the present invention, “plurality” means two or more than two, unless specifically defined otherwise.
- a transmitting/receiving clock (Clock) is also required.
- Information mechanism In order to improve signal transmission quality and reduce electromagnetic interference (Electromagnetic interference, EMI), provide debugging mechanism (Error correction) and clock-saving circuits, generally use the data to be transmitted to encode to meet the above requirements. After the signal is encoded in the existing data transmission technology, the problem of code error is still prone to occur in the transmission process. So far, there is no effective solution.
- the embodiments of the present invention provide a data encoding method, decoding method, related device, and storage medium. Detailed descriptions are given below.
- an embodiment of the present invention provides a data encoding method.
- the data encoding method includes: obtaining a first bit stream of original encoded data; performing a preset logical operation according to the first bit stream to obtain a second bit stream;
- the bit stream has more bits than the first bit stream; it is judged whether the logical values of consecutive preset bits in the second bit stream are the same. If they are the same, at least the middle position of the consecutive preset bits
- the logic value of one bit is inverted to obtain the third bit stream; the target bit in the third bit stream is inverted and inserted as a flag bit into the first bit of the third bit stream to obtain encoded data.
- FIG. 1 it is a schematic flowchart of an embodiment of a data encoding method in an embodiment of the present invention, and the method includes:
- the original encoded data may be data that needs to be transmitted to the receiver (Receiver, RX) under the transmitter (Transmitter, TX).
- the original encoded data is in the form of a bit stream, for example, when the first bit stream is 8-bit data, such as 00111100.
- the number of bits in the second bit stream is more than the number of bits in the first bit stream.
- the first bit stream is 8-bit data
- the second bit stream is 9-bit data. It is understandable that in other embodiments of the present invention, The first bit stream and the second bit stream can also be data with other digits, as long as the digits of the second bit stream are more than the digits of the first bit stream, which is not specifically limited here.
- step 103 Determine whether the logical values of multiple consecutive preset bits in the second bit stream are the same, if they are the same, perform step 104, and if they are not the same, perform step 106.
- the consecutive preset bits in the second bit stream may be multiple consecutive preset bits in the low order of the second bit stream, or multiple consecutive preset bits in the middle, or multiple high-order presets.
- the number of consecutive preset positions is not specifically limited here. In addition, the number of multiple preset positions can be set as required, for example, three.
- the plurality of consecutive preset positions may be an odd number, so that the logical value of at least one bit in the middle position is selected for inversion processing among the plurality of consecutive preset positions.
- the logical value of at least one bit of can be set according to the number of multiple preset bits.
- the number of consecutive multiple preset bits is 3, one bit can be selected for inversion processing, and the one bit can be the middle of multiple consecutive preset bits
- the first bit stream of the original coded data is converted into coded data, and the first bit stream of the original coded data is first subjected to a preset logical operation to obtain the second bit stream; then the signal is judged and reversed.
- Process and insert the corresponding flag bit to obtain a code with a certain jump amplitude and the number of consecutive 0 or 1 is lower than multiple preset bits, which solves the problem that the signal is prone to error in the transmission process and improves the reliability of the code It is convenient for signal transmission.
- the first bit stream may be 8-bit data
- the second bit stream is 9-bit data
- the preset logical operation is performed according to the first bit stream to obtain the second
- the bit stream includes: assigning the first bit of the first bit stream to the first bit of the second bit stream; assigning the second bit of the first bit stream to the first bit of the second bit stream Two bits; after inverting the second bit of the first bit stream, assign it to the third bit of the second bit stream; assign the third bit of the first bit stream to the second bit stream After inverting the sixth bit of the first bit stream, assign it to the seventh bit of the second bit stream; perform a preset logical operation according to the first bit stream to obtain the second The fifth, sixth, eighth, and ninth bit stream.
- performing a preset logical operation according to the first bit stream to obtain the fifth, sixth, eighth, and ninth bits of the second bit stream may include: performing the first bit stream The first bit, the second bit, and the fourth bit of the stream are respectively subjected to multiple logical operations, and the results of the multiple logical operations are subjected to a logical OR operation, and the logical OR operation result is used as the second bit stream Fifth bit; perform multiple logical operations on the first bit, second bit, and fifth bit of the first bit stream, respectively, perform a first logical OR operation on the results of the multiple logical AND operations, and combine all
- the first logical OR operation result is used as the sixth bit of the second bit stream; the first bit, the second bit, and the seventh bit of the first bit stream are respectively subjected to multiple logical operations, and the multiple Perform a second logical OR operation on the result of the second logical AND operation, and use the second logical OR operation result as the eighth bit of the second bit stream; and perform the sum of the first bit and the second bit of the first
- the second bit stream is described in detail by performing a preset logical operation based on the first bit stream in conjunction with a specific embodiment.
- the first bit stream is directly assigned through the following logical operations to encode 8bit data into 9bit data.
- the specific encoding mechanism is as follows:
- bn[5] (bm[4]& ⁇ bm[1]& ⁇ bm[0])
- the result is the sixth bit of the second bitstream bn[5])
- bn[7] ⁇ ((bm[6]& ⁇ bm[1]& ⁇ bm[0])
- bn[8] (bm[7]& ⁇ bm[1]& ⁇ bm[0])
- the AND operation is to perform a logical AND operation on the first bit, the second bit and the eighth bit of the first bit stream, and then perform a logical OR operation on the results of the above four logical AND operations, and the logical OR operation
- the result is the ninth bit of the second bit stream bn[8])
- bm[0 ⁇ 7] is the original 8-bit encoded data, that is, the first bit stream
- bn[0 ⁇ 8] is the converted 9-bit data, that is, the second bit stream is obtained
- the inversion of a bit indicates that the bit is inverted
- the value for example, the first bit is inverted ⁇ bm[1]
- the determination in step 103 above whether the logical values of consecutive multiple preset bits in the second bit stream are the same may further include: Perform a logical AND operation on the value to obtain the first operation result; perform a logical OR operation on the values in the consecutive plurality of preset bits to obtain the second operation result; perform the first operation result and the second operation result As a result, perform a logical AND operation to obtain a third operation result; when the third operation result is 1, the logical values of the consecutive multiple preset bits are not the same, and when the third operation result is 0, The logical values of the consecutive multiple preset bits are the same.
- NAND End[6 ⁇ 8]
- the above logical expression is 1, which means that the logical values of bits 6 to 8 of the second bit stream are not the same, that is, they are not 0 or 1 at the same time, and the coding quality standard is met, and the flag bit can be inserted directly. If the above logical expression The formula is 0, which means that the logic values of the 6th to 8th bits of the second bit stream are the same, then the 7th bit of the second bit stream is inverted, and then the flag bit is inserted.
- the target bit can be inserted as a flag bit into the first bit of the second bit stream to obtain encoded data.
- the target bit in the third bit stream can be inverted and inserted into the first bit of the third bit stream as a flag bit to obtain the encoded data.
- an embodiment of the present invention also provides a data decoding method, the data decoding method includes:
- the original data to be decoded may be data received by the receiver (RX) and transmitted by the transmitter (Transmitter, TX).
- the original data to be decoded may be in the form of a bit stream, for example, when the first bit stream is 10-bit data, such as 0011110011.
- the flag information may be a value of "0" or "1" as described in the data encoding method.
- the preset bit information can be set according to a method corresponding to the data encoding method. For example, when there are three consecutive bits in the data encoding method, the preset bit information is the bit in the middle of the three bits. For example, in the data encoding method, the consecutive multiple bits End[6 ⁇ 8] are 111 respectively, and the first bit stream of the corresponding decoded data is 101 (the middle bit is inverted). In the first bit stream Then the preset position is 0 in the middle.
- the preset bits in the first bit stream are inverted to obtain the second bit stream.
- the first bit of the corresponding decoded data in the data decoding method In the stream it is 101 (the middle bit is inverted).
- the preset bit is 0 in the middle. Invert the "0" and restore it to "1" to get the second bit stream. .
- the preset logical operation based on the second bit stream may be the opposite logic of "predetermined logical operation based on the first bit stream to obtain the second bit stream" in the above data encoding method embodiment.
- the calculation method will not be described in detail here.
- the preset logical operation based on the second bit stream may be performed before the flag bit is removed, or the flag bit may be removed first, and then based on the second bit stream.
- the preset logic operation There is no limit to the preset logic operation, but no matter how the logic operation is performed, the flag bit does not participate in the logic operation.
- the present invention by converting the first bit stream of the original decoded data into decoded data, first obtain the flag information in the first bit stream; then judge by the flag bit, when the value of the flag bit is in the first bit stream When the value of the target bit is inverted, obtain the preset bit information of the inversion process during encoding in the first bit stream; perform the inversion process on the preset bit in the first bit stream to obtain the second bit stream; The bit stream performs a preset logic operation and removes the flag bit to obtain decoded data.
- the data encoding method it solves the problem that the signal is prone to error in the transmission process, improves the reliability of the decoded data, and facilitates the signal transmission.
- the data decoding method may further include:
- an embodiment of the present invention also provides a data encoding device, and the data encoding device 300 includes:
- the obtaining unit 301 is configured to obtain the first bit stream of the original encoded data
- the logical operation unit 302 is configured to perform a preset logical operation according to the first bit stream to obtain a second bit stream, and the number of bits of the second bit stream is more than the number of bits of the first bit stream;
- the encoding unit 303 is configured to determine whether the logical values of consecutive multiple preset bits in the second bit stream are the same, and if they are the same, change the logical value of at least one bit in the middle position of the consecutive multiple preset bits Perform inversion processing to obtain a third bit stream; invert the target bit in the third bit stream and insert it as a flag bit into the first bit of the third bit stream to obtain encoded data.
- the encoding unit 303 is further configured to: when the logical values of multiple consecutive preset bits in the second bit stream are not the same, insert the target bit as a flag bit into the second bit stream First, get the encoded data.
- the first bit stream is 8-bit data
- the second bit stream is 9-bit data
- the logical operation unit 302 is specifically configured to:
- logical operation unit 302 is specifically configured to:
- the encoding unit 303 is specifically configured to:
- the data encoding device provided by the embodiment of the present invention solves the problem that the signal is prone to error in the transmission process, improves the reliability of the encoded data, and facilitates signal transmission.
- an embodiment of the present invention also provides a data decoding device.
- the data decoding device 400 includes:
- the first obtaining unit 401 is configured to obtain a first bit stream corresponding to the original data to be decoded
- the second acquiring unit 402 is configured to acquire flag bit information in the first bit stream
- the third acquiring unit 403 is configured to acquire the preset inversion processing of encoding in the first bit stream when the value of the flag bit is the inverted value of the target bit in the first bit stream Bit information
- the decoding unit 404 is configured to invert a preset bit in the first bit stream to obtain a second bit stream; perform a preset logical operation according to the second bit stream and remove the flag bit to obtain a decoding Data, the number of bits of the decoded data is more than the number of bits of the second bit stream.
- the decoding unit 404 is further configured to: when the value of the flag bit is the value of the target bit in the first bit stream, perform a preset logical operation according to the first bit stream and remove The flag bit obtains the decoded data.
- the data decoding device provided by the embodiment of the present invention solves the problem that the signal is prone to error in the transmission process, improves the reliability of the decoded data, and facilitates signal transmission.
- the present application also provides a storage medium that stores a plurality of instructions, and the instructions are suitable for loading by a processor to execute the steps in any of the foregoing data encoding method embodiments, or to execute any data decoding Steps in the method embodiment.
- each of the above units or structures can be implemented as independent entities, or can be combined arbitrarily, and implemented as the same or several entities.
- each of the above units or structures please refer to the previous method embodiments. No longer.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Compression Or Coding Systems Of Tv Signals (AREA)
- Compression, Expansion, Code Conversion, And Decoders (AREA)
Abstract
一种数据编码方法、解码方法、相关装置及存储介质。该数据编码方法首先将原始编码数据的第一比特流通过逻辑运算,得到第二比特流;再通过信号判断、取反处理并插入相应的标志位,得到具有一定跳变幅度的编码数据,解决了信号在传输过程中容易发生误码的问题,提高编码的可靠性,便于信号传输。
Description
本发明涉及数据编码技术领域,具体涉及一种数据编码方法、解码方法、相关装置及存储介质。
数字信号编码技术旨在使二进制0/1数字数据变换成具有一定极性、幅度、比特速率,跳变规则的方波波形。信号在串行传输的过程中,传输的数据可以被编码成包含有时钟频率分量的码流,使得接收端可以从码流中提取时钟同步信息,时钟同步信息可以保证接收端按照正确的时序从接收到的信号中再生出原始数据,然而信号在传输过程中连续的0或者连续的1的个数过多时,接收端始终数据恢复时很容易会发生相位移位或者频率偏差,这种错误被称为误码。
现有数据传输技术中信号在传输过程中容易发生误码问题,迄今为止,尚未有有效的解决方案。
本发明实施例提供一种数据编码方法、解码方法、相关装置及存储介质,解决了信号在传输过程中容易发生误码的问题,提高编码的可靠性,便于信号传输。
为解决上述问题,第一方面,本申请提供一种数据编码方法,所述方法包括:
获取原始编码数据的第一比特流;
根据所述第一比特流进行预设的逻辑运算,得到第二比特流,所述第二比特流的位数多于所述第一比特流的位数;
判断所述第二比特流中连续的多个预设位的逻辑值是否相同,若相同,将所述连续的多个预设位中中间位置的至少一个位的逻辑值进行取反处理,得到第三比特流;
将所述第三比特流中目标位取反后作为标志位插入到所述第三比特流首位,得到编码数据。
其中,所述方法还包括:
当所述第二比特流中连续的多个预设位的逻辑值不相同时,将所述目标位作为标志位插入到所述第二比特流首位,得到编码数据。
其中,所述第一比特流为8位数据,所述第二比特流为9位数据,所述根据所述第一比特流进行预设的逻辑运算,得到第二比特流,包括:
将所述第一比特流的第一位赋值为所述第二比特流的第一位;
将所述第一比特流的第二位赋值为所述第二比特流的第二位;
对所述第一比特流的第二位取反后,赋值为所述第二比特流的第三位;
将所述第一比特流的第三位赋值为所述第二比特流的第四位;
对所述第一比特流的第六位取反后,赋值为所述第二比特流的第七位;
根据所述第一比特流进行预设的逻辑运算,得到第二比特流的第五位、第六位、第八位和第九位。
其中,所述根据所述第一比特流进行预设的逻辑运算,得到第二比特流的第五位、第六位、第八位和第九位,包括:
对所述第一比特流的第一位、第二位和第四位分别进行多次逻辑运算,并对所述多次逻辑运算的结果进行逻辑或运算,将所述逻辑或运算结果作为所述第二比特流的第五位;
对所述第一比特流的第一位、第二位和第五位分别进行多次逻辑运算,并对所述多次逻辑与运算的结果进行第一逻辑或运算,将所述第一逻辑或运算结果作为所述第二比特流的第六位;
对所述第一比特流的第一位、第二位和第七位分别进行多次逻辑运算,并对所述多次逻辑与运算的结果进行第二逻辑或运算,将所述第二逻辑或运算结果作为所述第二比特流的第八位;
对所述第一比特流的第一位、第二位和第八位分别进行多次逻辑运算,并对所述多次逻辑与运算的结果进行第三逻辑或运算,将所述第三逻辑或运算结果作为所述第二比特流的第九位。
其中,所述判断所述第二比特流中连续的多个预设位的逻辑值是否相同,包括:
对所述连续的多个预设位中的取值进行逻辑与非运算,得到第一运算结果;
对所述连续的多个预设位中的取值进行逻辑或运算,得到第二运算结果;
对所述第一运算结果和第二运算结果进行逻辑与运算,得到第三运算结果;
当所述第三运算结果为1时,所述连续的多个预设位的逻辑值不相同,当所述第三运算结果为0时,所述连续的多个预设位的逻辑值相同。
其中,所述第二比特流中连续的预设位为所述第二比特流中间的多个连续的预设位。
其中,所述第二比特流中连续的预设位为所述第二比特流中低位的多个连续的预设位。
第二方面,本申请提供一种数据解码方法,该方法包括:
获取原始待解码数据对应的第一比特流;
获取所述第一比特流中的标志位信息;
当所述标志位的取值为所述第一比特流中目标位取反后的取值时,获取所述第一比特流中编码时取反处理的预设位信息;
对所述第一比特流中预设位进行取反处理,得到第二比特流;
根据所述第二比特流进行预设的逻辑运算并去掉所述标志位,得到解码数据,所述解码数据的位数多于所述第二比特流的位数。
其中,所述方法还包括:
当所述标志位的取值为所述第一比特流中目标位的取值时,根据所述第一比特流进行预设的逻辑运算并去掉所述标志位,得到解码数据。
第三方面,本申请提供一种数据编码装置,所述数据编码装置包括:
获取单元,用于获取原始编码数据的第一比特流;
逻辑运算单元,用于根据所述第一比特流进行预设的逻辑运算,得到第二比特流,所述第二比特流的位数多于所述第一比特流的位数;
编码单元,用于判断所述第二比特流中连续的多个预设位的逻辑值是否相同,若相同,将所述连续的多个预设位中中间位置的至少一个位的逻辑值进行取反处理,得到第三比特流;将所述第三比特流中目标位取反后作为标志位插入到所述第三比特流首位,得到编码数据。
其中,所述第一比特流为8位数据,所述第二比特流为9位数据,所述编码单元还用于:
当所述第二比特流中连续的多个预设位的逻辑值不相同时,将所述目标位作为标志位插入到所述第二比特流首位,得到编码数据。
其中,所述逻辑运算单元具体用于:
将所述第一比特流的第一位赋值为所述第二比特流的第一位;
将所述第一比特流的第二位赋值为所述第二比特流的第二位;
对所述第一比特流的第二位取反后,赋值为所述第二比特流的第三位;
将所述第一比特流的第三位赋值为所述第二比特流的第四位;
对所述第一比特流的第六位取反后,赋值为所述第二比特流的第七位;
根据所述第一比特流进行预设的逻辑运算,得到第二比特流的第五位、第六位、第八位和第九位。
其中,所述逻辑运算单元具体用于:
对所述第一比特流的第一位、第二位和第四位分别进行多次逻辑运算,并对所述多次逻辑运算的结果进行逻辑或运算,将所述逻辑或运算结果作为所述第二比特流的第五位;
对所述第一比特流的第一位、第二位和第五位分别进行多次逻辑运算,并对所述多次逻辑运算的结果进行第一逻辑或运算,将所述第一逻辑或运算结果作为所述第二比特流的第六位;
对所述第一比特流的第一位、第二位和第七位分别进行多次逻辑运算,并对所述多次逻辑与运算的结果进行第二逻辑或运算,将所述第二逻辑或运算结果作为所述第二比特流的第八位;
对所述第一比特流的第一位、第二位和第八位分别进行多次逻辑运算,并对所述多次逻辑与运算的结果进行第三逻辑或运算,将所述第三逻辑或运算结果作为所述第二比特流的第九位。
其中,所述编码单元具体用于:
对所述连续的多个预设位中的取值进行逻辑与非运算,得到第一运算结果;
对所述连续的多个预设位中的取值进行逻辑或运算,得到第二运算结果;
对所述第一运算结果和第二运算结果进行逻辑与运算,得到第三运算结果;
当所述第三运算结果为1时,所述连续的多个预设位的逻辑值不相同,当所述第三运算结果为0时,所述连续的多个预设位的逻辑值相同。
其中,所述第二比特流中连续的预设位为所述第二比特流中间的多个连续的预设位。
其中,所述第二比特流中连续的预设位为所述第二比特流中低位的多个连续的预设位。
其中,所述数据编码装置包括:
第一获取单元,用于获取原始待解码数据对应的第四比特流;
第二获取单元,用于获取所述第四比特流中的标志位信息;
第三获取单元,用于当所述标志位的取值为所述第四比特流中目标位取反后的取值时,获取所述第四比特流中编码时取反处理的预设位信息;
解码单元,用于对所述第四比特流中预设位进行取反处理,得到第五比特流;根据所述第五比特流进行预设的逻辑运算并去掉所述标志位,得到解码数据,所述解码数据的位数多于所述第五比特流的位数。
其中,所述解码单元还用于:
当所述标志位的取值为所述第四比特流中目标位的取值时,根据所述第四比特流进行预设的逻辑运算并去掉所述标志位,得到解码数据。
其中,所述第四比特流中预设位为多个连续的预设位。
其中,所述第四比特流中预设位为低位的多个连续的预设位。
第四方面,本申请提供一种数据解码装置,所述数据解码装置包括:
第一获取单元,用于获取原始待解码数据对应的第一比特流;
第二获取单元,用于获取所述第一比特流中的标志位信息;
第三获取单元,用于当所述标志位的取值为所述第一比特流中目标位取反后的取值时,获取所述第一比特流中编码时取反处理的预设位信息;
解码单元,用于对所述第一比特流中预设位进行取反处理,得到第二比特流;根据所述第二比特流进行预设的逻辑运算并去掉所述标志位,得到解码数据,所述解码数据的位数多于所述第二比特流的位数。
其中,所述解码单元还用于:
当所述标志位的取值为所述第一比特流中目标位的取值时,根据所述第一比特流进行预设的逻辑运算并去掉所述标志位,得到解码数据。
第五方面,本申请还提供一种存储介质,所述存储介质存储有多条指令,所述指令适于处理器进行加载,以执行第一方面中任一项所述的数据编码方法中的步骤,或者以执行第二方面中任一项所述的数据解码方法中的步骤。
本发明实施例中通过将原始编码数据的第一比特流转换成编码数据,首先将原始编码数据的第一比特流通过预设的逻辑运算,得到第二比特流;再通过信号判断、取反处理并插入相应的标志位,得到具有一定跳变幅度、连续0或者1的个数低于多个预设位的编码,解决了信号在传输过程中容易发生误码的问题,提高编码的可靠性,便于信号传输。
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1是本发明实施例提供的数据编码方法的一个实施例流程示意图;
图2是本发明实施例提供的数据解码方法的一个实施例流程示意图;
图3是本发明实施例提供的数据编码装置的一个实施例结构示意图;
图4是本发明实施例提供的数据解码装置的一个实施例结构示意图。
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
在本发明的描述中,需要理解的是,术语“中心”、“纵向”、“横向”、“长度”、“宽度”、“厚度”、“上”、“下”、“前”、“后”、“左”、“右”、“竖直”、“水平”、“顶”、“底”、“内”、“外”等指示的方位或位置关系为基于附图所示的方位或位置关系,仅是为了便于描述本发明和简化描述,而不是指示或暗示所指的装置或元件必须具有特定的方位、以特定的方位构造和操作,因此不能理解为对本发明的限制。此外,术语“第一”、“第二”仅用于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括一个或者更多个所述特征。在本发明的描述中,“多个”的含义是两个或两个以上,除非另有明确具体的限定。
在本申请中,“示例性”一词用来表示“用作例子、例证或说明”。本申请中被描述为“示例性”的任何实施例不一定被解释为比其它实施例更优选或更具优势。为了使本领域任何技术人员能够实现和使用本发明,给出了以下描述。在以下描述中,为了解释的目的而列出了细节。应当明白的是,本领域普通技术人员可以认识到,在不使用这些特定细节的情况下也可以实现本发明。在其它实例中,不会对公知的结构和过程进行详细阐述,以避免不必要的细节使本发明的描述变得晦涩。因此,本发明并非旨在限于所示的实施例,而是与符合本申请所公开的原理和特征的最广范围相一致。
一般来说,传送端(Transmitter,TX)与接收端(Receiver,RX)彼此之间在传输数据时,除了需要有传送/接收数据的机制之外,也需要有传送/接收时脉(Clock)信息的机制。在高速接口传输数据时,为了要提高信号传输质量、降低电磁干扰(Electromagnetic
interference,EMI)、提供除错机制
(Error correction)以及节省时脉电路,一般会利用将欲传输的数据加以编码来满足以上需求。现有数据传输技术中信号编码后,在传输过程中仍容易发生误码问题,迄今为止,尚未有有效的解决方案。
基于此,本发明实施例提供一种数据编码方法、解码方法、相关装置及存储介质。以下分别进行详细说明。
首先,本发明实施例中提供一种数据编码方法,该数据编码方法包括:获取原始编码数据的第一比特流;根据第一比特流进行预设的逻辑运算,得到第二比特流,第二比特流的位数多于第一比特流的位数;判断第二比特流中连续的多个预设位的逻辑值是否相同,若相同,将连续的多个预设位中中间位置的至少一个位的逻辑值进行取反处理,得到第三比特流;将第三比特流中目标位取反后作为标志位插入到第三比特流首位,得到编码数据。
如图1所示,为本发明实施例中数据编码方法的一个实施例流程示意图,该方法包括:
101、获取原始编码数据的第一比特流。
具体的,该原始编码数据可以是传送端(Transmitter,TX)下需要传输到接收端(Receiver,RX)的数据。该原始编码数据为比特流形式,例如第一比特流为8位数据时,如00111100等。
102、根据第一比特流进行预设的逻辑运算,得到第二比特流。
其中,第二比特流的位数多于第一比特流的位数,例如第一比特流为8位数据,第二比特流为9位数据,可以理解的是,在本发明其他实施例中,第一比特流和第二比特流还可以是其他位数的数据,只要第二比特流的位数多于第一比特流的位数即可,具体此处不作限定。
103、判断第二比特流中连续的多个预设位的逻辑值是否相同,若相同,执行步骤104,若不相同,可以执行步骤106。
具体的,第二比特流中连续的预设位可以是第二比特流中低位的多个连续的预设位,也可以是中间的多个连续的预设位,还可以是高位的多个连续的预设位,具体此处不作限定,另外,多个预设位可以根据需要设定数量,例如3个等。
104、将连续的多个预设位中中间位置的至少一个位的逻辑值进行取反处理,得到第三比特流。
其中,该连续的多个预设位可以是奇数个数,以便在连续的多个预设位中选取中间位置的至少一个位的逻辑值进行取反处理,该多个预设位中中间位置的至少一个位的逻辑值可以按照多个预设位的数量进行设置,例如多个预设位的数量为n,n=2m+1,n≥3,且n,m均为正整数,则该至少一个位的数量为m,具体的,即连续的多个预设位的数量为3时,可以选择1个位进行取反处理,该1个位可以是连续的多个预设位中间的位,当连续的多个预设位的数量为5时,可以选择2个位进行取反处理,依次类推。
105、将第三比特流中目标位取反后作为标志位插入到第三比特流首位,得到编码数据。
106、将目标位作为标志位插入到所述第二比特流首位,得到编码数据。
本发明实施例中通过将原始编码数据的第一比特流转换成编码数据,首先将原始编码数据的第一比特流通过预设的逻辑运算,得到第二比特流;再通过信号判断、取反处理并插入相应的标志位,得到具有一定跳变幅度、连续0或者1的个数低于多个预设位的编码,解决了信号在传输过程中容易发生误码的问题,提高编码的可靠性,便于信号传输。
在本发明一些实施例中,所述第一比特流可以为8位数据,所述第二比特流为9位数据,所述根据所述第一比特流进行预设的逻辑运算,得到第二比特流,包括:将所述第一比特流的第一位赋值为所述第二比特流的第一位;将所述第一比特流的第二位赋值为所述第二比特流的第二位;对所述第一比特流的第二位取反后,赋值为所述第二比特流的第三位;将所述第一比特流的第三位赋值为所述第二比特流的第四位;对所述第一比特流的第六位取反后,赋值为所述第二比特流的第七位;根据所述第一比特流进行预设的逻辑运算,得到第二比特流的第五位、第六位、第八位和第九位。
具体的,所述根据所述第一比特流进行预设的逻辑运算,得到第二比特流的第五位、第六位、第八位和第九位,可以包括:对所述第一比特流的第一位、第二位和第四位分别进行多次逻辑运算,并对所述多次逻辑运算的结果进行逻辑或运算,将所述逻辑或运算结果作为所述第二比特流的第五位;对所述第一比特流的第一位、第二位和第五位分别进行多次逻辑运算,并对所述多次逻辑与运算的结果进行第一逻辑或运算,将所述第一逻辑或运算结果作为所述第二比特流的第六位;对所述第一比特流的第一位、第二位和第七位分别进行多次逻辑运算,并对所述多次逻辑与运算的结果进行第二逻辑或运算,将所述第二逻辑或运算结果作为所述第二比特流的第八位;对所述第一比特流的第一位、第二位和第八位分别进行多次逻辑运算,并对所述多次逻辑与运算的结果进行第三逻辑或运算,将所述第三逻辑或运算结果作为所述第二比特流的第九位。
下面以第一比特流可以为8位数据,第二比特流为9位数据,结合一具体实施例对根据第一比特流进行预设的逻辑运算,得到第二比特流进行详细描述。
首先对第一比特流通过如下逻辑运算直接赋值,将8bit数据编码成9bit数据,具体编码机制如下:
bn[0]=bm[0];(将第一比特流的第一位赋值为第二比特流的第一位)
bn[1]=bm[1];(将第一比特流的第二位赋值为第二比特流的第二位)
bn[2]=~bm[1];(对第一比特流的第二位取反后,赋值为第二比特流的第三位)
bn[3]=bm[2];(将第一比特流的第三位赋值为第二比特流的第四位)
bn[4]=~((bm[3]&~bm[1]&~bm[0])|(~bm[3]&~bm[1]&bm[0])|(bm[3]&bm[1]&bm[0])|(~bm[3]&bm[1]&~bm[0]));(分别对第一比特流的第一位取反、第二位取反和第四位进行逻辑与运算,对第一比特流的第一位、第二位取反和第四位取反进行逻辑与运算,对所述第一比特流的第一位、第二位和第四位进行逻辑与运算,对所述第一比特流的第一位取反、第二位和第四位取反进行逻辑与运算,然后对上述四次逻辑与运算结果进行逻辑或运算,将该逻辑或运算结果作为第二比特流的第五位bn[4])
bn[5]=(bm[4]&~bm[1]&~bm[0])|(~bm[4]&~bm[1]&bm[0])|(bm[4]&bm[1]&bm[0])|(~bm[4]&bm[1]&~bm[0]);(分别对第一比特流的第一位取反、第二位取反和第五位进行逻辑与运算,对第一比特流的第一位、第二位取反和第五位取反进行逻辑与运算,对所述第一比特流的第一位、第二位和第五位进行逻辑与运算,对所述第一比特流的第一位取反、第二位和第五位取反进行逻辑与运算,然后对上述四次逻辑与运算结果进行逻辑或运算,将该逻辑或运算结果作为第二比特流的第六位bn[5])
bn[6]=~bm[5];(对第一比特流的第六位取反后,赋值为第二比特流的第七位)
bn[7]=~((bm[6]&~bm[1]&~bm[0])|(~bm[6]&~bm[1]&bm[0])|(bm[6]&bm[1]&bm[0])|(~bm[6]&bm[1]&~bm[0]))
;(分别对第一比特流的第一位取反、第二位取反和第七位进行逻辑与运算,对第一比特流的第一位、第二位取反和第七位取反进行逻辑与运算,对所述第一比特流的第一位、第二位和第七位进行逻辑与运算,对所述第一比特流的第一位取反、第二位和第七位取反进行逻辑与运算,然后对上述四次逻辑与运算结果进行逻辑或运算,将该逻辑或运算结果作为第二比特流的第八位bn[7])
bn[8]=(bm[7]&~bm[1]&~bm[0])|(~bm[7]&~bm[1]&bm[0])|(bm[7]&bm[1]&bm[0])|(~bm[7]&bm[1]&~bm[0]);(分别对第一比特流的第一位取反、第二位取反和第八位进行逻辑与运算,对第一比特流的第一位、第二位取反和第八位取反进行逻辑与运算,对所述第一比特流的第一位、第二位和第八位进行逻辑与运算,对所述第一比特流的第一位取反、第二位和第八位取反进行逻辑与运算,然后对上述四次逻辑与运算结果进行逻辑或运算,将该逻辑或运算结果作为第二比特流的第九位bn[8])
其中,bm[0~7]为原始8bit编码数据,即第一比特流,bn[0~8]为转换后的9bit数据,即得到第二比特流,某一位取反表示该位取反后的值,例如第一位取反~bm[1],表示第一位取反后的值。
在本发明具体实施时,上述步骤103中所述判断所述第二比特流中连续的多个预设位的逻辑值是否相同,可以进一步包括:对所述连续的多个预设位中的取值进行逻辑与非运算,得到第一运算结果;对所述连续的多个预设位中的取值进行逻辑或运算,得到第二运算结果;对所述第一运算结果和第二运算结果进行逻辑与运算,得到第三运算结果;当所述第三运算结果为1时,所述连续的多个预设位的逻辑值不相同,当所述第三运算结果为0时,所述连续的多个预设位的逻辑值相同。
具体的,下面以多个预设位为3位,第二比特流为9位数据为例进行详细描述。假设第二比特流为End[1~9],上述所述第二比特流中连续的多个预设位的逻辑值是否相同具体为判断第二比特流中的第6位至第8位的逻辑值相同,可以采用如下逻辑表达式:
AND(NAND(End[6~8]),OR(End[6~8]))
当第二比特流的第6位至第8位均为1时,NAND(End[6~8])为0;
当第二比特流的第6位至第8位均为0时,OR(End[6~8])为0;
上述逻辑表达式为1,则意味着第二比特流的第6位至第8位逻辑值不相同,即不同时为0或者1,满足编码质量标准,可以直接插入标志位,若上述逻辑表达式为0,则意味着第二比特流的第6位至第8位逻辑值相同,则对第二比特流的第7位取反,再插入标志位。
需要说明的是,本发明实施例中第二比特流中连续的多个预设位的逻辑值均相同和不相同时,可以插入不同的标志位,例如,当第二比特流中连续的多个预设位的逻辑值相同时,可以将目标位作为标志位插入到所述第二比特流首位,得到编码数据,当第二比特流中连续的多个预设位的逻辑值不相同时,可以将第三比特流中目标位取反后作为标志位插入到第三比特流首位,得到编码数据。
为了更好实施本发明实施例中数据编码方法,在数据编码方法基础之上,对应的,如图2所示,本发明实施例中还提供一种数据解码方法,该数据解码方法包括:
201、获取原始待解码数据对应的第一比特流。
具体的,该原始待解码数据可以是接收端(Receiver,RX)接收到传送端(Transmitter,TX)传输的数据。该原始待解码数据可以为比特流形式,例如第一比特流为10位数据时,如0011110011等。
202、获取所述第一比特流中的标志位信息。
具体的,标志位信息可以是如数据编码方法中描述的“0”或“1”取值。
203、当所述标志位的取值为所述第一比特流中目标位取反后的取值时,获取所述第一比特流中编码时取反处理的预设位信息。
其中,该预设位信息可以按照与数据编码方法对应的方法进行设定,例如,当数据编码方法中连续的多个位为3个时,该预设位信息为该3个位中间的位,例如,数据编码方法中该连续的多个位End[6~8]分别为111,对应的解码数据的第一比特流中即为101(中间位取反处理了),在第一比特流则该预设位为中间的0。
204、对所述第一比特流中预设位进行取反处理,得到第二比特流。
具体的,在数据解码方法中第一比特流中预设位进行取反处理,即可得到第二比特流,接着以步骤203中为例,在数据解码方法中对应的解码数据的第一比特流中即为101(中间位取反处理了),在第一比特流则该预设位为中间的0,将该“0”取反处理,恢复为“1”即可得到第二比特流。
205、根据所述第二比特流进行预设的逻辑运算并去掉所述标志位,得到解码数据,所述解码数据的位数多于所述第二比特流的位数。
本发明实施例中,根据所述第二比特流进行预设的逻辑运算可以采用上述数据编码方法实施例中“根据第一比特流进行预设的逻辑运算,得到第二比特流”相反的逻辑运算方式,具体此处不再详细描述。
另外,本发明实施例中,根据所述第二比特流进行预设的逻辑运算可以是在去掉所述标志位之前进行,也可以是先去掉所述标志位,再根据所述第二比特流进行预设的逻辑运算,此处不作限定,但不论怎样进行逻辑运算,标志位不参与逻辑运算。
本发明实施例中通过将原始解码数据的第一比特流转换成解码数据,首先获取第一比特流中的标志位信息;再通过标志位判断,当标志位的取值为第一比特流中目标位取反后的取值时,获取第一比特流中编码时取反处理的预设位信息;对第一比特流中预设位进行取反处理,得到第二比特流;根据第二比特流进行预设的逻辑运算并去掉所述标志位,得到解码数据。与数据编码方法对应的,解决了信号在传输过程中容易发生误码的问题,提高解码后数据的可靠性,便于信号传输。
进一步的,所述数据解码方法还可以包括:
当所述标志位的取值为所述第一比特流中目标位的取值时,根据所述第一比特流进行预设的逻辑运算并去掉所述标志位,得到解码数据。
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见上文针对其他实施例的详细描述,如数据解码方法中没有详述的部分,可以参见上文针对数据编码方法实施例的详细描述,此处不再赘述。
为了更好实施本发明实施例中数据编码方法,在数据编码方法基础之上,对应的,如图3所示,本发明实施例中还提供一种数据编码装置,该数据编码装置300包括:
获取单元301,用于获取原始编码数据的第一比特流;
逻辑运算单元302,用于根据所述第一比特流进行预设的逻辑运算,得到第二比特流,所述第二比特流的位数多于所述第一比特流的位数;
编码单元303,用于判断所述第二比特流中连续的多个预设位的逻辑值是否相同,若相同,将所述连续的多个预设位中中间位置的至少一个位的逻辑值进行取反处理,得到第三比特流;将所述第三比特流中目标位取反后作为标志位插入到所述第三比特流首位,得到编码数据。
进一步的,所述编码单元303还用于:当所述第二比特流中连续的多个预设位的逻辑值不相同时,将所述目标位作为标志位插入到所述第二比特流首位,得到编码数据。
进一步的,所述第一比特流为8位数据,所述第二比特流为9位数据,所述逻辑运算单元302具体用于:
将所述第一比特流的第一位赋值为所述第二比特流的第一位;
将所述第一比特流的第二位赋值为所述第二比特流的第二位;
对所述第一比特流的第二位取反后,赋值为所述第二比特流的第三位;
将所述第一比特流的第三位赋值为所述第二比特流的第四位;
对所述第一比特流的第六位取反后,赋值为所述第二比特流的第七位;
根据所述第一比特流进行预设的逻辑运算,得到第二比特流的第五位、第六位、第八位和第九位。
进一步的,所述逻辑运算单元302具体用于:
对所述第一比特流的第一位、第二位和第四位分别进行多次逻辑运算,并对所述多次逻辑运算的结果进行逻辑或运算,将所述逻辑或运算结果作为所述第二比特流的第五位;
对所述第一比特流的第一位、第二位和第五位分别进行多次逻辑运算,并对所述多次逻辑运算的结果进行第一逻辑或运算,将所述第一逻辑或运算结果作为所述第二比特流的第六位;
对所述第一比特流的第一位、第二位和第七位分别进行多次逻辑运算,并对所述多次逻辑与运算的结果进行第二逻辑或运算,将所述第二逻辑或运算结果作为所述第二比特流的第八位;
对所述第一比特流的第一位、第二位和第八位分别进行多次逻辑运算,并对所述多次逻辑与运算的结果进行第三逻辑或运算,将所述第三逻辑或运算结果作为所述第二比特流的第九位。
进一步的,所述编码单元303具体用于:
对所述连续的多个预设位中的取值进行逻辑与非运算,得到第一运算结果;
对所述连续的多个预设位中的取值进行逻辑或运算,得到第二运算结果;
对所述第一运算结果和第二运算结果进行逻辑与运算,得到第三运算结果;
当所述第三运算结果为1时,所述连续的多个预设位的逻辑值不相同,当所述第三运算结果为0时,所述连续的多个预设位的逻辑值相同。
本发明实施例中数据编码装置提供的解决了信号在传输过程中容易发生误码的问题,提高编码数据的可靠性,便于信号传输。
为了更好实施本发明实施例中数据解码方法,在数据解码方法基础之上,对应的,如图4所示,本发明实施例中还提供一种数据解码装置,该数据解码装置400包括:
第一获取单元401,用于获取原始待解码数据对应的第一比特流;
第二获取单元402,用于获取所述第一比特流中的标志位信息;
第三获取单元403,用于当所述标志位的取值为所述第一比特流中目标位取反后的取值时,获取所述第一比特流中编码时取反处理的预设位信息;
解码单元404,用于对所述第一比特流中预设位进行取反处理,得到第二比特流;根据所述第二比特流进行预设的逻辑运算并去掉所述标志位,得到解码数据,所述解码数据的位数多于所述第二比特流的位数。
进一步的,所述解码单元404还用于:当所述标志位的取值为所述第一比特流中目标位的取值时,根据所述第一比特流进行预设的逻辑运算并去掉所述标志位,得到解码数据。
本发明实施例中数据解码装置提供的解决了信号在传输过程中容易发生误码的问题,提高解码后数据的可靠性,便于信号传输。
本申请还提供一种存储介质,所述存储介质存储有多条指令,所述指令适于处理器进行加载,以执行上述任一数据编码方法实施例中的步骤,或者以执行任一数据解码方法实施例中的步骤。
具体实施时,以上各个单元或结构可以作为独立的实体来实现,也可以进行任意组合,作为同一或若干个实体来实现,以上各个单元或结构的具体实施可参见前面的方法实施例,在此不再赘述。
以上各个操作的具体实施可参见前面的实施例,在此不再赘述。
以上对本发明实施例所提供的一种数据编码方法、解码方法、相关装置及存储介质进行了详细介绍,本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想;同时,对于本领域的技术人员,依据本发明的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本发明的限制。
Claims (20)
- 一种数据编码方法,其中,所述方法包括:获取原始编码数据的第一比特流;根据所述第一比特流进行预设的逻辑运算,得到第二比特流,所述第二比特流的位数多于所述第一比特流的位数;判断所述第二比特流中连续的多个预设位的逻辑值是否相同,若相同,将所述连续的多个预设位中中间位置的至少一个位的逻辑值进行取反处理,得到第三比特流;将所述第三比特流中目标位取反后作为标志位插入到所述第三比特流首位,得到编码数据。
- 根据权利要求1所述的方法,其中,所述方法还包括:当所述第二比特流中连续的多个预设位的逻辑值不相同时,将所述目标位作为标志位插入到所述第二比特流首位,得到编码数据。
- 根据权利要求1所述的数据编码方法,其中,所述第一比特流为8位数据,所述第二比特流为9位数据,所述根据所述第一比特流进行预设的逻辑运算,得到第二比特流,包括:将所述第一比特流的第一位赋值为所述第二比特流的第一位;将所述第一比特流的第二位赋值为所述第二比特流的第二位;对所述第一比特流的第二位取反后,赋值为所述第二比特流的第三位;将所述第一比特流的第三位赋值为所述第二比特流的第四位;对所述第一比特流的第六位取反后,赋值为所述第二比特流的第七位;根据所述第一比特流进行预设的逻辑运算,得到第二比特流的第五位、第六位、第八位和第九位。
- 根据权利要求3所述的数据编码方法,其中,所述根据所述第一比特流进行预设的逻辑运算,得到第二比特流的第五位、第六位、第八位和第九位,包括:对所述第一比特流的第一位、第二位和第四位分别进行多次逻辑运算,并对所述多次逻辑运算的结果进行逻辑或运算,将所述逻辑或运算结果作为所述第二比特流的第五位;对所述第一比特流的第一位、第二位和第五位分别进行多次逻辑运算,并对所述多次逻辑运算的结果进行第一逻辑或运算,将所述第一逻辑或运算结果作为所述第二比特流的第六位;对所述第一比特流的第一位、第二位和第七位分别进行多次逻辑运算,并对所述多次逻辑与运算的结果进行第二逻辑或运算,将所述第二逻辑或运算结果作为所述第二比特流的第八位;对所述第一比特流的第一位、第二位和第八位分别进行多次逻辑运算,并对所述多次逻辑与运算的结果进行第三逻辑或运算,将所述第三逻辑或运算结果作为所述第二比特流的第九位。
- 根据权利要求1所述的数据编码方法,其中,所述判断所述第二比特流中连续的多个预设位的逻辑值是否相同,包括:对所述连续的多个预设位中的取值进行逻辑与非运算,得到第一运算结果;对所述连续的多个预设位中的取值进行逻辑或运算,得到第二运算结果;对所述第一运算结果和第二运算结果进行逻辑与运算,得到第三运算结果;当所述第三运算结果为1时,所述连续的多个预设位的逻辑值不相同,当所述第三运算结果为0时,所述连续的多个预设位的逻辑值相同。
- 根据权利要求1所述的数据编码方法,其中,所述第二比特流中连续的预设位为所述第二比特流中间的多个连续的预设位。
- 根据权利要求1所述的数据编码方法,其中,所述第二比特流中连续的预设位为所述第二比特流中低位的多个连续的预设位。
- 一种数据解码方法,其中,所述方法包括:获取原始待解码数据对应的第一比特流;获取所述第一比特流中的标志位信息;当所述标志位的取值为所述第一比特流中目标位取反后的取值时,获取所述第一比特流中编码时取反处理的预设位信息;对所述第一比特流中预设位进行取反处理,得到第二比特流;根据所述第二比特流进行预设的逻辑运算并去掉所述标志位,得到解码数据,所述解码数据的位数多于所述第二比特流的位数。
- 根据权利要求8所述的解码方法,其中,所述方法还包括:当所述标志位的取值为所述第一比特流中目标位的取值时,根据所述第一比特流进行预设的逻辑运算并去掉所述标志位,得到解码数据。
- 一种数据编码装置,其中,所述数据编码装置包括:获取单元,用于获取原始编码数据的第一比特流;逻辑运算单元,用于根据所述第一比特流进行预设的逻辑运算,得到第二比特流,所述第二比特流的位数多于所述第一比特流的位数;编码单元,用于判断所述第二比特流中连续的多个预设位的逻辑值是否相同,若相同,将所述连续的多个预设位中中间位置的至少一个位的逻辑值进行取反处理,得到第三比特流;将所述第三比特流中目标位取反后作为标志位插入到所述第三比特流首位,得到编码数据。
- 根据权利要求10所述的数据编码装置,其中,所述第一比特流为8位数据,所述第二比特流为9位数据,所述编码单元还用于:当所述第二比特流中连续的多个预设位的逻辑值不相同时,将所述目标位作为标志位插入到所述第二比特流首位,得到编码数据。
- 根据权利要求10所述的数据编码装置,其中,所述逻辑运算单元具体用于:将所述第一比特流的第一位赋值为所述第二比特流的第一位;将所述第一比特流的第二位赋值为所述第二比特流的第二位;对所述第一比特流的第二位取反后,赋值为所述第二比特流的第三位;将所述第一比特流的第三位赋值为所述第二比特流的第四位;对所述第一比特流的第六位取反后,赋值为所述第二比特流的第七位;根据所述第一比特流进行预设的逻辑运算,得到第二比特流的第五位、第六位、第八位和第九位。
- 根据权利要求12所述的数据编码装置,其中,所述逻辑运算单元具体用于:对所述第一比特流的第一位、第二位和第四位分别进行多次逻辑运算,并对所述多次逻辑运算的结果进行逻辑或运算,将所述逻辑或运算结果作为所述第二比特流的第五位;对所述第一比特流的第一位、第二位和第五位分别进行多次逻辑运算,并对所述多次逻辑运算的结果进行第一逻辑或运算,将所述第一逻辑或运算结果作为所述第二比特流的第六位;对所述第一比特流的第一位、第二位和第七位分别进行多次逻辑运算,并对所述多次逻辑与运算的结果进行第二逻辑或运算,将所述第二逻辑或运算结果作为所述第二比特流的第八位;对所述第一比特流的第一位、第二位和第八位分别进行多次逻辑运算,并对所述多次逻辑与运算的结果进行第三逻辑或运算,将所述第三逻辑或运算结果作为所述第二比特流的第九位。
- 根据权利要求10所述的数据编码装置,其中,所述编码单元具体用于:对所述连续的多个预设位中的取值进行逻辑与非运算,得到第一运算结果;对所述连续的多个预设位中的取值进行逻辑或运算,得到第二运算结果;对所述第一运算结果和第二运算结果进行逻辑与运算,得到第三运算结果;当所述第三运算结果为1时,所述连续的多个预设位的逻辑值不相同,当所述第三运算结果为0时,所述连续的多个预设位的逻辑值相同。
- 根据权利要求10所述的数据编码装置,其中,所述第二比特流中连续的预设位为所述第二比特流中间的多个连续的预设位。
- 根据权利要求10所述的数据编码装置,其中,所述第二比特流中连续的预设位为所述第二比特流中低位的多个连续的预设位。
- 根据权利要求10所述的数据编码装置,其中,所述数据编码装置包括:第一获取单元,用于获取原始待解码数据对应的第四比特流;第二获取单元,用于获取所述第四比特流中的标志位信息;第三获取单元,用于当所述标志位的取值为所述第四比特流中目标位取反后的取值时,获取所述第四比特流中编码时取反处理的预设位信息;解码单元,用于对所述第四比特流中预设位进行取反处理,得到第五比特流;根据所述第五比特流进行预设的逻辑运算并去掉所述标志位,得到解码数据,所述解码数据的位数多于所述第五比特流的位数。
- 根据权利要求17所述的数据编码装置,其中,所述解码单元还用于:当所述标志位的取值为所述第四比特流中目标位的取值时,根据所述第四比特流进行预设的逻辑运算并去掉所述标志位,得到解码数据。
- 根据权利要求17所述的数据编码装置,其中,所述第四比特流中预设位为多个连续的预设位。
- 根据权利要求19所述的数据编码装置,其中,所述第四比特流中预设位为低位的多个连续的预设位。
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| US16/618,146 US11611354B2 (en) | 2019-04-08 | 2019-07-29 | Data encoding method, decoding method, related device, and storage medium |
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201910277375.5 | 2019-04-08 | ||
| CN201910277375.5A CN110098837B (zh) | 2019-04-08 | 2019-04-08 | 数据编码方法、解码方法、相关装置及存储介质 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2020206875A1 true WO2020206875A1 (zh) | 2020-10-15 |
Family
ID=67444565
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2019/098115 Ceased WO2020206875A1 (zh) | 2019-04-08 | 2019-07-29 | 数据编码方法、解码方法、相关装置及存储介质 |
Country Status (3)
| Country | Link |
|---|---|
| US (1) | US11611354B2 (zh) |
| CN (1) | CN110098837B (zh) |
| WO (1) | WO2020206875A1 (zh) |
Families Citing this family (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN112492386A (zh) | 2020-11-09 | 2021-03-12 | Tcl华星光电技术有限公司 | 解码方法、解码装置及可读存储介质 |
| CN112953680B (zh) * | 2021-02-10 | 2022-12-23 | Tcl华星光电技术有限公司 | 编码方法、解码方法、编码装置及解码装置 |
| CN113014357B (zh) * | 2021-02-20 | 2022-03-08 | Tcl华星光电技术有限公司 | 数据编码方法、数据编码装置及存储介质 |
| CN113347428B (zh) * | 2021-05-26 | 2023-01-24 | Tcl华星光电技术有限公司 | 一种解码方法、及解码设备 |
| CN113438050B (zh) * | 2021-06-03 | 2022-08-23 | Tcl华星光电技术有限公司 | 一种编码方法、解码方法、编码装置和解码装置 |
| US12021548B2 (en) | 2022-05-10 | 2024-06-25 | Samsung Display Co., Ltd. | System and method for efficient transition encoding for decimation CDR |
| CN118433392B (zh) * | 2024-07-03 | 2024-10-22 | Tcl华星光电技术有限公司 | 数据编码方法及芯片、数据解码方法及芯片、显示装置 |
Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20020002412A1 (en) * | 2000-06-30 | 2002-01-03 | Hitachi, Ltd. | Digital audio system |
| EP1711016A2 (en) * | 2005-04-07 | 2006-10-11 | British Broadcasting Corporation | Coding data |
| CN101847997A (zh) * | 2010-04-26 | 2010-09-29 | 瑞斯康达科技发展股份有限公司 | 一种9b/10b编解码器及其实现方法 |
| CN106411322A (zh) * | 2016-11-04 | 2017-02-15 | 深圳国人通信股份有限公司 | 基于SerDes技术串行通信系统的编解码方法及装置 |
| CN109309548A (zh) * | 2018-05-11 | 2019-02-05 | 深圳市华星光电技术有限公司 | 编码方法、设备及可读存储介质 |
Family Cites Families (15)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US4539684A (en) * | 1983-01-07 | 1985-09-03 | Motorola, Inc. | Automatic frame synchronization recovery utilizing a sequential decoder |
| KR100224815B1 (ko) * | 1995-06-23 | 1999-10-15 | 윤종용 | 데이타 압축 및 신장방법 |
| JPH11110967A (ja) * | 1997-10-01 | 1999-04-23 | Nec Corp | 半導体メモリ装置 |
| US6275587B1 (en) * | 1998-06-30 | 2001-08-14 | Adobe Systems Incorporated | Secure data encoder and decoder |
| US7142603B2 (en) * | 2000-01-15 | 2006-11-28 | Sony Corporation | Method and system for predictive table look-up code length of variable length code |
| JP3772976B2 (ja) * | 2002-05-22 | 2006-05-10 | ソニー株式会社 | プロセッサ、エンコーダ、デコーダ及び電子機器 |
| GB0524983D0 (en) * | 2005-12-07 | 2006-01-18 | Imagination Tech Ltd | Recompression and decompression of a data stream for rate smoothing |
| US7783862B2 (en) * | 2006-08-07 | 2010-08-24 | International Characters, Inc. | Method and apparatus for an inductive doubling architecture |
| US20080033974A1 (en) * | 2006-08-07 | 2008-02-07 | International Characters, Inc. | Method and Apparatus for XML Parsing Using Parallel Bit streams |
| US20080040345A1 (en) * | 2006-08-07 | 2008-02-14 | International Characters, Inc. | Method and Apparatus for String Search Using Parallel Bit Streams |
| US8392174B2 (en) * | 2006-08-07 | 2013-03-05 | International Characters, Inc. | Method and apparatus for lexical analysis using parallel bit streams |
| TWI489814B (zh) * | 2011-10-07 | 2015-06-21 | Au Optronics Corp | 編碼方法、編碼裝置、解碼方法、解碼裝置、資料傳送裝置及資料接收裝置 |
| CN105072058B (zh) * | 2015-08-25 | 2018-05-25 | 许继集团有限公司 | 一种基于光纤传输的数据正反相位编码方法及数据传输方法 |
| CN108847916B (zh) * | 2018-05-30 | 2020-12-04 | 深圳市华星光电技术有限公司 | 编码方法、设备及可读存储介质 |
| CN109525372A (zh) * | 2018-12-24 | 2019-03-26 | 深圳市华星光电技术有限公司 | 终端数据传输方法、装置及存储介质 |
-
2019
- 2019-04-08 CN CN201910277375.5A patent/CN110098837B/zh active Active
- 2019-07-29 US US16/618,146 patent/US11611354B2/en active Active
- 2019-07-29 WO PCT/CN2019/098115 patent/WO2020206875A1/zh not_active Ceased
Patent Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20020002412A1 (en) * | 2000-06-30 | 2002-01-03 | Hitachi, Ltd. | Digital audio system |
| EP1711016A2 (en) * | 2005-04-07 | 2006-10-11 | British Broadcasting Corporation | Coding data |
| CN101847997A (zh) * | 2010-04-26 | 2010-09-29 | 瑞斯康达科技发展股份有限公司 | 一种9b/10b编解码器及其实现方法 |
| CN106411322A (zh) * | 2016-11-04 | 2017-02-15 | 深圳国人通信股份有限公司 | 基于SerDes技术串行通信系统的编解码方法及装置 |
| CN109309548A (zh) * | 2018-05-11 | 2019-02-05 | 深圳市华星光电技术有限公司 | 编码方法、设备及可读存储介质 |
Also Published As
| Publication number | Publication date |
|---|---|
| CN110098837A (zh) | 2019-08-06 |
| CN110098837B (zh) | 2020-11-06 |
| US11611354B2 (en) | 2023-03-21 |
| US20220029635A1 (en) | 2022-01-27 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| WO2020206875A1 (zh) | 数据编码方法、解码方法、相关装置及存储介质 | |
| CN104052577B (zh) | 信号传输的处理方法和装置及视频数据的传输方法和系统 | |
| CN108694918B (zh) | 编码方法及装置、解码方法及装置及显示装置 | |
| CN110086575B (zh) | 编码方法、解码方法、相关装置及存储介质 | |
| JP2000507755A (ja) | 遷移制御された平衡エンコード体系 | |
| KR100914964B1 (ko) | 신호 인코더 및 신호 디코더 | |
| US11817882B2 (en) | Decoding method, decoding device, and readable storage medium | |
| CN112953680B (zh) | 编码方法、解码方法、编码装置及解码装置 | |
| TW201640359A (zh) | N基底數字至實體線狀態符號翻譯方法 | |
| CN103229444B (zh) | 编码/解码方法、装置及系统 | |
| WO2019227831A1 (zh) | 编码方法、设备及可读存储介质 | |
| WO2011137790A1 (zh) | 通用公共无线接口业务发送/接收方法及装置 | |
| WO2019214141A1 (zh) | 编码方法、设备及可读存储介质 | |
| WO2019214139A1 (zh) | 编码方法、设备及可读存储介质 | |
| CN114510446A (zh) | 串口波特率自适应方法、装置、设备及介质 | |
| WO2019214140A1 (zh) | 编码方法、设备及可读存储介质 | |
| WO2019242180A1 (zh) | 解码方法、设备及可读存储介质 | |
| CN119938577A (zh) | 通用串行总线设备中的链路转换方法及其系统 | |
| KR101038112B1 (ko) | 디스플레이 포트의 디지털 엔코더 및 디지털 디코더 | |
| JP2023055683A (ja) | データエンコーディング方法およびエンコーダーとデータデコーディング方法 | |
| CN113196661B (zh) | 一种数据处理方法及相关装置 | |
| US8166219B2 (en) | Method and apparatus for encoding/decoding bus signal | |
| CN113630211B (zh) | 编码方法及存储介质 | |
| JP2017050734A (ja) | シリアル通信装置、通信システム及び通信方法 | |
| WO2016025337A1 (en) | System and method for transcoding data |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 19924255 Country of ref document: EP Kind code of ref document: A1 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 19924255 Country of ref document: EP Kind code of ref document: A1 |