[go: up one dir, main page]

CN114333857A - Data processing method and device, storage medium and electronic device - Google Patents

Data processing method and device, storage medium and electronic device Download PDF

Info

Publication number
CN114333857A
CN114333857A CN202111436378.2A CN202111436378A CN114333857A CN 114333857 A CN114333857 A CN 114333857A CN 202111436378 A CN202111436378 A CN 202111436378A CN 114333857 A CN114333857 A CN 114333857A
Authority
CN
China
Prior art keywords
data bit
sequence
polarity
encoding
data
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
Application number
CN202111436378.2A
Other languages
Chinese (zh)
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.)
Shenzhen Lontium Semiconductor Technology Co ltd
Original Assignee
Shenzhen Lontium Semiconductor Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Lontium Semiconductor Technology Co ltd filed Critical Shenzhen Lontium Semiconductor Technology Co ltd
Priority to CN202111436378.2A priority Critical patent/CN114333857A/en
Publication of CN114333857A publication Critical patent/CN114333857A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

本发明提供一种数据处理方法及装置、存储介质及电子设备,该方法包括:将包头序列添加至获取到的数据的前端;确定数据中各个数据位的编码类型,基于每个数据位的编码类型,将每个数据位的数值转换成对应的编码序列,得到所述数据的包编码序列;基于每个数据位的编码类型确定每个数据位的编码极性,基于各个数据位的编码极性确定包编码序列的序列极性,在包编码序列后端添加包结束序列以及与序列极性对应的电平平衡序列。对数据进行编码,将数据位的数值直接转换成与数据位的编码类型对应的编码序列,过程简单、快捷,提高了编码效率,在数据的包编码序列后添加用于确保包编码序列达到DC平衡的电平平衡序列,在提高编码效率的同时保证了编码质量。

Figure 202111436378

The present invention provides a data processing method and device, a storage medium and electronic equipment. The method includes: adding a packet header sequence to the front end of acquired data; determining the encoding type of each data bit in the data, and determining the encoding type of each data bit based on the encoding type, convert the value of each data bit into a corresponding coding sequence, and obtain the packet coding sequence of the data; determine the coding polarity of each data bit based on the coding type of each data bit, and determine the coding polarity of each data bit based on the coding polarity of each data bit. The sequence polarity of the packet coding sequence is determined, and the packet end sequence and the level balance sequence corresponding to the sequence polarity are added to the back end of the packet coding sequence. The data is encoded, and the value of the data bit is directly converted into the encoding sequence corresponding to the encoding type of the data bit. The process is simple and fast, and the encoding efficiency is improved. After the packet encoding sequence of the data, it is added to ensure that the packet encoding sequence reaches DC. Balanced level-balanced sequence, which improves coding efficiency while ensuring coding quality.

Figure 202111436378

Description

数据处理方法及装置、存储介质及电子设备Data processing method and device, storage medium and electronic device

技术领域technical field

本发明涉及数据编码技术领域,特别涉及一种数据处理方法及装置、存储介质及电子设备。The present invention relates to the technical field of data encoding, and in particular, to a data processing method and device, a storage medium and an electronic device.

背景技术Background technique

多媒体技术在生活中的应用越来越广泛,播放音频是多媒体技术中使用频率最高的一项功能。音频的原始信号的数据量非常大,所以通常会对音频的原始信号进行压缩处理,进而减少传输线路的传输压力和减少音频的数据的占用内存。The application of multimedia technology in life is more and more extensive, and playing audio is the most frequently used function in multimedia technology. The data volume of the original audio signal is very large, so the original audio signal is usually compressed, thereby reducing the transmission pressure on the transmission line and reducing the memory occupied by the audio data.

通常使用编码技术对音频的数据进行压缩处理,随着各种社交即时通信软件以及视频直播的广泛应用,需要进行压缩处理的音频的数据越来越多,面对庞大的音频的数据,如何保证编码质量的同时提高编码效率成为各个研发人员亟需解决的问题。Coding technology is usually used to compress audio data. With the wide application of various social instant messaging software and live video broadcasts, more and more audio data needs to be compressed. Faced with huge audio data, how to ensure Improving coding efficiency while coding quality has become an urgent problem for R&D personnel to solve.

发明内容SUMMARY OF THE INVENTION

有鉴于此,本发明提供一种数据处理方法,基于数据中的每个数据位的编码极性对数据位的数值进行编码,直接将数值转换成与编码极性对应的编码序列即完成对数据位的编码,该过程简单、快捷,并在在得到的包编码序列的后端添加确保包编码序列处于DC平衡的电平平衡序列,由此可以在保证编码的质量的同时提高编码效率。In view of this, the present invention provides a data processing method, which encodes the numerical value of the data bit based on the coding polarity of each data bit in the data, and directly converts the numerical value into a coding sequence corresponding to the coding polarity to complete the data processing. Bit encoding, the process is simple and fast, and a level-balanced sequence to ensure that the packet encoding sequence is DC balanced is added at the back end of the obtained packet encoding sequence, thereby improving encoding efficiency while ensuring encoding quality.

为实现上述目的,本发明实施例提供如下技术方案:To achieve the above purpose, the embodiments of the present invention provide the following technical solutions:

本发明第一方面公开一种数据处理方法,包括:A first aspect of the present invention discloses a data processing method, comprising:

获取待处理的数据:Get pending data:

将预设的包头序列添加至所述数据的前端;adding a preset packet header sequence to the front end of the data;

逐一确定所述数据中各个数据位的编码类型,并将每个数据位中的数值转换成与其编码类型对应的编码序列,得到所述数据的包编码序列;Determine the encoding type of each data bit in the data one by one, and convert the numerical value in each data bit into the encoding sequence corresponding to its encoding type to obtain the packet encoding sequence of the data;

基于每个数据位的编码序列,确定每个数据位的编码极性,并基于每个数据位的编码极性确定所述包编码序列的序列极性;Determine the coding polarity of each data bit based on the coding sequence of each data bit, and determine the sequence polarity of the packet coding sequence based on the coding polarity of each data bit;

将预设的包结束序列添加至所述包编码序列的末端,并基于所述包编码序列的序列极性,在所述包结束序列的末端添加用于保证所述包编码序列的电平平衡的电平平衡序列,以完成对所述数据的编码处理。Adding a preset packet end sequence to the end of the packet encoding sequence, and adding a level balance of the packet encoding sequence at the end of the packet end sequence based on the sequence polarity of the packet encoding sequence level balance sequence to complete the encoding process of the data.

上述的方法,可选的,所述逐一确定所述数据中各个数据位的编码类型,包括:In the above method, optionally, the encoding type of each data bit in the data is determined one by one, including:

逐一读取所述数据中的各个数据位,并将读取到的数据位作为当前数据位;Read each data bit in the data one by one, and use the read data bit as the current data bit;

获取当前数据位的数值和位置信息;Get the value and position information of the current data bit;

基于所述位置信息确定所述当前数据位是否为所述数据的起始数据位;determining whether the current data bit is the start data bit of the data based on the location information;

若确定所述当前数据位为所述数据的起始数据位,则基于所述当前数据位的数值,确定所述当前数据位的编码类型;If it is determined that the current data bit is the initial data bit of the data, then based on the value of the current data bit, the encoding type of the current data bit is determined;

若确定所述当前数据位不为所述数据的起始数据位,则判断所述当前数据位是否发生翻转;If it is determined that the current data bit is not the start data bit of the data, then determine whether the current data bit is flipped;

若确定所述当前数据位未发生翻转,则确定所述当前数据位的编码类型为第一类型;If it is determined that the current data bit is not flipped, then determine that the encoding type of the current data bit is the first type;

若所述当前数据位发生翻转,则基于所述当前数据位的数值,确定所述当前数据位的编码类型。If the current data bit is flipped, the encoding type of the current data bit is determined based on the value of the current data bit.

上述的方法,可选的,所述基于所述当前数据位的数值,确定所述当前数据位的编码类型,包括:In the above-mentioned method, optionally, the encoding type of the current data bit is determined based on the value of the current data bit, including:

确定所述当前数据位的数值是否为1;determining whether the value of the current data bit is 1;

若确定所述当前数据位的数值为1,则确定所述当前数据位的编码类型为第二类型;If it is determined that the value of the current data bit is 1, then it is determined that the encoding type of the current data bit is the second type;

若确定所述当前数据位的数值不为1,则确定所述当前数据位的数值为0,并确定所述当前数据位的编码类型为第三类型。If it is determined that the value of the current data bit is not 1, the value of the current data bit is determined to be 0, and the encoding type of the current data bit is determined to be the third type.

上述的方法,可选的,所述判断所述当前数据位是否发生翻转,包括:In the above method, optionally, the judging whether the current data bit is flipped includes:

获取位于所述当前数据位的前一个数据位的数值;Obtain the numerical value of the previous data bit located in the current data bit;

判断所述当前数据位的数值与位于所述当前数据位的前一个数据位的数值是否一致;Judging whether the numerical value of the current data bit is consistent with the numerical value of the previous data bit located in the current data bit;

若所述当前数据位的数值与位于所述当前数据位的前一个数据位的数值不一致,则确定所述当前数据位发生翻转;If the numerical value of the current data bit is inconsistent with the numerical value of the previous data bit located in the current data bit, it is determined that the current data bit is flipped;

若所述当前数据位的数值与位于所述当前数据位的前一个数据位的数值一致,则确定所述当前数据位不发生翻转。If the value of the current data bit is consistent with the value of the previous data bit located in the current data bit, it is determined that the current data bit does not flip.

上述的方法,可选的,所述将每个数据位中的数值转换成与其编码类型对应的编码序列,包括:In the above-mentioned method, optionally, the numerical value in each data bit is converted into an encoding sequence corresponding to its encoding type, including:

对于每个数据位,当所述数据位的编码类型为第一类型时,将所述数据位的数值转换成与所述第一类型对应的零极性编码序列;当所述数据位的编码类型为第二类型时,将所述数据位的数值转换成与所述第二类型对应的正极性编码序列;当所述数据位的编码类型为第三类型时,将所述数据位的数值转换成负极性编码序列。For each data bit, when the encoding type of the data bit is the first type, the value of the data bit is converted into a zero-polarity encoding sequence corresponding to the first type; when the encoding type of the data bit is When the type is the second type, the value of the data bit is converted into a positive polarity coding sequence corresponding to the second type; when the encoding type of the data bit is the third type, the value of the data bit is converted Convert to negative polarity coding sequence.

上述的方法,可选的,所述基于每个数据位的编码序列,确定每个数据位的编码极性,包括:The above-mentioned method, optionally, the coding sequence based on each data bit, determining the coding polarity of each data bit, including:

