Audio data processing method and device, storage medium and electronic device

By coding polarity conversion based on data bits and adding level balance sequences in audio data encoding, the problem of low encoding efficiency is solved, and efficient and high-quality audio data encoding is achieved.

CN114333857BActive Publication Date: 2025-09-02SHENZHEN LONTIUM SEMICON TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111436378.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-29
Publication Date
2025-09-02
Estimated Expiration
2041-11-29

AI Technical Summary

Technical Problem

The prior art has low encoding efficiency in audio data encoding, and it is difficult to improve encoding efficiency while ensuring encoding quality.

Method used

By encoding the numerical values ​​of each data bit in the audio data based on the encoding polarity of each data bit in the audio data, the numerical values ​​are directly converted into an encoding sequence corresponding to the encoding polarity, and a level balance sequence is added to the back end of the packet encoding sequence to ensure DC balance.

Benefits of technology

Improve coding efficiency, ensure coding quality, and achieve DC balance of packet coding sequences.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114333857B_ABST
    Figure CN114333857B_ABST
Patent Text Reader

Abstract

The present invention provides an audio data processing method and device, a storage medium, and an electronic device. The method includes: adding a packet header sequence to the front end of acquired audio data; determining the encoding type of each data bit in the audio data, and based on the encoding type of each data bit, converting the value of each data bit into a corresponding encoding sequence to obtain a packet encoding sequence of the audio data; determining the encoding polarity of each data bit based on the encoding type of each data bit, determining the sequence polarity of the packet encoding sequence based on the encoding polarity of each data bit, and adding a packet end sequence and a level balancing sequence corresponding to the sequence polarity to the back end of the packet encoding sequence. The audio data is encoded, and the data bit values ​​are directly converted into the encoding sequence corresponding to the encoding type of the data bit, thereby further improving encoding efficiency. The level balancing sequence is added after the packet encoding sequence of the audio data, thereby improving encoding efficiency while ensuring encoding quality.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data coding technology, and in particular to an audio data processing method and device, a storage medium, and an electronic device. Background Art

[0002] Multimedia technology is increasingly being used in our daily lives, and audio playback is one of the most frequently used multimedia features. The raw audio signal is very large, so it is often compressed to reduce transmission line pressure and reduce the memory occupied by the audio data.

[0003] Audio data is usually compressed using encoding technology. With the widespread application of various social instant messaging software and live video, more and more audio data needs to be compressed. Faced with such a huge amount of audio data, how to ensure encoding quality while improving encoding efficiency has become an urgent problem that researchers need to solve. Summary of the Invention

[0004] In view of this, the present invention provides an audio data processing method, which encodes the numerical value of each data bit in the audio data based on the coding polarity of each data bit, and directly converts the numerical value into a coding sequence corresponding to the coding polarity to complete the encoding of the data bit. This process is simple and fast, and a level balance sequence is added to the back end of the obtained packet coding sequence to ensure that the packet coding sequence is in DC balance, thereby improving the coding efficiency while ensuring the coding quality.

[0005] To achieve the above objectives, the embodiments of the present invention provide the following technical solutions:

[0006] A first aspect of the present invention discloses an audio data processing method, comprising:

[0007] Get the audio data to be processed:

[0008] Adding a preset packet header sequence to the front end of the audio data;

[0009] Determining the encoding type of each data bit in the audio data one by one, and converting the value in each data bit into a code sequence corresponding to its encoding type, to obtain a packet code sequence of the audio data;

[0010] Determining a coding polarity of each data bit based on the coding sequence of each data bit, and determining a sequence polarity of the packet coding sequence based on the coding polarity of each data bit;

[0011] A preset packet end sequence is added to the end of the packet coding sequence, and based on the sequence polarity of the packet coding sequence, a level balance sequence for ensuring the level balance of the packet coding sequence is added to the end of the packet end sequence to complete the encoding processing of the audio data.

[0012] Optionally, in the above method, determining the encoding type of each data bit in the audio data one by one includes:

[0013] Reading each data bit in the audio data one by one, and using the read data bit as the current data bit;

[0014] Get the value and position information of the current data bit;

[0015] determining whether the current data bit is a starting data bit of the audio data based on the position information;

[0016] If it is determined that the current data bit is the starting data bit of the audio data, determining the encoding type of the current data bit based on the value of the current data bit;

[0017] If it is determined that the current data bit is not the starting data bit of the audio data, determining whether the current data bit is flipped;

[0018] If it is determined that the current data bit has not been flipped, determining that the encoding type of the current data bit is the first type;

[0019] 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.

[0020] Optionally, in the above method, determining the encoding type of the current data bit based on the value of the current data bit includes:

[0021] Determine whether the value of the current data bit is 1;

[0022] If it is determined that the value of the current data bit is 1, then determining that the encoding type of the current data bit is the second type;

[0023] 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.

[0024] Optionally, in the above method, determining whether the current data bit is flipped includes:

[0025] Obtaining a value of a data bit preceding the current data bit;

