An audio encoding method, an audio decoding method and a terminal device
Patent Information
- Application Number
- CN202611179736.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-05
- Publication Date
- 2026-10-13
AI Technical Summary
这导致解码端需处理大量冗余信息,降低了解码效率,增加了解码资源的消耗
通过整数变换将原始音频帧转换为整数频域系数,再将整数频域系数在频域上划分为多个频段,并对每个频段独立进行无损编码生成子码流,使得不同频段的数据以相互独立的子码流形式存在。再将子码流与解码边信息打包为机器听觉码流发送给解码端,也即机器听觉码流中携带了用于表征各频段在频域上位置和范围的频段描述信息,使得解码端无需解析全部码流数据,即可根据频段描述信息定位并读取所需频段对应的子码流,无需遍历或解析非目标频段的数据,在解码过程中实现对部分频段的选择性处理,降低了解码端的计算量。
Smart Images

Figure CN122907071A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data transmission technology, and in particular to an audio encoding method, an audio decoding method, and a terminal device. Background Technology
[0002] In machine hearing applications (such as industrial equipment inspection, intelligent transportation, medical sound analysis, live content understanding, sound field detection, sound source localization, etc.), downstream tasks (such as fault detection, event recognition, etc.) often rely on specific frequency ranges in audio signals and are sensitive to frequency regions, transients, weak events, inter-channel phase relationships, and acquisition conditions in audio.
[0003] Traditional lossy audio coding, which is designed for human hearing, may alter the details that machine tasks depend on, even when the hearing is acceptable, thus causing a shift in the execution of downstream tasks.
[0004] Current lossless audio coding technologies typically use complete channels or complete frame bitstreams as the basic coding unit. Even if the decoder only needs a portion of the data, it often needs to access or transmit a large complete bitstream. This results in the decoder having to process a large amount of redundant information, reducing decoding efficiency and increasing the consumption of decoding resources.
[0005] Therefore, a solution is needed that can reduce the computational load at the decoding end while ensuring lossless audio transmission. Summary of the Invention
[0006] In view of this, embodiments of this application provide an audio encoding method, an audio decoding method, and a terminal device for use in machine hearing scenarios. While ensuring lossless audio transmission, the decoding end can select and decode some frequency bands as needed, reducing the amount of decoding computation.
[0007] In a first aspect, embodiments of this application provide an audio encoding method applied at an encoding end, the method comprising: Perform an integer transform on the current frame of the original audio to obtain integer frequency domain coefficients; The integer frequency domain coefficients are divided into multiple frequency bands in the frequency domain to obtain frequency band coefficient segments that correspond one-to-one with the frequency bands; Each frequency band coefficient segment is losslessly encoded to generate the corresponding frequency band sub-code stream, and decoding side information is generated; the decoding side information includes frequency band description information used to characterize the position and range of the frequency band in the frequency domain; The decoding side information is packaged with multiple frequency band sub-streams to generate a machine hearing stream, which is then sent to the decoding end.
[0008] In some embodiments, performing an integer transform on the current frame of the original audio to obtain integer frequency domain coefficients includes: padding the current frame of the original audio with zeros or extending its boundaries to obtain a first frame; applying an analysis window function to the first frame to obtain a second frame; and performing an integer-corrected discrete cosine transform on the second frame to obtain integer frequency domain coefficients.
[0009] In some embodiments, the integer frequency domain coefficients are divided into multiple frequency bands in the frequency domain to obtain frequency band coefficient segments that correspond one-to-one with the frequency bands. This includes: determining the start frequency and end frequency of each frequency band according to a preset frequency band division strategy; mapping the start frequency and end frequency to the start frequency point and end frequency point in the integer frequency domain coefficients; and segmenting the corresponding frequency band coefficient segments from the integer frequency domain coefficients according to the start frequency point and end frequency point.
[0010] In some embodiments, lossless coding is performed on each frequency band coefficient segment to generate a corresponding frequency band sub-code stream, including: performing sign mapping on each signed integer coefficient in the frequency band coefficient segment to convert the signed integer coefficients into non-negative integers; determining coding parameters based on the distribution characteristics of non-negative integers; performing lossless coding on each non-negative integer based on the coding parameters to generate codewords; and concatenating the coding parameters and codewords to obtain the frequency band sub-code stream corresponding to the current frequency band of the current frame.
[0011] In some embodiments, a sign mapping is performed on each signed integer coefficient in the frequency band coefficient segment to convert the signed integer coefficient into a non-negative integer, including: for any signed integer coefficient in the frequency band coefficient segment that is greater than or equal to zero, mapping the signed integer coefficient to a first value, the first value being twice the signed integer coefficient; for any signed integer coefficient in the frequency band coefficient segment that is less than zero, mapping the signed integer coefficient to a second value, the second value being twice the absolute value of the signed integer coefficient minus one.
[0012] Secondly, embodiments of this application provide an audio decoding method applied at a decoding end, the method comprising: Receive the machine auditory bitstream sent by the encoding end; The machine auditory bitstream is analyzed to obtain decoding side information; the decoding side information includes frequency band description information. Based on the frequency band description information, locate and read the frequency band sub-stream corresponding to the target frequency band from the machine auditory bitstream; Lossless decoding of the frequency band sub-code stream yields the frequency band coefficient segment of the target frequency band; Reconstruct the frequency band coefficient segments into time-domain audio frames and output them.
[0013] In some embodiments, lossless decoding of the frequency band sub-code stream to obtain the frequency band coefficient segment of the target frequency band includes: obtaining coding parameters and codewords from the frequency band sub-code stream; performing lossless decoding on the codewords according to the coding parameters to obtain a non-negative integer sequence; and performing inverse sign mapping on the non-negative integer sequence to obtain a signed integer coefficient sequence, which serves as the frequency band coefficient segment of the target frequency band.
[0014] In some embodiments, performing an inverse sign mapping on a non-negative integer sequence to obtain a signed integer coefficient sequence includes: for any even number in the non-negative integer sequence, mapping the even number to a third value, which is half of the even number; for any odd number in the non-negative integer sequence, mapping the odd number to a fourth value, which is half of the odd number plus one and then inverted.
[0015] In some embodiments, reconstructing a frequency band coefficient segment into a time-domain audio frame includes: performing an integer-corrected discrete cosine inverse transform on the frequency band coefficient segment to obtain a reconstructed time-domain frame; applying a synthesis window function to the reconstructed time-domain frame to obtain a windowed time-domain frame; overlapping and adding the windowed time-domain frames according to the frame shift, and removing zero-padded samples according to the total number of samples to output the reconstructed time-domain audio frame.
[0016] Thirdly, embodiments of this application provide an audio encoding apparatus, comprising: a processing module, configured to perform integer transformation on the current frame of the original audio to obtain integer frequency domain coefficients; the processing module is further configured to divide the integer frequency domain coefficients into multiple frequency bands in the frequency domain to obtain frequency band coefficient segments corresponding one-to-one with the frequency bands; an encoding module, configured to perform lossless encoding on each frequency band coefficient segment to generate a corresponding frequency band sub-code stream; the processing module is further configured to generate decoding side information; the decoding side information includes frequency band description information used to characterize the position and range of the frequency band in the frequency domain; the encoding module is further configured to package the decoding side information and multiple frequency band sub-code streams to generate a machine hearing code stream; and a sending module, configured to send the machine hearing code stream to a decoding end.
[0017] Fourthly, embodiments of this application provide an audio decoding apparatus, comprising: a receiving module for receiving a machine hearing bitstream sent by an encoding end; a decoding module for parsing the machine hearing bitstream to obtain decoding side information; the decoding side information including frequency band description information; a processing module for locating and reading a frequency band sub-bitstream corresponding to a target frequency band from the machine hearing bitstream according to the frequency band description information; the decoding module is further configured to perform lossless decoding on the frequency band sub-bitstream to obtain a frequency band coefficient segment of the target frequency band; the processing module is further configured to reconstruct the frequency band coefficient segment into a time-domain audio frame and output it.
[0018] Fifthly, embodiments of this application provide a terminal device, including a processor and a memory, wherein the memory stores a computer program, and the processor is configured to execute the computer program to implement any of the audio encoding methods in the first aspect and any of the audio decoding methods in the second aspect.
[0019] In a sixth aspect, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed on a processor, implements any one of the audio encoding methods in the first aspect and any one of the audio decoding methods in the second aspect.
[0020] The embodiments of this application have the following beneficial effects: The original audio frame is converted into integer frequency domain coefficients through integer transformation. These coefficients are then divided into multiple frequency bands, and each band is independently lossless encoded to generate a sub-bitstream. This ensures that data from different frequency bands exist as independent sub-bitstreams. The sub-bitstreams, along with decoding side information, are packaged into a machine hearing bitstream and sent to the decoder. This machine hearing bitstream carries frequency band description information representing the position and range of each frequency band in the frequency domain. This allows the decoder to locate and read the sub-bitstream corresponding to the desired frequency band without parsing the entire bitstream, eliminating the need to traverse or parse data from non-target frequency bands. This selective processing of certain frequency bands during decoding reduces the computational load on the decoder.
[0021] In addition, the decoding end can reconstruct the frequency band coefficient segments obtained from the decoding into time-domain audio frames for output, so that even if the decoding end only obtains part of the frequency band data, it can still output the time-domain audio signal of the corresponding frequency band for subsequent use. Attached Figure Description
[0022] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0023] Figure 1 A flowchart of an audio encoding method provided in an embodiment of this application is shown; Figure 2 This illustration shows yet another flowchart of an audio encoding method provided in an embodiment of this application; Figure 3 A flowchart of an audio decoding method provided in an embodiment of this application is shown; Figure 4 This illustration shows yet another flowchart of an audio decoding method provided in an embodiment of this application; Figure 5 This paper shows a schematic diagram of the structure of an audio encoding device provided in an embodiment of this application; Figure 6 A schematic diagram of the structure of an audio decoding device provided in an embodiment of this application is shown. Detailed Implementation
[0024] The technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments.
[0025] The components of the embodiments of this application described and illustrated in the accompanying drawings can be arranged and designed in a variety of different configurations. Therefore, the following detailed description of the embodiments of this application provided in the drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0026] In the following text, the terms "comprising," "having," and their cognates, which may be used in various embodiments of this application, are intended only to indicate a particular feature, number, step, operation, element, component, or combination thereof, and should not be construed as primarily excluding the presence of one or more other features, numbers, steps, operations, elements, components, or combinations thereof, or adding the possibility of one or more combinations thereof. Furthermore, the terms "first," "second," "third," etc., are used only for distinguishing descriptions and should not be construed as indicating or implying relative importance.
[0027] Unless otherwise specified, all terms used herein (including technical and scientific terms) shall have the same meaning as commonly understood by one of ordinary skill in the art to which the various embodiments of this application pertain. Terms (such as those defined in commonly used dictionaries) shall be interpreted as having the same meaning as in their contextual meaning in the relevant technical field and shall not be construed as having an idealized or overly formal meaning, unless clearly defined in the various embodiments of this application.
[0028] As described in the background section, in the context of machine hearing applications, during the lossless transmission of audio, the decoding end needs to process a large amount of redundant information, resulting in low decoding efficiency and a large computational load.
[0029] Based on this, this application provides an audio encoding method and an audio decoding method. The encoding end divides the integer frequency domain coefficients obtained by integer transformation of the audio frame into multiple independent frequency bands. Each frequency band is then losslessly encoded to generate a corresponding frequency band sub-bitstream. The decoding side information carries frequency band description information representing the position and range of each frequency band in the frequency domain, and these are packaged and sent to the decoding end. The decoding end parses the frequency band description information, locates and reads the corresponding frequency band sub-bitstream from the machine auditory bitstream, and performs lossless decoding and temporal reconstruction. Thus, the decoding end can select and decode only a portion of the frequency bands as needed without parsing and decoding the entire frequency band data, significantly reducing the decoding computation while ensuring lossless recovery of the required frequency band data.
[0030] The audio encoding and decoding methods will be described in detail below with reference to the accompanying drawings and some specific embodiments. Unless otherwise specified, the following embodiments and features can be combined with each other.
[0031] Figure 1 A flowchart of an audio encoding method according to an embodiment of this application is shown. This audio encoding method can be executed by an encoding end and includes the following steps: S101. Perform integer transformation on the current frame of the original audio to obtain integer frequency domain coefficients.
[0032] In some embodiments, step S101 can be specifically implemented as follows: zero-padding or boundary extension of the current frame of the original audio to obtain a first frame; applying an analysis window function to the first frame to obtain a second frame; and performing an integer-corrected discrete cosine transform on the second frame to obtain integer frequency domain coefficients.
[0033] The encoding end receives mono or multi-channel machine auditory audio data and organizes samples in frames as the basic processing unit. For each processed frame, the preprocessing module in the encoding end converts the audio into an integer frequency domain identifier suitable for frequency band division and lossless encoding. The encoding end first divides the input Pulse Code Modulation (PCM) format audio into fixed-length frames according to the frame length (frame_len) and frame shift (hop_size). For insufficient parts at the beginning and end, deterministic zero padding or boundary extension is used, and the total number of sampling points (total_samples) is recorded in the bitstream header so that the subsequent decoding end can remove the zero-padded samples without introducing additional silence or truncation.
[0034] Each frame sample is multiplied by a preset analysis window function, identified by `window_id`. To ensure lossless recovery, the encoder and decoder must use the exact same window, scaling, and rounding method when applying the window function. In practice, the windowing operation can be performed using a pure integer arithmetic scheme called the "Integer Lifting Scheme," avoiding floating-point errors and ensuring perfect cancellation between the forward and inverse transforms.
[0035] The windowed time-domain frame is converted into N integer frequency-domain coefficients using the Modified Discrete Cosine Transform (MDCT). The type of the integer MDCT is identified by the type label (imdct_id), and N can be determined by frame_len, overlap mode, and specific transformation method.
[0036] Integer MDCT transforms time-domain waveforms into frequency-domain spectra using mathematical transformations. A common method is the integer lifting structure, which breaks down the floating-point MDCT operation into multiple steps. Each step uses integer addition, subtraction, and shifting instead of floating-point multiplication and division. The result of each step is an integer, and each step is reversible. The inverse transformation performs the exact opposite integer operation, which can accurately restore the original waveform.
[0037] Integer MDCT can also be implemented in other ways, which, together with the corresponding integer IMDCT (inverse transform), inverse window, and overlap addition process, form a reversible or perfect reconstruction relationship.
[0038] By padding the current frame of the original audio with zeros or extending its boundaries, samples at the beginning and end of the audio (less than one frame) can be processed normally, avoiding the discarding of valid data due to insufficient frame length. After applying an analysis window function, an integer-corrected discrete cosine transform is performed to convert the time-domain samples into integer frequency-domain coefficients. Integer transformation avoids rounding errors caused by floating-point operations; all operations are integer-reversible, ensuring that the frequency-domain coefficients accurately represent time-domain information, providing a data foundation for subsequent lossless coding.
[0039] S102. Divide the integer frequency domain coefficients into multiple frequency bands in the frequency domain to obtain frequency band coefficient segments that correspond one-to-one with the frequency bands.
[0040] In some embodiments, at least two frequency bands have different numbers of coefficients in their corresponding frequency band coefficient segments.
[0041] Machine auditory audio data has a wide sampling rate range, including the frequency range of human hearing, as well as the frequency ranges of infrasound and ultrasound. Different machine auditory tasks have different sensitivities to low-frequency, mid-frequency, high-frequency, or ultrasonic bands. Therefore, the frequency splitting module at the encoding end can divide integer frequency domain coefficients into one or more non-equal-length frequency band data segments according to a preset or externally configured frequency band splitting strategy. That is, different frequency bands can contain different numbers of MDCT coefficients.
[0042] The non-uniform frequency band division allows integer frequency domain coefficients to be allocated differently according to the sensitivity of the machine's hearing task to different frequency ranges. More coefficients are allocated to sensitive frequency bands to achieve fine characterization, while fewer coefficients are allocated to insensitive frequency bands to save coding overhead. This optimizes coding efficiency while ensuring the frequency band accuracy required by the task and enhances the adaptability of the coding scheme to different tasks and audio with different sampling rates.
[0043] In some embodiments, step S102 can be specifically implemented as follows: determining the start frequency and end frequency of each frequency band according to a preset frequency band division strategy; mapping the start frequency and end frequency to the start frequency point and end frequency point in the integer frequency domain coefficients; and dividing the corresponding frequency band coefficient segment from the integer frequency domain coefficients according to the start frequency point and end frequency point.
[0044] The Split module receives a frame of integer frequency domain coefficients output by the preprocessing module and divides the integer frequency domain coefficients into multiple frequency bands according to the frequency band table. The frequency band table can be represented by the frequency band number (band_id), start frequency (start_frequency), stop frequency (stop_frequency), start frequency point (start_bin), stop frequency point (stop_bin), or number of coefficients (coeff_count). Among them, start_frequency and stop_frequency are used to describe the physical meaning of the frequency band, and start_bin and stop_bin are used to determine the actual coefficient index range.
[0045] For each frequency band, the Split module outputs the corresponding frequency band coefficient sequence.
[0046] The start and end frequencies of each frequency band are determined by a preset or externally configured frequency band division strategy, which allows the frequency band division method to be flexibly configured according to the actual needs of different machine hearing tasks. Different tasks can correspond to different frequency band division methods, which improves the versatility and adaptability of the coding scheme.
[0047] By mapping the start and end frequencies to the start and end frequencies in the integer frequency domain coefficients, a precise correspondence is established between the physical meaning (Hz) of the frequency band and the index of the MDCT coefficient array. This ensures the accuracy of the frequency band boundary positioning, enabling the segmented frequency band coefficients to accurately correspond to the preset frequency range and avoiding data distortion caused by frequency band misalignment.
[0048] Based on the start and end frequencies, the corresponding frequency band coefficient segments are directly segmented from the integer frequency domain coefficient array, avoiding the overhead of traversing all coefficients and performing point-by-point judgments. This index-range-based segmentation method has low computational cost and precise positioning, enabling the encoding end to quickly complete frequency band division.
[0049] S103. Perform lossless encoding on each frequency band coefficient segment to generate the corresponding frequency band sub-code stream and generate decoding side information.
[0050] The decoding side information includes frequency band description information used to characterize the position and range of the frequency band in the frequency domain.
[0051] Specifically, the frequency band description information includes the start frequency, end frequency, number of coefficients, and sub-stream length. The frequency band description information may also include the frequency band number and frequency band order.
[0052] Decoding side information may also include global parameters, which are shared by all frequency bands. Global parameters include at least one of the following: sampling rate, quantization bit depth, frame length, frame shift, window function identifier, inverse transform identifier, total number of frames, total number of samples, and number of frequency bands.
[0053] Traditional floating-point MDCT outputs decimals, which must be quantized into integers before encoding. The quantization process discards the decimal part, causing irreversible errors, resulting in lossy encoding and transmission. In contrast, this application uses integer MDCT to directly output integers, eliminating the need for quantization. The encoded result is a precise integer, which can be completely restored during subsequent decoding, achieving lossless encoding and transmission.
[0054] In some embodiments, step S103 can be specifically implemented as follows: performing sign mapping on each signed integer coefficient in the frequency band coefficient segment to convert the signed integer coefficients into non-negative integers; determining the coding parameters according to the distribution characteristics of non-negative integers; performing lossless coding on each non-negative integer according to the coding parameters to generate codewords; concatenating the coding parameters and codewords to obtain the frequency band sub-codestream corresponding to the current frequency band of the current frame.
[0055] Specifically, for each signed integer coefficient in the frequency band coefficient segment, a sign mapping is performed to convert the signed integer coefficient into a non-negative integer. This can be implemented as follows: for any signed integer coefficient in the frequency band coefficient segment that is greater than or equal to zero, the signed integer coefficient is mapped to a first value, which is twice the signed integer coefficient; for any signed integer coefficient in the frequency band coefficient segment that is less than zero, the signed integer coefficient is mapped to a second value, which is twice the absolute value of the signed integer coefficient minus one.
[0056] For example, lossless coding can be achieved using the Rice-Golomb coding method.
[0057] The encoder performs sign mapping on the integer coefficient sequence X[0...M-1] for each frame and each frequency band. For a signed integer coefficient x, it is mapped to a non-negative integer u: when x≥0, u=2x; when x<0, u=-2x-1. Since Rice-Golomb coding can only handle non-negative integers, but MDCT coefficients can be positive or negative, this mapping process transforms both positive and negative numbers into non-negative numbers, making all MDCT coefficients usable with Rice-Golomb coding. The mapping is one-to-one; each coefficient corresponds to a unique mapping value. No two different coefficients are mapped to the same number. The mapping process is reversible; the decoder can accurately reconstruct the MDCT coefficients through inverse mapping. Furthermore, the mapping is lossless; no information is lost during the mapping process.
[0058] When lossless coding is Rice-Golomb coding, the coding parameter can be the Rice parameter k, which determines the coding efficiency. Different frames and frequency bands have different data distribution characteristics, such as coefficients, and therefore different suitable k values. The optimal k value can be determined individually for each frame and each frequency band.
[0059] The Rice parameter k can be adaptively determined based on the current frame. Specifically, the encoder can select k based on the mean, variance, or trial code length of the absolute values of the MDCT coefficients of the frame to minimize or near minimize the coding length. After determining the value of k, k is written into the frequency band sub-code stream. k can be an integer between 0 and 31, represented using 5 bits.
[0060] The core calculation process of Rice-Golomb coding is as follows: for each mapped non-negative integer u, calculate the quotient (q) and the remainder (r), where q=u>>k, i.e., q is the quotient obtained by dividing u by 2 to the power of k, and r=u&((1<<k)-1), i.e., r is the remainder obtained by dividing u by 2 to the power of k. The quotient is converted into a codeword: first write q zeros, then write a 1 as a termination; the remainder is converted into a codeword, and the remainder is represented by a fixed k bits. The two codewords are concatenated to obtain a complete codeword corresponding to one coefficient. The encoder first writes the coding parameters, and then continuously writes the Rice-Golomb codewords of M coefficients, so as to form the encoded data of the current frequency band of the current frame, that is, the frequency band sub-bitstream corresponding to the frequency band.
[0061] Lossless sign conversion is realized by performing odd-even mapping on signed integer coefficients, adaptive coding parameters are independently selected according to the distribution characteristics of coefficients in each frequency band, and the coding parameters and codewords are concatenated to form an independently encapsulated frequency band sub-bitstream, which improves the compression efficiency of each frequency band on the premise of ensuring the lossless property of encoding and decoding, and provides an independent data unit and positioning basis for the decoder to select and decode the target frequency band on demand.
[0062] S104. Packing the decoding side information and the plurality of frequency band sub-bitstreams to generate a machine auditory bitstream, and transmitting the machine auditory bitstream to the decoder.
[0063] Optionally, in actual transmission, the decoding side information and one or more frequency band sub-bitstreams may be packed to generate a machine auditory bitstream for transmission.
[0064] The machine auditory bitstream is composed of a bitstream header and one or more frequency band sub-bitstreams. For single-frequency-band transmission, a structure of "sync word | header length | bitstream header | frequency band data | CRC" can be adopted; for multi-frequency-band transmission, a structure of "sync word | header length | multiplexing header | sub-bitstream data area | CRC" can be adopted.
[0065] As an example, the bitstream sync word is 16 bits, with a value of 0x47aa, which is used by the decoder to identify the start position of one coding unit. The header length is 16 bits, indicating the byte length of the bitstream header or the multiplexing header.
[0066] The decoding side information is written into the bitstream header or the multiplexing header, which is information shared by all frequency bands.
[0067] Specifically, the global parameters included in the decoding side information may include: bitstream version number (version), sampling rate (sample_rate), quantization bit depth (pcm_bit_depth), frame_len, hop_size, window_id, imdct_id, total number of frames (num_frames), total number of samples (total_samples), and number of frequency bands (subBand_num). Here, total_samples is used to remove zero-padded samples from the last frame, and subBand_num represents the number N of non-equal-length frequency bands divided by the Split module.
[0068] The frequency band description information included in the decoding side information may include: frequency band number (band_id), start_frequency, stop_frequency, coeff_count, and sub-stream length (payload_length). start_frequency and stop_frequency are represented by 32-bit integers in Hz; coeff_count represents the number of integer MDCT coefficients that need to be decoded per frame for this frequency band; and payload_length represents the byte length of the sub-stream data area for this frequency band.
[0069] Each frequency band sub-code stream can consist of multiple data blocks, the number of which is determined by the number of coefficients (num_frames) in that frequency band. The structure of each frequency band sub-code stream is fixed: rice_k|rice_code(coeff[0])|rice_code(coeff[1])|...|rice_code(coeff[coeff_count-1]). Rice_k uses 5 bits to represent the adaptive Rice parameter of the current frequency band sub-code stream, followed by coeff_count variable-length Rice-Golomb codewords, which correspond to coeff_count MDCT coefficients of the current frequency band in the current frame.
[0070] For multi-band multiplexing transmission, global parameters and frequency band descriptions are written sequentially in the multiplexing header, and sub-bitstreams of each frequency band are written sequentially in the sub-bitstream data area. Since Rice-Golomb codewords are variable-length codes, payload_length is a necessary field for the decoder to distinguish the boundaries of different frequency band sub-bitstreams. If random access is required, an offset field (payload_offset) can be added. In the simplest implementation, the payload_offset field is not written in the bitstream; the decoder calculates the offset by summing the payload_lengths of all frequency bands and determining the starting position of the current frequency band.
[0071] The Cyclic Redundancy Check (CRC) field is used to detect errors in the bitstream header, frequency band description information, and sub-bitstream data. For example, the CRC can use a 16-bit or 32-bit checksum, covering all bytes from the beginning length field to the beginning CRC field. The decoder parses the CRC value from the bitstream and recalculates it for all bytes within the covered range using the same CRC algorithm. This calculated value is then compared to the CRC value. If they are equal, the data is not corrupted, and decoding continues. If they are not equal, the data is corrupted, and the encoded data is discarded or a retransmission is requested.
[0072] In summary, the frequency band coding process can be as follows: Figure 2 As shown: Machine auditory audio data enters the preprocessing module, which performs integer frequency domain conversion on the audio data to obtain integer frequency domain coefficients and outputs them to the Split module. The Split module divides the integer frequency domain coefficients into multiple frequency band coefficient segments and obtains decoding side information. The encoding module encodes these frequency band coefficient segments respectively to obtain sub-streams that correspond one-to-one with the frequency band coefficient segments. These sub-streams are multiplexed with the decoding side information to obtain the machine auditory bitstream, which is then transmitted to the decoding end through the transmission network.
[0073] Correspondingly, Figure 3 A flowchart of an audio decoding method according to an embodiment of this application is shown. This audio decoding method can be executed by a decoding end and includes the following steps: S201, Receive the machine auditory bitstream sent by the encoding end.
[0074] The machine auditory bitstream is generated by the encoding end according to the agreed bitstream format and can be transmitted to the decoding end through wired or wireless network transmission, copying to storage media, or real-time streaming media transmission.
[0075] S202. Analyze the machine auditory bitstream to obtain decoding side information.
[0076] In the bitstream, each encoded unit begins with the synchronization word 0x47aa and ends with a CRC checksum field. The decoder searches for the synchronization word 0x47aa in the bitstream to locate the start of a complete encoded unit. If a valid synchronization word is not found consecutively in the bitstream, the current data segment is deemed invalid, discarded, and the search continues for the next synchronization word.
[0077] After locating the start position of a coding unit, the decoder reads the header length field from a fixed offset position after the synchronization word to obtain the byte length of the entire bitstream header. Based on this header length, the decoder reads the complete bitstream header data to obtain decoding and encoding information, including global parameters and frequency band description information.
[0078] The decoding end stores the parsed decoding side information in an internal data structure to form a decoding context.
[0079] Optionally, the decoding end may further verify the integrity and consistency of the decoding side information, and if the decoding side information is incomplete or has obvious errors, determine that the code stream is invalid and terminate decoding.
[0080] S203. Locate and read the sub-code stream corresponding to the target frequency band from the machine auditory code stream according to the frequency band description information.
[0081] The decoding end selects one or more frequency bands as target frequency bands according to the requirements of the current machine auditory task. For example, a voice wake-up task may only require the 0-4kHz frequency band, and the decoding end selects the frequency band covering this frequency range as the target frequency band; a fault detection task may only require the high frequency band of 20kHz-1MHz, and the decoding end selects this frequency band as the target frequency band.
[0082] After the target frequency band is selected, the decoding end determines the start position and end position of the sub-code stream of this frequency band in the data area according to the frequency band description information, and reads the required sub-code stream data of the frequency band from the data area accordingly.
[0083] S204. Perform lossless decoding on the frequency band sub-code stream to obtain the frequency band coefficient segment of the target frequency band.
[0084] In some embodiments, step S204 may be specifically implemented as: obtaining encoding parameters and codewords from the frequency band sub-code stream; performing lossless decoding on the codewords according to the encoding parameters to obtain a non-negative integer sequence; performing inverse sign mapping on the non-negative integer sequence to obtain a signed integer coefficient sequence, which is used as the frequency band coefficient segment of the target frequency band.
[0085] Specifically, performing inverse sign mapping on the non-negative integer sequence to obtain the signed integer coefficient sequence may be specifically implemented as: for any even number in the non-negative integer sequence, mapping the even number to a third value, where the third value is half of the even number; for any odd number in the non-negative integer sequence, mapping the odd number to a fourth value, where the fourth value is half of the negation of the odd number after adding one.
[0086] For example, the decoding end reads the frame-level Rice parameter k, and continuously decodes M Rice-Golomb codewords. For each codeword, first count the number of 0s before the terminating 1 to obtain q, then read k bits to obtain r, and restore u=(q<<k)+r; then perform inverse sign mapping: if u is an even number, x=u / 2; if u is an odd number, x=-(u+1) / 2. The restored x is the integer MDCT coefficient of this frequency band of this frame.
[0087] Rice-Golomb lossless decoding is then performed on each frequency band to recover integer frequency domain coefficients. Corresponding to the Split module at the encoding end, the Merge module at the decoding end performs the reverse operation. The decoding end determines the frequency domain position where the coefficients of each frequency band should be placed back based on the frequency band description information; if all frequency bands are received, the Merge module concatenates the coefficients of each frequency band in frequency band order or fills them into the complete MDCT coefficient buffer according to the frequency point index; if only some frequency bands are received, the Merge module can output only the MDCT coefficients of that frequency band, or set the unreceived frequency bands to zero for subsequent time domain reconstruction.
[0088] Frequency band division determines the coefficient range of each sub-bitstream, the Rice parameter determines the coding efficiency of the current frame residual / coefficients, and decoding side information ensures that the decoder knows how many coefficients should be decoded in each frame and in which frequency band these coefficients should be placed back. Since both encoding and decoding processes are integer reversible operations, lossless audio restoration can be achieved when the required frequency band set and decoding side information are obtained.
[0089] S205. Reconstruct the frequency band coefficient segment into a time-domain audio frame and output it.
[0090] In some embodiments, step S205 can be specifically implemented as follows: performing integer-corrected discrete cosine inverse transform on the frequency band coefficient segment to obtain a reconstructed time-domain frame; applying a synthesis window function to the reconstructed time-domain frame to obtain a windowed time-domain frame; overlapping and adding the windowed time-domain frame according to the frame shift, and removing zero-padding samples according to the total number of samples to output the reconstructed time-domain audio frame.
[0091] First, the complete integer frequency domain coefficients output by the Merge module are fed into the integer IMDCT to obtain the reconstructed time domain frame; then, overlapping and addition are performed according to the inverse window / synthesis window corresponding to window_id and hop_size; finally, the zero-padding part at the encoder end is deleted according to total_samples, and the restored audio is output.
[0092] If only a portion of the frequency band is received, the receiver can output the frequency domain representation of that band or recover the corresponding frequency band signal. If all frequency bands are received, the Merge module puts the coefficients of each frequency band back into the complete frequency domain coefficient sequence, and recovers the time domain audio consistent with the input audio after integer IMDCT, inverse windowing, and overlapping addition.
[0093] In summary, the frequency band decoding process can be as follows: Figure 4 As shown: The decoding end receives the machine's auditory bitstream through the transmission network, demultiplexes the bitstream to obtain multiple substreams and decoding side information, and decodes each substream based on the decoding side information to obtain data segments corresponding to each substream. The Merge module of the decoding end performs inverse transformation to obtain MDCT coefficients, and the post-processing module performs time-domain transformation on the MDCT coefficients to obtain lossless original audio usable by downstream machine tasks.
[0094] During the encoding and decoding process, the data flow is as follows: the original audio samples flow sequentially through the encoding end (preprocessing module (integer transformation) → Split module (frequency band division) → frequency band lossless encoding module (frequency band frequency domain coefficient encoding) → bitstream multiplexing module (machine auditory bitstream) → transmission / storage module) → decoding end (bitstream parsing module (sub-bitstream and decoding side information) → frequency band lossless decoding module (sub-bitstream decoding) → Merge module (inverse integer transformation) → post-processing module (time domain transformation)). The data transmitted between each module are, in sequence, time domain frames, integer frequency domain coefficients, frequency band coefficient segments, frequency band sub-bitstreams, multiplexed bitstreams, demultiplexed sub-bitstreams, recovered frequency band coefficients, complete frequency domain coefficients, and the original audio.
[0095] For example, in the Voice Activity Detection (VAD / wake word) task, the focus is primarily on the 0-4kHz audio band. Traditional telephone voice only transmits 300-3400Hz, which is sufficient to support basic voice communication and recognition; high frequencies are helpful for distinguishing voiceless consonants such as / s / and / f / , but tasks such as "whether someone is speaking," "simple commands," and "keyword detection" typically do not require the full bandwidth.
[0096] Based on the audio encoding method provided in this application: input 16kHz mono PCM speech; split the frame into 20ms and 10ms frames; perform integer window function and integer MDCT on each frame; the Split module selects the coefficient range corresponding to 0-4kHz as frequency band B0; calculate the Rice parameter k for the coefficients of each frame of B0 and perform Rice-Golomb encoding; write sample_rate=16000, frame_len, hop_size, window_id, imdct_id, band_id=B0, start_frequency=0, stop_frequency=4000, coeff_count and num_frames into the bitstream header.
[0097] Based on the audio decoding method provided in this application: read the bitstream header and obtain the frequency range of B0 and the number of coefficients per frame; read rice_k frame by frame and solve for the B0 coefficients; if the task directly consumes frequency domain features, then send the B0 coefficients into the VAD or wake word model; if a time domain signal is required, then set the untransmitted frequency band to zero and perform integer IMDCT, inverse window, and overlap summation to obtain a 0-4kHz restricted speech signal.
[0098] Another example is acoustic emission (AE) studies of early bearing / mechanical failures, which primarily focus on high-frequency or ultrasonic bands such as 20kHz-1MHz. Early microcracks, friction, and impacts may not be noticeable in the ordinary audible frequency range, but are more sensitive to high-frequency AEs.
[0099] Based on the audio encoding method provided in this application: input a high sampling rate mono sensor signal, such as a 2MHz sampling rate; divide the signal into frames with a fixed frame length and execute integer window functions and integer MDCT; the Split module selects frequency domain coefficients in the range of 20kHz-1MHz according to the task configuration to form one or more non-uniform length frequency bands; each frequency band independently selects frame-level Rice parameters and performs Rice-Golomb encoding; the multiplexed bitstream records the band_id, start and end frequencies, coeff_count, and payload_length of each frequency band.
[0100] Based on the audio decoding method provided in this application: the receiver locates the high-frequency acoustic emission sub-code stream according to the frequency band description table; the Rice-Golomb codewords are decoded frame by frame to recover the high-frequency integer MDCT coefficients; the machine fault detection model can directly use the high-frequency coefficients to calculate the impact energy, spectral peaks, envelope, or anomaly score; if playback or verification is required, the high-frequency coefficients are put back into the corresponding frequency band and post-processing is performed to obtain the high-frequency reconstructed signal.
[0101] As another example, when the downstream machine task is cough detection, the cough frequency distribution can range from tens of Hz to about 4 kHz. Machine auditory methods can divide cough features into multiple subbands such as 0-0.5 kHz, 0.5-1 kHz, 1-1.5 kHz, 1.5-2 kHz, and 2-5.5125 kHz for medical monitoring, respiratory disease screening, and long-term cough counting.
[0102] Based on the audio encoding method provided in this application: input mono cough monitoring audio; divide into frames according to fixed frame length and frame shift; execute integer window function and integer MDCT; the Split module generates multiple frequency band coefficient segments according to the above non-equal length frequency bands; the encoding end adaptively selects Rice parameters for each frequency band and each frame and performs Rice-Golomb encoding; the code stream multiplexing header records the start and end frequencies, number of coefficients and sub-code stream length of each frequency band.
[0103] Based on the audio decoding method provided in this application: the receiver can only parse a few frequency bands required by the cough detection model, such as 0.5-2kHz and 2-5.5125kHz; the sub-code streams of each frequency band are decoded by Rice-Golomb to recover the frequency domain coefficients, which can be directly input into the cough classification model. If a complete cough segment verification is required, all frequency bands are received, the Merge module recovers the complete frequency domain coefficients, and the post-processing module outputs the complete time domain audio.
[0104] Figure 5 A schematic diagram of an audio encoding apparatus according to an embodiment of this application is shown. Exemplarily, the audio encoding apparatus 300 includes a processing module 301, an encoding module 302, and a transmitting module 303.
[0105] The processing module 301 is used to perform integer transformation on the current frame of the original audio to obtain integer frequency domain coefficients; the processing module 301 is also used to divide the integer frequency domain coefficients into multiple frequency bands in the frequency domain to obtain frequency band coefficient segments corresponding to each frequency band; the encoding module 302 is used to perform lossless encoding on each frequency band coefficient segment to generate the corresponding frequency band sub-code stream; the processing module 301 is also used to generate decoding side information; the decoding side information includes frequency band description information used to characterize the position and range of the frequency band in the frequency domain; the encoding module 302 is also used to package the decoding side information and multiple frequency band sub-code streams to generate a machine hearing code stream; the sending module 303 is used to send the machine hearing code stream to the decoding end.
[0106] In some embodiments, the processing module 301 is specifically used to: pad the current frame of the original audio with zeros or extend its boundaries to obtain a first frame; apply an analysis window function to the first frame to obtain a second frame; and perform an integer-corrected discrete cosine transform on the second frame to obtain integer frequency domain coefficients.
[0107] In some embodiments, the processing module 301 is specifically used to: determine the start frequency and end frequency of each frequency band according to a preset frequency band division strategy; map the start frequency and end frequency to the start frequency point and end frequency point in the integer frequency domain coefficients; and divide the corresponding frequency band coefficient segment from the integer frequency domain coefficients according to the start frequency point and end frequency point.
[0108] In some embodiments, the encoding module 302 is specifically used to: perform sign mapping on each signed integer coefficient in the frequency band coefficient segment, converting the signed integer coefficients into non-negative integers; determine the encoding parameters according to the distribution characteristics of non-negative integers; perform lossless encoding on each non-negative integer according to the encoding parameters to generate codewords; and concatenate the encoding parameters and codewords to obtain the frequency band sub-codestream corresponding to the current frequency band of the current frame.
[0109] In some embodiments, the encoding module 302 is specifically used to: for any signed integer coefficient in the frequency band coefficient segment that is greater than or equal to zero, map the signed integer coefficient to a first value, the first value being twice the signed integer coefficient; for any signed integer coefficient in the frequency band coefficient segment that is less than zero, map the signed integer coefficient to a second value, the second value being twice the absolute value of the signed integer coefficient minus one.
[0110] Figure 6 A schematic diagram of an audio decoding device according to an embodiment of this application is shown. Exemplarily, the audio decoding device 400 includes a receiving module 401, a decoding module 402, and a processing module 403.
[0111] The receiving module 401 is used to receive the machine auditory bitstream sent by the encoding end; the decoding module 402 is used to parse the machine auditory bitstream to obtain decoding side information; the decoding side information includes frequency band description information; the processing module 403 is used to locate and read the frequency band sub-bitstream corresponding to the target frequency band from the machine auditory bitstream according to the frequency band description information; the decoding module 402 is also used to perform lossless decoding on the frequency band sub-bitstream to obtain the frequency band coefficient segment of the target frequency band; the processing module 403 is also used to reconstruct the frequency band coefficient segment into a time-domain audio frame and output it.
[0112] In some embodiments, the decoding module 402 is specifically used to: obtain encoding parameters and codewords from the frequency band sub-code stream; perform lossless decoding on the codewords according to the encoding parameters to obtain a non-negative integer sequence; and perform inverse sign mapping on the non-negative integer sequence to obtain a signed integer coefficient sequence, which serves as the frequency band coefficient segment of the target frequency band.
[0113] In some embodiments, the decoding module 402 is specifically used to: for any even number in the non-negative integer sequence, map the even number to a third value, the third value being half of the even number; for any odd number in the non-negative integer sequence, map the odd number to a fourth value, the fourth value being half of the odd number plus one and then inverted.
[0114] In some embodiments, the processing module 403 is specifically used to: perform integer-corrected discrete cosine inverse transform on the frequency band coefficient segment to obtain a reconstructed time-domain frame; apply a synthesis window function to the reconstructed time-domain frame to obtain a windowed time-domain frame; overlap and add the windowed time-domain frame according to the frame shift, and remove zero-padding samples according to the total number of samples to output the reconstructed time-domain audio frame.
[0115] It is understood that the apparatus in this embodiment corresponds to the audio encoding method and audio decoding method in the above embodiments, and the options in the above embodiments are also applicable to this embodiment, so they will not be described again here.
[0116] This application also provides a terminal device, exemplary of which includes a processor and a memory, wherein the memory stores a computer program, and the processor, by running the computer program, causes the terminal device to perform the functions of the aforementioned audio encoding method and audio decoding method or the various modules in the aforementioned audio encoding device and audio decoding device.
[0117] The processor can be an integrated circuit chip with signal processing capabilities. The processor can be a general-purpose processor, including at least one of a Central Processing Unit (CPU), Graphics Processing Unit (GPU), Network Processor (NP), Digital Signal Processor (DSP), Application-Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The general-purpose processor can be a microprocessor or any conventional processor, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in the embodiments of this application.
[0118] The memory can be, but is not limited to, Random Access Memory (RAM), Read Only Memory (ROM), Programmable Read-Only Memory (PROM), Erasable Programmable Read-Only Memory (EPROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), etc. The memory is used to store computer programs, and the processor can execute the computer programs accordingly after receiving execution instructions.
[0119] This application also provides a computer-readable storage medium for storing the computer program used in the aforementioned terminal device. For example, the computer-readable storage medium may include, but is not limited to, various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0120] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings show the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that, in alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and combinations of blocks in the block diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0121] In addition, the functional modules or units in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0122] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a smartphone, personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application.
[0123] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.
Claims
1. An audio encoding method, characterized in that, Applied to the encoding end; the method includes: Perform an integer transform on the current frame of the original audio to obtain integer frequency domain coefficients; The integer frequency domain coefficients are divided into multiple frequency bands in the frequency domain to obtain frequency band coefficient segments that correspond one-to-one with the frequency bands; Each frequency band coefficient segment is losslessly encoded to generate a corresponding frequency band sub-code stream, and decoding side information is generated; the decoding side information includes frequency band description information used to characterize the position and range of the frequency band in the frequency domain; The decoding side information is packaged with multiple frequency band sub-streams to generate a machine hearing stream, and the machine hearing stream is sent to the decoding end.
2. The method according to claim 1, characterized in that, The step of performing an integer transformation on the current frame of the original audio to obtain integer frequency domain coefficients includes: The first frame is obtained by zero-padding or boundary extension of the current frame of the original audio. Apply an analysis window function to the first frame to obtain the second frame; The integer frequency domain coefficients are obtained by performing an integer-corrected discrete cosine transform on the second frame.
3. The method according to claim 1, characterized in that, The step of dividing the integer frequency domain coefficients into multiple frequency bands in the frequency domain to obtain frequency band coefficient segments corresponding one-to-one with the frequency bands includes: According to the preset frequency band division strategy, the start frequency and end frequency of each frequency band are determined; Map the starting frequency and the ending frequency to the starting and ending frequency points in the integer frequency domain coefficients; Based on the starting and ending frequency points, the corresponding frequency band coefficient segments are segmented from the integer frequency domain coefficients.
4. The method according to claim 1, characterized in that, The step of lossless encoding of each frequency band coefficient segment to generate a corresponding frequency band sub-code stream includes: For each signed integer coefficient in the frequency band coefficient segment, perform sign mapping to convert the signed integer coefficient into a non-negative integer; Based on the distribution characteristics of the non-negative integers, determine the encoding parameters; According to the encoding parameters, each of the non-negative integers is losslessly encoded to generate codewords; By concatenating the encoding parameters and the codeword, the frequency band sub-code stream corresponding to the current frequency band of the current frame is obtained.
5. The method according to claim 4, characterized in that, The step of performing sign mapping on each signed integer coefficient in the frequency band coefficient segment, converting the signed integer coefficients into non-negative integers, includes: For any signed integer coefficient greater than or equal to zero in the frequency band coefficient segment, the signed integer coefficient is mapped to a first value, where the first value is twice the signed integer coefficient. For any signed integer coefficient less than zero in the frequency band coefficient segment, the signed integer coefficient is mapped to a second value, which is twice the absolute value of the signed integer coefficient minus one.
6. An audio decoding method, characterized in that, Applied to the decoding end; the method includes: Receive the machine auditory bitstream sent by the encoding end; The machine auditory bitstream is parsed to obtain decoding side information; the decoding side information includes frequency band description information. Based on the frequency band description information, locate and read the frequency band sub-stream corresponding to the target frequency band from the machine auditory code stream; Lossless decoding is performed on the sub-code stream of the frequency band to obtain the frequency band coefficient segment of the target frequency band; The frequency band coefficient segments are reconstructed into time-domain audio frames and output.
7. The method according to claim 6, characterized in that, The lossless decoding of the frequency band sub-code stream to obtain the frequency band coefficient segment of the target frequency band includes: The encoding parameters and codewords are obtained from the sub-code stream of the frequency band; Based on the encoding parameters, the codeword is losslessly decoded to obtain a sequence of non-negative integers; Perform an inverse sign mapping on the non-negative integer sequence to obtain a signed integer coefficient sequence, which serves as the frequency band coefficient segment of the target frequency band.
8. The method according to claim 7, characterized in that, The step of performing an inverse sign mapping on the non-negative integer sequence to obtain a signed integer coefficient sequence includes: For any even number in the non-negative integer sequence, map the even number to a third value, the third value being half of the even number; For any odd number in the non-negative integer sequence, the odd number is mapped to a fourth value, which is half of the odd number plus one and then inverted.
9. The method according to claim 6, characterized in that, The step of reconstructing the frequency band coefficient segment into a time-domain audio frame includes: Perform an integer-corrected discrete cosine inverse transform on the frequency band coefficient segments to obtain the reconstructed time-domain frame; A synthesis window function is applied to the reconstructed temporal frame to obtain a windowed temporal frame; The windowed temporal frames are overlapped and added according to the frame shift, and zero-padding samples are removed according to the total number of samples to output the reconstructed temporal audio frame.
10. A terminal device, characterized in that, The terminal device includes a processor and a memory, the memory storing a computer program, and the processor executing the computer program to implement the audio encoding method of any one of claims 1-5, or the audio decoding method of any one of claims 6-9.