对于每个所述数据位,当所述数据位的编码序列为零极性编码序列时,确定所述数据位的编码极性为零极性;当所述数据位的编码序列为正极性编码序列时,确定所述数据位的编码极性为正极性;当所述数据位的编码序列为负极性编码序列时,确定所述数据位的编码极性为负极性。For each data bit, when the coding sequence of the data bit is a zero-polarity coding sequence, the coding polarity of the data bit is determined to be zero-polarity; when the coding sequence of the data bit is a positive-polarity coding During the sequence, the coding polarity of the data bits is determined to be positive; when the coding sequence of the data bits is a negative coding sequence, the coding polarity of the data bits is determined to be negative.

上述的方法,可选的,所述基于每个数据位的编码极性确定所述包编码序列的序列极性,包括:The above-mentioned method, optionally, determining the sequence polarity of the packet coding sequence based on the coding polarity of each data bit, including:

确定编码极性为正极性的数据位的第一数量,以及确定编码极性为负极性的数据位的第二数量;determining a first number of data bits whose encoding polarity is positive, and determining a second number of data bits whose encoding polarity is negative;

判断所述第一数量是否等于所述第二数量;determining whether the first quantity is equal to the second quantity;

若所述第一数量等于所述第二数量,则确定所述包编码序列的序列极性为零极性;If the first number is equal to the second number, determining that the sequence polarity of the packet coding sequence is zero polarity;

若所述第一数量不等于所述第二数量,则确定所述第一数量是否大于所述第二数量;If the first quantity is not equal to the second quantity, determining whether the first quantity is greater than the second quantity;

若所述第一数量大于所述第二数量,则确定所述包编码序列的序列极性为正极性;If the first number is greater than the second number, determining that the sequence polarity of the packet encoding sequence is positive;

若所述第一数量小于所述第二数量,则确定所述包编码序列的序列极性为负极性。If the first number is smaller than the second number, it is determined that the sequence polarity of the packet coding sequence is negative polarity.

本发明第二方面公开一种数据处理装置,包括:A second aspect of the present invention discloses a data processing device, comprising:

获取单元,用于获取待处理的数据:Get unit, used to get the data to be processed:

第一添加单元,用于将预设的包头序列添加至所述数据的前端;a first adding unit, for adding a preset packet header sequence to the front end of the data;

第一确定单元,用于逐一确定所述数据中各个数据位的编码类型,并将每个数据位中的数值转换成与其编码类型对应的编码序列,得到所述数据的包编码序列;The first determining unit is used to determine the encoding type of each data bit in the data one by one, and convert the numerical value in each data bit into the encoding sequence corresponding to its encoding type, to obtain the packet encoding sequence of the data;

第二确定单元,用于基于每个数据位的编码序列,确定每个数据位的编码极性,并基于每个数据位的编码极性确定所述包编码序列的序列极性;a second determining unit, configured to determine the coding polarity of each data bit based on the coding sequence of each data bit, and determine the sequence polarity of the packet coding sequence based on the coding polarity of each data bit;

第二添加单元,用于将预设的包结束序列添加至所述包编码序列的末端,并基于所述包编码序列的序列极性,在所述包结束序列的末端添加用于保证所述包编码序列的电平平衡的平衡序列,以完成对所述数据的编码处理。a second adding unit, configured to add a preset packet end sequence to the end of the packet encoding sequence, and based on the sequence polarity of the packet encoding sequence, add a preset packet end sequence at the end of the packet encoding sequence to ensure the A level-balanced balanced sequence of the packet encoding sequence to complete the encoding process for the data.

上述的装置,可选的,所述第一确定单元,用于执行逐一确定所述数据中各个数据位的编码类型时,具体包括:In the above-mentioned device, optionally, the first determining unit, which is used to determine the encoding type of each data bit in the data one by one, specifically includes:

逐一读取所述数据中的各个数据位,并将读取到的数据位作为当前数据位;Read each data bit in the data one by one, and use the read data bit as the current data bit;

获取当前数据位的数值和位置信息;Get the value and position information of the current data bit;

基于所述位置信息确定所述当前数据位是否为所述数据的起始数据位;determining whether the current data bit is the start data bit of the data based on the location information;

若确定所述当前数据位为所述数据的起始数据位,则基于所述当前数据位的数值,确定所述当前数据位的编码类型;If it is determined that the current data bit is the initial data bit of the data, then based on the value of the current data bit, the encoding type of the current data bit is determined;

若确定所述当前数据位不为所述数据的起始数据位,则判断所述当前数据位是否发生翻转;If it is determined that the current data bit is not the start data bit of the data, then determine whether the current data bit is flipped;

若确定所述当前数据位未发生翻转,则确定所述当前数据位的编码类型为第一类型;If it is determined that the current data bit is not flipped, then determine that the encoding type of the current data bit is the first type;

若所述当前数据位发生翻转,则基于所述当前数据位的数值,确定所述当前数据位的编码类型。If the current data bit is flipped, the encoding type of the current data bit is determined based on the value of the current data bit.

上述的装置,可选的,所述第一确定单元,用于执行基于所述当前数据位的数值,确定所述当前数据位的编码类型时,具体包括:In the above-mentioned device, optionally, the first determining unit is configured to determine the encoding type of the current data bit based on the numerical value of the current data bit, specifically including:

确定所述当前数据位的数值是否为1;determining whether the value of the current data bit is 1;

若确定所述当前数据位的数值为1,则确定所述当前数据位的编码类型为第二类型;If it is determined that the value of the current data bit is 1, then it is determined that the encoding type of the current data bit is the second type;

若确定所述当前数据位的数值不为1,则确定所述当前数据位的数值为0,并确定所述当前数据位的编码类型为第三类型。If it is determined that the value of the current data bit is not 1, the value of the current data bit is determined to be 0, and the encoding type of the current data bit is determined to be the third type.

上述的装置,可选的,所述第一确定单元,用于执行判断所述当前数据位是否发生翻转时,具体包括:In the above-mentioned device, optionally, the first determining unit, configured to perform judgment on whether the current data bit is flipped, specifically includes:

获取位于所述当前数据位的前一个数据位的数值;Obtain the numerical value of the previous data bit located in the current data bit;

判断所述当前数据位的数值与位于所述当前数据位的前一个数据位的数值是否一致;Judging whether the numerical value of the current data bit is consistent with the numerical value of the previous data bit located in the current data bit;

若所述当前数据位的数值与位于所述当前数据位的前一个数据位的数值不一致,则确定所述当前数据位发生翻转;If the numerical value of the current data bit is inconsistent with the numerical value of the previous data bit located in the current data bit, it is determined that the current data bit is flipped;

若所述当前数据位的数值与位于所述当前数据位的前一个数据位的数值一致,则确定所述当前数据位不发生翻转。If the value of the current data bit is consistent with the value of the previous data bit located in the current data bit, it is determined that the current data bit does not flip.

上述的装置,可选的,所述第一确定单元,用于执行将每个数据位中的数值转换成与其编码类型对应的编码序列时,具体包括:The above-mentioned device, optionally, the first determination unit, when performing the conversion of the numerical value in each data bit into an encoding sequence corresponding to its encoding type, specifically includes:

对于每个数据位,当所述数据位的编码类型为第一类型时,将所述数据位的数值转换成与所述第一类型对应的零极性编码序列;当所述数据位的编码类型为第二类型时,将所述数据位的数值转换成与所述第二类型对应的正极性编码序列;当所述数据位的编码类型为第三类型时,将所述数据位的数值转换成负极性编码序列。For each data bit, when the encoding type of the data bit is the first type, the value of the data bit is converted into a zero-polarity encoding sequence corresponding to the first type; when the encoding type of the data bit is When the type is the second type, the value of the data bit is converted into a positive polarity coding sequence corresponding to the second type; when the encoding type of the data bit is the third type, the value of the data bit is converted Convert to negative polarity coding sequence.

上述的装置,可选的,所述第二确定单元,用于执行基于每个数据位的编码序列,确定每个数据位的编码极性时,具体包括:In the above-mentioned device, optionally, the second determining unit, for executing the encoding sequence based on each data bit, when determining the encoding polarity of each data bit, specifically includes:

对于每个所述数据位,当所述数据位的编码序列为零极性编码序列时,确定所述数据位的编码极性为零极性;当所述数据位的编码序列为正极性编码序列时,确定所述数据位的编码极性为正极性;当所述数据位的编码序列为负极性编码序列时,确定所述数据位的编码极性为负极性。For each data bit, when the coding sequence of the data bit is a zero-polarity coding sequence, the coding polarity of the data bit is determined to be zero-polarity; when the coding sequence of the data bit is a positive-polarity coding During the sequence, the coding polarity of the data bits is determined to be positive; when the coding sequence of the data bits is a negative coding sequence, the coding polarity of the data bits is determined to be negative.

上述的装置,可选的,所述第二确定单元,用于执行基于每个数据位的编码极性确定所述包编码序列的序列极性时,具体包括:The above-mentioned device, optionally, the second determination unit, when performing the determination of the sequence polarity of the packet coding sequence based on the coding polarity of each data bit, specifically includes:

确定编码极性为正极性的数据位的第一数量,以及确定编码极性为负极性的数据位的第二数量;determining a first number of data bits whose encoding polarity is positive, and determining a second number of data bits whose encoding polarity is negative;

判断所述第一数量是否等于所述第二数量;determining whether the first quantity is equal to the second quantity;

若所述第一数量等于所述第二数量,则确定所述包编码序列的序列极性为零极性;If the first number is equal to the second number, determining that the sequence polarity of the packet coding sequence is zero polarity;

若所述第一数量不等于所述第二数量,则确定所述第一数量是否大于所述第二数量;If the first quantity is not equal to the second quantity, determining whether the first quantity is greater than the second quantity;

若所述第一数量大于所述第二数量,则确定所述包编码序列的序列极性为正极性;If the first number is greater than the second number, determining that the sequence polarity of the packet encoding sequence is positive;

若所述第一数量小于所述第二数量,则确定所述包编码序列的序列极性为负极性。If the first number is smaller than the second number, it is determined that the sequence polarity of the packet coding sequence is negative polarity.

本发明第三方面公开一种存储介质,所述存储介质包括存储的指令,其中,在所述指令运行时控制所述存储介质所在的设备执行如上所述的数据处理方法。A third aspect of the present invention discloses a storage medium, the storage medium includes stored instructions, wherein when the instructions are executed, a device where the storage medium is located is controlled to execute the above-mentioned data processing method.

本发明第四方面公开一种电子设备,包括存储器,以及一个或者一个以上的指令,其中一个或者一个以上指令存储于存储器中,且经配置以由一个或者一个以上处理器执行如上所述的数据处理方法。A fourth aspect of the present invention discloses an electronic device comprising a memory, and one or more instructions, wherein the one or more instructions are stored in the memory and configured to execute data as described above by one or more processors Approach.