[0026] Determining whether the value of the current data bit is consistent with the value of the data bit before the current data bit;

[0027] If the value of the current data bit is inconsistent with the value of the data bit before the current data bit, it is determined that the current data bit is flipped;

[0028] If the value of the current data bit is consistent with the value of the data bit before the current data bit, it is determined that the current data bit does not flip.

[0029] Optionally, in the above method, converting the value in each data bit into a coding sequence corresponding to its coding type includes:

[0030] 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 the second type, the value of the data bit is converted into a positive polarity encoding 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 into a negative polarity encoding sequence.

[0031] Optionally, in the above method, determining the encoding polarity of each data bit based on the encoding sequence of each data bit includes:

[0032] For each of the data bits, 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 sequence, the coding polarity of the data bit is determined to be positive polarity; when the coding sequence of the data bit is a negative polarity coding sequence, the coding polarity of the data bit is determined to be negative polarity.

[0033] Optionally, in the above method, determining the sequence polarity of the packet coding sequence based on the coding polarity of each data bit includes:

[0034] determining a first number of data bits encoded with a positive polarity, and determining a second number of data bits encoded with a negative polarity;

[0035] determining whether the first quantity is equal to the second quantity;

[0036] If the first number is equal to the second number, determining that the sequence polarity of the packet encoding sequence is zero polarity;

[0037] If the first number is not equal to the second number, determining whether the first number is greater than the second number;

[0038] If the first number is greater than the second number, determining that the sequence polarity of the packet encoding sequence is positive;

[0039] If the first number is smaller than the second number, the sequence polarity of the packet encoding sequence is determined to be negative.

[0040] A second aspect of the present invention discloses an audio data processing device, comprising:

[0041] The acquisition unit is used to obtain the audio data to be processed:

[0042] A first adding unit, configured to add a preset packet header sequence to the front end of the audio data;

[0043] a first determining unit, configured to determine the encoding type of each data bit in the audio 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;

[0044] a second determining unit, configured to determine a coding polarity of each data bit based on the coding sequence of each data bit, and determine a sequence polarity of the packet coding sequence based on the coding polarity of each data bit;

[0045] A second adding unit is used to add a preset packet end sequence to the end of the packet coding sequence, and based on the sequence polarity of the packet coding sequence, add a balancing sequence at the end of the packet end sequence to ensure the level balance of the packet coding sequence, so as to complete the encoding processing of the audio data.

[0046] In the above apparatus, optionally, the first determining unit, when used to determine the encoding type of each data bit in the audio data one by one, specifically includes:

[0047] Reading each data bit in the audio data one by one, and using the read data bit as the current data bit;

[0048] Get the value and position information of the current data bit;

[0049] determining whether the current data bit is a starting data bit of the audio data based on the position information;

[0050] If it is determined that the current data bit is the starting data bit of the audio data, determining the encoding type of the current data bit based on the value of the current data bit;

[0051] If it is determined that the current data bit is not the starting data bit of the audio data, determining whether the current data bit is flipped;

[0052] If it is determined that the current data bit has not been flipped, determining that the encoding type of the current data bit is the first type;

[0053] 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.

[0054] In the above-mentioned apparatus, optionally, the first determining unit is configured to determine the encoding type of the current data bit based on the value of the current data bit, specifically including:

[0055] Determine whether the value of the current data bit is 1;

[0056] If it is determined that the value of the current data bit is 1, then determining that the encoding type of the current data bit is the second type;

[0057] 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.

[0058] In the above device, optionally, the first determining unit is configured to determine whether the current data bit is flipped, specifically comprising:

[0059] Obtaining a value of a data bit preceding the current data bit;

[0060] Determining whether the value of the current data bit is consistent with the value of the data bit before the current data bit;

[0061] If the value of the current data bit is inconsistent with the value of the data bit before the current data bit, it is determined that the current data bit is flipped;

[0062] If the value of the current data bit is consistent with the value of the data bit before the current data bit, it is determined that the current data bit does not flip.

[0063] In the above-mentioned apparatus, optionally, the first determining unit is configured to convert the numerical value in each data bit into a coding sequence corresponding to its coding type, specifically including:

[0064] 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 the second type, the value of the data bit is converted into a positive polarity encoding 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 into a negative polarity encoding sequence.

[0065] Optionally, in the above-mentioned apparatus, the second determining unit is configured to determine the coding polarity of each data bit based on the coding sequence of each data bit, specifically including:

[0066] For each of the data bits, 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 sequence, the coding polarity of the data bit is determined to be positive polarity; when the coding sequence of the data bit is a negative polarity coding sequence, the coding polarity of the data bit is determined to be negative polarity.

[0067] Optionally, in the above-mentioned apparatus, the second determining unit is configured to determine the sequence polarity of the packet coding sequence based on the coding polarity of each data bit, specifically including:

[0068] determining a first number of data bits encoded with a positive polarity, and determining a second number of data bits encoded with a negative polarity;

[0069] determining whether the first quantity is equal to the second quantity;

