Hybrid coding method and decoding method based on IIS bus and Bluetooth earphone

Through the hybrid encoding method based on IIS bus, lossless compression is performed using the slow change of audio data and channel correlation characteristics, which solves the problem of low utilization rate of IIS bus, and realizes efficient and simultaneous transmission of audio data and user data, improving the bus utilization efficiency and adaptability of transmission rate.

CN120472916APending Publication Date: 2025-08-12SHENZHEN BLUETRUM TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510363293.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-26
Publication Date
2025-08-12

AI Technical Summary

Technical Problem

In the prior art, the utilization rate of the IIS bus is low when there is no audio data transmission, and the audio data is in the PCM format, resulting in a large bandwidth requirement, and there is a lack of a solution to improve utilization.

Method used

Through the mixed encoding method based on the IIS bus, the slow change of audio data and channel correlation characteristics are used to perform lossless compression, the transmission rate of user data is dynamically adjusted, and the mixed encoding is formed by combining compressed encoding and identification code to realize the simultaneous transmission of audio data and user data.

Benefits of technology

The utilization efficiency of the IIS bus is improved, lossless compression of audio data and adaptive transmission of user data are realized, and the advantages of low latency and adaptive transmission code rate are achieved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120472916A_ABST
    Figure CN120472916A_ABST
Patent Text Reader

Abstract

The invention discloses a hybrid coding method based on an IIS bus. The method comprises the following steps: acquiring first audio data, second audio data and non-audio data; the difference between the first PCM data in the first audio data and the second PCM data in the second audio data is halved, and a first boundary value is obtained; when the superposition number of continuous code elements from the first bit in the first boundary value is not less than a first preset threshold value; carrying out compression and obtaining a first compression code with a first compression code length; subtracting the first compression coding length from the preset mixed coding total length and then subtracting the first median coding length to obtain a first mixed code length of non-audio data coding; and forming a first hybrid code according to the first compressed code, the first median code and the non-audio data code. The audio data is compressed under the condition that the quality of the audio data is ensured to be lossless, and the utilization rate of the IIS bus is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of speech recognition, and in particular to a hybrid encoding method, a decoding method and a Bluetooth headset based on an IIS bus. Background Art

[0002] IIS, a commonly used data bus between chips, is usually used to transmit audio data between master and slave devices. In the bus design of IIS, a common usage method is to complete the audio data transmission from the host to the slave in a three-wire manner. The IIS bus requires at least three IO connections between the master and slave chips. In general scenarios, when there is no need to transmit music between the master and slave devices, the IIS bus will be idle and its actual utilization rate will be low. This is a waste of hardware resources for chips with limited IO resources. In addition, the data transmitted on the IIS bus is generally in PCM format. This audio format has a high sound quality and also has a large bandwidth requirement.

[0003] While ensuring the quality of audio data on the IIS bus, compressing the audio data losslessly, and sending non-audio data streams, the prior art lacks a solution for improving the utilization of the IIS bus. Summary of the Invention

[0004] Based on the above situation, the present invention proposes a hybrid encoding method based on the IIS bus, which can achieve lossless compression of audio data and adaptive transmission bit rate of user data. The audio stream data transmitted on the IIS bus is dual-channel PCM data. The audio PCM data is compressed based on the audio data's characteristics of "slowly varying" and "correlation between left and right channels." The "slowly varying" characteristic manifests itself in a small difference in PCM values between consecutive samples, while the "correlation between left and right channels" characteristic manifests itself in a small difference in PCM values between simultaneous left and right channel samples. Based on these characteristics, lossless compression is performed on the audio data at the transmitter. For a sample unit in the audio stream after preliminary compression, its actual length after compression varies dynamically based on the state of the audio stream. Compared to the original audio sample data, the length of the compressed audio sample data is statistically smaller. The dynamic data bandwidth obtained by compression is used to extract data content of corresponding length from the user data stream. This data content is combined with the compressed audio content to form a data packet transmitted on the IIS bus. This data packet can be used to restore the audio data stream with a constant bit rate and the user data stream with a variable bit rate.