与现有技术相比,本发明具有以下优点:Compared with the prior art, the present invention has the following advantages:

本发明提供一种数据处理方法及装置、存储介质及电子设备,该方法包括:获取待处理的数据;将包头序列添加至数据的前端;逐一确定数据中各个数据位的编码类型,并将每个数据位中的数值转换成与其编码类型对应的编码序列,得到数据的包编码序列;基于每个数据位的编码序列,确定每个数据位的编码极性,并基于每个数据位的编码极性确定包编码序列的序列极性;将包结束序列添加至包编码序列的末端,并基于包编码序列的序列极性,在包结束序列的末端添加用于保证包编码序列的电平平衡的电平平衡序列,以完成对数据的编码处理。在对数据进行编码的过程中,基于数据位的编码类型,可以将数据位的数值直接转换成与编码类型对应的编码序列,对数据位的编码过程简单、快捷,从而提高了编码效率,在数据的包编码序列后端添加了电平平衡序列,该电平平衡序列用于确保包编码序列处于零极性,以保证包编码序列达到DC平衡,由此在提高编码效率的同时保证了编码质量。The present invention provides a data processing method and device, a storage medium and electronic equipment. The method includes: acquiring data to be processed; adding a packet header sequence to the front end of the data; determining the encoding type of each data bit in the data one by one, The values in the data bits are converted into the coding sequence corresponding to their coding type, and the packet coding sequence of the data is obtained; based on the coding sequence of each data bit, the coding polarity of each data bit is determined, and based on the coding sequence of each data bit Polarity determines the sequence polarity of the packet coding sequence; the end of the packet sequence is added to the end of the packet coding sequence, and based on the sequence polarity of the packet coding sequence, the end of the packet coding sequence is added to ensure the level balance of the packet coding sequence The level balance sequence to complete the encoding process of the data. In the process of encoding data, based on the encoding type of the data bit, the value of the data bit can be directly converted into an encoding sequence corresponding to the encoding type. The encoding process of the data bit is simple and fast, thereby improving the encoding efficiency. A level balance sequence is added to the back end of the packet coding sequence of the data. The level balance sequence is used to ensure that the packet coding sequence is in zero polarity, so as to ensure that the packet coding sequence reaches DC balance, thereby improving coding efficiency and ensuring coding. quality.

附图说明Description of drawings

为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据提供的附图获得其他的附图。In order to explain the embodiments of the present invention or the technical solutions in the prior art more clearly, the following briefly introduces the accompanying drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only It is an embodiment of the present invention. For those of ordinary skill in the art, other drawings can also be obtained according to the provided drawings without creative work.

图1为一种使用HDMI eARC协议的编码的示例图;Fig. 1 is an example diagram of encoding using HDMI eARC protocol;

图2为一种使用HDMI eARC协议的编码的又一示例图;Fig. 2 is another example diagram of a kind of encoding using HDMI eARC protocol;

图3为本发明实施例提供的一种数据处理方法的方法流程图;3 is a method flowchart of a data processing method provided by an embodiment of the present invention;

图4为本发明实施例提供的一种IDLE数据的编码的示例图;4 is an exemplary diagram of encoding of IDLE data provided by an embodiment of the present invention;

图5为本发明实施例提供的一种发包的时序示例图;FIG. 5 is an example diagram of a timing sequence for sending a packet according to an embodiment of the present invention;

图6为本发明实施例提供的一种确定数据位的编码极性的方法流程图;6 is a flowchart of a method for determining the coding polarity of a data bit according to an embodiment of the present invention;

图7为本发明实施例提供的一种确定包编码序列的序列极性的方法流程图;7 is a flowchart of a method for determining the sequence polarity of a packet coding sequence provided by an embodiment of the present invention;

图8为本发明实施例提供的一种数据包的结构定义图;8 is a structure definition diagram of a data packet provided by an embodiment of the present invention;

图9为本发明实施例提供的包头序列及包结束序列的编码的示例图;FIG. 9 is an exemplary diagram of encoding of a packet header sequence and a packet end sequence provided by an embodiment of the present invention;

图10为本发明实施例提供的一种数据包的有效数据的编码的示例图;10 is an exemplary diagram of encoding of valid data of a data packet according to an embodiment of the present invention;

图11为本发明实施例提供的一种数据处理装置的结构示意图;11 is a schematic structural diagram of a data processing apparatus according to an embodiment of the present invention;

图12为本发明实施例提供的一种电子设备的结构示意图。FIG. 12 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.

具体实施方式Detailed ways

下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

在本申请中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。In this application, the terms "comprising", "comprising" or any other variation thereof are intended to encompass a non-exclusive inclusion such that a process, method, article or device comprising a list of elements includes not only those elements, but also no Other elements expressly listed, or which are also inherent to such a process, method, article or apparatus. Without further limitation, an element qualified by the phrase "comprising a..." does not preclude the presence of additional identical elements in a process, method, article or apparatus that includes the element.

目前对音频的数据进行编码时,通常使用HDMI eARC协议对音频的数据进行编码处理,参照图1,为使用HDMI eARC协议的编码的示例图。HDMI eARC协议中定义了一种使用双向编码(Biphase-Mark code)和下降沿调制(Falling-edge modulation)组合的方式完成编码,参照图2,为使用HDMI eARC进行编码的另一示例图,HDMI eARC中对数据进行编码时,首先进行Biphase-Mark编码,效率为1/2;之后进行Falling-edge modulation编码,效率为1/3,最终的编码效率为1/6,使用HDMI eARC协议对音频的数据进行编码,虽然可以同时保持DC平衡和时钟恢复,但是编码的效率较低。Currently, when encoding audio data, the HDMI eARC protocol is usually used to encode the audio data. Referring to FIG. 1 , it is an example diagram of encoding using the HDMI eARC protocol. The HDMI eARC protocol defines a combination of Biphase-Mark code and Falling-edge modulation to complete encoding. Referring to Figure 2, for another example of encoding using HDMI eARC, HDMI When encoding data in eARC, first perform Biphase-Mark encoding with an efficiency of 1/2; then perform Falling-edge modulation encoding with an efficiency of 1/3, and the final encoding efficiency is 1/6. The HDMI eARC protocol is used to encode audio Although the DC balance and clock recovery can be maintained at the same time, the encoding efficiency is low.

本发明旨在提供一种数据处理方法,用以提高对数据进行编码的效率,本发明可以用于数据编码系统中,数据编码系统可由众多通用或专用的计算装置环境或配置中。例如:个人计算机、服务器计算机、手持设备或便携式设备、平板型设备、多处理器装置、包括以上任何装置或设备的分布式计算环境等等。本发明的执行主体可以为数据编码系统的处理器或是服务器。The present invention aims to provide a data processing method to improve the efficiency of encoding data, and the present invention can be used in a data encoding system, which can be used in many general or special computing device environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet-type devices, multi-processor devices, distributed computing environments including any of the above, and the like. The executive body of the present invention may be a processor or a server of the data encoding system.

参照图3,为本发明实施例提供的一种数据处理方法的方法流程图,具体说明如下所述:Referring to FIG. 3, it is a method flowchart of a data processing method provided by an embodiment of the present invention, and the specific description is as follows:

S101、获取待处理的数据。S101. Acquire data to be processed.

当接收到数据发送命令时,对数据发送指令进行解析,得到数据发送指令中的待处理的数据,待处理的数据中包含了需要发送给接收端的有效数据。When a data sending command is received, the data sending command is parsed to obtain the data to be processed in the data sending command, and the data to be processed includes valid data to be sent to the receiving end.

需要说明的是,系统在开始工作后,在未接收到数据发送命令前,一直发送IDEL数据,IDEL数据的每个位都会转换成固定的编码序列,固定的编码序列为“1100”,IDEL数据的编码示意图可参照图4,IDEL数据每个上升沿均包含时钟信息,IDEL数据的每个bit都会被编码成“1100”,因此,IDEL数据的编码满足DC平衡,并且包含时钟信息。It should be noted that, after the system starts to work, it keeps sending IDEL data before receiving the data sending command. Each bit of the IDEL data will be converted into a fixed code sequence. The fixed code sequence is "1100", and the IDEL data 4, each rising edge of IDEL data contains clock information, and each bit of IDEL data will be encoded as "1100", therefore, the encoding of IDEL data satisfies DC balance and contains clock information.

系统在接收到数据发送命令后,需要发送接收到的数据,其中,在将数据发送之前,需要先对数据进行编码处理,以得到与数据对应的数据包,在将数据包发送,其中,系统的发包时序如图5所示,系统在发送IDEL数据的过程中接收到数据发送命令,可以将对数据进行编码处理后得到的数据包发送完毕再继续发送IDEL数据,需要说明的是,图5中所示的数据包为对数据进行编码后得到的数据包,数据进行编码处理的过程可参照S102至S105的过程。After the system receives the data sending command, it needs to send the received data. Before sending the data, it needs to encode the data to obtain the data packet corresponding to the data. After sending the data packet, the system The packet sending sequence is shown in Figure 5. The system receives the data sending command in the process of sending IDEL data, and the data packet obtained after encoding the data can be sent and then continue to send the IDEL data. It should be noted that Figure 5 The data packets shown in are the data packets obtained after encoding the data, and the process of encoding the data may refer to the process of S102 to S105.

S102、将预设的包头序列添加至数据的前端。S102. Add a preset packet header sequence to the front end of the data.

包头序列(PREAMBLE)用于作为数据中的有效数据的开始标识,包头序列可用于指示数据的开始,其中,数据中的有效数据包括但不限于器件地址、寄存器地址、读写使能、ECC、需要传输的寄存器值以及CRC等,其中,数据中包含多个数据位,不同的有效数据的数据位的个数是不同的,数据位可以理解为bit。The packet header sequence (PREAMBLE) is used as the start identifier of valid data in the data, and the packet header sequence can be used to indicate the beginning of the data, wherein the valid data in the data includes but is not limited to device address, register address, read and write enable, ECC, The register value and CRC that need to be transmitted, among which, the data contains multiple data bits, the number of data bits of different valid data is different, and the data bits can be understood as bits.

包头序列为预设的固定序列,在将包头序列发送至接收端时,接收端对其解码时,将其作为普通的包数据。The packet header sequence is a preset fixed sequence. When the packet header sequence is sent to the receiving end, the receiving end uses it as ordinary packet data when decoding it.

S103、逐一确定数据中各个数据位的编码类型,并将每个数据位中的数值转换成与其编码类型对应的编码序列,得到数据的包编码序列。S103: Determine the encoding type of each data bit in the data one by one, and convert the value in each data bit into an encoding sequence corresponding to its encoding type to obtain a packet encoding sequence of the data.