[0070] If the first number is equal to the second number, determining that the sequence polarity of the packet encoding sequence is zero polarity;

[0071] If the first number is not equal to the second number, determining whether the first number is greater than the second number;

[0072] If the first number is greater than the second number, determining that the sequence polarity of the packet encoding sequence is positive;

[0073] If the first number is smaller than the second number, the sequence polarity of the packet encoding sequence is determined to be negative.

[0074] A third aspect of the present invention discloses a storage medium, which includes stored instructions, wherein when the instructions are executed, the device where the storage medium is located is controlled to execute the audio data processing method described above.

[0075] 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 be executed by one or more processors to perform the data processing method described above.

[0076] Compared with the prior art, the present invention has the following advantages:

[0077] The present invention provides an audio data processing method and device, a storage medium, and an electronic device. The method comprises: obtaining audio data to be processed; adding a packet header sequence to the front end of the audio data; determining the encoding type of each data bit in the audio data one by one, and converting the value in each data bit into a code sequence corresponding to its encoding type to obtain a packet encoding sequence of the audio data; determining the encoding polarity of each data bit based on the encoding sequence of each data bit, and determining the sequence polarity of the packet encoding sequence based on the encoding polarity of each data bit; adding a packet end sequence to the end of the packet encoding sequence, and adding a level balancing sequence to the end of the packet end sequence based on the sequence polarity of the packet encoding sequence to ensure level balance of the packet encoding sequence, thereby completing the encoding process of the audio data. In the process of encoding the audio data, based on the encoding type of the data bit, the value of the data bit can be directly converted into a code sequence corresponding to the encoding type, thereby simplifying and speeding the encoding process of the data bit, thereby improving encoding efficiency. The level balancing sequence is added to the end of the packet encoding sequence of the audio data, and the level balancing sequence is used to ensure that the packet encoding sequence is in zero polarity to ensure that the packet encoding sequence achieves DC balance, thereby improving encoding efficiency while ensuring encoding quality. BRIEF DESCRIPTION OF THE DRAWINGS

[0078] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are merely embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.

[0079] Figure 1 This is an example diagram of encoding using the HDMI eARC protocol;

[0080] Figure 2 FIG1 is another example diagram of encoding using the HDMI eARC protocol;

[0081] Figure 3 A flowchart of an audio data processing method provided by an embodiment of the present invention;

[0082] Figure 4 An example diagram of IDLE data encoding provided by an embodiment of the present invention;

[0083] Figure 5 An example diagram of a packet sending timing provided by an embodiment of the present invention;

[0084] Figure 6 A flow chart of a method for determining the encoding polarity of a data bit provided by an embodiment of the present invention;

[0085] Figure 7 A flow chart of a method for determining the sequence polarity of a packet coding sequence provided by an embodiment of the present invention;

[0086] Figure 8 A structural definition diagram of a data packet provided by an embodiment of the present invention;

[0087] Figure 9 An example diagram of encoding of a packet header sequence and a packet end sequence provided in an embodiment of the present invention;

[0088] Figure 10 An example diagram of encoding of valid data of a data packet provided by an embodiment of the present invention;

[0089] Figure 11 A schematic structural diagram of an audio data processing device provided by an embodiment of the present invention;

[0090] Figure 12 A schematic structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0091] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0092] In this application, the terms "comprises," "comprising," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus that includes a list of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not preclude the presence of additional identical elements in the process, method, article, or apparatus that includes the element.

[0093] Currently, when encoding audio data, the HDMI eARC protocol is usually used to encode the audio data. Figure 1 , is an example diagram of encoding using the HDMI eARC protocol. The HDMI eARC protocol defines a method of using a combination of biphase-mark code and falling-edge modulation to complete encoding, refer to Figure 2, is another example diagram for encoding using HDMI eARC. When encoding audio data in HDMI eARC, Biphase-Mark encoding is first performed with an efficiency of 1 / 2; then Falling-edge modulation encoding is performed with an efficiency of 1 / 3. The final encoding efficiency is 1 / 6. Although the HDMI eARC protocol can maintain DC balance and clock recovery at the same time when encoding audio data, the encoding efficiency is low.

[0094] The present invention provides an audio data processing method for improving the efficiency of audio data encoding. The present invention can be used in data encoding systems, which can be implemented in a variety of general-purpose or specialized computing device environments or configurations. Examples include personal computers, server computers, handheld or portable devices, tablet devices, multi-processor devices, and distributed computing environments including any of the above. The present invention can be implemented by a processor or server in the data encoding system.

[0095] Reference Figure 3 , is a flow chart of a method for processing audio data provided by an embodiment of the present invention, and is specifically described as follows:

[0096] S101: Acquire audio data to be processed.

[0097] When an audio data sending command is received, the audio data sending instruction is parsed to obtain the audio data to be processed in the audio data sending instruction, where the audio data to be processed includes valid audio data that needs to be sent to the receiving end.

[0098] It should be noted that after the system starts working, it will continue to send IDEL data before receiving the audio data sending command. Each bit of the IDEL data will be converted into a fixed coding sequence, which is "1100". The coding diagram of IDEL data can be referred to Figure 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.