[0005] The present invention provides a hybrid coding method based on the IIS bus, which obtains first audio data, second audio data and non-audio data; takes the difference of first PCM data of the first data length in the first audio data and second PCM data of the first data length in the second audio data and takes half of it to obtain a first edge value; determines whether the number of consecutive code elements superimposed from the first position in the first edge value is greater than or equal to a first preset threshold; if so, compresses and obtains a first compressed code of a first compressed code length; subtracts the first compressed code length from the predetermined total length of the hybrid code and then subtracts the first median code length to obtain a first mixed code length for the non-audio data code; and forms a first hybrid code based on the first compressed code, the first median code and the non-audio data code of the first mixed code length; the first median code is a code obtained by taking half of the sum of the first PCM data and the second PCM data, the first median code length is a code length obtained by taking half of the sum of the first PCM data and the second PCM data, and is equal to the first data length, and the first compressed code includes a compressed edge value code and a first compressed identification code, and the first compressed identification code is at the head or tail of the first compressed code.

[0006] When it is determined that the number of consecutive code elements superimposed from the first position in the first edge value is less than the first preset threshold, no compression is performed, and the predetermined total mixed code length is subtracted from the first data length subtracted from the length of the second compression identification code and then subtracted from the first median code length to obtain the second mixed code length of the non-audio data code, and the second mixed code is composed of the first edge value code, the second compression identification code, the first median code and the non-audio data code of the second mixed code length; the second compression identification code is at the head or tail of the second compression code.

[0007] The present invention provides a decoding method based on the IIS bus, which is applied to the decoding of the above-mentioned encoding method, and determines that the data obtained is a first mixed code through a first compression identification code; obtains a first compression code, a first median code and a non-audio data code of a first mixed code length through decoding; the first compression code is decoded according to a first preset threshold or the first compression identification code to obtain a first edge value code; the first edge value code and the first median code are added to obtain first PCM data of a first data length; the first edge value code and the first median code are subtracted to obtain second PCM data of a second data length.

[0008] The data obtained by determining through the second compression identification code is the second mixed code; through decoding, the first edge value code, the second compression identification code, the first median code and the non-audio data code of the second mixed code length are respectively obtained; the first edge value code and the first median code are added to obtain the first PCM data of the first data length; the first edge value code and the first median code are subtracted to obtain the second PCM data of the second data length.

[0009] Some technical benefits of this disclosure include: This method enables simultaneous transmission of lossless audio data and user data over the IIS, improving the efficiency of the IIS bus. This method can automatically adjust the user data transmission rate based on the audio content. When the dual-channel music data is identical or the dynamic range of the music is small, the transmission rate of the non-audio data is dynamically increased. This method offers advantages such as adaptive transmission bitrate, lossless audio, and low-latency encoding. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] To better understand the technical solutions of this disclosure, please refer to the following drawings, which are used to assist in explaining the prior art or embodiments. These drawings selectively illustrate the products or methods involved in the prior art or some embodiments of this disclosure. The basic information of these drawings is as follows:

[0011] Figure 1 It is a logical framework diagram of a hybrid encoding-transmission-decoding overall process method based on IIS bus of the present invention;

[0012] Figure 2 This is a system framework diagram of a hybrid encoding-transmission-decoding overall process method based on IIS bus of the present invention.

[0013] Figure 3 It is a transmission status diagram of the coded frame of the present invention on the IIS bus.

[0014] Figure 4 This is an overall flow chart of a hybrid encoding method based on IIS bus of the present invention.

[0015] Figure 5 This is a data structure diagram of the first hybrid coding of the present invention. DETAILED DESCRIPTION

[0016] The following will further describe the technical means or technical effects involved in this disclosure. Obviously, the embodiments provided are only some of the embodiments of this disclosure, and not all of them. Based on the embodiments and the explicit or implicit descriptions in the figures and texts in this disclosure, all other embodiments that can be obtained by those skilled in the art without making any creative efforts will be within the scope of protection of this disclosure.

[0017] In order to better describe a hybrid encoding method based on IIS bus of the present invention, Figure 1 The logical framework of the entire encoding-transmission-decoding process method of the present invention is shown.

[0018] at the same time Figure 2The system framework of the entire encoding-transmission-decoding process method of the present invention is shown. The audio data stream is the audio data originally required to be transmitted on the IIS bus. The data transmitting side encodes the audio data to be transmitted and then transmits it via the IIS bus. The data receiving side decodes the encoded data stream to obtain lossless audio data. The user data stream refers to the user data content that can be transmitted between the two chips using this method. By mixing user data and audio data in a mixed encoding and transmission method, the user data and audio data streams can be transmitted simultaneously on the IIS bus.