需要说明的是,编码类型有三种,分别为第一类型、第二类型以及第三类型,不同的编码类型对应不同的编码序列。It should be noted that there are three encoding types, namely the first type, the second type and the third type, and different encoding types correspond to different encoding sequences.

确定编码类型时,可以根据数据位的数值和位置信息进行确定。When determining the encoding type, it can be determined according to the value and position information of the data bits.

参照图6,为本发明实施提供的确定数据位的编码类型的方法流程图,具体说明如下所述:6, it is a flowchart of a method for determining the encoding type of data bits provided by the implementation of the present invention, and the specific description is as follows:

S201、逐一读取数据中的各个数据位,并将读取到的数据位作为当前数据位。S201. Read each data bit in the data one by one, and use the read data bit as the current data bit.

数据中包含多个数据位,需要逐一对各个数据位进行处理。The data contains multiple data bits, and each data bit needs to be processed one by one.

对数据中的各个数据位逐一进行读取,并将读取到的数据位作为当前数据位。Each data bit in the data is read one by one, and the read data bit is used as the current data bit.

S202、获取当前数据位的数值和位置信息。S202. Obtain the numerical value and position information of the current data bit.

需要说明的是,数据中每个数据位的数值均为二进制的数值,即,每个数据位的数值不是1就是0;位置信息中包括但不限于当前数据位在数据中的排序信息以及位于当前数据位的前一数据位的数值,其中,若数据位为数据中的首个数据位时,该数据位的位置信息中位于当前数据位的前一数据位的数值为空。It should be noted that the value of each data bit in the data is a binary value, that is, the value of each data bit is either 1 or 0; the location information includes, but is not limited to, the sorting information of the current data bit in the data and the location in the data. The value of the previous data bit of the current data bit, wherein, if the data bit is the first data bit in the data, the value of the previous data bit of the current data bit in the position information of the data bit is empty.

S203、基于位置信息确定当前数据位是否为数据的起始数据位;若确定当前数据不为数据的起始数据位,则执行S204;若确定当前数据位为数据的起始数据位,则执行S206。S203. Determine whether the current data bit is the initial data bit of the data based on the position information; if it is determined that the current data is not the initial data bit of the data, execute S204; if it is determined that the current data bit is the initial data bit of the data, execute S206.

S204、判断当前数据位是否发生翻转;若确定当前数据位未发生翻转,则执行S205;若确定当前数据位发生翻转,则执行S206。S204. Determine whether the current data bit is flipped; if it is determined that the current data bit is not flipped, execute S205; if it is determined that the current data bit has flipped, execute S206.

判断当前数据位是否发生翻转需要基于当前数据位的数值和位于当前数据位的前一个数据位的数值进行判断,具体过程如下所述:Judging whether the current data bit has flipped needs to be judged based on the value of the current data bit and the value of the previous data bit located in the current data bit. The specific process is as follows:

获取位于所述当前数据位的前一个数据位的数值;Obtain the numerical value of the previous data bit located in the current data bit;

判断所述当前数据位的数值与位于所述当前数据位的前一个数据位的数值是否一致;Judging whether the numerical value of the current data bit is consistent with the numerical value of the previous data bit located in the current data bit;

若所述当前数据位的数值与位于所述当前数据位的前一个数据位的数值不一致,则确定所述当前数据位发生翻转;If the numerical value of the current data bit is inconsistent with the numerical value of the previous data bit located in the current data bit, it is determined that the current data bit is flipped;

若所述当前数据位的数值与位于所述当前数据位的前一个数据位的数值一致,则确定所述当前数据位不发生翻转。If the value of the current data bit is consistent with the value of the previous data bit located in the current data bit, it is determined that the current data bit does not flip.

需要说明的是,可以从当前数据位的位置信息中,确定位于当前数据位的前一个数据位的数值。It should be noted that the value of the data bit located before the current data bit can be determined from the position information of the current data bit.

需要说明的是,在当前数据位的数值和位于当前数据位的前一数据位的数值不相同时,可以确定当前数据位发生了翻转,而翻转有两种情况,一种是发生0-1翻转,此时,0为位于当前数据位的前一数据位的数值,1为当前数据位的数值;另一种情况是发生1-0翻转,此时,1为位于当前数据位的前一数据位的数值,0为当前数据位的数值。It should be noted that when the value of the current data bit is different from the value of the previous data bit located in the current data bit, it can be determined that the current data bit has flipped, and there are two cases of flipping, one is that 0-1 occurs Flip, at this time, 0 is the value of the previous data bit located in the current data bit, and 1 is the value of the current data bit; another case is that a 1-0 flip occurs, at this time, 1 is located in the previous data bit. The value of the data bit, 0 is the value of the current data bit.

S205、确定当前数据位的编码类型为第一类型。S205. Determine that the encoding type of the current data bit is the first type.

S206、确定当前数据位的数值是否为1;若确定当前数据位的数值为1,则执行S207;若确定当前数据位的数值不为1,则执行S208。S206. Determine whether the value of the current data bit is 1; if it is determined that the value of the current data bit is 1, execute S207; if it is determined that the value of the current data bit is not 1, execute S208.

S207、确定当前数据位的编码类型为第二类型。S207. Determine that the encoding type of the current data bit is the second type.

S208、确定当前数据位的数值为0,并确定当前数据位的编码类型为第三类型。S208. Determine that the value of the current data bit is 0, and determine that the encoding type of the current data bit is the third type.

本发明实施例提供的方法中,步骤S206~S208为基于当前数据位的数值,确定当前数据位的编码类型的具体过程。In the method provided by the embodiment of the present invention, steps S206 to S208 are a specific process of determining the encoding type of the current data bit based on the value of the current data bit.

在确定了当前数据位的编码类型后,可以根据当前数据位的编码类型,将当前数据位的数值转换成与其编码类型对应的编码序列,具体如下所述:After the encoding type of the current data bit is determined, the value of the current data bit can be converted into an encoding sequence corresponding to its encoding type according to the encoding type of the current data bit, as follows:

在当前数据位的编码类型为第一类型时,将当前数据位的数值转换成与第一类型对应的零极性编码序列;在当前数据位的编码类型为第二类型时,将当前数据位的数值转换成与第二类型对应的正极性编码序列;在当前数据位的编码类型为第三类型时,将当前数据位的数值转换成负极性编码序列。When the encoding type of the current data bit is the first type, convert the value of the current data bit into a zero-polarity encoding sequence corresponding to the first type; when the encoding type of the current data bit is the second type, convert the current data bit The value of the current data bit is converted into a positive polarity coding sequence corresponding to the second type; when the coding type of the current data bit is the third type, the value of the current data bit is converted into a negative polarity coding sequence.

需要说明的是,上述将当前数据位的数值转换成编码序列的方式可以应用于数据中所有的数据位,进一步的,不同的编码类型对应不同的编码序列,其中,编码类型为第一类型时,对应的编码序列为零极性编码序列;编码类型为第二类型时,对应的编码序列为正极性编码序列;编码类型为第三类型时,对应的编码序列为负极性编码序列。It should be noted that the above-mentioned method of converting the value of the current data bit into a coding sequence can be applied to all data bits in the data. Further, different coding types correspond to different coding sequences, wherein, when the coding type is the first type , the corresponding coding sequence is a zero polarity coding sequence; when the coding type is the second type, the corresponding coding sequence is a positive polarity coding sequence; when the coding type is the third type, the corresponding coding sequence is a negative polarity coding sequence.

需要说明的是,正极编码序列、负极编码序列以及零极编码序列均由二进制数值组成,不同类型的编码序列中的二进制数值是不同的;示例性的,正极编码序列为“1110”,负极编码序列为“1000”,零极编码序列为“1100”。It should be noted that the positive coding sequence, the negative coding sequence and the zero coding sequence are all composed of binary values, and the binary values in different types of coding sequences are different; exemplarily, the positive coding sequence is "1110", and the negative coding sequence The sequence is "1000" and the zero-pole coding sequence is "1100".

S104、基于每个数据位的编码序列,确定每个数据位的编码极性,并基于每个数据位的编码极性确定所述包编码序列的序列极性。S104. Determine the coding polarity of each data bit based on the coding sequence of each data bit, and determine the sequence polarity of the packet coding sequence based on the coding polarity of each data bit.

本发明实施例提供的方法中,在将数据位中的数值转换成编码序列后,可以根据编码序列确定数据位的编码极性,具体如:当数据位的编码序列为零极性编码序列时,确定数据位的编码极性为零极性;当数据位的编码序列为正极性编码序列时,确定数据位的编码极性为正极性;当数据位的编码序列为负极性编码序列时,确定数据位的编码极性为负极性。In the method provided by the embodiment of the present invention, after the numerical value in the data bit is converted into a coding sequence, the coding polarity of the data bit can be determined according to the coding sequence, for example: when the coding sequence of the data bit is a zero-polar coding sequence , determine that the coding polarity of the data bit is zero polarity; when the coding sequence of the data bit is a positive polarity coding sequence, determine that the coding polarity of the data bit is positive polarity; when the coding sequence of the data bit is a negative polarity coding sequence, Determine the encoding polarity of the data bits to be negative.

本发明实施例提供的方法中,确定每个数据位的编码极性后,可以根据每个数据位的编码极性确定包编码序列的序列极性;确定包编码序列的序列极性是为了确定包编码序列是否达到了DC平衡,序列极性与编码极性相同,分为三种,一种为正极性,一种为负极性,另外一种为零极性。In the method provided by the embodiment of the present invention, after the coding polarity of each data bit is determined, the sequence polarity of the packet coding sequence can be determined according to the coding polarity of each data bit; the sequence polarity of the packet coding sequence is determined to determine the sequence polarity of the packet coding sequence. Whether the packet coding sequence has reached DC balance, the sequence polarity is the same as the coding polarity, there are three types, one is positive polarity, one is negative polarity, and the other is zero polarity.

参照图7,为本发明实施例提供的确定包编码序列的序列极性的方法流程图,具体说明如下所述:Referring to FIG. 7, it is a flowchart of a method for determining the sequence polarity of a packet coding sequence provided by an embodiment of the present invention, and the specific description is as follows:

S301、确定编码极性为正极性的数据位的第一数量,以及确定编码极性为负极性的数据位的第二数量。S301. Determine a first number of data bits whose encoding polarity is positive, and determine a second number of data bits whose encoding polarity is negative.

对数据中的各个数据位的编码极性进行统计,从而确定编码极性为正极性的数据位的第一数量,以及确定编码极性为负极性的数据位的第二数量,进一步的,还可以确定编码极性为零极性的数据位的第三数量。Statistics are performed on the coding polarities of each data bit in the data, thereby determining a first number of data bits whose coding polarity is positive, and determining a second number of data bits whose coding polarity is negative, and further, also A third number of data bits with an encoding polarity of zero polarity may be determined.

