Coding method and apparatus, decoding method and apparatus, and corresponding coder and decoder
Patent Information
- Application Number
- PCT/CN2025/117890
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2025-02-28
- Filing Date
- 2025-08-29
- Publication Date
- 2026-09-03
Smart Images

Figure CN2025117890_03092026_PF_FP_ABST
Abstract
Description
Encoding methods, decoding methods and devices, and corresponding encoders and decoders
[0001] This application claims priority to Russian Patent Application No. RU2025104627, filed with the Russian Federal Intellectual Property Office on February 28, 2025, entitled "Encoding Method, Decoding Method and Apparatus, Corresponding Encoder and Decoder", the entire contents of which are incorporated herein by reference. Technical Field
[0002] This application relates to the field of encoding and decoding technology, and in particular to an encoding method, a decoding method and apparatus, and a corresponding encoder and decoder. Background Technology
[0003] Digital video capabilities can be incorporated into a wide variety of devices, including digital television, digital live broadcasting systems, wireless broadcasting systems, personal digital assistants (PDAs), laptops or desktop computers, tablets, e-book readers, digital cameras, digital recording devices, digital media players, video game devices, video game consoles, cellular or satellite radio phones (so-called "smartphones"), video conferencing devices, video streaming devices, and the like. Digital video devices implement video compression techniques, such as those described in standards defined by MPEG-2, MPEG-4, ITU-T H.263, ITU-T H.264 / MPEG-4 Part 10 High-Level Video Coding (AVC), the H.265 / HEVC video coding standard, and extensions to such standards. By implementing such video compression techniques, video devices can transmit, receive, encode, decode, and / or store digital video information more efficiently.
[0004] Current encoding and decoding technologies suffer from low efficiency and slow speed, and need to be improved. Summary of the Invention
[0005] To address the aforementioned technical problems, this application provides a decoding method, an encoding method and apparatus, and corresponding encoders and decoders. This method improves compression efficiency and decompression efficiency, and increases encoding and decoding speed.
[0006] In a first aspect, embodiments of this application provide a decoding method, the method comprising: acquiring a bitstream of an image to be decoded, the image to be decoded including a block to be decoded in a high-frequency subband; then, decoding the bitstream to obtain first information, the first information indicating that the absolute value of at least one coefficient of the block to be decoded is greater than a first value; finally, based on the first information, acquiring a code table corresponding to the block to be decoded, and decoding the block to be decoded using the code table to obtain reconstructed data of the block to be decoded, wherein the codeword lengths corresponding to coefficients in the code table whose absolute values are less than or equal to a second value are the same, and the first value is less than or equal to the second value.
[0007] In this embodiment of the application, for a block to be decoded in a high-frequency subband where at least one coefficient has an absolute value greater than a first value, a code table corresponding to the block to be decoded can be obtained. In this code table, the absolute values of coefficients whose absolute values are less than or equal to a second value correspond to the same codeword length, while the first value is less than or equal to the second value. In this way, the codeword lengths of coefficients with smaller absolute values in the block to be decoded are the same, thereby reducing the overall length of the encoded data corresponding to the block to be decoded received by the decoder, so as to reduce the amount of decoded data, improve decompression efficiency and decoding speed, and reduce the memory occupation of the bitstream.
[0008] Based on the first aspect, in some possible implementations, the bitstream includes a first syntax element that indicates that the absolute value of at least one coefficient of the block to be decoded is greater than a first value.
[0009] In this embodiment, the bitstream of the image to be decoded obtained by the decoder may include a first syntax element, and the first syntax element may indicate first information. The first information indicates that the absolute value of at least one coefficient of the block to be decoded is greater than a first value. In this way, the decoder can decode the first information based on the first syntax element according to the obtained bitstream, and then obtain the code table corresponding to the block to be decoded with at least one coefficient having an absolute value greater than the first value according to the first information. The decoder can then quickly and accurately decode the block to be decoded using the obtained code table corresponding to the block to be decoded, thereby obtaining the reconstructed data of the block to be decoded.
[0010] Furthermore, the first syntax element in the bitstream can indicate the coefficient distribution of the block to be decoded, thus reducing the amount of data in the bitstream that the decoder needs to process, thereby improving decoding speed and decompression efficiency, and reducing the memory usage of the bitstream.
[0011] Based on the first aspect, in some possible implementations, the bitstream further includes a second syntax element that indicates encoded data of the coefficient values of the block to be decoded.
[0012] In the embodiments of this application, the bitstream obtained by the decoder may include a second syntax element, and the second syntax element indicates the encoded data of the coefficient values of the block to be decoded. Compared with the encoded data of the original data of the block to be decoded (e.g., the pixel values of the block to be decoded), the encoded data of the coefficient values of the block to be decoded (e.g., the values of the quantization coefficients) has a smaller data volume, and the decoder needs to process less bitstream data, thereby improving decompression efficiency and decoding speed, and reducing the memory occupation of the bitstream.
[0013] Based on the first aspect, in some possible implementations, the above-mentioned decoding of the block to be decoded using a code table to obtain the reconstructed data of the block to be decoded includes: decoding the second syntax element using a code table to obtain the reconstructed data of the block to be decoded.
[0014] In this embodiment, when the decoder decodes the block to be decoded using the acquired code table, it can decode the second syntax element of the encoded data indicating the coefficient values of the block to be decoded using the acquired code table to obtain the reconstructed data of the block to be decoded. Compared to the encoded data of the original data of the block to be decoded (e.g., the pixel values of the block to be decoded), the encoded data of the coefficient values of the block to be decoded (e.g., the values of the quantization coefficients) has a smaller data volume, and the decoder needs to process less bitstream data, thereby improving decompression efficiency and decoding speed.
[0015] Based on the first aspect, in some possible implementations, the aforementioned first value is 1.
[0016] In this embodiment, the coefficient distribution in most areas of the high-frequency subband is relatively sparse. Sparse coefficient distribution means that the absolute values of most coefficients are less than or equal to 1, while a small portion are greater than 1. That is, there are more coefficients with absolute values of 0 and 1, and fewer coefficients with absolute values greater than 1. Thus, a small portion of the coefficient blocks in the high-frequency subband can be decoded using the code table determined by the method in this embodiment, without requiring all coefficient blocks in the high-frequency subband to be decoded using a uniform code table. This allows for the reasonable selection of a suitable code table based on the distribution of the absolute values of the coefficients in the block to be decoded in the high-frequency subband, thereby improving the data decompression speed of the high-frequency subband and ultimately improving the overall image decompression speed, enabling fast and accurate decoding. Furthermore, the length of the bitstream obtained by the decoder is shorter, further improving decompression efficiency and decoding speed while reducing the bandwidth usage of the bitstream.
[0017] Based on the first aspect, in some possible implementations, the aforementioned second syntax element indicates variable-length coding (VLC) encoded data of the coefficient values of the block to be decoded.
[0018] In this embodiment, the bitstream obtained by the decoder may include a second syntax element, which may indicate the VLC decoding data of the coefficient values of the block to be decoded. Thus, in this embodiment, the VLC encoded data of the coefficient values of the block to be decoded can be entropy decoded by VLC, thereby obtaining the coefficient values corresponding to the codewords included in the VLC encoded data of the block to be decoded by directly querying the code table, so as to realize the decoding of the VLC encoded data of the coefficient values of the block to be decoded. Compared with CABAC, which requires dynamic adjustment of the probability model, no complex calculations are required, which can improve the decoding efficiency.
[0019] Based on the first aspect, in some possible implementations, the aforementioned first syntax element indicates context-based adaptive binary arithmetic coding (CABAC) encoded data of the first information.
[0020] In this embodiment, the bitstream obtained by the decoder may include a first syntax element, which can indicate CABAC encoded data of first information. This first information indicates that the absolute value of at least one coefficient of the block to be decoded is greater than a first value. When the block to be decoded is a coefficient block in a high-frequency subband, there are fewer non-zero coefficients and more coefficients with absolute values of 0 and 1. Thus, the probability that the absolute value of a coefficient in the block to be decoded is greater than the first value is relatively low. That is, the probability of the decoded value, for example, max_grt1_flag = 1 is lower than the probability of max_grt1_flag = 0. Therefore, when the two values of the decoded value max_grt1_flag have unequal probabilities, decoding the first syntax element indicating max_grt1_flag is more suitable for entropy decoding using CABAC to obtain the first information. For the decoding side, the size of the obtained bitstream is smaller, which can reduce the decoder's reading time of the bitstream, thereby indirectly accelerating the decoding. Furthermore, the amount of data read by the decoder in the bitstream is smaller, which also reduces the memory usage of the bitstream.
[0021] Based on the first aspect, in some possible implementations, the codeword corresponding to the absolute value of the coefficient in the above code table is 00, the codeword corresponding to the absolute value of the coefficient in the above code table is 01, and the codeword corresponding to the absolute value of the coefficient in the above code table is 10.
[0022] In this embodiment, the coefficient distribution in most areas of the high-frequency subband is relatively sparse. Sparse coefficient distribution means that most of the absolute values of the coefficients are less than or equal to 1, with only a few larger coefficient values. Therefore, the absolute values of the coefficients in the block to be decoded are 0, 1, and 2, which occur frequently. In this embodiment, the codewords corresponding to the absolute values of 0, 1, and 2 in the code table of the block to be decoded can be 00, 01, and 10, respectively. It can be seen that the codewords corresponding to the absolute values of 0, 1, and 2 in the code table have the same length, and the codeword length is 2 bits. That is to say, the absolute values of 0, 1, and 2, which occur frequently in the block to be decoded, have the same and shorter codeword length in the code table. Therefore, when the decoder decodes the current block (e.g., the encoded data of the coefficient values of the current block) based on the code table, the length of the codewords that need to be processed frequently is smaller, thereby reducing the amount of decoded data, improving decompression efficiency and decoding speed, and reducing the memory occupation of the bitstream.
[0023] Based on the first aspect, in some possible implementations, the above code table is a code table corresponding to the absolute values of the coefficients of the block to be decoded, and this code table is Table 1:
[0024] Table 1
[0025] Wherein, for the absolute value of the target coefficient in the code table that is greater than 5, the number of 1s in the corresponding prefix code in the code table, prefix1Count, satisfies prefix1Count=FastLog2(abs(v)-4)+4; and the number of bits in the corresponding suffix code of the target coefficient in the code table that is greater than 5 satisfies prefix1Count-4.
[0026] In this embodiment, when the block to be decoded is a coefficient block in a high-frequency subband, the absolute values of the coefficients in the block to be decoded are frequently small, such as 0, 1, and 2. The code table obtained by the decoder corresponding to the block to be decoded can be the code table shown in Table 1 above. In this code table, the codewords corresponding to the absolute values of coefficients 0, 1, and 2 have the same length, and the codeword length is 2 bits. That is to say, the absolute values of coefficients 0, 1, and 2 that occur more frequently in the decoded block have the same length of codeword in the code table shown in Table 1 above, and the codewords are shorter. Therefore, when the decoder decodes the current block (e.g., the encoded data of the coefficient values of the current block) based on the code table described in Table 1 above, the length of the codewords that need to be processed frequently is smaller, thereby reducing the amount of decoded data, improving decompression efficiency and decoding speed, and reducing the memory usage of the bitstream.
[0027] Furthermore, the code table does not restrict the sign bit, resulting in a smaller code table size and reducing the storage space required by the decoder. In addition, due to the small size of the code table, the decoder can pre-store the code table in a cache during application, thereby reducing the time required to access the code table and further improving decoding speed.
[0028] Based on the first aspect, in some possible implementations, when the absolute value of the above coefficients is greater than 0, the above bitstream also includes the sign bit of the coefficient value of the block to be decoded.
[0029] In this embodiment of the application, when the absolute value of the coefficient of the block to be decoded is greater than 0, the bitstream may also include the sign bit of the coefficient value of the block to be decoded. Then, when the decoder performs decoding, it can, for example, decode the codeword of the absolute value of the coefficient and the sign bit of the coefficient value in parallel, thereby reducing the decoding time and improving the decoding speed.
[0030] Based on the first aspect, in some possible implementations, the size WxH of the block to be decoded is 2x2.
[0031] Where W is the width of the block to be decoded, which is also the number of columns in the block to be decoded, and H is the length of the block to be decoded, which is also the number of rows in the block to be decoded.
[0032] Secondly, embodiments of this application provide an encoding method, which includes: when the absolute value of at least one coefficient of a block to be encoded in an image to be encoded is greater than a first value, obtaining a code table corresponding to the block to be encoded, wherein the block to be encoded is a coefficient block in a high-frequency subband obtained by wavelet transform of the image to be encoded, and the codewords corresponding to coefficients in the code table whose absolute values are less than or equal to a second value have the same length, and the first value is less than or equal to the second value; then, encoding the block to be encoded based on the code table to obtain a bitstream.
[0033] In this embodiment of the application, for a block to be encoded in a high-frequency subband where at least one coefficient has an absolute value greater than a first value, a code table corresponding to the block to be encoded can be obtained. In this code table, the absolute values of coefficients whose absolute values are less than or equal to a second value correspond to codewords of the same length, while the first value is less than or equal to the second value. In this way, coefficients with smaller absolute values in the block to be encoded can be encoded into codewords of the same length through this code table, thereby reducing the overall length of the encoded data corresponding to the block to be encoded, reducing the code length of the bitstream, and improving data compression efficiency.
[0034] Based on the second aspect, in some possible implementations, the bitstream includes a first syntax element that indicates that the absolute value of at least one coefficient of the block to be encoded is greater than a first value.
[0035] In this embodiment of the application, when the absolute value of at least one coefficient of the block to be encoded in the high-frequency subband is greater than a first value, a first syntax element indicating that the absolute value of at least one coefficient of the block to be encoded is greater than the first value can be encoded into the bitstream. Thus, only one first syntax element is needed to indicate the coefficient distribution of the block to be encoded, thereby reducing the bandwidth occupation of the bitstream obtained by encoding the block to be encoded and improving the encoding speed and compression efficiency.
[0036] Based on the second aspect, in some possible implementations, the above-mentioned bitstream also includes a second syntax element that indicates encoded data of the coefficient values of the block to be encoded.
[0037] In the embodiments of this application, when the absolute value of at least one coefficient of the block to be encoded is greater than the first value, the encoder can encode the second syntax element of the encoded data indicating the coefficient value of the block to be encoded into the bitstream. Compared with the original data of the block to be encoded (e.g., the pixel value of the block to be encoded), the redundancy of the coefficient value of the block to be encoded (e.g., the value of the quantization coefficient) is small, and the amount of data to be encoded is small. In this way, the encoding speed and compression efficiency can be improved, the amount of data in the bitstream can be reduced, the bandwidth occupation of the bitstream can be reduced, and the transmission efficiency of the bitstream can be improved.
[0038] Based on the second aspect, in some possible implementations, the aforementioned first value is 1.
[0039] In this embodiment, the coefficient distribution in most areas of the high-frequency subband is relatively sparse. Sparse coefficient distribution means that most of the absolute values of the coefficients are less than or equal to 1, while a small portion are greater than 1. That is, there are more coefficients with absolute values of 0 and 1, and fewer coefficients with absolute values greater than 1. In this way, a small portion of the coefficient blocks in the high-frequency subband can be encoded using the code table determined by the method of this embodiment, without having to use a uniform code table for encoding all coefficient blocks in the high-frequency subband. Thus, a suitable code table can be reasonably selected based on the distribution of the absolute values of the coefficients of the block to be encoded in the high-frequency subband, thereby reducing the length of the codewords obtained after encoding the block to be encoded, reducing the amount of encoded data, improving the data compression speed of the high-frequency subband, and thus improving the overall compression speed of the image, shortening the bitstream length, and reducing the bandwidth usage of the bitstream.
[0040] Based on the second aspect, in some possible implementations, the aforementioned second syntax element indicates VLC-encoded data of the coefficient values of the block to be encoded.
[0041] In this embodiment, the bitstream obtained by the encoder may include a second syntax element, which may indicate the VLC encoded data of the coefficient values of the block to be encoded. Thus, the coefficient values of the block to be encoded in this embodiment can be entropy encoded by VLC, and the codewords corresponding to the coefficient values can be obtained by directly querying the code table to achieve the encoding of the coefficient values in the block to be encoded. Compared with context-based adaptive binary arithmetic coding (CABAC), which requires dynamic adjustment of the probability model, no complex calculations are required, which can improve the encoding efficiency.
[0042] Based on the second aspect, in some possible implementations, the aforementioned first syntax element is CABAC encoded data.
[0043] In this embodiment, the bitstream obtained by the encoder may include a first syntax element, which is CABAC encoded data obtained through CABAC encoding. When the block to be encoded is a coefficient block in a high-frequency subband, there are fewer non-zero coefficients in the high-frequency subband, and more coefficients with absolute values of 0 and 1. Thus, the probability that the absolute value of the coefficient in the block to be encoded is greater than the first value is relatively small. That is, the probability of max_grt1_flag = 1 is lower than the probability of max_grt1_flag = 0. Therefore, when the two values of max_grt1_flag to be encoded have unequal probabilities, CABAC encoding is more suitable for encoding max_grt1_flag. This application encodes the first syntax element using CABAC to obtain the bitstream, thereby reducing the number of bits in the encoded data, reducing encoding complexity, increasing compression speed, reducing the length of the bitstream, and thus reducing the bandwidth usage of the bitstream.
[0044] Based on the second aspect, in some possible implementations, the codeword corresponding to a coefficient absolute value of 0 in the above code table is 00, the codeword corresponding to a coefficient absolute value of 1 in the above code table is 01, and the codeword corresponding to a coefficient absolute value of 2 in the above code table is 10.
[0045] In this embodiment, the coefficient distribution in most areas of the high-frequency subband is relatively sparse. Sparse coefficient distribution means that most of the absolute values of the coefficients are less than or equal to 1, with only a few larger coefficient values. Therefore, the absolute values of the coefficients in the block to be encoded are 0, 1, and 2 more frequently. In this embodiment, the codewords corresponding to the absolute values of the coefficients 0, 1, and 2 in the code table corresponding to the block to be encoded can be 00, 01, and 10, respectively. It can be seen that the codewords corresponding to the absolute values of the coefficients 0, 1, and 2 in the code table have the same length and the codeword length is 2 bits. That is to say, the absolute values of the coefficients 0, 1, and 2 that appear more frequently in the block to be encoded have the same length in the code table and are shorter codewords. This can improve compression efficiency, improve coding efficiency, reduce the bandwidth occupation of the bitstream, and improve the transmission efficiency of the bitstream.
[0046] Based on the second aspect, in some possible implementations, the above code table is a code table corresponding to the absolute values of the coefficients of the block to be encoded, as shown in Table 1:
[0047] Table 1
[0048] Wherein, for the absolute value of the target coefficient in the code table that is greater than 5, the number of 1s in the corresponding prefix code in the code table, prefix1Count, satisfies prefix1Count=FastLog2(abs(v)-4)+4; and the number of bits in the corresponding suffix code of the target coefficient in the code table that is greater than 5 satisfies prefix1Count-4.
[0049] In this embodiment, when the block to be encoded is a coefficient block in a high-frequency subband, the absolute values of the coefficients in the block to be encoded, such as 0, 1, and 2, occur frequently. The code table corresponding to the block to be encoded obtained by the encoder can be the code table shown in Table 1 above. In the code table shown in Table 1, the codeword lengths corresponding to the absolute values of coefficients 0, 1, and 2 are the same, and the codeword length is 2 bits. That is to say, the absolute values of coefficients 0, 1, and 2 that occur frequently in the block to be encoded have the same codeword length in the code table shown in Table 1, and are shorter codeword lengths. Therefore, encoding the block to be encoded using the code table shown in Table 1 can improve compression efficiency, improve encoding efficiency, reduce the bandwidth occupation of the bitstream, and improve the transmission efficiency of the bitstream.
[0050] Furthermore, the code table does not restrict the sign bit, resulting in a smaller code table size and reducing the storage space occupied by the encoder. In addition, due to the small size of the code table, the encoder can pre-store the code table in a cache during application, thereby reducing the time required to access the code table and further improving encoding speed.
[0051] Based on the second aspect, in some possible implementations, when the absolute value of the coefficient is greater than 0, the above-mentioned bitstream also includes the sign bit of the coefficient value of the block to be encoded.
[0052] In this embodiment, when the absolute value of the coefficient of the block to be encoded is greater than 0, the encoder can also write the sign bit of the coefficient value with an absolute value greater than 0 into the bitstream. In this way, when the encoder performs encoding, it can encode the absolute value of the coefficient and the positive and negative information of the coefficient value in parallel, and match the corresponding codewords to obtain the codeword corresponding to the absolute value of the coefficient, thereby improving compression efficiency and encoding speed.
[0053] Based on the second aspect, in some possible implementations, the size WxH of the block to be encoded is 2x2.
[0054] Where W is the width of the block to be encoded, which is also the number of columns in the block to be encoded, and H is the length of the block to be encoded, which is also the number of rows in the block to be encoded.
[0055] Thirdly, embodiments of this application provide a decoding device, which may include: an acquisition module for acquiring a bitstream of an image to be decoded, the image to be decoded including a block to be decoded in a high-frequency subband; a decoding module for decoding the bitstream to obtain first information, the first information indicating that the absolute value of at least one coefficient of the block to be decoded is greater than a first value; the decoding module is further configured to acquire a code table corresponding to the block to be decoded based on the first information, and decode the block to be decoded through the code table to obtain reconstructed data of the block to be decoded, wherein the codeword lengths corresponding to coefficients whose absolute values are less than or equal to a second value in the code table are the same, and the first value is less than or equal to the second value.
[0056] Fourthly, embodiments of this application provide an encoding apparatus, comprising: an acquisition module, configured to acquire a code table corresponding to a block to be encoded when the absolute value of at least one coefficient of a block to be encoded in an image to be encoded is greater than a first value, wherein the block to be encoded is a coefficient block in a high-frequency subband obtained by wavelet transform of the image to be encoded, and the codewords corresponding to coefficients in the code table whose absolute values are less than or equal to a second value have the same length, and the first value is less than or equal to the second value; and an encoding module, configured to encode the block to be encoded based on the code table to obtain a code stream.
[0057] Fifthly, a system for distributing bitstreams is provided, the system comprising: at least one storage medium for storing a bitstream generated according to the method of the first or second aspect and any one of the embodiments of the second aspect; and a streaming media device for acquiring the bitstream from the at least one storage medium and transmitting the bitstream, wherein the streaming media device includes a content server or a content distribution server.
[0058] In a sixth aspect, a transcoding system is provided, comprising: at least one storage medium for storing a bitstream generated according to the method of the second aspect or any embodiment thereof; and a transcoding device for acquiring the bitstream from the at least one storage medium and transcoding the bitstream.
[0059] In one implementation, the transcoding device can convert the bitstream to MPEG-4 Part 4 (MP4), Matroska Video (MKV), Audio Video Interleave (AVI), Digital Audio Video (DAV), etc., without limitation.
[0060] In a seventh aspect, this application provides an apparatus comprising: one or more processors; and a memory for storing one or more programs; wherein, when the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in the first aspect or any embodiment of the first aspect. Exemplarily, the apparatus includes a decoder.
[0061] Eighthly, this application provides an apparatus comprising: one or more processors; and a memory for storing one or more programs; wherein, when the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in the second aspect or any embodiment of the second aspect above. Exemplarily, the apparatus includes an encoder.
[0062] Ninthly, this application provides a computer-readable storage medium including a computer program, which, when executed on a device, causes the device to perform the method described in the first aspect or any one of the embodiments of the first aspect.
[0063] In a tenth aspect, this application provides a computer-readable storage medium including a computer program that, when executed on a device, causes the device to perform the method described in the second aspect or any of the embodiments of the second aspect.
[0064] In one aspect, this application provides a computer program that, when executed by a device, is used to perform the method described in the first aspect or any embodiment of the first aspect, or to perform the method described in the second aspect or any embodiment of the second aspect.
[0065] In a twelfth aspect, this application provides a computer program product comprising computer program code that, when executed on a device, causes the device to perform the method described in the first aspect or any embodiment of the first aspect, or to perform the method described in the second aspect or any embodiment of the second aspect.
[0066] In a thirteenth aspect, this application provides a bitstream generated according to the method described in the second aspect or any embodiment of the second aspect.
[0067] In a fourteenth aspect, this application provides a computer-readable storage medium storing a bitstream generated according to the method in the second aspect or any embodiment of the second aspect described above.
[0068] In a fifteenth aspect, an apparatus for storing a bitstream is provided, the apparatus comprising: a transceiver unit and a storage unit, the transceiver unit being configured to receive a bitstream generated according to the method of the second aspect or any embodiment thereof, and the storage unit being configured to store the bitstream.
[0069] In a sixteenth aspect, an apparatus for transmitting a bitstream is provided, the apparatus comprising: a storage unit and a transceiver unit, the storage unit being used to store a bitstream generated according to the method of the second aspect or any embodiment thereof, and the transceiver unit being used to transmit the bitstream.
[0070] In a seventeenth aspect, an encoder is provided. The encoder includes a processing circuit that implements the steps of the second aspect or any embodiment of the second aspect described above.
[0071] In an eighteenth aspect, a decoder is provided. The decoder includes processing circuitry that implements the steps of the first aspect or any embodiment thereof. Attached Figure Description
[0072] Figure 1A is a schematic block diagram of a video encoding and decoding system provided in an embodiment of this application;
[0073] Figure 1B is a schematic block diagram of a video decoding system provided in an embodiment of this application;
[0074] Figure 2 is a schematic block diagram of an encoder provided in an embodiment of this application;
[0075] Figure 3 is a schematic block diagram of a decoder provided in an embodiment of this application;
[0076] Figure 4 is a schematic block diagram of an encoder based on wavelet transform provided in an embodiment of this application;
[0077] Figure 5 is a schematic diagram of subgraph partitioning provided in an embodiment of this application;
[0078] Figure 6 is a schematic diagram of a wavelet transform provided in an embodiment of this application;
[0079] Figure 7A is a schematic block diagram of a decoder provided in an embodiment of this application;
[0080] Figure 7B is a schematic block diagram of a decoder provided in an embodiment of this application;
[0081] Figure 8 is a schematic diagram of a bitstream structure provided in an embodiment of this application;
[0082] Figure 9 is a flowchart illustrating an encoding method provided in an embodiment of this application;
[0083] Figure 10 is a flowchart illustrating a decoding method provided in an embodiment of this application;
[0084] Figure 11 is a schematic diagram of an image to be encoded / decoded provided in an embodiment of this application;
[0085] Figure 12 is a schematic diagram of a block to be encoded / decoded in a high-frequency subband according to an embodiment of this application;
[0086] Figure 13A is a flowchart illustrating another encoding method provided in an embodiment of this application;
[0087] Figure 13B is a flowchart illustrating another decoding method provided in an embodiment of this application;
[0088] Figure 14 is a schematic diagram of the structure of a video decoding device provided in an embodiment of this application;
[0089] Figure 15 is a schematic diagram of the structure of a device provided in an embodiment of this application;
[0090] Figure 16A is a schematic diagram of a decoding device provided in an embodiment of this application;
[0091] Figure 16B is a schematic diagram of an encoding device provided in an embodiment of this application. Detailed Implementation
[0092] The embodiments of this application are described below with reference to the accompanying drawings. In the following description, reference is made to the accompanying drawings, which form part of this application and illustrate specific aspects of the embodiments of this application or to which specific aspects of the embodiments of this application may be used. It should be understood that the embodiments of this application may be used in other aspects and may include structural or logical variations not depicted in the drawings. Therefore, the following detailed description should not be construed in a limiting sense, and the scope of this application is defined by the appended claims. For example, it should be understood that the disclosure of the described methods is equally applicable to corresponding devices or systems for performing the methods, and vice versa. For example, if one or more specific method steps are described, the corresponding device may include one or more units, such as functional units, to perform the described one or more method steps (e.g., one unit performs one or more steps, or multiple units, each performing one or more of multiple steps), even if such one or more units are not explicitly described or illustrated in the drawings. On the other hand, for example, if a specific apparatus is described based on one or more units such as functional units, the corresponding method may include a step to perform the functionality of one or more units (e.g., a step to perform the functionality of one or more units, or multiple steps, each of which performs the functionality of one or more units among a plurality of units), even if such one or more steps are not explicitly described or illustrated in the accompanying drawings. Furthermore, it should be understood that, unless otherwise expressly stated, features of the various exemplary embodiments and / or aspects described herein can be combined with each other.
[0093] In the embodiments of this application, the modules / components shown in the framework diagram (or structural diagram or system diagram) are merely examples of this application. The actual framework (or structure or system) may include more or fewer modules / components than those shown in the diagram, or may have different component configurations. Furthermore, the various components / modules shown in the diagrams may be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and / or application-specific integrated circuits.
[0094] The terminology used in the implementation section of this application is for the purpose of explaining specific embodiments of this application only, and is not intended to limit this application.
[0095] The following is a brief introduction to some concepts that may be involved in the embodiments of this application. These concepts are only used to explain the specific embodiments of this application and are not intended to limit this application.
[0096] YUV is a color space model used to represent colors, widely used in image encoding and decoding, video encoding and decoding, digital image processing, television broadcasting, and other fields. YUV separates the luminance information from the chrominance information of an image.
[0097] The three components of YUV:
[0098] Y (luminance) component: Y represents the luminance information of an image, that is, the brightness or darkness of the image. It is obtained by weighting the red, green, and blue color channels according to certain weights. The Y component plays an important role in the sharpness and detail of an image.
[0099] U (chromaticity) component: U represents the chromaticity information of the image, indicating the offset of the blue channel relative to the luminance Y. It measures the change in the blue component.
[0100] V (chromaticity) component: V represents the chromaticity information of the image, indicating the offset of the red channel relative to the luminance Y.
[0101] The residual is the difference between the reconstructed value (or actual value) of a sample or data element and its predicted value.
[0102] A residual block is an M×N residual matrix composed of the residuals corresponding to the coded blocks.
[0103] Dequantization is the process of scaling the quantized residual to obtain the reconstructed residual value.
[0104] A partition divides a set into subsets. Each element in the set belongs to one and only one subset.
[0105] Partition type: The way the subsets obtained from the partition are organized.
[0106] A decoded picture is an image reconstructed by the decoder based on the bitstream.
[0107] Prediction is the specific implementation of the prediction process.
[0108] The prediction process uses previously decoded samples to obtain the predicted value for the current sample.
[0109] Syntax element: The result of parsing data units in a bitstream.
[0110] A bitstream is a binary data stream that encodes all or part of an image sample.
[0111] Variable-length coding (VLC) is a compression technique commonly used in data compression and information encoding.
[0112] Context-based adaptive binary arithmetic coding (CABAC) is an efficient entropy coding method.
[0113] Video coding generally refers to the processing of a sequence of images that form a video or video sequence. In the field of video coding, the terms "picture," "frame," or "image" can be used synonymously. Video coding is performed on the source side and typically involves processing (e.g., by compression) the raw video images to reduce the amount of data required to represent them, thus enabling more efficient storage and / or transmission. Video decoding is performed on the destination side and typically involves inverse processing relative to the encoder to reconstruct the video images. The combination of encoding and decoding is also known as encoding and decoding.
[0114] A video sequence consists of a series of images, which are further divided into slices, and slices into blocks. Video coding is performed on a block-by-block basis. In some newer video coding standards, the concept of a block has been further expanded. For example, the H.264 standard uses macroblocks (MBs), which can be further divided into multiple prediction blocks (partitions) for predictive coding. The High Efficiency Video Coding (HEVC) standard uses basic concepts such as coding units (CUs), prediction units (PUs), and transform units (TUs) to functionally divide various block units, and employs a novel tree-based structure for description. For instance, a CU can be divided into smaller CUs using a quadtree, and these smaller CUs can be further divided, forming a quadtree structure. The CU is the basic unit for partitioning and encoding the image. Similar tree structures exist for PUs and TUs. A PU corresponds to a prediction block and is the basic unit for predictive coding. CUs are further divided into multiple PUs according to partitioning patterns. TU can correspond to a transform block, which is the basic unit for transforming the prediction residual. However, whether it is CU, PU or TU, they all essentially belong to the concept of a block (or image block).
[0115] For example, in HEVC, the CTU is split into multiple CUs using a quadtree structure represented as a coding tree. At the CU level, a decision is made on whether to use inter-picture (temporal) or intra-picture (spatial) prediction to encode picture regions. Each CU can be further split into one, two, or four PUs based on the PU splitting type. The same prediction process is applied within a PU, and relevant information is transmitted to the decoder based on the PU. After obtaining residual blocks by applying the prediction process based on the PU splitting type, the CU can be segmented into transform units (TUs) according to other quadtree structures similar to the coding tree used for CUs. In the latest developments in video compression technology, quadtree and binary tree (QTBT) frame segmentation is used to divide coding blocks. In the QTBT block structure, CUs can be square or rectangular in shape.
[0116] In this paper, for ease of description and understanding, the image block to be processed in the current image is referred to as the current block. For example, in encoding, it refers to the block currently being encoded; in decoding, it refers to the block currently being decoded. The decoded image block in the reference image used to predict the current block is called the reference block. That is, the reference block is the block that provides a reference signal for the current block, where the reference signal represents the pixel value within the image block. The block in the reference image that provides a prediction signal for the current block is called the prediction block, where the prediction signal represents the pixel value, sampled value, or sampled signal within the prediction block. For example, after traversing multiple reference blocks, an optimal reference block is found. This optimal reference block will provide prediction for the current block; this block is called the prediction block.
[0117] In lossless video coding, the original video image can be reconstructed, meaning the reconstructed video image has the same quality as the original (assuming no transmission loss or other data loss during storage or transmission). In lossy video coding, further compression is performed, for example, through quantization, to reduce the amount of data required to represent the video image. However, the decoder cannot fully reconstruct the video image, meaning the quality of the reconstructed video image is lower or worse than the original video image.
[0118] The encoding / decoding method of this application embodiment encodes and decodes images or videos on a block-by-block basis.
[0119] In some embodiments, the block to be encoded or the block to be decoded may be an image block or a video block obtained from an image or video.
[0120] In some embodiments, the block to be encoded or the block to be decoded may be an image block or video block within a subgraph obtained by dividing the image or video into subgraphs.
[0121] In some embodiments, the block to be encoded or decoded may be a macroblock (MB) or a transform block (e.g., TU).
[0122] In some embodiments, the block to be encoded or the block to be decoded can be a block obtained from the transformed data of the image or video to be encoded after transformation processing (e.g., wavelet transform (also known as wavelet forward transform, etc., without limitation).
[0123] This application does not restrict the specific division method of the blocks to be encoded or decoded in an image or video, nor does it restrict the method of obtaining the blocks.
[0124] On the encoding side, the image to be encoded can be a frame from an image or video, a sub-image obtained by dividing a frame from an image or video, an image obtained after transformation (such as wavelet transform), or a sub-image from the transformed image; there are no restrictions here. On the encoding side, "current frame" can represent "image to be encoded," and "current block" can represent "block to be encoded." A frame is a frame of image to be displayed.
[0125] Similarly, the decoding side corresponds to the encoding side. On the decoding side, the image to be decoded can be a frame in an image or video, a sub-image obtained by dividing a frame in an image or video, an image obtained after transformation (such as wavelet transform), or a sub-image in the transformed image; there are no restrictions here. On the decoding side, "current frame" can represent "image to be decoded," and "current block" can represent "block to be decoded." A frame is a frame of image to be displayed.
[0126] Whether on the encoding or decoding side, the reconstructed data (also called the reconstructed value) of a block can be described as a reconstructed block, and the already encoded or decoded block referenced when encoding or decoding the current block can be described as a "reference block".
[0127] Whether on the encoding or decoding side, the prediction data for the current block is also referred to as the prediction block or the prediction value for the current block.
[0128] Whether on the encoding or decoding side, reconstruction is also referred to as refactoring.
[0129] Whether on the encoding or decoding side, the bitstream is also described as a bitstream, etc.
[0130] Whether on the encoding or decoding side, the residual is also referred to as a residual block.
[0131] Whether on the encoding or decoding side, the actual value of the current block is also expressed as the original value of the current block, or the value to be encoded in the current block.
[0132] In the accompanying drawings of the various embodiments described below, dashed boxes or dashed arrows indicate that the step or the data transmitted indicated by the arrow is optional.
[0133] The system architecture used in the embodiments of this application is described below. Referring to FIG1A, FIG1A provides an exemplary schematic block diagram of a video encoding and decoding system 10 used in the embodiments of this application. As shown in FIG1A, the video encoding and decoding system 10 may include a source device 12 and a destination device 14. The source device 12 generates encoded video data, and therefore, the source device 12 may be referred to as a video encoding device. The destination device 14 can decode the encoded video data generated by the source device 12, and therefore, the destination device 14 may be referred to as a video decoding device. Various embodiments of the source device 12, the destination device 14, or both may include one or more processors and memory coupled to the one or more processors. The memory may include, but is not limited to, RAM, ROM, EEPROM, flash memory, or any other media that can be used to store desired program code in the form of computer-accessible instructions or data structures. The source device 12 and the destination device 14 may include a variety of devices, including desktop computers, mobile computing devices, notebook (e.g., laptop) computers, tablet computers, set-top boxes, handsets, televisions, cameras, display devices, digital media players, video game consoles, in-vehicle computers, wireless communication devices, or the like.
[0134] Source device 12 and destination device 14 can communicate via link 13, through which destination device 14 can receive encoded video data from source device 12. Link 13 may include one or more media or devices capable of transmitting encoded video data from source device 12 to destination device 14. In one example, link 13 may include one or more communication media enabling source device 12 to transmit encoded video data to destination device 14 in real time. In this example, source device 12 may modulate the encoded video data according to a communication standard (e.g., a wireless communication protocol) and transmit the modulated video data to destination device 14. The one or more communication media may include wireless and / or wired communication media, such as 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, such as a local area network, wide area network, or global network (e.g., the Internet). The one or more communication media may include routers, switches, base stations, or other devices facilitating communication from source device 12 to destination device 14.
[0135] The source device 12 includes an encoder 20. Optionally, the source device 12 may also include an image source 16, an image preprocessor 18, and a communication interface 22. In specific implementations, the encoder 20, image source 16, image preprocessor 18, and communication interface 22 may be hardware components or software programs within the source device 12. These are described below:
[0136] Image source 16 may include or be any type of image capture device for, for example, capturing real-world images, and / or any type of image or commentary (for screen content encoding, some text on the screen is also considered as an image to be encoded or part of an image) generation device, such as a computer graphics processor for generating computer-animated images, or any type of device for acquiring and / or providing real-world images, computer-animated images (e.g., screen content, virtual reality (VR) images), and / or any combination thereof (e.g., augmented reality (AR) images). Image source 16 may be a camera for capturing images or a memory for storing images. Image source 16 may also include any type of (internal or external) interface for storing previously captured or generated images and / or acquiring or receiving images. When image source 16 is a camera, image source 16 may be, for example, a local or integrated camera integrated into a source device; when image source 16 is a memory, image source 16 may be a local or integrated memory integrated into a source device. When the image source 16 includes an interface, the interface may be, for example, an external interface for receiving images from an external video source, such as an external image capture device, like a camera, external storage, or an external image generation device, such as an external computer graphics processor, computer, or server. The interface can be any type of interface according to any proprietary or standardized interface protocol, such as a wired or wireless interface, or an optical interface.
[0137] An image can be viewed as a two-dimensional array or matrix of pixels. Pixels in the array are also called sampling points. The number of sampling points in the array or image along the horizontal and vertical directions (or axes) defines the image's size and / or resolution. To represent color, three color components are typically used; that is, an image can be represented as or contain three sampling arrays. For example, in RBG format or color space, an image includes corresponding red, green, and blue sampling arrays. However, in video coding, each pixel is typically represented in a luma / chroma format or color space. For example, for a YUV format image, this includes a luma component indicated by Y (sometimes also indicated by L) and two chroma components indicated by U and V. The luma component Y represents the brightness or grayscale level intensity (e.g., both are the same in a grayscale image), while the two chroma components U and V represent chroma or color information components. Accordingly, a YUV format image includes a luma sampling array of luma sample values (Y) and two chroma sampling arrays of chroma values (U and V). An RGB format image can be converted or transformed to YUV format, and vice versa; this process is also called color transformation or conversion. If the image is black and white, it may only include a luminance sampling array. In this embodiment, the image transmitted from image source 16 to image processor can also be referred to as raw image data 17.
[0138] Image preprocessor 18 is configured to receive raw image data 17 and perform preprocessing on the raw image data 17 to obtain a preprocessed image 19 or preprocessed image data 19. For example, the preprocessing performed by image preprocessor 18 may include retouching, color format conversion (e.g., from RGB format to YUV format), color correction, or noise reduction.
[0139] Encoder 20 (or video encoder 20) is used to receive preprocessed image data 19 and process the preprocessed image data 19 using a relevant prediction mode (such as the prediction mode in the various embodiments herein) to provide encoded image data 21.
[0140] Communication interface 22 can be used to receive encoded image data 21 and transmit the encoded image data 21 via link 13 to destination device 14 or any other device (such as a memory) for storage or direct reconstruction. The other device can be any device used for decoding or storage. Communication interface 22 can, for example, be used to encapsulate the encoded image data 21 into a suitable format, such as data packets, for transmission over link 13.
[0141] Destination device 14 includes decoder 30. Optionally, destination device 14 may also include communication interface 28, image post-processor 32, and display device 34. These are described below:
[0142] Communication interface 28 can be used to receive encoded image data 21 from source device 12 or any other source, such as a storage device, for example, an encoded image data storage device. Communication interface 28 can be used to transmit or receive encoded image data 21 via link 13 between source device 12 and destination device 14 or via any type of network, such as a wired or wireless connection, any type of network, such as a wired or wireless network or any combination thereof, or any type of private and public network, or any combination thereof. Communication interface 28 can be used, for example, to decapsulate data packets transmitted by communication interface 22 to obtain encoded image data 21.
[0143] Both communication interface 28 and communication interface 22 can be configured as unidirectional or bidirectional communication interfaces, and can be used, for example, to send and receive messages to establish connections, acknowledge and exchange any other information related to the communication link and / or data transmission, such as encoded image data transmission.
[0144] Decoder 30 (or video decoder 30) is used to receive encoded image data 21 and provide decoded image data 31 or decoded image 31 (the structural details of decoder 30 will be further described below based on Figure 3, Figure 4 or Figure 5).
[0145] Image post-processor 32 is used to perform post-processing on decoded image data 31 (also known as reconstructed image data) to obtain post-processed image data 33.
[0146] Display device 34 is used to receive post-processed image data 33 to display an image to, for example, a user or viewer. Display device 34 can be or may include any class of displays for presenting reconstructed images, such as integrated or external displays or monitors. For example, displays may include liquid crystal displays (LCDs), organic light emitting diode (OLED) displays, plasma displays, projectors, micro-LED displays, liquid crystal on silicon (LCoS), digital light processors (DLP), or any other class of displays.
[0147] Both encoder 20 and decoder 30 can be implemented as any of a variety of suitable circuits, such as one or more microprocessors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), discrete logic, hardware, or any combination thereof. If the technology is implemented in part in software, the device can store the software instructions in a suitable non-transitory computer-readable storage medium, and one or more processors can be used to execute the instructions in hardware to perform the technology of this disclosure. Any of the foregoing (including hardware, software, combinations of hardware and software, etc.) can be considered as one or more processors.
[0148] Referring to FIG1B, FIG1B is an illustrative diagram of an example of a video decoding system 40 including the encoder 20 of FIG2 and / or the decoder 30 of FIG3 according to an exemplary embodiment. The video decoding system 40 can implement various combinations of technologies of the embodiments of this application. In the illustrated embodiment, the video decoding system 40 may include an imaging device 41, an encoder 20, a decoder 30 (and / or a video encoder / decoder implemented by logic circuitry of a processing unit 46), an antenna 42, one or more processors 43, one or more memories 44, and a display device 45.
[0149] As shown in Figure 1B, the imaging device 41, antenna 42, processing unit 46, logic circuit, encoder 20, decoder 30, processor 43, memory 44, and display device 45 are capable of communicating with each other. As discussed, although encoder 20 and decoder 30 are used as examples to describe the video decoding system 40, in different instances, the video decoding system 40 may contain only encoder 20 or only decoder 30.
[0150] In some instances, antenna 42 can be used to transmit or receive encoded video data streams. Additionally, in some instances, display device 45 can be used to present video data. In some instances, logic circuitry can be implemented using processing unit 46. Processing unit 46 can include an ASIC, graphics processor, general-purpose processor, etc. Video decoding system 40 can also include an optional processor 43, which can similarly include an ASIC, graphics processor, general-purpose processor, etc. In some instances, logic circuitry can be implemented in hardware, such as dedicated video encoding hardware, while processor 43 can be implemented in general-purpose software, operating system, etc. Furthermore, memory 44 can be any type of memory, such as volatile memory (e.g., static random access memory (SRAM), dynamic random access memory (DRAM), etc.) or non-volatile memory (e.g., flash memory, etc.). In a non-limiting instance, memory 44 can be implemented using cache memory. In some instances, logic circuitry can access memory 44 (e.g., for implementing an image buffer). In other instances, the logic circuitry and / or processing unit 46 may include memory (e.g., cache, etc.) for implementing image buffers, etc.
[0151] In some instances, the encoder 20 implemented via logic circuitry may include (e.g., implemented via processing unit 46 or memory 44) an image buffer and (e.g., implemented via processing unit 46) a graphics processing unit. The graphics processing unit may be communicatively coupled to the image buffer. The graphics processing unit may include the encoder 20 implemented via logic circuitry to implement various modules discussed with reference to Figure 2 and / or any other encoder system or subsystem described herein. The logic circuitry may be used to perform various operations discussed herein.
[0152] In some instances, decoder 30 may be implemented via logic circuitry in a similar manner to implement the various modules discussed in reference to decoder 30 of Figure 3 and / or any other decoder system or subsystem described herein. In some instances, the logic circuitry-implemented decoder 30 may include an image buffer (implemented via processing unit 46 or memory 44) and a graphics processing unit (e.g., implemented via processing unit 46). The graphics processing unit may be communicatively coupled to the image buffer. The graphics processing unit may include decoder 30 implemented via logic circuitry to implement the various modules discussed in reference to Figure 3 and / or any other decoder system or subsystem described herein.
[0153] In some instances, antenna 42 can be used to receive an encoded stream of video data. As discussed herein, the encoded stream may contain data related to encoded video frames, indicators, index values, mode selection data, etc., such as data related to code segmentation (e.g., transform coefficients or quantized transform coefficients, optional indicators, and / or data defining code segmentation). Video decoding system 40 may also include a decoder 30 coupled to antenna 42 for decoding the encoded stream. Display device 45 is used to display the video frames.
[0154] It should be understood that, referring to the examples described for encoder 20 in the embodiments of this application, decoder 30 can be used to perform the reverse process. Regarding signaling syntax elements, decoder 30 can be used to receive and parse such syntax elements, and accordingly decode the associated video data. In some examples, encoder 20 can entropy-encode syntax elements into an encoded video stream. In such instances, decoder 30 can parse such syntax elements and accordingly decode the associated video data.
[0155] It should be noted that the encoding and decoding method described in the embodiments of this application is mainly used for the encoding and decoding process of video or images. This process exists in both encoder 20 and decoder 30. The encoder 20 and decoder 30 in the embodiments of this application can be, for example, the encoding / decoder corresponding to video standard protocols such as H.263, H.264, HEVV, MPEG-2, MPEG-4, VP8, VP9, H.266, or next-generation video standard protocols (such as H.267).
[0156] Referring to Figure 2, which is a schematic / conceptual block diagram of an exemplary example of encoder 20, encoder 20 includes a residual calculation unit 204, a transform processing unit 206, a quantization unit 208, an inverse quantization unit 210, an inverse transform processing unit 212, a reconstruction unit 214, a buffer 216, a loop filter unit 220, a decoded picture buffer (DPB) 230, a prediction processing unit 260, and an entropy coding unit 270. Prediction processing unit 260 may include inter-frame prediction unit 244, intra-frame prediction unit 254, and mode selection unit 262. Inter-frame prediction unit 244 may include a motion estimation unit and a motion compensation unit (not shown). Encoder 20 shown in Figure 2 may also be referred to as a hybrid video encoder or a video encoder based on a hybrid video codec.
[0157] Specifically, encoder 20 receives image 201 or image blocks 203 of image 201 via, for example, input 202. Encoder 20 is used to encode image 201 block by block, for example, by performing encoding and prediction for each image block 203.
[0158] The residual calculation unit 204 is used to calculate the residual block 205 based on the image block 203 and the prediction block 265. The transform processing unit 206 is used to apply a transform, such as a discrete cosine transform (DCT) or a discrete sine transform (DST), to the sample values of the residual block 205 to obtain transform coefficients 207 in the transform domain. The transform coefficients 207 can also be called transform residual coefficients.
[0159] The quantization unit 208 is used to quantize the transform coefficients 207, for example, by applying scalar quantization or vector quantization, to obtain the quantized transform coefficients 209.
[0160] The inverse quantization unit 210 is used to apply the inverse quantization of the quantization unit 208 to the quantized coefficients to obtain the inverse quantization coefficients 211.
[0161] The inverse transformation processing unit 212 is used to apply the inverse transformation of the transformation applied by the transformation processing unit 206 to obtain the inverse transformation block 213.
[0162] Reconstruction unit 214 (e.g., summer 214) is used to add inverse transform block 213 (i.e. reconstructed residual block 213) to prediction block 265 to obtain reconstructed block 215.
[0163] The loop filter unit 220 (or simply "loop filter" 220) is used to filter the reconstructed block 215 to obtain the filtered block 221.
[0164] The decoded image buffer 230 can be used as a reference image memory to store reference image data for the encoder 20 to encode video data.
[0165] The prediction processing unit 260, also known as the block prediction processing unit 260, is used to receive or acquire image block 203 (current image block 203 of current image 201) and reconstructed image data, and to process such data to make predictions, i.e., to provide prediction block 265 which can be either inter-frame prediction block 245 or intra-frame prediction block 255.
[0166] The mode selection unit 262 can be used to select a prediction mode (e.g., intra-frame or inter-frame prediction mode) and / or the corresponding prediction block 245 or 255 used as prediction block 265 to compute residual block 205 and reconstructed block 215.
[0167] Specifically, the intra-frame prediction unit 254 can transmit syntax elements to the entropy coding unit 270. The entropy coding unit 270 is used to apply an entropy coding algorithm or scheme (e.g., variable length coding (VLC) scheme, context adaptive VLC (CAVLC) scheme, arithmetic coding scheme, context adaptive binary arithmetic coding (CABAC), syntax-based context-adaptive binary arithmetic coding (SBAC), probability interval partitioning entropy (PIPE) coding, or other entropy coding methods or techniques) to one or all (or not apply) of the quantized residual coefficients 209, inter-frame prediction parameters, intra-frame prediction parameters, and / or loop filter parameters to obtain encoded image data 21 that can be output by output 272 in the form of, for example, an encoded bitstream 21.
[0168] Referring to Figure 3, which is a schematic / conceptual block diagram of an example of a decoder 30, the decoder 30 is used to receive, for example, encoded image data (e.g., encoded bitstream) 21 encoded by encoder 20 to obtain a decoded image 331. During the decoding process, the decoder 30 receives video data from encoder 20, such as encoded video bitstreams representing image blocks of encoded video stripes and associated syntax elements.
[0169] In the example of Figure 3, decoder 30 includes an entropy decoding unit 304, an inverse quantization unit 310, an inverse transform processing unit 312, a reconstruction unit 314 (e.g., a summer 314), a buffer 316, a loop filter 320, a decoded image buffer 330, and a prediction processing unit 360. Prediction processing unit 360 may include an inter-frame prediction unit 344, an intra-frame prediction unit 354, and a mode selection unit 362. In some instances, decoder 30 may perform a decoding process that is generally the inverse of the encoding process described in video encoder 20 of Figure 2.
[0170] Specifically, the entropy decoding unit 304 is used to perform entropy decoding on the encoded image data 21 to obtain, for example, quantization coefficients 309 and / or decoded encoding parameters (not shown in Figure 3).
[0171] The inverse quantization unit 310 can function the same as the inverse quantization unit 110, the inverse transform processing unit 312 can function the same as the inverse transform processing unit 212, the reconstruction unit 314 can function the same as the reconstruction unit 214, the buffer 316 can function the same as the buffer 216, the loop filter 320 can function the same as the loop filter 220, and the decoded image buffer 330 can function the same as the decoded image buffer 230.
[0172] The prediction processing unit 360 is typically used to perform block prediction and / or obtain prediction blocks 365 from the encoded data 21, and to receive or obtain prediction-related parameters and / or information about the selected prediction mode from, for example, the entropy decoding unit 304 (explicitly or implicitly).
[0173] The inverse quantization unit 310 can be used to inverse quantize (i.e., dequantize) the quantized transform coefficients provided in the bitstream and decoded by the entropy decoding unit 304. The inverse transform processing unit 312 is used to apply an inverse transform (e.g., inverse DCT, inverse integer transform, or a conceptually similar inverse transform process) to the transform coefficients to generate a residual block in the pixel domain.
[0174] Reconstruction unit 314 (e.g., summer 314) is used to add inverse transform block 313 (i.e. reconstructed residual block 313) to prediction block 365 to obtain reconstructed block 315 in the sample domain.
[0175] The loop filter unit 320 (during or after the encoding loop) is used to filter the reconstructed block 315 to obtain the filtered block 321.
[0176] Decoder 30 is used, for example, to output decoded image 31 via output 332 for presentation to or viewing by the user.
[0177] For example, commonly used transform methods in image coding include discrete cosine transform and wavelet transform. Wavelet transform is a local transform method that can perform localized, multi-scale analysis of images, focusing on the details of signal changes, making it very suitable for image coding tasks.
[0178] This application provides a wavelet transform-based codec that can independently encode and decode low-frequency and high-frequency sub-bands, effectively reducing encoding and decoding complexity and improving efficiency. For example, an image undergoes wavelet transform to obtain low-frequency and high-frequency sub-bands, which are then encoded to generate low-frequency and high-frequency sub-band bitstreams, respectively. The low-frequency sub-band can be understood as a sub-image representing the low-frequency signal (or low-frequency information) of the original image, and the high-frequency sub-band can be understood as a sub-image representing the high-frequency signal (or high-frequency information) of the original image.
[0179] Referring to Figure 4, which is a schematic / conceptual block diagram of an encoder as an example, the encoder in the example of Figure 4 includes, but is not limited to, a sub-graph partitioning unit 410, a wavelet forward transform unit 420, a low-frequency sub-band processing path 430, and a high-frequency sub-band processing path 440.
[0180] The sub-image partitioning unit 410 is used to acquire the current image and partition it to obtain at least one sub-image. Specifically, the sub-image partitioning unit 410 partitions the current image into N sub-images according to a sub-image partitioning method, where N is an integer greater than 0 (or an integer greater than 1). The sub-image partitioning method can include, but is not limited to, at least one of the following:
[0181] The width and / or height of the subgraph are multiples of 128;
[0182] The maximum width of the subimage is 1024 pixels;
[0183] The minimum height and / or width of the subimage is 256 pixels;
[0184] The original image resolution is less than or equal to 1080p, and N is an integer greater than 1 and less than or equal to 8; or,
[0185] The original image has a length greater than or equal to 4320 pixels, a width greater than or equal to 2160 pixels, and N is an integer greater than 1 and less than or equal to 16; or,
[0186] The original image has a length greater than or equal to 7680 pixels, a width greater than or equal to 4320 pixels, and N is an integer greater than 1 and less than or equal to 32.
[0187] The values mentioned above are merely illustrative examples and can be set according to actual needs.
[0188] Referring to Figure 5, which is an exemplary schematic diagram of sub-image partitioning, in the example of Figure 5, the sub-image partitioning unit 410 can partition the image 401 into m*n sub-images according to the sub-image partitioning method. Optionally, in this example, the width and height of each sub-image satisfy a multiple of 128.
[0189] The sub-image partitioning unit 410 can partition the image into m*n sub-images according to the sub-image partitioning method. Among them, for sub-images whose width and height are not multiples of 128, the sub-image partitioning unit 410 can pad these sub-images so that the height and width of each padded sub-image can be multiples of 16.
[0190] The wavelet forward transform unit 420 is used to perform wavelet transform (also called wavelet forward transform) on the subgraph to obtain low-frequency subband and high-frequency subband. The low-frequency subband includes low-frequency signals in the subgraph that satisfy the low-frequency filter coefficients, and the high-frequency subband includes high-frequency signals in the subgraph that have been decomposed by the high-frequency filter in the wavelet transform.
[0191] Referring to Figure 6, which is an exemplary schematic diagram of wavelet transform, in the example of Figure 6, the wavelet forward transform unit 420 acquires the current sub-image, for example, sub-image 1_1. The wavelet forward transform unit 420 performs a wavelet transform on the current sub-image, wherein the wavelet transform includes one horizontal wavelet transform and one vertical wavelet transform to obtain the wavelet coefficients of the low-low (LL) sub-band (abbreviated as LL sub-band), the wavelet coefficients of the low-high (LH) sub-band (abbreviated as LH sub-band), the wavelet coefficients of the high-high (HH) sub-band (abbreviated as HH sub-band), and the wavelet coefficients of the high-low (HL) sub-band (abbreviated as HL sub-band).
[0192] In this embodiment, the low-frequency subband includes an LL subband, and the high-frequency subband includes an LH subband, an HH subband, and an HL subband. Optionally, the LL subband, LH subband, HH subband, and HL subband have the same dimensions (including width and height).
[0193] Referring again to Figure 4, the low-frequency subband processing path 430 is used to obtain the wavelet coefficients 403 of the low-frequency subband to obtain the low-frequency subband encoded data 413. The low-frequency subband processing path 430 includes, but is not limited to: a block partitioning unit 431 (also called a low-frequency subband block partitioning unit 431), a residual calculation unit 432, a prediction unit 437, a control unit 438, a transform / quantization unit (also called a low-frequency subband transform / quantization unit 433), an inverse quantization / inverse transform unit 434 (also called a low-frequency subband inverse quantization / inverse transform unit 434), a low-frequency subband reconstruction unit 435, a low-frequency subband splicing unit 436, and a low-frequency subband entropy coding unit 439, etc.
[0194] The high-frequency subband processing path 440 is used to acquire high-frequency subbands to obtain high-frequency subband encoded data. The high-frequency subband processing path 440 includes, but is not limited to: a block partitioning unit 431 (also referred to as a high-frequency subband block partitioning unit 431 or a second block partitioning unit 431), a transform / quantization unit (also referred to as a transform / quantization unit 442 or a second transform / quantization unit), and a high-frequency subband entropy coding unit 443, etc.
[0195] Alternatively, in some instances, the encoder may include more or fewer units or modules than in the structure shown in Figure 4.
[0196] The image 401 encoding method provided in this application will be described in detail below with reference to the encoder shown in Figure 4:
[0197] The codec receives image 401. A description of image 401 can be found above and will not be repeated here.
[0198] Sub-image partitioning unit 410 partitions image 401 into sub-images and outputs N sub-images. N is an integer greater than 0. In this embodiment, each sub-image is encoded and decoded independently. During the encoding process, sub-image 402 can be referred to as the current sub-image or the sub-image to be encoded.
[0199] Wavelet forward transform unit 420 performs wavelet forward transform on the current sub-image to obtain wavelet coefficients 403 (hereinafter referred to as low-frequency sub-band) and wavelet coefficients 414 (hereinafter referred to as high-frequency sub-band) of the current sub-image. The wavelet coefficients 403 of the low-frequency sub-band include the wavelet coefficients of the LL sub-band, and the wavelet coefficients 414 of the high-frequency sub-band include the wavelet coefficients of the LH, HL, and HH sub-bands. In this embodiment, each sub-image of the image can be independently encoded and decoded, and the high-frequency sub-band and low-frequency sub-band of each sub-image are independently encoded and decoded. The LH, HL, and HH sub-bands in the high-frequency sub-band can also be independently encoded and decoded.
[0200] The block partitioning unit 431 (which may be called the low-frequency sub-band block partitioning unit) is used to obtain the wavelet coefficients 403 of the low-frequency sub-band of the current sub-graph 402, so as to obtain at least one macroblock 404 of the low-frequency sub-band of the sub-graph 402. The macroblock can also be understood as a set of partial coefficients in the wavelet coefficients of the low-frequency sub-band.
[0201] Specifically, the block partitioning unit 431 partitions the wavelet coefficients 403 of the low-frequency sub-band of the current subgraph 402 into blocks based on the block partitioning method, obtaining at least one macroblock 404 of the low-frequency sub-band of the current subgraph, for example, M macroblocks, where M is an integer greater than 0 (or greater than 1). The low-frequency block partitioning unit 431 outputs the macroblocks 404 of the wavelet coefficients 403 of the current low-frequency sub-band one by one to the residual calculation unit 432 and the control unit 438.
[0202] In the embodiments of this application, macroblock 404 is a basic encoding / decoding unit. During the encoding process, macroblock 404 may also be referred to as the current block, current image block 401, macroblock 404 to be encoded, block to be encoded, image block 404 to be encoded, etc.
[0203] Alternatively, the block partitioning method includes, but is not limited to:
[0204] The wavelet coefficients 403 of both the high-frequency subband and the low-frequency subband are divided into basic coding units of 8x8 macroblocks 404 (unit is pixels).
[0205] For example, as described above, each subband uses macroblock 404 as the basic coding unit. The macroblock 404 currently to be encoded is referred to as the current macroblock 404. Specifically, the low-frequency subband processing path 430 encodes each macroblock 404 of the wavelet coefficients 403 of the low-frequency subband block by block. For example, encoding and prediction are performed on each macroblock 404. The encoding process for the current macroblock 404 will be described below; the processing flow for other macroblocks is the same, and will not be illustrated individually in this application. For example, in encoding, it refers to the macroblock currently being encoded; in decoding, it refers to the macroblock currently being decoded. The decoded macroblock in the reference image used for predicting the current macroblock 404 is called the reference block (i.e., the low-frequency subband reconstruction block 409 in the figure). The reference block is the block that provides the reference signal for the current block, where the reference signal represents the pixel value within the macroblock 404. The block in the reference image that provides the prediction signal for the current block can be called prediction block 405, where the prediction signal represents the pixel value, sample value, or sample signal within prediction block 405. For example, after traversing multiple reference blocks, an optimal reference block is found, and this optimal reference block will provide the prediction for the current block; this block is called prediction block 405.
[0206] Specifically, referring to Figure 4, the residual calculation unit 432 is used to obtain the current macroblock 404 and the prediction block 405 (further details of the prediction block 405 are provided below) to obtain the residual block 406. Specifically, the residual calculation unit performs residual calculation on the current macroblock 404 and the prediction block 405 to obtain the residual block 406. The residual calculation unit 432 outputs the residual block 406 to the transform / quantization unit 433.
[0207] The transform / quantization unit 433 is used to obtain the residual block 406 to obtain the residual quantized block 407. Specifically, the transform / quantization unit 433 performs transform and / or quantization processing on the residual block 406 to obtain the residual quantized block 407, which can also be called the quantized residual block. The residual quantized block 407 includes the quantization coefficients of the residual block 406.
[0208] The transform / quantization unit 433 outputs the residual quantization block 407 to the inverse quantization single / inverse transform unit 434 and the low-frequency subband entropy coding unit 439.
[0209] The inverse quantization / inverse transform unit 434, also known as the inverse quantization / inverse transform unit, is used to obtain the residual coefficients 407 to obtain the residual reconstruction block 408. Specifically, the inverse quantization / inverse transform unit 434 performs inverse quantization and / or inverse transform processing on the residual quantization block 407 to obtain the residual reconstruction block 408, which can also be called the inverse quantization residual block, etc. The residual reconstruction block 408 includes the inverse quantization coefficients of the residual block 406. The inverse quantization / inverse transform unit 434 outputs the residual reconstruction block 408 to the low-frequency subband splicing unit 436.
[0210] The dequantization / inverse transform unit 434 may include a dequantization unit and an inverse transform unit (not shown in the figure). The dequantization unit is used to dequantize the input coefficients, and the inverse transform unit is used to inverse transform the input coefficients.
[0211] The low-frequency subband reconstruction unit 435 is used to obtain a low-frequency subband reconstruction block 409 based on the prediction block 405 and the residual reconstruction block 408. Specifically, the low-frequency subband reconstruction unit 435 adds the residual reconstruction block 408 to the prediction block 405 to obtain the low-frequency subband reconstruction block 409, which can also be called a reconstructed low-frequency subband macroblock. Optionally, the low-frequency subband reconstruction unit 435 outputs the low-frequency subband reconstruction block 409 to the prediction unit 437 and the low-frequency subband splicing unit 436. Optionally, the low-frequency subband reconstruction unit 435 outputs the low-frequency subband reconstruction block 409 to the control unit 438.
[0212] The low-frequency subband stitching unit 436 is used to obtain the reconstructed low-frequency subband 411 based on the low-frequency subband reconstruction block 409, which can also be referred to as the reconstructed value of the low-frequency subband or the reconstructed data of the low-frequency subband. Optionally, the low-frequency subband stitching unit 436 outputs the reconstructed low-frequency subband 411 to the prediction unit 437. Optionally, the low-frequency subband stitching unit 436 outputs the reconstructed low-frequency subband 411 to the control unit 438.
[0213] Specifically, as described above, the low-frequency subband uses macroblocks as the basic coding unit, and the low-frequency subband splicing unit 436 can obtain M low-frequency subband reconstruction blocks of a low-frequency subband. The low-frequency subband splicing unit 436 can reconstruct the corresponding low-frequency subband based on the M low-frequency subband reconstruction blocks, that is, obtain the reconstructed low-frequency subband 411.
[0214] The control unit 438 is used to acquire control information 418 and output the control information 418 to the low-frequency subband entropy coding unit 439. For example, the control information 418 may include, but is not limited to, mode information 412. The control unit may determine the mode information 412 based on macroblock 404 (i.e., the current block); or it may determine the mode information 412 based on the current macroblock 404, the low-frequency subband reconstruction block 409, and the reconstructed low-frequency subband 411.
[0215] The mode information, also known as prediction mode information, is used to indicate the prediction mode (or prediction method) of the prediction unit 437, such as inter-frame or intra-frame prediction mode. The control unit 438 can output mode information 412 to the prediction unit 437.
[0216] Prediction unit 437, also known as prediction processing unit, is used to acquire mode information 412 and perform prediction processing based on mode information 412. Specifically, prediction unit 437 can select a prediction mode based on mode information 412. In one example, prediction unit 437 can acquire low-frequency sub-band reconstruction block 409 based on mode information 412 to obtain prediction block 405. Specifically, prediction unit 437 can perform intra-frame prediction based on low-frequency sub-band reconstruction block 409 to obtain prediction block 405. In another example, prediction unit 437 can acquire reconstructed low-frequency sub-band 411 based on mode information 412 to obtain prediction block 405.
[0217] The prediction unit 437 outputs prediction block 405 to the residual calculation unit 432 and the low-frequency sub-band splicing unit 436.
[0218] The low-frequency subband entropy coding unit 439 is used to obtain low-frequency subband encoded data 413, also known as encoded low-frequency subband, based on the residual quantization block 407 and mode information 412. Specifically, the low-frequency subband entropy coding unit 439 uses an entropy coding algorithm or scheme (e.g., variable length coding (VLC), context adaptive VLC (CAVLC), arithmetic coding, context adaptive binary arithmetic coding (CABAC), syntax-based context-adaptive binary arithmetic coding (SBAC), probability interval partitioning entropy (PIPE) coding, or other entropy coding methods or techniques) to entropy code the residual quantization block 407 and mode information 412 to obtain low-frequency subband encoded data 413 output in the form of, for example, an encoded bitstream.
[0219] Referring again to Figure 4, block partitioning unit 441, also known as high-frequency subband block partitioning unit, is used to obtain the high-frequency subband of the current subgraph 402 to obtain at least one macroblock 415 of the high-frequency subband of the subgraph 402. For a detailed description, please refer to the low-frequency subband section; it will not be repeated here. Specifically, block partitioning unit 441 partitions the high-frequency subband 414 of the current subgraph 402 (hereinafter referred to as the current high-frequency subband) into blocks based on the block partitioning method, obtaining at least one macroblock 415 of the current subgraph 402, for example, M macroblocks, where M is an integer greater than 0 (or an integer greater than 1). Other undescribed parts can be referred to the relevant description of block partitioning unit 431; it will not be repeated here.
[0220] Block partitioning unit 441 outputs the macroblocks of the current high-frequency subband one by one to quantization / conversion unit 442.
[0221] The transform / quantization unit 442 is used to transform and / or quantize the macroblock 415 to obtain the quantization coefficients 416 of the high-frequency subband block (i.e., the quantization coefficients of the current macroblock). The transform / quantization unit 442 outputs the quantization coefficients 416 of the high-frequency subband block to the high-frequency subband entropy coding unit 443.
[0222] The high-frequency subband entropy coding unit 443 is used to perform entropy coding on the data to be encoded to obtain high-frequency subband encoded data 417. The data to be encoded may include, but is not limited to, the quantization coefficients and syntax elements of each high-frequency subband block. The high-frequency subband encoded data 417 includes, but is not limited to, HH subband encoded data, HL subband encoded data, and LH subband encoded data.
[0223] The high-frequency subband entropy coding unit 443 uses an entropy coding algorithm or scheme to encode the data to be coded. The aforementioned entropy coding scheme can be, for example, at least one of the following: VLC scheme, CAVLC scheme, arithmetic coding scheme, and CABAC.
[0224] The encoding and decoding method provided in this application supports two scenarios: full I-frame configuration and I / P frame alternating encoding configuration. The encoder architecture shown in Figure 4 adds relevant modules required for the prediction process on the basis of the wavelet transform architecture, which can improve the compression efficiency of I / P frame alternating encoding for scenarios such as fixed camera positions and slow camera movement.
[0225] Optionally, encoder 40 may also include, but is not limited to, a combining unit (not shown in the figure), also known as a multiplexer (MUX). The combining unit is used to generate a bitstream based on low-frequency subband coded data and high-frequency subband coded data.
[0226] Specifically, the combining unit writes low-frequency subband coded data 413 into the bitstream and writes high-frequency subband coded data 417 into the bitstream. In this embodiment, by encoding the low-frequency subband and high-frequency subband separately, the low-frequency subband coded data and high-frequency subband coded data can be decoded independently. That is, at the decoding end, it can independently decode the low-frequency subband coded data and high-frequency subband coded data in the bitstream, thereby improving decoding efficiency.
[0227] Referring to Figure 7A, which is a schematic / conceptual block diagram of an exemplary decoder, in the example of Figure 7A, the decoder receives, for example, a bitstream encoded by an encoder to obtain a decoded image of the original image, also referred to as a decoded image, reconstructed image, etc. During the decoding process, the decoder receives the bitstream from the encoder, including, but not limited to, image header information and image data.
[0228] In the example shown in Figure 7A, the decoder includes, but is not limited to: low-frequency subband processing path 710, high-frequency subband processing path 720, wavelet inverse transform unit 730, image combination unit 740 (also known as image stitching unit), etc.
[0229] For example, the low-frequency subband processing path 710 is used to acquire low-frequency subband encoded data to obtain reconstructed low-frequency subband 706 (also known as decoded low-frequency subband). The low-frequency subband processing path includes, but is not limited to: low-frequency subband entropy decoding unit 711, inverse quantization / inverse transform unit 712 (also known as low-frequency subband inverse quantization / inverse transform unit), low-frequency subband reconstruction unit 713, low-frequency subband splicing unit 715, prediction unit 714, etc.
[0230] The high-frequency subband processing path 720 is used to acquire high-frequency subband encoded data to obtain reconstructed high-frequency subband 731, which can also be called the reconstructed value of high-frequency subband or the reconstructed data of high-frequency subband, including but not limited to: high-frequency subband entropy decoding unit 721, inverse quantization / inverse transform unit 722 (also called high-frequency subband inverse quantization / inverse transform unit), high-frequency subband reconstruction unit 723, etc.
[0231] In some instances, the decoder shown in Figure 7A can perform a decoding process that is largely the reverse of the encoding process described with reference to the encoder in Figure 4.
[0232] The decoding method in the embodiments of this application will be described in detail below with reference to the decoder 70 shown in Figure 7A.
[0233] For example, decoder 70 can obtain high-frequency subband encoded data and low-frequency subband encoded data in the bitstream based on the image header information in the bitstream. Furthermore, as described above, during the encoding process, the encoder uses macroblocks as the basic encoding unit, and correspondingly, during the decoding process, the decoder also uses macroblocks (e.g., encoded macroblocks) as the basic decoding unit for decoding.
[0234] For example, the low-frequency subband entropy decoding unit 711 performs entropy decoding on the low-frequency subband encoded data 701 in the bitstream, using macroblocks as the basic decoding unit, to obtain the quantization coefficients 702 (i.e., the quantization coefficients of the current macroblock) and syntax elements 707 of the low-frequency subband block. The description of the quantization coefficients 702 of the low-frequency subband can be found on the encoder side and will not be repeated here. Specifically, the low-frequency subband entropy decoding unit 711 obtains the encoded macroblocks (i.e., the encoded data of the macroblocks) of the low-frequency subbands (e.g., LL subbands) of each subgraph in the bitstream, and performs entropy decoding on each encoded macroblock to obtain the quantization coefficients 702 (which can be simply referred to as the quantization coefficients of the macroblock of the low-frequency subband) and syntax elements 707 of the corresponding low-frequency subband for each encoded macroblock. During the decoding process, the currently decoded encoded macroblock can be called the current block.
[0235] The low-frequency subband decoding unit is used to output the quantization coefficients 702 of the low-frequency subband block to the inverse quantization / inverse transform unit 712, and to output the mode information 707 to the prediction unit 714.
[0236] The inverse quantization / inverse transform unit 712 is used to obtain the quantization coefficients 702 of the low-frequency subband block to obtain the inverse quantization coefficients 703 of the low-frequency subband block. Alternatively, it can be the inverse transform coefficients of the current block of the low-frequency subband (depending on whether inverse transform processing was performed). Specifically, the inverse quantization / inverse transform unit 712 performs inverse quantization on the quantization coefficients of the current block of the low-frequency subband, or performs both inverse quantization and inverse transform, to obtain the inverse quantization coefficients of the current block of the low-frequency subband. The inverse quantization / inverse transform unit 712 outputs the inverse quantization coefficients 703 of the low-frequency subband block to the low-frequency subband reconstruction unit 713, for example, the inverse quantization coefficients of the current block of the low-frequency subband.
[0237] The low-frequency subband reconstruction unit 713 is used to obtain the low-frequency subband reconstruction block 704, which can also be called the reconstruction coefficient of the low-frequency subband block, based on the quantization coefficients 703 and the prediction block 705 of the low-frequency subband. Specifically, the low-frequency subband reconstruction unit 713 adds the prediction block to the inverse quantization coefficients of the current block of the low-frequency subband to obtain the low-frequency subband reconstruction block 704 corresponding to the current macroblock.
[0238] The prediction unit 714 is used to acquire mode information 412 and perform corresponding prediction processing according to the mode information 412. For example, it can perform intra-frame prediction based on the low-frequency subband reconstruction block 704, or perform inter-frame prediction based on the reconstructed low-frequency subband 706. Its execution method can be referred to the coding side, and will not be repeated here. The prediction unit 714 outputs prediction block 705 to the low-frequency subband reconstruction block 704 unit.
[0239] For example, the high-frequency subband entropy decoding unit 721 acquires the high-frequency subband encoded data 707 in the bitstream, and, using macroblocks as the basic decoding unit, acquires the quantization coefficients 708 of each high-frequency subband block (which are the quantization coefficients of the current macroblock). Specifically, the high-frequency subband entropy decoding unit 721 performs entropy decoding on the current block of the high-frequency subband encoded data 707 to obtain the quantization coefficients of the current block of the high-frequency subband. Optionally, based on entropy decoding, control information corresponding to the current block can also be acquired, such as mode information 412. The high-frequency subband entropy decoding unit 721 outputs the quantization coefficients 708 of the high-frequency subband block to the inverse quantization / inverse transform unit 722.
[0240] The inverse quantization / inverse transform unit 722, also known as the high-frequency subband inverse quantization / inverse transform unit, is used to obtain the quantization coefficients 708 of the high-frequency subband block to obtain the reconstruction coefficients 709 of the high-frequency subband block. The reconstruction coefficients can be either inverse quantization coefficients after inverse quantization processing, or inverse transform coefficients after inverse quantization and inverse transform processing.
[0241] The high-frequency subband reconstruction unit 723 (also known as the high-frequency subband splicing unit) is used to obtain the reconstruction coefficients 709 of the high-frequency subband block to obtain the reconstructed high-frequency subband 731, which can also be referred to as the reconstructed value or reconstructed data of the high-frequency subband. Specifically, the high-frequency subband reconstruction unit 723 can obtain the reconstruction coefficients corresponding to each macroblock of the high-frequency subband, that is, reconstruct the high-frequency subband block. The high-frequency subband reconstruction unit 723 can splice the obtained multiple macroblocks to obtain the corresponding high-frequency subband. Among them, the reconstructed high-frequency subband may optionally include reconstructing the HL subband (e.g., the reconstruction coefficients of the HL subband), reconstructing the HH subband (e.g., the reconstruction coefficients of the HH subband), and reconstructing the LH subband (e.g., the reconstruction coefficients of the LH subband).
[0242] The inverse wavelet transform unit 730 is used to acquire the reconstructed high-frequency subband 731 and the reconstructed low-frequency subband 706 to obtain the reconstructed sub-image 732. Specifically, the inverse wavelet transform unit 730 acquires the reconstructed low-frequency subband 706 output by the low-frequency subband stitching unit 715 and the reconstructed high-frequency subband 731 output by the high-frequency subband reconstruction unit 723, and performs an inverse wavelet transform on the reconstructed low-frequency subband 706 and the reconstructed high-frequency subband 731 to obtain the reconstructed sub-image 732. The inverse wavelet transform unit 730 outputs the reconstructed sub-image 732 to the image combining unit (also known as the image stitching unit, etc.).
[0243] Image combining unit 740 is used to acquire reconstructed sub-images 732 to obtain a reconstructed image 733 of the original image, which can also be called a decoded image or a decoded image, etc. Specifically, image combining unit 740 can acquire N reconstructed sub-images (N is an integer greater than 0) of the image (referring to the original image), and stitch (or combine) the N reconstructed sub-images according to the division method (including size and position) of each reconstructed sub-image during encoding to obtain the reconstructed image 733.
[0244] Optionally, after acquiring the reconstructed image, the image combining unit 740 can determine whether the reconstructed image contains a padding portion based on the image size information in the image header information and the size information of the current reconstructed image. In one example, if the size of the current reconstructed image is the same as the size indicated by the image size information (i.e., the same as the original image size), the image combining unit 740 can send the reconstructed image to the display device. In this case, the sizes of the displayed image, the original image, and the reconstructed image are all the same. In another example, if the size of the current reconstructed image is different from the size indicated by the image size information (e.g., larger than the original image size), the image combining unit 740 can remove the padding portion of the current reconstructed image based on the size indicated by the image size information to obtain the displayed image. The size of the displayed image is the same as the size of the original image. Optionally, the decoder is used, for example, to output the reconstructed image through the decoder's output port (or output interface) for presentation to the user or for the user to view.
[0245] Other variations of the decoder can be used to decode compressed bitstreams.
[0246] Referring to Figure 7B, which is an exemplary schematic / conceptual block diagram of a decoder, in this example, the wavelet inverse transform unit 730 is used to obtain the reconstruction coefficients 709 of the high-frequency subband block, i.e., the high-frequency subband reconstruction block, and the low-frequency subband reconstruction block 704 output by the low-frequency subband reconstruction block unit 713. The wavelet inverse transform is then performed on the high-frequency subband reconstruction block (e.g., including HH subband reconstruction blocks, HL subband reconstruction blocks, and LH subband reconstruction blocks) and the low-frequency subband reconstruction block 704 to obtain the reconstruction block 734, which is the reconstruction block of the current subgraph, and can also be referred to as the reconstruction data of the current block of the current subgraph or the reconstruction value of the current block of the current subgraph, etc.
[0247] The wavelet inverse transform unit 730 outputs a reconstructed block 734 to the sub-image combination unit 750. The sub-image combination unit 750 can obtain a reconstructed sub-image 732 of the current sub-image based on at least one reconstructed block corresponding to the current sub-image; this can also be referred to as the reconstructed value or reconstructed data of the current sub-image. The undescribed parts of Figure 7B can be referred to Figure 7A, and will not be elaborated here.
[0248] The bitstream output by the encoder in the embodiments of this application will be described in detail below. The bitstream structure described below can be applied to the encoder shown in Figure 4, and of course, it can also be applied to other encoder variations based on Figure 4.
[0249] Referring to Figure 8, which is an exemplary schematic diagram of the bitstream structure, the bitstream in the example of Figure 8 includes, but is not limited to, image header information and image data.
[0250] For example, the image data includes at least one image data region (also referred to as an image data sub-region), such as, but not limited to, a first image data region and a second image data region. During the encoding process, the encoder (e.g., through a combination unit) writes high-frequency subband encoded data and low-frequency subband encoded data into the bitstream. Specifically, the encoder writes high-frequency subband encoded data into the first image data region and low-frequency subband encoded data into the second image data region. The order in which the encoded data is written is merely illustrative and will not be repeated below.
[0251] For example, image header information includes, but is not limited to, offset information and image size information.
[0252] For example, image size information is used to indicate the size of the original image. As mentioned above, during the encoding process, some sub-images may be padded during sub-image partitioning to ensure that the length and width of each sub-image are multiples of 16. Thus, during decoding, the size of the reconstructed image obtained by the decoder may be larger than the original image size. The decoder can process the reconstructed image based on the image size information to remove the padded portions.
[0253] For example, offset information is used to indicate the position of a data region in the bitstream, and can also be understood as indicating the position of independently decodeable coded data in the bitstream. When decoding coded data (i.e., the bitstream) according to this application, the offset information in the image header information can be used to obtain independently decodeable coded data, and decoding operations can be performed on the coded data. The independently decodeable coded data (e.g., low-frequency subband coded data and high-frequency subband coded data) can be decoded synchronously during decoding to improve decoding efficiency.
[0254] In one example, the offset information can be the length of the image data region containing adjacent, independently decodeable encoded data in the bitstream.
[0255] In another example, the offset information can be the offset (i.e., the difference) between the starting position of the image data region where the independently decoded encoded data is located and the ending position of the image header information.
[0256] It should be noted that the embodiments in this application only use a single image stream as an example for illustration, that is, the stream includes only one image data. During the encoding of video images, the encoder can generate a bitstream after encoding each image, that is, the bitstream includes multiple image data, and each image data carries the encoded data of the corresponding image.
[0257] Specifically, in the example shown in Figure 8, the high-frequency subband encoded data (including LH subband encoded data, HH subband encoded data, and HL subband encoded data) of each sub-image of the image are continuously written into the first image data region. The description of the second image data region can be found in Figure 15, and will not be repeated here.
[0258] For example, as shown in Figure 8, sub-images 1-HL-MB0, 1-HH-MB0, and 1-LH-MB0 are consecutively written into the first image data region. Here, 1-HL-MB0 represents the encoded macroblock MB0 of the HL subband of sub-image 1, 1-HH-MB0 represents the encoded macroblock MB0 of the HH subband of sub-image 1, and 1-LH-MB0 represents the encoded macroblock MB0 of the LH subband of sub-image 1. The figure only shows the encoded data structure of sub-image 1 in the bitstream; the other sub-images are similar and will not be illustrated individually here.
[0259] In this example, during decoding, the decoding end can decode the high-frequency subband encoded data according to the sub-image order, that is, each sub-image in the first image data region is decoded independently. The low-frequency subband encoded data is also decoded according to the sub-image order, that is, each sub-image in the second image data region is decoded independently. When decoding the first image data region, the decoding end can decode each coded macroblock one by one according to the coded macroblock order of each sub-image in the region. That is, the three high-frequency subband encoded data of sub-image 1 are written continuously into the first image data region; therefore, during decoding, the three high-frequency subband encoded data of sub-image 1 can be decoded one by one to obtain the decoded high-frequency subband. The structure of the LL subband encoded data is also based on each sub-image as the granularity, and the encoded data of each sub-image includes the LL subband encoded data of each macroblock in the sub-image.
[0260] In the embodiments of this application, multiple independently decoded encoded data can be decoded simultaneously, or one or more high-frequency subbands can be decoded simultaneously, and the number of simultaneous decodes depends on the decoder hardware performance.
[0261] The encoding method provided in this application embodiment can be applied to the above-mentioned wavelet transform-based encoder, and the decoding method provided in this application embodiment can be applied to the above-mentioned wavelet transform-based decoder.
[0262] The following example illustrates the encoding and decoding methods of this application by using an encoder to execute the encoding method and a decoder to execute the decoding method. However, this application does not limit the subject that executes the encoding and decoding methods of this application.
[0263] The following describes various embodiments of the wavelet transform-based coding method of this application.
[0264] Example A1
[0265] This application provides an encoding method, as shown in FIG9. The encoding method may include, but is not limited to, the following steps: S201 and S202.
[0266] S201. When the absolute value of at least one coefficient of the block to be encoded in the image to be encoded is greater than a first value, obtain the code table corresponding to the block to be encoded.
[0267] The image to be encoded can be an image from a video or a picture. The image to be encoded can also be a sub-image obtained from the original image of the video or picture. There are no restrictions here.
[0268] In some embodiments, the block to be encoded is a coefficient block in the high-frequency subband obtained by wavelet transform of the image to be encoded. At least one coefficient of the block to be encoded is a wavelet coefficient obtained by wavelet transform of the image to be encoded. Optionally, as shown in FIG9, before executing S201, the encoder may also optionally execute the following S101, S102 and S103 to obtain the coefficient block in the high-frequency subband obtained by wavelet transform of the image to be encoded, so as to obtain the block to be encoded.
[0269] S101. Obtain the image to be encoded.
[0270] In optional embodiments, the image to be encoded can be a frame in an image or video, or a sub-image obtained by dividing a frame in an image or video, without limitation.
[0271] For example, referring to Figure 4 above, the image to be encoded can be image 401, or the image to be encoded can be sub-image 402.
[0272] S102. Perform wavelet transform on the image to be encoded obtained in S101 to obtain the high-frequency subband of the image to be encoded.
[0273] For the image to be encoded, the encoder can perform wavelet transform on the image to obtain the wavelet coefficients of the low-frequency subband (or simply the low-frequency subband) and the wavelet coefficients of the high-frequency subband (or simply the high-frequency subband).
[0274] In an optional embodiment, the low-frequency subband includes a low-low (LL) subband, and the aforementioned high-frequency subband includes a low-high (LH) subband, a high-high (HH) subband, and a high-low (HL) subband. Optionally, the LL subband, LH subband, HH subband, and HL subband have the same dimensions (including width and height).
[0275] In a specific embodiment, the wavelet forward transform unit 420 shown in Figure 4 above can perform a wavelet forward transform on the image to obtain the wavelet coefficients of the low-frequency subband and the high-frequency subband of the image. The wavelet coefficients of the low-frequency subband may include the wavelet coefficients of the LL subband, and the wavelet coefficients of the high-frequency subband may include the wavelet coefficients of the LH, HL, and HH subbands. For example, the wavelet transform includes one horizontal wavelet transform and one vertical wavelet transform.
[0276] For example, referring to Figure 4 above, the high-frequency subband of the image to be encoded can be the wavelet coefficient 414 of the high-frequency subband.
[0277] For example, the high-frequency subbands of the image to be encoded may include the HL subband, LH subband, and HH subband shown in Figure 6 above. Then, the HL subband, LH subband, and HH subband can all be encoded using the encoding method of the embodiments of this application.
[0278] In an optional embodiment, the LH subband, HH subband, and HL subband can be encoded independently.
[0279] For more information on wavelet transform and high-frequency subbands, please refer to the descriptions in Figures 4 and 6 above, which will not be repeated here.
[0280] S103. Divide the high-frequency subbands in the image to be encoded obtained in S102 into blocks to obtain coefficient blocks in the high-frequency subbands of the image to be encoded, so as to obtain the blocks to be encoded in the image to be encoded.
[0281] In an alternative embodiment, the encoder can obtain macroblocks by dividing the high-frequency subbands into blocks.
[0282] In an optional embodiment, for example, the block partitioning unit 441 shown in Figure 4 above can partition the high-frequency sub-band of the image (hereinafter referred to as the current high-frequency sub-band) into blocks based on the block partitioning method to obtain at least one macroblock of the image, for example, X macroblocks, where X is a positive integer. A macroblock can be understood as a set of partial coefficients from the wavelet coefficients of the high-frequency sub-band.
[0283] In some embodiments, the size of a macroblock is 2x2, that is, each macroblock may include 2x2 wavelet coefficients. The block partitioning unit 441 divides the wavelet coefficients of the high-frequency subband in a 2x2 manner to obtain macroblocks. For example, if the wavelet coefficients of the high-frequency subband are arranged in row-column alignment, the block partitioning unit 441 may determine the wavelet coefficients located in the first column to the second column and in the first row to the second row as a macroblock.
[0284] As shown in Figure 11, Figure 11 illustrates an exemplary schematic diagram of the block division result of a high-frequency subband of an image to be encoded. The high-frequency subband may include multiple coefficient blocks, which are in the following encoding order: block 1->block 2->block 3->block 4->block 5->block 6->block 7>block 8->block 9.
[0285] For example, as shown in Figure 11, the size of each coefficient block is WxH, which is 2x2. This application does not limit the size of the blocks, where W represents the width of the block and H represents the height of the block. The width and height can be the same or different, which is not limited here. Furthermore, this application does not limit the block division method for the high-frequency subbands, nor the number of blocks obtained through block division. Therefore, the block to be encoded can be any coefficient block in Figure 11.
[0286] In some embodiments, the block to be encoded is a coefficient block in a high-frequency subband, which may include some or all of the wavelet coefficients in the high-frequency subband.
[0287] In some embodiments, the block partitioning operation described in S103 above can also be performed before the wavelet transform operation described in S102 above. That is, after acquiring the image to be encoded, the encoder can first partition the image to be encoded into blocks, and then perform wavelet transform on the block data obtained from the block partitioning, thereby obtaining the high-frequency subband of each block obtained from the block partitioning. The high-frequency subband of each block obtained is the coefficient block in the high-frequency subband of the image to be encoded.
[0288] In an optional embodiment, for any coefficient block included in any high-frequency subband, at least one coefficient block in the high-frequency subband can be used as the above-mentioned block to be encoded to be encoded using the encoding method provided in the embodiments of this application.
[0289] The coefficient block may include multiple coefficients to be encoded (i.e., wavelet coefficients), which are high-frequency subband coefficients. In addition, the coefficients to be encoded may be high-frequency subband coefficients after transformation and quantization, or they may be high-frequency subband coefficients after quantization.
[0290] In an optional embodiment, as shown in FIG4, the coefficient block to be encoded in the high-frequency subband (e.g., macroblock 415) may be quantized before entropy encoding. Optionally, a transform operation (e.g., Hadamard transform, without limitation) may also be performed before quantization. Then the coefficients in the above-mentioned block to be encoded may be the quantized coefficients of the high-frequency subband obtained after the quantization operation (e.g., quantization coefficient 416 as shown in FIG4).
[0291] In some embodiments, the absolute value of the coefficients of the block to be encoded refers to the absolute value of the coefficients (also called coefficient values or coefficient numerical values) in the block to be encoded.
[0292] Taking a block size of 2x2 as an example, the block to be encoded can include 4 coefficients. Please refer to Figure 12, which exemplarily shows the coefficient values of the block to be encoded (e.g., block 1) in the high-frequency subband (e.g., HH subband) shown in Figure 11, for example, 2, 5, -1, and 12 respectively. Thus, the absolute values of the coefficients of the block to be encoded are 2, 5, 1, and 12 respectively.
[0293] In some embodiments, the size of the block to be encoded is WxH. When the absolute value of at least one coefficient of the block to be encoded (referring to the absolute value of the coefficients in the block to be encoded) is greater than the first value, it indicates that the absolute value of at least one coefficient among the WxH coefficients of the block to be encoded is greater than the first value.
[0294] In some embodiments, the first value may be pre-stored in the encoder (e.g., as a parameter of the encoder), or it may be sent to the encoder by another device and received by the encoder. This application does not limit the source of the first value.
[0295] In some embodiments, the first value can be 1.
[0296] For example, the first value is 1. In the block to be encoded shown in Figure 12, the coefficient values of the block to be encoded are 2, 5, -1 and 12, where the absolute values of coefficients 2, 5 and 12 are all greater than 1.
[0297] When the absolute value of at least one coefficient of the block to be encoded is greater than the first value, the encoder can obtain the code table corresponding to the block to be encoded.
[0298] The code table can be a code table that matches the distribution of the absolute values of the coefficients of the block to be encoded. In other words, the code table can be used to encode a block to be encoded in which the absolute value of at least one coefficient is greater than a first value.
[0299] In other embodiments, the first value may also be an integer greater than 1, which is not a limitation here.
[0300] In an optional embodiment, the encoder pre-stores one or more code tables. When the absolute value of at least one coefficient of the block to be encoded is greater than a first value, the encoder can obtain the code table corresponding to the block to be encoded from the one or more code tables.
[0301] In an optional embodiment, the code table can be as shown in Table 1.
[0302] In some embodiments, the code table obtained by the encoder through S201 shown in FIG9 may include the mapping relationship between the absolute value of the coefficient and the codeword.
[0303] In some embodiments, the codeword lengths of coefficients whose absolute values in the code table corresponding to the block to be encoded are the same as those of coefficients whose absolute values are less than or equal to the second value.
[0304] In this embodiment, the codeword refers to the codeword corresponding to the unsigned number (absolute value of the coefficient) of the coefficient. In other words, in the code table corresponding to the block to be encoded, the codewords corresponding to the unsigned numbers (absolute values of the coefficients) of coefficients whose absolute values are less than or equal to the second value are the same.
[0305] The first value mentioned above can be less than or equal to the second value.
[0306] For example, the first value can be 1, and the second value can be 2. The range of coefficient values in this code table can include {0, 1, -1, 2, -2, 3, -3}. Then, for the coefficients 0, 1, -1, 2, and -2 in this code table whose absolute values are less than or equal to 2, the unsigned numbers corresponding to these five coefficients, that is, the codeword lengths corresponding to the absolute values of these five coefficients 0, 1, and 2, are the same, for example, all of them are 2 bits.
[0307] Following S201, the method may further include S202.
[0308] S202. Based on the code table obtained in S201, encode the block to be encoded to obtain the bitstream.
[0309] In some embodiments, the codeword corresponding to a coefficient absolute value of 0 in the code table obtained in S201 is 00, the codeword corresponding to a coefficient absolute value of 1 in the code table is 01, and the codeword corresponding to a coefficient absolute value of 2 in the code table is 10.
[0310] In some embodiments, as shown in FIG9, the bitstream obtained in S202 may include a first syntax element, wherein the first syntax element indicates that the absolute value of at least one coefficient of the block to be encoded is greater than the first value mentioned above.
[0311] In an optional embodiment, the encoder can encode the first syntax element into the bitstream through entropy encoding, so that the high-frequency subband encoded data 417 shown in FIG4 may include the first syntax element, which can indicate that the absolute value of at least one coefficient of the block to be encoded is greater than a first value.
[0312] In an optional embodiment, the bitstream may include a syntax structure corresponding to the block to be encoded, and the syntax structure may include the first syntax element.
[0313] For example, the syntax structure may include a header portion and a data portion of the block to be encoded. The header portion may include the first syntax element, and the data portion may include the encoded data of the coefficient values of the block to be encoded (e.g., encoded using the code table obtained in S201 above).
[0314] For example, the first syntax element of the block to be encoded could be "max_grt1_flag", where max_grt1_flag = 1 to indicate that the absolute value of at least one coefficient of the block to be encoded is greater than a first value (e.g., 1).
[0315] In other embodiments, when the absolute values of all coefficients of the block to be encoded are less than or equal to a first value (e.g., 1), then max_grt1_flag = 0 in the aforementioned data structure of the block to be encoded, to indicate that the absolute values of all coefficients of the block to be encoded are less than or equal to the first value (e.g., 1). Thus, when encoding the block to be encoded, the obtained code table is not the code table mentioned in the embodiments of this application, but a code table that can match the probability distribution of the coefficients of the block to be encoded; this is not a limitation.
[0316] Alternatively, in other embodiments, "max_grt1_flag = 0" is used to indicate that the absolute value of at least one coefficient of the block to be encoded is greater than a first value (e.g., 1).
[0317] In some embodiments, the bitstream obtained by the encoder may further include a second syntax element, which optionally indicates encoded data of the coefficient values (e.g., quantization coefficients of high-frequency subbands) of the block to be encoded.
[0318] In an optional embodiment, the coefficient values of the block to be encoded are, for example, the four coefficient values shown in FIG12. The encoder can encode these four coefficient values using the code table corresponding to the block to be encoded obtained in S201 shown in FIG9 above, to obtain the encoded data of the coefficient values of the block to be encoded. In this way, the bitstream may include a second syntax element to indicate the encoded data of the coefficient values of the block to be encoded.
[0319] As described above, in an optional embodiment, the bitstream may include a syntax structure corresponding to the block to be encoded, the syntax structure may include the first syntax element, and the syntax structure may also include the second syntax element.
[0320] For example, the syntax structure may include a header portion and a data portion of the block to be encoded, the header portion may include the first syntax element, and the data portion may include the second syntax element mentioned above.
[0321] In this embodiment, the entropy encoding method used by the encoder to entropy encode the first syntax element, and its specific implementation process, are not limited. Similarly, the entropy encoding method used by the encoder to entropy encode the coefficient values of the block to be encoded, and its specific implementation process, are also not limited. The entropy encoding method used by the encoder for the first syntax element and the coefficient values of the block to be encoded can be any known or future-developed encoding method. Furthermore, the entropy encoding methods used by the encoder for the first syntax element and the block to be encoded can be the same or different, and this application does not impose any restrictions on this.
[0322] For example, referring to Figure 4 above, when the block to be encoded is a coefficient block in a high-frequency subband, the encoded data of the coefficient values of the block to be encoded obtained by the encoder can be high-frequency subband encoded data 417.
[0323] Example A2
[0324] In conjunction with any of the above embodiments of the wavelet transform-based coding method, in an optional embodiment, FIG13A exemplarily illustrates a flowchart of a coding method according to an embodiment of this application. As shown in FIG13A, the method flow may include, but is not limited to, the following steps S301, S302, S303, S304, S305, and S306.
[0325] S301. Obtain the current block based on video or image.
[0326] In some embodiments, the encoder may obtain the current block based on the image to be encoded in a video or image, which is also referred to as the block to be encoded.
[0327] In some embodiments, the encoding method can be applied to a wavelet transform encoder, which can obtain the current block based on the image to be encoded in a video or image through the following S121 and S123.
[0328] In some embodiments, the current block can be obtained through S121 and S123 shown in FIG13A.
[0329] S121. Perform wavelet transform on the video to be encoded or the video image to be encoded to obtain high-frequency subbands (HH subband, HL subband, LH subband).
[0330] The image to be encoded can be the original image or a sub-image obtained by sub-image partitioning (the process of sub-image partitioning can be referred to the description of the relevant embodiments such as Figure 5 above), and there are no restrictions here.
[0331] Similarly, the video to be encoded can be the original video to be encoded, or it can be a video region obtained by segmenting the video to be encoded; there are no restrictions here.
[0332] After the encoder performs wavelet transform on the image to be encoded, it can obtain low-frequency subbands and high-frequency subbands. The specific process can be referred to the relevant introduction in Figure 6, which will not be repeated here.
[0333] S123. Divide the high-frequency subband into blocks to obtain the current block.
[0334] Thus, the current block is a coefficient block in the high-frequency subband obtained after wavelet transform of the image to be encoded. This coefficient block may include some or all of the wavelet coefficients within the high-frequency subband block. This current block can also be referred to as the high-frequency subband block to be encoded, or the coefficient block to be encoded in the high-frequency subband to be encoded.
[0335] In some embodiments, the encoder may also divide the high-frequency subbands obtained by wavelet transform of the image to be encoded into blocks to obtain the current block (which is a high-frequency subband block) and perform the encoding process of any one of the embodiments in Examples A1 and A2 on the current block.
[0336] In other embodiments, the encoder may divide the low-frequency subband obtained by wavelet transform of the image to be encoded into blocks to obtain the current block (which is a low-frequency subband block), and encode the current block according to any of the embodiments in Examples A1 and A2.
[0337] The embodiments of this application do not limit the application of the encoding method of this application to coefficient blocks in the high-frequency subband or the low-frequency subband of the current frame.
[0338] In an optional embodiment, the execution order of S121 and S123 can also be reversed. That is, the image to be encoded can be divided into blocks first, and then wavelet transform can be performed on the block data obtained by the division. Similarly, coefficient blocks in the high-frequency subband and coefficient blocks in the low-frequency subband can be obtained.
[0339] Returning to Figure 13A, optionally, the encoder executes S302 after executing S301.
[0340] Optionally, S302. Transform the current block to obtain the transformation coefficients of the current block.
[0341] For example, the encoder can transform the current block to obtain a transformed block, which includes the transform coefficients of the current block.
[0342] As shown in Figure 13A, after the encoder executes S301 or S302, it can also execute S303.
[0343] S303. Quantize the transform coefficients of the current block to obtain the quantization coefficients of the current block.
[0344] Based on S201 in Example A1 above, the coefficients in the block to be encoded can be the quantization coefficients (also called quantization blocks) obtained in S303.
[0345] In other words, the coefficients of the block to be encoded are the quantization coefficients of the high-frequency subband block.
[0346] As described in the embodiment of Figure 4 above, the encoder's transformation operation on the current block is optional. In some embodiments, the encoder can perform S303 quantization on the wavelet coefficients in the current block after executing S301 to obtain the quantization coefficients of the current block.
[0347] As shown in Figure 13A, after executing S303, the encoder can also execute S304.
[0348] S304. When the absolute value of at least one coefficient of the current block is greater than the first value, obtain the code table corresponding to the current block.
[0349] The specific implementation process of S304 can be referred to S201 in Example A1 above, and will not be repeated here.
[0350] In the case where the absolute value of at least one coefficient of the current block is greater than a first value (e.g., the first value is 1), as an optional embodiment, the code table acquired by the encoder can be code table 0 as shown in Table 1:
[0351] Table 1
[0352] In code table 0 shown in Table 1, the prefix code and suffix code corresponding to the absolute value of the coefficient together constitute the codeword corresponding to the absolute value of the coefficient.
[0353] In an optional embodiment, the absolute value of the coefficient in code table 0 is greater than the absolute value of the target coefficient of the third value, and the number of 1s in the corresponding prefix code in code table 0, prefix1Count, satisfies prefix1Count=FastLog2(abs(v)-4)+4.
[0354] In an optional embodiment, the third value may be an integer greater than 4.
[0355] For example, the third value can be 5.
[0356] Where abs(v) represents the absolute value of the coefficient v whose absolute value is greater than the third value; FastLog2() calculates the logarithm to the base 2 and rounds it down.
[0357] The number of bits in the suffix code corresponding to the absolute value of the target coefficient in code table 0 that is greater than the third value satisfies prefix1Count-4.
[0358] In another embodiment, the code table corresponding to the current block obtained in S304 (or S201) may further include a sign bit. In this way, the absolute values of the coefficients in code table 0 become coefficient values. Specifically, Table 2 shows another structure of code table 1 in this application. This code table is also applicable to encoding where the absolute value of at least one coefficient in the current block is greater than a first value (e.g., the first value is 1). Code table 1 and code table 0 have most of the same content and mapping relationship; the only difference is the addition of a sign bit, and the replacement of absolute coefficient values with coefficient values.
[0359] Table 2
[0360] In the code table 1 above, "±" represents the positive and negative sign, such as ±3 representing 3 and -3.
[0361] In an optional embodiment, the target coefficient value whose absolute value is greater than the third value in code table 1 has the following prefix code number of 1s: prefix1Count = FastLog2(abs(v)-4) + 4. The target coefficient value whose absolute value is greater than the third value in code table 1 has the following suffix code number of bits: prefix1Count-4. For details, please refer to the above introduction of code table 0 shown in Table 1, which will not be repeated here.
[0362] The difference between code table 1 shown in Table 2 and code table 0 shown in Table 1 is that code table 1 limits the number of bits for the sign bit of coefficients with an absolute value greater than 0, and the number of bits for the sign bit of coefficients with an absolute value greater than 0 in code table 1 is 1 bit.
[0363] In an optional embodiment, the encoder may provide any one of the code tables in Tables 1 and 2 above as the code table used for the block to be encoded when the absolute value of at least one coefficient of the block to be encoded is greater than a first value. Similarly, the code table used by the decoder and the encoder is the same. For example, the encoder and the decoder agree to use code table 0 shown in Table 1 above for encoding and decoding when the absolute value of at least one coefficient of the block to be encoded / decoded is greater than a first value, so as to achieve accurate decoding of coefficient blocks in high-frequency subbands.
[0364] As shown in Figure 13A, after executing S304, the encoder can also execute S305 and S306. The execution order of S305 can be before S306, after S306, or in parallel with S306. This application does not impose any restrictions on this.
[0365] S305. Based on the acquired code table, entropy coding of the coefficient values of the current block is performed using variable-length coding (VLC) to obtain VLC-coded data of the coefficient values of the current block, thereby obtaining the bitstream.
[0366] The code table corresponding to the current block (such as the code table shown in either Table 1 or Table 2 above) can also be called the VLC code table.
[0367] In a specific embodiment, the encoder can obtain the codeword corresponding to each coefficient value of the current block through the acquired code table, and then write the codeword corresponding to each coefficient value of the current block into the bitstream. In this way, the obtained bitstream includes the VLC encoded data of the coefficient values of the current block.
[0368] The following example uses the code tables corresponding to the current block obtained by the encoder as shown in Table 1 and Table 2 above, and takes the coefficient value of the current block as the quantization coefficient shown in Figure 12 as an example to illustrate the process of entropy encoding of the coefficient value of the current block by VLC.
[0369] As shown in Figure 12, the scanning order (i.e. encoding order) of the four coefficient values in the current block of the high-frequency subband is as shown by the dashed arrow, i.e., 2, 5, -1, 12 are encoded in sequence.
[0370] Example 1: The code table corresponding to the current block obtained by the encoder is code table 0 as shown in Table 1 above.
[0371] Next, we will introduce how to use code table 0 to encode the coefficients of the current block, as shown in Figure 12. The coefficient values of the current block are 2, 5, -1, and 12 in sequence.
[0372] When encoding the coefficient value 2 in the current block, the encoder can look up the codeword corresponding to the absolute value of the coefficient 2 in code table 0 shown in Table 1, which is 10, so as to encode the coefficient value 2 as 10.
[0373] When encoding the coefficient value 5 in the current block, the encoder can look up the codeword corresponding to the absolute value of the coefficient 5 in code table 0 shown in Table 1, which is 11110, so as to encode the coefficient value 5 as 11110.
[0374] When encoding the coefficient value -1 in the current block, the encoder can look up the codeword corresponding to the absolute value of the coefficient 1 in code table 0 shown in Table 1, which is 01, so as to encode the coefficient value -1 as 01.
[0375] When encoding the coefficient value 12 in the current block, the encoder can look up the prefix code corresponding to the absolute value of coefficient 12 in code table 0 shown in Table 1. The prefix code is 11111110 and the suffix code is 3 bits, thereby encoding the coefficient 12 into a codeword with a codeword length of 11 bits.
[0376] The codewords in code table 0 shown in Table 1 do not include the sign bit. Therefore, when encoding the coefficients of the current block, not only can code table 0 be used, but the sign of the coefficients in the current block can also be encoded separately, so that the sign bit of each coefficient of the current block can be encoded into the bitstream. For example, a sign bit of 0 can represent a positive number, and a sign bit of 1 can represent a negative number.
[0377] Thus, as shown in Figure 12, the encoding data of the sign bit of the current block is 0010, indicating the sign bits of 2, 5, -1, and 12.
[0378] Thus, after encoding the current block shown in Figure 12, the resulting bitstream can include not only the codewords of each coefficient obtained through the code table 0 above, but also the sign bit of each coefficient.
[0379] In some embodiments, the second syntax element described above may indicate the VLC encoded data of the coefficient values (including the values of the coefficients and the positive or negative signs of the coefficients) of the current block.
[0380] Specifically, as shown in Figure 12, the codeword sequence obtained by passing the absolute values of the four coefficients in the current block through code table 0, and the sequence of the sign bits of the four coefficients in the current block, can be entropy encoded using VLC to obtain the VLC encoded data of the coefficient values of the current block.
[0381] Example 2: The code table corresponding to the current block obtained by the encoder is code table 1 as shown in Table 2 above.
[0382] The code table 1 shown in Table 2 further includes a sign bit. For example, a sign bit of 0 can represent a positive number, and a sign bit of 1 can represent a negative number. In this way, the codeword obtained by encoding the coefficient value of the current block through code table 1 can carry the sign bit, without the need to encode the sign bit separately.
[0383] Next, we will introduce how to use code table 1 to encode the coefficients of the current block, as shown in Figure 12. The coefficient values of the current block are 2, 5, -1, and 12 in sequence.
[0384] When encoding the coefficient value 2 in the current block, the encoder can look up the codeword corresponding to the coefficient value 2 in code table 1 shown in Table 2, which is 10, so as to encode the coefficient value 2 as 100.
[0385] When encoding the coefficient value 5 in the current block, the encoder can look up the codeword corresponding to the coefficient value 5 in code table 1 shown in Table 2, which is 111100, so as to encode the coefficient value 5 as 111100.
[0386] When encoding the coefficient value -1 in the current block, the encoder can look up the codeword corresponding to the coefficient value -1 in code table 1 shown in Table 2, which is 011, so as to encode the coefficient value -1 as 011.
[0387] When encoding the coefficient value 12 in the current block, the encoder can look up the code table 1 shown in Table 2. The prefix code corresponding to the coefficient value 12 in the code table 1 is 11111110, the suffix code is 3 bits, and the sign bit is 1 bit, so as to encode the coefficient 12 into a codeword with a codeword length of 12 bits.
[0388] Thus, after encoding the current block shown in Figure 12, the resulting bitstream may include codewords of each coefficient obtained through the code table 1 above, and the codewords may include the sign bit of each coefficient.
[0389] In some embodiments, the bitstream obtained by the encoder may include the second syntax element mentioned in Example A1 above, which may indicate VLC encoded data of the coefficient values of the current block.
[0390] For example, in conjunction with the embodiment of FIG4 above, the high-frequency subband encoded data 417 may include VLC encoded data of the coefficient values of the current block (i.e., the high-frequency subband block).
[0391] S306. Obtain the CABAC encoded data of the first syntax element through CABAC encoding to obtain the bitstream.
[0392] In some embodiments, the bitstream may contain CABAC encoded data of the first syntax element.
[0393] The first syntax element indicates that the absolute value of at least one coefficient in the current block is greater than a first value.
[0394] In some embodiments, the first syntax element may be represented as “max_grt1_flag”.
[0395] The above mainly describes the encoding process when the absolute value of at least one coefficient of the block to be encoded is greater than the first value. In some embodiments, when the absolute values of all coefficients of the block to be encoded are less than or equal to the first value, the encoder can also entropy encode the coefficient values of the block to be encoded.
[0396] In an optional embodiment, when the absolute values of all coefficients in the block to be encoded are less than or equal to the first value, the encoder may further entropy encode the second information to also write the second information into the bitstream. This second information may indicate that the absolute values of all coefficients in the block to be encoded are less than or equal to the first value.
[0397] In some embodiments, for example, the second information can be represented as "max_grt1_flag=0".
[0398] Furthermore, in some embodiments, when the absolute value of at least one coefficient of the block to be encoded is greater than a first value, the encoder may also encode second information via CABAC, the second information indicating that the absolute value of at least one coefficient of the block to be encoded is greater than the first value.
[0399] In some embodiments, the bitstream obtained by the encoder may further include a first bitstream pointer and a second bitstream pointer, wherein the first bitstream pointer is used to indicate the position of the first syntax element in the bitstream and the second bitstream pointer is used to indicate the position of the second syntax element in the bitstream.
[0400] In an optional embodiment, the first stream pointer and the second stream pointer have different identifiers (ID).
[0401] In some embodiments, the bitstream obtained by the encoder may further include a first descriptor and a second descriptor, wherein the first descriptor is used to indicate the encoding method of the encoded data of the first information, and the second descriptor is used to indicate the encoding method of the encoded data of the coefficient values of the block to be encoded.
[0402] Example A3
[0403] The encoding process of the encoding method in the embodiments of this application will be illustrated below with specific examples.
[0404] • Wavelet decomposition of the image yields high-frequency subbands. The high-frequency coefficients within these subbands are then entropy-coded using the following method:
[0405] • For at least one 2x2 block (high-frequency subband block), when the absolute value of at least one of the four coefficients in the 2x2 block is greater than 1, max_grt1_flag is set to 1; when the absolute values of all four coefficients in the 2x2 block are less than or equal to 1, max_grt1_flag is set to 0.
[0406] • When max_grt1_flag = 0, max_grt1_flag can be encoded into (written into) the bitstream; of course, the coefficient values within this 2x2 block can also be encoded, and there are no restrictions on the specific encoding method.
[0407] • When max_grt1_flag = 1, max_grt1_flag can be encoded into (written into) the bitstream; and the coefficient values within the 2x2 block can be encoded according to code table 0 or code table 1 as described above to obtain the bitstream.
[0408] Optionally, max_grt1_flag can be written into a CABAC bitstream (also known as CABAC encoded data) using CABAC entropy encoding; the coefficient values in the 2x2 block can be encoded using code table 0 or code table 1, and written into a VLC bitstream (also known as VLC encoded data) using VLC encoding.
[0409] In some embodiments, taking a block size of 2x2 as an example, Table 3 below shows the syntax elements of the bitstream, where bold text represents syntax elements.
[0410] Table 3
[0411] As shown in Table 3, the first syntax element can be max_grt1_flag. When the size of the block to be encoded is 2x2, the second syntax element can be coef[k]. Since the block to be encoded can include 4 coefficients, k can be 0, 1, 2, or 3 to indicate the values of the first to fourth coefficients to be encoded in the block. coef[k] is an array that stores the encoded data of the coefficient values of the block to be encoded.
[0412] As shown in the first row of the syntax elements in Table 3, the bitstream may include the syntax element max_grt1_flag, and the descriptor of max_grt1_flag is ae(1). In other words, max_grt1_flag is encoded in CABAC encoding mode. The bitstream pointer ID in the first row of Table 3 is 0, which indicates the position of the CABAC encoded data obtained by CABAC encoding of max_grt1_flag in the bitstream.
[0413] As shown in the second row of the syntax elements in Table 3, the bitstream may include the syntax element coef[k], and the descriptor of coef[k] is ce(v). In other words, coef[k] is encoded in VLC encoding mode. The bitstream pointer ID in the second row of Table 3 is 1, which indicates the position of the VLC encoded data obtained by VLC encoding of coef[k] in the bitstream.
[0414] Of course, the code stream pointer IDs of the two syntax elements mentioned above only need to be different; they do not necessarily have to be 0 or 1.
[0415] As shown in the first row of the syntax elements in Table 3 above, max_grt1_flag can be encoded using CABAC encoding; the bitstream includes CABAC encoded data of max_grt1_flag;
[0416] As shown in the first row of the syntax elements in Table 3 above, the coefficient values of the current block in the high-frequency subband can be encoded using VLC encoding, and the bitstream includes VLC encoded data of the coefficient values of the current block.
[0417] The following describes various embodiments of the wavelet transform-based decoding method of this application.
[0418] Example B1
[0419] Corresponding to Example A1 above, this application provides a decoding method. Please refer to Figure 10. The method may include, but is not limited to, the following steps: S401, S402, S403 and S404.
[0420] S401. Obtain the bitstream of the image to be decoded.
[0421] In an optional embodiment, the image to be decoded can be an image in a video or a picture. The image to be decoded can also be a sub-image obtained from the original image of the video or picture, which is not limited here.
[0422] In some embodiments, the image to be decoded includes a block to be decoded in a high-frequency subband (also referred to as a high-frequency subband block). Thus, the block to be decoded in S401 on the decoding side can be a coefficient block in the high-frequency subband obtained by wavelet transform of the image to be decoded during encoding.
[0423] The specific process of obtaining the coefficient block in the high-frequency subband by wavelet transform of the image to be decoded during encoding can be found in S101 to S103 of Example A1 above.
[0424] In an optional embodiment, the image to be decoded may include a low-frequency subband to be decoded and a high-frequency subband to be decoded, obtained by wavelet transform.
[0425] For example, referring to Figure 7A, the bitstream of the image to be decoded may include low-frequency subband coded data 701 and high-frequency subband coded data 707.
[0426] In optional embodiments, the HL subband, LH subband, and HH subband can all be decoded using the decoding method of the embodiments of this application.
[0427] In an optional embodiment, the LH subband, HH subband, and HL subband can be decoded independently.
[0428] In some embodiments, the size of the block to be decoded (e.g., a macroblock) is 2x2, that is, each macroblock may include 2x2 wavelet coefficients.
[0429] As shown in Figure 11, Figure 11 illustrates an exemplary schematic diagram of multiple coefficient blocks in a high-frequency subband of an image to be decoded, which are arranged in the following decoding order: block 1-> block 2-> block 3-> block 4-> block 5-> block 6-> block 7> block 8-> block 9.
[0430] For example, as shown in Figure 11, the size of each coefficient block is WxH, which is 2x2. This application does not limit the size of the blocks, where W represents the width of the block and H represents the height of the block. The width and height can be the same or different, which is not limited here. Furthermore, this application does not limit the block division method for the high-frequency subbands, nor the number of blocks obtained through block division. Therefore, the block to be decoded can be any coefficient block in Figure 11.
[0431] In some embodiments, the block to be decoded is a coefficient block in a high-frequency subband, which may include some or all of the wavelet coefficients in the high-frequency subband.
[0432] In an optional embodiment, for any coefficient block included in a high-frequency subband, at least one coefficient block in the high-frequency subband can be used as the block to be decoded to be decoded using the decoding method provided in this application embodiment. That is, not all coefficient blocks of the high-frequency subband need to be decoded using the decoding method provided in this application embodiment; other decoding methods can also be used, and this application embodiment does not impose any restrictions on this.
[0433] This coefficient block may include multiple coefficients to be decoded (i.e., wavelet coefficients), which are high-frequency subband coefficients. Furthermore, these coefficients may be high-frequency subband coefficients transformed and quantized during encoding (also called quantized coefficients of the high-frequency subband block), or they may be high-frequency subband coefficients quantized during encoding (also called quantized coefficients of the high-frequency subband block). For details, please refer to the explanation in Example A1 above; it will not be repeated here.
[0434] For example, referring to Figure 7A above, when the block to be decoded is a high-frequency subband block, the coefficient value of the block to be decoded can be the quantization coefficient 708 of the high-frequency subband block.
[0435] Following S401, the method may also include S402.
[0436] S402. Decode the bitstream to obtain the first information.
[0437] In some embodiments, the first information may indicate that the absolute value of at least one coefficient of the block to be decoded is greater than a first value.
[0438] In an optional embodiment, the block to be decoded may include multiple coefficient values, which may contain the same coefficient value or may all be different coefficient values.
[0439] In some embodiments, the size of the block to be decoded is WxH. When the absolute value of at least one coefficient of the block to be decoded (referring to the absolute value of the coefficients in the block to be decoded) is greater than a first value, it indicates that the absolute value of at least one coefficient among the WxH coefficients of the block to be decoded is greater than the first value.
[0440] For example, if the size of the block to be decoded is 2x2, then the absolute value of at least one coefficient of the block to be decoded being greater than the first value means that the absolute value of at least one of the four coefficients of the block to be decoded is greater than the first value.
[0441] In some embodiments, the first value may be pre-existing in the decoder (e.g., as a parameter of the decoder), or it may be sent to the decoder by another device and received by the decoder. This application does not limit the source of the first value.
[0442] In some embodiments, the absolute value of the coefficients of the block to be decoded refers to the absolute value of the coefficients (also called coefficient values or coefficient numerical values) in the block to be decoded.
[0443] Taking a 2x2 block size as an example, the block to be decoded can include 4 coefficients. Please refer to Figure 12, which exemplarily shows the coefficient values of the block to be decoded (e.g., block 1) in the high-frequency subband (e.g., HH subband) shown in Figure 11, for example, 2, 5, -1, and 12 respectively. Thus, the absolute values of the coefficients of the block to be decoded are 2, 5, 1, and 12 respectively.
[0444] In some embodiments, the first value can be 1.
[0445] For example, if the first value is 1, in the block to be decoded shown in Figure 12, the coefficient values of the block to be decoded are 2, 5, -1 and 12, where the absolute values of coefficients 2, 5 and 12 are all greater than 1. Then the decoder can decode from the bitstream to obtain first information indicating that at least one coefficient of the block to be decoded has an absolute value greater than 1, and obtain the code table corresponding to the block to be decoded based on the first information (as described in S403 below).
[0446] The code table can be a code table that matches the distribution of the absolute values of the coefficients of the block to be decoded. In other words, the code table can be applied to the decoding of the block to be decoded where the absolute value of at least one coefficient is greater than a first value. When the absolute values of the coefficients of the block to be decoded are all less than or equal to the first value, other code tables are used to decode the block to be decoded. This application does not impose any restrictions on this.
[0447] In other embodiments, the first value may also be an integer greater than 1, which is not a limitation here.
[0448] Following S402, the method may also include S403.
[0449] S403. Based on the first information, obtain the code table corresponding to the block to be decoded, and decode the block to be decoded using the code table to obtain the reconstructed data of the block to be decoded.
[0450] In an optional embodiment, the decoder pre-stores one or more code tables. After obtaining first information indicating that the absolute value of at least one coefficient of the block to be decoded is greater than a first value, the decoder can obtain the code table corresponding to the block to be decoded from the one or more code tables based on the first information.
[0451] In some embodiments, the decoder may include a mapping relationship between the absolute values of coefficients and codewords in the code table corresponding to the block to be decoded.
[0452] In some embodiments, the codeword lengths of coefficients whose absolute values in the code table corresponding to the block to be decoded are the same as those of coefficients whose absolute values are less than or equal to the second value.
[0453] Here, the codeword refers to the codeword corresponding to the unsigned number (absolute value of the coefficient) of the coefficient. In other words, in the code table corresponding to the block to be decoded, the codewords corresponding to the unsigned numbers (absolute values of the coefficients) of coefficients whose absolute values are less than or equal to the second value are the same.
[0454] The first value mentioned above can be less than or equal to the second value.
[0455] For example, the first value can be 1, and the second value can be 2. The range of coefficient values in this code table can include {0, 1, -1, 2, -2, 3, -3}. Then, for the coefficients 0, 1, -1, 2, and -2 in this code table whose absolute values are less than or equal to 2, the unsigned numbers corresponding to these five coefficients, that is, the codeword lengths corresponding to the absolute values of these five coefficients 0, 1, and 2, are the same, for example, all of them are 2 bits.
[0456] For example, if the first value is 1 and the second value can also be 1, the range of coefficient values in this code table is {0, 1, -1}. Then, for the coefficients 0, 1, and -1 in this code table whose absolute values are less than or equal to 1, the unsigned numbers corresponding to these three coefficients, that is, the codeword lengths corresponding to the absolute values 0 and 1, are the same, for example, all are 2 bits.
[0457] Based on the first information obtained in S402, the decoder obtains the code table corresponding to the block to be decoded, and then uses the code table to decode the block to be decoded to obtain the reconstructed data of the block to be decoded.
[0458] In some embodiments, the codeword corresponding to a coefficient absolute value of 0 in the code table of the block to be decoded obtained by the decoder is 00, the codeword corresponding to a coefficient absolute value of 1 in the code table is 01, and the codeword corresponding to a coefficient absolute value of 2 in the code table is 10.
[0459] In some embodiments, when the absolute value of the coefficients of the block to be decoded is greater than 0, the bitstream may further include the sign bit of the coefficient values of the block to be decoded.
[0460] In some embodiments, as shown in FIG10, the bitstream obtained in S401 may include a first syntax element, the first syntax element indicating first information, the first information indicating that at least one coefficient absolute value of the block to be decoded in S401 is greater than a first value.
[0461] In an optional embodiment, the bitstream may include a syntax structure corresponding to the block to be decoded, and the syntax structure may include the first syntax element.
[0462] For example, the syntax structure may include a header portion and a data portion of the block to be decoded, the header portion may include the first syntax element, and the data portion may include encoded data of the coefficient values of the block to be decoded.
[0463] For example, the first syntax element of the block to be decoded can be "max_grt1_flag", where max_grt1_flag = 1 to indicate the first information.
[0464] In other embodiments, when the absolute values of all coefficients of the block to be decoded are less than or equal to a first value (e.g., 1), then max_grt1_flag in the aforementioned data structure of the block to be decoded is 0 to indicate the first information. Thus, when decoding the block to be decoded, the obtained code table is not the code table mentioned in the embodiments of this application, but a code table that can match the probability distribution of the coefficients of the block to be decoded; this is not a limitation.
[0465] Alternatively, in other embodiments, "max_grt1_flag = 0" indicates that the absolute value of at least one coefficient of the block to be decoded is greater than a first value (e.g., 1).
[0466] In an optional embodiment, the decoder can decode the bitstream to obtain a first syntax element, and obtain first information based on the first syntax element, thereby finding the code table corresponding to the block to be decoded based on the first information, so as to realize the decoding of the block to be decoded.
[0467] In some embodiments, the bitstream obtained by the decoder may further include a second syntax element, which optionally indicates encoded data of the coefficient values (e.g., quantization coefficients of high-frequency subbands) of the block to be decoded.
[0468] As described above, in an optional embodiment, the bitstream may include a syntax structure corresponding to the block to be decoded, the syntax structure may include the first syntax element, and the syntax structure may also include the second syntax element.
[0469] For example, the syntax structure may include a header portion and a data portion of the block to be decoded, the header portion may include the first syntax element, and the data portion may include the second syntax element mentioned above.
[0470] In some embodiments, when the decoder decodes the block to be decoded using the code table obtained in S403 to obtain the reconstructed data of the block to be decoded, it can decode the second syntax element in the bitstream using the code table corresponding to the block to be decoded to obtain the reconstructed data of the block to be decoded.
[0471] As mentioned above, the second syntax element indicates the encoded data of the coefficient values of the block to be decoded, which can be the values of the quantization coefficients of the block to be decoded.
[0472] In an optional embodiment, when the decoder decodes the second syntax element, it can look up the coefficient value corresponding to the codeword in the encoded data of the coefficient value of the block to be decoded through a code table, and perform entropy decoding on the encoded data of the coefficient value of the block to be decoded to obtain the quantization coefficients of the block to be decoded. Optionally, the quantization coefficients are then dequantized, and the dequantization result is then inversely transformed to obtain the reconstructed data of the block to be decoded.
[0473] Example B2
[0474] In conjunction with any of the above-described wavelet transform-based decoding methods, Figure 13B exemplarily illustrates a flowchart of a decoding method according to an embodiment of this application. The method may include, but is not limited to, the following steps S501, S502, S503, S504, S505, and S506.
[0475] S501. Obtain the bitstream of the image to be decoded.
[0476] In some embodiments, the image to be decoded includes a current block, which is also referred to as the block to be decoded.
[0477] In some embodiments, the current block is a coefficient block in a high-frequency subband, also called a high-frequency subband block, or a coefficient block to be decoded in a high-frequency subband. For details, please refer to the relevant content in Example B1 above, which will not be repeated here.
[0478] The embodiments of this application do not limit the execution of the decoding method of the embodiments of this application to coefficient blocks in the high-frequency subband of the current frame or coefficient blocks in the low-frequency subband of the current frame.
[0479] For further explanation of the image to be decoded and the block to be decoded, please refer to the description in Example B1 above, which will not be repeated here.
[0480] In some embodiments, the bitstream acquired by the decoder may include the second syntax element mentioned in Example B1 above, which may indicate VLC-encoded data of the coefficient values of the current block.
[0481] For example, in conjunction with the embodiment of FIG7A above, the VLC encoded data of the coefficient value of the current block can be high-frequency subband encoded data 707.
[0482] In some embodiments, the bitstream acquired by the decoder may include the first syntax element mentioned in Example B1 above, which may indicate CABAC encoded data of first information, wherein the absolute value of at least one coefficient of the block to be decoded is greater than a first value.
[0483] In some embodiments, the first information can be represented by the value of the first field being 1, for example, the first information can be represented by "max_grt1_flag=1".
[0484] In an optional embodiment, when the absolute values of all coefficients in the block to be decoded are less than or equal to a first value, the bitstream corresponding to the block to be decoded may include syntax elements indicating second information. This second information may indicate that the absolute values of all coefficients in the block to be decoded are less than or equal to the first value.
[0485] In some embodiments, the second information can be represented by the value of the first field being 0, for example, the second information can be represented by "max_grt1_flag=0".
[0486] In some embodiments, the bitstream obtained by the decoder may further include a first bitstream pointer and a second bitstream pointer, wherein the first bitstream pointer is used to indicate the position of the first syntax element in the bitstream, and the second bitstream pointer is used to indicate the position of the second syntax element in the bitstream.
[0487] In an optional embodiment, the first stream pointer and the second stream pointer have different identifiers (identy, ID).
[0488] In some embodiments, the bitstream obtained by the decoder may further include a first descriptor and a second descriptor, wherein the first descriptor is used to indicate the encoding method of the encoded data of the first information, and the second descriptor is used to indicate the encoding method of the encoded data of the coefficient values of the block to be decoded.
[0489] As shown in Figure 13B, after S501, the method may also include S502.
[0490] S502 performs CABAC entropy decoding on the first syntax element in the bitstream obtained in S501 to obtain the first information.
[0491] In a specific embodiment, the decoder can obtain the first syntax element in the bitstream corresponding to the current block and perform CABAC entropy decoding on the first syntax element to perform CABAC entropy decoding on the CABAC encoded data of the first information, thereby obtaining the first information.
[0492] In some embodiments, the decoder can determine the position of the first syntax element and the encoding method (CABAC encoding) of the encoded data of the first information by using the first bitstream pointer and the first descriptor included in the bitstream. Then, it can perform entropy decoding (CABAC entropy decoding) on the first syntax element at the position indicated by the first bitstream pointer by using the decoding method corresponding to the encoding method of the encoded data of the first information indicated by the first descriptor, so as to obtain the first information.
[0493] Furthermore, in some embodiments, the bitstream acquired by the decoder may also include syntax elements of CABAC encoded data indicating second information. The decoder can also decode these syntax elements using CABAC to obtain the second information, which indicates that the absolute values of the coefficients of the block to be decoded are all less than or equal to the first value.
[0494] S503 obtains the code table corresponding to the current block based on the first information.
[0495] The process can be referred to in the description in Example B1 above, and will not be repeated here.
[0496] In some embodiments, the code table corresponding to the current block obtained by the decoder can be any one of the code tables shown in Table 1 (code table 0) and Table 2 (code table 1) in Example A2 above.
[0497] However, the code table used on the decoding side is the same as the code table used on the encoding side.
[0498] In an optional embodiment, when the code table corresponding to the current block obtained by the decoder is one of the code tables in Tables 1 and 2, the first value can be 1.
[0499] The decoder and encoder use the same code table. For example, the decoder and encoder agree that if the absolute value of at least one coefficient of the block to be encoded / decoded is greater than a first value, they will both use code table 0 shown in Table 1 above for encoding and decoding, so as to achieve accurate decoding of coefficient blocks in high-frequency subbands.
[0500] As shown in Figure 13B, after S503, the method may also include S504.
[0501] S504. Based on the code table corresponding to the current block, perform VLC entropy decoding on the second syntax element in the acquired bitstream to obtain the quantization coefficients of the current block.
[0502] In a specific embodiment, the second syntax element indicates the VLC encoded data of the coefficient values of the current block. The decoder can obtain the second syntax element in the bitstream corresponding to the current block, and perform VLC entropy decoding on the second syntax element based on the code table corresponding to the current block (such as the code table shown in either Table 1 or Table 2 above), so as to perform VLC entropy decoding on the VLC encoded data of the coefficient values of the current block, thereby obtaining the quantization coefficients of the current block.
[0503] In some embodiments, the decoder can determine the position of the second syntax element and the encoding method (VLC encoding) of the encoded data of the coefficient value of the current block by using the second bitstream pointer and the second descriptor included in the bitstream. Then, it can perform entropy decoding (VLC entropy decoding) on the second syntax element at the position indicated by the second bitstream pointer by using the decoding method corresponding to the encoding method of the encoded data of the first information indicated by the first descriptor, so as to obtain the quantization coefficient of the current block.
[0504] The code table obtained by the decoder can also be called the VLC code table.
[0505] In a specific embodiment, the decoder can obtain the coefficient value corresponding to each codeword in the encoded data of the current block through the code table corresponding to the current block, and thus obtain the quantization coefficient of the current block.
[0506] The following example uses the code tables corresponding to the current block obtained by the decoder as shown in Tables 1 and 2 above, and takes the coefficient value of the current block as the quantization coefficient shown in Figure 12 as an example to illustrate the process of entropy decoding of the encoded data of the coefficient value of the current block by VLC.
[0507] As shown in Figure 12, the scanning order (i.e. decoding order) of the encoded data of the four coefficient values in the current block of the high-frequency subband is as shown by the dashed arrow, that is, the encoded data of 2, 5, -1, and 12 are decoded in sequence.
[0508] Example 1: The code table corresponding to the current block obtained by the decoder is code table 0 as shown in Table 1 above.
[0509] Next, we will introduce how to use code table 0 to decode the coefficients of the current block. As shown in Figure 12, the data structure corresponding to the current block in the bitstream may include a header part and a data part. The header part may include the first syntax element mentioned above, and the data part may include the encoded data of the coefficient values of the current block (e.g., VLC encoded data).
[0510] The decoder can obtain code table 0, as shown in Table 1, from the first syntax element decoded from the bitstream, thereby decoding the VLC encoded data to obtain the absolute values of the four coefficients of the current block, which are 2, 5, 1, and 12 in the scanning order; and the VLC encoded data may also include the sign bit of the four coefficient values, so the sign bit can be decoded (to obtain 0010), and the decoded coefficients 2, 5, -1, and 12 of the current block can be obtained using the sign bit, thereby realizing VLC entropy decoding of the encoded data of the coefficient values of the current block.
[0511] Example 2: The code table corresponding to the current block obtained by the decoder is code table 1 as shown in Table 2 above.
[0512] The code table 1 shown in Table 2 further includes a sign bit. For example, a sign bit of 0 can represent a positive number, and a sign bit of 1 can represent a negative number. In this way, the coefficient codeword includes a sign bit.
[0513] The decoder can obtain code table 1, as shown in Table 2, from the first syntax element decoded from the bitstream, thereby decoding the VLC encoded data to obtain the four coefficients 2, 5, -1, and 12 of the current block, thus realizing VLC entropy decoding of the encoded data of the coefficient values of the current block.
[0514] The specific limitations on the suffix code and sign bit in the two examples above are for illustrative purposes only and do not constitute a limitation on this application.
[0515] As shown in Figure 13B, after S504, the method may also include S505.
[0516] S505. Dequantize the quantization coefficients of the current block to obtain the dequantization coefficients of the current block, thereby obtaining the reconstructed data of the current block.
[0517] In a specific embodiment, the decoder can dequantize the quantized block of the current block to obtain the dequantized block of the current block. The quantized block includes the quantization coefficients of the current block, and the dequantized block includes the dequantization coefficients of the current block.
[0518] In some embodiments, the reconstructed data of the current block is the quantization coefficient of the current block.
[0519] For example, referring to Figure 7A, when the block to be decoded is a high-frequency subband block, the quantization coefficient of the block to be decoded can be the quantization coefficient 708 of the high-frequency subband block, and the reconstructed data of the block to be decoded can be the reconstruction coefficient 709 of the high-frequency subband block.
[0520] Optionally, after obtaining the inverse quantization coefficients of the current block in S505, the method may further include S506.
[0521] S506. Perform an inverse transform on the inverse quantization coefficients of the current block to obtain the inverse transform coefficients of the current block, thereby obtaining the reconstructed data of the current block.
[0522] In a specific embodiment, the decoder can perform an inverse transform on the inverse quantization block (also called the transform block) of the current block to obtain the inverse transform block of the current block.
[0523] The transform block includes the transform coefficients of the current block. The inverse transform block includes the inverse transform coefficients of the current block.
[0524] In some embodiments, the inverse transform of the current block is the reconstructed data of the current block.
[0525] In this embodiment, no restrictions are placed on the specific implementation process of the above-mentioned inverse quantization and inverse transformation.
[0526] Example B3
[0527] The decoding process of the decoding method in the embodiments of this application will be illustrated below with specific examples.
[0528] • Decode max_grt1_flag from the header information of the bitstream;
[0529] When max_grt1_flag is 1, it means that at least one of the four coefficients in the 2x2 block has an absolute value greater than 1, and the four coefficient values can be decoded from the bitstream according to code table 0 or code table 1 as described above.
[0530] Optionally, CABAC entropy decoding is used to obtain max_grt1_flag for the CABAC encoded data in the bitstream; VLC decoding is used to obtain the four coefficient values within a 2x2 block for the VLC encoded data in the bitstream.
[0531] When max_grt1_flag = 0, it means that the absolute values of the four coefficients in the 2x2 block are all less than or equal to 1. The four coefficient values can be obtained from the bitstream by decoding according to other code tables (other than the above code tables). There are no restrictions on the specific decoding method.
[0532] As shown in the first row of the syntax elements in Table 5 above, the bitstream includes CABAC encoded data of max_grt1_flag. The decoder can use the CABAC decoding method corresponding to the CABAC encoding method to decode max_grt1_flag to obtain first information indicating that the absolute value of a coefficient of the block to be decoded is greater than a first value. For example, the first information indicating that at least one of the absolute values of the four coefficients of the block to be decoded with a size of 2x2 is greater than 1.
[0533] As shown in the first row of the syntax elements in Table 5 above, the bitstream includes VLC encoded data of the coefficient values of the current block. The decoder can use the VLC decoding method corresponding to the VLC encoding method to decode the VLC encoded data of the coefficient values of the current block in the high-frequency subband to obtain the coefficient values of the block to be decoded, for example, to obtain 4 coefficient values of the block to be decoded with a size of 2x2.
[0534] The decoding process of the decoding method in this application embodiment is illustrated below with specific examples:
[0535] When max_grt1_flag is 1, the code table corresponding to tableIdx equal to 1 can be obtained based on the value of max_grt1_flag, and the value of coeff_level (referring to the quantization coefficient in this embodiment) can be obtained based on the code table. For example, the code table corresponding to tableIdx equal to 1 is code table 0 or code table 1 mentioned above. Other values of tableIdx may correspond to other code tables, which is not limited in this application.
[0536] In the above embodiments, the encoding and decoding methods of the embodiments of this application are mostly illustrated using the current block as an example. In other embodiments, the encoding and decoding of the various embodiments of this application can also be implemented by taking sub-graphs or images as units. The methods are similar and will not be described again here.
[0537] Referring to Figure 14, Figure 14 is a schematic structural diagram of a video decoding device 1400 provided in an embodiment of this application. The video decoding device 1400 is suitable for implementing the embodiments described herein. In one embodiment, the video decoding device 1400 may be a video decoder (e.g., the decoder shown in Figures 3, 7A, and 7B) or a video encoder (e.g., the encoder shown in Figures 2 and 4). In another embodiment, the video decoding device 1400 may be one or more components of the aforementioned decoder or encoder.
[0538] The video decoding device 1400 includes: a downlink port 1410 and a receiver unit (Rx) 1420 for receiving data; a processor, logic unit, or central processing unit (CPU) 1430 for processing data; a transmitter unit (Tx) 1440 and an uplink port 1450 for transmitting data; and a memory 1460 for storing data. The video decoding device 1400 may also include photoelectric conversion components and electro-optical (EO) components coupled to the downlink port 1410, receiver unit 1420, transmitter unit 140, and uplink port 1450 for uplink or downlink transmission of optical or electrical signals.
[0539] Processor 1430 is implemented in both hardware and software. Processor 1430 can be implemented as one or more CPU chips, cores (e.g., multi-core processors), FPGAs, ASICs, and DSPs. Processor 1430 communicates with downlink port 1410, receiver unit 1420, transmitter unit 1440, uplink port 1450, and memory 1460. Processor 1430 includes encoding module 1470 or decoding module 1470. Encoding / decoding module 1470 implements the embodiments disclosed herein to implement the encoding or decoding methods provided in the embodiments of this application. For example, encoding / decoding module 1470 implements, processes, or provides various encoding operations. Therefore, encoding / decoding module 1470 provides substantial improvements to the functionality of video decoding device 1400 and affects the transitions of video decoding device 1400 to different states. Alternatively, encoding / decoding module 1470 can be implemented with instructions stored in memory 1460 and executed by processor 1430.
[0540] Memory 1460 includes one or more disks, tape drives, and solid-state drives, which can be used as overflow data storage devices to store programs while they are selectively executed, and to store instructions and data read during program execution. Memory 1460 can be volatile and / or non-volatile, and can be read-only memory (ROM), random access memory (RAM), ternary content-addressable memory (TCAM), and / or static random access memory (SRAM).
[0541] Referring to FIG15, FIG15 is a simplified block diagram of an apparatus 1500 that can be used as either or both of the source device 12 and destination device 14 in FIG1A according to an exemplary embodiment. Apparatus 1500 can implement the techniques of this application. In other words, FIG15 is a schematic block diagram of an implementation of an encoder or decoder (referred to as decoding apparatus 1500) according to an embodiment of this application. The decoding apparatus 1500 may include a processor 1502, a memory 1504, and a bus system 1512. The processor 1502 and the memory 1504 are connected via the bus system 1512. The memory 1504 is used to store instruction / program code, and the processor 1502 is used to execute the instruction / program code stored in the memory 1504. The memory 1504 of the decoding apparatus 1500 stores instruction / program code, and the processor 1502 can call the program code stored in the memory 1504 to execute various video encoding or decoding methods described in this application. To avoid repetition, detailed descriptions are not provided here.
[0542] In this embodiment, the processor 1502 may be a central processing unit (CPU), or it may be other general-purpose processors, DSPs, ASICs, FPGAs, or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor.
[0543] The memory 1504 may include read-only memory (ROM) or random access memory (RAM). Any other suitable type of storage device may also be used as memory 1504. Memory 1504 may include program code and data 1506 accessed by processor 1502 via bus 1512. Memory 1504 may further include an operating system 1508 and an application program 1510, which includes at least one program that allows processor 1502 to execute the encoding or decoding methods described in this application. For example, application program 1510 may include applications 1 to N, which further include video encoding or decoding applications that execute the encoding or decoding methods described in this application.
[0544] In addition to the data bus, the bus system 1512 may also include a power bus, a control bus, and a status signal bus. However, for clarity, all buses are labeled as bus system 1512 in the figure.
[0545] Optionally, the decoding device 1500 may also include one or more output devices, such as a display 1518. In one example, the display 1518 may be a haptic display that combines a display with a haptic unit capable of operatively sensing touch input. The display 1518 may be connected to the processor 1502 via a bus 1512.
[0546] Based on the same concept as the above method, as shown in FIG16A, this application embodiment also provides a decoding device 1000, which includes: an acquisition module 1001, used to acquire the bitstream of an image to be decoded, the image to be decoded including a block to be decoded in a high-frequency subband; a decoding module 1002, used to decode the bitstream to obtain first information, the first information indicating that the absolute value of at least one coefficient of the block to be decoded is greater than a first value; the decoding module 1002 is further used to acquire a code table corresponding to the block to be decoded based on the first information, and to decode the block to be decoded through the code table to obtain reconstructed data of the block to be decoded, wherein the codeword lengths corresponding to coefficients whose absolute values are less than or equal to a second value in the code table are the same, and the first value is less than or equal to the second value.
[0547] The decoding module 1002 of the aforementioned decoding device can be applied to the entropy decoding process at the decoding end. Specifically, at the decoding end, the decoding module 1002 can be applied to the high-frequency subband entropy decoding unit of the aforementioned decoder.
[0548] The specific implementation process of the decoding device 1000 can be referred to the embodiments of the decoding method and the relevant description of the decoder in any of the above embodiments. For the sake of brevity, it will not be repeated here.
[0549] Based on the same concept as the above method, as shown in Figure 16B, this application embodiment also provides an encoding device 2000, which includes: an acquisition module 2001, used to acquire a code table corresponding to the block to be encoded when the absolute value of at least one coefficient of the block to be encoded in the image to be encoded is greater than a first value, wherein the block to be encoded is a coefficient block in the high-frequency subband obtained by wavelet transform of the image to be encoded, and the codewords corresponding to coefficients in the code table whose absolute values are less than or equal to a second value have the same length, and the first value is less than or equal to the second value; and an encoding module 2002, used to encode the block to be encoded based on the code table to obtain a code stream.
[0550] The encoding module 2002 of the aforementioned encoding device can be applied to the entropy encoding process at the encoding end. Specifically, at the encoding end, the encoding module 2002 can be applied to the high-frequency subband entropy encoding unit of the aforementioned encoder.
[0551] The specific implementation process of the encoding device 2000 can be referred to the encoding method embodiment and the relevant description of the encoder in any of the above embodiments. For the sake of brevity, it will not be repeated here.
[0552] All relevant content of each step involved in the above method embodiments can be referenced from the functional description of the corresponding functional module, and will not be repeated here.
[0553] This application also provides a chip including one or more interface circuits and one or more processors; the one or more processors receive or send data through the one or more interface circuits, and when the one or more processors execute computer instructions, the steps of the above-described related method steps to implement the methods in the above embodiments are executed. This application also provides a computer-readable storage medium storing computer instructions, which, when executed on an electronic device, cause the electronic device to execute the above-described related method steps to implement the methods in the above embodiments.
[0554] This embodiment also provides a computer program product comprising computer instructions that, when executed by a computer or processor, cause the computer to perform the aforementioned steps to implement the methods described in the above embodiments. Exemplarily, the computer program product may be stored in a computer-readable storage medium.
[0555] The computer-readable storage medium in this application includes random access memory (RAM), flash memory, read-only memory (ROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), registers, hard disks, portable hard disks, read-only optical discs (CD-ROMs), or any other form of storage medium known in the art.
[0556] In addition, embodiments of this application also provide an apparatus, which may specifically be a chip, component, or module. The apparatus may include a connected processor and a memory; wherein the memory is used to store computer execution instructions, and when the apparatus is running, the processor may execute the computer execution instructions stored in the memory to cause the chip to execute the methods in the above-described method embodiments.
[0557] In this embodiment, the device, computer-readable storage medium, computer program product, or chip are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can be referred to the beneficial effects in the corresponding methods provided above.
[0558] Through the above description of the embodiments, those skilled in the art will understand that, for the sake of convenience and brevity, 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 as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0559] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another apparatus, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0560] The units described as separate components may or may not be physically separate. A component shown as a unit can be one or more physical units; that is, it can be located in one place or distributed in multiple different locations. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0561] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0562] Any content in the various embodiments of this application, as well as any content in the same embodiment, can be freely combined. Any combination of the above content is within the scope of this application.
[0563] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.
Claims
1. A decoding method, characterized in that, The method includes: Obtain the bitstream of the image to be decoded, wherein the image to be decoded includes the block to be decoded in the high-frequency subband; The bitstream is decoded to obtain first information, the first information indicating that the absolute value of at least one coefficient of the block to be decoded is greater than a first value; Based on the first information, the code table corresponding to the block to be decoded is obtained, and the block to be decoded is decoded through the code table to obtain the reconstructed data of the block to be decoded. The codeword lengths corresponding to the coefficients whose absolute values are less than or equal to the second value in the code table are the same, and the first value is less than or equal to the second value.
2. The method according to claim 1, characterized in that, The bitstream includes a first syntax element that indicates that the absolute value of at least one coefficient of the block to be decoded is greater than the first value.
3. The method according to claim 1 or 2, characterized in that, The bitstream also includes a second syntax element, which indicates the encoded data of the coefficient values of the block to be decoded.
4. The method according to claim 3, characterized in that, Decoding the block to be decoded using the code table to obtain the reconstructed data of the block to be decoded includes: The second syntax element is decoded using the code table to obtain the reconstructed data of the block to be decoded.
5. The method according to any one of claims 1 to 4, characterized in that, The first value is 1.
6. The method according to claim 3, characterized in that, The second syntax element indicates the variable-length encoded data of the coefficient values of the block to be decoded.
7. The method according to claim 2, characterized in that, The first syntax element indicates the encoded data of the arithmetic code of the first information.
8. The method according to any one of claims 1 to 7, characterized in that, The codeword corresponding to a coefficient absolute value of 0 in the code table is 00, the codeword corresponding to a coefficient absolute value of 1 in the code table is 01, and the codeword corresponding to a coefficient absolute value of 2 in the code table is 10.
9. The method according to any one of claims 1 to 8, characterized in that, The code table is a code table corresponding to the absolute values of the coefficients of the block to be decoded, and the code table is Table 1: Table 1 Wherein, for the absolute value of the target coefficient in the code table that is greater than 5, the number of 1s in the corresponding prefix code in the code table, prefix1Count, satisfies prefix1Count=FastLog2(abs(v)-4)+4; and the number of bits in the corresponding suffix code of the target coefficient in the code table that is greater than 5 satisfies prefix1Count-4.
10. The method according to any one of claims 1 to 9, characterized in that, When the absolute value of the coefficient is greater than 0, the bitstream also includes the sign bit of the coefficient value of the block to be decoded.
11. An encoding method, characterized in that, The method includes: When the absolute value of at least one coefficient of the block to be encoded in the image to be encoded is greater than a first value, the code table corresponding to the block to be encoded is obtained, wherein the block to be encoded is a coefficient block in the high-frequency subband obtained by wavelet transform of the image to be encoded, and the codewords corresponding to the coefficients in the code table whose absolute values are less than or equal to a second value have the same length, and the first value is less than or equal to the second value. Based on the code table, the block to be encoded is encoded to obtain a bitstream.
12. The method according to claim 11, characterized in that, The bitstream includes a first syntax element, which indicates that the absolute value of at least one coefficient of the block to be encoded is greater than the first value.
13. The method according to claim 11 or 12, characterized in that, The bitstream also includes a second syntax element, which indicates the encoded data of the coefficient values of the block to be encoded.
14. The method according to any one of claims 11 to 13, characterized in that, The first value is 1.
15. The method according to claim 13, characterized in that, The second syntax element indicates the coded data for variable-length encoding of the coefficient values of the block to be encoded.
16. The method according to claim 12, characterized in that, The first syntax element is arithmetic encoded data.
17. The method according to any one of claims 11 to 16, characterized in that, The codeword corresponding to a coefficient absolute value of 0 in the code table is 00, the codeword corresponding to a coefficient absolute value of 1 in the code table is 01, and the codeword corresponding to a coefficient absolute value of 2 in the code table is 10.
18. The method according to any one of claims 11 to 17, characterized in that, The code table is a code table corresponding to the absolute values of the coefficients of the block to be encoded, and the code table is Table 1: Table 1 Wherein, for the absolute value of the target coefficient in the code table that is greater than 5, the number of 1s in the corresponding prefix code in the code table, prefix1Count, satisfies prefix1Count=FastLog2(abs(v)-4)+4; and the number of bits in the corresponding suffix code of the target coefficient in the code table that is greater than 5 satisfies prefix1Count-4.
19. The method according to any one of claims 11 to 18, characterized in that, When the absolute value of the coefficient is greater than 0, the bitstream also includes the sign bit of the coefficient value of the block to be encoded.
20. An encoder, characterized in that, include: A memory and a processor, wherein the memory is coupled to the processor; The memory stores program instructions that, when executed by the processor, cause the processor to perform the steps of the method as claimed in any one of claims 11 to 19.
21. A decoder, characterized in that, include: A memory and a processor, wherein the memory is coupled to the processor; The memory stores program instructions that, when executed by the processor, cause the processor to perform the steps of the method as described in any one of claims 1 to 10.
22. An encoder, characterized in that, include: A processing circuit that implements the steps of the method as claimed in any one of claims 11 to 19.
23. A decoder, characterized in that, include: A processing circuit that implements the steps of the method as claimed in any one of claims 1 to 10.
24. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed on a computer or processor, causes the computer or processor to perform the method as described in any one of claims 1 to 10, or causes the computer or processor to perform the method as described in any one of claims 11 to 19.
25. A computer program product, characterized in that, The computer program product includes computer instructions that, when executed by a computer or processor, cause the steps of the method as described in any one of claims 1 to 10 to be performed, or cause the steps of the method as described in any one of claims 11 to 19 to be performed.
26. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a bitstream generated according to the method described in any one of claims 11 to 19.