[0019] Figure 3 The figure shows the transmission status of the encoded frame on the IIS bus. In this embodiment, a single left and right channel sampling point (i.e., the first audio data and the second audio data) in the audio stream is used as the frame distinction for encoding, and one frame of encoded data corresponds to one audio sampling point in the original audio stream. According to the 32-bit data transmission format used by the IIS bus, the length of the current frame of encoded data is 64 bits. The data sending side combines the previous and next frame data information to encode the inter-frame redundant information of the compressed audio data stream. The data sending side performs secondary encoding on the compressed audio data and user data (i.e., non-audio data) and adds verification information of the user data to adapt to the IIS bus transmission. The receiving side restores the lossless audio data and user data by decoding.

[0020] like Figure 4 As shown, the method in this embodiment includes the steps of:

[0021] S1. Obtain first audio data, second audio data, and non-audio data; take the difference between first PCM data of a first data length in the first audio data and second PCM data of the first data length in the second audio data and halve it to obtain a first edge value.

[0022] Currently, common IIS bus data transmission formats include: single sampling point 16-bit dual-channel, single sampling point 24-bit dual-channel, single sampling point 32-bit dual-channel, etc. The encoding method of this embodiment is applicable to both 16-bit and 24-bit data transmission formats. The following description focuses on the common 16-bit data transmission format. The IIS bus bit width is increased to provide a larger transmission bandwidth upper limit. The conventionally used IIS bus data transmission format will be consistent with the audio data format it transmits. For example, 16-bit dual-channel audio data will use the IIS data transmission format with a single sampling point 16-bit dual-channel. The encoding method of this embodiment uses the 32-bit dual-channel IIS bus data transmission format with a higher data bit count to transmit the encoded data, which improves the achievable transmission bit rate per unit time. After changing from the 16-bit data transmission format to the 32-bit data transmission format, when using a 48kHz sampling rate IIS bus, its maximum transmission bit rate is increased from 1536kbps to 3072kbps.

[0023] For a single sample point in a 16-bit dual-channel audio stream, the data includes the first PCM data of the first data length in the first audio data (a 16-bit signed number of the left channel PCM data is denoted as L) and the second PCM data of the first data length in the second audio data (a 16-bit signed number of the right channel PCM data is denoted as R). The following steps are the data processing process for a single sample point in the audio stream:

[0024] Calculate the median M and edge S of the samples in the audio stream and convert the data into code.

[0025] The first PCM data of the first data length in the first audio data is halved with the second PCM data of the first data length in the second audio data to obtain a first edge value. Halving is performed to ensure a more appropriate value during compression; other simple mathematical operations are also covered by this method. The edge value S corresponding to the sample point is calculated using the formula (LR) / 2. The first edge value S is calculated as 16-bit signed PCM data.

[0026] The first PCM data of the first data length in the first audio data and the second PCM data of the first data length in the second audio data are summed and halved to obtain a first median. The median M corresponding to the sample point is calculated using the formula (L+R) / 2. The median M of the sample point is calculated. The data format of the median M is 16-bit signed PCM data.

[0027] S2. Determine whether the number of consecutive code elements superimposed starting from the first edge value is greater than or equal to a first preset threshold;

[0028] Since the audio stream data transmitted on the IIS bus is dual-channel PCM data, compression is performed based on the audio data's characteristics of "slowly varying from front to back" and "correlation between left and right channels." The "slowly varying from front to back" characteristic manifests itself in a small difference in PCM values between the preceding and following samples, while the "correlation between left and right channels" characteristic manifests itself in a small difference in PCM values between the left and right channels at the same moment. Based on these characteristics, the data difference between the sum values (L+R) in adjacent frames changes relatively slowly, and the difference between the sum values of the preceding and following frames can produce a code with many repeated values. This results in a high degree of compressibility when performing lossless compression. Furthermore, the data difference between the left and right channels in the same frame of data is not particularly large, so the difference can produce a code with many repeated values, resulting in a high degree of compressibility when performing lossless compression. The number of consecutive code elements superimposed from the first position is the number that is continuously superimposed starting from the first code. For example, in 0b0000000000000011, the 0 after 0b is the first code, and the number of consecutive superimpositions starting from the first code is "0000000000000", which is 14; for example, in 0b1111111111111011, the 1 after 0b is the first code, and the number of consecutive superimpositions starting from the first code is "1111111111111", which is 13.