[0099] After receiving the audio data sending command, the system needs to send the received audio data. Before sending the audio data, the audio data needs to be encoded to obtain a data packet corresponding to the audio data. Before sending the data packet, the system's packet sending timing is as follows: Figure 5 As shown, the system receives an audio data sending command during the process of sending IDEL data, and can send the data packet obtained after encoding the audio data before continuing to send IDEL data. It should be noted that Figure 5 The data packet shown in is a data packet obtained after encoding the audio data. The process of encoding the audio data can refer to the process from S102 to S105.

[0100] S102: Add a preset packet header sequence to the front end of the audio data.

[0101] The packet header sequence (PREAMBLE) is used as a start identifier for valid data in the audio data. The packet header sequence can be used to indicate the start of the audio data. The valid data in the audio data includes but is not limited to the device address, register address, read and write enable, ECC, register value to be transmitted, and CRC, etc. The audio data contains multiple data bits. The number of data bits of different valid data is different. The data bit can be understood as a bit.

[0102] The packet header sequence is a preset fixed sequence. When the packet header sequence is sent to a receiving end, the receiving end decodes it and regards it as ordinary packet data.

[0103] S103 : Determine the coding type of each data bit in the audio data one by one, and convert the value in each data bit into a coding sequence corresponding to its coding type, to obtain a packet coding sequence of the audio data.

[0104] 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.

[0105] When determining the encoding type, it can be determined based on the value and position information of the data bits.

[0106] Reference Figure 6 , which is a flow chart of a method for determining the encoding type of a data bit provided by the present invention, is specifically described as follows:

[0107] S201 , reading each data bit in the audio data one by one, and using the read data bit as the current data bit.

[0108] Audio data contains multiple data bits, and each data bit needs to be processed one by one.

[0109] Each data bit in the audio data is read one by one, and the read data bit is used as the current data bit.

[0110] S202: Obtain the value and position information of the current data bit.

[0111] It should be noted that the value of each data bit in the audio data is a binary value, that is, the value of each data bit is either 1 or 0; the position information includes but is not limited to the sorting information of the current data bit in the audio data and the value of the data bit before the current data bit, where, if the data bit is the first data bit in the audio data, the value of the data bit before the current data bit in the position information of the data bit is empty.

[0112] S203. Determine whether the current data bit is the starting data bit of the audio data based on the position information; if it is determined that the current data is not the starting data bit of the audio data, execute S204; if it is determined that the current data bit is the starting data bit of the audio data, execute S206.

[0113] 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 is flipped, execute S206.

[0114] To determine whether the current data bit is flipped, it is necessary to determine based on the value of the current data bit and the value of the previous data bit. The specific process is as follows:

[0115] Obtaining a value of a data bit preceding the current data bit;

[0116] Determining whether the value of the current data bit is consistent with the value of the data bit before the current data bit;

[0117] If the value of the current data bit is inconsistent with the value of the data bit before the current data bit, it is determined that the current data bit is flipped;

[0118] If the value of the current data bit is consistent with the value of the data bit before the current data bit, it is determined that the current data bit does not flip.

[0119] It should be noted that the value of the data bit before the current data bit can be determined from the position information of the current data bit.

[0120] It should be noted that when the value of the current data bit is different from the value of the data bit before the current data bit, it can be determined that the current data bit has been flipped. There are two cases of flipping: one is a 0-1 flip, in which case 0 is the value of the data bit before the current data bit, and 1 is the value of the current data bit; the other is a 1-0 flip, in which case 1 is the value of the data bit before the current data bit, and 0 is the value of the current data bit.

[0121] S205: Determine that the encoding type of the current data bit is the first type.

[0122] 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.

[0123] S207: Determine that the encoding type of the current data bit is the second type.

[0124] 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.

[0125] In the method provided by the embodiment of the present invention, steps S206 to S208 are specific processes for determining the encoding type of the current data bit based on the value of the current data bit.

[0126] After determining the encoding type of the current data bit, the value of the current data bit can be converted into a coding sequence corresponding to its encoding type according to the encoding type of the current data bit, as described below:

[0127] When the encoding type of the current data bit is the first type, the value of the current data bit is converted into a zero polarity encoding sequence corresponding to the first type; when the encoding type of the current data bit is the second type, the value of the current data bit is converted into a positive polarity encoding sequence corresponding to the second type; when the encoding type of the current data bit is the third type, the value of the current data bit is converted into a negative polarity encoding sequence.

[0128] It should be noted that the above-mentioned method of converting the numerical value of the current data bit into a coding sequence can be applied to all data bits in the audio data. Furthermore, different coding types correspond to different coding sequences. 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.

[0129] It should be noted that the positive polarity coding sequence, the negative polarity coding sequence and the zero polarity coding sequence are all composed of binary values, and the binary values ​​in different types of coding sequences are different; for example, the positive polarity coding sequence is "1110", the negative polarity coding sequence is "1000", and the zero polarity coding sequence is "1100".