S302、判断第一数量是否等于第二数量;若确定第一数量等于第二数量,则执行S303;若确定第一数量不等于第二数量,则执行S304。S302. Determine whether the first quantity is equal to the second quantity; if it is determined that the first quantity is equal to the second quantity, then execute S303; if it is determined that the first quantity is not equal to the second quantity, execute S304.

将第一数量和第二数量进行对比,以判断第一数量是否等于第二数量。The first quantity and the second quantity are compared to determine whether the first quantity is equal to the second quantity.

S303、确定包编码序列的序列极性为零极性。S303. Determine that the sequence polarity of the packet coding sequence is zero polarity.

在确定第一数量等于第二数量时,表示编码极性为正极性的数据位的个数等于编码极性为负极性的数据位的个数,由此可以确定包编码序列的序列极性为零极性,也可以确定包编码序列达到了DC平衡。When it is determined that the first number is equal to the second number, the number of data bits indicating that the encoding polarity is positive is equal to the number of data bits whose encoding polarity is negative, so it can be determined that the sequence polarity of the packet encoding sequence is Zero polarity also determines that the packet encoding sequence is DC balanced.

S304、确定第一数量是否大于第二数量;若确定第一数量大于第二数量,则执行S305;若确定第一数量不大于第二数量,则执行S306。S304. Determine whether the first quantity is greater than the second quantity; if it is determined that the first quantity is greater than the second quantity, execute S305; if it is determined that the first quantity is not greater than the second quantity, execute S306.

在第一数量不等于第二数量时,判断第一数量是否大于第二数量。When the first quantity is not equal to the second quantity, it is determined whether the first quantity is greater than the second quantity.

S305、确定包编码序列的序列极性为正极性。S305. Determine that the sequence polarity of the packet coding sequence is positive.

当第一数量大于第二数量时,表示编码极性为正极性的数据位的个数多于编码极性为负极性的数据位的个数,因此可以确定包编码序列的序列极性为正极性,此时包编码序列未达到DC平衡,此时包编码序列需要补充负极性的编码,才能使包编码序列达到DC平衡。When the first number is greater than the second number, it indicates that the number of data bits whose coding polarity is positive is more than the number of data bits whose coding polarity is negative, so it can be determined that the sequence polarity of the packet coding sequence is positive At this time, the packet coding sequence has not reached the DC balance. At this time, the packet coding sequence needs to be supplemented with negative polarity coding, so that the packet coding sequence can reach the DC balance.

S306、确定包编码序列的序列极性为负极性。S306. Determine that the sequence polarity of the packet coding sequence is negative.

当第一数量不大于第二数量时,即当确定第一数量小于第二数量时,此时表示编码极性为负极性的数据位的个数多于编码极性为正极性的数据位的个数,因此可以确定包编码序列的序列极性为负极性,此时包编码序列未达到DC平衡,此时包编码序列需要补充正极性的编码,才能使包编码序列达到DC平衡。When the first number is not greater than the second number, that is, when the first number is determined to be less than the second number, the number of data bits indicating that the encoding polarity is negative is more than the number of data bits whose encoding polarity is positive. Therefore, it can be determined that the sequence polarity of the packet coding sequence is negative. At this time, the packet coding sequence has not reached the DC balance. At this time, the packet coding sequence needs to be supplemented with positive polarity codes to make the packet coding sequence reach DC balance.

S105、将预设的包结束序列添加至包编码序列的末端,并基于包编码序列的序列极性,在包结束序列的末端添加用于保证包编码序列的电平平衡的电平平衡序列,以完成对数据的编码处理。S105, adding a preset packet end sequence to the end of the packet encoding sequence, and based on the sequence polarity of the packet encoding sequence, adding a level balance sequence for ensuring the level balance of the packet encoding sequence at the end of the packet end sequence, to complete the encoding of the data.

包结束序列(End of Packet,EOP)添加在包编码序列的末端,用于表示数据的有效数据到此结束,EOP为固定的序列,在解码时将其作为普通的包数据,EOP满足DC平衡。End of Packet (EOP) is added at the end of the packet coding sequence, which is used to indicate that the valid data of the data ends here. EOP is a fixed sequence, which is used as ordinary packet data during decoding. EOP satisfies DC balance .

为了保证包编码序列达到DC平衡,本发明还对包编码序列补充了一个电平平衡序列,其中,电平平衡序列根据包编码序列的序列极性进行添加,不同的序列极性对应的电平平衡序列的内容是不同的,示例性的,在序列极性为负极性时,补充的电平平衡序列应为正极性的编码序列,因此此时的电平平衡序列具体可为“1110”;在序列极性为正极性时,补充的电平平衡序列应为负极性的编码序列,因此此时的电平平衡序列具体可为“1000”,在序列极性为零极性时,补充的电平平衡序列应为零极性的编码序列,因此此时的电平平衡序列具体可为“1100”。In order to ensure that the packet coding sequence achieves DC balance, the present invention also supplements the packet coding sequence with a level balance sequence, wherein the level balance sequence is added according to the sequence polarity of the packet coding sequence, and the levels corresponding to different sequence polarities The content of the balance sequence is different. For example, when the sequence polarity is negative, the supplementary level balance sequence should be a positive code sequence, so the level balance sequence at this time can be specifically "1110"; When the sequence polarity is positive, the supplemented level balance sequence should be a negative code sequence, so the level balance sequence at this time can be specifically "1000", when the sequence polarity is zero polarity, the supplementary level balance sequence The level balance sequence should be a zero-polarity coding sequence, so the level balance sequence at this time can specifically be "1100".

电平平衡序列添加在包结束序列的末端,由此可以使包编码序列达到零极性,使得包编码序列达到DC平衡。The level balancing sequence is added at the end of the packet end sequence, whereby the packet coding sequence can be brought to zero polarity and the packet coding sequence can be DC balanced.

本发明实施例提供的方法中,获取待处理的数据;将预设的包头序列添加至数据的前端;逐一确定数据中各个数据位的编码类型,并将每个数据位中的数值转换成与其编码类型对应的编码序列,得到数据的包编码序列;基于每个数据位的编码序列,确定每个数据位的编码极性,并基于每个数据位的编码极性确定包编码序列的序列极性;将包结束序列添加至包编码序列的末端,并基于包编码序列的序列极性,在包结束序列的末端添加用于保证包编码序列的电平平衡的电平平衡序列,以完成对数据的编码处理。在对数据进行编码的过程中,基于数据位的编码类型,可以将数据位的数值直接转换成与编码类型对应的编码序列,对数据位的编码过程简单、快捷,从而提高了编码效率,为了保证包编码序列的电平平衡,在包编码序列后添加了对包编码序列的序列极性对应的电平平衡序列,由此,在提高编码效率的同时保证了编码质量。In the method provided by the embodiment of the present invention, the data to be processed is acquired; the preset packet header sequence is added to the front end of the data; the encoding type of each data bit in the data is determined one by one, and the numerical value in each data bit is converted into its corresponding value. The coding sequence corresponding to the coding type is used to obtain the packet coding sequence of the data; based on the coding sequence of each data bit, the coding polarity of each data bit is determined, and the sequence polarity of the packet coding sequence is determined based on the coding polarity of each data bit. Add the packet end sequence to the end of the packet coding sequence, and based on the sequence polarity of the packet coding sequence, add a level balance sequence to ensure the level balance of the packet coding sequence at the end of the packet end sequence to complete the matching Encoding of data. In the process of encoding data, based on the encoding type of the data bit, the value of the data bit can be directly converted into an encoding sequence corresponding to the encoding type. The encoding process of the data bit is simple and fast, thereby improving the encoding efficiency. In order to To ensure the level balance of the packet coding sequence, a level balancing sequence corresponding to the sequence polarity of the packet coding sequence is added after the packet coding sequence, thereby improving coding efficiency and ensuring coding quality.

完成对数据的编码处理后,得到了与数据对应的数据包,为了形象的说明数据包的结构,本发明实施例提供的一种数据包的结构定义图,参照图8,如图所示,包有效数据表示数据包中的有效数据,也可以理解为上文中的包编码序列,图中的PREAMBLE表示添加的8bit的包头序列,包有效数据中包含但不限于器件地址,寄存器地址,读写使能,ECC,需要传输的寄存器值,CRC等数据,不同的数据有不同的bit;图中的EOP为添加的包结束序列,dc_biase_bit为添加的1bit的电平平衡序列(编码后是4bit)。After completing the encoding processing of the data, a data packet corresponding to the data is obtained. In order to visually illustrate the structure of the data packet, a structure definition diagram of a data packet provided by an embodiment of the present invention is shown in FIG. 8 , as shown in the figure, The effective data of the packet means the effective data in the data packet, which can also be understood as the packet coding sequence above. The PREAMBLE in the figure represents the added 8-bit packet header sequence. The effective data of the packet includes but is not limited to the device address, register address, read and write Enable, ECC, register value to be transmitted, CRC and other data, different data have different bits; EOP in the figure is the added packet end sequence, dc_biase_bit is the added 1-bit level balance sequence (4 bits after encoding) .

参照图9,为本发明实施例提供的包头序列(PREAMBLE)以及EOP的编码示意图,包头序列和EOP均为固定的编码序列,包头序列和EOP的具体编码可以如图9中的编码所示。Referring to FIG. 9 , it is a schematic diagram of the encoding of a packet header sequence (PREAMBLE) and EOP provided by an embodiment of the present invention. The packet header sequence and EOP are both fixed encoding sequences, and the specific encoding of the packet header sequence and EOP can be as shown in the encoding in FIG. 9 .

参照图10,为本发明实施例提供的对数据中的有效数据进行编码的示例图,如图所示,数据的第一个数据位的数值为0,可确定第一个数据位的编码类型为第三类型,因此,对第一个数据位为数值进行编码可以得到“1000”,第二个数据位至第四个数据位的数值均与第一个数据位的数值相等,因此,可以确定第二个数据位至第四个数据位的编码类型均为第一类型,故而第二个数据位到第四个数据位的编码均为“1100”,第五个数据位的数值发生了翻转,而翻转的方式为“0-1”,第五个数据位的数值为1,因此,第五个数据位的编码类型为第二类型,故而第五个数据位的编码为“1110”,第六个数据位和第七个数据位的数值均与第五个数据位的数值相等,因此,第六个数据位和第七个数据位的编码类型均为第一类型,故而第六个数据位和第七个数据位的编码均为“1100”;第八个数据位的数值发生了翻转,翻转的方式为“1-0”,第八个数据位的数值为0,因此,第八个数据位的编码类型为第三类型,故而第八个数据位的编码为“1000”。Referring to FIG. 10, it is an example diagram of encoding valid data in data provided by an embodiment of the present invention. As shown in the figure, the value of the first data bit of the data is 0, and the encoding type of the first data bit can be determined It is the third type. Therefore, "1000" can be obtained by encoding the first data bit as a numerical value. The values of the second data bit to the fourth data bit are all equal to the value of the first data bit. Therefore, you can It is determined that the encoding type of the second data bit to the fourth data bit is the first type, so the encoding of the second data bit to the fourth data bit is "1100", and the value of the fifth data bit occurs. Flip, and the flip method is "0-1", the value of the fifth data bit is 1, therefore, the encoding type of the fifth data bit is the second type, so the encoding of the fifth data bit is "1110" , the value of the sixth data bit and the seventh data bit are equal to the value of the fifth data bit, therefore, the encoding type of the sixth data bit and the seventh data bit are the first type, so the sixth data bit and the seventh data bit are of the first type. The codes of the first data bit and the seventh data bit are both "1100"; the value of the eighth data bit is flipped, and the flip method is "1-0", and the value of the eighth data bit is 0. Therefore, The encoding type of the eighth data bit is the third type, so the encoding of the eighth data bit is "1000".