[0029] S3. If yes, perform compression and obtain a first compressed code of a first compressed code length; subtract the first compressed code length from the predetermined total mixed code length and then subtract the first median code length to obtain the first mixed code length of the non-audio data code; and form a first mixed code based on the first compressed code, the first median code, and the non-audio data code of the first mixed code length; the first median code is the code obtained by taking the sum of the first PCM data and the second PCM data and taking half of it, and the first median code length is the code length obtained by taking the sum of the first PCM data and the second PCM data and taking half of it. The first compressed code includes a compressed edge code and a first compressed identification code, and the first compressed identification code is at the head or tail of the first compressed code.

[0030] In certain use cases, the first median value is compressible, while the first edge value is relatively uncompressed. After obtaining the first edge value, the encoded digital data may require compression in various situations. The first preset threshold can be set to a fixed empirical value, or a different first preset threshold can be selected based on the audio type. For example, if the audio type is determined to be basic stereo, the left and right channels have a greater correlation, so a larger first preset threshold, such as 12, can be used, achieving a better compression effect. On the other hand, if the audio type is determined to be a multi-track mix, the left and right channels have a lower correlation, so a smaller first preset threshold, such as 6, can be used, compressing only a relatively small amount of data.

[0031] Commonly used compression methods include: First compression method: obtain the number of consecutive code elements superimposed from the first position in the first edge value. When the number of consecutive code elements superimposed from the first position is greater than or equal to the first preset threshold, directly record the number of compressed digits using the first preset threshold, and add a compression identification code to the code. For example, if the first edge value obtained is 0b0000000000000011 and the first preset threshold is 12, then the compressed edge value code is 0b000111, and a compression identification code 1 is added, and the final first compressed code is 0b000111. The length of the first compressed code here is 6. This compression method can only compress the code elements of the first preset threshold number, and only needs to add a compression identification code; it can greatly reduce the number of code elements; and it is determined that compression cannot be performed when it is lower than the first preset threshold. During decompression, only the first preset threshold of 12 and the first compression code 0b000111 are needed to completely restore the first edge value. The second compression method: when the number of consecutive code elements superimposed from the first position is greater than or equal to the first preset threshold, the number of consecutive code elements superimposed from the first position is directly compressed, and 4 compression identification codes are added to the code to represent the compression number; for example, the first edge value obtained is 0b0000000000000011, and the first preset threshold is 5; then after compression, it is 0b011, and 4 compression identification codes 1110 are added to represent the number of overlapping compressions. The final first compression code is 0b01111110, and the length of the first compression code is 7. When decompressing, it is only necessary to directly restore the first edge value through the original overlapping compression number 14 and the compression code 0b011. The above two compression methods have different compression efficiencies, but overall they can compress the original 16-bit code less. The compression identification code of this embodiment can be 1-4 bits (or even more bits), 1 bit is used to indicate that the number is only compressed, and 0 is not compressed; the value of the corresponding compression identification code above 1 indicates how many numbers are compressed; for example, if 4 bits are set, 12 are compressed; its compression identification code is 1100, and if 4 bits are set, 0 is compressed; its compression identification code is 0000.

[0032] Because the first median code is the sum of the first and second PCM data and halved (halving is to prevent data overflow after the sum), the first median code length is the length of the first and second PCM data, i.e., the first data length. Therefore, the first mixed code length for the non-audio data is obtained by subtracting the first compressed code length and then the first median code length from the total length of the predetermined mixed code. Finally, the non-audio data encoding based on the first compressed code, the first median code, and the first mixed code length is used to form the first mixed code. Because the first median code is compressed and variably adjusted based on the audio content, the non-audio data is also variably encoded and transmitted based on the first mixed code length, thereby improving IIS bus utilization.

[0033] like Figure 5 In the data structure shown, the total length of the predetermined mixed code is generally set to 64 bits, the first median code is 16 bits, and the first compressed code length obtained according to the first compression method in the above example is 5 bits, so the remaining non-audio data code length is 43 bits. According to the second compression method in the above example, the first compressed code length obtained is 7 bits, so the remaining non-audio data code length is 41 bits, where the non-audio data code includes the non-audio data content and a parity check code (which may not be included in actual implementation). The first compressed code includes a compressed edge code and a first compressed identification code, and the first compressed identification code is at the head or tail of the first mixed code. Because the mixed code contains three codes, the non-audio data code length varies with the change in the first compressed code length; one or two specific positions are required for the decoder to identify whether the code segment is compressed; the 1st to 4th bits or the last 1-4 bits are the compression identification code, which can clearly indicate whether the code segment is compressed. In this embodiment, the first, second and third compressed identification codes are set at fixed positions such as the head or tail. Of course, when the first median code is fixed to the first data length, the compressed identification code can also be set next to it, but this is a simple variation of setting the head and tail. If this method is adopted, it should also be within the scope of protection of the present invention.