[0130] S104 : Determine the encoding polarity of each data bit based on the encoding sequence of each data bit, and determine the sequence polarity of the packet encoding sequence based on the encoding polarity of each data bit.

[0131] In the method provided by an 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, specifically: 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 sequence, the coding polarity of the data bit is determined to be positive polarity; when the coding sequence of the data bit is a negative polarity coding sequence, the coding polarity of the data bit is determined to be negative polarity.

[0132] In the method provided by the embodiment of the present invention, after determining the encoding polarity of each data bit, the sequence polarity of the packet encoding sequence can be determined based on the encoding polarity of each data bit; the sequence polarity of the packet encoding sequence is determined to determine whether the packet encoding sequence has achieved DC balance. The sequence polarity is the same as the encoding polarity and is divided into three types: one is positive polarity, one is negative polarity, and the other is zero polarity.

[0133] Reference Figure 7 , which is a flow chart of a method for determining the sequence polarity of a packet coding sequence provided by an embodiment of the present invention, is specifically described as follows:

[0134] S301 : Determine a first number of data bits whose coding polarity is positive, and determine a second number of data bits whose coding polarity is negative.

[0135] Statistics are performed on the coding polarity of each data bit in the audio data to determine a first number of data bits with positive coding polarity and a second number of data bits with negative coding polarity. Furthermore, a third number of data bits with zero coding polarity can also be determined.

[0136] 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, execute S303; if it is determined that the first quantity is not equal to the second quantity, execute S304.

[0137] The first quantity is compared with the second quantity to determine whether the first quantity is equal to the second quantity.

[0138] S303: Determine that the sequence polarity of the packet coding sequence is zero polarity.

[0139] When it is determined that the first number is equal to the second number, it indicates that the number of data bits with positive coding polarity is equal to the number of data bits with negative coding polarity. Thus, it can be determined that the sequence polarity of the packet coding sequence is zero polarity, and it can also be determined that the packet coding sequence has achieved DC balance.

[0140] 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.

[0141] When the first number is not equal to the second number, it is determined whether the first number is greater than the second number.

[0142] S305: Determine that the sequence polarity of the packet encoding sequence is positive.

[0143] When the first number is greater than the second number, it means that the number of data bits with positive coding polarity is greater than the number of data bits with negative coding polarity. Therefore, it can be determined that the sequence polarity of the packet coding sequence is positive. At this time, the packet coding sequence has not achieved DC balance. At this time, the packet coding sequence needs to be supplemented with negative polarity coding to achieve DC balance.

[0144] S306: Determine that the sequence polarity of the packet encoding sequence is negative.

[0145] When the first number is not greater than the second number, that is, when it is determined that the first number is less than the second number, it indicates that the number of data bits with negative coding polarity is greater than the number of data bits with positive coding polarity. 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 achieved DC balance. At this time, the packet coding sequence needs to be supplemented with positive polarity coding to achieve DC balance.

[0146] S105: Add a preset 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 the end of the packet end sequence to ensure the level balance of the packet coding sequence, so as to complete the encoding process of the audio data.

[0147] The End of Packet (EOP) sequence is added at the end of the packet encoding sequence to indicate the end of the valid audio data. The EOP is a fixed sequence and is treated as ordinary packet data during decoding. The EOP meets DC balance.

[0148] In order to ensure that the packet coding sequence achieves DC balance, the present invention also supplements the packet coding sequence with a level balancing sequence, wherein the level balancing sequence is added according to the sequence polarity of the packet coding sequence, and the content of the level balancing sequence corresponding to different sequence polarities is different. For example, when the sequence polarity is negative, the supplemented level balancing sequence should be a coding sequence with positive polarity, so the level balancing sequence at this time can be specifically "1110"; when the sequence polarity is positive, the supplemented level balancing sequence should be a coding sequence with negative polarity, so the level balancing sequence at this time can be specifically "1000"; when the sequence polarity is zero polarity, the supplemented level balancing sequence should be a coding sequence with zero polarity, so the level balancing sequence at this time can be specifically "1100".

[0149] The level balancing sequence is added at the end of the packet end sequence, thereby enabling the packet coding sequence to reach zero polarity, thereby achieving DC balance of the packet coding sequence.

[0150] In the method provided by an embodiment of the present invention, audio data to be processed is obtained; a preset packet header sequence is added to the front end of the audio data; the encoding type of each data bit in the audio data is determined one by one, and the value in each data bit is converted into a coding sequence corresponding to its encoding type to obtain a packet coding sequence of the audio data; based on the coding sequence of each data bit, the encoding polarity of each data bit is determined, and the sequence polarity of the packet coding sequence is determined based on the encoding polarity of each data bit; a packet end sequence is added to the end of the packet coding sequence, and based on the sequence polarity of the packet coding sequence, a level balancing sequence for ensuring the level balance of the packet coding sequence is added to the end of the packet end sequence to complete the encoding processing of the audio data. In the process of encoding the audio data, based on the encoding type of the data bit, the value of the data bit can be directly converted into the coding 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 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 the encoding efficiency while ensuring the encoding quality.

