Coding and decoding method, device, equipment, storage medium and computer program
By adjusting the number of coding bits of the latent variable, the problem of unstable coding rate in entropy coding is solved, ensuring that the number of coding bits of each frame of media data is consistent, meeting the stable coding rate requirements of the encoder, and being suitable for a variety of media data.
Patent Information
- Application Number
- CN202410892763.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-21
- Publication Date
- 2024-09-24
AI Technical Summary
In the existing encoding and decoding methods, entropy coding dynamically changes the number of encoding bits of latent variables in different frames of audio signals, which cannot meet the demand for stable encoding rate. Especially when transmitting side information, the number of encoding bits is inconsistent, which affects the stability of the encoder. .
The latent variables are adjusted by adjusting factors so that the number of coded bits of the entropy coding result meets the preset coding rate conditions to ensure that the number of coded bits of each frame of media data is consistent, including the use of fixed code rate and variable code rate processing methods. , and consider the number of encoding bits of side information when necessary.
It achieves the stability of the number of coded bits of the entropy coding result of each frame of media data, meets the encoder's demand for a stable coding rate, and ensures that the number of coded bits is basically consistent, and is suitable for media data such as audio, video, and images.
Smart Images

Figure CN118694750A
Abstract
Description
[0001] This application is a divisional application. The application number of the original application is 202110559102.7, and the original application date is May 21, 2021. The entire contents of the original application are incorporated into this application by reference. Technical Field
[0002] The embodiments of the present application relate to the field of coding and decoding technology, and in particular, to a coding and decoding method, apparatus, device, storage medium and computer program. Background Art
[0003] Codec technology is an indispensable part of media applications such as media communication and media broadcasting. Therefore, how to perform codec has become one of the concerns of the industry.
[0004] The related art proposes a method for encoding and decoding an audio signal, in which, when encoding an audio signal, a modified discrete cosine transform (MDCT) is performed on the audio signal in the time domain to obtain an audio signal in the frequency domain. The audio signal in the frequency domain is processed by an encoding neural network model to obtain a latent variable, which is used to indicate the characteristics of the audio signal in the frequency domain. The latent variable is quantized to obtain a quantized latent variable, the quantized latent variable is entropy encoded, and the entropy encoding result is written into a bit stream. When decoding the audio signal, the quantized latent variable is determined based on the bit stream, the quantized latent variable is dequantized to obtain a latent variable. The latent variable is processed by a decoding neural network model to obtain an audio signal in the frequency domain, and the audio signal in the frequency domain is processed by a modified inverse discrete cosine transform (IMDCT) to obtain a reconstructed audio signal in the time domain.
[0005] However, since entropy coding uses different numbers of bits to encode elements with different probabilities, for two adjacent frames of audio signals, the probabilities of the elements in the latent variables corresponding to the two frames of audio signals may be different, resulting in different numbers of encoding bits for the latent variables of the two frames of audio signals, which cannot meet the requirements of a stable coding rate. Summary of the invention
[0006] The present application provides a coding and decoding method, apparatus, device, storage medium and computer program, which can meet the requirements of the encoder for stable coding rate. The technical solution is as follows:
[0007] In a first aspect, a coding method is provided, which can be applied to a codec that does not include a context model, and can also be applied to a codec that includes a context model. Moreover, not only can the latent variables generated by the media data to be encoded be adjusted by the adjustment factor, but also the latent variables determined by the context model can be adjusted by the adjustment factor. Therefore, the method will be explained in detail in the following divided into multiple cases.
[0008] In the first case, the media data to be encoded is processed by a first encoding neural network model to obtain a first latent variable, the first latent variable is used to indicate the characteristics of the media data to be encoded; a first variable adjustment factor is determined based on the first latent variable, the first variable adjustment factor is used to make the number of encoding bits of the entropy encoding result of the second latent variable meet the preset encoding rate condition, and the second latent variable is obtained by adjusting the first latent variable by the first variable adjustment factor; the entropy encoding result of the second latent variable is obtained; and the entropy encoding result of the second latent variable and the encoding result of the first variable adjustment factor are written into the bitstream.
[0009] Since the number of coded bits of the entropy coding result of the second latent variable meets the preset coding rate condition, it can be ensured that the number of coded bits of the entropy coding result of the latent variable corresponding to each frame of media data can meet the preset coding rate condition, that is, it can be ensured that the number of coded bits of the entropy coding result of the latent variable corresponding to each frame of media data remains basically consistent, rather than dynamically changing, thereby meeting the encoder's demand for a stable coding rate. Further, considering the need to transmit side information (such as window type, time-domain noise shaping (TNS: Temporal Noise Shaping) parameters, frequency-domain noise shaping (FDNS: Frequency-domain noise shaping) parameters, and / or bandwidth extension (BWE: bandwidth extension) parameters, etc.), it can be ensured that the number of coded bits of the entropy coding result of the latent variable corresponding to each frame of media data and the number of coded bits of the side information remain basically consistent as a whole, thereby meeting the encoder's demand for a stable coding rate.
[0010] The media data to be encoded is an audio signal, a video signal or an image, etc. Moreover, the media data to be encoded may be in any form, which is not limited in the present application.
[0011] The implementation process of processing the media data to be encoded by the first encoding neural network model is: inputting the media data to be encoded into the first encoding neural network model to obtain the first latent variable output by the first encoding neural network model. Alternatively, preprocessing the media data to be encoded, inputting the preprocessed media data into the first encoding neural network model, and obtaining the first latent variable output by the first encoding neural network model.
[0012] That is to say, the media data to be encoded can be used as the input of the first encoding neural network model to determine the first latent variable, or the media data to be encoded can be preprocessed and then used as the input of the first encoding neural network model to determine the first latent variable.
[0013] Optionally, when using a fixed bit rate to encode the media data to be encoded, satisfying the preset encoding rate condition includes that the number of encoding bits is less than or equal to the target number of encoding bits; or, satisfying the preset encoding rate condition includes that the number of encoding bits is less than or equal to the target number of encoding bits, and the difference between the number of encoding bits and the target number of encoding bits is less than a bit number threshold; or, satisfying the preset encoding rate condition includes that the number of encoding bits is a maximum number of encoding bits that is less than or equal to the target number of encoding bits.
[0014] Optionally, when the media data to be encoded is encoded using a variable bit rate, satisfying the preset encoding rate condition includes that the absolute value of the difference between the number of encoded bits and the target number of encoded bits is less than a bit number threshold. That is, satisfying the preset encoding rate condition includes that the number of encoded bits is less than or equal to the target number of encoded bits, and the difference between the target number of encoded bits and the number of encoded bits is less than the bit number threshold; or satisfying the preset encoding rate condition includes that the number of encoded bits is greater than or equal to the target number of encoded bits, and the difference between the number of encoded bits and the target number of encoded bits is less than the bit number threshold.
[0015] The target number of coding bits may be set in advance. Of course, the target number of coding bits may also be determined based on the coding rate, and different coding rates correspond to different target numbers of coding bits.
[0016] In the embodiment of the present application, the media data to be encoded may be encoded using a fixed bit rate, or may be encoded using a variable bit rate.
[0017] When the media data to be encoded is encoded at a fixed bit rate, the number of bits of the media data to be encoded of the current frame can be determined based on the fixed bit rate, and then the number of used bits of the current frame can be subtracted to obtain the target number of bits for encoding the current frame. The number of used bits can be the number of bits for encoding side information, etc., and usually, the side information of each frame of media data is different, so the target number of bits for encoding each frame of media data is usually different.
[0018] When using a variable bit rate to encode the media data to be encoded, a bit rate is usually specified, and the actual bit rate will fluctuate above and below the specified bit rate. At this time, the number of bits of the media data to be encoded in the current frame can be determined based on the specified bit rate, and then the number of used bits of the current frame is subtracted to obtain the target number of bits for encoding the current frame. The number of used bits can be the number of bits for encoding side information, etc., and in some cases, the side information of media data in different frames can be different, so the target number of bits for encoding media data in different frames is usually different.
[0019] The initial number of coding bits may be determined based on the first latent variable, and the first variable adjustment factor may be determined based on the initial number of coding bits and the target number of coding bits.
[0020] The initial number of coded bits is the number of coded bits of the entropy coding result of the first latent variable; or the initial number of coded bits is the number of coded bits of the entropy coding result of the first latent variable adjusted by the first initial adjustment factor. The first initial adjustment factor may be a first preset adjustment factor.
[0021] The implementation process of adjusting the first latent variable based on the first initial adjustment factor is: multiplying each element in the first latent variable by the corresponding element in the first initial adjustment factor to obtain the adjusted first latent variable.
[0022] It is worth noting that the above implementation process is only an example. In actual applications, other methods can also be used for adjustment. For example, each element in the first latent variable can be divided by the corresponding element in the first initial adjustment factor to obtain the adjusted first latent variable. The embodiment of the present application does not limit the adjustment method.
[0023] There are multiple implementations of determining the first variable adjustment factor based on the initial number of coding bits and the target number of coding bits, three of which are introduced below.
[0024] In a first implementation, when the initial number of coding bits is equal to the target number of coding bits, the first initial adjustment factor is determined as the first variable adjustment factor. When the initial number of coding bits is not equal to the target number of coding bits, the first variable adjustment factor is determined in a first loop based on the initial number of coding bits and the target number of coding bits.
[0025] Among them, the i-th loop processing of the first loop mode includes the following steps: determining the adjustment factor of the i-th loop processing, i is a positive integer, adjusting the first latent variable based on the adjustment factor of the i-th loop processing, and obtaining the first latent variable after the i-th adjustment. Determine the number of coded bits of the entropy coding result of the i-th adjusted first latent variable to obtain the i-th number of coded bits. When the i-th number of coded bits meets the condition for continued adjustment, execute the i+1-th loop processing of the first loop mode. When the i-th number of coded bits does not meet the condition for continued adjustment, terminate the execution of the first loop mode, and determine the first variable adjustment factor based on the adjustment factor of the i-th loop processing.
[0026] The implementation process of determining the adjustment factor of the i-th loop processing is as follows: based on the adjustment factor of the i-1th loop processing of the first loop mode, the i-1th number of coded bits and the target number of coded bits, the adjustment factor of the i-th loop processing is determined. Wherein, in the case of i=1, the adjustment factor of the i-1th loop processing is the first initial adjustment factor, and the i-1th number of coded bits is the initial number of coded bits.
[0027] At this time, the conditions for continuing to adjust include that the number of coding bits for the i-1th time and the number of coding bits for the i-th time are both less than the target number of coding bits, or the conditions for continuing to adjust include that the number of coding bits for the i-1th time and the number of coding bits for the i-th time are both greater than the target number of coding bits.
[0028] In other words, the condition for continuing to adjust includes that the number of coding bits for the i-th time does not exceed the target number of coding bits. The meaning of not exceeding here is: the number of coding bits for the previous i-1 times has always been less than the target number of coding bits, and the number of coding bits for the i-th time is still less than the target number of coding bits. Alternatively, the number of coding bits for the previous i-1 times has always been greater than the target number of coding bits, and the number of coding bits for the i-th time is still greater than the target number of coding bits. On the contrary, exceeding means: the number of coding bits for the previous i-1 times has always been less than the target number of coding bits, and the number of coding bits for the i-th time is greater than the target number of coding bits. Alternatively, the number of coding bits for the previous i-1 times has always been greater than the target number of coding bits, and the number of coding bits for the i-th time is less than the target number of coding bits.
[0029] The implementation process of determining the first variable adjustment factor based on the adjustment factor of the ith loop processing includes: when the number of coded bits for the ith loop is equal to the target number of coded bits, the adjustment factor of the ith loop processing is determined as the first variable adjustment factor. Alternatively, when the number of coded bits for the ith loop is not equal to the target number of coded bits, the first variable adjustment factor is determined based on the adjustment factor of the ith loop processing and the adjustment factor of the i-1th loop processing of the first loop mode.
[0030] That is, the adjustment factor of the i-th loop processing is the adjustment factor obtained last time through the above-mentioned first loop method, and the i-th number of coded bits is the number of coded bits obtained last time. When the number of coded bits obtained last time is equal to the target number of coded bits, the adjustment factor obtained last time is determined as the first variable adjustment factor. When the number of coded bits obtained last time is not equal to the target number of coded bits, the first variable adjustment factor is determined based on the adjustment factors obtained in the last two times.
[0031] Among them, based on the adjustment factor of the i-th cycle processing and the adjustment factor of the i-1-th cycle processing of the first cycle mode, the implementation process of determining the first variable adjustment factor includes: determining the average value of the adjustment factor of the i-th cycle processing and the adjustment factor of the i-1-th cycle processing, and determining the first variable adjustment factor based on the average value.
[0032] The average value may be directly determined as the first variable adjustment factor, or the average value may be multiplied by a preset constant to obtain the first variable adjustment factor. Optionally, the constant may be less than 1.
[0033] Of course, the implementation process of determining the adjustment factor of the first variable based on the adjustment factor of the i-th cycle processing and the adjustment factor of the i-1-th cycle processing of the first cycle method can also be: based on the adjustment factor of the i-th cycle processing and the adjustment factor of the i-1-th cycle processing, determine the adjustment factor of the first variable through the second cycle method.
[0034] As an example, the j-th loop processing of the second loop mode includes the following steps: determining the third adjustment factor of the j-th loop processing based on the first adjustment factor of the j-th loop processing and the second adjustment factor of the j-th loop processing, wherein, when j is equal to 1, the first adjustment factor of the j-th loop processing is one of the adjustment factor of the ith loop processing and the adjustment factor of the i-1-th loop processing, the second adjustment factor of the j-th loop processing is the other of the adjustment factor of the ith loop processing and the adjustment factor of the i-1-th loop processing, the first adjustment factor of the j-th loop processing corresponds to the j-th first number of coded bits, the second adjustment factor of the j-th loop processing corresponds to the j-th second number of coded bits, the j-th first number of coded bits refers to the number of coded bits of the entropy coding result of the first latent variable adjusted by the first adjustment factor of the j-th loop processing, the j-th second number of coded bits refers to the number of coded bits of the entropy coding result of the first latent variable adjusted by the second adjustment factor of the j-th loop processing, and the j-th first number of coded bits is less than the j-th second number of coded bits. The third number of coded bits for the jth time is obtained, and the third number of coded bits for the jth time refers to the number of coded bits of the entropy coding result of the first latent variable after the third adjustment factor of the jth loop processing is adjusted. If the third number of coded bits for the jth time does not meet the condition for continuing the loop, the execution of the second loop mode is terminated, and the third adjustment factor of the jth loop processing is determined as the first variable adjustment factor. If the third number of coded bits for the jth time meets the condition for continuing the loop, the third number of coded bits for the jth time is greater than the target number of coded bits and less than the second number of coded bits for the jth time, the third adjustment factor of the jth loop processing is used as the second adjustment factor of the j+1th loop processing, and the first adjustment factor of the jth loop processing is used as the first adjustment factor of the j+1th loop processing, and the j+1th loop processing of the second loop mode is executed. If the third number of encoded bits for the jth time meets the condition for continuing the loop, and the third number of encoded bits for the jth time is less than the target number of encoded bits and greater than the first number of encoded bits for the jth time, the third adjustment factor of the jth loop processing is used as the first adjustment factor of the j+1th loop processing, and the second adjustment factor of the jth loop processing is used as the second adjustment factor of the j+1th loop processing, and the j+1th loop processing of the second loop mode is executed.
[0035] As another example, the j-th loop processing of the second loop mode includes the following steps: determining the third adjustment factor of the j-th loop processing based on the first adjustment factor of the j-th loop processing and the second adjustment factor of the j-th loop processing, wherein, when j is equal to 1, the first adjustment factor of the j-th loop processing is one of the adjustment factor of the i-th loop processing and the adjustment factor of the i-1-th loop processing, the second adjustment factor of the j-th loop processing is the other of the adjustment factor of the i-th loop processing and the adjustment factor of the i-1-th loop processing, the first adjustment factor of the j-th loop processing corresponds to the j-th first number of coded bits, the second adjustment factor of the j-th loop processing corresponds to the j-th second number of coded bits, the j-th first number of coded bits is less than the j-th second number of coded bits, and j is a positive integer. Obtaining the j-th third number of coded bits, the j-th third number of coded bits refers to the number of coded bits of the entropy coding result of the first latent variable adjusted by the third adjustment factor of the j-th loop processing. If the third number of coded bits of the jth time does not meet the condition for continuing the loop, the execution of the second loop mode is terminated, and the third adjustment factor of the jth loop processing is determined as the first variable adjustment factor. If j reaches the maximum number of loops and the third number of coded bits of the jth time meets the condition for continuing the loop, the execution of the second loop mode is terminated, and the first variable adjustment factor is determined based on the first adjustment factor of the jth loop processing. If j does not reach the maximum number of loops, the third number of coded bits of the jth time meets the condition for continuing the loop, and the third number of coded bits of the jth time is greater than the target number of coded bits and less than the second number of coded bits of the jth time, the third adjustment factor of the jth loop processing is used as the second adjustment factor of the j+1th loop processing, and the first adjustment factor of the jth loop processing is used as the first adjustment factor of the j+1th loop processing, and the j+1th loop processing of the second loop mode is executed. If j has not reached the maximum number of loops, the third number of coded bits for the jth time meets the condition for continuing the loop, and the third number of coded bits for the jth time is less than the target number of coded bits and greater than the first number of coded bits for the jth time, the third adjustment factor of the jth loop processing is used as the first adjustment factor of the j+1th loop processing, and the second adjustment factor of the jth loop processing is used as the second adjustment factor of the j+1th loop processing, and the j+1th loop processing of the second loop mode is executed.
[0036] The implementation process of determining the third adjustment factor of the j-th loop processing based on the first adjustment factor of the j-th loop processing and the second adjustment factor of the j-th loop processing includes: determining the average value of the first adjustment factor of the j-th loop processing and the second adjustment factor of the j-th loop processing, and determining the third adjustment factor of the j-th loop processing based on the average value. As an example, the average value can be directly determined as the third adjustment factor of the j-th loop processing, or the average value can be multiplied by a preset constant to obtain the third adjustment factor of the j-th loop processing. Optionally, the constant can be less than 1.
[0037] In addition, the implementation process of obtaining the third number of coded bits for the jth time includes: adjusting the first latent variable based on the third adjustment factor processed in the jth loop to obtain the adjusted first latent variable, quantizing the adjusted first latent variable to obtain the quantized first latent variable, performing entropy coding on the quantized first latent variable, and counting the number of coded bits of the entropy coding result to obtain the third number of coded bits for the jth time.
[0038] Wherein, in the case of encoding the media data to be encoded using a fixed bit rate, the implementation process of determining the first variable adjustment factor based on the first adjustment factor of the j-th loop processing includes: determining the first adjustment factor of the j-th loop processing as the first variable adjustment factor. In the case of encoding the media data to be encoded using a variable bit rate, the implementation process of determining the first variable adjustment factor based on the first adjustment factor of the j-th loop processing includes: determining a first difference between the target number of encoded bits and the first number of encoded bits for the j-th time, and determining a second difference between the second number of encoded bits for the j-th time and the target number of encoded bits. If the first difference is less than the second difference, the first adjustment factor of the j-th loop processing is determined as the first variable adjustment factor. If the second difference is less than the first difference, the second adjustment factor of the j-th loop processing is determined as the first variable adjustment factor. If the first difference is equal to the second difference, the first adjustment factor of the j-th loop processing is determined as the first variable adjustment factor, or the second adjustment factor of the j-th loop processing is determined as the first variable adjustment factor.
[0039] Wherein, when a fixed bit rate is used to encode the media data to be encoded, the condition for continuing the loop includes that the third number of encoded bits for the jth time is greater than the target number of encoded bits, or the condition for continuing the loop includes that the third number of encoded bits for the jth time is less than the target number of encoded bits, and the difference between the target number of encoded bits and the third number of encoded bits for the jth time is greater than the bit number threshold. When a variable bit rate is used to encode the media data to be encoded, the condition for continuing the loop includes that the absolute value of the difference between the target number of encoded bits and the third number of encoded bits for the jth time is greater than the bit number threshold. That is, the condition for continuing the loop includes that the third number of encoded bits for the jth time is greater than the target number of encoded bits, and the difference between the third number of encoded bits for the jth time and the target number of encoded bits is greater than the bit number threshold, or the condition for continuing the loop includes that the third number of encoded bits for the jth time is less than the target number of encoded bits, and the difference between the target number of encoded bits and the third number of encoded bits for the jth time is greater than the bit number threshold.
[0040] In a second implementation, when the initial number of coding bits is equal to the target number of coding bits, the first initial adjustment factor is determined as the first variable adjustment factor. When the initial number of coding bits is not equal to the target number of coding bits, the first variable adjustment factor is determined according to the first implementation. However, different from the first implementation, when the initial number of coding bits is less than the target number of coding bits, the adjustment factor of the i-1th cycle processing of the first cycle mode is adjusted according to the first step size to obtain the adjustment factor of the i-th cycle processing. At this time, the condition for continuing to adjust includes that the i-th number of coding bits is less than the target number of coding bits. When the initial number of coding bits is greater than the target number of coding bits, the adjustment factor of the i-1th cycle processing of the first cycle mode is adjusted according to the second step size to obtain the adjustment factor of the i-th cycle processing. At this time, the condition for continuing to adjust includes that the i-th number of coding bits is greater than the target number of coding bits.
[0041] Among them, adjusting the adjustment factor of the i-1th cycle processing of the first cycle mode according to the first step size may refer to increasing the adjustment factor of the i-1th cycle processing according to the first step size, and adjusting the adjustment factor of the i-1th cycle processing of the first cycle mode according to the second step size may refer to reducing the adjustment factor of the i-1th cycle processing according to the second step size.
[0042] The above-mentioned increase process and decrease process can be linear or nonlinear. For example, the sum of the adjustment factor of the i-1th cycle process and the first step length can be determined as the adjustment factor of the i-th cycle process, and the difference between the adjustment factor of the i-1th cycle process and the second step length can be determined as the adjustment factor of the i-th cycle process.
[0043] It should be noted that the first step length and the second step length may be pre-set, and the first step length and the second step length may be adjusted based on different requirements. In addition, the first step length and the second step length may be equal or unequal.
[0044] In a third implementation, when the initial number of coding bits is less than or equal to the target number of coding bits, the first initial adjustment factor is determined as the first variable adjustment factor. When the initial number of coding bits is greater than the target number of coding bits, the first variable adjustment factor can be determined according to the first implementation. The first variable adjustment factor can also be determined according to the second implementation in which the initial number of coding bits is greater than the target number of coding bits.
[0045] In the second case, based on the first case, the entropy coding result of the third latent variable is also obtained, the third latent variable is determined based on the second latent variable through the context model, and the third latent variable is used to indicate the probability distribution of the second latent variable; the entropy coding result of the third latent variable is written into the bitstream. The total number of coded bits of the entropy coding result of the second latent variable and the entropy coding result of the third latent variable meets the preset coding rate condition.
[0046] Wherein, determining the first variable adjustment factor based on the first latent variable includes: determining an initial number of coding bits based on the first latent variable; and determining the first variable adjustment factor based on the initial number of coding bits and a target number of coding bits.
[0047] There are two ways to determine the initial number of coding bits based on the first latent variable, which will be introduced below respectively.
[0048] In a first implementation, based on the first latent variable, the corresponding context initial coding bit number and initial entropy coding model parameters are determined through a context model, and based on the initial entropy coding model parameters, the coding bit number of the entropy coding result of the first latent variable is determined to obtain a basic initial coding bit number. The initial coding bit number is determined based on the context initial coding bit number and the basic initial coding bit number.
[0049] Among them, the context model includes a context coding neural network model and a context decoding neural network model. Based on the first latent variable, the implementation process of determining the corresponding context initial coding bit number and initial entropy coding model parameters through the context model includes: processing the first latent variable through the context coding neural network model to obtain a fifth latent variable, and the fifth latent variable is used to indicate the probability distribution of the first latent variable. Determine the entropy coding result of the fifth latent variable, and use the coding bit number of the entropy coding result of the fifth latent variable as the context initial coding bit number. Reconstruct the fifth latent variable based on the entropy coding result of the fifth latent variable, and process the reconstructed fifth latent variable through the context decoding neural network model to obtain the initial entropy coding model parameters.
[0050] In a second implementation, the first preset adjustment factor is used as the first initial adjustment factor, the first latent variable is adjusted based on the first initial adjustment factor, the corresponding context initial coding bit number and initial entropy coding model parameters are determined through the context model based on the adjusted first latent variable, and the number of coding bits of the entropy coding result of the adjusted first latent variable is determined based on the initial entropy coding model parameters to obtain the basic initial coding bit number. The initial coding bit number is determined based on the context initial coding bit number and the basic initial coding bit number.
[0051] Among them, the context model includes a context coding neural network model and a context decoding neural network model. Based on the adjusted first latent variable, the implementation process of determining the corresponding context initial coding bit number and initial entropy coding model parameters through the context model includes: processing the adjusted first latent variable through the context coding neural network model to obtain a sixth latent variable, and the sixth latent variable is used to indicate the probability distribution of the adjusted first latent variable. Determine the entropy coding result of the sixth latent variable, and use the coding bit number of the entropy coding result of the sixth latent variable as the context initial coding bit number. Reconstruct the sixth latent variable based on the entropy coding result of the sixth latent variable, and process the reconstructed sixth latent variable through the context decoding neural network model to obtain the initial entropy coding model parameters.
[0052] There are multiple implementations of determining the first variable adjustment factor based on the initial number of coding bits and the target number of coding bits, three of which are introduced below.
[0053] In a first implementation, when the initial number of coding bits is equal to the target number of coding bits, the first initial adjustment factor is determined as the first variable adjustment factor. When the initial number of coding bits is not equal to the target number of coding bits, the first variable adjustment factor is determined in a first loop based on the initial number of coding bits and the target number of coding bits.
[0054] The i-th loop processing of the first loop mode includes the following steps: determining the adjustment factor of the i-th loop processing, i is a positive integer, adjusting the first latent variable based on the adjustment factor of the i-th loop processing, and obtaining the i-th adjusted first latent variable. Based on the i-th adjusted first latent variable, determining the corresponding i-th context coding bit number and the i-th entropy coding model parameter through the context model, determining the number of coded bits of the entropy coding result of the i-th adjusted first latent variable based on the i-th entropy coding model parameter, obtaining the i-th basic coding bit number, and determining the i-th coding bit number based on the i-th context coding bit number and the i-th basic coding bit number. If the i-th coding bit number meets the condition for continued adjustment, the i+1-th loop processing of the first loop mode is executed. If the i-th coding bit number does not meet the condition for continued adjustment, the execution of the first loop mode is terminated, and the first variable adjustment factor is determined based on the adjustment factor of the i-th loop processing.
[0055] In a second implementation, when the initial number of coding bits is equal to the target number of coding bits, the first initial adjustment factor is determined as the first variable adjustment factor. When the initial number of coding bits is not equal to the target number of coding bits, the first variable adjustment factor is determined according to the first implementation. However, different from the first implementation, when the initial number of coding bits is less than the target number of coding bits, the adjustment factor of the i-1th cycle processing of the first cycle mode is adjusted according to the first step size to obtain the adjustment factor of the i-th cycle processing. At this time, the condition for continuing to adjust includes that the i-th number of coding bits is less than the target number of coding bits. When the initial number of coding bits is greater than the target number of coding bits, the adjustment factor of the i-1th cycle processing of the first cycle mode is adjusted according to the second step size to obtain the adjustment factor of the i-th cycle processing. At this time, the condition for continuing to adjust includes that the i-th number of coding bits is greater than the target number of coding bits.
[0056] Among them, adjusting the adjustment factor of the i-1th cycle processing of the first cycle mode according to the first step size may refer to increasing the adjustment factor of the i-1th cycle processing according to the first step size, and adjusting the adjustment factor of the i-1th cycle processing of the first cycle mode according to the second step size may refer to reducing the adjustment factor of the i-1th cycle processing according to the second step size.
[0057] The above-mentioned increase process and decrease process can be linear or nonlinear. For example, the sum of the adjustment factor of the i-1th cycle process and the first step length can be determined as the adjustment factor of the i-th cycle process, and the difference between the adjustment factor of the i-1th cycle process and the second step length can be determined as the adjustment factor of the i-th cycle process.
[0058] It should be noted that the first step length and the second step length may be pre-set, and the first step length and the second step length may be adjusted based on different requirements. In addition, the first step length and the second step length may be equal or unequal.
[0059] In a third implementation, when the initial number of coding bits is less than or equal to the target number of coding bits, the first initial adjustment factor is determined as the first variable adjustment factor. When the initial number of coding bits is greater than the target number of coding bits, the first variable adjustment factor can be determined according to the first implementation. The first variable adjustment factor can also be determined according to the second implementation in which the initial number of coding bits is greater than the target number of coding bits.
[0060] In the third case, based on the first case, the second variable adjustment factor is also determined based on the first latent variable; the entropy coding result of the fourth latent variable is obtained, the fourth latent variable is obtained by adjusting the third latent variable based on the second variable adjustment factor, the third latent variable is determined based on the second latent variable through the context model, and the third latent variable is used to indicate the probability distribution of the second latent variable; the entropy coding result of the fourth latent variable and the coding result of the second variable adjustment factor are written into the bitstream; wherein the total number of coding bits of the entropy coding result of the second latent variable and the entropy coding result of the fourth latent variable meet the preset coding rate condition.
[0061] There are two ways to determine the first variable adjustment factor and the second variable adjustment factor based on the first latent variable, which are:
[0062] The first implementation method is to determine the corresponding context initial coding bit number and initial entropy coding model parameters through the context model based on the first latent variable; determine the coding bit number of the entropy coding result of the first latent variable based on the initial entropy coding model parameters to obtain the basic initial coding bit number; determine the first variable adjustment factor and the second variable adjustment factor based on the context initial coding bit number, the basic initial coding bit number and the target coding bit number.
[0063] In a second implementation, the first preset adjustment factor is used as the first initial adjustment factor, and the second preset adjustment factor is used as the second initial adjustment factor. The first latent variable is adjusted based on the first initial adjustment factor, and the corresponding context initial coding bit number and initial entropy coding model parameters are determined through the context model based on the adjusted first latent variable and the second initial adjustment factor. Based on the initial entropy coding model parameters, the coding bit number of the entropy coding result of the first latent variable is determined to obtain the basic initial coding bit number. The first variable adjustment factor and the second variable adjustment factor are determined based on the context initial coding bit number, the basic initial coding bit number and the target coding bit number.
[0064] Among them, the context model includes a context coding neural network model and a context decoding neural network model. Based on the adjusted first latent variable and the second initial adjustment factor, the implementation process of determining the corresponding context initial coding bit number and initial entropy coding model parameters through the context model includes: processing the adjusted first latent variable through the context coding neural network model to obtain a sixth latent variable, and the sixth latent variable is used to indicate the probability distribution of the adjusted first latent variable. Adjust the sixth latent variable based on the second initial adjustment factor to obtain a seventh latent variable. Determine the entropy coding result of the seventh latent variable, and use the coding bit number of the entropy coding result of the seventh latent variable as the context initial coding bit number. Reconstruct the seventh latent variable based on the entropy coding result of the seventh latent variable, and process the reconstructed seventh latent variable through the context decoding neural network model to obtain the initial entropy coding model parameters.
[0065] The implementation process of adjusting the sixth latent variable based on the second initial adjustment factor is: multiplying each element in the sixth latent variable by the corresponding element in the second initial adjustment factor to obtain the seventh latent variable.
[0066] It is worth noting that the above implementation process is only an example. In actual applications, other methods can also be used for adjustment. For example, each element in the sixth potential variable can be divided by the corresponding element in the second initial adjustment factor to obtain the seventh potential variable. The embodiment of the present application does not limit the adjustment method.
[0067] Among them, based on the context initial coding bit number, the basic initial coding bit number and the target coding bit number, the implementation process of determining the first variable adjustment factor and the second variable adjustment factor may include two methods, which are introduced below respectively.
[0068] In a first implementation, the second variable adjustment factor is set to the second initial adjustment factor, and the basic target number of coding bits is determined based on at least one of the basic initial number of coding bits and the context initial number of coding bits, as well as the target number of coding bits. Based on the second initial adjustment factor, the basic target number of coding bits, and the basic initial number of coding bits, the first variable adjustment factor and the basic actual number of coding bits are determined, where the basic actual number of coding bits refers to the number of coding bits of the entropy coding result of the first latent variable adjusted by the first variable adjustment factor. Based on the target number of coding bits and the basic actual number of coding bits, the context target number of coding bits is determined. Based on the context target number of coding bits and the context initial number of coding bits, the second variable adjustment factor is determined.
[0069] Among them, based on at least one of the basic initial coding bit number and the context initial coding bit number, and the target coding bit number, the implementation process of determining the basic target coding bit number includes: subtracting the context initial coding bit number from the target coding bit number to obtain the basic target coding bit number. Alternatively, determine the ratio between the basic initial coding bit number and the context initial coding bit number, and determine the basic target coding bit number based on the ratio and the target coding bit number. Alternatively, determine the basic target coding bit number based on the ratio of the target coding bit number to the basic initial coding bit number. Of course, it can also be determined through other implementation processes.
[0070] Among them, there are also three implementation methods for determining the first variable adjustment factor based on the second initial adjustment factor, the basic target number of coding bits and the basic initial number of coding bits, which are introduced below respectively.
[0071] Mode 11: When the basic initial coding bit number is equal to the basic target coding bit number, the first initial adjustment factor is determined as the first variable adjustment factor. When the basic initial coding bit number is not equal to the basic target coding bit number, the first variable adjustment factor is determined through a first loop mode based on the basic initial coding bit number and the basic target coding bit number.
[0072] The i-th loop processing of the first loop mode includes the following steps: determining the adjustment factor of the i-th loop processing, i is a positive integer, adjusting the first latent variable based on the adjustment factor of the i-th loop processing, and obtaining the first latent variable after the i-th adjustment. Based on the i-th adjusted first latent variable and the second initial adjustment factor, determining the i-th context coding bit number and the i-th entropy coding model parameter through the context model, determining the number of coded bits of the entropy coding result of the i-th adjusted first latent variable based on the i-th entropy coding model parameter, obtaining the i-th basic coding bit number, and determining the i-th coding bit number based on the i-th context coding bit number and the i-th basic coding bit number. If the i-th coding bit number meets the condition for continuing adjustment, the i+1-th loop processing of the first loop mode is executed. If the i-th coding bit number does not meet the condition for continuing adjustment, the execution of the first loop mode is terminated, and the first variable adjustment factor is determined based on the adjustment factor of the i-th loop processing.
[0073] Mode 12, when the basic initial number of coding bits is equal to the basic target number of coding bits, the first initial adjustment factor is determined as the first variable adjustment factor. When the basic initial number of coding bits is not equal to the basic target number of coding bits, the first variable adjustment factor is determined according to the above-mentioned mode 11. However, different from the above-mentioned mode 11, when the basic initial number of coding bits is less than the basic target number of coding bits, the adjustment factor of the i-1th loop processing of the first loop mode is adjusted according to the first step length to obtain the adjustment factor of the i-th loop processing. At this time, the condition for continuing to adjust includes that the i-th number of coding bits is less than the basic target number of coding bits. When the basic initial number of coding bits is greater than the basic target number of coding bits, the adjustment factor of the i-1th loop processing of the first loop mode is adjusted according to the second step length to obtain the adjustment factor of the i-th loop processing. At this time, the condition for continuing to adjust includes that the i-th number of coding bits is greater than the basic target number of coding bits.
[0074] Mode 13: When the basic initial coding bit number is less than or equal to the basic target coding bit number, the first initial adjustment factor is determined as the first variable adjustment factor. When the basic initial coding bit number is greater than the basic target coding bit number, the first variable adjustment factor can be determined according to the above mode 11. The first variable adjustment factor can also be determined according to the above mode 12 when the basic initial coding bit number is greater than the basic target coding bit number.
[0075] The implementation process of determining the second variable adjustment factor based on the context target coding bit number and the context initial coding bit number is similar to the implementation process of determining the first variable adjustment factor based on the basic initial coding bit number and the basic target coding bit number. The following is also divided into three ways to introduce them respectively.
[0076] Mode 21, when the number of initial coding bits of the context is equal to the number of target coding bits of the context, the second initial adjustment factor is determined as the second variable adjustment factor. When the number of initial coding bits of the context is not equal to the number of target coding bits of the context, the first latent variable is adjusted based on the first variable adjustment factor to obtain the second latent variable. Based on the number of initial coding bits of the context, the number of target coding bits of the context and the second latent variable, the second variable adjustment factor is determined through the first loop mode.
[0077] The i-th loop processing of the first loop mode includes the following steps: determining the adjustment factor of the i-th loop processing, i is a positive integer, based on the second latent variable and the adjustment factor of the i-th loop processing, determining the i-th context coding bit number and the i-th entropy coding model parameter through the context model, determining the number of coded bits of the entropy coding result of the second latent variable based on the i-th entropy coding model parameter, obtaining the i-th basic coding bit number, and determining the i-th coding bit number based on the i-th context coding bit number and the i-th basic coding bit number. If the i-th coding bit number meets the condition for continued adjustment, the i+1-th loop processing of the first loop mode is executed. If the i-th coding bit number does not meet the condition for continued adjustment, the execution of the first loop mode is terminated, and the second variable adjustment factor is determined based on the adjustment factor of the i-th loop processing.
[0078] The implementation process of determining the i-th context coding bit number and the i-th entropy coding model parameter through the context model based on the second latent variable and the adjustment factor of the i-th loop processing includes: processing the second latent variable through the context coding neural network model to obtain a third latent variable, and the third latent variable is used to indicate the probability distribution of the second latent variable. Adjusting the third latent variable based on the adjustment factor of the i-th loop processing to obtain the i-th adjusted third latent variable. Determining the entropy coding result of the i-th adjusted third latent variable, and using the number of coded bits of the entropy coding result of the i-th adjusted third latent variable as the i-th context coding bit number. Reconstructing the i-th adjusted third latent variable based on the entropy coding result of the i-th adjusted third latent variable. Adjusting the reconstructed i-th adjusted third latent variable through the adjustment factor of the i-th loop processing to obtain the reconstructed third latent variable. Processing the reconstructed third latent variable through the context decoding neural network model to obtain the i-th entropy coding model parameter.
[0079] Mode 22, when the number of initial coding bits of the context is equal to the number of target coding bits of the context, the second initial adjustment factor is determined as the second variable adjustment factor. When the number of initial coding bits of the context is not equal to the number of target coding bits of the context, the second variable adjustment factor is determined according to the above-mentioned mode 21. However, different from the above-mentioned mode 21, when the number of initial coding bits of the context is less than the number of target coding bits of the context, the adjustment factor of the i-1th loop processing of the first loop mode is adjusted according to the first step size to obtain the adjustment factor of the i-th loop processing, and at this time, the condition for continuing to adjust includes that the number of coding bits for the i-1th time is less than the number of target coding bits of the context. When the number of initial coding bits of the context is greater than the number of target coding bits of the context, the adjustment factor of the i-1th loop processing of the first loop mode is adjusted according to the second step size to obtain the adjustment factor of the i-th loop processing, and at this time, the condition for continuing to adjust includes that the number of coding bits for the i-1th time is greater than the number of target coding bits of the context.
[0080] Mode 23, when the number of initial coding bits of the context is less than or equal to the number of target coding bits of the context, the second initial adjustment factor is determined as the second variable adjustment factor. When the number of initial coding bits of the context is greater than the number of target coding bits of the context, the second variable adjustment factor can be determined according to the above mode 21. The second variable adjustment factor can also be determined according to the above mode 22 when the number of initial coding bits of the context is greater than the number of target coding bits of the context.
[0081] In a second implementation, the target coding bit number is divided into a basic target coding bit number and a context target coding bit number, and a first variable adjustment factor is determined based on the basic target coding bit number and the basic initial coding bit number. A second variable adjustment factor is determined based on the context target coding bit number and the context initial coding bit number.
[0082] In the second aspect, a decoding method is provided, in which a plurality of situations are also introduced.
[0083] In the first case, a reconstructed second latent variable and a reconstructed first variable adjustment factor are determined based on the bitstream; based on the reconstructed first variable adjustment factor, the reconstructed second latent variable is adjusted to obtain a reconstructed first latent variable, and the reconstructed first latent variable is used to indicate the characteristics of the media data to be decoded; the reconstructed first latent variable is processed by a first decoding neural network model to obtain the reconstructed media data.
[0084] In the second case, the reconstructed third latent variable and the reconstructed first variable adjustment factor are determined based on the bitstream; the reconstructed second latent variable is determined based on the bitstream and the reconstructed third latent variable. The reconstructed second latent variable is adjusted based on the reconstructed first variable adjustment factor to obtain a reconstructed first latent variable, and the reconstructed first latent variable is used to indicate the characteristics of the media data to be decoded; the reconstructed first latent variable is processed by the first decoding neural network model to obtain the reconstructed media data.
[0085] Wherein, based on the bitstream and the reconstructed third latent variable, determining the reconstructed second latent variable includes: processing the reconstructed third latent variable through a context decoding neural network model to obtain a reconstructed first entropy coding model parameter; based on the bitstream and the reconstructed first entropy coding model parameter, determining the reconstructed second latent variable.
[0086] In the third case, the reconstructed fourth latent variable, the reconstructed second variable adjustment factor and the reconstructed first variable adjustment factor are determined based on the bitstream; the reconstructed second latent variable is determined based on the bitstream, the reconstructed fourth latent variable and the reconstructed second variable adjustment factor. The reconstructed second latent variable is determined based on the bitstream and the reconstructed third latent variable. The reconstructed second latent variable is adjusted based on the reconstructed first variable adjustment factor to obtain a reconstructed first latent variable, and the reconstructed first latent variable is used to indicate the characteristics of the media data to be decoded; the reconstructed first latent variable is processed by the first decoding neural network model to obtain the reconstructed media data.
[0087] Wherein, based on the bitstream, the reconstructed fourth latent variable and the reconstructed second variable adjustment factor, the reconstructed second latent variable is determined, including: based on the reconstructed second variable adjustment factor, the reconstructed fourth latent variable is adjusted to obtain a reconstructed third latent variable; the reconstructed third latent variable is processed by a context decoding neural network model to obtain a reconstructed second entropy coding model parameter; based on the bitstream and the reconstructed second entropy coding model parameter, the reconstructed second latent variable is determined.
[0088] The media data is an audio signal, a video signal or an image.
[0089] In a third aspect, a coding device is provided, wherein the coding device has the function of implementing the coding method in the first aspect. The coding device includes at least one module, and the at least one module is used to implement the coding method provided in the first aspect.
[0090] In a fourth aspect, a decoding device is provided, wherein the decoding device has the function of implementing the decoding method in the second aspect. The decoding device comprises at least one module, wherein the at least one module is used to implement the decoding method provided in the second aspect.
[0091] In a fifth aspect, a coding end device is provided, the coding end device comprising a processor and a memory, the memory being used to store a program for executing the coding method provided in the first aspect. The processor is configured to execute the program stored in the memory to implement the coding method provided in the first aspect.
[0092] Optionally, the encoding end device may further include a communication bus, and the communication bus is used to establish a connection between the processor and the memory.
[0093] In a sixth aspect, a decoding end device is provided, the decoding end device comprising a processor and a memory, the memory being used to store a program for executing the decoding method provided in the second aspect. The processor is configured to execute the program stored in the memory to implement the decoding method provided in the second aspect.
[0094] Optionally, the decoding end device may further include a communication bus, and the communication bus is used to establish a connection between the processor and the memory.
[0095] In the seventh aspect, a computer-readable storage medium is provided, wherein the storage medium stores instructions, and when the instructions are executed on a computer, the computer executes the steps of the encoding method described in the first aspect above, or executes the steps of the decoding method described in the second aspect above.
[0096] In an eighth aspect, a computer program product comprising instructions is provided, and when the instructions are executed on a computer, the computer is caused to execute the steps of the encoding method described in the first aspect, or the steps of the decoding method described in the second aspect. In other words, a computer program is provided, and when the computer program is executed, the steps of the encoding method described in the first aspect, or the steps of the decoding method described in the second aspect are implemented.
[0097] In a ninth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium includes a code stream obtained by the encoding method described in the first aspect.
[0098] In a tenth aspect, there is provided an encoded bitstream, the bitstream comprising: an entropy encoding result of a second latent variable and an encoding result of a first variable adjustment factor;
[0099] The second latent variable is obtained by adjusting the first latent variable by the first variable adjustment factor, the first variable adjustment factor is determined based on the first latent variable, and the first variable adjustment factor is used to make the number of coded bits of the entropy coding result of the second latent variable meet a preset coding rate condition;
[0100] The first latent variable is obtained by processing the audio signal to be encoded through a first encoding neural network model, and the first latent variable is used to indicate a feature of the audio signal to be encoded.
[0101] In an eleventh aspect, there is provided an encoded bitstream, the bitstream comprising: an entropy encoding result of a second latent variable, an entropy encoding result of a third latent variable, and an encoding result of a first variable adjustment factor;
[0102] The second latent variable is obtained by adjusting the first latent variable by the first variable adjustment factor, the first variable adjustment factor is determined based on the first latent variable, and the first variable adjustment factor is used to make the number of coded bits of the entropy coding result of the second latent variable meet a preset coding rate condition;
[0103] The first latent variable is obtained by processing the audio signal to be encoded by a first encoding neural network model, and the first latent variable is used to indicate a feature of the audio signal to be encoded;
[0104] The third latent variable is determined based on the second latent variable through a context model, and the total number of coded bits of the entropy coding result of the third latent variable and the entropy coding result of the second latent variable meets the preset coding rate condition.
[0105] In a twelfth aspect, there is provided an encoded bitstream, the bitstream comprising: an entropy encoding result of a second latent variable, an entropy encoding result of a fourth latent variable, an encoding result of a first variable adjustment factor, and an encoding result of a second variable adjustment factor;
[0106] The second latent variable is obtained by adjusting the first latent variable by the first variable adjustment factor, the first variable adjustment factor is determined based on the first latent variable, and the first variable adjustment factor is used to make the number of coded bits of the entropy coding result of the second latent variable meet a preset coding rate condition;
[0107] The first latent variable is obtained by processing the audio signal to be encoded by a first encoding neural network model, and the first latent variable is used to indicate a feature of the audio signal to be encoded;
[0108] The fourth latent variable is obtained by adjusting the third latent variable based on the second variable adjustment factor, the second variable adjustment factor is determined based on the first latent variable, the third latent variable is determined based on the second latent variable through a context model, and the total number of encoded bits of the entropy encoding result of the fourth latent variable and the entropy encoding result of the second latent variable meet the preset coding rate condition.
[0109] The technical effects obtained in the above-mentioned third to twelfth aspects are similar to the technical effects obtained by the corresponding technical means in the first or second aspect, and will not be repeated here.
[0110] The technical solution provided by the embodiments of the present application can at least bring the following beneficial effects:
[0111] The first latent variable is adjusted by the first variable adjustment factor to obtain the second latent variable, and the number of coded bits of the entropy coding result of the second latent variable meets the preset coding rate condition, so that the number of coded bits of the entropy coding result of the latent variable corresponding to each frame of media data can meet the preset coding rate condition, that is, the number of coded bits of the entropy coding result of the latent variable corresponding to each frame of media data can be guaranteed to be basically consistent, rather than dynamically changing, thereby meeting the encoder's demand for a stable coding rate. Further, considering the need to transmit side information (such as window type, time domain noise shaping (TNS: Temporal Noise Shaping) parameters, frequency domain noise shaping (FDNS: Frequency-domain noise shaping) parameters, and / or bandwidth extension (BWE: bandwidth extension) parameters, etc.), it can be ensured that the number of coded bits of the entropy coding result of the latent variable corresponding to each frame of media data and the number of coded bits of the side information are basically consistent as a whole, thereby meeting the encoder's demand for a stable coding rate. BRIEF DESCRIPTION OF THE DRAWINGS
[0112] Figure 1 It is a schematic diagram of an implementation environment provided by an embodiment of the present application;
[0113] Figure 2 It is a schematic diagram of an implementation environment of a terminal scenario provided in an embodiment of the present application;
[0114] Figure 3 It is a schematic diagram of an implementation environment of a transcoding scenario of a wireless or core network device provided in an embodiment of the present application;
[0115] Figure 4 is a schematic diagram of an implementation environment of a broadcasting and television scenario provided in an embodiment of the present application;
[0116] Figure 5 It is a schematic diagram of an implementation environment of a virtual reality streaming scene provided in an embodiment of the present application;
[0117] Figure 6 is a flowchart of the first encoding method provided in an embodiment of the present application;
[0118] Figure 7It is a schematic diagram of the form of the first potential variable provided in the embodiment of the present application;
[0119] Figure 8 It is a schematic diagram of the form of the second potential variable provided in the embodiment of the present application;
[0120] Fig. 9 is a flowchart of a first decoding method provided in an embodiment of the present application;
[0121] Fig.10 is a flowchart of a second encoding method provided in an embodiment of the present application;
[0122] Fig.11 is a flowchart of a second decoding method provided in an embodiment of the present application;
[0123] Fig.12 This is a method provided by the embodiment of the present application. Fig.10 An exemplary block diagram of the encoding method shown;
[0124] Fig.13 This is a method provided by the embodiment of the present application. Fig.11 An exemplary block diagram of the decoding method shown;
[0125] Fig.14 is a flowchart of a third encoding method provided in an embodiment of the present application;
[0126] Fig.15 is a flowchart of a third decoding method provided in an embodiment of the present application;
[0127] Fig.16 This is a method provided by the embodiment of the present application. Fig.14 An exemplary block diagram of the encoding method shown;
[0128] Fig.17 This is a method provided by the embodiment of the present application. Fig.15 An exemplary block diagram of the decoding method shown;
[0129] Fig.18 is a schematic diagram of the structure of an encoding device provided in an embodiment of the present application;
[0130] Fig.19 is a structural diagram of a decoding device provided in an embodiment of the present application;
[0131] Fig. 20 It is a schematic block diagram of a coding and decoding device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0132] In order to make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the implementation methods of the present application will be further described in detail below in conjunction with the accompanying drawings.
[0133] Before explaining the encoding and decoding method provided in the embodiment of the present application in detail, the terms and implementation environment involved in the embodiment of the present application are first introduced.
[0134] To facilitate understanding, the terms involved in the embodiments of the present application are first explained.
[0135] Coding: refers to the process of compressing the media data to be encoded into a bitstream. The media data to be encoded mainly includes audio signals, video signals and images. The encoding of audio signals is the process of compressing the audio frame sequence included in the audio signal to be encoded into a bitstream, the encoding of video signals is the process of compressing the image sequence included in the video to be encoded into a bitstream, and the encoding of images is the process of compressing the image to be encoded into a bitstream.
[0136] It should be noted that media data compressed into a code stream may be referred to as coded media data or compressed media data. For example, for an audio signal, after being compressed into a code stream, it may be referred to as a coded audio signal or a compressed audio signal; a video signal compressed into a code stream may be referred to as a coded video signal or a compressed video signal; and an image compressed into a code stream may be referred to as a coded image or a compressed image.
[0137] Decoding: refers to the process of restoring the coded bitstream into reconstructed media data according to specific grammatical rules and processing methods. Among them, decoding of audio bitstream refers to the process of restoring the audio bitstream into reconstructed audio signals, decoding of video bitstream refers to the process of restoring the video bitstream into reconstructed video signals, and decoding of image bitstream refers to the process of restoring the image bitstream into reconstructed images.
[0138] Entropy coding: refers to coding that does not lose any information during the coding process according to the entropy principle. It is also a lossless data compression method. Entropy coding is based on the probability of occurrence of elements. That is, for the same element, when the probability of occurrence of the element is different, the number of coded bits of the entropy coding result of the element is different. Entropy coding usually includes arithmetic coding (arithmetic coding), range coding (RC), Huffman coding, etc.
[0139] Constant bit rate (CBR): refers to the encoding bit rate being a fixed value, such as the target encoding bit rate.
[0140] Variable bit rate (VBR): refers to the coding rate that can exceed the target coding rate, or can be less than the target coding rate, but the difference between the target coding rate and the target coding rate is small.
[0141] Next, the implementation environment involved in the embodiments of the present application is introduced.
[0142] Please refer to Figure 1 , Figure 1 is a schematic diagram of an implementation environment provided by an embodiment of the present application. The implementation environment includes a source device 10, a destination device 20, a link 30, and a storage device 40. Among them, the source device 10 can generate encoded media data. Therefore, the source device 10 can also be called a media data encoding device. The destination device 20 can decode the encoded media data generated by the source device 10. Therefore, the destination device 20 can also be called a media data decoding device. The link 30 can receive the encoded media data generated by the source device 10, and can transmit the encoded media data to the destination device 20. The storage device 40 can receive the encoded media data generated by the source device 10, and can store the encoded media data. Under such conditions, the destination device 20 can directly obtain the encoded media data from the storage device 40. Alternatively, the storage device 40 can correspond to a file server or another intermediate storage device that can store the encoded media data generated by the source device 10. Under such conditions, the destination device 20 can stream or download the encoded media data stored in the storage device 40.
[0143] The source device 10 and the destination device 20 may each include one or more processors and a memory coupled to the one or more processors, which may include random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory, any other medium that can be used to store desired program code in the form of instructions or data structures that can be accessed by a computer, etc. For example, the source device 10 and the destination device 20 may each include a desktop computer, a mobile computing device, a notebook (e.g., laptop) computer, a tablet computer, a set-top box, a telephone handset such as a so-called "smart" phone, a television, a camera, a display device, a digital media player, a video game console, a car computer, or the like.
[0144] The link 30 may include one or more media or devices capable of transmitting the encoded media data from the source device 10 to the destination device 20. In one possible implementation, the link 30 may include one or more communication media that enable the source device 10 to send the encoded media data directly to the destination device 20 in real time. In an embodiment of the present application, the source device 10 may modulate the encoded media data based on a communication standard, which may be a wireless communication protocol, etc., and may send the modulated media data to the destination device 20. The one or more communication media may include wireless and / or wired communication media, for example, the one or more communication media may include a radio frequency (RF) spectrum or one or more physical transmission lines. The one or more communication media may form part of a packet-based network, which may be a local area network, a wide area network, or a global network (e.g., the Internet), etc. The one or more communication media may include routers, switches, base stations, or other devices that facilitate communication from the source device 10 to the destination device 20, etc., and the embodiment of the present application does not specifically limit this.
[0145] In a possible implementation, the storage device 40 may store the received encoded media data sent by the source device 10, and the destination device 20 may directly obtain the encoded media data from the storage device 40. Under such conditions, the storage device 40 may include any of a variety of distributed or locally accessible data storage media, for example, any of the multiple distributed or locally accessible data storage media may be a hard disk drive, a Blu-ray disc, a digital versatile disc (DVD), a compact disc read-only memory (CD-ROM), a flash memory, a volatile or non-volatile memory, or any other suitable digital storage medium for storing encoded media data.
[0146] In one possible implementation, the storage device 40 may correspond to a file server or another intermediate storage device that can store the encoded media data generated by the source device 10, and the destination device 20 may stream or download the media data stored in the storage device 40. The file server may be any type of server that can store the encoded media data and send the encoded media data to the destination device 20. In one possible implementation, the file server may include a network server, a file transfer protocol (FTP) server, a network attached storage (NAS) device, or a local disk drive, etc. The destination device 20 may obtain the encoded media data through any standard data connection (including an Internet connection). Any standard data connection may include a wireless channel (e.g., a Wi-Fi connection), a wired connection (e.g., a digital subscriber line (DSL), a cable modem, etc.), or a combination of the two suitable for obtaining the encoded media data stored on the file server. The transmission of the encoded media data from the storage device 40 may be streaming transmission, download transmission, or a combination of the two.
[0147] Figure 1 The implementation environment shown is only one possible implementation method, and the technology of the embodiment of the present application can be applied not only to Figure 1 The source device 10 that can encode media data and the destination device 20 that can decode the encoded media data shown can also be applicable to other devices that can encode media data and decode encoded media data, and the embodiments of the present application do not specifically limit this.
[0148] exist Figure 1 In the illustrated implementation, the source device 10 includes a data source 120, an encoder 100, and an output interface 140. In some embodiments, the output interface 140 may include a modulator / demodulator (modem) and / or a transmitter, where the transmitter may also be referred to as a transmitter. The data source 120 may include an image capture device (e.g., a camera, etc.), an archive containing previously captured media data, a feed interface for receiving media data from a media data content provider, and / or a computer graphics system for generating media data, or a combination of these sources of media data.
[0149] The data source 120 may send media data to the encoder 100, and the encoder 100 may encode the media data received from the data source 120 to obtain the encoded media data. The encoder may send the encoded media data to the output interface. In some embodiments, the source device 10 directly sends the encoded media data to the destination device 20 via the output interface 140. In other embodiments, the encoded media data may also be stored in the storage device 40 for the destination device 20 to obtain and use for decoding and / or display later.
[0150] exist Figure 1 In the illustrated implementation environment, the destination device 20 includes an input interface 240, a decoder 200, and a display device 220. In some embodiments, the input interface 240 includes a receiver and / or a modem. The input interface 240 may receive the encoded media data via the link 30 and / or from the storage device 40, and then send it to the decoder 200. The decoder 200 may decode the received encoded media data to obtain decoded media data. The decoder may send the decoded media data to the display device 220. The display device 220 may be integrated with the destination device 20 or may be external to the destination device 20. In general, the display device 220 displays the decoded media data. The display device 220 may be any of a variety of types of display devices, for example, the display device 220 may be a liquid crystal display (LCD), a plasma display, an organic light-emitting diode (OLED) display, or other types of display devices.
[0151] although Figure 1 1 and 2. Although not shown in the drawings, in some aspects, encoder 100 and decoder 200 may be integrated with an encoder and decoder, respectively, and may include appropriate multiplexer-demultiplexer (MUX-DEMUX) units or other hardware and software for encoding both audio and video in a common data stream or in separate data streams. In some embodiments, if applicable, the MUX-DEMUX units may conform to the ITU H.223 multiplexer protocol, or other protocols such as the user datagram protocol (UDP).
[0152] The encoder 100 and the decoder 200 may each be any of the following circuits: one or more microprocessors, digital signal processors (digital signal processing, DSP), application specific integrated circuits (application specific integrated circuits, ASIC), field programmable gate arrays (field-programmable gate array, FPGA), discrete logic, hardware or any combination thereof. If the technology of the embodiment of the present application is partially implemented in software, the device may store instructions for the software in a suitable non-volatile computer-readable storage medium, and may use one or more processors to execute the instructions in hardware to implement the technology of the embodiment of the present application. Any of the foregoing contents (including hardware, software, a combination of hardware and software, etc.) may be regarded as one or more processors. Each of the encoder 100 and the decoder 200 may be included in one or more encoders or decoders, and any of the encoders or decoders may be integrated as part of a combined encoder / decoder (encoder-decoder) in a corresponding device.
[0153] The embodiments of the present application may generally refer to encoder 100 as "signaling" or "sending" certain information to another device, such as decoder 200. The term "signaling" or "sending" may generally refer to the transmission of syntax elements and / or other data used to decode the compressed media data. This transmission may occur in real time or near real time. Alternatively, this communication may occur over a period of time, such as when the syntax elements are stored in the encoded bitstream to a computer-readable storage medium at the time of encoding, and the decoding device may then retrieve the syntax elements at any time after the syntax elements are stored to this medium.
[0154] The encoding and decoding method provided in the embodiments of the present application can be applied to a variety of scenarios. Next, taking the media data to be encoded as an audio signal as an example, several scenarios are introduced respectively.
[0155] Please refer to Figure 2 , Figure 2 1 is a schematic diagram of an implementation environment of a coding and decoding method provided in an embodiment of the present application applied to a terminal scenario. The implementation environment includes a first terminal 101 and a second terminal 201, and the first terminal 101 is connected to the second terminal 201 for communication. The communication connection can be a wireless connection or a wired connection, which is not limited in the embodiment of the present application.
[0156] The first terminal 101 can be a transmitting device or a receiving device, and similarly, the second terminal 201 can be a receiving device or a transmitting device. When the first terminal 101 is a transmitting device, the second terminal 201 is a receiving device, and when the first terminal 101 is a receiving device, the second terminal 201 is a transmitting device.
[0157] Next, the first terminal 101 is used as a transmitting device and the second terminal 201 is used as a receiving device as an example for introduction.
[0158] The first terminal 101 may be the above Figure 1 The source device 10 in the implementation environment shown. The second terminal 201 can be the above Figure 1 The destination device 20 in the implementation environment shown in the figure. The first terminal 101 and the second terminal 201 both include an audio acquisition module, an audio playback module, an encoder, a decoder, a channel encoding module and a channel decoding module.
[0159] The audio acquisition module in the first terminal 101 collects the audio signal and transmits it to the encoder, which encodes the audio signal using the encoding method provided in the embodiment of the present application, which can be called source encoding. Afterwards, in order to realize the transmission of the audio signal in the channel, the channel encoding module needs to perform channel encoding again, and then transmit the encoded code stream in the digital channel through a wireless or wired network communication device.
[0160] The second terminal 201 receives the code stream transmitted in the digital channel through a wireless or wired network communication device, the channel decoding module performs channel decoding on the code stream, and then the decoder uses the decoding method provided in the embodiment of the present application to decode the audio signal, and then plays it through the audio playback module.
[0161] Among them, the first terminal 101 and the second terminal 201 can be any electronic product that can interact with the user through one or more methods such as keyboard, touchpad, touch screen, remote control, voice interaction or handwriting device, such as personal computer (PC), mobile phone, smart phone, personal digital assistant (PDA), wearable device, PPC (pocket PC), tablet computer, smart car machine, smart TV, smart speaker, etc.
[0162] Those skilled in the art should understand that the above-mentioned terminals are only examples, and other existing or future terminals, if applicable to the embodiments of the present application, should also be included in the protection scope of the embodiments of the present application and are included here by reference.
[0163] Please refer to Figure 3 , Figure 3 The embodiment of the present invention provides a coding method for implementing a transcoding scenario of a wireless or core network device, and the implementation environment includes a channel decoding module, an audio decoder, an audio encoder, and a channel coding module.
[0164] Among them, the audio decoder can be a decoder using the decoding method provided by the embodiment of the present application, or a decoder using other decoding methods. The audio encoder can be an encoder using the encoding method provided by the embodiment of the present application, or an encoder using other encoding methods. In the case where the audio decoder is a decoder using the decoding method provided by the embodiment of the present application, the audio encoder is an encoder using other encoding methods, and in the case where the audio decoder is a decoder using other decoding methods, the audio encoder is an encoder using the encoding method provided by the embodiment of the present application.
[0165] In the first case, the audio decoder is a decoder using the decoding method provided in the embodiment of the present application, and the audio encoder is an encoder using other encoding methods.
[0166] At this time, the channel decoding module is used to perform channel decoding on the received code stream, and then the audio decoder is used to perform source decoding using the decoding method provided in the embodiment of the present application, and then the audio encoder is used to encode according to other encoding methods to achieve conversion from one format to another, that is, transcoding. After that, it is sent after channel encoding.
[0167] In the second case, the audio decoder is a decoder that uses other decoding methods, and the audio encoder is an encoder that uses the encoding method provided in the embodiment of the present application.
[0168] At this time, the channel decoding module is used to perform channel decoding on the received code stream, and then the audio decoder is used to perform source decoding using other decoding methods, and then the audio encoder is used to encode using the encoding method provided in the embodiment of the present application to achieve conversion from one format to another, that is, transcoding. After that, it is sent after channel encoding.
[0169] The wireless device may be a wireless access point, a wireless router, a wireless connector, etc. The core network device may be a mobility management entity, a gateway, etc.
[0170] Those skilled in the art should understand that the above-mentioned wireless devices or core network devices are only examples, and other existing or future wireless or core network devices, if applicable to the embodiments of the present application, should also be included in the protection scope of the embodiments of the present application and are included here by reference.
[0171] Please refer to Figure 4 , Figure 41 is a schematic diagram of an implementation environment of a coding and decoding method provided by an embodiment of the present application applied to a broadcasting and television scenario. The broadcasting and television scenario is divided into a live broadcast scenario and a post-production scenario. For the live broadcast scenario, the implementation environment includes a live program 3D sound production module, a 3D sound encoding module, a set-top box and a speaker group, and the set-top box includes a 3D sound decoding module. For the post-production scenario, the implementation environment includes a post-program 3D sound production module, a 3D sound encoding module, a network receiver, a mobile terminal, headphones, etc.
[0172] In the live broadcast scenario, the live program 3D sound production module produces a 3D sound signal, which is encoded by the encoding method of the embodiment of the present application to obtain a code stream, which is transmitted to the user side via the radio and television network, and is decoded by the 3D sound decoder in the set-top box using the decoding method provided by the embodiment of the present application, thereby reconstructing the 3D sound signal, which is played back by the speaker group. Alternatively, the code stream is transmitted to the user side via the Internet, and is decoded by the 3D sound decoder in the network receiver using the decoding method provided by the embodiment of the present application, thereby reconstructing the 3D sound signal, which is played back by the speaker group. Alternatively, the code stream is transmitted to the user side via the Internet, and is decoded by the 3D sound decoder in the mobile terminal using the decoding method provided by the embodiment of the present application, thereby reconstructing the 3D sound signal, which is played back by the headphones.
[0173] In the post-production scenario, the post-production program three-dimensional sound production module produces a three-dimensional sound signal, and the three-dimensional sound signal is encoded by applying the encoding method of the embodiment of the present application to obtain a code stream, which is transmitted to the user side via the radio and television network, and is decoded by the three-dimensional sound decoder in the set-top box using the decoding method provided by the embodiment of the present application, thereby reconstructing the three-dimensional sound signal, and playing it back by the speaker group. Alternatively, the code stream is transmitted to the user side via the Internet, and is decoded by the three-dimensional sound decoder in the network receiver using the decoding method provided by the embodiment of the present application, thereby reconstructing the three-dimensional sound signal, and playing it back by the speaker group. Alternatively, the code stream is transmitted to the user side via the Internet, and is decoded by the three-dimensional sound decoder in the mobile terminal using the decoding method provided by the embodiment of the present application, thereby reconstructing the three-dimensional sound signal, and playing it back by the headphones.
[0174] Please refer to Figure 5 , Figure 5 The present invention is a schematic diagram of an implementation environment of a coding and decoding method provided in an embodiment of the present invention applied to a virtual reality streaming scene. The implementation environment includes an encoding end and a decoding end, the encoding end includes an acquisition module, a preprocessing module, an encoding module, a packaging module and a sending module, and the decoding end includes an unpacking module, a decoding module, a rendering module and headphones.
[0175] The acquisition module acquires the audio signal, and then performs preprocessing operations through the preprocessing module, which includes filtering out the low-frequency part of the signal, usually with 20Hz or 50Hz as the dividing point, extracting the direction information in the signal, etc. Then, the encoding module uses the encoding method provided in the embodiment of the present application to perform encoding processing, and after encoding, the packaging module is used to package it, and then it is sent to the decoding end through the sending module.
[0176] The unpacking module of the decoding end first unpacks, then decodes the signal by using the decoding method provided by the embodiment of the present application through the decoding module, and then performs binaural rendering processing on the decoded signal through the rendering module, and the rendered signal is mapped to the listener's headphones. The headphones can be independent headphones or headphones on a virtual reality-based glasses device.
[0177] Next, the encoding and decoding method provided in the embodiment of the present application is explained in detail. Figure 1 In the illustrated implementation environment, any of the encoding methods described below may be executed by the encoder 100 in the source device 10 . Any of the decoding methods described below may be executed by the decoder 200 in the destination device 20 .
[0178] It should be noted that the embodiments of the present application can be applied to a codec that does not include a context model, and can also be applied to a codec that includes a context model. Moreover, the embodiments of the present application can not only adjust the potential variables generated by the media data to be encoded through the adjustment factor, but also adjust the potential variables determined by the context model through the adjustment factor. Therefore, the following will be divided into multiple embodiments to explain the encoding and decoding method provided by the embodiments of the present application in detail. In addition, the adjustment factors and variable adjustment factors involved in the embodiments of the present application can be values before quantization or values after quantization, and the embodiments of the present application do not limit this.
[0179] Please refer to Figure 6 , Figure 6 This is a flowchart of the first encoding method provided by the embodiment of the present application. The method does not include a context model, and only adjusts the potential variables generated by the media data to be encoded by an adjustment factor. The encoding method is applied to an encoding end device and includes the following steps.
[0180] Step 601: Process the media data to be encoded by using a first encoding neural network model to obtain a first latent variable, where the first latent variable is used to indicate a feature of the media data to be encoded.
[0181] The media data to be encoded is an audio signal, a video signal or an image, etc. Moreover, the media data to be encoded may be in any form, which is not limited in the embodiment of the present application.
[0182] For example, the media data to be encoded may be media data in the time domain, or may be media data in the frequency domain obtained by subjecting the time domain media data to time-frequency transformation, for example, it may be media data in the frequency domain obtained by subjecting the time domain media data to MDCT transformation, or it may be media data in the frequency domain obtained by subjecting the time domain media data to fast Fourier transformation (FFT). The media data to be encoded may also be media data in the complex frequency domain obtained by subjecting the time domain media data to orthogonal mirror filter (QMF) filtering, or the media data to be encoded may be feature signals extracted from the time domain media data, such as Mel cepstral coefficients, or the media data to be encoded may also be residual signals, such as residual signals of other encodings or residual signals filtered by linear predictive coding (LPC).
[0183] The implementation process of processing the media data to be encoded by the first encoding neural network model is: inputting the media data to be encoded into the first encoding neural network model to obtain the first latent variable output by the first encoding neural network model. Alternatively, preprocessing the media data to be encoded, inputting the preprocessed media data into the first encoding neural network model, and obtaining the first latent variable output by the first encoding neural network model.
[0184] That is to say, the media data to be encoded can be used as the input of the first encoding neural network model to determine the first latent variable, or the media data to be encoded can be preprocessed and then used as the input of the first encoding neural network model to determine the first latent variable.
[0185] The preprocessing operation may be a time domain noise shaping (TNS) process, a frequency domain noise shaping (FDNS) process, a channel downmix process, and the like.
[0186] The first coding neural network model is pre-trained, and the embodiment of the present application does not limit the network structure and training method of the first coding neural network model. For example, the network structure of the first coding neural network model can be a fully connected network or a convolutional neural network (CNN) network. In addition, the embodiment of the present application does not limit the number of layers contained in the network structure of the first coding neural network model and the number of nodes in each layer.
[0187] The form of the latent variable output by the encoding neural network model of different network structures may be different. For example, when the network structure of the first encoding neural network model is a fully connected network, the first latent variable is a vector, and the dimension M of the vector is the size of the latent variable (latent size), such as Figure 7 When the network structure of the first encoding neural network model is a CNN network, the first latent variable is an N*M dimensional matrix, where N is the number of channels of the CNN network, and M is the size of the latent variable of each channel of the CNN network, as shown in FIG. Figure 8 It should be noted that Figure 7 and Figure 8 Only an illustration of the latent variables of the fully connected network and the latent variables of the CNN network is given. The channel numbers can be counted from 1 or 0, and the element numbers of the latent variables in each channel are the same.
[0188] Step 602: Determine a first variable adjustment factor based on the first latent variable, the first variable adjustment factor is used to make the number of coding bits of the entropy coding result of the second latent variable meet the preset coding rate condition, and the second latent variable is obtained by adjusting the first latent variable by the first variable adjustment factor.
[0189] In some embodiments, an initial number of coded bits may be determined based on a first latent variable, and a first variable adjustment factor may be determined based on the initial number of coded bits and a target number of coded bits.
[0190] The target number of coding bits may be set in advance. Of course, the target number of coding bits may also be determined based on the coding rate, and different coding rates correspond to different target numbers of coding bits.
[0191] In the embodiment of the present application, the media data to be encoded may be encoded using a fixed bit rate, or may be encoded using a variable bit rate.
[0192] When the media data to be encoded is encoded at a fixed bit rate, the number of bits of the media data to be encoded of the current frame can be determined based on the fixed bit rate, and then the number of used bits of the current frame can be subtracted to obtain the target number of bits for encoding the current frame. The number of used bits can be the number of bits for encoding side information, etc., and usually, the side information of each frame of media data is different, so the target number of bits for encoding each frame of media data is usually different.
[0193] When using a variable bit rate to encode the media data to be encoded, a bit rate is usually specified, and the actual bit rate will fluctuate above and below the specified bit rate. At this time, the number of bits of the media data to be encoded in the current frame can be determined based on the specified bit rate, and then the number of used bits of the current frame is subtracted to obtain the target number of bits for encoding the current frame. The number of used bits can be the number of bits for encoding side information, etc., and in some cases, the side information of media data in different frames can be different, so the target number of bits for encoding media data in different frames is usually different.
[0194] Next, the determination process of the initial number of coding bits and the first variable adjustment factor will be explained in detail.
[0195] Determine the initial number of encoding bits
[0196] There are two ways to determine the initial number of coding bits based on the first latent variable, which will be introduced below respectively.
[0197] In a first implementation, the number of coded bits of the entropy coding result of the first latent variable is determined to obtain an initial number of coded bits. That is, the initial number of coded bits is the number of coded bits of the entropy coding result of the first latent variable.
[0198] As an example, the first latent variable is quantized to obtain the quantized first latent variable. The quantized first latent variable is entropy encoded to obtain an initial encoding result of the first latent variable. The number of encoding bits of the initial encoding result of the first latent variable is counted to obtain the initial encoding bit number.
[0199] Among them, there may be multiple ways to quantize the first latent variable, for example, scalar quantization is performed on each element in the first latent variable. The quantization step of scalar quantization can be determined based on different coding rates, that is, the correspondence between the coding rate and the quantization step is stored in advance, and the corresponding quantization step can be obtained from the correspondence based on the coding rate adopted in the embodiment of the present application. In addition, scalar quantization can also have an offset, that is, the first latent variable is offset by the offset and then scalar quantization is performed according to the quantization step.
[0200] When entropy coding is performed on the quantized first latent variable, entropy coding can be performed based on an adjustable entropy coding model, or entropy coding can be performed using an entropy coding model with a preset probability distribution, which is not limited in the embodiment of the present application. Among them, entropy coding can use one of arithmetic coding (arithmetic coding), range coding (range coding, RC) or Huffman coding, which is not limited in the embodiment of the present application.
[0201] It should be noted that the quantization processing method and entropy coding method below are similar to those here. The quantization processing method and entropy coding method below can refer to the methods here, and the embodiments of the present application will not be repeated in the following text.
[0202] In a second implementation, the first latent variable is adjusted based on the first initial adjustment factor, and the number of coded bits of the entropy coding result of the adjusted first latent variable is determined to obtain the initial number of coded bits. That is, the initial number of coded bits is the number of coded bits of the entropy coding result of the first latent variable after adjustment by the first initial adjustment factor. The first initial adjustment factor may be a first preset adjustment factor.
[0203] As an example, the first latent variable is adjusted based on the first initial adjustment factor to obtain the adjusted first latent variable, and the adjusted first latent variable is quantized to obtain the quantized first latent variable. The quantized first latent variable is entropy encoded to obtain the initial encoding result of the first latent variable. The number of encoding bits of the initial encoding result of the first latent variable is counted to obtain the initial number of encoding bits.
[0204] The implementation process of adjusting the first latent variable based on the first initial adjustment factor is: multiplying each element in the first latent variable by the corresponding element in the first initial adjustment factor to obtain the adjusted first latent variable.
[0205] It is worth noting that the above implementation process is only an example. In actual applications, other methods can also be used for adjustment. For example, each element in the first latent variable can be divided by the corresponding element in the first initial adjustment factor to obtain the adjusted first latent variable. The embodiment of the present application does not limit the adjustment method.
[0206] It should be noted that, in the embodiment of the present application, an initial value of the adjustment factor is set for the first potential variable, and the initial value of the adjustment factor is usually equal to 1. The first preset adjustment factor may be greater than or equal to the initial value of the adjustment factor, or may be less than the initial value of the adjustment factor. For example, the first preset adjustment factor is a constant such as 1 or 2. In the case where the initial number of coded bits is determined by the first implementation method described above, the first initial adjustment factor is the initial value of the adjustment factor. In the case where the initial number of coded bits is determined by the second implementation method described above, the first initial adjustment factor is the first preset adjustment factor.
[0207] In addition, the first initial adjustment factor can be a scalar or a vector. For example, assuming that the network structure of the first encoding neural network model is a fully connected network, the first latent variable outputted is a vector, and the dimension M of the vector is the size (latent size) of the first latent variable. If the first initial adjustment factor is a scalar, in this case, the adjustment factor value corresponding to each element in the first latent variable of dimension M and vector is the same, that is, the first initial adjustment factor includes one element. If the first initial adjustment factor is a vector, in this case, the adjustment factor value corresponding to each element in the first latent variable vector of dimension M and vector is not exactly the same, and multiple elements can share one adjustment factor value, that is, the first initial adjustment factor includes multiple elements, each element corresponding to one or more elements in the first latent variable.
[0208] Similarly, assuming that the network structure of the first encoding neural network model is a CNN network, the first latent variable outputted by it is an N*M dimensional matrix, where N is the number of channels of the CNN network, and M is the size of the latent variable of each channel of the CNN network. If the first initial adjustment factor is a scalar, in this case, the adjustment factor value corresponding to each element in the N*M dimensional first latent variable matrix is the same, that is, the first initial adjustment factor includes one element. If the first initial adjustment factor is a vector, in this case, the adjustment factor value corresponding to each element in the N*M dimensional first latent variable matrix is not exactly the same, and elements of the latent variables belonging to the same channel may correspond to the same adjustment factor value, that is, the first initial adjustment factor includes N elements, each of which corresponds to M elements with the same channel number in the first latent variable.
[0209] Determine the first variable adjustment factor
[0210] The first variable adjustment factor is the final value of the adjustment factor of the first latent variable. The second latent variable is obtained by adjusting the first latent variable by the first variable adjustment factor, and the number of coded bits of the entropy coding result of the second latent variable meets the preset coding rate condition. Wherein, in the case of encoding the media data to be encoded using a fixed bit rate, satisfying the preset coding rate condition includes that the number of coded bits is less than or equal to the target number of coded bits. Alternatively, satisfying the preset coding rate condition includes that the number of coded bits is less than or equal to the target number of coded bits, and the difference between the number of coded bits and the target number of coded bits is less than the bit number threshold. In the case of encoding the media data to be encoded using a variable bit rate, satisfying the preset coding rate condition includes that the absolute value of the difference between the number of coded bits and the target number of coded bits is less than the bit number threshold. That is, satisfying the preset coding rate condition includes that the number of coded bits is less than or equal to the target number of coded bits, and the difference between the target number of coded bits and the number of coded bits is less than the bit number threshold. Alternatively, satisfying the preset coding rate condition includes that the number of coded bits is greater than or equal to the target number of coded bits, and the difference between the number of coded bits and the target number of coded bits is less than the bit number threshold.
[0211] It should be noted that the bit number threshold can be set in advance, and the bit number threshold can be adjusted based on different requirements.
[0212] There are multiple implementations of determining the first variable adjustment factor based on the initial number of coding bits and the target number of coding bits, three of which are introduced below.
[0213] In a first implementation, when the initial number of coding bits is equal to the target number of coding bits, the first initial adjustment factor is determined as the first variable adjustment factor. When the initial number of coding bits is not equal to the target number of coding bits, the first variable adjustment factor is determined in a first loop based on the initial number of coding bits and the target number of coding bits.
[0214] The i-th loop processing of the first loop method includes the following steps: determining the adjustment factor of the i-th loop processing, i is a positive integer, and adjusting the first latent variable based on the adjustment factor of the i-th loop processing to obtain the first latent variable after the i-th adjustment. Determine the number of coded bits of the entropy coding result of the i-th adjusted first latent variable to obtain the i-th number of coded bits. If the i-th number of coded bits meets the condition for continued adjustment, execute the i+1-th loop processing of the first loop method. If the i-th number of coded bits does not meet the condition for continued adjustment, terminate the execution of the first loop method, and determine the first variable adjustment factor based on the adjustment factor of the i-th loop processing.
[0215] The implementation process of determining the adjustment factor of the i-th loop processing is as follows: based on the adjustment factor of the i-1th loop processing of the first loop mode, the i-1th number of coded bits and the target number of coded bits, the adjustment factor of the i-th loop processing is determined. Wherein, in the case of i=1, the adjustment factor of the i-1th loop processing is the first initial adjustment factor, and the i-1th number of coded bits is the initial number of coded bits.
[0216] At this time, the conditions for continuing to adjust include that the number of coding bits for the i-1th time and the number of coding bits for the i-th time are both less than the target number of coding bits, or the conditions for continuing to adjust include that the number of coding bits for the i-1th time and the number of coding bits for the i-th time are both greater than the target number of coding bits.
[0217] In other words, the condition for continuing to adjust includes that the number of coding bits for the i-th time does not exceed the target number of coding bits. The meaning of not exceeding here is: the number of coding bits for the previous i-1 times has always been less than the target number of coding bits, and the number of coding bits for the i-th time is still less than the target number of coding bits. Alternatively, the number of coding bits for the previous i-1 times has always been greater than the target number of coding bits, and the number of coding bits for the i-th time is still greater than the target number of coding bits. On the contrary, exceeding means: the number of coding bits for the previous i-1 times has always been less than the target number of coding bits, and the number of coding bits for the i-th time is greater than the target number of coding bits. Alternatively, the number of coding bits for the previous i-1 times has always been greater than the target number of coding bits, and the number of coding bits for the i-th time is less than the target number of coding bits.
[0218] As an example, when the adjustment factor is a quantized value, the adjustment factor for the i-th loop processing can be determined according to the following formula (1) based on the adjustment factor for the i-1th loop processing of the first loop mode, the i-1th number of coding bits and the target number of coding bits.
[0219] scale(i)=Q{scale(i-1)*[target / curr(i-1)]} (1)
[0220] In the above formula (1), scale(i) refers to the adjustment factor of the i-th loop processing, scale(i-1) refers to the adjustment factor of the i-1th loop processing, target refers to the target number of coded bits, and curr(i-1) refers to the number of coded bits of the i-1th loop. Wherein, i is a positive integer greater than 0. Q{x} refers to the value after obtaining the quantization of x.
[0221] It should be noted that, when the adjustment factor is a value before quantization, when the adjustment factor of the i-th loop processing is determined by the above formula (1), the right side of the above formula (1) does not need to be processed by Q{x}.
[0222] The implementation process of determining the first variable adjustment factor based on the adjustment factor of the i-th loop processing includes: when the number of coded bits for the i-th loop is equal to the target number of coded bits, the adjustment factor of the i-th loop processing is determined as the first variable adjustment factor. Alternatively, when the number of coded bits for the i-th loop is not equal to the target number of coded bits, the first variable adjustment factor is determined based on the adjustment factor of the i-th loop processing and the adjustment factor of the i-1-th loop processing.
[0223] That is, the adjustment factor of the i-th loop processing is the adjustment factor obtained last time through the above-mentioned first loop method, and the i-th number of coded bits is the number of coded bits obtained last time. When the number of coded bits obtained last time is equal to the target number of coded bits, the adjustment factor obtained last time is determined as the first variable adjustment factor. When the number of coded bits obtained last time is not equal to the target number of coded bits, the first variable adjustment factor is determined based on the adjustment factors obtained in the last two times.
[0224] In some embodiments, based on the adjustment factor of the i-th cycle processing and the adjustment factor of the i-1-th cycle processing, the implementation process of determining the first variable adjustment factor includes: determining the average value of the adjustment factor of the i-th cycle processing and the adjustment factor of the i-1-th cycle processing, and determining the first variable adjustment factor based on the average value.
[0225] As an example, the average value may be directly determined as the first variable adjustment factor, or the average value may be multiplied by a preset constant to obtain the first variable adjustment factor. Optionally, the constant may be less than 1.
[0226] In other embodiments, the implementation process of determining the first variable adjustment factor based on the adjustment factor of the i-th cycle processing and the adjustment factor of the i-1-th cycle processing includes: determining the first variable adjustment factor through a second cycle method based on the adjustment factor of the i-th cycle processing and the adjustment factor of the i-1-th cycle processing.
[0227] As an example, the j-th loop processing of the second loop mode includes the following steps: determining the third adjustment factor of the j-th loop processing based on the first adjustment factor of the j-th loop processing and the second adjustment factor of the j-th loop processing, wherein, when j is equal to 1, the first adjustment factor of the j-th loop processing is one of the adjustment factor of the ith loop processing and the adjustment factor of the i-1-th loop processing, the second adjustment factor of the j-th loop processing is the other of the adjustment factor of the ith loop processing and the adjustment factor of the i-1-th loop processing, the first adjustment factor of the j-th loop processing corresponds to the j-th first number of coded bits, the second adjustment factor of the j-th loop processing corresponds to the j-th second number of coded bits, the j-th first number of coded bits refers to the number of coded bits of the entropy coding result of the first latent variable adjusted by the first adjustment factor of the j-th loop processing, the j-th second number of coded bits refers to the number of coded bits of the entropy coding result of the first latent variable adjusted by the second adjustment factor of the j-th loop processing, and the j-th first number of coded bits is less than the j-th second number of coded bits. The third number of coded bits for the jth time is obtained, and the third number of coded bits for the jth time refers to the number of coded bits of the entropy coding result of the first latent variable after the third adjustment factor of the jth loop processing is adjusted. If the third number of coded bits for the jth time does not meet the condition for continuing the loop, the execution of the second loop mode is terminated, and the third adjustment factor of the jth loop processing is determined as the first variable adjustment factor. If the third number of coded bits for the jth time meets the condition for continuing the loop, the third number of coded bits for the jth time is greater than the target number of coded bits and less than the second number of coded bits for the jth time, the third adjustment factor of the jth loop processing is used as the second adjustment factor of the j+1th loop processing, and the first adjustment factor of the jth loop processing is used as the first adjustment factor of the j+1th loop processing, and the j+1th loop processing of the second loop mode is executed. If the third number of encoded bits for the jth time meets the condition for continuing the loop, and the third number of encoded bits for the jth time is less than the target number of encoded bits and greater than the first number of encoded bits for the jth time, the third adjustment factor of the jth loop processing is used as the first adjustment factor of the j+1th loop processing, and the second adjustment factor of the jth loop processing is used as the second adjustment factor of the j+1th loop processing, and the j+1th loop processing of the second loop mode is executed.
[0228] As another example, the j-th loop processing of the second loop mode includes the following steps: determining the third adjustment factor of the j-th loop processing based on the first adjustment factor of the j-th loop processing and the second adjustment factor of the j-th loop processing, wherein, when j is equal to 1, the first adjustment factor of the j-th loop processing is one of the adjustment factor of the i-th loop processing and the adjustment factor of the i-1-th loop processing, the second adjustment factor of the j-th loop processing is the other of the adjustment factor of the i-th loop processing and the adjustment factor of the i-1-th loop processing, the first adjustment factor of the j-th loop processing corresponds to the j-th first number of coded bits, the second adjustment factor of the j-th loop processing corresponds to the j-th second number of coded bits, the j-th first number of coded bits is less than the j-th second number of coded bits, and j is a positive integer. Obtaining the j-th third number of coded bits, the j-th third number of coded bits refers to the number of coded bits of the entropy coding result of the first latent variable adjusted by the third adjustment factor of the j-th loop processing. If the third number of coded bits of the jth time does not meet the condition for continuing the loop, the execution of the second loop mode is terminated, and the third adjustment factor of the jth loop processing is determined as the first variable adjustment factor. If j reaches the maximum number of loops and the third number of coded bits of the jth time meets the condition for continuing the loop, the execution of the second loop mode is terminated, and the first variable adjustment factor is determined based on the first adjustment factor of the jth loop processing. If j does not reach the maximum number of loops, the third number of coded bits of the jth time meets the condition for continuing the loop, and the third number of coded bits of the jth time is greater than the target number of coded bits and less than the second number of coded bits of the jth time, the third adjustment factor of the jth loop processing is used as the second adjustment factor of the j+1th loop processing, and the first adjustment factor of the jth loop processing is used as the first adjustment factor of the j+1th loop processing, and the j+1th loop processing of the second loop mode is executed. If j has not reached the maximum number of loops, the third number of coded bits for the jth time meets the condition for continuing the loop, and the third number of coded bits for the jth time is less than the target number of coded bits and greater than the first number of coded bits for the jth time, the third adjustment factor of the jth loop processing is used as the first adjustment factor of the j+1th loop processing, and the second adjustment factor of the jth loop processing is used as the second adjustment factor of the j+1th loop processing, and the j+1th loop processing of the second loop mode is executed.
[0229] The implementation process of determining the third adjustment factor of the j-th loop processing based on the first adjustment factor of the j-th loop processing and the second adjustment factor of the j-th loop processing includes: determining the average value of the first adjustment factor of the j-th loop processing and the second adjustment factor of the j-th loop processing, and determining the third adjustment factor of the j-th loop processing based on the average value. As an example, the average value can be directly determined as the third adjustment factor of the j-th loop processing, or the average value can be multiplied by a preset constant to obtain the third adjustment factor of the j-th loop processing. Optionally, the constant can be less than 1.
[0230] In addition, the implementation process of obtaining the third number of coded bits for the jth time includes: adjusting the first latent variable based on the third adjustment factor processed in the jth loop to obtain the adjusted first latent variable, quantizing the adjusted first latent variable to obtain the quantized first latent variable, performing entropy coding on the quantized first latent variable, and counting the number of coded bits of the entropy coding result to obtain the third number of coded bits for the jth time.
[0231] Wherein, in the case of encoding the media data to be encoded using a fixed bit rate, the implementation process of determining the first variable adjustment factor based on the first adjustment factor of the j-th loop processing includes: determining the first adjustment factor of the j-th loop processing as the first variable adjustment factor. In the case of encoding the media data to be encoded using a variable bit rate, the implementation process of determining the first variable adjustment factor based on the first adjustment factor of the j-th loop processing includes: determining a first difference between the target number of encoded bits and the first number of encoded bits for the j-th time, and determining a second difference between the second number of encoded bits for the j-th time and the target number of encoded bits. If the first difference is less than the second difference, the first adjustment factor of the j-th loop processing is determined as the first variable adjustment factor. If the second difference is less than the first difference, the second adjustment factor of the j-th loop processing is determined as the first variable adjustment factor. If the first difference is equal to the second difference, the first adjustment factor of the j-th loop processing is determined as the first variable adjustment factor, or the second adjustment factor of the j-th loop processing is determined as the first variable adjustment factor.
[0232] Wherein, when a fixed bit rate is used to encode the media data to be encoded, the condition for continuing the loop includes that the third number of encoded bits for the jth time is greater than the target number of encoded bits, or the condition for continuing the loop includes that the third number of encoded bits for the jth time is less than the target number of encoded bits, and the difference between the target number of encoded bits and the third number of encoded bits for the jth time is greater than the bit number threshold. When a variable bit rate is used to encode the media data to be encoded, the condition for continuing the loop includes that the absolute value of the difference between the target number of encoded bits and the third number of encoded bits for the jth time is greater than the bit number threshold. That is, the condition for continuing the loop includes that the third number of encoded bits for the jth time is greater than the target number of encoded bits, and the difference between the third number of encoded bits for the jth time and the target number of encoded bits is greater than the bit number threshold, or the condition for continuing the loop includes that the third number of encoded bits for the jth time is less than the target number of encoded bits, and the difference between the target number of encoded bits and the third number of encoded bits for the jth time is greater than the bit number threshold.
[0233] That is, when a fixed bit rate is used to encode the media data to be encoded, the loop continuation condition includes: bits_curr>target||(bits_curr<target&&(target-bits_curr)> TH), when the media data to be encoded is encoded using a variable bit rate, the conditions for continuing the loop include: bits_curr>target&&(bits_curr-target)>TH||(bits_curr<target&&(target-bits_curr)> TH). Among them, bits_curr refers to the third number of encoded bits of the jth time, target refers to the target number of encoded bits, and TH is the bit number threshold.
[0234] The first adjustment factor of the j-th loop processing can be recorded as scale_lower, the first number of encoded bits of the j-th loop processing can be recorded as bits_lower, the second adjustment factor of the j-th loop processing can be recorded as scale_upper, the second number of encoded bits of the j-th loop processing can be recorded as bits_upper, the third adjustment factor of the j-th loop processing can be recorded as scale_curr, and the third adjustment factor of the j-th loop processing can be used as the first adjustment factor of the j+1-th loop processing or the second adjustment factor of the j+1-th loop processing. The pseudo code is as follows:
[0235] if bits_curr>target&bits_curr <bits_upper
[0236] scale_upper=scale_curr
[0237] bits_upper=bits_curr
[0238] else if bits_curr<target&bits_curr> bits_lower
[0239] scale_lower = scale_curr
[0240] bits_lower = bits_curr
[0241] In a second implementation, when the initial number of coding bits is equal to the target number of coding bits, the first initial adjustment factor is determined as the first variable adjustment factor. When the initial number of coding bits is not equal to the target number of coding bits, the first variable adjustment factor is determined according to the first implementation. However, different from the first implementation, when the initial number of coding bits is less than the target number of coding bits, the adjustment factor of the i-1th loop processing is adjusted according to the first step size to obtain the adjustment factor of the i-th loop processing. At this time, the condition for continuing to adjust includes that the i-th number of coding bits is less than the target number of coding bits. When the initial number of coding bits is greater than the target number of coding bits, the adjustment factor of the i-1th loop processing is adjusted according to the second step size to obtain the adjustment factor of the i-th loop processing. At this time, the condition for continuing to adjust includes that the i-th number of coding bits is greater than the target number of coding bits.
[0242] Among them, adjusting the adjustment factor of the i-1th loop processing according to the first step size may refer to increasing the adjustment factor of the i-1th loop processing according to the first step size, and adjusting the adjustment factor of the i-1th loop processing according to the second step size may refer to reducing the adjustment factor of the i-1th loop processing according to the second step size.
[0243] The above-mentioned increase process and decrease process can be linear or nonlinear. For example, the sum of the adjustment factor of the i-1th cycle process and the first step length can be determined as the adjustment factor of the i-th cycle process, and the difference between the adjustment factor of the i-1th cycle process and the second step length can be determined as the adjustment factor of the i-th cycle process.
[0244] It should be noted that the first step length and the second step length may be pre-set, and the first step length and the second step length may be adjusted based on different requirements. In addition, the first step length and the second step length may be equal or unequal.
[0245] In a third implementation, when the initial number of coding bits is less than or equal to the target number of coding bits, the first initial adjustment factor is determined as the first variable adjustment factor. When the initial number of coding bits is greater than the target number of coding bits, the first variable adjustment factor can be determined according to the first implementation. The first variable adjustment factor can also be determined according to the second implementation in which the initial number of coding bits is greater than the target number of coding bits.
[0246] Step 603: Obtain the entropy encoding result of the second latent variable.
[0247] In the process of determining the first variable adjustment factor in step 602, the first variable adjustment factor may be the first initial adjustment factor, the adjustment factor of the i-th loop processing, the third adjustment factor of the j-th loop processing, or the first adjustment factor determined based on the j-th loop processing. In either case, the corresponding entropy coding result is determined in the above loop process, so the entropy coding result corresponding to the first variable adjustment factor, that is, the entropy coding result of the second latent variable, can be directly obtained from the entropy coding result determined in the above loop process.
[0248] Of course, the process can be reprocessed once more. That is, the first latent variable is adjusted directly based on the first variable adjustment factor to obtain the second latent variable. The second latent variable is quantized to obtain the quantized second latent variable. The quantized second latent variable is entropy encoded to obtain the entropy encoding result of the second latent variable.
[0249] Based on the above description, the first initial adjustment factor may be a scalar or a vector, and the first variable adjustment factor is determined based on the first initial adjustment factor, so the first variable adjustment factor may be a scalar or a vector.
[0250] That is, the first variable adjustment factor includes one element or multiple elements. When the first variable adjustment factor includes multiple elements, one element in the first variable adjustment factor corresponds to one or more elements in the first latent variable.
[0251] Step 604: Write the entropy coding result of the second latent variable and the coding result of the first variable adjustment factor into the bitstream.
[0252] Based on the above description, the first variable adjustment factor can be a value before quantization or a value after quantization. If the first variable adjustment factor is a value before quantization, at this time, the implementation process of determining the encoding result of the first variable adjustment factor includes: quantizing and encoding the first variable adjustment factor to obtain the encoding result of the first variable adjustment factor. If the first variable adjustment factor is a value after quantization, at this time, the implementation process of determining the encoding result of the first variable adjustment factor includes: encoding the first variable adjustment factor to obtain the encoding result of the first variable adjustment factor.
[0253] The first variable adjustment factor may be encoded in any encoding method, which is not limited in the embodiment of the present application.
[0254] In addition, for some encoders, the quantization process and the encoding process are performed in one process, that is, the quantization result and the encoding result can be obtained through one process. Therefore, for the first variable adjustment factor, the encoding result of the first variable adjustment factor may also be obtained in the process of determining the first variable adjustment factor, so the encoding result of the first variable adjustment factor can be directly obtained. That is, the encoding result of the first variable adjustment factor can also be directly obtained in the process of determining the first variable adjustment factor.
[0255] Optionally, if the first variable adjustment factor is a value before quantization, the embodiment of the present application may also determine the quantization index corresponding to the quantization step of the first variable adjustment factor to obtain a first quantization index. Optionally, the embodiment of the present application may also determine the quantization index corresponding to the quantization step of the second latent variable to obtain a second quantization index. The first quantization index and the second quantization index are encoded into the bitstream. Among them, the quantization index is used to indicate the corresponding quantization step, that is, the first quantization index is used to indicate the quantization step of the first variable adjustment factor, and the second quantization index is used to indicate the quantization step of the second latent variable.
[0256] In the embodiment of the present application, the first latent variable is adjusted by the first variable adjustment factor to obtain the second latent variable, and the number of coded bits of the entropy coding result of the second latent variable meets the preset coding rate condition, so that the number of coded bits of the entropy coding result of the latent variable corresponding to each frame of media data can meet the preset coding rate condition, that is, the number of coded bits of the entropy coding result of the latent variable corresponding to each frame of media data can be guaranteed to be basically consistent, rather than dynamically changing, thereby meeting the encoder's demand for a stable coding rate. Further, considering the need to transmit side information (such as window type, time domain noise shaping (TNS: Temporal Noise Shaping) parameters, frequency domain noise shaping (FDNS: Frequency-domain noise shaping) parameters, and / or bandwidth extension (BWE: bandwidthextension) parameters, etc.), it can be ensured that the number of coded bits of the entropy coding result of the latent variable corresponding to each frame of media data and the number of coded bits of the side information are basically consistent as a whole, thereby meeting the encoder's demand for a stable coding rate.
[0257] Please refer to Fig. 9 , Fig. 9 is a flowchart of a first decoding method provided in an embodiment of the present application, which is applied to a decoding end. The method corresponds to Figure 6 The encoding method shown in FIG.
[0258] Step 901: Determine a reconstructed second latent variable and a reconstructed first variable adjustment factor based on a bitstream.
[0259] In some embodiments, the entropy encoding result of the second latent variable in the bitstream may be entropy decoded, and the encoding result of the first variable adjustment factor in the bitstream may be decoded to obtain a quantized second latent variable and a quantized first variable adjustment factor. The quantized second latent variable and the quantized first variable adjustment factor may be dequantized to obtain a reconstructed second latent variable and a reconstructed first variable adjustment factor.
[0260] The decoding method of this step corresponds to the encoding method of the encoding end, and the dequantization processing of this step corresponds to the quantization processing of the encoding end. That is, the decoding method is the inverse process of the encoding method, and the dequantization processing is the inverse process of the quantization processing.
[0261] For example, a first quantization index and a second quantization index can be parsed from the bitstream, the first quantization index is used to indicate the quantization step of the first variable adjustment factor, and the second quantization index is used to indicate the quantization step of the second latent variable. According to the quantization step indicated by the first quantization index, the quantized first variable adjustment factor is dequantized to obtain a reconstructed first variable adjustment factor. According to the quantization step indicated by the second quantization index, the quantized second latent variable is dequantized to obtain a reconstructed second latent variable.
[0262] Step 902: Based on the reconstructed first variable adjustment factor, the reconstructed second latent variable is adjusted to obtain a reconstructed first latent variable, where the reconstructed first latent variable is used to indicate the characteristics of the media data to be decoded.
[0263] Since the second latent variable is obtained by adjusting the first latent variable by the first variable adjustment factor, the reconstructed second latent variable can be adjusted based on the reconstructed first variable adjustment factor to obtain the reconstructed first latent variable.
[0264] Among them, the process of adjusting the reconstructed second latent variable based on the reconstructed first variable adjustment factor is the inverse process of the adjustment of the first latent variable on the encoding side. For example, when the encoding side multiplies each element in the first latent variable with the corresponding element in the first variable adjustment factor, each element in the reconstructed second latent variable can be divided by the corresponding element in the reconstructed first variable adjustment factor to obtain the reconstructed first latent variable. When the encoding side divides each element in the first latent variable by the corresponding element in the first variable adjustment factor, each element in the reconstructed second latent variable can be multiplied by the corresponding element in the reconstructed first variable adjustment factor to obtain the reconstructed first latent variable.
[0265] Based on the above description, the first initial adjustment factor can be a scalar or a vector, so the final first variable adjustment factor can be a scalar or a vector. For example, assuming that the network structure of the first encoding neural network model is a fully connected network, the second latent variable is a vector, and the dimension M of the vector is the size (latentsize) of the second latent variable. If the first variable adjustment factor is a scalar, in this case, the adjustment factor value corresponding to each element in the second latent variable with dimension M and a vector is the same, that is, the first variable adjustment factor includes one element. If the first variable adjustment factor is a vector, in this case, the adjustment factor value corresponding to each element in the second latent variable vector with dimension M and a vector is not exactly the same, and multiple elements can share one adjustment factor value, that is, the first variable adjustment factor includes multiple elements, each element corresponding to one or more elements in the second latent variable.
[0266] Similarly, assuming that the network structure of the first encoding neural network model is a CNN network, the second latent variable is an N*M dimensional matrix, where N is the number of channels of the CNN network, and M is the size of the latent variable of each channel of the CNN network. If the first variable adjustment factor is a scalar, in this case, the adjustment factor value corresponding to each element in the N*M dimensional second latent variable matrix is the same, that is, the first variable adjustment factor includes one element. If the first variable adjustment factor is a vector, in this case, the adjustment factor value corresponding to each element in the N*M dimensional second latent variable matrix is not exactly the same, and the elements of the latent variables belonging to the same channel may correspond to the same adjustment factor value, that is, the first variable adjustment factor includes N elements, each of which corresponds to M elements with the same channel number in the second latent variable.
[0267] Step 903: Process the reconstructed first latent variable through the first decoding neural network model to obtain reconstructed media data.
[0268] In some embodiments, the reconstructed first latent variable may be input into the first decoding neural network model to obtain the reconstructed media data output by the first decoding neural network model. Alternatively, the reconstructed first latent variable may be post-processed, and the post-processed first latent variable may be input into the first decoding neural network model to obtain the reconstructed media data output by the first decoding neural network model.
[0269] That is to say, the reconstructed first latent variable can be used as the input of the first decoding neural network model to determine the reconstructed media data, or the reconstructed first latent variable can be post-processed and then used as the input of the first decoding neural network model to determine the reconstructed media data.
[0270] Among them, the first decoding neural network model corresponds to the first encoding neural network model, and both are pre-trained. The embodiment of the present application does not limit the network structure and training method of the first decoding neural network model. For example, the network structure of the first decoding neural network model can be a fully connected network or a CNN network. In addition, the embodiment of the present application does not limit the number of layers contained in the network structure of the first decoding neural network model and the number of nodes in each layer.
[0271] In the case where the media data is an audio signal or a video signal, the output of the first decoding neural network model can be reconstructed time domain media data or reconstructed frequency domain media data. If it is frequency domain media data, it is necessary to transform the frequency domain to the time domain to obtain the time domain media data. The output of the first decoding neural network model can also be a residual signal, in which case other corresponding processing is required to obtain the audio signal or the video signal.
[0272] In the embodiment of the present application, since the number of coded bits of the entropy coding result of the second latent variable meets the preset coding rate condition, it can be ensured that the number of coded bits of the entropy coding result of the latent variable corresponding to each frame of media data can meet the preset coding rate condition, that is, it can be ensured that the number of coded bits of the entropy coding result of the latent variable corresponding to each frame of media data remains basically consistent, rather than dynamically changing, thereby meeting the encoder's demand for a stable coding rate. Further, considering the need to transmit side information (such as window type, time-domain noise shaping (TNS: Temporal Noise Shaping) parameters, frequency-domain noise shaping (FDNS: Frequency-domain noise shaping) parameters, and / or bandwidth extension (BWE: bandwidth extension) parameters, etc.), it can be ensured that the number of coded bits of the entropy coding result of the latent variable corresponding to each frame of media data and the number of coded bits of the side information remain basically consistent as a whole, thereby meeting the encoder's demand for a stable coding rate.
[0273] Please refer to Fig.10 , Fig.10 This is a flow chart of a second encoding method provided by an embodiment of the present application, which includes a context model, but only adjusts the potential variables generated by the media data to be encoded through an adjustment factor. The encoding method is applied to an encoding end device and includes the following steps.
[0274] Step 1001: Processing media data to be encoded by a first encoding neural network model to obtain a first latent variable, where the first latent variable is used to indicate a feature of the media data to be encoded.
[0275] The implementation process of step 1001 may refer to the implementation process of step 601 above, and will not be repeated here.
[0276] Step 1002: Determine a first variable adjustment factor based on a first latent variable.
[0277] In some embodiments, the initial number of coding bits can be determined based on the first potential variable, and the first variable adjustment factor can be determined based on the initial number of coding bits and the target number of coding bits. The description of the target number of coding bits can refer to the content in step 602, which will not be repeated here. Next, the determination process of the initial number of coding bits and the first variable adjustment factor will be explained in detail.
[0278] Determine the initial number of encoding bits
[0279] There are two ways to determine the initial number of coding bits based on the first latent variable, which will be introduced below respectively.
[0280] In a first implementation, based on the first latent variable, the corresponding context initial coding bit number and initial entropy coding model parameters are determined through a context model, and based on the initial entropy coding model parameters, the coding bit number of the entropy coding result of the first latent variable is determined to obtain a basic initial coding bit number. The initial coding bit number is determined based on the context initial coding bit number and the basic initial coding bit number.
[0281] Among them, the context model includes a context coding neural network model and a context decoding neural network model. Based on the first latent variable, the implementation process of determining the corresponding context initial coding bit number and initial entropy coding model parameters through the context model includes: processing the first latent variable through the context coding neural network model to obtain a fifth latent variable, and the fifth latent variable is used to indicate the probability distribution of the first latent variable. Determine the entropy coding result of the fifth latent variable, and use the coding bit number of the entropy coding result of the fifth latent variable as the context initial coding bit number. Reconstruct the fifth latent variable based on the entropy coding result of the fifth latent variable, and process the reconstructed fifth latent variable through the context decoding neural network model to obtain the initial entropy coding model parameters.
[0282] As an example, the first latent variable is processed by the context coding neural network model to obtain the fifth latent variable. The fifth latent variable is quantized to obtain the quantized fifth latent variable. The quantized fifth latent variable is entropy encoded, and the number of coded bits of the entropy encoding result is counted to obtain the context initial coding bit number. Afterwards, the entropy encoding result of the fifth latent variable is entropy decoded to obtain the quantized fifth latent variable, and the quantized fifth latent variable is dequantized to obtain the reconstructed fifth latent variable. The reconstructed fifth latent variable is input into the context decoding neural network model to obtain the initial entropy coding model parameters output by the context decoding neural network model.
[0283] The implementation process of processing the first latent variable by the context coding neural network model is as follows: inputting the first latent variable into the context coding neural network model to obtain the fifth latent variable output by the context coding neural network model. Alternatively, taking the absolute value of each element in the first latent variable and then inputting it into the context coding neural network model to obtain the fifth latent variable output by the context coding neural network model.
[0284] The implementation process of determining the number of coded bits of the entropy coding result of the first latent variable based on the initial entropy coding model parameters and obtaining the basic initial number of coded bits is as follows: determining the entropy coding model corresponding to the initial entropy coding model parameters from the entropy coding model with adjustable coding model parameters. Quantizing the first latent variable to obtain the quantized first latent variable. Based on the entropy coding model corresponding to the initial entropy coding model parameters, entropy coding the quantized first latent variable to obtain the initial coding result of the first latent variable. Counting the number of coded bits of the initial coding result of the first latent variable to obtain the basic initial number of coded bits.
[0285] Among them, the quantization processing method and entropy coding method in step 1002 can refer to the quantization processing method and entropy coding method in step 602, and will not be repeated here.
[0286] The implementation process of determining the initial coding bit number based on the context initial coding bit number and the basic initial coding bit number as the initial coding bit number includes: determining the sum of the context initial coding bit number and the basic initial coding bit number as the initial coding bit number. Of course, it can also be determined by other implementation methods.
[0287] In a second implementation, the first latent variable is adjusted based on the first initial adjustment factor, and based on the adjusted first latent variable, the corresponding context initial coding bit number and initial entropy coding model parameters are determined through the context model, and based on the initial entropy coding model parameters, the number of coding bits of the entropy coding result of the adjusted first latent variable is determined to obtain the basic initial coding bit number. The initial coding bit number is determined based on the context initial coding bit number and the basic initial coding bit number. The first initial adjustment factor may be a first preset adjustment factor.
[0288] Among them, the context model includes a context coding neural network model and a context decoding neural network model. Based on the adjusted first latent variable, the implementation process of determining the corresponding context initial coding bit number and initial entropy coding model parameters through the context model includes: processing the adjusted first latent variable through the context coding neural network model to obtain a sixth latent variable, and the sixth latent variable is used to indicate the probability distribution of the adjusted first latent variable. Determine the entropy coding result of the sixth latent variable, and use the coding bit number of the entropy coding result of the sixth latent variable as the context initial coding bit number. Reconstruct the sixth latent variable based on the entropy coding result of the sixth latent variable, and process the reconstructed sixth latent variable through the context decoding neural network model to obtain the initial entropy coding model parameters.
[0289] As an example, the adjusted first latent variable is processed by a context coding neural network model to obtain a sixth latent variable. The sixth latent variable is quantized to obtain a quantized sixth latent variable. The quantized sixth latent variable is entropy encoded, and the number of coded bits of the entropy encoding result is counted to obtain the context initial coding bit number. Afterwards, the entropy encoding result of the sixth latent variable is entropy decoded to obtain a quantized sixth latent variable, and the quantized sixth latent variable is dequantized to obtain a reconstructed sixth latent variable. The reconstructed sixth latent variable is input into the context decoding neural network model to obtain the initial entropy coding model parameters output by the context decoding neural network model.
[0290] It should be noted that for other contents in the second implementation method, reference can be made to the description of the corresponding steps above and will not be repeated here.
[0291] Determine the first variable adjustment factor
[0292] The above-mentioned first variable adjustment factor is the final value of the adjustment factor of the first latent variable. The second latent variable is obtained by adjusting the first latent variable by the first variable adjustment factor, and the third latent variable is obtained by processing the second latent variable through the context coding neural network model, and the total number of coded bits of the entropy coding result of the second latent variable and the entropy coding result of the third latent variable meet the preset coding rate condition. Wherein, in the case of encoding the media data to be encoded using a fixed bit rate, satisfying the preset coding rate condition includes that the number of coded bits is less than or equal to the target number of coded bits. Alternatively, satisfying the preset coding rate condition includes that the number of coded bits is less than or equal to the target number of coded bits, and the difference between the number of coded bits and the target number of coded bits is less than the bit number threshold. In the case of encoding the media data to be encoded using a variable bit rate, satisfying the preset coding rate condition includes that the absolute value of the difference between the number of coded bits and the target number of coded bits is less than the bit number threshold. That is, satisfying the preset coding rate condition includes that the number of coded bits is less than or equal to the target number of coded bits, and the difference between the target number of coded bits and the number of coded bits is less than the bit number threshold. Alternatively, satisfying the preset coding rate condition includes that the number of coding bits is greater than or equal to the target number of coding bits, and the difference between the number of coding bits and the target number of coding bits is less than a bit number threshold.
[0293] It should be noted that the bit number threshold can be set in advance, and the bit number threshold can be adjusted based on different requirements.
[0294] There are multiple implementations of determining the first variable adjustment factor based on the initial number of coding bits and the target number of coding bits, three of which are introduced below.
[0295] In a first implementation, when the initial number of coding bits is equal to the target number of coding bits, the first initial adjustment factor is determined as the first variable adjustment factor. When the initial number of coding bits is not equal to the target number of coding bits, the first variable adjustment factor is determined in a first loop based on the initial number of coding bits and the target number of coding bits.
[0296] The i-th loop processing of the first loop mode includes the following steps: determining the adjustment factor of the i-th loop processing, i is a positive integer, adjusting the first latent variable based on the adjustment factor of the i-th loop processing, and obtaining the i-th adjusted first latent variable. Based on the i-th adjusted first latent variable, determining the corresponding i-th context coding bit number and the i-th entropy coding model parameter through the context model, determining the number of coded bits of the entropy coding result of the i-th adjusted first latent variable based on the i-th entropy coding model parameter, obtaining the i-th basic coding bit number, and determining the i-th coding bit number based on the i-th context coding bit number and the i-th basic coding bit number. If the i-th coding bit number meets the condition for continued adjustment, the i+1-th loop processing of the first loop mode is executed. If the i-th coding bit number does not meet the condition for continued adjustment, the execution of the first loop mode is terminated, and the first variable adjustment factor is determined based on the adjustment factor of the i-th loop processing.
[0297] Among them, the implementation process of determining the adjustment factor of the i-th loop processing can refer to the relevant description in the above step 602, which will not be repeated here. Based on the first latent variable after the i-th adjustment, the implementation process of determining the i-th context coding bit number and the i-th entropy coding model parameter through the context model can refer to the above-mentioned process of determining the context initial coding bit number and the initial entropy coding model parameter, which will not be repeated here. Based on the i-th coding model parameters, the implementation process of determining the number of coding bits of the entropy coding result of the i-th adjusted first latent variable can refer to the above-mentioned process of determining the basic initial coding bit number based on the initial entropy coding model parameters, which will not be repeated here.
[0298] The implementation process of determining the first variable adjustment factor based on the adjustment factor of the i-th cycle processing may refer to the description in the above step 602, which will not be repeated here.
[0299] In a second implementation, when the initial number of coding bits is equal to the target number of coding bits, the first initial adjustment factor is determined as the first variable adjustment factor. When the initial number of coding bits is not equal to the target number of coding bits, the first variable adjustment factor is determined according to the first implementation. However, different from the first implementation, when the initial number of coding bits is less than the target number of coding bits, the adjustment factor of the i-1th cycle processing of the first cycle mode is adjusted according to the first step size to obtain the adjustment factor of the i-th cycle processing. At this time, the condition for continuing to adjust includes that the i-th number of coding bits is less than the target number of coding bits. When the initial number of coding bits is greater than the target number of coding bits, the adjustment factor of the i-1th cycle processing of the first cycle mode is adjusted according to the second step size to obtain the adjustment factor of the i-th cycle processing. At this time, the condition for continuing to adjust includes that the i-th number of coding bits is greater than the target number of coding bits.
[0300] Among them, adjusting the adjustment factor of the i-1th loop processing according to the first step size may refer to increasing the adjustment factor of the i-1th loop processing according to the first step size, and adjusting the adjustment factor of the i-1th loop processing according to the second step size may refer to reducing the adjustment factor of the i-1th loop processing according to the second step size.
[0301] The above-mentioned increase process and decrease process can be linear or nonlinear. For example, the sum of the adjustment factor of the i-1th cycle process and the first step length can be determined as the adjustment factor of the i-th cycle process, and the difference between the adjustment factor of the i-1th cycle process and the second step length can be determined as the adjustment factor of the i-th cycle process.
[0302] It should be noted that the first step length and the second step length may be pre-set, and the first step length and the second step length may be adjusted based on different requirements. In addition, the first step length and the second step length may be equal or unequal.
[0303] In a third implementation, when the initial number of coding bits is less than or equal to the target number of coding bits, the first initial adjustment factor is determined as the first variable adjustment factor. When the initial number of coding bits is greater than the target number of coding bits, the first variable adjustment factor can be determined according to the first implementation. The first variable adjustment factor can also be determined according to the second implementation in which the initial number of coding bits is greater than the target number of coding bits.
[0304] Step 1003: Obtain entropy coding results of a second latent variable and entropy coding results of a third latent variable, wherein the second latent variable is obtained by adjusting the first latent variable by a first variable adjustment factor, and the third latent variable is used to indicate a probability distribution of the second latent variable, and the total number of coding bits of the entropy coding results of the second latent variable and the entropy coding results of the third latent variable meet a preset coding rate condition.
[0305] In the process of determining the first variable adjustment factor in step 1002, the first variable adjustment factor may be the first initial adjustment factor, the adjustment factor of the i-th loop processing, the third adjustment factor of the j-th loop processing, or determined based on the first adjustment factor of the j-th loop processing. In either case, the corresponding entropy coding result is determined in the above loop process, so the entropy coding result of the second latent variable and the entropy coding result of the third latent variable can be directly obtained from the entropy coding result determined in the above loop process.
[0306] Of course, it can be reprocessed once. That is, the first latent variable is adjusted directly based on the first variable adjustment factor to obtain the second latent variable. Based on the second latent variable, the entropy coding result of the third latent coding and the first entropy coding model parameters are determined through the context model. The second latent variable is quantized to obtain the quantized second latent variable. Based on the first entropy coding model parameters, the entropy coding result of the quantized second latent variable is determined, that is, the entropy coding result of the second latent variable.
[0307] The context model includes a context coding neural network model and a context decoding neural network model. Based on the second latent variable, the implementation process of determining the entropy coding result of the third latent coding and the first entropy coding model parameters through the context model includes: processing the second latent variable through the context coding neural network model to obtain the third latent variable. Quantizing the third latent variable to obtain the quantized third latent variable. Entropy coding the quantized third latent variable to obtain the entropy coding result of the third latent variable. Entropy decoding the entropy coding result of the third latent variable to obtain the quantized third latent variable, dequantizing the quantized third latent variable to obtain the reconstructed third latent variable. Processing the reconstructed third latent variable through the context decoding neural network model to obtain the first entropy coding model parameters.
[0308] The implementation process of determining the entropy coding result of the quantized second latent variable based on the first entropy coding model parameter includes: determining an entropy coding model corresponding to the first entropy coding model parameter from an entropy coding model with adjustable coding model parameters. Based on the entropy coding model corresponding to the first entropy coding model parameter, entropy coding is performed on the quantized second latent variable to obtain the entropy coding result of the second latent variable.
[0309] Step 1004: Write the entropy coding result of the second latent variable, the entropy coding result of the third latent variable, and the coding result of the first variable adjustment factor into the bitstream.
[0310] For the relevant contents about the encoding result of the first variable adjustment factor, please refer to the description in step 604, which will not be repeated here.
[0311] Optionally, if the first variable adjustment factor is a value before quantization, the embodiment of the present application may also determine the quantization index corresponding to the quantization step of the first variable adjustment factor to obtain a first quantization index. Optionally, the embodiment of the present application may also determine the quantization index corresponding to the quantization step of the second latent variable to obtain a second quantization index, and determine the quantization index corresponding to the quantization step of the third latent variable to obtain a third quantization index. The first quantization index, the second quantization index, and the third quantization index are encoded into the bitstream. Among them, the quantization index is used to indicate the corresponding quantization step, that is, the first quantization index is used to indicate the quantization step of the first variable adjustment factor, the second quantization index is used to indicate the quantization step of the second latent variable, and the third quantization index is used to indicate the quantization step of the third latent variable.
[0312] In the embodiment of the present application, the first latent variable is adjusted by the first variable adjustment factor to obtain the second latent variable, and the second latent variable is processed by the context coding neural network model to obtain the third latent variable, and the total number of coded bits of the entropy coding result of the second latent variable and the entropy coding result of the third latent variable meet the preset coding rate condition, so that the number of coded bits of the entropy coding result of the latent variable corresponding to each frame of media data can meet the preset coding rate condition, that is, the number of coded bits of the entropy coding result of the latent variable corresponding to each frame of media data can be guaranteed to be basically consistent, rather than dynamically changing, thereby meeting the encoder's demand for a stable coding rate. Further, considering the need to transmit side information (such as window type, time domain noise shaping (TNS: Temporal Noise Shaping) parameters, frequency domain noise shaping (FDNS: Frequency-domain noise shaping) parameters, and / or bandwidth extension (BWE: bandwidth extension) parameters, etc.), it can be ensured that the number of coded bits of the entropy coding result of the latent variable corresponding to each frame of media data and the number of coded bits of the side information are basically consistent as a whole, thereby meeting the encoder's demand for a stable coding rate.
[0313] Please refer to Fig.11 , Fig.11 is a flowchart of a second decoding method provided in an embodiment of the present application, which is applied to a decoding end and corresponds to Fig.10 The encoding method shown in FIG.
[0314] Step 1101: Determine a reconstructed third latent variable and a reconstructed first variable adjustment factor based on a bitstream.
[0315] In some embodiments, the entropy encoding result of the third latent variable in the bitstream may be entropy decoded, and the encoding result of the first variable adjustment factor in the bitstream may be decoded to obtain a quantized third latent variable and a quantized first variable adjustment factor. The quantized third latent variable and the quantized first variable adjustment factor may be dequantized to obtain a reconstructed third latent variable and a reconstructed first variable adjustment factor.
[0316] The decoding method of this step corresponds to the encoding method of the encoding end, and the dequantization processing of this step corresponds to the quantization processing of the encoding end. That is, the decoding method is the inverse process of the encoding method, and the dequantization processing is the inverse process of the quantization processing.
[0317] For example, the first quantization index and the third quantization index can be parsed from the bitstream, the first quantization index is used to indicate the quantization step of the first variable adjustment factor, and the third quantization index is used to indicate the quantization step of the third latent variable. According to the quantization step indicated by the first quantization index, the quantized first variable adjustment factor is dequantized to obtain the reconstructed first variable adjustment factor. According to the quantization step indicated by the third quantization index, the quantized third latent variable is dequantized to obtain the reconstructed third latent variable.
[0318] Step 1102: Determine a reconstructed second latent variable based on the bitstream and the reconstructed third latent variable.
[0319] In some embodiments, the reconstructed third latent variable is processed by a context decoding neural network model to obtain a reconstructed first entropy coding model parameter, and the reconstructed second latent variable is determined based on the bitstream and the reconstructed first entropy coding model parameter.
[0320] In some embodiments, an entropy decoding model corresponding to the reconstructed first entropy coding model parameters may be determined. Based on the entropy decoding model corresponding to the reconstructed first entropy coding model parameters, the entropy coding result of the second latent variable in the bitstream is entropy decoded to obtain a quantized second latent variable. The quantized second latent variable is dequantized to obtain a reconstructed second latent variable.
[0321] The decoding method of this step corresponds to the encoding method of the encoding end, and the dequantization processing of this step corresponds to the quantization processing of the encoding end. That is, the decoding method is the inverse process of the encoding method, and the dequantization processing is the inverse process of the quantization processing.
[0322] For example, a second quantization index can be parsed from the bitstream, and the second quantization index is used to indicate the quantization step of the second latent variable. According to the quantization step indicated by the second quantization index, the quantized second latent variable is dequantized to obtain a reconstructed second latent variable.
[0323] Step 1103: Based on the reconstructed first variable adjustment factor, the reconstructed second latent variable is adjusted to obtain a reconstructed first latent variable, where the reconstructed first latent variable is used to indicate the characteristics of the media data to be decoded.
[0324] The implementation process of step 1103 may refer to the implementation process of step 902 above, which will not be repeated here.
[0325] Step 1104: Process the reconstructed first latent variable through the first decoding neural network model to obtain reconstructed media data.
[0326] The implementation process of step 1104 may refer to the implementation process of step 903 above, which will not be repeated here.
[0327] In the embodiment of the present application, since the total number of coded bits of the entropy coding result of the second latent variable and the entropy coding result of the third latent variable meet the preset coding rate condition, it can be ensured that the number of coded bits of the entropy coding result of the latent variable corresponding to each frame of media data can meet the preset coding rate condition, that is, it can be ensured that the number of coded bits of the entropy coding result of the latent variable corresponding to each frame of media data remains basically consistent, rather than dynamically changing, thereby meeting the encoder's demand for a stable coding rate. Further, considering the need to transmit side information (such as window type, time domain noise shaping (TNS: Temporal Noise Shaping) parameters, frequency domain noise shaping (FDNS: Frequency-domainnoise shaping) parameters, and / or bandwidth extension (BWE: bandwidth extension) parameters, etc.), it can be ensured that the number of coded bits of the entropy coding result of the latent variable corresponding to each frame of media data and the number of coded bits of the side information remain basically consistent as a whole, thereby meeting the encoder's demand for a stable coding rate.
[0328] Please refer to Fig.12 , Fig.12 It is a block diagram of an exemplary encoding method provided in an embodiment of the present application. Fig.12 Mainly for Fig.10 The encoding method shown is explained as an example. Fig.12In the embodiment, an audio signal is taken as an example. The audio signal can be subjected to windowing processing to obtain the audio signal of the current frame. After the audio signal of the current frame is subjected to MDCT transform processing, the frequency domain signal of the current frame is obtained. Based on the frequency domain signal of the current frame, the first latent variable is processed by the first coding neural network model to output the first latent variable. The first latent variable is adjusted based on the first latent variable adjustment factor to obtain the second latent variable. The second latent variable is processed by the context coding neural network model to obtain the third latent variable. The third latent variable is quantized and entropy encoded to obtain the entropy encoding result of the third latent variable, and the entropy encoding result of the third latent variable is written into the bitstream. At the same time, the entropy encoding result of the third latent variable is entropy decoded to obtain the quantized third latent variable. The quantized third latent variable is dequantized to obtain the reconstructed third latent variable. The reconstructed third latent variable is processed by the context decoding neural network model to obtain the first entropy coding model parameters. An entropy coding model corresponding to the first entropy coding model parameters is selected from the entropy coding models with adjustable parameters. The second latent variable is quantized, and entropy coding is performed on the quantized second latent variable based on the selected entropy coding model to obtain an entropy coding result of the second latent variable, and the entropy coding result of the second latent variable is written into the bitstream. Then, the coding result of the first variable adjustment factor is written into the bitstream.
[0329] Please refer to Fig.13 , Fig.13 It is a block diagram of an exemplary decoding method provided in an embodiment of the present application. Fig.13 Mainly for Fig.11 The decoding method shown is explained as an example. Fig.13 In the example, an audio signal is taken as an example. The entropy encoding result of the third latent variable in the code stream is entropy decoded by an entropy decoding model to obtain a quantized third latent variable. The quantized third latent variable is dequantized to obtain a reconstructed third latent variable. The reconstructed third variable is processed by a context decoding neural network model to obtain a reconstructed first entropy encoding model parameter. Based on the reconstructed first entropy encoding model parameter, a corresponding entropy decoding model is selected from the entropy decoding model with adjustable parameters. The entropy encoding result of the second latent variable in the code stream is entropy decoded according to the selected entropy decoding model to obtain a quantized second latent variable. The quantized second latent variable is dequantized to obtain a reconstructed second latent variable. The encoding result of the first variable adjustment factor in the code stream is decoded to obtain a reconstructed first variable adjustment factor. The reconstructed second latent variable is adjusted based on the reconstructed first variable adjustment factor to obtain a reconstructed first latent variable. The reconstructed first latent variable is processed by a first decoding neural network model to obtain a reconstructed frequency domain signal of the current frame. The reconstructed frequency domain signal of the current frame is subjected to IMDCT transformation processing and de-windowing processing to obtain a reconstructed audio signal.
[0330] Please refer to Fig.14 , Fig.14 The third encoding method provided by the embodiment of the present application is a flowchart, which includes a context model, and not only adjusts the potential variables generated by the media data to be encoded by the adjustment factor, but also adjusts the potential variables determined by the context model by the adjustment factor. The encoding method is applied to an encoding end device and includes the following steps.
[0331] Step 1401: Process the media data to be encoded by using a first encoding neural network model to obtain a first latent variable, where the first latent variable is used to indicate a feature of the media data to be encoded.
[0332] The implementation process of step 1401 may refer to the implementation process of step 601, which will not be repeated here.
[0333] Step 1402: Determine a first variable adjustment factor and a second variable adjustment factor based on a first latent variable.
[0334] In some embodiments, based on the first latent variable, the corresponding context initial coding bit number and initial entropy coding model parameters can be determined through the context model, and based on the initial entropy coding model parameters, the number of coding bits of the entropy coding result of the first latent variable can be determined to obtain the basic initial coding bit number, and based on the context initial coding bit number, the basic initial coding bit number and the target coding bit number, the first variable adjustment factor and the second variable adjustment factor can be determined.
[0335] Among them, based on the first latent variable, the implementation process of determining the corresponding context initial coding bit number and the initial entropy coding model parameters through the context model, and based on the initial entropy coding model parameters, determining the number of coding bits of the entropy coding result of the first latent variable to obtain the basic initial coding bit number can refer to the relevant description in the above step 1002, which will not be repeated here.
[0336] In other embodiments, the first preset adjustment factor can be used as the first initial adjustment factor, and the second preset adjustment factor can be used as the second initial adjustment factor. The first latent variable is adjusted based on the first initial adjustment factor, and the corresponding context initial coding bit number and initial entropy coding model parameters are determined through the context model based on the adjusted first latent variable and the second initial adjustment factor. Based on the initial entropy coding model parameters, the coding bit number of the entropy coding result of the first latent variable is determined to obtain the basic initial coding bit number. The first variable adjustment factor and the second variable adjustment factor are determined based on the context initial coding bit number, the basic initial coding bit number and the target coding bit number.
[0337] The implementation process of adjusting the first latent variable based on the first initial adjustment factor may refer to the relevant description in the above step 1002, which will not be repeated here.
[0338] Among them, the context model includes a context coding neural network model and a context decoding neural network model. Based on the adjusted first latent variable and the second initial adjustment factor, the implementation process of determining the corresponding context initial coding bit number and initial entropy coding model parameters through the context model includes: processing the adjusted first latent variable through the context coding neural network model to obtain a sixth latent variable, and the sixth latent variable is used to indicate the probability distribution of the adjusted first latent variable. Adjust the sixth latent variable based on the second initial adjustment factor to obtain a seventh latent variable. Determine the entropy coding result of the seventh latent variable, and use the coding bit number of the entropy coding result of the seventh latent variable as the context initial coding bit number. Reconstruct the seventh latent variable based on the entropy coding result of the seventh latent variable, and process the reconstructed seventh latent variable through the context decoding neural network model to obtain the initial entropy coding model parameters.
[0339] As an example, the adjusted first latent variable is processed by a context coding neural network model to obtain a sixth latent variable. The sixth latent variable is adjusted based on the second initial adjustment factor to obtain a seventh latent variable. The seventh latent variable is quantized to obtain a quantized seventh latent variable. The quantized seventh latent variable is entropy encoded, and the number of coded bits of the entropy encoding result is counted to obtain the context initial coding bit number. Afterwards, the entropy encoding result of the seventh latent variable is entropy decoded to obtain a quantized seventh latent variable, and the quantized seventh latent variable is dequantized to obtain a reconstructed seventh latent variable. The reconstructed seventh latent variable is input into the context decoding neural network model to obtain the initial entropy coding model parameters output by the context decoding neural network model.
[0340] The implementation process of adjusting the sixth latent variable based on the second initial adjustment factor is: multiplying each element in the sixth latent variable by the corresponding element in the second initial adjustment factor to obtain the seventh latent variable.
[0341] It is worth noting that the above implementation process is only an example. In actual applications, other methods can also be used for adjustment. For example, each element in the sixth potential variable can be divided by the corresponding element in the second initial adjustment factor to obtain the seventh potential variable. The embodiment of the present application does not limit the adjustment method.
[0342] The specific implementation process of the remaining steps can refer to the description of the corresponding steps in the previous text and will not be repeated here.
[0343] It should be noted that, in the embodiment of the present application, an initial value of the adjustment factor is set for the third potential variable, and the initial value of the adjustment factor is usually equal to 1. The second preset adjustment factor may be greater than or equal to the initial value of the adjustment factor, or may be less than the initial value of the adjustment factor. For example, the second preset adjustment factor is a constant such as 1 or 2. In the case where the first variable adjustment factor and the second variable adjustment factor are determined by the first implementation method described above, the second initial adjustment factor is the initial value of the adjustment factor. In the case where the first variable adjustment factor and the second variable adjustment factor are determined by the second implementation method described above, the second initial adjustment factor is the second preset adjustment factor.
[0344] In addition, the second initial adjustment factor can be a scalar or a vector. For detailed introduction, please refer to the relevant introduction of the first initial adjustment factor.
[0345] The number of bits of the initial coding of the context, the number of bits of the initial coding of the base and the number of bits of the target coding is determined. There are two implementation processes of the first variable adjustment factor and the second variable adjustment factor, which will be introduced below respectively.
[0346] In a first implementation, the second variable adjustment factor is set to the second initial adjustment factor, and the basic target number of coding bits is determined based on at least one of the basic initial number of coding bits and the context initial number of coding bits, as well as the target number of coding bits. Based on the second initial adjustment factor, the basic target number of coding bits, and the basic initial number of coding bits, the first variable adjustment factor and the basic actual number of coding bits are determined, where the basic actual number of coding bits refers to the number of coding bits of the entropy coding result of the first latent variable adjusted by the first variable adjustment factor. Based on the target number of coding bits and the basic actual number of coding bits, the context target number of coding bits is determined. Based on the context target number of coding bits and the context initial number of coding bits, the second variable adjustment factor is determined.
[0347] Among them, based on at least one of the basic initial coding bit number and the context initial coding bit number, and the target coding bit number, the implementation process of determining the basic target coding bit number includes: subtracting the context initial coding bit number from the target coding bit number to obtain the basic target coding bit number. Alternatively, determine the ratio between the basic initial coding bit number and the context initial coding bit number, and determine the basic target coding bit number based on the ratio and the target coding bit number. Alternatively, determine the basic target coding bit number based on the ratio of the target coding bit number to the basic initial coding bit number. Of course, it can also be determined through other implementation processes.
[0348] For example, it is determined that the ratio between the basic initial coding bit number and the context initial coding bit number is 5:3. At this time, the target coding bit number can be multiplied by 5 / 8 to obtain the basic target coding bit number.
[0349] For another example, the ratio of the target number of coding bits to the basic initial number of coding bits is determined. If the ratio of the target number of coding bits to the basic initial number of coding bits is greater than the first proportional threshold, the sum of the basic initial number of coding bits and the preset first proportional adjustment step is determined as the basic target number of coding bits. If the ratio of the target number of coding bits to the basic initial number of coding bits is less than the second proportional threshold, the difference between the basic initial number of coding bits and the preset second proportional adjustment step is determined as the basic target number of coding bits. Among them, the first proportional threshold is greater than the second proportional threshold. If the ratio of the target number of coding bits to the basic initial number of coding bits is greater than or equal to the second proportional threshold and less than or equal to the first proportional threshold, the basic initial number of coding bits is determined as the basic target number of coding bits.
[0350] It should be noted that the first proportional adjustment step may be greater than the second proportional adjustment step, or less than the second proportional adjustment step, and of course, may be equal to the second proportional adjustment step. The embodiment of the present application does not limit the size relationship between the first proportional adjustment step and the second proportional adjustment step.
[0351] Among them, there are also three implementation methods for determining the first variable adjustment factor based on the second initial adjustment factor, the basic target number of coding bits and the basic initial number of coding bits, which are introduced below respectively.
[0352] Mode 11: When the basic initial coding bit number is equal to the basic target coding bit number, the first initial adjustment factor is determined as the first variable adjustment factor. When the basic initial coding bit number is not equal to the basic target coding bit number, the first variable adjustment factor is determined through a first loop mode based on the basic initial coding bit number and the basic target coding bit number.
[0353] The i-th loop processing of the first loop mode includes the following steps: determining the adjustment factor of the i-th loop processing, i is a positive integer, adjusting the first latent variable based on the adjustment factor of the i-th loop processing, and obtaining the first latent variable after the i-th adjustment. Based on the i-th adjusted first latent variable and the second initial adjustment factor, determining the i-th context coding bit number and the i-th entropy coding model parameter through the context model, determining the number of coded bits of the entropy coding result of the i-th adjusted first latent variable based on the i-th entropy coding model parameter, obtaining the i-th basic coding bit number, and determining the i-th coding bit number based on the i-th context coding bit number and the i-th basic coding bit number. If the i-th coding bit number meets the condition for continuing adjustment, the i+1-th loop processing of the first loop mode is executed. If the i-th coding bit number does not meet the condition for continuing adjustment, the execution of the first loop mode is terminated, and the first variable adjustment factor is determined based on the adjustment factor of the i-th loop processing.
[0354] Among them, the content of the method 11 for determining the first variable adjustment factor is similar to the content of the first implementation method for determining the first variable adjustment factor in step 1002. The difference is that this step is based on the first latent variable and the second initial adjustment factor after the i-th adjustment, and determines the i-th number of context coding bits and the i-th entropy coding model parameters through the context model. Among them, the implementation process of determining the i-th number of context coding bits and the i-th entropy coding model parameters through the context model based on the first latent variable and the second initial adjustment factor after the i-th adjustment can refer to the implementation process of determining the corresponding context initial coding bits and initial entropy coding model parameters through the context model based on the adjusted first latent variable and the second initial adjustment factor above, which will not be repeated here.
[0355] Mode 12, when the basic initial number of coding bits is equal to the basic target number of coding bits, the first initial adjustment factor is determined as the first variable adjustment factor. When the basic initial number of coding bits is not equal to the basic target number of coding bits, the first variable adjustment factor is determined according to the above-mentioned mode 11. However, different from the above-mentioned mode 11, when the basic initial number of coding bits is less than the basic target number of coding bits, the adjustment factor of the i-1th loop processing of the first loop mode is adjusted according to the first step length to obtain the adjustment factor of the i-th loop processing. At this time, the condition for continuing to adjust includes that the i-th number of coding bits is less than the basic target number of coding bits. When the basic initial number of coding bits is greater than the basic target number of coding bits, the adjustment factor of the i-1th loop processing of the first loop mode is adjusted according to the second step length to obtain the adjustment factor of the i-th loop processing. At this time, the condition for continuing to adjust includes that the i-th number of coding bits is greater than the basic target number of coding bits.
[0356] Among them, the relevant content in method 12 can refer to the content of the second implementation method in step 1002, and will not be repeated here.
[0357] Mode 13: When the basic initial coding bit number is less than or equal to the basic target coding bit number, the first initial adjustment factor is determined as the first variable adjustment factor. When the basic initial coding bit number is greater than the basic target coding bit number, the first variable adjustment factor can be determined according to the above mode 11. The first variable adjustment factor can also be determined according to the above mode 12 when the basic initial coding bit number is greater than the basic target coding bit number.
[0358] The implementation process of determining the context target coding bit number based on the target coding bit number and the basic actual coding bit number includes: subtracting the basic actual coding bit number from the target coding bit number to obtain the context target coding bit number.
[0359] The implementation process of determining the second variable adjustment factor based on the context target coding bit number and the context initial coding bit number is similar to the implementation process of determining the first variable adjustment factor based on the basic initial coding bit number and the basic target coding bit number. The following is also divided into three ways to introduce them respectively.
[0360] Mode 21, when the number of initial coding bits of the context is equal to the number of target coding bits of the context, the second initial adjustment factor is determined as the second variable adjustment factor. When the number of initial coding bits of the context is not equal to the number of target coding bits of the context, the first latent variable is adjusted based on the first variable adjustment factor to obtain the second latent variable. Based on the number of initial coding bits of the context, the number of target coding bits of the context and the second latent variable, the second variable adjustment factor is determined through the first loop mode.
[0361] The i-th loop processing of the first loop mode includes the following steps: determining the adjustment factor of the i-th loop processing, i is a positive integer, based on the second latent variable and the adjustment factor of the i-th loop processing, determining the i-th context coding bit number and the i-th entropy coding model parameter through the context model, determining the number of coded bits of the entropy coding result of the second latent variable based on the i-th entropy coding model parameter, obtaining the i-th basic coding bit number, and determining the i-th coding bit number based on the i-th context coding bit number and the i-th basic coding bit number. If the i-th coding bit number meets the condition for continued adjustment, the i+1-th loop processing of the first loop mode is executed. If the i-th coding bit number does not meet the condition for continued adjustment, the execution of the first loop mode is terminated, and the second variable adjustment factor is determined based on the adjustment factor of the i-th loop processing.
[0362] The implementation process of determining the i-th context coding bit number and the i-th entropy coding model parameter through the context model based on the second latent variable and the adjustment factor of the i-th loop processing includes: processing the second latent variable through the context coding neural network model to obtain a third latent variable, and the third latent variable is used to indicate the probability distribution of the second latent variable. Adjusting the third latent variable based on the adjustment factor of the i-th loop processing to obtain the i-th adjusted third latent variable. Determining the entropy coding result of the i-th adjusted third latent variable, and using the number of coded bits of the entropy coding result of the i-th adjusted third latent variable as the i-th context coding bit number. Reconstructing the i-th adjusted third latent variable based on the entropy coding result of the i-th adjusted third latent variable. Adjusting the reconstructed i-th adjusted third latent variable through the adjustment factor of the i-th loop processing to obtain the reconstructed third latent variable. Processing the reconstructed third latent variable through the context decoding neural network model to obtain the i-th entropy coding model parameter.
[0363] For the remaining steps, please refer to the description of the corresponding content in the previous text and will not be repeated here.
[0364] Mode 22, when the number of initial coding bits of the context is equal to the number of target coding bits of the context, the second initial adjustment factor is determined as the second variable adjustment factor. When the number of initial coding bits of the context is not equal to the number of target coding bits of the context, the second variable adjustment factor is determined according to the above-mentioned mode 21. However, different from the above-mentioned mode 21, when the number of initial coding bits of the context is less than the number of target coding bits of the context, the adjustment factor of the i-1th loop processing of the first loop mode is adjusted according to the first step size to obtain the adjustment factor of the i-th loop processing, and at this time, the condition for continuing to adjust includes that the number of coding bits for the i-1th time is less than the number of target coding bits of the context. When the number of initial coding bits of the context is greater than the number of target coding bits of the context, the adjustment factor of the i-1th loop processing of the first loop mode is adjusted according to the second step size to obtain the adjustment factor of the i-th loop processing, and at this time, the condition for continuing to adjust includes that the number of coding bits for the i-1th time is greater than the number of target coding bits of the context.
[0365] Mode 23, when the number of initial coding bits of the context is less than or equal to the number of target coding bits of the context, the second initial adjustment factor is determined as the second variable adjustment factor. When the number of initial coding bits of the context is greater than the number of target coding bits of the context, the second variable adjustment factor can be determined according to the above mode 21. The second variable adjustment factor can also be determined according to the above mode 22 when the number of initial coding bits of the context is greater than the number of target coding bits of the context.
[0366] In a second implementation, the target coding bit number is divided into a basic target coding bit number and a context target coding bit number, and a first variable adjustment factor is determined based on the basic target coding bit number and the basic initial coding bit number. A second variable adjustment factor is determined based on the context target coding bit number and the context initial coding bit number.
[0367] When the first variable adjustment factor is determined based on the basic target number of coding bits and the basic initial number of coding bits, the second variable adjustment factor can be set to the second initial adjustment factor, and the first variable adjustment factor can be determined based on the second initial adjustment factor, the basic target number of coding bits and the basic initial number of coding bits. The specific implementation process can refer to the above description.
[0368] In addition, when determining the second variable adjustment factor based on the context target number of coding bits and the context initial number of coding bits, the first variable adjustment factor has been determined. At this time, the second variable adjustment factor can be directly determined based on the first variable adjustment factor, the context target number of coding bits and the context initial number of coding bits. The specific implementation process can refer to the above description.
[0369] Step 1403: Obtain the entropy coding result of the second latent variable and the entropy coding result of the fourth latent variable, the second latent variable is obtained by adjusting the first latent variable by the first variable adjustment factor, the fourth latent variable is obtained by adjusting the third latent variable based on the second variable adjustment factor, the third latent variable is determined based on the second latent variable through the context model, the third latent variable is used to indicate the probability distribution of the second latent variable, and the total number of coding bits of the entropy coding result of the second latent variable and the entropy coding result of the fourth latent variable meet the preset coding rate condition.
[0370] In the process of determining the first variable adjustment factor and the second variable adjustment factor in step 1402, the entropy coding results corresponding to the adjustment factors processed in each loop are determined in the above loop process. Therefore, the entropy coding results of the second potential variable and the entropy coding results of the fourth potential variable can be directly obtained from the entropy coding results determined in the above loop process.
[0371] Of course, it can be reprocessed once. That is, the first latent variable is adjusted directly based on the first variable adjustment factor to obtain the second latent variable. Based on the second latent variable, the entropy coding result of the fourth latent coding and the second entropy coding model parameters are determined through the context model. The second latent variable is quantized to obtain the quantized second latent variable. Based on the second entropy coding model parameters, the entropy coding result of the quantized second latent variable is determined, that is, the entropy coding result of the second latent variable.
[0372] The context model includes a context coding neural network model and a context decoding neural network model. Based on the second latent variable, the implementation process of determining the entropy coding result of the fourth latent coding and the second entropy coding model parameters through the context model includes: processing the second latent variable through the context coding neural network model to obtain a third latent variable. Adjusting the third latent variable based on the second variable adjustment factor to obtain a fourth latent variable. Quantizing the fourth latent variable to obtain a quantized fourth latent variable. Entropy coding the quantized fourth latent variable to obtain an entropy coding result of the fourth latent variable. Entropy decoding the entropy coding result of the fourth latent variable to obtain a quantized fourth latent variable, dequantizing the quantized fourth latent variable to obtain a reconstructed fourth latent variable. Adjusting the reconstructed fourth latent variable based on the second variable adjustment factor to obtain a reconstructed third latent variable. Processing the reconstructed third latent variable through the context decoding neural network model to obtain the second entropy coding model parameters.
[0373] The implementation process of determining the entropy coding result of the quantized second latent variable based on the second entropy coding model parameter includes: determining an entropy coding model corresponding to the second entropy coding model parameter from an entropy coding model with adjustable coding model parameters. Based on the entropy coding model corresponding to the second entropy coding model parameter, entropy coding is performed on the quantized second latent variable to obtain an initial coding result of the second latent variable.
[0374] Step 1404: Write the entropy coding result of the second latent variable, the entropy coding result of the fourth latent variable, the coding result of the first variable adjustment factor, and the coding result of the second variable adjustment factor into the bitstream.
[0375] For the relevant contents about the encoding result of the first variable adjustment factor, please refer to the description in step 604, which will not be repeated here.
[0376] Based on the above description, the second variable adjustment factor can be a value before quantization or a value after quantization. If the second variable adjustment factor is a value before quantization, at this time, the implementation process of determining the encoding result of the second variable adjustment factor includes: quantizing and encoding the second variable adjustment factor to obtain the encoding result of the second variable adjustment factor. If the second variable adjustment factor is a value after quantization, at this time, the implementation process of determining the encoding result of the second variable adjustment factor includes: encoding the second variable adjustment factor to obtain the encoding result of the second variable adjustment factor. Among them, the second variable adjustment factor can be encoded using any encoding method, and the embodiments of the present application are not limited to this.
[0377] In addition, for some encoders, the quantization process and the encoding process are performed in one process, that is, the quantization result and the encoding result can be obtained through one process. Therefore, for the second variable adjustment factor, the encoding result of the second variable adjustment factor may also be obtained in the process of determining the second variable adjustment factor, so the encoding result of the second variable adjustment factor can be directly obtained. That is, the encoding result of the second variable adjustment factor can also be directly obtained in the process of determining the second variable adjustment factor.
[0378] Optionally, if the first variable adjustment factor and the second variable adjustment factor are values before quantization, the embodiment of the present application may also determine the quantization index corresponding to the quantization step of the first variable adjustment factor to obtain the first quantization index, and determine the quantization step of the second variable adjustment factor to obtain the fifth quantization index. Optionally, the embodiment of the present application may also determine the quantization index corresponding to the quantization step of the second latent variable to obtain the second quantization index, determine the quantization index corresponding to the quantization step of the fourth latent variable to obtain the fourth quantization index, and encode the first quantization index, the second quantization index, the fourth quantization index and the fifth quantization index into the bitstream. Among them, the quantization index is used to indicate the corresponding quantization step, that is, the first quantization index is used to indicate the quantization step of the first variable adjustment factor, the second quantization index is used to indicate the quantization step of the second latent variable, the fourth quantization index is used to indicate the quantization step of the fourth latent variable, and the fifth quantization index is used to indicate the quantization step of the second variable adjustment factor.
[0379] In an embodiment of the present application, the first latent variable is adjusted by the first variable adjustment factor to obtain the second latent variable, and the second latent variable is processed by the context coding neural network model to obtain the third latent variable. The third latent variable is adjusted by the second variable adjustment factor to obtain the fourth latent variable. Moreover, the total number of coded bits of the entropy coding result of the second latent variable and the entropy coding result of the fourth latent variable meet the preset coding rate conditions, so that the number of coded bits of the entropy coding result of the latent variable corresponding to each frame of media data can meet the preset coding rate conditions, that is, it can be ensured that the number of coded bits of the entropy coding result of the latent variable corresponding to each frame of media data remains basically consistent, rather than dynamically changing, thereby meeting the encoder's demand for a stable coding rate. Furthermore, when taking into account the need to transmit side information (such as window type, time-domain noise shaping (TNS: Temporal Noise Shaping) parameters, frequency-domain noise shaping (FDNS: Frequency-domain noise shaping) parameters, and / or bandwidth extension (BWE: bandwidth extension) parameters, etc.), it can be ensured that the number of encoded bits of the entropy encoding result of the latent variable corresponding to each frame of media data and the number of encoded bits of the side information remain basically consistent as a whole, thereby satisfying the encoder's demand for a stable coding rate.
[0380] Please refer to Fig.15 , Fig.15 is a flowchart of a third decoding method provided in an embodiment of the present application, which is applied to a decoding end. Fig.14 The encoding method shown comprises the following steps.
[0381] Step 1501: Determine a reconstructed fourth latent variable, a reconstructed first variable adjustment factor, and a reconstructed second variable adjustment factor based on a bitstream.
[0382] In some embodiments, the entropy encoding result of the fourth latent variable in the bitstream may be entropy decoded, and the encoding result of the first variable adjustment factor and the second variable adjustment factor in the bitstream may be decoded to obtain a quantized fourth latent variable, a quantized first variable adjustment factor, and a quantized second variable adjustment factor. The quantized fourth latent variable, the quantized first variable adjustment factor, and the quantized second variable adjustment factor may be dequantized to obtain a reconstructed fourth latent variable, a reconstructed first variable adjustment factor, and a reconstructed second variable adjustment factor.
[0383] The decoding method of this step corresponds to the encoding method of the encoding end, and the dequantization processing of this step corresponds to the quantization processing of the encoding end. That is, the decoding method is the inverse process of the encoding method, and the dequantization processing is the inverse process of the quantization processing.
[0384] For example, the first quantization index, the fourth quantization index and the fifth quantization index can be parsed from the code stream, the first quantization index is used to indicate the quantization step of the first variable adjustment factor, the fourth quantization index is used to indicate the quantization step of the fourth latent variable, and the fifth quantization index is used to indicate the quantization step of the second variable adjustment factor. According to the quantization step indicated by the first quantization index, the quantized first variable adjustment factor is dequantized to obtain the reconstructed first variable adjustment factor. According to the quantization step indicated by the fourth quantization index, the quantized fourth latent variable is dequantized to obtain the reconstructed fourth latent variable. According to the quantization step indicated by the fifth quantization index, the quantized second variable adjustment factor is dequantized to obtain the reconstructed second variable adjustment factor.
[0385] Step 1502: Determine a reconstructed second latent variable based on the bitstream, the reconstructed fourth latent variable and the reconstructed second variable adjustment factor.
[0386] In some embodiments, the reconstructed fourth latent variable is adjusted based on the reconstructed second variable adjustment factor to obtain a reconstructed third latent variable. The reconstructed third latent variable is processed by a context decoding neural network model to obtain a reconstructed second entropy coding model parameter, and the reconstructed second latent variable is determined based on the bitstream and the reconstructed second entropy coding model parameter.
[0387] In some embodiments, an entropy decoding model corresponding to the reconstructed second entropy coding model parameters may be determined. Based on the entropy decoding model corresponding to the second entropy coding model parameters, the entropy coding result of the second latent variable in the bitstream is entropy decoded to obtain a quantized second latent variable. The quantized second latent variable is dequantized to obtain a reconstructed second latent variable.
[0388] The decoding method of this step corresponds to the encoding method of the encoding end, and the dequantization processing of this step corresponds to the quantization processing of the encoding end. That is, the decoding method is the inverse process of the encoding method, and the dequantization processing is the inverse process of the quantization processing.
[0389] For example, a second quantization index can be parsed from the bitstream, and the second quantization index is used to indicate the quantization step of the second latent variable. According to the quantization step indicated by the second quantization index, the quantized second latent variable is dequantized to obtain a reconstructed second latent variable.
[0390] Step 1503: Based on the reconstructed first variable adjustment factor, adjust the reconstructed second latent variable to obtain the reconstructed first latent variable.
[0391] The implementation process of step 1503 may refer to the implementation process of step 902 above, which will not be repeated here.
[0392] Step 1504: Process the reconstructed first latent variable through the first decoding neural network model to obtain reconstructed media data.
[0393] The implementation process of step 1504 may refer to the implementation process of step 903 above, which will not be repeated here.
[0394] In the embodiment of the present application, since the total number of coded bits of the entropy coding result of the second latent variable and the entropy coding result of the fourth latent variable meet the preset coding rate condition, it can be ensured that the number of coded bits of the entropy coding result of the latent variable corresponding to each frame of media data can meet the preset coding rate condition, that is, it can be ensured that the number of coded bits of the entropy coding result of the latent variable corresponding to each frame of media data remains basically consistent, rather than dynamically changing, thereby meeting the encoder's demand for a stable coding rate. Further, considering the need to transmit side information (such as window type, time domain noise shaping (TNS: Temporal Noise Shaping) parameters, frequency domain noise shaping (FDNS: Frequency-domainnoise shaping) parameters, and / or bandwidth extension (BWE: bandwidth extension) parameters, etc.), it can be ensured that the number of coded bits of the entropy coding result of the latent variable corresponding to each frame of media data and the number of coded bits of the side information remain basically consistent as a whole, thereby meeting the encoder's demand for a stable coding rate.
[0395] Please refer to Fig.16 , Fig.16 It is a block diagram of an exemplary encoding method provided in an embodiment of the present application. Fig.16 Mainly for Fig.14 The encoding method shown is explained as an example. Fig.16In the embodiment, an audio signal is taken as an example. The audio signal can be subjected to windowing processing to obtain the audio signal of the current frame. After the audio signal of the current frame is subjected to MDCT transform processing, the frequency domain signal of the current frame is obtained. Based on the frequency domain signal of the current frame, the first latent variable is processed by the first coding neural network model to output the first latent variable. The first latent variable is adjusted based on the first latent variable adjustment factor to obtain the second latent variable. The second latent variable is processed by the context coding neural network model to obtain the third latent variable. The third latent variable is adjusted based on the second variable adjustment factor to obtain the fourth latent variable. The fourth latent variable is quantized and entropy encoded to obtain the entropy encoding result of the fourth latent variable, and the entropy encoding result of the fourth latent variable is written into the bitstream. At the same time, the entropy encoding result of the fourth latent variable is entropy decoded to obtain the quantized fourth latent variable. The quantized fourth latent variable is dequantized to obtain the reconstructed fourth latent variable. The reconstructed fourth latent variable is adjusted based on the second variable adjustment factor to obtain the reconstructed third latent variable. The reconstructed third latent variable is processed by the context decoding neural network model to obtain the second entropy coding model parameter. An entropy coding model corresponding to the second entropy coding model parameter is selected from the entropy coding models with adjustable parameters. The second latent variable is quantized, and the quantized second latent variable is entropy coded based on the selected entropy coding model to obtain an entropy coding result of the second latent variable, and the entropy coding result of the second latent variable is written into the bitstream. Then, the coding result of the first variable adjustment factor is written into the bitstream.
[0396] Please refer to Fig.17 , Fig.17 It is a block diagram of an exemplary decoding method provided in an embodiment of the present application. Fig.17 Mainly for Fig.15 The decoding method shown is explained as an example. Fig.17In the example, an audio signal is taken as an example. The entropy encoding result of the fourth potential variable in the code stream is entropy decoded by the entropy decoding model to obtain a quantized fourth potential variable. The quantized fourth potential variable is dequantized to obtain a reconstructed fourth potential variable. The encoding result of the second variable adjustment factor in the code stream is decoded to obtain a quantized second variable adjustment factor. The quantized second variable adjustment factor is dequantized to obtain a reconstructed second variable adjustment factor. The reconstructed fourth potential variable is adjusted based on the reconstructed second variable adjustment factor to obtain a reconstructed third potential variable. The reconstructed third variable is processed by the context decoding neural network model to obtain a reconstructed second entropy encoding model parameter. Based on the reconstructed second entropy encoding model parameter, a corresponding entropy decoding model is selected from the entropy decoding models with adjustable parameters. The entropy encoding result of the second potential variable in the code stream is entropy decoded according to the selected entropy decoding model to obtain a quantized second potential variable. The quantized second potential variable is dequantized to obtain a reconstructed second potential variable. The encoding result of the first variable adjustment factor in the code stream is decoded to obtain a reconstructed first variable adjustment factor. The reconstructed second latent variable is adjusted based on the reconstructed first variable adjustment factor to obtain a reconstructed first latent variable. The reconstructed first latent variable is processed by the first decoding neural network model to obtain a reconstructed frequency domain signal of the current frame. The reconstructed frequency domain signal of the current frame is subjected to IMDCT transformation processing and de-windowing processing to obtain a reconstructed audio signal.
[0397] Based on the three encoding methods provided in the embodiments of the present application, the embodiments of the present application also provide three encoded code streams, including:
[0398] A first encoded bitstream, the bitstream comprising: an entropy encoding result of a second latent variable and an encoding result of a first variable adjustment factor;
[0399] Among them, the second latent variable is obtained by adjusting the first latent variable by the first variable adjustment factor, the first variable adjustment factor is determined based on the first latent variable, and the first variable adjustment factor is used to make the number of coding bits of the entropy coding result of the second latent variable meet the preset coding rate condition; the first latent variable is obtained by processing the audio signal to be encoded by the first coding neural network model, and the first latent variable is used to indicate the characteristics of the audio signal to be encoded.
[0400] It should be noted that for a detailed description of the information carried in the first encoded bitstream, please refer to the above Figure 6 The relevant descriptions in the method embodiment will not be repeated here.
[0401] A second encoded bitstream, the bitstream comprising: an entropy encoding result of the second latent variable, an entropy encoding result of the third latent variable, and an encoding result of the first variable adjustment factor;
[0402] Among them, the second latent variable is obtained by adjusting the first latent variable by the first variable adjustment factor, the first variable adjustment factor is determined based on the first latent variable, and the first variable adjustment factor is used to make the number of coding bits of the entropy coding result of the second latent variable meet the preset coding rate condition; the first latent variable is obtained by processing the audio signal to be encoded by the first coding neural network model, and the first latent variable is used to indicate the characteristics of the audio signal to be encoded; the third latent variable is determined based on the second latent variable through the context model, and the entropy coding result of the third latent variable and the total number of coding bits of the entropy coding result of the second latent variable meet the preset coding rate condition.
[0403] It should be noted that for a detailed description of the information carried in the second encoded bitstream, please refer to the above Fig.10 The relevant descriptions in the method embodiment will not be repeated here.
[0404] A third encoded bitstream, the bitstream comprising: the bitstream comprising: an entropy encoding result of a second latent variable, an entropy encoding result of a fourth latent variable, an encoding result of a first variable adjustment factor, and an encoding result of a second variable adjustment factor;
[0405] Among them, the second latent variable is obtained by adjusting the first latent variable by the first variable adjustment factor, the first variable adjustment factor is determined based on the first latent variable, and the first variable adjustment factor is used to make the number of coding bits of the entropy coding result of the second latent variable meet the preset coding rate condition; the first latent variable is obtained by processing the audio signal to be encoded by the first coding neural network model, and the first latent variable is used to indicate the characteristics of the audio signal to be encoded; the fourth latent variable is obtained by adjusting the third latent variable based on the second variable adjustment factor, the second variable adjustment factor is determined based on the first latent variable, the third latent variable is determined based on the second latent variable through the context model, and the total number of coding bits of the entropy coding result of the fourth latent variable and the entropy coding result of the second latent variable meet the preset coding rate condition.
[0406] It should be noted that for a detailed description of the information carried in the third encoded bitstream, please refer to the above Fig.14 The relevant descriptions in the method embodiment will not be repeated here.
[0407] Fig.18 is a schematic diagram of the structure of a coding device provided in an embodiment of the present application. The coding device can be implemented by software, hardware or a combination of both to become part or all of a coding end device. The coding end device can be Figure 1 Source device shown. Fig.18The device includes: a data processing module 1801, an adjustment factor determination module 1802, a first encoding result acquisition module 1803 and a first encoding result writing module 1804.
[0408] The data processing module 1801 is used to process the media data to be encoded through the first encoding neural network model to obtain a first latent variable, and the first latent variable is used to indicate the characteristics of the media data to be encoded. The detailed implementation process refers to the corresponding content in the above embodiments, which will not be repeated here.
[0409] The adjustment factor determination module 1802 is used to determine the first variable adjustment factor based on the first latent variable, the first variable adjustment factor is used to make the number of coded bits of the entropy coding result of the second latent variable meet the preset coding rate condition, and the second latent variable is obtained by adjusting the first latent variable by the first variable adjustment factor. The detailed implementation process refers to the corresponding content in the above embodiments, which will not be repeated here.
[0410] The first encoding result acquisition module 1803 is used to obtain the entropy encoding result of the second latent variable. The detailed implementation process refers to the corresponding content in the above embodiments, which will not be repeated here.
[0411] The first coding result writing module 1804 is used to write the entropy coding result of the second latent variable and the coding result of the first variable adjustment factor into the bitstream. The detailed implementation process refers to the corresponding content in the above embodiments, which will not be repeated here.
[0412] Optionally, when using a fixed bit rate to encode the media data to be encoded, satisfying the preset encoding rate condition includes that the number of encoding bits is less than or equal to the target number of encoding bits; or, satisfying the preset encoding rate condition includes that the number of encoding bits is less than or equal to the target number of encoding bits, and the difference between the number of encoding bits and the target number of encoding bits is less than a bit number threshold.
[0413] Optionally, when a variable bit rate is used to encode the media data to be encoded, satisfying the preset encoding rate condition includes that an absolute value of a difference between the number of encoded bits and a target number of encoded bits is less than a bit number threshold.
[0414] Optionally, the adjustment factor determination module 1802 includes:
[0415] A bit number determination submodule, used to determine an initial encoding bit number based on a first latent variable;
[0416] The first factor determination submodule is used to determine a first variable adjustment factor based on an initial number of coding bits and a target number of coding bits.
[0417] Optionally, the initial number of coding bits is the number of coding bits of the entropy coding result of the first latent variable; or, the initial number of coding bits is the number of coding bits of the entropy coding result of the first latent variable adjusted by a first initial adjustment factor.
[0418] Optionally, when the initial number of coding bits is not equal to the target number of coding bits, the first factor determination submodule is specifically used to:
[0419] Determining a first variable adjustment factor through a first loop method based on an initial number of coded bits and a target number of coded bits;
[0420] The i-th loop processing of the first loop method includes the following steps:
[0421] Determine the adjustment factor for the i-th cycle processing, where i is a positive integer;
[0422] Adjusting the first latent variable based on the adjustment factor processed in the i-th cycle to obtain the first latent variable after the i-th adjustment;
[0423] Determine the number of coded bits of the entropy coding result of the first latent variable after the i-th adjustment to obtain the i-th number of coded bits;
[0424] If the number of coded bits for the i-th time satisfies the condition for continued adjustment, the i+1-th cycle of the first cycle mode is executed;
[0425] If the number of coded bits for the i-th time does not satisfy the condition for continued adjustment, the execution of the first loop mode is terminated, and the first variable adjustment factor is determined based on the adjustment factor of the i-th loop processing.
[0426] Optionally, the device further comprises:
[0427] A second encoding result acquisition module is used to obtain an entropy encoding result of a third latent variable, where the third latent variable is determined based on the second latent variable through a context model;
[0428] A second encoding result writing module, used for writing the entropy encoding result of the third latent variable into the bitstream;
[0429] The total number of coded bits of the entropy coding result of the second latent variable and the entropy coding result of the third latent variable meets the preset coding rate condition.
[0430] Optionally, the adjustment factor determination module 1802 includes:
[0431] A bit number determination submodule, used to determine an initial encoding bit number based on a first latent variable;
[0432] The first factor determination submodule is used to determine a first variable adjustment factor based on an initial number of coding bits and a target number of coding bits.
[0433] Optionally, the bit number determination submodule is specifically used for:
[0434] Based on the first latent variable, determining the corresponding number of initial context coding bits and initial entropy coding model parameters through the context model;
[0435] Determining the number of coded bits of the entropy coding result of the first latent variable based on the initial entropy coding model parameters to obtain a basic initial number of coded bits;
[0436] The initial number of coding bits is determined based on the context initial number of coding bits and the basic initial number of coding bits.
[0437] Optionally, when the initial number of coding bits is not equal to the target number of coding bits, the first factor determination submodule is specifically used to:
[0438] Determining a first variable adjustment factor through a first loop method based on an initial number of coded bits and a target number of coded bits;
[0439] The i-th loop processing of the first loop method includes the following steps:
[0440] Determine the adjustment factor for the i-th cycle processing, where i is a positive integer;
[0441] Adjust the first latent variable based on the adjustment factor of the i-th cycle processing to obtain the i-th adjusted first latent variable;
[0442] Based on the first latent variable adjusted for the i-th time, determining the i-th number of context coding bits and the i-th entropy coding model parameters through the context model;
[0443] Determine, based on the i-th entropy coding model parameter, the number of coded bits of the entropy coding result of the i-th adjusted first latent variable to obtain the i-th basic coded bit number;
[0444] Determine the number of encoding bits for the i-th time based on the number of context encoding bits for the i-th time and the number of basic encoding bits for the i-th time;
[0445] If the number of coded bits for the i-th time satisfies the condition for continued adjustment, the i+1-th cycle of the first cycle mode is executed;
[0446] If the number of coded bits for the i-th time does not satisfy the condition for continued adjustment, the execution of the first loop mode is terminated, and the first variable adjustment factor is determined based on the adjustment factor of the i-th loop processing.
[0447] Optionally, the first factor determination submodule is specifically used for:
[0448] Determine an adjustment factor for the i-th loop processing based on the adjustment factor for the i-1th loop processing of the first loop mode, the i-1th number of coded bits, and the target number of coded bits;
[0449] Wherein, in the case of i=1, the adjustment factor of the i-1th cycle processing is the first initial adjustment factor, and the number of coded bits of the i-1th cycle is the initial number of coded bits;
[0450] The conditions for continued adjustment include that the number of coded bits for the i-1th time and the number of coded bits for the i-th time are both less than the target number of coded bits, or the conditions for continued adjustment include that the number of coded bits for the i-1th time and the number of coded bits for the i-th time are both greater than the target number of coded bits.
[0451] Optionally, when the initial number of coding bits is less than the target number of coding bits, the first factor determination submodule is specifically used to:
[0452] Adjust the adjustment factor of the i-1th cycle processing of the first cycle mode according to the first step length to obtain the adjustment factor of the i-th cycle processing;
[0453] Wherein, when i=1, the adjustment factor of the (i-1)th cycle processing is the first initial adjustment factor;
[0454] The condition for continuing adjustment includes that the number of coded bits for the i-th time is less than the target number of coded bits.
[0455] Optionally, when the initial number of coding bits is greater than the target number of coding bits, the first factor determination submodule is specifically used to:
[0456] Adjust the adjustment factor of the (i-1)th cycle processing of the first cycle mode according to the second step length to obtain the adjustment factor of the (i)th cycle processing;
[0457] Wherein, when i=1, the adjustment factor of the (i-1)th cycle processing is the first initial adjustment factor;
[0458] The condition for continuing adjustment includes that the number of coded bits for the i-th time is greater than the target number of coded bits.
[0459] Optionally, the first factor determination submodule is specifically used for:
[0460] When the initial number of coded bits is less than the target number of coded bits, the first initial adjustment factor is determined as the first variable adjustment factor.
[0461] Optionally, the first factor determination submodule is specifically used for:
[0462] When the number of coded bits for the i-th time is equal to the target number of coded bits, the adjustment factor for the i-th loop processing is determined as the first variable adjustment factor; or,
[0463] When the number of coded bits of the i-th cycle is not equal to the target number of coded bits, a first variable adjustment factor is determined based on the adjustment factor of the i-th cycle processing and the adjustment factor of the (i-1)-th cycle processing of the first cycle mode.
[0464] Optionally, the first factor determination submodule is specifically used for:
[0465] Determine the average of the adjustment factor for the i-th cycle and the adjustment factor for the i-1-th cycle;
[0466] A first variable adjustment factor is determined based on the average value.
[0467] Optionally, the first factor determination submodule is specifically used for:
[0468] Determine the first variable adjustment factor through a second cycle based on the adjustment factor of the i-th cycle and the adjustment factor of the (i-1)-th cycle;
[0469] The j-th cycle processing of the second cycle method includes the following steps:
[0470] determining a third adjustment factor for the j-th loop processing based on the first adjustment factor for the j-th loop processing and the second adjustment factor for the j-th loop processing, wherein, when j is equal to 1, the first adjustment factor for the j-th loop processing is one of the adjustment factor for the ith loop processing and the adjustment factor for the i-1-th loop processing, the second adjustment factor for the j-th loop processing is the other of the adjustment factor for the ith loop processing and the adjustment factor for the i-1-th loop processing, the first adjustment factor for the j-th loop processing corresponds to the j-th first number of coded bits, the second adjustment factor for the j-th loop processing corresponds to the j-th second number of coded bits, the j-th first number of coded bits is less than the j-th second number of coded bits, and j is a positive integer;
[0471] Obtaining a third number of encoded bits for the jth time, where the third number of encoded bits for the jth time refers to the number of encoded bits of the entropy encoding result of the first latent variable after the third adjustment factor is adjusted after the jth loop processing;
[0472] If the third number of encoded bits in the jth cycle does not satisfy the condition for continuing the loop, the execution of the second loop mode is terminated, and the third adjustment factor processed in the jth loop is determined as the first variable adjustment factor;
[0473] If the third number of coded bits of the jth time satisfies the condition for continuing the loop, and the third number of coded bits of the jth time is greater than the target number of coded bits and less than the second number of coded bits of the jth time, the third adjustment factor of the jth loop processing is used as the second adjustment factor of the j+1th loop processing, and the first adjustment factor of the jth loop processing is used as the first adjustment factor of the j+1th loop processing, and the j+1th loop processing of the second loop mode is performed;
[0474] If the third number of encoded bits for the jth time meets the condition for continuing the loop, and the third number of encoded bits for the jth time is less than the target number of encoded bits and greater than the first number of encoded bits for the jth time, the third adjustment factor of the jth loop processing is used as the first adjustment factor of the j+1th loop processing, and the second adjustment factor of the jth loop processing is used as the second adjustment factor of the j+1th loop processing, and the j+1th loop processing of the second loop mode is executed.
[0475] Optionally, the first factor determination submodule is specifically used for:
[0476] Determine the first variable adjustment factor through a second cycle based on the adjustment factor of the i-th cycle and the adjustment factor of the (i-1)-th cycle;
[0477] The j-th cycle processing of the second cycle method includes the following steps:
[0478] determining a third adjustment factor for the j-th loop processing based on the first adjustment factor for the j-th loop processing and the second adjustment factor for the j-th loop processing, wherein, when j is equal to 1, the first adjustment factor for the j-th loop processing is one of the adjustment factor for the ith loop processing and the adjustment factor for the i-1-th loop processing, the second adjustment factor for the j-th loop processing is the other of the adjustment factor for the ith loop processing and the adjustment factor for the i-1-th loop processing, the first adjustment factor for the j-th loop processing corresponds to the j-th first number of coded bits, the second adjustment factor for the j-th loop processing corresponds to the j-th second number of coded bits, the j-th first number of coded bits is less than the j-th second number of coded bits, and j is a positive integer;
[0479] Obtaining a third number of encoded bits for the jth time, where the third number of encoded bits for the jth time refers to the number of encoded bits of the entropy encoding result of the first latent variable after the third adjustment factor is adjusted after the jth loop processing;
[0480] If the third number of encoded bits in the jth cycle does not satisfy the condition for continuing the loop, the execution of the second loop mode is terminated, and the third adjustment factor processed in the jth loop is determined as the first variable adjustment factor;
[0481] If j reaches the maximum number of loops and the third number of coded bits in the jth loop satisfies the condition for continuing the loop, the execution of the second loop mode is terminated, and the first variable adjustment factor is determined based on the first adjustment factor of the jth loop processing;
[0482] If j does not reach the maximum number of loops, the third number of coded bits in the jth loop meets the condition for continuing the loop, and the third number of coded bits in the jth loop is greater than the target number of coded bits and less than the second number of coded bits in the jth loop, the third adjustment factor of the jth loop processing is used as the second adjustment factor of the j+1th loop processing, and the first adjustment factor of the jth loop processing is used as the first adjustment factor of the j+1th loop processing, and the j+1th loop processing of the second loop mode is performed;
[0483] If j has not reached the maximum number of loops, the third number of coded bits for the jth time meets the condition for continuing the loop, and the third number of coded bits for the jth time is less than the target number of coded bits and greater than the first number of coded bits for the jth time, the third adjustment factor of the jth loop processing is used as the first adjustment factor of the j+1th loop processing, and the second adjustment factor of the jth loop processing is used as the second adjustment factor of the j+1th loop processing, and the j+1th loop processing of the second loop mode is executed.
[0484] Optionally, the first factor determination submodule is specifically used for:
[0485] In the case where the media data to be encoded is encoded using a fixed bit rate, the first adjustment factor processed in the j-th loop is determined as the first variable adjustment factor.
[0486] Optionally, the first factor determination submodule is specifically used for:
[0487] In the case of encoding the media data to be encoded using a variable bit rate, determining a first difference between a target number of encoding bits and a first number of encoding bits for the jth time, and determining a second difference between a second number of encoding bits for the jth time and the target number of encoding bits;
[0488] If the first difference is less than the second difference, the first adjustment factor processed in the j-th cycle is determined as the first variable adjustment factor;
[0489] If the second difference is less than the first difference, the second adjustment factor processed in the j-th cycle is determined as the first variable adjustment factor;
[0490] If the first difference is equal to the second difference, the first adjustment factor processed in the j-th loop is determined as the first variable adjustment factor, or the second adjustment factor processed in the j-th loop is determined as the first variable adjustment factor.
[0491] Optionally, when using a fixed bit rate to encode the media data to be encoded, the condition for continuing the loop includes that the third number of encoding bits for the jth time is greater than the target number of encoding bits, or, the condition for continuing the loop includes that the third number of encoding bits for the jth time is less than the target number of encoding bits, and the difference between the target number of encoding bits and the third number of encoding bits for the jth time is greater than a bit number threshold.
[0492] Optionally, when the media data to be encoded is encoded using a variable bit rate, the loop continuation condition includes that the absolute value of the difference between the target encoding bit number and the third encoding bit number of the jth time is greater than a bit number threshold.
[0493] Optionally, the first factor determination submodule is specifically used for:
[0494] When the initial number of coded bits is equal to the target number of coded bits, the first initial adjustment factor is determined as the first variable adjustment factor.
[0495] Optionally, the device further comprises:
[0496] The adjustment factor determination module 1802 is further used to determine the second variable adjustment factor based on the first latent variable;
[0497] A third encoding result acquisition module is used to obtain an entropy encoding result of a fourth latent variable, where the fourth latent variable is obtained by adjusting the third latent variable based on the second variable adjustment factor, and the third latent variable is determined based on the second latent variable through a context model;
[0498] A third encoding result writing module is used to write the entropy encoding result of the fourth latent variable and the encoding result of the second variable adjustment factor into the bitstream;
[0499] Among them, the total number of coded bits of the entropy coding result of the second latent variable and the entropy coding result of the fourth latent variable meets the preset coding rate condition.
[0500] Optionally, the adjustment factor determination module 1802 includes:
[0501] A first determination submodule, configured to determine the corresponding number of initial context coding bits and initial entropy coding model parameters through a context model based on a first latent variable;
[0502] A second determination submodule is used to determine the number of coded bits of the entropy coding result of the first latent variable based on the initial entropy coding model parameters to obtain a basic initial coded bit number;
[0503] The second factor determination submodule is used to determine a first variable adjustment factor and a second variable adjustment factor based on the context initial coding bit number, the basic initial coding bit number and the target coding bit number.
[0504] Optionally, the second factor determination submodule is specifically used for:
[0505] Determining a basic target number of coding bits based on at least one of a basic initial number of coding bits and a context initial number of coding bits, and a target number of coding bits;
[0506] Determine a first variable adjustment factor and a basic actual number of coding bits based on the second initial adjustment factor, the basic target number of coding bits, and the basic initial number of coding bits, wherein the basic actual number of coding bits refers to the number of coding bits of the entropy coding result of the first latent variable adjusted by the first variable adjustment factor;
[0507] Determining a context target number of coding bits based on the target number of coding bits and the base actual number of coding bits;
[0508] A second variable adjustment factor is determined based on the context target number of coding bits and the context initial number of coding bits.
[0509] Optionally, the second factor determination submodule is specifically used for:
[0510] Dividing the target coding bit number into a basic target coding bit number and a context target coding bit number;
[0511] Determining a first variable adjustment factor based on a basic target number of coding bits and a basic initial number of coding bits;
[0512] A second variable adjustment factor is determined based on the context target number of coding bits and the context initial number of coding bits.
[0513] Optionally, the media data is an audio signal, a video signal or an image.
[0514] Since the number of coded bits of the entropy coding result of the second latent variable meets the preset coding rate condition, it can be ensured that the number of coded bits of the entropy coding result of the latent variable corresponding to each frame of media data can meet the preset coding rate condition, that is, it can be ensured that the number of coded bits of the entropy coding result of the latent variable corresponding to each frame of media data remains basically consistent, rather than dynamically changing, thereby meeting the encoder's demand for a stable coding rate. Further, considering the need to transmit side information (such as window type, time-domain noise shaping (TNS: Temporal Noise Shaping) parameters, frequency-domain noise shaping (FDNS: Frequency-domain noise shaping) parameters, and / or bandwidth extension (BWE: bandwidth extension) parameters, etc.), it can be ensured that the number of coded bits of the entropy coding result of the latent variable corresponding to each frame of media data and the number of coded bits of the side information remain basically consistent as a whole, thereby meeting the encoder's demand for a stable coding rate.
[0515] It should be noted that: when the encoding device provided in the above embodiment performs encoding, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules based on needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the encoding device provided in the above embodiment and the encoding method embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.
[0516] Fig.19 is a schematic diagram of a decoding device provided in an embodiment of the present application. The decoding device can be implemented by software, hardware or a combination of both to become part or all of a decoding end device. The decoding end device can be Figure 1 Destination device shown. Fig.19 The device includes: a first determination module 1901, a variable adjustment module 1902 and a variable processing module 1903.
[0517] The first determination module 1901 is used to determine the reconstructed second potential variable and the reconstructed first variable adjustment factor based on the bitstream. The detailed implementation process refers to the corresponding content in the above embodiments, which will not be repeated here.
[0518] The variable adjustment module 1902 is used to adjust the reconstructed second latent variable based on the reconstructed first variable adjustment factor to obtain a reconstructed first latent variable, where the reconstructed first latent variable is used to indicate the characteristics of the media data to be decoded. The detailed implementation process refers to the corresponding content in the above embodiments, which will not be repeated here.
[0519] The variable processing module 1903 is used to process the reconstructed first latent variable through the first decoding neural network model to obtain reconstructed media data. The detailed implementation process refers to the corresponding content in the above embodiments, which will not be repeated here.
[0520] Optionally, the first determining module 1901 includes:
[0521] A first determining submodule, configured to determine a reconstructed third latent variable based on a bitstream;
[0522] The second determination submodule is used to determine the reconstructed second latent variable based on the bitstream and the reconstructed third latent variable.
[0523] Optionally, the second determining submodule is specifically used for:
[0524] Processing the reconstructed third latent variable through the context decoding neural network model to obtain a reconstructed first entropy coding model parameter;
[0525] Based on the bitstream and the reconstructed first entropy coding model parameters, a reconstructed second latent variable is determined.
[0526] Optionally, the first determining module 1901 includes:
[0527] A third determination submodule, configured to determine a reconstructed fourth latent variable and a reconstructed second variable adjustment factor based on a bitstream;
[0528] The fourth determination submodule is used to determine the reconstructed second latent variable based on the bitstream, the reconstructed fourth latent variable and the reconstructed second variable adjustment factor.
[0529] Optionally, the fourth determining submodule is specifically used to:
[0530] Based on the reconstructed second variable adjustment factor, the reconstructed fourth latent variable is adjusted to obtain a reconstructed third latent variable;
[0531] Processing the reconstructed third latent variable through the context decoding neural network model to obtain a reconstructed second entropy coding model parameter;
[0532] Based on the bitstream and the reconstructed second entropy coding model parameters, a reconstructed second latent variable is determined.
[0533] Optionally, the media data is an audio signal, a video signal or an image.
[0534] In the embodiment of the present application, since the number of coded bits of the entropy coding result of the second latent variable meets the preset coding rate condition, it can be ensured that the number of coded bits of the entropy coding result of the latent variable corresponding to each frame of media data can meet the preset coding rate condition, that is, it can be ensured that the number of coded bits of the entropy coding result of the latent variable corresponding to each frame of media data remains basically consistent, rather than dynamically changing, thereby meeting the encoder's demand for a stable coding rate. Further, considering the need to transmit side information (such as window type, time-domain noise shaping (TNS: Temporal Noise Shaping) parameters, frequency-domain noise shaping (FDNS: Frequency-domain noise shaping) parameters, and / or bandwidth extension (BWE: bandwidth extension) parameters, etc.), it can be ensured that the number of coded bits of the entropy coding result of the latent variable corresponding to each frame of media data and the number of coded bits of the side information remain basically consistent as a whole, thereby meeting the encoder's demand for a stable coding rate.
[0535] It should be noted that: when the decoding device provided in the above embodiment performs decoding, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules based on needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the decoding device provided in the above embodiment and the decoding method embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.
[0536] Fig. 20 Schematic block diagram of a coding and decoding device 2000 for an embodiment of the present application. The coding and decoding device 2000 may include a processor 2001, a memory 2002 and a bus system 2003. The processor 2001 and the memory 2002 are connected via the bus system 2003, the memory 2002 is used to store instructions, and the processor 2001 is used to execute the instructions stored in the memory 2002 to execute various encoding or decoding methods described in the embodiments of the present application. To avoid repetition, it is not described in detail here.
[0537] In the embodiment of the present application, the processor 2001 may be a central processing unit (CPU), or other general-purpose processors, DSP, ASIC, FPGA or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.
[0538] The memory 2002 may include a ROM device or a RAM device. Any other suitable type of storage device may also be used as the memory 2002. The memory 2002 may include code and data 20021 accessed by the processor 2001 using the bus 2003. The memory 2002 may further include an operating system 20023 and an application 20022, which includes at least one program that allows the processor 2001 to perform the encoding or decoding method described in the embodiment of the present application. For example, the application 20022 may include applications 1 to N, which further include an encoding or decoding application (referred to as a codec application) that executes the encoding or decoding method described in the embodiment of the present application.
[0539] The bus system 2003 may include, in addition to the data bus, a power bus, a control bus, a status signal bus, etc. However, for the sake of clarity, various buses are labeled as the bus system 2003 in the figure.
[0540] Optionally, the codec apparatus 2000 may further include one or more output devices, such as a display 2004. In one example, the display 2004 may be a touch-sensitive display that combines a display with a touch-sensitive unit operable to sense touch input. The display 2004 may be connected to the processor 2001 via a bus 2003.
[0541] It should be noted that the encoding and decoding device 2000 can execute the encoding method in the embodiment of the present application, and can also execute the decoding method in the embodiment of the present application.
[0542] Those skilled in the art will appreciate that the functions described in conjunction with the various illustrative logic blocks, modules, and algorithm steps disclosed herein can be implemented in hardware, software, firmware, or any combination thereof. If implemented in software, the functions described in the various illustrative logic blocks, modules, and steps can be stored or transmitted as one or more instructions or codes on a computer-readable medium and executed by a hardware-based processing unit. Computer-readable media may include computer-readable storage media, which corresponds to tangible media, such as data storage media, or includes any media (e.g., based on a communication protocol) that facilitates the transfer of a computer program from one place to another. In this manner, computer-readable media may generally correspond to (1) non-temporary tangible computer-readable storage media, or (2) communication media, such as signals or carrier waves. Data storage media may be any available media that can be accessed by one or more computers or one or more processors to retrieve instructions, codes, and / or data structures for implementing the techniques described in this application. A computer program product may include computer-readable media.
[0543] As an example and not limitation, such computer-readable storage media may include RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage or other magnetic storage, flash memory, or any other medium that can be used to store the desired program code in the form of instructions or data structures and can be accessed by a computer. Also, any connection is properly referred to as a computer-readable medium. For example, if instructions are transmitted from a website, server or other remote source using a coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL), or wireless technologies such as infrared, radio and microwave, then the coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio and microwave are included in the definition of media. However, it should be understood that the computer-readable storage media and data storage media do not include connections, carrier waves, signals or other temporary media, but are actually directed to non-temporary tangible storage media. As used herein, disks and optical disks include compact disks (CDs), laser optical disks, optical optical disks, DVDs, and Blu-ray disks, where disks typically reproduce data magnetically, while optical disks reproduce data optically using lasers. Combinations of the above should also be included within the scope of computer-readable media.
[0544] Instructions may be executed by one or more processors such as one or more digital signal processors (DSPs), general-purpose microprocessors, application-specific integrated circuits (ASICs), field programmable logic arrays (FPGAs), or other equivalent integrated or discrete logic circuits. Therefore, the term "processor" as used herein may refer to any of the aforementioned structures or any other structures suitable for implementing the techniques described herein. In addition, in some aspects, the functions described by the various illustrative logic blocks, modules, and steps described herein may be provided in dedicated hardware and / or software modules configured for encoding and decoding, or incorporated in a combined codec. Moreover, the technology may be fully implemented in one or more circuits or logic elements. In one example, the various illustrative logic blocks, units, and modules in the encoder 100 and the decoder 200 may be understood as corresponding circuit devices or logic elements.
[0545] The techniques of the embodiments of the present application can be implemented in a variety of devices or equipment, including wireless handsets, integrated circuits (ICs), or a group of ICs (e.g., chipsets). The various components, modules, or units described in the embodiments of the present application are intended to emphasize the functional aspects of the devices used to perform the disclosed techniques, but they do not necessarily need to be implemented by different hardware units. In fact, as described above, the various units can be combined in a codec hardware unit in combination with appropriate software and / or firmware, or provided by interoperable hardware units (including one or more processors as described above).
[0546] That is to say, in the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from one website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access, or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a digital versatile disc (DVD)), or a semiconductor medium (e.g., a solid state disk (SSD)), etc. It is worth noting that the computer-readable storage medium mentioned in the embodiment of the present application may be a non-volatile storage medium, in other words, a non-transient storage medium.
[0547] It should be understood that the "multiple" mentioned herein refers to two or more. In the description of the embodiments of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in this article is only a description of the association relationship of the associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in order to facilitate the clear description of the technical solution of the embodiments of the present application, in the embodiments of the present application, the words "first", "second" and the like are used to distinguish between the same items or similar items with basically the same functions and effects. Those skilled in the art can understand that the words "first", "second" and the like do not limit the quantity and execution order, and the words "first", "second" and the like do not limit them to be necessarily different.
[0548] The above-mentioned embodiments are provided for the present application and are not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A coding method, characterized in that: The method comprises: Processing the audio signal to be encoded by a first encoding neural network model to obtain a first latent variable, where the first latent variable is used to indicate a feature of the audio signal to be encoded; Determine a first variable adjustment factor based on the first latent variable, the first variable adjustment factor is used to make the number of coded bits of the entropy coding result of the second latent variable meet a preset coding rate condition, and the second latent variable is obtained by adjusting the first latent variable by the first variable adjustment factor; Obtaining an entropy encoding result of the second latent variable; The entropy encoding result of the second latent variable and the encoding result of the first variable adjustment factor are written into the bitstream.
2. The method according to claim 1, characterized in that In the case where the audio signal to be encoded is encoded using a fixed bit rate, the satisfying the preset encoding rate condition includes that the number of encoding bits is less than or equal to a target number of encoding bits; or, the satisfying the preset encoding rate condition includes that the number of encoding bits is less than or equal to the target number of encoding bits, and a difference between the number of encoding bits and the target number of encoding bits is less than a bit number threshold; In the case of encoding the audio signal to be encoded using a variable bit rate, satisfying the preset encoding rate condition includes that an absolute value of a difference between the number of encoding bits and a target number of encoding bits is less than a bit number threshold.
3. The method according to claim 1, characterized in that The determining of a first variable adjustment factor based on the first latent variable comprises: determining an initial number of encoding bits based on the first latent variable; The first variable adjustment factor is determined based on the initial number of coded bits and the target number of coded bits.
4. The method according to claim 3, characterized in that The initial number of coded bits is the number of coded bits of the entropy coding result of the first latent variable; or, The initial number of coded bits is the number of coded bits of the entropy coding result of the first latent variable adjusted by the first initial adjustment factor.
5. The method according to claim 1, characterized in that The method further comprises: Obtaining an entropy encoding result of a third latent variable, where the third latent variable is determined based on the second latent variable through a context model; Writing the entropy encoding result of the third latent variable into the bit stream; The total number of coded bits of the entropy coding result of the second latent variable and the entropy coding result of the third latent variable meets the preset coding rate condition.
6. The method according to claim 5, characterized in that The determining of a first variable adjustment factor based on the first latent variable comprises: determining an initial number of encoding bits based on the first latent variable; The first variable adjustment factor is determined based on the initial number of coded bits and the target number of coded bits.
7. The method according to claim 6, characterized in that The determining of the initial number of coding bits based on the first latent variable comprises: Based on the first latent variable, determining the corresponding number of initial context coding bits and initial entropy coding model parameters through the context model; Determining the number of coded bits of the entropy coding result of the first latent variable based on the initial entropy coding model parameters to obtain a basic initial coded bit number; The initial number of coding bits is determined based on the context initial number of coding bits and the basic initial number of coding bits.
8. The method according to claim 1, characterized in that The method further comprises: determining a second variable adjustment factor based on the first latent variable; Obtaining an entropy coding result of a fourth latent variable, wherein the fourth latent variable is obtained by adjusting the third latent variable based on the second variable adjustment factor, and the third latent variable is determined based on the second latent variable through a context model; Writing the entropy encoding result of the fourth latent variable and the encoding result of the second variable adjustment factor into the bitstream; The total number of coded bits of the entropy coding result of the second latent variable and the entropy coding result of the fourth latent variable meets the preset coding rate condition.
9. The method according to claim 8, characterized in that Determining a first variable adjustment factor and a second variable adjustment factor based on the first latent variable includes: Based on the first latent variable, determining the corresponding number of initial context coding bits and initial entropy coding model parameters through the context model; Determining the number of coded bits of the entropy coding result of the first latent variable based on the initial entropy coding model parameters to obtain a basic initial coded bit number; The first variable adjustment factor and the second variable adjustment factor are determined based on the context initial coding bit number, the basic initial coding bit number and the target coding bit number.
10. The method according to claim 9, characterized in that The determining the first variable adjustment factor and the second variable adjustment factor based on the context initial coding bit number, the basic initial coding bit number and the target coding bit number includes: Determining a basic target number of coding bits based on at least one of the basic initial number of coding bits and the context initial number of coding bits, and the target number of coding bits; Determine the first variable adjustment factor and a basic actual number of coding bits based on the second initial adjustment factor, the basic target number of coding bits, and the basic initial number of coding bits, wherein the basic actual number of coding bits refers to the number of coding bits of the entropy coding result of the first latent variable adjusted by the first variable adjustment factor; Determining a context target number of coding bits based on the target number of coding bits and the basic actual number of coding bits; The second variable adjustment factor is determined based on the context target number of coding bits and the context initial number of coding bits.
11. The method according to claim 9, characterized in that The determining the first variable adjustment factor and the second variable adjustment factor based on the context initial coding bit number, the basic initial coding bit number and the target coding bit number includes: Dividing the target coding bit number into a basic target coding bit number and a context target coding bit number; Determining the first variable adjustment factor based on the basic target number of coding bits and the basic initial number of coding bits; The second variable adjustment factor is determined based on the context target number of coding bits and the context initial number of coding bits.
12. A decoding method, characterized in that: The method comprises: Determine a reconstructed second latent variable and a reconstructed first variable adjustment factor based on the bit stream, wherein the first variable adjustment factor is used to make the number of coded bits of the entropy coding result of the second latent variable meet a preset coding rate condition; Based on the reconstructed first variable adjustment factor, adjusting the reconstructed second latent variable to obtain a reconstructed first latent variable, wherein the reconstructed first latent variable is used to indicate a feature of the audio signal to be decoded; The reconstructed first latent variable is processed by a first decoding neural network model to obtain a reconstructed audio signal.
13. The method according to claim 12, characterized in that The determining of the reconstructed second potential variable based on the bitstream includes: Determine a reconstructed third latent variable based on the bitstream; The reconstructed second latent variable is determined based on the code stream and the reconstructed third latent variable.
14. The method according to claim 13, characterized in that The determining the reconstructed second latent variable based on the code stream and the reconstructed third latent variable comprises: Processing the reconstructed third latent variable through a context decoding neural network model to obtain a reconstructed first entropy coding model parameter; The reconstructed second latent variable is determined based on the bitstream and the reconstructed first entropy coding model parameters.
15. The method according to claim 12, characterized in that The determining of the reconstructed second potential variable based on the bitstream includes: Determine a reconstructed fourth latent variable and a reconstructed second variable adjustment factor based on the bitstream; The reconstructed second latent variable is determined based on the code stream, the reconstructed fourth latent variable and the reconstructed second variable adjustment factor.
16. The method according to claim 15, characterized in that The determining the reconstructed second latent variable based on the bitstream, the reconstructed fourth latent variable and the reconstructed second variable adjustment factor comprises: Based on the reconstructed second variable adjustment factor, adjusting the reconstructed fourth latent variable to obtain a reconstructed third latent variable; Processing the reconstructed third latent variable through a context decoding neural network model to obtain a reconstructed second entropy coding model parameter; The reconstructed second latent variable is determined based on the bitstream and the reconstructed second entropy coding model parameters.
17. An encoded bit stream, characterized in that The bit stream includes: an entropy coding result of the second latent variable and a coding result of the first variable adjustment factor; The second latent variable is obtained by adjusting the first latent variable by the first variable adjustment factor, the first variable adjustment factor is determined based on the first latent variable, and the first variable adjustment factor is used to make the number of coded bits of the entropy coding result of the second latent variable meet a preset coding rate condition; The first latent variable is obtained by processing the audio signal to be encoded through a first encoding neural network model, and the first latent variable is used to indicate a feature of the audio signal to be encoded.
18. An encoded bit stream, characterized in that The bit stream includes: an entropy coding result of the second latent variable, an entropy coding result of the third latent variable, and a coding result of the first variable adjustment factor; The second latent variable is obtained by adjusting the first latent variable by the first variable adjustment factor, the first variable adjustment factor is determined based on the first latent variable, and the first variable adjustment factor is used to make the number of coded bits of the entropy coding result of the second latent variable meet a preset coding rate condition; The first latent variable is obtained by processing the audio signal to be encoded by a first encoding neural network model, and the first latent variable is used to indicate a feature of the audio signal to be encoded; The third latent variable is determined based on the second latent variable through a context model, and the total number of coded bits of the entropy coding result of the third latent variable and the entropy coding result of the second latent variable meets the preset coding rate condition.
19. An encoded bitstream, characterized in that The bit stream includes: an entropy coding result of the second latent variable, an entropy coding result of the fourth latent variable, a coding result of the first variable adjustment factor, and a coding result of the second variable adjustment factor; The second latent variable is obtained by adjusting the first latent variable by the first variable adjustment factor, the first variable adjustment factor is determined based on the first latent variable, and the first variable adjustment factor is used to make the number of coded bits of the entropy coding result of the second latent variable meet a preset coding rate condition; The first latent variable is obtained by processing the audio signal to be encoded by a first encoding neural network model, and the first latent variable is used to indicate a feature of the audio signal to be encoded; The fourth latent variable is obtained by adjusting the third latent variable based on the second variable adjustment factor, the second variable adjustment factor is determined based on the first latent variable, the third latent variable is determined based on the second latent variable through a context model, and the total number of encoded bits of the entropy encoding result of the fourth latent variable and the entropy encoding result of the second latent variable meet the preset coding rate condition.
20. A computer-readable storage medium, characterized in that: The storage medium stores a code stream as described in any one of claims 17-19.