[0034] S4. If not, no compression is performed; the predetermined total mixed code length is subtracted from the first data length subtracted from the length of the second compression identification code and then subtracted from the first median code length to obtain the second mixed code length of the non-audio data code, and the second mixed code is composed of the first edge code, the second compression identification code, the first median code and the non-audio data code of the second mixed code length.

[0035] In most cases, the left and right channel data within the same frame are relatively close, allowing for some compression potential. However, in rare cases, neither the first median nor the first edge can be compressed. This situation does exist, but the probability of occurrence is much lower than in other cases. For frames with significantly different left and right channel data, uncompressing them is more cost-effective.

[0036] As another preferred embodiment, both the first median and the first edge can be compressed. A second median code is obtained by summing and halving the third PCM data of the first data length in the first audio data of the previous frame and the fourth PCM data of the first data length in the second audio data of the previous frame. The second median code is then subtracted from the first median code corresponding to the current frame to obtain a differential value. When the number of consecutive code elements superimposed from the first position in the differential value is greater than or equal to a second preset threshold, compression is performed to obtain a third compressed code of a third compressed code length, where the third compressed code includes a compressed differential value and a third compressed identification code. The third compressed code is then used to replace the first median code. The first compressed code length is subtracted from the predetermined total mixed code length, and then the third compressed code length is subtracted to obtain a third mixed code length for the non-audio data code. The first compressed code, the third compressed code, and the non-audio data code of the third mixed code length are combined to form a third mixed code. Since the third mixed code here is composed of three variable-length codes, it is necessary to ensure that the first compressed code and the third compressed code are decompressed before the third mixed code length is decompressed. The first compressed identification code and the third compressed identification code exist simultaneously, one at the head and the other at the tail. That is, when the first compressed identification code is at the head of the first mixed code, the third compressed identification code is at the tail of the third mixed code; when the first compressed identification code is at the tail of the first mixed code, the third compressed identification code is at the head of the third mixed code.

[0037] As another preferred embodiment, the first median value is compressible, but the first side value is incompressible. A second median code is obtained by summing and halving the third PCM data of the first data length in the first audio data of the previous frame and the fourth PCM data of the first data length in the second audio data of the previous frame, and then subtracting the second median code from the first median code corresponding to the current frame to obtain a differential value; when the number of consecutive code elements superimposed from the first position in the differential value is greater than or equal to a second preset threshold, compression is performed to obtain a third compressed code of a third compressed code length, and the third compressed code is used to replace the first median code; a fourth mixed code length of the non-audio data code is obtained by subtracting the first data length minus the length of the second compressed identification code and then subtracting the third compressed code length from the total length of the predetermined mixed code, and a fourth mixed code is formed based on the first edge value code, the second compressed identification code, the third compressed code, and the non-audio data code of the fourth mixed code length; the third compressed code includes a compressed differential value and a third compressed identification code; when the second compressed identification code is at the head of the fourth mixed code, the third compressed identification code is at the tail of the fourth mixed code; when the second compressed identification code is at the tail of the fourth mixed code, the second compressed identification code is at the head of the fourth mixed code.

[0038] In addition, for the difference between the first median and the second median, there are other processing methods to obtain different compression results, which is the third compression method:

[0039] The median M of the audio stream samples is processed, and the median M of the samples is forward-differentiated to obtain the median forward-differential value dM of the samples. For the current frame, dM satisfies the relationship:

[0040] M(n)=M(n-1)+dM For the first frame encoding, the M value of the forward frame is considered to be 0. That is, the dM used in the first frame encoding is numerically equal to the median M of the first frame.

[0041] Perform pre-compression on dM to obtain the shortest compressed code length l of dM M ; Refer to the above processing of boundary values for the steps.

[0042] Select the codeword sequence dM' after compression of the median forward differential value of the current coding frame and the code length step step of dM' for the current coding frame dM’ ;

[0043] Select the median forward differential value dM of the current coding frame after compression of the codeword sequence and the median sequence code length step step dM’ For the sample points of the current coding frame, the actual compressed median forward differential value codeword sequence is recorded as dM', and its corresponding actual compressed code length is L dM’ The actual compression code length of the current frame is L dM’ The actual compression code length of the forward reference frame median and the forward differential code length step of the current frame median are calculated. dM’ "Decide.