此处对数据的有效数据进行编码的方式做进一步说明:Here is a further description of how the valid data of the data is encoded:

1、数据的有效数据的第一个bit数据是1,则将其编码为1110;第一个bit数据是0,则将其编码为1000;1. If the first bit data of the valid data of the data is 1, it is encoded as 1110; the first bit data is 0, then it is encoded as 1000;

2、数据位发生0-1转换,对应的数据位编码为1110;数据位发生1-0转换,对应的数据位编码为1000;不发生数据转换时,数据位编码为1100;2. When the data bit undergoes 0-1 conversion, the corresponding data bit code is 1110; when the data bit undergoes 1-0 conversion, the corresponding data bit code is 1000; when no data conversion occurs, the data bit code is 1100;

3、所有的DC不平衡都是由‘1110’和‘1000’引入的。每次0-1转换将会引入一个正极性(‘1110’中1的个数比0多两个),每次1-0转换会引入一个负极性(‘1000’中1的个数比0少两个)。因为不可能出现连续两次0-1翻转或是1-0翻转,并且0-1翻转和1-0翻转总是交替出现的,因此,在数据的编码结束时,正负极性的差值只可能是-1(‘1000’比‘1110’多一个,此时数据的包编码序列的序列极性为负极性),0(‘1110’和‘1000’数量相同,此时数据的包编码序列的序列极性为零极性),1(‘1110’比‘1000’多一个,此时数据的包编码序列的极性为正极性),因此在数据的包编码序列的结尾处补充一个对应的dc_biase_bit(电平平衡序列),用以保证整个包编码序列的极性为零极性;具体做法是如果正负极的差值为-1,此时包编码序列的序列极性为负极性,则补充的电平平衡序列为“1110”;如果正负极的差值为0,此时包编码序列的序列极性为零极性,则补充的电平平衡序列为“1100”,如果正负极的差值为1,此时包编码序列的序列极性为正极性,则补充的电平平衡序列为“1000”。3. All DC imbalances are introduced by '1110' and '1000'. Each 0-1 transition will introduce a positive polarity (the number of 1s in '1110' is two more than 0's), and each 1-0 transition will introduce a negative polarity (the number of 1's in '1000' is more than 0's) two less). Because it is impossible to have two consecutive 0-1 inversions or 1-0 inversions, and 0-1 inversions and 1-0 inversions always occur alternately, therefore, at the end of data encoding, the difference between positive and negative polarities It can only be -1 ('1000' is one more than '1110', and the sequence polarity of the data packet coding sequence is negative), 0 (the number of '1110' and '1000' is the same, and the data packet coding sequence is the same at this time. The sequence polarity of the sequence is zero polarity), 1 ('1110' is one more than '1000', at this time the polarity of the data packet coding sequence is positive polarity), so add one at the end of the data packet coding sequence The corresponding dc_biase_bit (level balance sequence) is used to ensure that the polarity of the entire packet coding sequence is zero polarity; the specific method is that if the difference between the positive and negative poles is -1, then the sequence polarity of the packet coding sequence is negative. If the difference between the positive and negative poles is 0, then the sequence polarity of the packet coding sequence is zero, then the supplementary level balance sequence is “1100”. If the difference between the positive and negative poles is 1, and the sequence polarity of the packet coding sequence is positive, the supplementary level balance sequence is "1000".

由上述的内容可知,每个数据位均被编码成4bit的编码序列,整体的编码效率接近1/4,相对于现有技术中使用HDMI eARC协议进行编码的方式,具有更高的编码效率,除此之外,本发明除了具有达到DC平衡和包含时钟信息的优点外,还具有相邻占空比更接近1:1的优点。It can be seen from the above that each data bit is encoded into a 4-bit encoding sequence, and the overall encoding efficiency is close to 1/4. Compared with the encoding method using the HDMI eARC protocol in the prior art, it has higher encoding efficiency. Besides, the present invention has the advantage that the adjacent duty ratio is closer to 1:1 in addition to the advantages of achieving DC balance and including clock information.

进一步的,使用本发明提供的数据处理方式对数据进行编码时,接收端在接收到对应的数据流时,可以使用与本发明提供的数据处理方式所对应的解码方式进行解码操作,从而可以得到数据包中的有效数据。Further, when using the data processing method provided by the present invention to encode data, when the receiving end receives the corresponding data stream, it can use the decoding method corresponding to the data processing method provided by the present invention to perform decoding operations, thereby obtaining Valid data in the packet.

与图3所示的方法相对应的,本发明实施例提供的一种数据处理装置,该装置可以应用于可以进行编码的系统中,该装置用于支持图3所示的方法在现实生活中的应用,该装置的结构示意图如图11所示,具体说明如下所述:Corresponding to the method shown in FIG. 3, an embodiment of the present invention provides a data processing apparatus, the apparatus can be applied to a system that can perform coding, and the apparatus is used to support the method shown in FIG. 3 in real life. , the schematic diagram of the structure of the device is shown in Figure 11, and the specific description is as follows:

获取单元401,用于获取待处理的数据:An acquisition unit 401 is used to acquire the data to be processed:

第一添加单元402,用于将预设的包头序列添加至所述数据的前端;a first adding unit 402, configured to add a preset packet header sequence to the front end of the data;

第一确定单元403,用于逐一确定所述数据中各个数据位的编码类型,并将每个数据位中的数值转换成与其编码类型对应的编码序列,得到所述数据的包编码序列;The first determining unit 403 is used to determine the encoding type of each data bit in the data one by one, and convert the numerical value in each data bit into the encoding sequence corresponding to its encoding type, to obtain the packet encoding sequence of the data;

第二确定单元404,用于基于每个数据位的编码序列,确定每个数据位的编码极性,并基于每个数据位的编码极性确定所述包编码序列的序列极性;The second determining unit 404 is configured to determine the coding polarity of each data bit based on the coding sequence of each data bit, and determine the sequence polarity of the packet coding sequence based on the coding polarity of each data bit;

第二添加单元405,用于将预设的包结束序列添加至所述包编码序列的末端,并基于所述包编码序列的序列极性,在所述包结束序列的末端添加用于保证所述包编码序列的电平平衡的电平平衡序列,以完成对所述数据的编码处理。The second adding unit 405 is configured to add a preset packet end sequence to the end of the packet encoding sequence, and based on the sequence polarity of the packet encoding sequence, add at the end of the packet end sequence to ensure that all The level-balanced level-balanced sequence of the packet coding sequence is used to complete the coding process of the data.

本发明实施例提供的装置中,获取待处理的数据;将预设的包头序列添加至数据的前端;逐一确定数据中各个数据位的编码类型,并将每个数据位中的数值转换成与其编码类型对应的编码序列,得到数据的包编码序列;基于每个数据位的编码序列,确定每个数据位的编码极性,并基于每个数据位的编码极性确定包编码序列的序列极性;将包结束序列添加至包编码序列的末端,并基于包编码序列的序列极性,在包结束序列的末端添加用于保证包编码序列的电平平衡的电平平衡序列,以完成对数据的编码处理。在对数据进行编码的过程中,基于数据位的编码类型,可以将数据位的数值直接转换成与编码类型对应的编码序列,对数据位的编码过程简单、快捷,从而提高了编码效率,在包编码序列后添加电平平衡序列,该电平平衡序列用于确保包编码序列处于零极性,以保证包编码序列达到DC平衡,由此在提高编码效率的同时保证了编码质量。In the device provided by the embodiment of the present invention, the data to be processed is acquired; the preset packet header sequence is added to the front end of the data; the encoding type of each data bit in the data is determined one by one, and the numerical value in each data bit is converted into its corresponding value. The coding sequence corresponding to the coding type is used to obtain the packet coding sequence of the data; based on the coding sequence of each data bit, the coding polarity of each data bit is determined, and the sequence polarity of the packet coding sequence is determined based on the coding polarity of each data bit. Add the packet end sequence to the end of the packet coding sequence, and based on the sequence polarity of the packet coding sequence, add a level balance sequence to ensure the level balance of the packet coding sequence at the end of the packet end sequence to complete the matching Encoding of data. In the process of encoding data, based on the encoding type of the data bit, the value of the data bit can be directly converted into an encoding sequence corresponding to the encoding type. The encoding process of the data bit is simple and fast, thereby improving the encoding efficiency. A level balancing sequence is added after the packet coding sequence, and the level balancing sequence is used to ensure that the packet coding sequence is in zero polarity, so as to ensure that the packet coding sequence reaches DC balance, thereby improving coding efficiency and ensuring coding quality.

本发明实施例提供的装置中,所述第一确定单元403,用于执行逐一确定所述数据中各个数据位的编码类型时,具体包括:In the apparatus provided by the embodiment of the present invention, when the first determining unit 403 is configured to determine the encoding type of each data bit in the data one by one, it specifically includes:

逐一读取所述数据中的各个数据位,并将读取到的数据位作为当前数据位;Read each data bit in the data one by one, and use the read data bit as the current data bit;

获取当前数据位的数值和位置信息;Get the value and position information of the current data bit;

基于所述位置信息确定所述当前数据位是否为所述数据的起始数据位;determining whether the current data bit is the start data bit of the data based on the location information;

若确定所述当前数据位为所述数据的起始数据位,则基于所述当前数据位的数值,确定所述当前数据位的编码类型;If it is determined that the current data bit is the initial data bit of the data, then based on the value of the current data bit, the encoding type of the current data bit is determined;

若确定所述当前数据位不为所述数据的起始数据位,则判断所述当前数据位是否发生翻转;If it is determined that the current data bit is not the start data bit of the data, then determine whether the current data bit is flipped;

若确定所述当前数据位未发生翻转,则确定所述当前数据位的编码类型为第一类型;If it is determined that the current data bit is not flipped, then determine that the encoding type of the current data bit is the first type;

若所述当前数据位发生翻转,则基于所述当前数据位的数值,确定所述当前数据位的编码类型。If the current data bit is flipped, the encoding type of the current data bit is determined based on the value of the current data bit.

本发明实施例提供的装置中,所述第一确定单元403,用于执行基于所述当前数据位的数值,确定所述当前数据位的编码类型时,具体包括:In the apparatus provided by the embodiment of the present invention, the first determining unit 403, configured to perform the determination of the encoding type of the current data bit based on the value of the current data bit, specifically includes:

确定所述当前数据位的数值是否为1;determining whether the value of the current data bit is 1;

若确定所述当前数据位的数值为1,则确定所述当前数据位的编码类型为第二类型;If it is determined that the value of the current data bit is 1, then it is determined that the encoding type of the current data bit is the second type;

若确定所述当前数据位的数值不为1,则确定所述当前数据位的数值为0,并确定所述当前数据位的编码类型为第三类型。If it is determined that the value of the current data bit is not 1, the value of the current data bit is determined to be 0, and the encoding type of the current data bit is determined to be the third type.

本发明实施例提供的装置中,所述第一确定单元403,用于执行判断所述当前数据位是否发生翻转时,具体包括:In the device provided by the embodiment of the present invention, the first determining unit 403, configured to perform judgment on whether the current data bit is flipped, specifically includes:

获取位于所述当前数据位的前一个数据位的数值;Obtain the numerical value of the previous data bit located in the current data bit;

判断所述当前数据位的数值与位于所述当前数据位的前一个数据位的数值是否一致;Judging whether the numerical value of the current data bit is consistent with the numerical value of the previous data bit located in the current data bit;

若所述当前数据位的数值与位于所述当前数据位的前一个数据位的数值不一致,则确定所述当前数据位发生翻转;If the numerical value of the current data bit is inconsistent with the numerical value of the previous data bit located in the current data bit, it is determined that the current data bit is flipped;

若所述当前数据位的数值与位于所述当前数据位的前一个数据位的数值一致,则确定所述当前数据位不发生翻转。If the value of the current data bit is consistent with the value of the previous data bit located in the current data bit, it is determined that the current data bit does not flip.

本发明实施例提供的装置中,所述第一确定单元403,用于执行将每个数据位中的数值转换成与其编码类型对应的编码序列时,具体包括:In the device provided by the embodiment of the present invention, when the first determining unit 403 is configured to convert the value in each data bit into an encoding sequence corresponding to its encoding type, the first determining unit 403 specifically includes:

对于每个数据位,当所述数据位的编码类型为第一类型时,将所述数据位的数值转换成与所述第一类型对应的零极性编码序列;当所述数据位的编码类型为第二类型时,将所述数据位的数值转换成与所述第二类型对应的正极性编码序列;当所述数据位的编码类型为第三类型时,将所述数据位的数值转换成负极性编码序列。For each data bit, when the encoding type of the data bit is the first type, the value of the data bit is converted into a zero-polarity encoding sequence corresponding to the first type; when the encoding type of the data bit is When the type is the second type, the value of the data bit is converted into a positive polarity coding sequence corresponding to the second type; when the encoding type of the data bit is the third type, the value of the data bit is converted Convert to negative polarity coding sequence.

本发明实施例提供的装置中,所述第二确定单元404,用于执行基于每个数据位的编码序列,确定每个数据位的编码极性时,具体包括:In the apparatus provided by the embodiment of the present invention, the second determining unit 404, configured to execute a coding sequence based on each data bit, and when determining the coding polarity of each data bit, specifically includes:

对于每个所述数据位,当所述数据位的编码序列为零极性编码序列时,确定所述数据位的编码极性为零极性;当所述数据位的编码序列为正极性编码序列时,确定所述数据位的编码极性为正极性;当所述数据位的编码序列为负极性编码序列时,确定所述数据位的编码极性为负极性。For each data bit, when the coding sequence of the data bit is a zero-polarity coding sequence, the coding polarity of the data bit is determined to be zero-polarity; when the coding sequence of the data bit is a positive-polarity coding During the sequence, the coding polarity of the data bits is determined to be positive; when the coding sequence of the data bits is a negative coding sequence, the coding polarity of the data bits is determined to be negative.

本发明实施例提供的装置中,所述第二确定单元404,用于执行基于每个数据位的编码极性确定所述包编码序列的序列极性时,具体包括:In the apparatus provided in the embodiment of the present invention, when the second determining unit 404 is configured to determine the sequence polarity of the packet coding sequence based on the coding polarity of each data bit, it specifically includes:

确定编码极性为正极性的数据位的第一数量,以及确定编码极性为负极性的数据位的第二数量;determining a first number of data bits whose encoding polarity is positive, and determining a second number of data bits whose encoding polarity is negative;

判断所述第一数量是否等于所述第二数量;determining whether the first quantity is equal to the second quantity;

若所述第一数量等于所述第二数量,则确定所述包编码序列的序列极性为零极性;If the first number is equal to the second number, determining that the sequence polarity of the packet coding sequence is zero polarity;

若所述第一数量不等于所述第二数量,则确定所述第一数量是否大于所述第二数量;If the first quantity is not equal to the second quantity, determining whether the first quantity is greater than the second quantity;

若所述第一数量大于所述第二数量,则确定所述包编码序列的序列极性为正极性;If the first number is greater than the second number, determining that the sequence polarity of the packet encoding sequence is positive;

若所述第一数量小于所述第二数量,则确定所述包编码序列的序列极性为负极性。If the first number is smaller than the second number, it is determined that the sequence polarity of the packet coding sequence is negative polarity.

本发明实施例还提供了一种存储介质,所述存储介质包括存储的指令,其中,在所述指令运行时控制所述存储介质所在的设备执行上述数据处理方法。An embodiment of the present invention further provides a storage medium, where the storage medium includes stored instructions, wherein when the instructions are executed, a device where the storage medium is located is controlled to execute the above data processing method.

本发明实施例还提供了一种电子设备,其结构示意图如图12所示,具体包括存储器501,以及一个或者一个以上的指令502,其中一个或者一个以上指令502存储于存储器501中,且经配置以由一个或者一个以上处理器503执行所述一个或者一个以上指令502执行上述数据处理方法。An embodiment of the present invention also provides an electronic device, the schematic structural diagram of which is shown in FIG. 12 , and specifically includes a memory 501 and one or more instructions 502 , wherein one or more instructions 502 are stored in the memory 501 and are processed through the memory 501 . The one or more instructions 502 are configured to be executed by one or more processors 503 to perform the data processing method described above.

上述各个实施例的具体实施过程及其衍生方式,均在本发明的保护范围之内。The specific implementation process of each of the above-mentioned embodiments and the derivatives thereof are all within the protection scope of the present invention.

本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于系统或系统实施例而言,由于其基本相似于方法实施例,所以描述得比较简单,相关之处参见方法实施例的部分说明即可。以上所描述的系统及系统实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。Each embodiment in this specification is described in a progressive manner, and the same and similar parts between the various embodiments may be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system or the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and reference may be made to the partial description of the method embodiment for related parts. The systems and system embodiments described above are only illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, It can be located in one place, or it can be distributed over multiple network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution in this embodiment. Those of ordinary skill in the art can understand and implement it without creative effort.

专业人员还可以进一步意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。Professionals may further realize that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two, in order to clearly illustrate the possibilities of hardware and software. Interchangeability, the above description has generally described the components and steps of each example in terms of functionality. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Skilled artisans may implement the described functionality using different methods for each particular application, but such implementations should not be considered beyond the scope of the present invention.

对所公开的实施例的上述说明,使本领域专业技术人员能够实现或使用本发明。对这些实施例的多种修改对本领域的专业技术人员来说将是显而易见的,本文中所定义的一般原理可以在不脱离本发明的精神或范围的情况下,在其它实施例中实现。因此,本发明将不会被限制于本文所示的这些实施例,而是要符合与本文所公开的原理和新颖特点相一致的最宽的范围。The above description of the disclosed embodiments enables any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1.一种数据处理方法,其特征在于,包括:1. a data processing method, is characterized in that, comprises: 获取待处理的数据:Get pending data: 将预设的包头序列添加至所述数据的前端;adding a preset packet header sequence to the front end of the data; 逐一确定所述数据中各个数据位的编码类型,并将每个数据位中的数值转换成与其编码类型对应的编码序列,得到所述数据的包编码序列;Determine the encoding type of each data bit in the data one by one, and convert the numerical value in each data bit into the encoding sequence corresponding to its encoding type to obtain the packet encoding sequence of the data; 基于每个数据位的编码序列,确定每个数据位的编码极性,并基于每个数据位的编码极性确定所述包编码序列的序列极性;Determine the coding polarity of each data bit based on the coding sequence of each data bit, and determine the sequence polarity of the packet coding sequence based on the coding polarity of each data bit; 将预设的包结束序列添加至所述包编码序列的末端,并基于所述包编码序列的序列极性,在所述包结束序列的末端添加用于保证所述包编码序列的电平平衡的电平平衡序列,以完成对所述数据的编码处理。Adding a preset packet end sequence to the end of the packet encoding sequence, and adding a level balance of the packet encoding sequence at the end of the packet end sequence based on the sequence polarity of the packet encoding sequence level balance sequence to complete the encoding process of the data. 2.根据权利要求1所述的方法,其特征在于,所述逐一确定所述数据中各个数据位的编码类型,包括:2. The method according to claim 1, wherein the determining the encoding type of each data bit in the data one by one comprises: 逐一读取所述数据中的各个数据位,并将读取到的数据位作为当前数据位;Read each data bit in the data one by one, and use the read data bit as the current data bit; 获取当前数据位的数值和位置信息;Get the value and position information of the current data bit; 基于所述位置信息确定所述当前数据位是否为所述数据的起始数据位;determining whether the current data bit is the start data bit of the data based on the location information; 若确定所述当前数据位为所述数据的起始数据位,则基于所述当前数据位的数值,确定所述当前数据位的编码类型;If it is determined that the current data bit is the initial data bit of the data, then based on the value of the current data bit, the encoding type of the current data bit is determined; 若确定所述当前数据位不为所述数据的起始数据位,则判断所述当前数据位是否发生翻转;If it is determined that the current data bit is not the start data bit of the data, then determine whether the current data bit is flipped; 若确定所述当前数据位未发生翻转,则确定所述当前数据位的编码类型为第一类型;If it is determined that the current data bit is not flipped, then determine that the encoding type of the current data bit is the first type; 若所述当前数据位发生翻转,则基于所述当前数据位的数值,确定所述当前数据位的编码类型。If the current data bit is flipped, the encoding type of the current data bit is determined based on the value of the current data bit. 3.根据权利要求2所述的方法,其特征在于,所述基于所述当前数据位的数值,确定所述当前数据位的编码类型,包括:3. The method according to claim 2, characterized in that, determining the encoding type of the current data bit based on the numerical value of the current data bit, comprising: 确定所述当前数据位的数值是否为1;determining whether the value of the current data bit is 1; 若确定所述当前数据位的数值为1,则确定所述当前数据位的编码类型为第二类型;If it is determined that the value of the current data bit is 1, then it is determined that the encoding type of the current data bit is the second type; 若确定所述当前数据位的数值不为1,则确定所述当前数据位的数值为0,并确定所述当前数据位的编码类型为第三类型。If it is determined that the value of the current data bit is not 1, the value of the current data bit is determined to be 0, and the encoding type of the current data bit is determined to be the third type. 4.根据权利要求2所述的方法,其特征在于,所述判断所述当前数据位是否发生翻转,包括:4. The method according to claim 2, wherein the judging whether the current data bit is flipped comprises: 获取位于所述当前数据位的前一个数据位的数值;Obtain the numerical value of the previous data bit located in the current data bit; 判断所述当前数据位的数值与位于所述当前数据位的前一个数据位的数值是否一致;Judging whether the numerical value of the current data bit is consistent with the numerical value of the previous data bit located in the current data bit; 若所述当前数据位的数值与位于所述当前数据位的前一个数据位的数值不一致,则确定所述当前数据位发生翻转;If the numerical value of the current data bit is inconsistent with the numerical value of the previous data bit located in the current data bit, it is determined that the current data bit is flipped; 若所述当前数据位的数值与位于所述当前数据位的前一个数据位的数值一致,则确定所述当前数据位不发生翻转。If the value of the current data bit is consistent with the value of the previous data bit located in the current data bit, it is determined that the current data bit does not flip. 5.根据权利要求3所述的方法,其特征在于,所述将每个数据位中的数值转换成与其编码类型对应的编码序列,包括:5. method according to claim 3, is characterized in that, described converting the numerical value in each data bit into the coding sequence corresponding to its coding type, comprising: 对于每个数据位,当所述数据位的编码类型为第一类型时,将所述数据位的数值转换成与所述第一类型对应的零极性编码序列;当所述数据位的编码类型为第二类型时,将所述数据位的数值转换成与所述第二类型对应的正极性编码序列;当所述数据位的编码类型为第三类型时,将所述数据位的数值转换成负极性编码序列。For each data bit, when the encoding type of the data bit is the first type, the value of the data bit is converted into a zero-polarity encoding sequence corresponding to the first type; when the encoding type of the data bit is When the type is the second type, the value of the data bit is converted into a positive polarity coding sequence corresponding to the second type; when the encoding type of the data bit is the third type, the value of the data bit is converted Convert to negative polarity coding sequence. 6.根据权利要求5所述的方法,其特征在于,所述基于每个数据位的编码序列,确定每个数据位的编码极性,包括:6. The method according to claim 5, wherein the encoding sequence based on each data bit, determining the encoding polarity of each data bit, comprising: 对于每个所述数据位,当所述数据位的编码序列为零极性编码序列时,确定所述数据位的编码极性为零极性;当所述数据位的编码序列为正极性编码序列时,确定所述数据位的编码极性为正极性;当所述数据位的编码序列为负极性编码序列时,确定所述数据位的编码极性为负极性。For each data bit, when the coding sequence of the data bit is a zero-polarity coding sequence, the coding polarity of the data bit is determined to be zero-polarity; when the coding sequence of the data bit is a positive-polarity coding During the sequence, the coding polarity of the data bits is determined to be positive; when the coding sequence of the data bits is a negative coding sequence, the coding polarity of the data bits is determined to be negative. 7.根据权利要求6所述的方法,其特征在于,所述基于每个数据位的编码极性确定所述包编码序列的序列极性,包括:7. The method according to claim 6, wherein the determining the sequence polarity of the packet coding sequence based on the coding polarity of each data bit comprises: 确定编码极性为正极性的数据位的第一数量,以及确定编码极性为负极性的数据位的第二数量;determining a first number of data bits whose encoding polarity is positive, and determining a second number of data bits whose encoding polarity is negative; 判断所述第一数量是否等于所述第二数量;determining whether the first quantity is equal to the second quantity; 若所述第一数量等于所述第二数量,则确定所述包编码序列的序列极性为零极性;If the first number is equal to the second number, determining that the sequence polarity of the packet coding sequence is zero polarity; 若所述第一数量不等于所述第二数量,则确定所述第一数量是否大于所述第二数量;If the first quantity is not equal to the second quantity, determining whether the first quantity is greater than the second quantity; 若所述第一数量大于所述第二数量,则确定所述包编码序列的序列极性为正极性;If the first number is greater than the second number, determining that the sequence polarity of the packet encoding sequence is positive; 若所述第一数量小于所述第二数量,则确定所述包编码序列的序列极性为负极性。If the first number is smaller than the second number, it is determined that the sequence polarity of the packet coding sequence is negative polarity. 8.一种数据处理装置,其特征在于,包括:8. A data processing device, comprising: 获取单元,用于获取待处理的数据:Get unit, used to get the data to be processed: 第一添加单元,用于将预设的包头序列添加至所述数据的前端;a first adding unit, for adding a preset packet header sequence to the front end of the data; 第一确定单元,用于逐一确定所述数据中各个数据位的编码类型,并将每个数据位中的数值转换成与其编码类型对应的编码序列,得到所述数据的包编码序列;The first determining unit is used to determine the encoding type of each data bit in the data one by one, and convert the numerical value in each data bit into the encoding sequence corresponding to its encoding type, to obtain the packet encoding sequence of the data; 第二确定单元,用于基于每个数据位的编码序列,确定每个数据位的编码极性,并基于每个数据位的编码极性确定所述包编码序列的序列极性;a second determining unit, configured to determine the coding polarity of each data bit based on the coding sequence of each data bit, and determine the sequence polarity of the packet coding sequence based on the coding polarity of each data bit; 第二添加单元,用于将预设的包结束序列添加至所述包编码序列的末端,并基于所述包编码序列的序列极性,在所述包结束序列的末端添加用于保证所述包编码序列的电平平衡的平衡序列,以完成对所述数据的编码处理。a second adding unit, configured to add a preset packet end sequence to the end of the packet encoding sequence, and based on the sequence polarity of the packet encoding sequence, add a preset packet end sequence at the end of the packet encoding sequence to ensure the A level-balanced balanced sequence of the packet encoding sequence to complete the encoding process for the data. 9.一种存储介质,其特征在于,所述存储介质包括存储的指令,其中,在所述指令运行时控制所述存储介质所在的设备执行如权利要求1~7任意一项所述的数据处理方法。9 . A storage medium, characterized in that the storage medium comprises stored instructions, wherein when the instructions are executed, a device where the storage medium is located is controlled to execute the data according to any one of claims 1 to 7 Approach. 10.一种电子设备,其特征在于,包括存储器,以及一个或者一个以上的指令,其中一个或者一个以上指令存储于存储器中,且经配置以由一个或者一个以上处理器执行如权利要求1~7任意一项所述的数据处理方法。10. An electronic device, comprising a memory, and one or more instructions, wherein the one or more instructions are stored in the memory and configured to be executed by one or more processors as claimed in claims 1- 7. The data processing method described in any one of the items.
CN202111436378.2A 2021-11-29 2021-11-29 Data processing method and device, storage medium and electronic device Pending CN114333857A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111436378.2A CN114333857A (en) 2021-11-29 2021-11-29 Data processing method and device, storage medium and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111436378.2A CN114333857A (en) 2021-11-29 2021-11-29 Data processing method and device, storage medium and electronic device

Publications (1)

Publication Number Publication Date
CN114333857A true CN114333857A (en) 2022-04-12

Family

ID=81045965

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111436378.2A Pending CN114333857A (en) 2021-11-29 2021-11-29 Data processing method and device, storage medium and electronic device

Country Status (1)

Country Link
CN (1) CN114333857A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1049580A (en) * 1989-07-17 1991-02-27 数字设备公司 improved digital signal data and forward error control coding technology
JP2013153394A (en) * 2012-01-26 2013-08-08 Keio Gijuku Conversion method of transmission line code for digital communication, and code generation method for the conversion method
CN110740011A (en) * 2019-10-08 2020-01-31 苏州浪潮智能科技有限公司 coding and decoding method and coder and decoder
CN112838868A (en) * 2020-12-30 2021-05-25 天津瑞发科半导体技术有限公司 9B/10B coding and decoding method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1049580A (en) * 1989-07-17 1991-02-27 数字设备公司 improved digital signal data and forward error control coding technology
JP2013153394A (en) * 2012-01-26 2013-08-08 Keio Gijuku Conversion method of transmission line code for digital communication, and code generation method for the conversion method
CN110740011A (en) * 2019-10-08 2020-01-31 苏州浪潮智能科技有限公司 coding and decoding method and coder and decoder
CN112838868A (en) * 2020-12-30 2021-05-25 天津瑞发科半导体技术有限公司 9B/10B coding and decoding method

Similar Documents

Publication Publication Date Title
CN105812098A (en) Universal file transmission method for providing veried error protection and
CN111865952B (en) Data processing method, data processing device, storage medium and electronic equipment
WO2018068634A1 (en) Methods and devices for encoding and decoding binary data
CN108960797B (en) Block generation and verification method, device, equipment and storage medium
CN103534968A (en) Encoding and decoding method and device for Ethernet physical layer
CN101789105B (en) Packet-level dynamic mail attachment virus detection method
CN111082896A (en) A data transmission method and sending and receiving device
CN110086703A (en) A kind of method for message transmission and device based on Transmission Control Protocol
TW527808B (en) Wide band radio transmission method
CN114333857A (en) Data processing method and device, storage medium and electronic device
CN111211887B (en) Resource encryption method, system, device and computer-readable storage medium
CN101228698B (en) 4-level logic decoder and method for decoding 4-level input data signal
CN114356925A (en) Identification generation method and device, electronic equipment and storage medium
CN116187435B (en) Method and system for storing information by utilizing DNA (deoxyribonucleic acid) based on large and small fountain codes and MRC (MRC) algorithm
CN101141442B (en) System and method for implementing memory card function service
CN115085872B (en) Data processing method and device, storage medium and electronic equipment
CN114626338B (en) Method, system, equipment and storage medium for encoding and decoding characters of data
CN114257879B (en) Method and system for playing video
CN114124309B (en) Data transmission method and equipment
CN116319828A (en) Remote disaster recovery backup data transmission method, system, device and medium
CN115952517A (en) Method and system for calculating hash value
CN115206330A (en) Audio processing method, audio processing apparatus, electronic device, and storage medium
CN110401458B (en) Data check coding method and system
CN109428861A (en) Network communication method and equipment
CN114339252A (en) Data compression method and device

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