[0151] After the audio data is encoded, a data packet corresponding to the audio data is obtained. In order to vividly 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. Figure 8 As shown in the figure, the packet valid data represents the valid data in the data packet, which can also be understood as the packet encoding sequence mentioned above. The PREAMBLE in the figure represents the added 8-bit packet header sequence. The packet valid data 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 has different bits; the EOP in the figure is the added packet end sequence, and the dc_biase_bit is the added 1-bit level balance sequence (4 bits after encoding).

[0152] Reference Figure 9 , is a schematic diagram of the coding of the packet header sequence (PREAMBLE) and EOP provided in an embodiment of the present invention. The packet header sequence and EOP are both fixed coding sequences. The specific coding of the packet header sequence and EOP can be as follows Figure 9 The encoding is shown in .

[0153] Reference Figure 10, is an example diagram of encoding valid data in audio data provided by an embodiment of the present invention. As shown in the figure, the value of the first data bit of the audio data is 0, and it can be determined that the encoding type of the first data bit is the third type. Therefore, encoding the first data bit as a value can obtain "1000". The values ​​of the second data bit to the fourth data bit are all equal to the value of the first data bit. Therefore, it can be determined that the encoding types of the second data bit to the fourth data bit are all the first type. Therefore, the codes of the second data bit to the fourth data bit are all "1100". The value of the fifth data bit is flipped, and the flipping 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 values ​​of the sixth and seventh data bits are equal to the value of the fifth data bit, therefore, the encoding types of the sixth and seventh data bits are both the first type, so the encodings of the sixth and seventh data bits are both "1100"; the value of the eighth data bit is flipped, and the flipping 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".

[0154] Here is a further explanation of how the valid data of the audio data is encoded:

[0155] 1. If the first bit of the valid data of the audio data is 1, it is encoded as 1110; if the first bit is 0, it is encoded as 1000;

[0156] 2. When the data bit undergoes a 0-1 conversion, the corresponding data bit code is 1110; when the data bit undergoes a 1-0 conversion, the corresponding data bit code is 1000; when no data conversion occurs, the data bit code is 1100;

[0157] 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), and each 1-0 transition will introduce a negative polarity (the number of 1s in '1000' is two less than 0). Because it is impossible to have two consecutive 0-1 flips or 1-0 flips, and 0-1 flips and 1-0 flips always alternate, at the end of the encoding of the audio data, the difference between the positive and negative polarities can only be -1 ('1000' has one more than '1110', and the sequence polarity of the data packet encoding sequence is negative), 0 (the number of '1110' and '1000' is the same, and the sequence polarity of the data packet encoding sequence is zero polarity), 1 ('1110' has one more than '1000', and the polarity of the data packet encoding sequence is positive). Therefore, in the audio data A corresponding dc_biase_bit (level balancing sequence) is added to the end of the packet coding sequence to ensure that the polarity of the entire packet coding sequence is zero polarity; specifically, if the difference between the positive and negative poles is -1, the sequence polarity of the packet coding sequence is negative, and the added level balancing sequence is "1110"; if the difference between the positive and negative poles is 0, the sequence polarity of the packet coding sequence is zero polarity, and the added level balancing sequence is "1100"; if the difference between the positive and negative poles is 1, the sequence polarity of the packet coding sequence is positive, and the added level balancing sequence is "1000".

[0158] From the above content, it can be seen that each data bit is encoded into a 4-bit coding sequence, and the overall coding efficiency is close to 1 / 4. Compared with the encoding method using the HDMI eARC protocol in the prior art, it has higher coding efficiency. In addition, in addition to having the advantages of achieving DC balance and containing clock information, the present invention also has the advantage of adjacent duty ratios being closer to 1:1.

[0159] Furthermore, when the audio data is encoded using the audio data processing method provided by the present invention, when the receiving end receives the corresponding data stream, it can use the decoding method corresponding to the audio data processing method provided by the present invention to perform a decoding operation, thereby obtaining valid data in the data packet.

[0160] and Figure 3 Corresponding to the method shown in FIG, an embodiment of the present invention provides an audio data processing device, which can be applied to a system that can perform encoding, and is used to support Figure 3 The method shown in the figure is applied in real life. The schematic diagram of the device is shown in Figure 11 The specific instructions are as follows:

[0161] The acquisition unit 401 is used to acquire the audio data to be processed:

[0162] A first adding unit 402 is configured to add a preset packet header sequence to the front end of the audio data;

[0163] A first determining unit 403 is configured to determine the encoding type of each data bit in the audio data one by one, and convert the value in each data bit into a coding sequence corresponding to its coding type to obtain a packet coding sequence of the audio data;

[0164] a second determining unit 404, configured to determine a coding polarity of each data bit based on the coding sequence of each data bit, and determine a sequence polarity of the packet coding sequence based on the coding polarity of each data bit;