[0044] The actual compression code length L of the median forward difference value of the current frame dM’ The actual compressed code length equal to the median of the forward reference frame and the median forward differential code length step of the current frame dM’ The formula is as follows

[0045] L dM′ (n) = L dM′ (n-1)+step dM′ (n)

[0046] For 16-bit audio data format, it is assumed that the actual compression code length of the forward reference frame of the first frame coded at startup is 16. This means that in the first frame coded data, the actual compression code length of the median forward difference value compressed code element sequence dM' is equal to 16 + step dM′ (0).

[0047] For the median forward differential value code of the current frame, the long step step dM’ The selection must meet the following rules:

[0048] 1. Tend to choose a smaller step dM’ ;

[0049] 2. The step used in the current frame dM’ It is necessary to ensure that the actual compression code length L of the median forward difference value in the current frame dM’ Not less than the corresponding shortest code length L dM’ ;

[0050] 3. The step used in the current frame dM’ It is necessary to ensure that the actual compression code length L of the median forward difference value in the backward frame dM’ Not less than the corresponding shortest code length L dM ;

[0051] For the 16-bit audio data format, a set of code length steps are designed, namely "-1", "0", "1", and "2". Choose a smaller step dM’ Make the target value tend to be compressed as the sample frame is sent; select step dM’ When compressing the current frame, it is necessary to ensure that the compression is correct, while considering the actual compression code length L of the subsequent adjacent frames. dM’ The representable range of step. dM’ The maximum value determines the actual compression code length L between two frames. dM’ In order to avoid the inability to express the shortest code length L that increases suddenly in the following adjacent frames. dM , current encoding frame step dM’ The choice needs to be combined with the consideration of the shortest code length L of the subsequent adjacent frames dM For 16-bit audio data format, and when using the above code length step group, it is necessary to consider the shortest code length L of the next 8 frames. dM Condition.

[0052] The first mixed code, the second mixed code, and the third mixed code generated by the above method are decoded by corresponding methods at the receiving end, as follows:

[0053] The receiving end receives continuous sample frames via the IIS bus and decodes them using a decoding method corresponding to the above encoding to obtain lossless audio data and non-audio data (user data).

[0054] A first mixed code is used to obtain the corresponding first compression code, first median code, and non-audio data code of the first mixed code length. The first edge value is then restored by decompressing the first compression code using a first preset threshold, a compression identifier, and the first compression code. The left channel PCM data is obtained by adding the first median value and the first edge value of the current decoded frame, and the right channel PCM data is obtained by subtracting the first median value and the first edge value of the current decoded frame. The remaining non-audio data bits in the current decoded frame are extracted and their parity information is calculated to ensure data reliability. The IIS receiver uses the above method to decode consecutive data frames, separating and receiving audio data from user data. Using this method to transmit 16-bit dual-channel audio data, the theoretical transmission rate of non-music data is between 1296 kbps and 2736 kbps. Actual measurements show that when transmitting the music "Ferry" at 100% volume, the user data transmission rate can reach 2046 kbps. When the audio data is silent or no audio data is being transmitted, the user data transmission rate can reach 2736 kbps. The following are the lengths of the various parts in the data frame when the left and right channel data of the actual audio stream are both zero.

[0055] As an implementation example for the first mixed coding and decoding, the data obtained is determined to be the first mixed coding by the first compression identification code; the first compression code, the first median code and the non-audio data code of the first mixed code length are respectively obtained by decoding; the first compression code is decoded according to the first preset threshold or the first compression identification code to obtain the first edge value code; the first edge value code and the first median code are added to obtain the first PCM data of the first data length; the first edge value code and the first median code are subtracted to obtain the second PCM data of the second data length.

[0056] As an implementation example for the second mixed coding and decoding, the data obtained is determined to be the second mixed coding by the second compression identification code; the first edge value code, the second compression identification code, the first median code and the non-audio data code of the second mixed code length are respectively obtained through decoding; the first edge value code and the first median code are added to obtain the first PCM data of the first data length; the first edge value code and the first median code are subtracted to obtain the second PCM data of the second data length.

[0057] As an implementation example for the third mixed coding and decoding, when the first compression identification code and the third compression identification code are detected simultaneously, it is determined that the obtained data is the third mixed code; the first compression code, the third compression code and the non-audio data code of the third mixed code length are respectively obtained by decoding; the first compression code is decoded according to the first preset threshold or the first compression identification code to obtain the first edge value code; the third compression code is decoded according to the second preset threshold or the third compression identification code to obtain the differential value; the first median code is obtained by summing the differential value and the second median code; the first edge value code and the first median code are added to obtain the first PCM data of the first data length; the first edge value code and the first median code are subtracted to obtain the second PCM data of the second data length.

[0058] As an implementation example for the fourth mixed coding and decoding, when the second compression identification code and the third compression identification code are detected simultaneously, it is determined that the obtained data is the fourth mixed code; the first edge value code, the second compression identification code, the third compression code and the non-audio data code of the fourth mixed code length are respectively obtained by decoding; the third compression code is decoded according to the second preset threshold or the third compression identification code to obtain a differential value; the first median code is obtained by summing the differential value and the second median code; the first edge value code and the first median code are added to obtain first PCM data of the first data length; the first edge value code and the first median code are subtracted to obtain second PCM data of the second data length.

[0059] As an application of this embodiment, this embodiment also provides a Bluetooth chip, including: a Bluetooth headset chip configured with a decoding chip using the above-described decoding method. As a simple replacement, this Bluetooth headset chip can also be used in other products, such as Bluetooth speakers, etc., which are all simple replacements for this embodiment.

[0060] As an application of this embodiment, this embodiment further provides a Bluetooth headset, including: the above-mentioned Bluetooth headset chip is set.

[0061] It will be understood by those skilled in the art that all or part of the steps in the embodiments can be implemented by instructing related hardware through a computer program, and the program can be stored in a computer-readable medium, which can include various media that can store program codes, such as a flash drive, a mobile hard disk, a read-only memory, a random access memory, a magnetic disk, or an optical disk. In one embodiment, the present disclosure provides a computer-readable medium having a computer program stored therein, which is loaded and executed by a processing module to implement a hybrid encoding method based on an IIS bus.

[0062] Within the scope of the knowledge and ability level of those skilled in the art, the various embodiments or technical features mentioned herein may be combined with each other to serve as other optional embodiments without conflict. These limited number of optional embodiments, which are not listed one by one and are formed by combining a limited number of technical features, still fall within the technical scope disclosed in the present disclosure and can be understood or inferred by those skilled in the art in combination with the drawings and the above text.

[0063] In addition, the description of most embodiments is based on different focuses. For details not described in detail, please refer to the content of the prior art or other relevant descriptions in this document for understanding.

[0064] It is emphasized again that the embodiments listed above are typical and preferred embodiments of the present disclosure and are intended only to illustrate and explain the technical solutions of the present disclosure in detail to facilitate understanding by the reader, and are not intended to limit the scope of protection or application of the present disclosure. Any technical solutions obtained through modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present disclosure shall be included within the scope of protection of the present disclosure.

Claims

1. A hybrid encoding method based on IIS bus, characterized in that: Obtaining first audio data, second audio data, and non-audio data; performing a subtraction of first PCM data of a first data length in the first audio data and second PCM data of the first data length in the second audio data, and taking half of the difference, to obtain a first edge value; determining whether the number of consecutive code elements superimposed from the first position in the first edge value is greater than or equal to a first preset threshold; if so, performing compression and obtaining a first compressed code of a first compressed code length; The first mixed code length of the non-audio data code is obtained by subtracting the first compressed code length and then the first median code length from the total length of the predetermined mixed code; and the first mixed code is composed of the first compressed code, the first median code and the non-audio data code of the first mixed code length; the first median code is the code obtained by summing and halving the first PCM data and the second PCM data, the first median code length is the code length obtained by summing and halving the first PCM data and the second PCM data, which is equal to the first data length, the first compressed code includes a compressed edge value code and a first compressed identification code, and the first compressed identification code is at the head or tail of the first mixed code.

2. The hybrid coding method according to claim 1, wherein: When the number of consecutive code elements superimposed from the first position in the first edge value is less than the first preset threshold, no compression is performed, and the second mixed code length of the non-audio data code is obtained by subtracting the first data length minus the length of the second compression identification code and then subtracting the first median code length from the total length of the predetermined mixed code, and the second mixed code is composed of the first edge value code, the second compression identification code, the first median code and the non-audio data code of the second mixed code length; the second compression identification code is at the head or tail of the second mixed code.