[0165] The second adding unit 405 is used to add a preset 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 balancing sequence to the end of the packet end sequence to ensure the level balance of the packet coding sequence, so as to complete the encoding processing of the audio data.

[0166] In the apparatus provided by an embodiment of the present invention, audio data to be processed is obtained; a preset packet header sequence is added to the front end of the audio data; the encoding type of each data bit in the audio data is determined one by one, and the value in each data bit is converted into a coding sequence corresponding to its encoding type to obtain a packet coding sequence of the audio data; the encoding polarity of each data bit is determined based on the coding sequence of each data bit, and the sequence polarity of the packet coding sequence is determined based on the coding polarity of each data bit; a packet end sequence is added to the end of the packet coding sequence, and based on the sequence polarity of the packet coding sequence, a level balancing sequence is added to the end of the packet end sequence to ensure level balance of the packet coding sequence, thereby completing the encoding process of the audio data. In the process of encoding the audio data, based on the encoding type of the data bit, the value of the data bit can be directly converted into a coding sequence corresponding to the encoding type, the encoding process of the data bit is simple and fast, thereby improving the encoding efficiency, and the level balancing sequence is added after the packet coding sequence, the level balancing sequence is used to ensure that the packet coding sequence is in zero polarity to ensure that the packet coding sequence achieves DC balance, thereby improving the encoding efficiency while ensuring the encoding quality.

[0167] In the apparatus provided by an embodiment of the present invention, the first determining unit 403 is configured to determine the encoding type of each data bit in the audio data one by one, specifically including:

[0168] Reading each data bit in the audio data one by one, and using the read data bit as the current data bit;

[0169] Get the value and position information of the current data bit;

[0170] determining whether the current data bit is a starting data bit of the audio data based on the position information;

[0171] If it is determined that the current data bit is the starting data bit of the audio data, determining the encoding type of the current data bit based on the value of the current data bit;

[0172] If it is determined that the current data bit is not the starting data bit of the audio data, determining whether the current data bit is flipped;

[0173] If it is determined that the current data bit has not been flipped, determining that the encoding type of the current data bit is the first type;

[0174] 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.

[0175] In the apparatus provided by an embodiment of the present invention, the first determining unit 403 is configured to determine the encoding type of the current data bit based on the value of the current data bit, specifically including:

[0176] Determine whether the value of the current data bit is 1;

[0177] If it is determined that the value of the current data bit is 1, then determining that the encoding type of the current data bit is the second type;

[0178] 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.

[0179] In the apparatus provided by the embodiment of the present invention, the first determining unit 403 is configured to determine whether the current data bit is flipped, specifically including:

[0180] Obtaining a value of a data bit preceding the current data bit;

[0181] Determining whether the value of the current data bit is consistent with the value of the data bit before the current data bit;

[0182] If the value of the current data bit is inconsistent with the value of the data bit before the current data bit, it is determined that the current data bit is flipped;

[0183] If the value of the current data bit is consistent with the value of the data bit before the current data bit, it is determined that the current data bit does not flip.

[0184] In the apparatus provided by an embodiment of the present invention, the first determining unit 403 is configured to convert the numerical value in each data bit into a coding sequence corresponding to its coding type, specifically including:

[0185] 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 the second type, the value of the data bit is converted into a positive polarity encoding 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 into a negative polarity encoding sequence.

[0186] In the apparatus provided by an embodiment of the present invention, 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, specifically including:

[0187] For each of the data bits, 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 sequence, the coding polarity of the data bit is determined to be positive polarity; when the coding sequence of the data bit is a negative polarity coding sequence, the coding polarity of the data bit is determined to be negative polarity.

[0188] In the apparatus provided by an embodiment of the present invention, the second determining unit 404, when configured to determine the sequence polarity of the packet coding sequence based on the coding polarity of each data bit, specifically includes:

[0189] determining a first number of data bits encoded with a positive polarity, and determining a second number of data bits encoded with a negative polarity;

[0190] determining whether the first quantity is equal to the second quantity;

[0191] If the first number is equal to the second number, determining that the sequence polarity of the packet encoding sequence is zero polarity;

[0192] If the first number is not equal to the second number, determining whether the first number is greater than the second number;

[0193] If the first number is greater than the second number, determining that the sequence polarity of the packet encoding sequence is positive;

[0194] If the first number is smaller than the second number, the sequence polarity of the packet encoding sequence is determined to be negative.

[0195] An embodiment of the present invention further provides a storage medium, which includes stored instructions, wherein when the instructions are executed, the device where the storage medium is located is controlled to execute the above-mentioned data processing method.

[0196] The embodiment of the present invention further provides an electronic device, the structural diagram of which is shown in FIG. Figure 12 As shown, it specifically includes a memory 501 and one or more instructions 502, wherein the one or more instructions 502 are stored in the memory 501 and are configured to be executed by one or more processors 503 to perform the above-mentioned data processing method.

[0197] The specific implementation processes and derivative methods of the above embodiments are all within the protection scope of the present invention.

[0198] Each embodiment in this specification is described in a progressive manner. The same or similar parts between the embodiments can be referred to each other. Each embodiment focuses on the differences from other embodiments. In particular, for system or system embodiments, since they are basically similar to method embodiments, the description is relatively simple. For relevant parts, refer to the partial description of the method embodiment. The system and system embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. A person of ordinary skill in the art can understand and implement it without expending creative work.

[0199] Professionals may further appreciate 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 interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present invention.

[0200] The above description of the disclosed embodiments is intended to enable one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be readily apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention is not limited to the embodiments shown herein but is intended to conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for processing audio data, characterized in that: include: Get the audio data to be processed: Adding a preset packet header sequence to the front end of the audio data; Determining the encoding type of each data bit in the audio data one by one, and converting the value in each data bit into a code sequence corresponding to its encoding type, to obtain a packet code sequence of the audio data; Determining a coding polarity of each data bit based on the coding sequence of each data bit, and determining a 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 coding sequence, and adding a level balancing sequence for ensuring level balance of the packet coding sequence to the end of the packet end sequence based on the sequence polarity of the packet coding sequence, so as to complete the encoding process of the audio data; Determining the encoding type of each data bit in the audio data one by one includes: Reading each data bit in the audio data one by one, and using 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 a starting data bit of the audio data based on the position information; If it is determined that the current data bit is the starting data bit of the audio data, determining the encoding type of the current data bit based on the value of the current data bit; If it is determined that the current data bit is not the starting data bit of the audio data, determining whether the current data bit is flipped; If it is determined that the current data bit has not been flipped, determining that the encoding type of the current data bit is the first type; If the current data bit is flipped, determining the encoding type of the current data bit based on the value of the current data bit; The determining, based on the value of the current data bit, the encoding type of the current data bit includes: 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, then determining that the encoding type of the current data bit is the second type; 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.

2. The method according to claim 1, characterized in that The determining whether the current data bit is flipped includes: Obtaining a value of a data bit preceding the current data bit; Determining whether the value of the current data bit is consistent with the value of the data bit before the current data bit; If the value of the current data bit is inconsistent with the value of the data bit before 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 data bit before the current data bit, it is determined that the current data bit does not flip.

3. The method according to claim 1, characterized in that The step of converting the value of each data bit into a coding sequence corresponding to its coding type 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 the second type, the value of the data bit is converted into a positive polarity encoding 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 into a negative polarity encoding sequence.

4. The method according to claim 3, characterized in that The determining of the encoding polarity of each data bit based on the encoding sequence of each data bit includes: For each of the data bits, 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 sequence, the coding polarity of the data bit is determined to be positive polarity; when the coding sequence of the data bit is a negative polarity coding sequence, the coding polarity of the data bit is determined to be negative polarity.

5. The method according to claim 4, characterized in that The determining of the sequence polarity of the packet coding sequence based on the coding polarity of each data bit includes: determining a first number of data bits encoded with a positive polarity, and determining a second number of data bits encoded with a negative polarity; 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 encoding sequence is zero polarity; If the first number is not equal to the second number, determining whether the first number is greater than the second number; 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, the sequence polarity of the packet encoding sequence is determined to be negative.

6. An audio data processing device, characterized in that: include: The acquisition unit is used to obtain the audio data to be processed: A first adding unit, configured to add a preset packet header sequence to the front end of the audio data; a first determining unit, configured to determine the encoding type of each data bit in the audio 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 audio data; a second determining unit, configured to determine a coding polarity of each data bit based on the coding sequence of each data bit, and determine a 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 coding sequence, and based on the sequence polarity of the packet coding sequence, add a balancing sequence for ensuring level balance of the packet coding sequence to the end of the packet end sequence, so as to complete the encoding processing of the audio data; The first determining unit, when used to determine the encoding type of each data bit in the audio data one by one, specifically includes: Reading each data bit in the audio data one by one, and using 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 a starting data bit of the audio data based on the position information; If it is determined that the current data bit is the starting data bit of the audio data, determining the encoding type of the current data bit based on the value of the current data bit; If it is determined that the current data bit is not the starting data bit of the audio data, determining whether the current data bit is flipped; If it is determined that the current data bit has not been flipped, determining that the encoding type of the current data bit is the first type; If the current data bit is flipped, determining the encoding type of the current data bit based on the value of the current data bit; The first determining unit, configured to determine the encoding type of the current data bit based on the value of the current data bit, specifically includes: 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, then determining that the encoding type of the current data bit is the second type; 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.

7. A storage medium, characterized in that: The storage medium includes stored instructions, wherein when the instructions are executed, the device where the storage medium is located is controlled to execute the audio data processing method according to any one of claims 1 to 5.

8. An electronic device, characterized in that: The system comprises a memory and one or more instructions, wherein the one or more instructions are stored in the memory and configured to execute the audio data processing method according to any one of claims 1 to 5 by one or more processors.

Citation Information

Patent Citations

  • Data and forward error control coding techniques for digital signals

    CN1049580A

  • 9B / 10B encoding and decoding methods

    CN112838868A