3. The hybrid coding method according to claim 1, wherein: obtaining a second median code by summing and halving the third PCM data of the first data length in the first audio data of the previous frame and the fourth PCM data of the first data length in the second audio data of the previous frame, and then subtracting the second median code from the first median code corresponding to the current frame to obtain a differential value; When the number of consecutive code elements superimposed from the first position in the differential value is greater than or equal to a second preset threshold, compression is performed to obtain a third compressed code of a third compressed code length, and the third compressed code is used to replace the first median code; The third mixed code length of the non-audio data code is obtained by subtracting the first compressed code length and then the third compressed code length from the predetermined total mixed code length; the first compressed code, the third compressed code and the non-audio data code of the third mixed code length are combined into a third mixed code; the third compressed code includes a compressed differential value and a third compressed identification code; when the first compressed identification code is at the head of the first mixed code, the third compressed identification code is at the tail of the third mixed code; when the first compressed identification code is at the tail of the first mixed code, the third compressed identification code is at the head of the third mixed code.

4. The hybrid coding method according to claim 2, wherein: obtaining a second median code by summing and halving the third PCM data of the first data length in the first audio data of the previous frame and the fourth PCM data of the first data length in the second audio data of the previous frame, and then subtracting the second median code from the first median code corresponding to the current frame to obtain a differential value; When the number of consecutive code elements superimposed from the first position in the differential value is greater than or equal to a second preset threshold, compression is performed to obtain a third compressed code of a third compressed code length, and the third compressed code is used to replace the first median code; The fourth mixed code length of the non-audio data code is obtained by subtracting the first data length minus the length of the second compression identification code and then subtracting the third compression code length from the predetermined total mixed code length, and a fourth mixed code is formed based on the first edge value code, the second compression identification code, the third compression code and the non-audio data code of the fourth mixed code length; the third compression code includes a compressed differential value and a third compression identification code; when the second compression identification code is at the head of the fourth mixed code, the third compression identification code is at the tail of the fourth mixed code; when the second compression identification code is at the tail of the fourth mixed code, the second compression identification code is at the head of the fourth mixed code.

5. A decoding method based on IIS bus, applied to the decoding of the encoding method of claim 1, characterized in that: The data obtained is determined to be a first mixed code by using a first compression identification code; a first compression code, a first median code, and a non-audio data code of a first mixed code length are obtained by decoding; the first compression code is decoded according to the first preset threshold or the first compression identification code to obtain a first edge value code; The first edge value code and the first median code are added to obtain first PCM data of a first data length; and the first edge value code and the first median code are subtracted to obtain second PCM data of a second data length.

6. A decoding method based on an IIS bus, applied to the decoding of the encoding method according to claim 2, characterized in that: The data obtained by determining through the second compression identification code is the second mixed code; through decoding, the first edge value code, the second compression identification code, the first median code and the non-audio data code of the second mixed code length are respectively obtained; the first edge value code and the first median code are added to obtain the first PCM data of the first data length; the first edge value code and the first median code are subtracted to obtain the second PCM data of the second data length.

7. A decoding method based on an II S bus, applied to the decoding of the encoding method according to claim 3, characterized in that: When the first compression identification code and the third compression identification code are detected simultaneously, the obtained data is determined to be a third mixed code; the first compression code, the third compression code, and the non-audio data code of the third mixed code length are obtained by decoding; the first compression code is decoded according to the first preset threshold or the first compression identification code to obtain a first edge value code; Decode the third compressed code according to the second preset threshold or the third compressed identification code to obtain a differential value; obtain a first median code by summing the differential value and the second median code; add the first edge value code and the first median code to obtain first PCM data of the first data length; subtract the first edge value code from the first median code to obtain second PCM data of the second data length.

8. A decoding method based on IIS bus, applied to the decoding of the encoding method of claim 4, characterized in that: When the second compression identification code and the third compression identification code are detected simultaneously, the data obtained is determined to be the fourth mixed code; the first edge value code, the second compression identification code, the third compression code and the non-audio data code of the fourth mixed code length are obtained respectively by decoding; the third compression code is decoded according to the second preset threshold or the third compression identification code to obtain the differential value; the first median code is obtained by summing the differential value and the second median code; the first edge value code and the first median code are added to obtain the first PCM data of the first data length; the first edge value code and the first median code are subtracted to obtain the second PCM data of the second data length.

9. A Bluetooth headset chip, characterized in that include: The Bluetooth headset chip is configured to use a decoding chip using the decoding method described in any one of claims 5-8.

10. A Bluetooth headset, characterized in that include: A Bluetooth headset body, wherein the Bluetooth headset body is provided with the Bluetooth headset chip as claimed in claim 9.