Decoding method, encoding method, apparatus, device, storage medium, and program product
By determining the region index based on the block size in video encoding and adaptively selecting the filter granularity, the problem of limited room for improvement in filtering effect in existing technologies is solved, and higher encoding and decoding performance is achieved.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
- Filing Date
- 2024-12-23
- Publication Date
- 2026-07-02
AI Technical Summary
Existing loop filters have limited room for improvement in filtering performance during video coding, making it difficult to further enhance encoding and decoding performance.
The region corresponding to the filter coefficient group in the filter coefficient set is determined by parsing the bit stream, and the region index is determined based on the size of the current block. The granularity of the filter is adaptively selected, and loop filtering is performed on the current block.
This improved the filtering effect, thereby enhancing encoding and decoding performance.
Smart Images

Figure CN2024141554_02072026_PF_FP_ABST
Abstract
Description
Decoding methods, encoding methods, devices, equipment, storage media and program products Technical Field
[0001] This application belongs to the field of encoding and decoding technology, specifically relating to a decoding method, encoding method, apparatus, device, storage medium, and program product. Background Technology
[0002] In video coding standards, loop filters mainly include deblocking filters, sample offset compensation, and adaptive loop filters (ALF).
[0003] ALF (Average Filtering) improves overall image quality by filtering the reconstructed image to minimize the mean square error between the reconstructed and original images. However, there is still room for improvement in the filtering effect when using ALF. Summary of the Invention
[0004] This application provides a decoding method, encoding method, apparatus, device, storage medium, and program product that can improve the filtering effect of filters, thereby improving encoding and decoding performance.
[0005] In a first aspect, a decoding method is provided, comprising: parsing a bitstream to obtain first information, the first information being used to determine the region corresponding to a filter coefficient group in a filter coefficient set; performing loop filtering on the reconstructed block of the current block based on the first information, the filter coefficient set, and the region index of the current block; wherein the region index of the current block is determined based on the size of the current block.
[0006] In conjunction with the first aspect, in some implementations, the size of the aforementioned current block is less than or equal to the size of the Coding Tree Unit (CTU).
[0007] In conjunction with the first aspect, in some implementations, the size of the aforementioned current block being less than or equal to the size of the CTU includes at least one of the following:
[0008] The width of the current block is less than or equal to the width of the CTU;
[0009] The height of the current block is less than or equal to the height of the CTU.
[0010] In conjunction with the first aspect, in some implementations, the region index of the current block is determined based on the first index, or based on the first index and the region lookup table;
[0011] The first index mentioned above is determined based on the position coordinates of the current block and the size of the current block.
[0012] In conjunction with the first aspect, in some implementations, the aforementioned first index includes a second index and a third index, wherein the second index is determined based on the horizontal coordinate of the current block's position and the width of the current block, and the third index is determined based on the vertical coordinate of the current block's position and the height of the current block.
[0013] In conjunction with the first aspect, in some implementations, the second index is determined based on a first ratio of the horizontal coordinate of the current block's position to the width of the current block; the third index is determined based on a second ratio of the vertical coordinate of the current block's position to the height of the current block.
[0014] In conjunction with the first aspect, in some implementations, the aforementioned second index is the minimum of the first ratio and the first value, which is related to the maximum number of regions of the CTU or image in the horizontal direction; the aforementioned third index is the minimum of the second ratio and the second value, which is related to the maximum number of regions of the CTU or image in the vertical direction.
[0015] In conjunction with the first aspect, in some implementations, the x-coordinate of the current block's position is the x-coordinate of the top-left corner of the current block relative to the first position, and the y-coordinate of the current block's position is the y-coordinate of the top-left corner of the current block relative to the first position.
[0016] The first position mentioned above refers to the upper left corner of the CTU or the upper left corner of the image.
[0017] In conjunction with the first aspect, in some implementations, the region index of the current block is determined based on the first index;
[0018] The region index of the current block is the sum of the second index and the third value, which is the product of the third index and the fourth value, which is the number of blocks contained in the horizontal direction.
[0019] In conjunction with the first aspect, in some implementations, the region index of the current block is determined based on the first index and the region lookup table;
[0020] The region index of the current block is a value determined from the region lookup table based on the second and third indices mentioned above.
[0021] In conjunction with the first aspect, in some implementations, the region index of the current block is the value corresponding to the second position in the region lookup table, where the second position is the position with the second index on the horizontal axis and the third index on the vertical axis.
[0022] In conjunction with the first aspect, in some implementations, the aforementioned region lookup table is determined based on the location coordinates of the CTU; wherein, the location coordinates of the CTU are the coordinates of the CTU relative to the upper left corner of the image.
[0023] In conjunction with the first aspect, in some implementations, the above decoding method also includes:
[0024] The first syntax element in the parsed code stream is used to obtain the first indication information, which is used to indicate the index of the region lookup table.
[0025] In conjunction with the first aspect, in some implementations, the aforementioned loop filtering of the reconstructed block of the current block based on the first information, the set of filter coefficients, and the region index of the current block includes:
[0026] Based on the first information, determine the region corresponding to the filter coefficient group in the filter coefficient set;
[0027] The first filter coefficient group is determined from the filter coefficient set based on the region corresponding to the filter coefficient group and the region index of the current block;
[0028] Loop filtering is performed on the reconstructed block of the current block based on the first set of filter coefficients.
[0029] In conjunction with the first aspect, in some implementations, the above-mentioned parsing of the bitstream yields the first information, including:
[0030] The second syntax element in the code stream is parsed to obtain the first information.
[0031] In conjunction with the first aspect, in some implementations, the above decoding method also includes:
[0032] The third syntax element in the bitstream is parsed to obtain the set of filter coefficients.
[0033] In conjunction with the first aspect, in some implementations, the above decoding method also includes:
[0034] The fourth syntax element in the bitstream is parsed to obtain the second indication information, which is used to indicate whether to perform loop filtering on the reconstructed block of the current block. The reconstructed block includes at least one of the following: a reconstructed block of the luminance component, a reconstructed block of the first chrominance component, and a reconstructed block of the second chrominance component.
[0035] In conjunction with the first aspect, in some implementations, the above decoding method also includes:
[0036] The fifth syntax element in the bitstream is parsed to obtain the second information, which is used to characterize the maximum number of filter coefficient sets that can be used in a region of the image, and the maximum number is the number of regions in the image.
[0037] In conjunction with the first aspect, in some implementations, the above decoding method also includes:
[0038] The sixth syntax element in the parsed bitstream is used to obtain the scaling factor corresponding to the set of filter coefficients. This scaling factor is used to integrate the filter coefficients determined based on the set of filter coefficients.
[0039] In conjunction with the first aspect, in some implementations, the aforementioned current block is a block in the CTU; or, the aforementioned current block is a block in the image.
[0040] In conjunction with the first aspect, in some implementations, the aforementioned current block is a block in the CTU, and the aforementioned reconstructed block includes at least one of the following: a reconstructed block of the luminance component, a reconstructed block of the first chrominance component, and a reconstructed block of the second chrominance component; or,
[0041] The aforementioned current block is a block in the image, and the aforementioned reconstructed block includes at least one of the following: a reconstructed block of the first chromaticity component and a reconstructed block of the second chromaticity component.
[0042] In the decoding method of this application embodiment, the decoding end can parse the bitstream to obtain first information. This first information is used to determine the region corresponding to the filter coefficient group in the filter coefficient set. Then, based on the first information, the filter coefficient set, and the region index of the current block, loop filtering is performed on the reconstructed block of the current block. The region index of the current block is determined based on the size of the current block. Through this scheme, since the region index of the current block can be determined based on the size of the current block, for each YUV component, the region index of the block can be adaptively determined according to the size of the corresponding block to determine the filter used for the region corresponding to the block. That is, the size of the block determines the granularity of the filter. Therefore, the granularity of the filter determined by the decoding end based on the first information, the filter coefficient set, and the region index of the current block is a block-level filter determined by the size of the block. Using a filter with this granularity to filter the reconstructed block of the current block can improve the filtering effect, thereby improving the filter performance and thus improving the encoding and decoding performance.
[0043] Secondly, an encoding method is provided, which includes: performing loop filtering on the reconstructed block of the current block based on first information, a set of filtering coefficients and a region index of the current block, wherein the first information is used to determine the region corresponding to the filtering coefficient group in the set of filtering coefficients; and writing the first information into the bit stream; wherein the region index of the current block is determined based on the size of the current block.
[0044] In conjunction with the second aspect, in some implementations, the size of the aforementioned current block is less than or equal to the size of the CTU.
[0045] In conjunction with the second aspect, in some implementations, the size of the aforementioned current block being less than or equal to the size of the CTU includes at least one of the following:
[0046] The width of the current block is less than or equal to the width of the CTU;
[0047] The height of the current block is less than or equal to the height of the CTU.
[0048] In conjunction with the second aspect, in some implementations, the region index of the current block is determined based on the first index, or based on the first index and the region lookup table;
[0049] The first index mentioned above is determined based on the position coordinates of the current block and the size of the current block.
[0050] In conjunction with the second aspect, in some implementations, the aforementioned first index includes a second index and a third index, wherein the second index is determined based on the horizontal coordinate of the current block's position and the width of the current block, and the third index is determined based on the vertical coordinate of the current block's position and the height of the current block.
[0051] In conjunction with the second aspect, in some implementations, the aforementioned second index is determined based on a first ratio of the horizontal coordinate of the current block's position to the width of the current block; the aforementioned third index is determined based on a second ratio of the vertical coordinate of the current block's position to the height of the current block.
[0052] In conjunction with the second aspect, in some implementations, the aforementioned second index is the minimum of the first ratio and the first value, which is related to the maximum number of regions of the CTU or image in the horizontal direction;
[0053] The third index mentioned above is the minimum of the second ratio and the second value, which is related to the maximum number of regions in the vertical direction of the CTU or image.
[0054] In conjunction with the second aspect, in some implementations, the x-coordinate of the current block's position is the x-coordinate of the top-left corner of the current block relative to the first position, and the y-coordinate of the current block's position is the y-coordinate of the top-left corner of the current block relative to the first position.
[0055] The first position mentioned above refers to the upper left corner of the CTU or the upper left corner of the image.
[0056] In conjunction with the second aspect, in some implementations, the region index of the current block is determined based on the first index;
[0057] The region index of the current block is the sum of the second index and the third value, which is the product of the third index and the fourth value, which is the number of blocks contained in the horizontal direction.
[0058] In conjunction with the second aspect, in some implementations, the region index of the current block is determined based on the first index and the region lookup table;
[0059] The region index of the current block is a value determined from the region lookup table based on the second and third indices mentioned above.
[0060] In conjunction with the second aspect, in some implementations, the region index of the current block is the value corresponding to the second position in the region lookup table. This second position is the position where the horizontal coordinate is the second index and the vertical coordinate is the third index.
[0061] In conjunction with the second aspect, in some implementations, the aforementioned region lookup table is determined based on the location coordinates of the CTU; where the location coordinates of the CTU are the coordinates of the CTU relative to the upper left corner of the image.
[0062] In conjunction with the second aspect, in some implementations, the above encoding method also includes:
[0063] Write the first syntax element into the code stream. This first syntax element is used to represent the first indication information, which is used to indicate the index of the area lookup table.
[0064] In conjunction with the second aspect, in some implementations, the aforementioned loop filtering of the reconstructed block of the current block based on the first information, the set of filter coefficients, and the region index of the current block includes:
[0065] Based on the first information, determine the region corresponding to the filter coefficient group in the filter coefficient set;
[0066] The first filter coefficient group is determined from the filter coefficient set based on the region corresponding to the filter coefficient group and the region index of the current block;
[0067] Loop filtering is performed on the reconstructed block of the current block based on the first set of filter coefficients.
[0068] In conjunction with the second aspect, in some implementations, the above-mentioned writing of the first information into the bitstream includes:
[0069] Write the second syntax element into the code stream. The second syntax element is used to represent the first information.
[0070] In conjunction with the second aspect, in some implementations, the above encoding method also includes:
[0071] The third syntax element is written into the bitstream; the third syntax element is used to represent the set of filter coefficients.
[0072] In conjunction with the second aspect, in some implementations, the above encoding method also includes:
[0073] Write a fourth syntax element into the bitstream. The fourth syntax element is used to characterize the second indication information. The second indication information is used to indicate whether to perform loop filtering on the reconstructed block of the current block. The reconstructed block includes at least one of the following: a reconstructed block of the luminance component, a reconstructed block of the first chrominance component, and a reconstructed block of the second chrominance component.
[0074] In conjunction with the second aspect, in some implementations, the above encoding method also includes:
[0075] The fifth syntax element is written into the bitstream. This fifth syntax element is used to characterize the second information, which is used to characterize the maximum number of filter coefficient sets that can be used in a region of the image. This maximum number is the number of regions in the image.
[0076] In conjunction with the second aspect, in some implementations, the above encoding method also includes:
[0077] The sixth syntax element is written into the bitstream. This sixth syntax element is used to characterize the scaling factor corresponding to the set of filter coefficients. This scaling factor is used to integrate the filter coefficients determined based on the set of filter coefficients.
[0078] In conjunction with the second aspect, in some implementations, the aforementioned current block is a block in the CTU; or, the aforementioned current block is a block in the image.
[0079] In conjunction with the second aspect, in some implementations, the aforementioned current block is a block in the CTU, and the aforementioned reconstructed block includes at least one of the following: a reconstructed block of the luminance component, a reconstructed block of the first chrominance component, and a reconstructed block of the second chrominance component; or,
[0080] The aforementioned current block is a block in the image, and the aforementioned reconstructed block includes at least one of the following: a reconstructed block of the first chromaticity component and a reconstructed block of the second chromaticity component.
[0081] In the encoding method of this application embodiment, the encoding end can perform loop filtering on the reconstructed block of the current block based on first information, a set of filter coefficients, and the region index of the current block. The first information is used to determine the region corresponding to the filter coefficient group in the set of filter coefficients, and the region index of the current block is determined based on the size of the current block. Then, the encoding end writes the first information into the bitstream. Through this scheme, since the region index of the current block can be determined based on the size of the current block, for each YUV component, the region index of the block can be adaptively determined according to the size of the corresponding block to determine the filter used for the region corresponding to the block. That is, the size of the block determines the granularity of the filter. Therefore, the granularity of the filter determined by the encoding end based on the first information, the set of filter coefficients, and the region index of the current block is a block-level filter determined by the size of the block. Using a filter with this granularity to filter the reconstructed block of the current block can improve the filtering effect, thereby improving the performance of the filter and thus improving the encoding and decoding performance.
[0082] Thirdly, a decoding device is provided, comprising: a parsing module and a filtering module. The parsing module is used to parse the bitstream to obtain first information, which is used to determine the region corresponding to the filter coefficient group in the filter coefficient set; the filtering module is used to perform loop filtering on the reconstructed block of the current block based on the first information, the filter coefficient set, and the region index of the current block; wherein the region index of the current block is determined based on the size of the current block.
[0083] In conjunction with the third aspect, in some implementations, the size of the aforementioned current block is less than or equal to the size of the CTU.
[0084] In conjunction with the third aspect, in some implementations, the size of the aforementioned current block being less than or equal to the size of the CTU includes at least one of the following:
[0085] The width of the current block is less than or equal to the width of the CTU;
[0086] The height of the current block is less than or equal to the height of the CTU.
[0087] In conjunction with the third aspect, in some implementations, the region index of the current block is determined based on the first index, or based on the first index and the region lookup table;
[0088] The first index mentioned above is determined based on the position coordinates of the current block and the size of the current block.
[0089] In conjunction with the third aspect, in some implementations, the aforementioned first index includes a second index and a third index, wherein the second index is determined based on the horizontal coordinate of the current block's position and the width of the current block, and the third index is determined based on the vertical coordinate of the current block's position and the height of the current block.
[0090] In conjunction with the third aspect, in some implementations, the second index is determined based on a first ratio of the horizontal coordinate of the current block's position to the width of the current block; the third index is determined based on a second ratio of the vertical coordinate of the current block's position to the height of the current block.
[0091] In conjunction with the third aspect, in some implementations, the aforementioned second index is the minimum of the first ratio and the first value, which is related to the maximum number of regions of the CTU or image in the horizontal direction; the aforementioned third index is the minimum of the second ratio and the second value, which is related to the maximum number of regions of the CTU or image in the vertical direction.
[0092] In conjunction with the third aspect, in some implementations, the x-coordinate of the current block's position is the x-coordinate of the top-left corner of the current block relative to the first position, and the y-coordinate of the current block's position is the y-coordinate of the top-left corner of the current block relative to the first position.
[0093] The first position mentioned above refers to the upper left corner of the CTU or the upper left corner of the image.
[0094] In conjunction with the third aspect, in some implementations, the region index of the current block is determined based on the first index;
[0095] The region index of the current block is the sum of the second index and the third value, which is the product of the third index and the fourth value, which is the number of blocks contained in the horizontal direction.
[0096] In conjunction with the third aspect, in some implementations, the region index of the current block is determined based on the first index and the region lookup table;
[0097] The region index of the current block is a value determined from the region lookup table based on the second and third indices mentioned above.
[0098] In conjunction with the third aspect, in some implementations, the region index of the current block is the value corresponding to the second position in the region lookup table. This second position is the position where the horizontal coordinate is the second index and the vertical coordinate is the third index.
[0099] In conjunction with the third aspect, in some implementations, the aforementioned area lookup table is determined based on the location coordinates of the CTU;
[0100] The position coordinates of the CTU are the coordinates of the CTU relative to the upper left corner of the image.
[0101] In conjunction with the third aspect, in some implementations, the aforementioned parsing module is also used to parse the first syntax element in the code stream to obtain first indication information, which is used to indicate the index of the region lookup table.
[0102] In conjunction with the third aspect, in some implementations, the aforementioned filtering module is specifically used for:
[0103] Based on the first information, determine the region corresponding to the filter coefficient group in the filter coefficient set;
[0104] The first filter coefficient group is determined from the filter coefficient set based on the region corresponding to the filter coefficient group and the region index of the current block;
[0105] Loop filtering is performed on the reconstructed block of the current block based on the first set of filter coefficients.
[0106] In conjunction with the third aspect, in some implementations, the aforementioned parsing module is specifically used for:
[0107] The second syntax element in the code stream is parsed to obtain the first information.
[0108] In conjunction with the third aspect, in some implementations, the aforementioned parsing module is also used to parse the third syntax element in the bitstream to obtain a set of filter coefficients.
[0109] In conjunction with the third aspect, in some implementations, the aforementioned parsing module is also used to parse the fourth syntax element in the bitstream to obtain second indication information. This second indication information is used to indicate whether to perform loop filtering on the reconstruction block of the current block. The reconstruction block includes at least one of the following: a reconstruction block of the luminance component, a reconstruction block of the first chrominance component, and a reconstruction block of the second chrominance component.
[0110] In conjunction with the third aspect, in some implementations, the aforementioned parsing module is also used to parse the fifth syntax element in the bitstream to obtain second information, which is used to characterize the maximum number of filter coefficient sets that can be used in a region of the image, the maximum number being the number of regions in the image.
[0111] In conjunction with the third aspect, in some implementations, the aforementioned parsing module is also used to parse the sixth syntax element in the bitstream to obtain the scaling factor corresponding to the set of filter coefficients. This scaling factor is used to integrate the filter coefficients determined based on the set of filter coefficients.
[0112] In conjunction with the third aspect, in some implementations, the aforementioned current block is a block in the CTU; or, the aforementioned current block is a block in the image.
[0113] In conjunction with the third aspect, in some implementations, the aforementioned current block is a block in the CTU, and the aforementioned reconstructed block includes at least one of the following: a reconstructed block of the luminance component, a reconstructed block of the first chrominance component, and a reconstructed block of the second chrominance component; or,
[0114] The aforementioned current block is a block in the image, and the aforementioned reconstructed block includes at least one of the following: a reconstructed block of the first chromaticity component and a reconstructed block of the second chromaticity component.
[0115] Fourthly, an encoding apparatus is provided, comprising: a filtering module and an encoding module. The filtering module is used to perform loop filtering on the reconstructed block of the current block based on first information, a set of filtering coefficients, and a region index of the current block, wherein the first information is used to determine the region corresponding to the filtering coefficient group in the set of filtering coefficients; the encoding module is used to write the first information into the bitstream; wherein the region index of the current block is determined based on the size of the current block.
[0116] In conjunction with the fourth aspect, in some implementations, the size of the aforementioned current block is less than or equal to the size of the CTU.
[0117] In conjunction with the fourth aspect, in some implementations, the size of the aforementioned current block being less than or equal to the size of the CTU includes at least one of the following:
[0118] The width of the current block is less than or equal to the width of the CTU;
[0119] The height of the current block is less than or equal to the height of the CTU.
[0120] In conjunction with the fourth aspect, in some implementations, the region index of the current block is determined based on the first index, or based on the first index and the region lookup table;
[0121] The first index mentioned above is determined based on the position coordinates of the current block and the size of the current block.
[0122] In conjunction with the fourth aspect, in some implementations, the aforementioned first index includes a second index and a third index. The second index is determined based on the horizontal coordinate of the current block's position and the width of the current block, and the third index is determined based on the vertical coordinate of the current block's position and the height of the current block.
[0123] In conjunction with the fourth aspect, in some implementations, the second index is determined based on a first ratio of the horizontal coordinate of the current block's position to the width of the current block; the third index is determined based on a second ratio of the vertical coordinate of the current block's position to the height of the current block.
[0124] In conjunction with the fourth aspect, in some implementations, the aforementioned second index is the minimum of the first ratio and the first value, which is related to the maximum number of regions of the CTU or image in the horizontal direction;
[0125] The third index mentioned above is the minimum of the second ratio and the second value, which is related to the maximum number of regions in the vertical direction of the CTU or image.
[0126] In conjunction with the fourth aspect, in some implementations, the x-coordinate of the current block's position is the x-coordinate of the upper left corner of the current block relative to the first position, and the y-coordinate of the current block's position is the y-coordinate of the upper left corner of the current block relative to the first position.
[0127] The first position mentioned above refers to the upper left corner of the CTU or the upper left corner of the image.
[0128] In conjunction with the fourth aspect, in some implementations, the region index of the current block is determined based on the first index;
[0129] The region index of the current block is the sum of the second index and the third value, which is the product of the third index and the fourth value, which is the number of blocks contained in the horizontal direction.
[0130] In conjunction with the fourth aspect, in some implementations, the region index of the current block is determined based on the first index and the region lookup table;
[0131] The region index of the current block is a value determined from the region lookup table based on the second and third indices mentioned above.
[0132] In conjunction with the fourth aspect, in some implementations, the region index of the current block is the value corresponding to the second position in the region lookup table. This second position is the position where the horizontal coordinate is the second index and the vertical coordinate is the third index.
[0133] In conjunction with the fourth aspect, in some implementations, the aforementioned region lookup table is determined based on the location coordinates of the CTU; where the location coordinates of the CTU are the coordinates of the CTU relative to the upper left corner of the image.
[0134] In conjunction with the fourth aspect, in some implementations, the aforementioned encoding module is also used to write a first syntax element into the code stream, the first syntax element being used to characterize first indication information, the first indication information being used to indicate the index of the region lookup table.
[0135] In conjunction with the fourth aspect, in some implementations, the aforementioned filtering module is specifically used for:
[0136] Based on the first information, determine the region corresponding to the filter coefficient group in the filter coefficient set;
[0137] The first filter coefficient group is determined from the filter coefficient set based on the region corresponding to the filter coefficient group and the region index of the current block;
[0138] Loop filtering is performed on the reconstructed block of the current block based on the first set of filter coefficients.
[0139] In conjunction with the fourth aspect, in some implementations, the aforementioned encoding module is specifically used for:
[0140] Write the second syntax element into the code stream; this second syntax element is used to represent the first information.
[0141] In conjunction with the fourth aspect, in some implementations, the aforementioned encoding module is also used to write a third syntax element into the bitstream, which is used to characterize the set of filter coefficients.
[0142] In conjunction with the fourth aspect, in some implementations, the above-mentioned encoding module is also used to write a fourth syntax element into the bitstream. The fourth syntax element is used to characterize the second indication information, which is used to indicate whether to perform loop filtering on the reconstructed block of the current block. The reconstructed block includes at least one of the following: a reconstructed block of the luminance component, a reconstructed block of the first chrominance component, and a reconstructed block of the second chrominance component.
[0143] In conjunction with the fourth aspect, in some implementations, the aforementioned encoding module is also used to write a fifth syntax element into the bitstream. This fifth syntax element is used to characterize the second information, which is used to characterize the maximum number of filter coefficient sets that can be used in a region of the image, the maximum number being the number of regions in the image.
[0144] In conjunction with the fourth aspect, in some implementations, the aforementioned encoding module is also used to write the sixth syntax element into the bitstream. This sixth syntax element is used to characterize the scaling factor corresponding to the set of filter coefficients. This scaling factor is used to integrate the filter coefficients determined based on the set of filter coefficients.
[0145] In conjunction with the fourth aspect, in some implementations, the aforementioned current block is a block in the CTU; or, the aforementioned current block is a block in the image.
[0146] In conjunction with the fourth aspect, in some implementations, the aforementioned current block is a block in the CTU, and the aforementioned reconstructed block includes at least one of the following: a reconstructed block of the luminance component, a reconstructed block of the first chrominance component, and a reconstructed block of the second chrominance component; or,
[0147] The aforementioned current block is a block in the image, and the aforementioned reconstructed block includes at least one of the following: a reconstructed block of the first chromaticity component and a reconstructed block of the second chromaticity component.
[0148] Fifthly, a decoder is provided, comprising: a memory and a processor, wherein the memory is used to store executable data instructions, and the processor is used to implement the decoding method as described in the first aspect or its various implementations above when executing the executable instructions stored in the memory.
[0149] In a sixth aspect, an encoder is provided, comprising: a memory and a processor, the memory for storing executable data instructions, and the processor for implementing the encoding method as described in the second aspect or its various implementations above when executing the executable instructions stored in the memory.
[0150] In a seventh aspect, a computer storage medium is provided for storing a bitstream generated by the encoding method described in the second aspect or its various implementations above.
[0151] Eighthly, an encoding / decoding system is provided, including an encoder and a decoder. The decoder is used to execute the decoding method described in the first aspect or its various implementations, and the encoder is used to execute the encoding method described in the second aspect or its various implementations.
[0152] In a ninth aspect, a chip is provided, the chip including a processor and a communication interface coupled to the processor, the processor being configured to run a program or instructions to implement the decoding method as described in the first aspect or its various implementations above, or to implement the encoding method as described in the second aspect or its various implementations above.
[0153] In a tenth aspect, a computer-readable storage medium is provided that stores a computer program, which, when executed by at least one processor, implements the decoding method as described in the first aspect or its various implementations above, or implements the encoding method as described in the second aspect or its various implementations above.
[0154] Eleventhly, a computer program product is provided, including computer program instructions that, when executed, implement the decoding method as described in the first aspect or its various implementations, or implement the encoding method as described in the second aspect or its various implementations.
[0155] In a twelfth aspect, a computer program is provided that, when run on a computer, causes the computer to perform the decoding method as described in the first aspect or its various implementations above, or to perform the encoding method as described in the second aspect or its various implementations above. Attached Figure Description
[0156] Figure 1 is a schematic diagram of an example of the shape of the ALF filter provided in an embodiment of this application;
[0157] Figure 2A is a schematic diagram of an example of image region division provided in an embodiment of this application;
[0158] Figure 2B is a schematic diagram of an example of a lookup table for image regions provided in an embodiment of this application;
[0159] Figure 3 is a schematic diagram of a simplified video encoding and decoding process provided in an embodiment of this application.
[0160] Figure 4 is a schematic diagram of the architecture of the encoding and decoding system provided in an embodiment of this application;
[0161] Figure 5A is a schematic diagram of the encoder provided in an embodiment of this application;
[0162] Figure 5B is a schematic diagram of the decoder provided in an embodiment of this application;
[0163] Figure 6 is a flowchart illustrating the encoding method provided in an embodiment of this application;
[0164] Figure 7 is a schematic diagram of an example of block partitioning of CTU provided in an embodiment of this application;
[0165] Figure 8 is a schematic diagram of an example of four area lookup tables provided in an embodiment of this application;
[0166] Figure 9 is a flowchart illustrating the encoding method provided in an embodiment of this application;
[0167] Figure 10 is a flowchart illustrating the encoding method provided in an embodiment of this application;
[0168] Figure 11 is a flowchart illustrating the decoding method provided in an embodiment of this application;
[0169] Figure 12 is a flowchart illustrating the decoding method provided in an embodiment of this application;
[0170] Figure 13 is a flowchart illustrating the decoding method provided in an embodiment of this application;
[0171] Figure 14 is a schematic diagram of the structure of the encoding device provided in an embodiment of this application;
[0172] Figure 15 is a schematic diagram of the structure of the encoding device provided in an embodiment of this application;
[0173] Figure 16 is a schematic diagram of the decoding device provided in an embodiment of this application;
[0174] Figure 17 is a schematic diagram of the structure of the decoding device provided in the embodiment of this application. Detailed Implementation
[0175] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.
[0176] In the description of the embodiments of this application, terms such as "first" and "second" are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that such terms can be used interchangeably where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first" and "second" are generally of the same class, and the number of objects is not limited. For example, the first object can be one or more.
[0177] In the description of the embodiments of this application, "instruction" can be either a direct instruction (or explicit instruction) or an indirect instruction (or implicit instruction). A direct instruction can be understood as the sender explicitly informing the receiver of specific information, the operation to be performed, or the requested result in the instruction sent. An indirect instruction can be understood as the receiver determining the corresponding information based on the instruction sent by the sender, or making a judgment and determining the operation to be performed or the requested result based on the judgment result.
[0178] In the description of the embodiments of this application, "at least one (item)", "at least one of", etc., refer to any one, any two or more combinations of the included objects. For example, at least one (item) of a, b, c can be represented as: "a", "b", "c", "a and b", "a and c", "b and c", and "a, b and c", where a, b, and c can be single or multiple. Similarly, "at least two (items)" refers to two or more, and its meaning is similar to "at least one (item)". In addition, the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0179] In the description of the embodiments of this application, "multiple" means two or more. For example, multiple image blocks refer to two or more image blocks. "At least two" has a similar meaning to "multiple," and in some embodiments, the two can be used interchangeably.
[0180] In the description of embodiments of this application, the terms "including," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that includes a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising a..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0181] The following explains some concepts and / or terms involved in the decoding method, encoding method, apparatus, device, storage medium, and program product provided in the embodiments of this application.
[0182] 1. Digital video compression technology
[0183] Digital video compression technology primarily compresses massive amounts of digital video data to facilitate transmission and storage. With the surge in internet video and increasing demands for video clarity, while existing digital video compression standards can save considerable video data, there is still a need to pursue better digital video compression technologies to reduce the bandwidth and traffic burden of digital video transmission.
[0184] In digital video encoding, the encoder reads unequal pixels from the original video sequence in different color formats, including luminance and chrominance components; that is, the encoder reads a black-and-white or color image. This image is then divided into blocks, and the block data is encoded by the encoder. Modern encoders typically use a hybrid frame coding mode, generally including intra-frame and inter-frame prediction, transform and quantization, inverse transform and inverse quantization, loop filtering, and entropy coding. Intra-frame prediction only references information from the same frame to predict pixel information within the current block, eliminating spatial redundancy. Inter-frame prediction can reference information from different frames, using motion estimation to search for the motion vector information that best matches the current block, eliminating temporal redundancy. Transform converts the predicted image blocks to the frequency domain, redistributing energy; combined with quantization, it removes information that the human eye is insensitive to, eliminating visual redundancy. Loop filtering uses statistical information to filter the image, improving both subjective and objective image quality. Entropy coding can eliminate character redundancy based on the current context model and the probability information of the binary bitstream.
[0185] 2. Video encoding technology
[0186] Video sequences contain a series of redundant information, including spatial redundancy, temporal redundancy, visual redundancy, information entropy redundancy, structural redundancy, knowledge redundancy, and importance redundancy. To remove as much redundant information as possible from video sequences and reduce the amount of data representing the video, video coding techniques have been proposed to reduce storage space and save transmission bandwidth. Video coding techniques are also known as video compression techniques.
[0187] As a new generation of video coding standard, VVC not only helps users store more high-definition video on their devices, thereby reducing data traffic on the network, but also supports high resolution, high dynamic range, screen content encoding and other functions in main10 profile, improving compression performance and enabling users to reduce data size by 50% while maintaining the subjective quality of the video.
[0188] It should be noted that in encoding algorithms based on a hybrid encoding architecture, the above compression encoding methods can be used in combination.
[0189] 3. Video decoding technology
[0190] Video decoding technology is a component of video encoding and decoding technology. Corresponding to video encoding technology, video decoding involves the process of restoring compressed video data into the original, playable video signal. Specifically, video encoding technology uses specific compression algorithms to compress the original video data into smaller files for easier storage and transmission; video decoding technology is the reverse operation, decompressing the compressed video data back into the original video signal for playback on display devices. This technology is of great significance to various industries such as IPTV, digital cinemas, distance education, and video conferencing, as it can significantly reduce the bandwidth and storage space required for storage and transmission while maintaining video quality.
[0191] Video decoding technologies can be classified according to different standards, mainly including the following:
[0192] Compression methods can be categorized into lossless decoding and lossy decoding.
[0193] Lossless decoding: Lossless decoding can completely recover the original video data without any information loss. This decoding method is suitable for situations with extremely high video quality requirements, such as disk file compression.
[0194] Lossy decoding: Lossy decoding loses some of the original data during decompression, but this loss usually does not significantly affect the viewing experience. Lossy decoding is widely used in video conferencing, video broadcasting, video surveillance, and other fields because it can significantly reduce bitrate and storage requirements while maintaining video quality.
[0195] 4. In-loop filter
[0196] Loop filters mainly include bilateral filters, luminance mapping and chrominance scaling, deblocking filters, sample offset compensation, and adaptive loop filters (ALF). Among them, ALF is a filter designed to minimize the mean square error between the reconstructed image and the original image.
[0197] Figure 1 shows the shape of the ALF filter. The pixel position corresponding to C14 is the pixel to be filtered, and the other positions are the positions of neighboring pixels.
[0198] After determining each region of the image, the covariance matrix and error vector of all pixels within the same region are summed. Specifically, for each pixel, its covariance matrix A is a 15x15 square matrix. Let each element of matrix A be a. i,j Where i,j∈[0,1,2,…,13,14], for a i,j Its value is: a i,j=R(i)*R(j)
[0199] The value of R(i) is: R(i) = rec′(i)
[0200] Wherein, when the value of i is less than 14, rec′(*) represents the sum of the reconstructed pixel values output by the previous module. It can be seen that each i corresponds to two positions. When i is less than 14, rec′(i) is the sum of the reconstructed pixel values at the two positions. When i equals 14, rec′(i) is the pixel value to be filtered and reconstructed.
[0201] The error vector B is a 15x1 vector. Let each element of vector B be b. i Where i∈[0,1,2,…,13,14], for b i Its value is: b i =R(i)*E
[0202] The meaning of R(i) is the same as above. For E, we have: E = org - rec
[0203] Where rec is the reconstructed pixel value of the pixel to be filtered, and org represents the original pixel value of the pixel to be filtered.
[0204] After obtaining the covariance matrix A and error vector B for each pixel, the covariance matrix and error vector of pixels of the same class in a frame of the image are summed separately. The Wiener-Hope equation Ac = B is constructed, where A is the sum of the covariance matrices of pixels of the same class, and B is the sum of the error vectors of pixels of the same class. The coefficient c for this class needs to be solved, where c is a 15x1 vector.
[0205] It should be noted that the filter coefficients obtained from the equations are all floating-point numbers. Since the range of floating-point numbers is almost unlimited, a lot of bits are needed to encode the coefficients. To solve this problem, the EVM encoder converts the filter coefficients to integers. First, the filter coefficients are scaled: c′ i =scale*c i
[0206] Among them, c i Here are the filter coefficients for solving the Wiener-Hoppt equation, scale is the adaptive scaling factor, and c′ i The values are scaled. Then, the coefficients are rounded to obtain the filter coefficients (coef).
[0207] After obtaining the filter coefficients, ALF will filter the pixels to be filtered, that is, based on the clamping function COM_CLIP3, the input pixel value img_pad, and the filter coefficients coef, the output pixel value img_res. The function COM_CLIP3(a,b,c) works as follows: when c is less than a, the function outputs a; when c is greater than b, the function outputs b; otherwise, the function outputs c.
[0208] Furthermore, after filtering, the relevant syntax elements need to be written into the bitstream. For example, this includes the ALF switch for the current image, whether the U-component of the current image is filtered, and the corresponding filter. If filters are used, the number of filters and the coefficients of each filter need to be written into the bitstream. At the decoding end, after receiving the bitstream, it determines the ALF switch for the current image, whether the U-component of the current image is filtered, and the corresponding filter.
[0209] Typically, for YUV, each channel has its own independent ALF. For the luminance component (hereinafter referred to as the Y component), a frame of image is divided into a maximum of 64 regions, with a maximum of 8 regions in the horizontal direction and a maximum of 8 regions in the vertical direction. The smallest unit of each region is CTU, meaning that each region can have an integer number of CTUs. Each defined region can have a set of ALF filter coefficients. Each frame of chrominance U component and chrominance V component has one and only one set of ALF filter coefficients.
[0210] Typically, the specific formula for CTU category (i.e., region) is as follows, and the region for each CTU can be obtained through this calculation method:
[0211] First, calculate the number of pixels that each region can cover:
[0212] x_interval=((((img_width+lcu_width-1) / lcu_width)+4) / 8*lcu_width)
[0213] y_interval=((((img_height+lcu_height-1) / lcu_height)+4) / 8*lcu_height)
[0214] Where img_width represents the width of the image to be encoded; lcu_width represents the width of the CTU; img_height represents the height of the image to be encoded; lcu_height represents the height of the CTU; x_interval represents the number of pixels covered by each region in the horizontal direction; and y_interval represents the number of pixels covered by each region in the vertical direction.
[0215] Let the coordinates of the top left corner of the CTU be (g, i), where g is the x-coordinate of the first pixel of the top left corner of the current CTU relative to the first pixel of the top left corner of the image, and i is the y-coordinate of the first pixel of the top left corner of the current CTU relative to the first pixel of the top left corner of the image.
[0216] Therefore, it can be calculated that:
[0217] x_index=Clip_post(7,g / x_interval)
[0218] y_index=Clip_post(7,i / y_interval)
[0219] Here, x_index represents the horizontal index value, and y_index represents the vertical index value. The Clip_post(a,b) function is a clamping function; when b is less than a, the function outputs b, and when b is greater than or equal to a, the function outputs a.
[0220] Therefore, the final CTU region index is: ctu_cIdx = tb[tIdx][y_index][x_index]. Here, tb is the region category lookup table, and tIdx indicates which table it is.
[0221] For example, for the Y component, each CTU is first classified, and the classification rule is based on region division. As shown in Figure 2A, for a 1920x1080 image, if the CTU size is 128x128, then there will be [number] regions in the horizontal direction. There are CTUs, and vertically there will be... There are 15 * 9 = 135 CTUs in total. Each CTU is assigned a corresponding region based on its position in the image, which is obtained by looking up a table. As shown in Figure 2B, four lookup tables are preset for the Y component. For the first CTU, its position is (0,0), so according to the first lookup table, its region is 63. For the second CTU, its position is (0,1), so according to the lookup table, its region is also 63. For the third CTU, its position is (0,2), so according to the lookup table, its region is 62, and so on. This allows us to determine the region of each CTU and thus the filter used for each region.
[0222] For the chrominance U component and chrominance V component, regardless of the resolution of the image to be encoded, the entire image is treated as a single region, and only one filter is used.
[0223] The system architecture used in the embodiments of this application is described below.
[0224] Typically, in the video data encoding process, taking a single video frame (i.e., a video image frame) as an example, the video encoding device uses a Coding Unit (CU) (corresponding to a coding block) as the encoding unit. Following certain encoding rules, it encodes all the CUs included in a Coding Unit (CTU) (including prediction, transform, quantization, and entropy coding, etc.), thus completing the encoding of multiple CTUs within an image and obtaining the corresponding encoded information. Correspondingly, in the video data decoding process, the decoding device, following the decoding rules corresponding to the encoding process, reconstructs the multiple CUs within a CTU (including prediction, inverse quantization, inverse transform, etc.), thus completing the reconstruction of multiple CTUs within an image and obtaining the reconstructed image.
[0225] Both CTU and CU are nodes on the coding tree. CTU is the root node. After partitioning, CTU is divided into a certain number of nodes. Further, some or all of the nodes obtained from the initial partitioning of CTU can be further divided into smaller nodes, and so on, until all nodes no longer need partitioning. The nodes that no longer need partitioning are called leaf nodes, i.e., leaf nodes are the nodes at the end of the coding tree that do not need further partitioning. In VVC, one leaf node corresponds to one CU.
[0226] It should be noted that, in the process of encoding or decoding the CU, it is also possible to consider dividing the CU into multiple regions, and performing transformation or inverse transformation on each region respectively, so as to obtain the transformation result or inverse transformation result of the CU based on the transformation result or inverse transformation result of multiple regions.
[0227] In the field of video data encoding and decoding, methods for partitioning a single CU (Computer-Aided Array) into multiple regions include quadtree partitioning, binary tree partitioning, and ternary tree partitioning. When partitioning a CU, any one or more of these methods can be selected. For example, in one implementation, a cascaded quadtree and binary tree partitioning method can be used. First, a CU is partitioned using a quadtree to obtain four regions. If one or more of these four regions can be further subdivided, a binary tree partitioning method is used to divide the regions requiring further subdivision into smaller regions. The specific partitioning method can be determined according to actual usage requirements, and this application does not impose specific limitations.
[0228] Figure 3 illustrates the simplified process of video data encoding and decoding, using an image block (which can be a CU) from a video frame as an example. During encoding, this image block is referred to as the block to be encoded; during decoding, it is referred to as the block to be decoded. The encoding process for this block includes prediction, transform, quantization, and entropy coding. After obtaining the prediction block of the current encoding block, the video encoding device obtains a residual block (the difference between the original block and the prediction block) based on the prediction block. Then, the encoding device transforms the residual block according to transform pairs (including horizontal and vertical transform kernels), quantizes the transformed residual block, and finally completes entropy coding (i.e., encoding of syntax elements and other parameters) to form a bitstream, thus completing the encoding of the block to be encoded. In the aforementioned encoding process, the transform kernel can be various types of transform kernels based on Discrete Cosine Transform (DCT) (e.g., DCT-II, DCT-VIII), or various types of transform kernels based on Discrete Sine Transform (DST) (e.g., DST-VII). Furthermore, the video encoding process also includes encoding syntax elements (e.g., partitioning flags, partitioning patterns). These encoded syntax elements and the encoded image blocks constitute the encoded information (i.e., the bitstream). In other words, the encoded information of the video data includes both the encoded image data and the encoded syntax elements. The video decoding device's decoding process for the block to be decoded includes entropy decoding, prediction, inverse transform, and inverse quantization. The video decoding process can be understood as the inverse of the video encoding process. The video decoding device reconstructs the image block (i.e., the block to be decoded) based on the syntax elements extracted from the encoded information. That is, the video decoding device obtains the reconstructed image block based on the syntax elements associated with the image block and the encoded image block, thus completing the decoding of the block to be decoded.
[0229] Figure 4 shows a schematic diagram of the architecture of the encoding / decoding system 10 used in the embodiments of this application. As shown in Figure 4, the encoding / decoding system 10 may include a source device 11 and a destination device 12. The source device 11 is used to encode images; therefore, the source device 11 may be referred to as an image encoding apparatus (device) or a video encoding apparatus (device). The destination device 12 is used to decode the encoded image data generated by the source device 11; therefore, the destination device 12 may be referred to as an image decoding apparatus (device) or a video decoding apparatus (device).
[0230] The source device 11 and the destination device 12 can take various forms, and this application embodiment does not specifically limit them. For example, the source device 11 and the destination device 12 can be a desktop computer, a mobile computing device, a laptop (e.g., a laptop computer), a tablet computer, a set-top box, a handset such as a so-called "smartphone", a television, a camera, a display device, a digital media player, a video game console, a vehicle computer, or other similar devices.
[0231] Optionally, the source device 11 and the destination device 12 shown in Figure 4 can be two separate devices. Alternatively, the source device 11 and the destination device 12 can also be a single device, meaning that the source device 11 or its corresponding functions and the destination device 12 or its corresponding functions can be integrated into the same device.
[0232] Optionally, the source device 11 and the destination device 12 can communicate with each other. For example, the destination device 12 can receive encoded image data from the source device 11. In one example, the source device 11 and the destination device 12 may include one or more communication devices that can be used to transmit the encoded image data from the source device 11 to the destination device 12. The one or more communication devices may include routers, switches, base stations, or any other possible devices that facilitate communication from the source device 11 to the destination device 12, which can be determined according to actual usage requirements, and this application embodiment does not limit this.
[0233] As shown in Figure 4, the source device 11 may include an encoder 112. Optionally, the source device 11 may also include an image preprocessor 111 and a communication interface 113. The image preprocessor 111 can be used to perform preprocessing on the received image to be encoded. For example, the preprocessing performed by the image preprocessor 111 may include trimming, color format conversion (e.g., from RGB to YUV format), color correction, or noise reduction, or any other possible processing. The encoder 112 can be used to receive the image preprocessed by the image preprocessor 111, process the preprocessed image using a correlation prediction mode, and output encoded image data. In some embodiments, the encoder 112 can be used to perform the encoding process described in the various embodiments below. The communication interface 113 can be used to transmit the encoded image data output by the encoder 112 to the destination device 12 or any other device (such as a storage device) for storage or direct reconstruction. Other devices can be any devices used for decoding or storage. Of course, in actual implementation, the communication interface 113 can also encapsulate the encoded image data output by the encoder 112 into a suitable format before transmission.
[0234] Optionally, the image preprocessor 111, encoder 112, and communication interface 113 may be hardware components in the source device 11, software programs in the source device 11, or a combination of hardware components and software programs in the source device 11. The specific details can be determined according to actual usage requirements, and this application embodiment does not limit this.
[0235] The destination device 12 may include a decoder 122. Optionally, the destination device 12 may also include a communication interface 121 and an image post-processor 123. The communication interface 121 may be used to receive encoded image data from the source device 11 or any other source device, such as a storage device. The communication interface 121 may also decapsulate the data transmitted by the communication interface 113 to obtain encoded image data. The decoder 122 is used to receive the encoded image data and output decoded image data (also called reconstructed image data or reconstructed image data). In some embodiments, the decoder 122 may be used to perform the decoding process described in the various embodiments below. The image post-processor 123 may be used to perform post-processing on the decoded image data to obtain post-processed image data. The post-processing performed by the image post-processor 123 may include color format conversion (e.g., from YUV format to RGB format), color correction, retouching, or resampling, and any possible processing. The image post-processor 123 may also be used to transmit the post-processed image data to a display device for display.
[0236] Optionally, the aforementioned communication interface 121, decoder 122, and image post-processor 123 may be hardware components in the target device 12, software programs in the target device 12, or a combination of hardware components and software programs in the target device 12. The specific details can be determined according to actual usage requirements, and this application embodiment does not limit this.
[0237] To gain a clearer understanding of the encoder 112 and decoder 122 described above, the structure of the encoder 112 and decoder 122 will be briefly introduced below.
[0238] Figure 5A shows a possible structural schematic block diagram of the encoder 112 used in an embodiment of this application.
[0239] As shown in Figure 5A, the encoder 112 may include an intra-frame prediction unit 301, a residual calculation unit 302, a transform / quantization unit 303, an entropy coding unit 304, an inverse quantization / inverse transform unit 305, a reconstruction unit 306, a loop filtering unit 307, a decoded image buffer 308, and a motion estimation / compensation unit 309.
[0240] The intra-frame prediction unit 301 predicts the current block to generate a prediction block. The residual calculation unit 202 calculates the difference between the original image block and the prediction block generated by the intra-frame prediction unit to obtain a residual block. The transform / quantization unit 303 performs transform coding on the residual block and quantizes the transform coefficients, mapping continuous transform coefficients to a finite number of discrete values. The entropy coding unit 304 further encodes the quantized data, such as using entropy coding (e.g., Huffman coding, arithmetic coding, or CABAC) to reduce redundant information in the data. The encoded data (bitstream) is then sent to the decoder or storage medium. The inverse quantization / inverse transform unit 305 inversely quantizes the quantized data to recover the transform coefficients and performs an inverse transform on these transform coefficients to recover the residual block. The reconstruction unit 306 adds the prediction block generated by the intra-frame prediction unit to the residual block recovered by the inverse residual transform unit to reconstruct the original image block. The loop filtering unit 307 is used to filter the reconstructed image blocks to improve image quality and reduce visual artifacts such as block artifacts. The decoding image buffer 308 is used to buffer the filtered image blocks output by the loop filtering unit 307. The motion estimation / compensation unit 309 is used to acquire the filtered image blocks and use them as reference blocks for subsequent motion estimation or motion compensation.
[0241] In one example, the input to encoder 112 is an image block (i.e., a block or encoding unit) of the image to be encoded. In another example, the input to encoder 112 is the image to be encoded, and encoder 112 may include a segmentation unit (not shown in FIG. 5A) that can be used to segment the image to be encoded into multiple image blocks. For example, the segmentation unit can divide the image to be encoded into one or more square CTUs of the same size. The segmentation unit can divide the image to be encoded into tiles, and optionally, the segmentation unit can further divide a tile into one or more bricks, wherein a tile or brick may contain one or more complete and / or partial CTUs. In addition, the segmentation unit can form one or more slices, one of which may contain one or more tiles arranged in raster order in the image, or contain one or more tiles covering a rectangular area in the image. The segmentation unit can also form one or more sub-images, one of which contains one or more slices, tiles, or bricks. Encoder 112 can complete the encoding of the image to be encoded by encoding multiple image blocks one by one. For example, encoder 112 can perform the encoding process for each image block separately, thereby completing the encoding of the image to be encoded.
[0242] Regarding the encoder architecture shown in Figure 5A, the loop filtering unit 307 may include a bilateral filter, luminance mapping and chrominance scaling, deblocking filter, sample offset compensation, ALF, and cross-component adaptive loop filter (CCALF), etc.
[0243] In this embodiment, the loop filter unit 307 described above can be used to implement the encoding method described in the following embodiments. This embodiment uses ALF as an example for illustration.
[0244] The encoding method of this application embodiment will now be described in conjunction with the various units in encoder 112.
[0245] In one example, the encoding method of this application embodiment may include the following steps:
[0246] Step 11: The loop filtering unit 307 divides the image or CTU into multiple blocks.
[0247] It should be noted that, in the embodiments of this application, the blocks obtained by dividing the image can be CTUs, tiles, bricks, CUs, or other possible forms of coded blocks, etc., and the embodiments of this application are not limited thereto. Dividing a CTU means dividing the CTU into smaller granular blocks.
[0248] Step 12: Loop filter unit 307 determines the region index of the current block.
[0249] In this embodiment of the application, the current block is any one of the plurality of blocks.
[0250] In this embodiment of the application, the region index of the current block is determined based on the size of the current block.
[0251] It should be noted that the method for determining the region index of the current block can be found in the description in the following embodiments, and will not be repeated here.
[0252] Step 13: Loop filter unit 307 determines the first information and the set of filter coefficients.
[0253] In this embodiment, the first information refers to the number of regions corresponding to each filter coefficient group, i.e., the number of regions covered by each filter (such as ALF). The maximum number of filters is equal to the number of regions in the image or CTU.
[0254] In this embodiment of the application, the above-mentioned set of filter coefficients includes multiple filter coefficient groups, each filter coefficient group corresponds to a filter, and each filter coefficient group includes multiple filter coefficients (e.g., 15 filter coefficients).
[0255] Thus, using the aforementioned first information and the set of filter coefficients, the area covered by each filter and the set of filter coefficients available for use in these areas can be obtained.
[0256] Step 14: The loop filter unit 307 determines the region corresponding to the filter coefficient group in the filter coefficient set based on the first information.
[0257] Step 15: The loop filter unit 307 determines the first filter coefficient group from the filter coefficient set based on the region corresponding to the filter coefficient group and the region index of the current block.
[0258] In this embodiment of the application, since the area covered by each filter and the set of filter coefficients that can be used in these areas can be obtained through the first information and the set of filter coefficients, then by combining the area index of the current block, it is possible to find out which filter covers the area where the current block is located, and thus obtain the set of filter coefficients that can be used in the current block.
[0259] Step 16: Loop filtering unit 307 performs loop filtering on the reconstructed block of the current block based on the first set of filtering coefficients.
[0260] In this embodiment of the application, the reconstruction block may include at least one of the following: a reconstruction block for the luminance component, a reconstruction block for the chrominance U component, and a reconstruction block for the chrominance V component.
[0261] Step 17: Entropy coding unit 304 writes the first information into the bit stream.
[0262] Optionally, in this embodiment of the application, the entropy coding unit 304 may also write the above-mentioned set of filtering coefficients into the bit stream so that the decoding end can obtain the corresponding filtering coefficients for loop filtering.
[0263] Figure 5B shows a possible schematic block diagram of the decoder 122 used in an embodiment of this application. The decoder 122 can be used to receive, for example, image data encoded by the encoder 112 (i.e., an encoded bitstream, for example, an encoded bitstream including image blocks and associated syntax elements) to obtain decoded image blocks.
[0264] As shown in Figure 5B, the decoder 122 may include a bitstream parsing unit 401, an inverse quantization unit 402, a residual inverse transform unit 404, a prediction processing unit 404, a reconstruction unit 405, and a filter unit 406. In some instances, the decoder 122 may perform a decoding process that is substantially the inverse of the encoding process described in the encoder 112 above. Optionally, the decoder 122 may also include a buffer and a filtered image buffer. The buffer can be used to buffer the reconstructed image blocks output by the reconstruction unit 405, and the filtered image buffer can be used to buffer the filtered image blocks output by the filter unit 406.
[0265] The bitstream parsing unit 401 can be used to decode the encoded bitstream to obtain quantized residual coefficients (or quantized residual values) and / or decoding parameters (e.g., decoding parameters may include any one or more of inter-frame prediction parameters, intra-frame prediction parameters, filter parameters, and / or other syntax elements performed on the encoding side). The bitstream parsing unit 401 can also be used to forward the above-mentioned decoding parameters to the prediction processing unit 304, so that the prediction processing unit 304 can perform a prediction process based on the decoding parameters.
[0266] The function of the dequantization unit 402 is the same as that of the dequantization unit 206 of the encoder 112, used to dequantize (i.e., reverse quantization) the quantized residual coefficients output by the code stream parsing unit 401.
[0267] The function of the residual inverse transform unit 403 is the same as that of the residual inverse transform unit 207 of the encoder 112, which is used to perform an inverse transform on the above-mentioned inverse quantized residual coefficients (e.g., inverse DCT, inverse integer transform, or a conceptually similar inverse transform process) to obtain the reconstructed residual value. The block obtained after the inverse transform is the residual block of the reconstructed block to be decoded in the pixel domain.
[0268] The function of the reconstruction unit 405 (e.g., a summer) can be the same as that of the reconstruction unit 208 of the encoder 112.
[0269] The prediction processing unit 404 is used to receive or acquire encoded image data (e.g., the encoded bitstream of the current image block) and reconstructed image data. The prediction processing unit 404 can also receive or acquire relevant parameters of the prediction mode and / or information about the selected prediction mode (i.e., the decoding parameters mentioned above) from, for example, the bitstream parsing unit 302, and make a prediction of the current image block based on the relevant data and decoding parameters in the reconstructed image data to obtain the prediction block of the current image block.
[0270] The reconstruction unit 405 can be used to add the reconstructed residual block to the prediction block to obtain the reconstructed block of the image to be decoded in the sample domain, for example, by adding the residual value in the reconstructed residual block to the predicted value in the prediction block.
[0271] The filter unit 406 can be used to filter the reconstructed block to obtain a filtered block, which is the decoded image block.
[0272] It is understood that in the encoder 112 and decoder 122 provided in the embodiments of this application, the processing result of a certain stage may be further processed before being output to the next stage. For example, after the prediction, transformation or filtering stages, the processing result of the corresponding stage may be further processed by Clip or shift operations.
[0273] In one example, the decoding method of this application embodiment may include the following steps:
[0274] Step 21: The code stream parsing unit 401 parses the code stream to obtain the first information.
[0275] In this embodiment of the application, the first information is used to determine the region corresponding to the filter coefficient group in the filter coefficient set.
[0276] Step 22: Filter unit 406 divides the image or CTU into multiple blocks.
[0277] Step 23: Filter unit 406 determines the region index of the current block.
[0278] In this embodiment of the application, the region index of the current block is determined based on the size of the current block.
[0279] Step 24: The filter unit 406 performs loop filtering on the reconstructed block of the current block based on the first information, the set of filter coefficients and the region index of the current block.
[0280] The encoding / decoding framework and basic process have been described above with reference to the accompanying drawings. This framework or process is for illustrative purposes only and is not intended to limit the scope of this application. For example, as technology advances, some modules or steps of this framework or process may be optimized. In specific implementations, the technical solutions provided in the embodiments of this application can be flexibly applied according to actual needs.
[0281] The encoding and decoding methods provided in the embodiments of this application will be described exemplarily below with reference to the accompanying drawings.
[0282] It should be noted that the encoding end in any embodiment of this application can be the encoder 112 in FIG5A above, or the source device 11 in FIG4 above. The decoding end in any embodiment of this application can be the decoder 122 in FIG5B above, or the destination device 12 in FIG4 above; the embodiments of this application do not limit this.
[0283] Figure 6 shows a flowchart of an encoding method provided in an embodiment of this application. The encoding method may include the following steps 31 and 32.
[0284] Step 31: The encoder performs loop filtering on the reconstructed block of the current block based on the first information, the set of filtering coefficients, and the region index of the current block.
[0285] In this embodiment, the encoding end can divide the image or CTU into multiple blocks. The blocks obtained by dividing the image can be CTUs, tiles, bricks, CUs, or other possible forms of encoded blocks, etc., and this embodiment does not impose any limitations. Dividing the CTU refers to dividing the CTU internally into smaller granular blocks.
[0286] In this embodiment of the application, the current block is any one of the plurality of blocks.
[0287] Optionally, in the embodiments of this application, the current block can be a block in the CTU; or, the current block can be a block in the image.
[0288] Optionally, in the embodiments of this application, the current block is a block in the CTU, and the reconstructed block may include at least one of the following: a reconstructed block of the luminance component, a reconstructed block of the first chrominance component, and a reconstructed block of the second chrominance component.
[0289] In this embodiment of the application, the first chromaticity component can be the chromaticity U component (Cb component), and the second chromaticity component can be the chromaticity V component (Cr component).
[0290] It is understandable that for filtering the luminance component (Y component), the CTU can be divided into smaller granular blocks, so that the granularity of the filter changes from CTU level to block level filtering. That is, the region of the block in the CTU determines the filter used, and each region uses a separate filter. In other words, the same region uses the same filter, that is, the same set of filter coefficients.
[0291] For filtering of the chroma U component or chroma V component, the CTU can be divided into smaller granular blocks, so that the granularity of the filter changes from image level to block level filtering. That is, the region of the block in the CTU determines the filter used, and each region uses a separate filter, i.e., a set of filter coefficients.
[0292] For example, a CTU can be divided into M x N blocks. Here, M is the number of blocks in the horizontal direction, and N is the number of blocks in the vertical direction. Let M = N = 8, as shown in Figure 7, a CTU is divided into 64 blocks. In Figure 7, 0 to 63 are the block indices of these 64 blocks. The internal partitioning of the CTU can be designed as follows:
[0293] (1) For the Y component, the size of each block is 16x16;
[0294] (2) For the chromaticity U component and the chromaticity V component, the size of each block is 8x8.
[0295] Optionally, in this embodiment of the application, the current block is a block in an image, and the reconstructed block may include at least one of the following: a reconstructed block of the first chromaticity component and a reconstructed block of the second chromaticity component.
[0296] It is understandable that for filtering the chromaticity U component or chromaticity V component, the image can be divided into multiple blocks, so that the granularity of the filter changes from image-level to block-level filtering. That is, the region of the block in the image determines the filter used, and each region uses a separate filter, i.e., a set of filter coefficients.
[0297] For example, for the chromaticity U component and chromaticity V component, an image can be divided into multiple CTUs. For example, for a 1920x1080 image, the size of the CTU is 128x128, so there will be 15 CTUs in the horizontal direction and 9 CTUs in the vertical direction, for a total of 15*9=135 CTUs.
[0298] Optionally, in this embodiment of the application, the size of the current block is less than or equal to the size of the CTU.
[0299] It can be understood that if the size of the current block is smaller than the size of the CTU, it can be interpreted as dividing the CTU into smaller, more granular blocks, such as M×N blocks, where M and N are both integers greater than 1. If the size of the current block is equal to the size of the CTU, it can be interpreted as dividing the image into multiple CTUs.
[0300] Optionally, in this embodiment of the application, for the Y component, the size of the current block is smaller than the size of the CTU.
[0301] Optionally, in this embodiment of the application, for the chromaticity U component and the chromaticity V component, the size of the current block is smaller than the size of the CTU, or the size of the current block is equal to the size of the CTU.
[0302] Optionally, in this embodiment of the application, the size of the current block being less than or equal to the size of the CTU includes at least one of the following:
[0303] The width of the current block is less than or equal to the width of the CTU;
[0304] The height of the current block is less than or equal to the height of the CTU.
[0305] For example, the size of the CTU is 128×128. For the Y component, the size of the current block is 16×16. For the chromaticity U component and the chromaticity V component, the size of the current block is 8×8.
[0306] In this embodiment of the application, the first information is used to determine the region corresponding to the filter coefficient group in the filter coefficient set.
[0307] In this embodiment of the application, the above-mentioned set of filter coefficients may include multiple filter coefficient groups (also referred to as multiple sets of filter coefficients). Each filter coefficient group is a filter coefficient of a filter (such as an ALF). Each filter coefficient group may include multiple filter coefficients, such as 15 filter coefficients. The specific number is determined by the shape of the filter, and this embodiment of the application does not impose any restrictions.
[0308] It should be noted that after obtaining the region of the block, the covariance matrix and error vector of all pixels in the same region can be accumulated to obtain the filtering coefficients, and then the pixels to be filtered can be filtered. The method for solving the filtering coefficients can be found in the description of the above embodiments, and will not be repeated here. The method for determining the region (region index) of the block can be found in the description of the following embodiments, and will not be repeated here.
[0309] In this embodiment of the application, the first information mentioned above is the number of regions covered by the filter, which can be represented by the syntax element alf_cb_region_distance. That is, the alf_cb_region_distance value under the filter is the number of regions covered by the filter. For example, for the chroma U component, it is the number of regions covered by each filter; or for the chroma V component, it is the number of regions covered by each filter; or for the Y component, it is the number of regions covered by each filter.
[0310] For example, an image can have a maximum of 16 regions, each with one filter. However, some regions have similar features, and after rate distortion (RD) calculation, they can be filtered using a single set of filters. If one filter is used for regions 3, 4, 5, and 6, then the value of `alf_cb_region_distance` is 4. Once the decoder obtains the value of `alf_cb_region_distance` (4) and the starting region 3, it can determine that regions 3, 4, 5, and 6 use the same filter, i.e., the same set of filter coefficients.
[0311] In this embodiment of the application, the region index of the current block is determined based on the size of the current block.
[0312] Optionally, in this embodiment, the region index of the current block is determined based on a first index, or based on the first index and a region lookup table. The first index is determined based on the position coordinates and size of the current block.
[0313] Optionally, in this embodiment, the size of the current block is smaller than the size of the CTU: the region index of the current block is determined based on the first index, or the region index of the current block is determined based on the first index and the region lookup table.
[0314] It should be noted that the CTU described in this application embodiment can be a CTU obtained by dividing the space into arbitrary sizes. For example, the size of the CTU can be 128×128, or the size of the CTU can be 64×64. This application embodiment is described from the perspective of the current block. For the current block, the CTU can be understood as the CTU in which the current block is located, and this CTU can be a CTU of any size. For example, the size of the current block being less than or equal to the size of the CTU can be understood as: the size of the current block being less than or equal to the size of the CTU in which the current block is located.
[0315] Optionally, in this embodiment, the size of the current block is equal to the size of the CTU: the region index of the current block is determined based on the first index and the region lookup table.
[0316] It should be noted that the position coordinates of the current block mentioned above include the horizontal and vertical coordinates of the current block, which can be represented as (g, i).
[0317] Optionally, in this embodiment of the application, the horizontal coordinate of the current block's position is the horizontal coordinate of the upper left corner of the current block relative to the first position, and the vertical coordinate of the current block's position is the vertical coordinate of the upper left corner of the current block relative to the first position.
[0318] The first position is either the top left corner of the CTU or the top left corner of the image.
[0319] It should be noted that the image described in this application embodiment can be an image of any size, for example, the image size can be 1920x1080. This application embodiment is described from the perspective of the current block. For the current block, the image can be understood as the image in which the current block is located, and this image can be an image of any size. For example, the first position being the upper left corner of the image can be understood as: the first position being the upper left corner of the image in which the current block is located.
[0320] It can be understood that the above current block is a block in CTU: the horizontal coordinate g of the above current block is the horizontal coordinate of the upper left corner of the current block relative to the upper left corner of CTU; the vertical coordinate i of the above current block is the vertical coordinate of the upper left corner of the current block relative to the upper left corner of CTU.
[0321] The above-mentioned current block refers to a block in the image: the horizontal coordinate g of the position of the above-mentioned current block is the horizontal coordinate of the upper left corner position of the current block (such as the current CTU) relative to the upper left corner position of the image; the vertical coordinate i of the position of the above-mentioned current block is the vertical coordinate of the upper left corner position of the current block relative to the upper left corner position of the image.
[0322] Optionally, in this embodiment of the application, the aforementioned upper left corner position can be the first pixel of the upper left corner.
[0323] For example, consider a block in a CTU (i.e., the CTU where the current block resides):
[0324] (1) For the Y component, the size of each block is 16x16. The position coordinates (g,i) of the first block in the CTU are (0,0); the position coordinates (g,i) of the second block in the horizontal direction in the CTU are (16,0); the position coordinates (g,i) of the third block in the horizontal direction in the CTU are (32,0), and so on. The position coordinates (g,i) of the eighth block in the horizontal direction in the CTU are (112,0); the position coordinates (g,i) of the second block in the vertical direction in the CTU are (0,16).
[0325] (2) For the chromaticity U component and the chromaticity V component, the size of each block is 8x8. The position coordinates (g,i) of the first block in the CTU are (0,0); the position coordinates (g,i) of the second block in the horizontal direction in the CTU are (8,0); the position coordinates (g,i) of the third block in the horizontal direction in the CTU are (16,0), and so on. The position coordinates (g,i) of the eighth block in the horizontal direction in the CTU are (56,0); the position coordinates (g,i) of the second block in the vertical direction in the CTU are (0,8).
[0326] For example, consider a 1920x1080 image. Taking the current block as an example (CTU) within the image (i.e., the image containing the current block):
[0327] (1) For the Y component, the image is divided into 135 CTUs, of which there are 15 CTUs in the horizontal direction and 9 CTUs in the vertical direction. The size of each CTU is 128x128. The position coordinates (g,i) of the first CTU in the image are (0,0); the position coordinates (g,i) of the second CTU in the horizontal direction are (128,0); the position coordinates (g,i) of the third CTU in the horizontal direction are (256,0), and so on. The position coordinates (g,i) of the fifteenth CTU in the horizontal direction are (1792,0); the position coordinates (g,i) of the second CTU in the vertical direction are (0,128).
[0328] (2) For the chromaticity U component and chromaticity V component, the size of the CTU is 64x64. Therefore, there will be 30 CTUs in the horizontal direction and 17 CTUs in the vertical direction, for a total of 30*17=510 CTUs. The position coordinates (g,i) of the first CTU in the image are (0,0); the position coordinates (g,i) of the second CTU in the horizontal direction are (64,0); the position coordinates (g,i) of the third CTU in the horizontal direction are (128,0), and so on. The position coordinates (g,i) of the thirtieth CTU in the horizontal direction are (1856,0); and the position coordinates (g,i) of the second CTU in the vertical direction are (0,64).
[0329] Optionally, in this embodiment of the application, the first index includes a second index and a third index. The second index is determined based on the horizontal coordinate of the current block and the width of the current block, and the third index is determined based on the vertical coordinate of the current block and the height of the current block.
[0330] It should be noted that the second index mentioned above is a horizontal index value, which can be represented as x_index. The third index mentioned above is a vertical index value, which can be represented as y_index.
[0331] Optionally, in this embodiment of the application, the second index is determined based on a first ratio of the horizontal coordinate of the current block's position to the width of the current block.
[0332] Optionally, in this embodiment of the application, the second index is the minimum value between the first ratio and the first value, which is related to the maximum number of regions of the CTU or image in the horizontal direction.
[0333] Optionally, in this embodiment, x_index = Clip_post(a, g / blkSizeX), where blkSizeX represents the width of the block. The Clip_post(a, b) function is a clamping function; when b is less than a, the function outputs b, and when b is greater than or equal to a, the function outputs a.
[0334] Where a is the first value mentioned above, and g / blkSizeX is the first ratio mentioned above.
[0335] Optionally, in this embodiment of the application, the first value is the maximum number of regions of CTU or image in the horizontal direction minus 1.
[0336] For example, for the YUV component, the maximum number of regions in the horizontal direction of CTU is 8, so the first value mentioned above is 7, x_index = Clip_post(7, g / blkSizeX).
[0337] For example, for YUV components, the maximum number of regions in the horizontal direction of the image is 8, so the first value mentioned above is 7, x_index = Clip_post(7, g / blkSizeX).
[0338] It should be noted that, for the chromaticity U component and chromaticity V component, the maximum number of regions in the horizontal direction of the image can also be other values, such as an integer greater than 1 and less than 8, like 4. The specific value can be determined according to the actual situation, and this application embodiment does not impose any limitations.
[0339] Optionally, in this embodiment of the application, the third index is determined based on a second ratio of the vertical coordinate of the current block's position to the height of the current block.
[0340] Optionally, in this embodiment of the application, the third index is the minimum value between the second ratio and the second value, which is related to the maximum number of regions of the CTU or image in the vertical direction.
[0341] Optionally, in this embodiment, y_index = Clip_post(a,i / blkSizeY), where blkSizeY represents the height of the block. The Clip_post(a,b) function is a clamping function; when b is less than a, the function outputs b, and when b is greater than or equal to a, the function outputs a.
[0342] Where a is the second value mentioned above, and i / blkSizeY is the second ratio mentioned above.
[0343] Optionally, in this embodiment of the application, the second value is the maximum number of regions of CTU or image in the vertical direction minus 1.
[0344] For example, for the YUV component, the maximum number of regions in the vertical direction of CTU is 8, so the second value mentioned above is 7, y_index = Clip_post(7,i / blkSizeY).
[0345] For example, for the YUV components, the maximum number of regions in the vertical direction of the image is 8, so the second value mentioned above is 7, y_index = Clip_post(7,i / blkSizeY).
[0346] Optionally, in this embodiment, the region index of the current block is determined based on a first index. The region index of the current block is the sum of a second index and a third value, where the third value is the product of the third index and a fourth value, where the fourth value represents the number of blocks contained in the horizontal direction.
[0347] Optionally, in this embodiment of the application, the fourth value can be the number of blocks contained in the CTU in the horizontal direction.
[0348] Optionally, in this embodiment of the application, the fourth value can be the number of blocks contained in the image in the horizontal direction.
[0349] It should be noted that the region index of the block in this embodiment can be represented as blk_cIdx.
[0350] Optionally, in this embodiment of the application, the region index of the current block is blk_cIdx = y_index * c + x_index, where c is the fourth value mentioned above.
[0351] For example, if the number of blocks contained in the CTU in the horizontal direction is 8, then the fourth value mentioned above is 8, and blk_cIdx = y_index * 8 + x_index.
[0352] For example, for the Y component, if the number of blocks (CTUs) contained in the image in the horizontal direction is 15, then the fourth value mentioned above is 15, blk_cIdx = y_index * 15 + x_index.
[0353] For example, for the chromaticity U component and chromaticity V component, if the number of blocks (CTUs) contained in the image in the horizontal direction is 30, then the fourth value mentioned above is 30, blk_cIdx = y_index * 30 + x_index.
[0354] The following example illustrates the method for determining the region index of a block based on the first index.
[0355] Example 1, taking a block in CTU as an example:
[0356] (1) For the Y component (each block is 16x16), x_index = Clip_post(7, g / blkSizeX), y_index = Clip_post(7, i / blkSizeY), blk_cIdx = y_index * 8 + x_index:
[0357] The position coordinates (g,i) of the first block in CTU are (0,0). Therefore, the x_index of the first block is Clip_post(7,0 / 16) = 0, the y_index of the first block is Clip_post(7,0 / 16) = 0, and the region index blk_cIdx of the first block is y_index*8+x_index = 0.
[0358] The position coordinates (g,i) of the second block in the horizontal direction in CTU are (16,0). Therefore, the x_index of the second block is Clip_post(7,16 / 16)=1, and the y_index of the second block is Clip_post(7,0 / 16)=0. Thus, the region index blk_cIdx of the second block in the horizontal direction in CTU is y_index*8+x_index=1.
[0359] The position coordinates (g,i) of the third block in the horizontal direction in CTU are (32,0). Therefore, the x_index of the third block is Clip_post(7,32 / 16)=2, and the y_index of the third block is Clip_post(7,0 / 16)=0. Thus, the region index blk_cIdx of the third block in the horizontal direction in CTU is y_index*8+x_index=2.
[0360] Similarly, the position coordinates (g,i) of the eighth block in the horizontal direction in CTU are (112,0). Therefore, the x_index of the eighth block is Clip_post(7,112 / 16) = 7, and the y_index of the eighth block is Clip_post(7,0 / 16) = 0. Thus, the region index blk_cIdx of the eighth block in the horizontal direction in CTU is y_index*8+x_index = 7.
[0361] The position coordinates (g,i) of the second block in the vertical direction in CTU are (0,16). Therefore, the x_index of the second block is Clip_post(7,0 / 16)=0, and the y_index of the second block is Clip_post(7,16 / 16)=1. Thus, the region index blk_cIdx of the second block in the vertical direction in CTU is y_index*8+x_index=8.
[0362] Similarly, the position coordinates (g,i) of the eighth block in the vertical direction in CTU are (0,112). Therefore, the x_index of the eighth block is Clip_post(7,0 / 16)=0, and the y_index of the eighth block is Clip_post(7,112 / 16)=7. Thus, the region index blk_cIdx of the eighth block in the vertical direction in CTU is y_index*8+x_index=56.
[0363] Thus, for the Y component, the region indices of the 64 blocks obtained by CTU partitioning can be determined to be from 0 to 63 using the above calculation method.
[0364] (2) For the chromaticity U component and chromaticity V component (each block is 8x8), x_index = Clip_post(7, g / blkSizeX), y_index = Clip_post(7, i / blkSizeY), blk_cIdx = y_index * 8 + x_index:
[0365] The position coordinates (g,i) of the first block in CTU are (0,0). Therefore, the x_index of the first block is Clip_post(7,0 / 8) = 0, the y_index of the first block is Clip_post(7,0 / 8) = 0, and the region index of the first block is blk_cIdx = y_index*8+x_index = 0.
[0366] The position coordinates (g,i) of the second block in the horizontal direction in CTU are (8,0). Therefore, the x_index of the second block is Clip_post(7,8 / 8)=1, and the y_index of the second block is Clip_post(7,0 / 8)=0. Thus, the region index blk_cIdx of the second block in the horizontal direction in CTU is y_index*8+x_index=1.
[0367] The position coordinates (g,i) of the third block in the horizontal direction in CTU are (16,0). Therefore, the x_index of the third block is Clip_post(7,16 / 8)=2, and the y_index of the third block is Clip_post(7,0 / 8)=0. Thus, the region index blk_cIdx of the third block in the horizontal direction in CTU is y_index*8+x_index=2.
[0368] Similarly, the position coordinates (g,i) of the eighth block in the horizontal direction in CTU are (56,0). Therefore, the x_index of the eighth block is Clip_post(7,56 / 8) = 7, and the y_index of the eighth block is Clip_post(7,0 / 8) = 0. Thus, the region index blk_cIdx of the eighth block in the horizontal direction in CTU is y_index*8+x_index = 7.
[0369] The position coordinates (g,i) of the second block in the vertical direction in CTU are (0,8). Then, the x_index of the second block is Clip_post(7,0 / 8)=0, and the y_index of the second block is Clip_post(7,8 / 8)=1. Therefore, the region index blk_cIdx of the second block in the vertical direction in CTU is y_index*8+x_index=8.
[0370] Similarly, the position coordinates (g,i) of the eighth block in the vertical direction in CTU are (0,56). Therefore, the x_index of the eighth block is Clip_post(7,0 / 8)=0, and the y_index of the eighth block is Clip_post(7,56 / 8)=7. Thus, the region index blk_cIdx of the eighth block in the vertical direction in CTU is y_index*8+x_index=56.
[0371] Thus, for the chromaticity U component and chromaticity V component, the region index of the 64 blocks obtained by CTU division can be determined to be from 0 to 63 using the above calculation method.
[0372] Combining Example 1 and Figure 7, it can be seen that for the blocks obtained by CTU partitioning, the region index of the block obtained by calculating the region index is the same as the block index of the block, that is, the block index of the block after CTU partitioning is the same as the region index of the block.
[0373] Optionally, in this embodiment, the region index of the current block is determined based on the first index and the region lookup table. The region index of the current block is a value determined from the region lookup table based on the second index and the third index.
[0374] Optionally, in this embodiment of the application, the region index of the current block can be the value corresponding to the second position in the region lookup table, where the second position is the position with the second index on the horizontal axis and the third index on the vertical axis.
[0375] Optionally, in this embodiment, the second position can also be a position where the horizontal coordinate is the third index and the vertical coordinate is the second index. Of course, it can also be determined in other ways, such as through syntax element indication, etc. The specific method can be determined according to actual usage requirements, and this embodiment does not impose any limitations.
[0376] Optionally, in this embodiment of the application, the region index of the current block is blk_cIdx=tb_ctu[tIdx][y_index][x_index], which means that after selecting the region lookup table, y_index and x_index are mapped to the region lookup table to obtain the region index of the current block. That is, the value corresponding to the position in the region lookup table with x_index as the horizontal coordinate and y_index as the vertical coordinate is the region index of the current block.
[0377] Where tb_ctu represents the region lookup table, and [tIdx] is the index of the region lookup table.
[0378] Optionally, in this embodiment, the aforementioned region lookup table (i.e., the index of the region lookup table) is determined based on the location coordinates of the CTU. The location coordinates of the CTU are the coordinates of the CTU relative to the upper left corner of the image.
[0379] Optionally, in this embodiment, the index of the aforementioned region lookup table is the sum of a fifth value and a sixth value. The fifth value is the modulus of the CTU's horizontal coordinate and a seventh value. The sixth value is the product of an eighth value and a seventh value. The eighth value is the modulus of the CTU's vertical coordinate and a seventh value. The seventh value is related to the number of preset region lookup tables.
[0380] For example, if the preset number of region lookup tables is 4, then the seventh value mentioned above can be 2, and the index of the region lookup table [tIdx] = (y%2)*2 + (x%2); if the preset number of region lookup tables is 6, then the seventh value mentioned above can be 3, and the index of the region lookup table [tIdx] = (y%3)*3 + (x%3). Here, x represents the x-coordinate of the CTU's position, y represents the y-coordinate of the CTU's position, and % represents the modulo operation.
[0381] Specifically, the CTU's position coordinates are (x, y), where x is the horizontal index of the CTU relative to the first CTU at the top left corner of the image, and y is the vertical index of the CTU relative to the first CTU at the top left corner of the image. For example, the first CTU's position coordinates are (0, 0), the horizontal position coordinates of the second CTU are (1, 0), and the vertical position coordinates of the second CTU are (0, 1).
[0382] The following example illustrates the method for determining the region index of a block based on the first index and the region lookup table. Taking a preset number of region lookup tables of 4 as an example, as shown in Figure 8, four preset region lookup tables (tb_ctu) are displayed. The indices of these four region lookup tables are 0 to 3 respectively. In Figure 8, (a) to (d) represent the region lookup tables with indices 0 to 3 respectively, and are referred to as region lookup table a to region lookup table d respectively.
[0383] Example 2, taking the current block as a block within the CTU as an example, assuming the CTU's location coordinates (x, y) = (1, 0), then the index [tIdx] of the above area lookup table = (y%2)*2 + (x%2) = 1:
[0384] (1) As can be seen from Example 1 in the above embodiments, for the Y component:
[0385] The first block in CTU has x_index = Clip_post(7,0 / 16) = 0 and y_index = Clip_post(7,0 / 16) = 0. Therefore, the region index of the first block in CTU is blk_cIdx = tb_ctu[tIdx][y_index][x_index]. That is, in the region lookup table with index 1 (i.e., region lookup table b), the value corresponding to the position with x-coordinate 0 and y-coordinate 0 (i.e., the second position) (i.e., 7) is the region index of the first block in CTU = 7.
[0386] In the CTU, the x_index = Clip_post(7,16 / 16) = 1 and the y_index = Clip_post(7,0 / 16) = 0 corresponding to the second block in the horizontal direction, then the region index of the second block in the horizontal direction in the CTU is blk_cIdx = tb_ctu[tIdx][y_index][x_index]. That is, in the region lookup table with index 1, the value corresponding to the position with x-coordinate 1 and y-coordinate 0 (i.e., 6) is the region index of the second block in the horizontal direction in the CTU = 6.
[0387] In the CTU, the x_index = Clip_post(7,32 / 16) = 2 and the y_index = Clip_post(7,0 / 16) = 0 corresponding to the third block in the horizontal direction, then the region index of the third block in the horizontal direction in the CTU is blk_cIdx = tb_ctu[tIdx][y_index][x_index]. That is, in the region lookup table with index 1, the value corresponding to the position with x-coordinate 2 and y-coordinate 0 (i.e., 5) is the region index of the third block in the horizontal direction in the CTU = 5.
[0388] Similarly, the x_index = Clip_post(7, 112 / 16) = 7 and the y_index = Clip_post(7, 0 / 16) = 0 corresponding to the eighth block in the horizontal direction in the CTU, then the region index of the eighth block in the horizontal direction in the CTU is blk_cIdx = tb_ctu[tIdx][y_index][x_index]. That is, in the region lookup table with index 1, the value corresponding to the position with x-coordinate 7 and y-coordinate 0 (i.e., 0) is the region index of the eighth block in the horizontal direction in the CTU = 0.
[0389] In the CTU, the x_index = Clip_post(7,0 / 16) = 0 and the y_index = Clip_post(7,16 / 16) = 1 corresponding to the second block in the vertical direction, then the region index of the second block in the vertical direction in the CTU is blk_cIdx = tb_ctu[tIdx][y_index][x_index]. That is, in the region lookup table with index 1, the value corresponding to the position with x-coordinate 0 and y-coordinate 1 (i.e., 15) is the region index of the second block in the vertical direction in the CTU = 15.
[0390] Similarly, the x_index = Clip_post(7,0 / 16) = 0 and the y_index = Clip_post(7,112 / 16) = 7 corresponding to the eighth block in the vertical direction in CTU, then the region index of the eighth block in the vertical direction in CTU is blk_cIdx = tb_ctu[tIdx][y_index][x_index]. That is, in the region lookup table with index 1, the value corresponding to the position with x-coordinate 0 and y-coordinate 7 (i.e., 63) is the region index of the eighth block in the vertical direction in CTU = 63.
[0391] (2) For the chromaticity U component and chromaticity V component, the method for determining the region index is similar to that for the Y component, and will not be repeated here.
[0392] Example 3, taking the current block as a block (CTU) in the image as an example:
[0393] (1) For the Y component (each CTU is 128x128 in size), x_index = Clip_post(7, g / blkSizeX), y_index = Clip_post(7, i / blkSizeY), blk_cIdx = tb_ctu[tIdx][y_index][x_index]:
[0394] The position coordinates (g,i) of the first CTU in the image are (0,0), and the position coordinates (x,y) of the first CTU are (0,0). Then, the index [tIdx] of the above region lookup table is (y%2)*2+(x%2)=0. The x_index corresponding to the first CTU is Clip_post(7,0 / 128)=0, and the y_index corresponding to the first CTU is Clip_post(7,0 / 128)=0. Thus, the region index blk_cIdx of the first CTU in the image is tb_ctu[tIdx][y_index][x_index]. That is, in the region lookup table with index 0 (i.e., region lookup table a), the value corresponding to the position with x-coordinate 0 and y-coordinate 0 (i.e., 0) is the region index of the first CTU in the image = 0.
[0395] The position coordinates (g,i) of the second CTU in the horizontal direction in the image are (128,0), and the position coordinates (x,y) of the second CTU are (1,0). Then, the index [tIdx] of the above region lookup table is (y%2)*2+(x%2)=1. The x_index corresponding to the second CTU in the horizontal direction is Clip_post(7,128 / 128)=1, and the y_index corresponding to the second CTU in the horizontal direction is Clip_post(7,0 / 128)=0. Thus, the region index blk_cIdx of the second CTU in the horizontal direction in the image is tb_ctu[tIdx][y_index][x_index]. That is, in the region lookup table with index 1 (i.e., region lookup table b), the value corresponding to the position with the horizontal coordinate 1 and the vertical coordinate 0 (i.e., 6) is the region index of the second CTU in the horizontal direction in the image = 6.
[0396] The position coordinates (g,i) of the third CTU in the horizontal direction in the image are (256,0), and the position coordinates (x,y) of this third CTU are (2,0). Then, the index [tIdx] of the above region lookup table is (y%2)*2+(x%2)=0. The x_index corresponding to the third CTU in the horizontal direction is Clip_post(7,256 / 128)=2, and the y_index corresponding to the third CTU in the horizontal direction is Clip_post(7,0 / 128)=0. Thus, the region index blk_cIdx of the third CTU in the horizontal direction in the image is tb_ctu[tIdx][y_index][x_index]. That is, in the region lookup table with index 0 (i.e., region lookup table a), the value corresponding to the position with the horizontal coordinate 2 and the vertical coordinate 0 (i.e., 2) is the region index of the third CTU in the horizontal direction in the image = 2.
[0397] Similarly, the position coordinates (g,i) of the fourteenth CTU in the horizontal direction in the image are (1664,0), and the position coordinates (x,y) of the fourteenth CTU are (13,0). Then, the index [tIdx] of the above region lookup table is (y%2)*2+(x%2)=1. The x_index corresponding to the fourteenth CTU in the horizontal direction is Clip_post(7,1664 / 128)=7, and the y_index corresponding to the fourteenth CTU in the horizontal direction is Clip_post(7,0 / 128)=0. Thus, the region index blk_cIdx of the fourteenth CTU in the horizontal direction in the image is tb_ctu[tIdx][y_index][x_index]. That is, in the region lookup table with index 1 (i.e., region lookup table b), the value corresponding to the position with the horizontal coordinate of 7 and the vertical coordinate of 0 (i.e., 0) is the region index of the fourteenth CTU in the horizontal direction in the image = 0.
[0398] The position coordinates (g,i) of the fifteenth CTU in the horizontal direction in the image are (1792,0), and the position coordinates (x,y) of the fifteenth CTU are (14,0). Then, the index [tIdx] of the above region lookup table is (y%2)*2+(x%2)=0. The x_index corresponding to the fifteenth CTU in the horizontal direction is Clip_post(7,1792 / 128)=7, and the y_index corresponding to the fifteenth CTU in the horizontal direction is Clip_post(7,0 / 128)=0. Thus, the region index blk_cIdx of the fifteenth CTU in the horizontal direction in the image is tb_ctu[tIdx][y_index][x_index]. That is, in the region lookup table with index 0 (i.e., region lookup table a), the value corresponding to the position with the horizontal coordinate 7 and the vertical coordinate 0 (i.e., 7) is the region index of the fifteenth CTU in the horizontal direction in the image = 7.
[0399] The position coordinates (g,i) of the second CTU in the vertical direction in the image are (0,128), and the position coordinates (x,y) of the second CTU are (0,1). Then, the index [tIdx] of the above region lookup table is (y%2)*2+(x%2)=2. The x_index corresponding to the second CTU in the vertical direction is Clip_post(7,0 / 128)=0, and the y_index corresponding to the second CTU in the vertical direction is Clip_post(7,128 / 128)=1. Thus, the region index blk_cIdx of the second CTU in the vertical direction in the image is tb_ctu[tIdx][y_index][x_index]. That is, in the region lookup table with index 2 (i.e., region lookup table c), the value corresponding to the position with the horizontal coordinate of 0 and the vertical coordinate of 1 (i.e., 48) is the region index of the second CTU in the vertical direction in the image = 48.
[0400] Similarly, the position coordinates (g,i) of the eighth CTU in the vertical direction of the image are (0,896), and the position coordinates (x,y) of this eighth CTU are (0,7). Then, the index [tIdx] of the above region lookup table is (y%2)*2+(x%2)=2. The x_index corresponding to the eighth CTU in the vertical direction is Clip_post(7,0 / 128)=0, and the y_index corresponding to this eighth CTU is Clip_post(7,896 / 128)=7. Thus, the region index blk_cIdx of the eighth CTU in the vertical direction of the image is tb_ctu[tIdx][y_index][x_index]. That is, in the region lookup table with index 2 (i.e., region lookup table c), the value corresponding to the position with the horizontal coordinate of 0 and the vertical coordinate of 7 (i.e., 0) is the region index of the eighth CTU in the vertical direction of the image = 0.
[0401] The position coordinates (g,i) of the ninth CTU in the vertical direction in the image are (0,1024), and the position coordinates (x,y) of this ninth CTU are (0,8). Then, the index [tIdx] of the above region lookup table is (y%2)*2+(x%2)=0. The x_index corresponding to the ninth CTU in the vertical direction is Clip_post(7,0 / 128)=0, and the y_index corresponding to the ninth CTU in the vertical direction is Clip_post(7,1024 / 128)=7. Thus, the region index blk_cIdx of the ninth CTU in the vertical direction in the image is tb_ctu[tIdx][y_index][x_index]. That is, in the region lookup table with index 0 (i.e., region lookup table a), the value corresponding to the position with the horizontal coordinate of 0 and the vertical coordinate of 7 (i.e., 56) is the region index of the ninth CTU in the vertical direction in the image = 56.
[0402] (2) For the chromaticity U component and chromaticity V component, the method for determining the region index is similar to that for the Y component, and will not be repeated here.
[0403] Thus, for YUV components, the region index of the block obtained by the image or CTU division can be determined by the above method. Blocks with the same region index can use the same filter, that is, each region uses a separate filter, thereby determining the set of filter coefficients used for the reconstruction block of the current block.
[0404] Typically, each channel of the luma component (hereinafter referred to as Y component), chroma U component, and chroma V component has its own independent ALF. For the Y component, there is usually one ALF for each CTU; while for the chroma U and chroma V components, there is one ALF for each frame of the image. However, the granularity of ALF is relatively large for both the Y component and the chroma U and V components, i.e., at the CTU level or image level. Therefore, directly using this large-granularity filter will reduce the filtering effect and is not conducive to improving the filter performance.
[0405] In this embodiment, for YUV components, that is, whether it is the Y component, the chromaticity U component, or the chromaticity V component, the pixel blocks inside the CTU can be divided into several classes according to their physical location. This allows the granularity of the ALF to evolve from the CTU level or image level to the block level filtering, so that the filter can be classified according to information of smaller granularity, thereby improving the performance of the filter and thus improving the encoding and decoding performance.
[0406] In this embodiment, for YUV components, when determining the region index of a block in the CTU, the region index of each block in the CTU can be obtained based on the position coordinates and size of the current block, so as to determine the filter corresponding to each region. Compared with existing CTU-level or image-level filters, this application uses a block-level filter with a smaller granularity than the CTU-level filter for YUV components. That is, this application considers the pixel changes within the CTU. Filtering with this block-level filter can achieve better filtering results, thereby improving the filter performance and thus improving the encoding and decoding performance.
[0407] In this embodiment, for the Y component, when determining the region index of the CTU in the image, the corresponding value can be found from multiple region lookup tables based on the position coordinates of the current block, the size of the current block, and the position coordinates (x, y) of the CTU, to obtain the region index of each CTU in the image, thereby determining the filter corresponding to each region. Compared with the existing method where all CTUs directly look up the corresponding region index from a certain region lookup table, this application, for the Y component, at the CTU-level filtering granularity, enables each CTU to look up the region index from its corresponding region lookup table, making the classification of CTU-level Y component filters more flexible, thereby improving the performance of the filter and thus improving the encoding and decoding performance.
[0408] In this embodiment, when determining the region index of a CTU in an image for the chroma U and chroma V components, the corresponding value can be found in a region lookup table based on the current block's position coordinates, the current block's size, and the CTU's position coordinates (x, y). This yields the region index of each CTU in the image, thus determining the filter corresponding to each region. Compared to existing methods where each frame of the chroma U and chroma V components corresponds to a single filter, this application divides the image into CTUs and finds the region index from a region lookup table. This allows the chroma U and chroma V components to use CTU-level filters, enabling CTU-level filters to be classified based on finer-grained information and with greater flexibility, thereby improving filter performance and ultimately enhancing encoding / decoding performance.
[0409] The effects of the embodiments of this application will be further illustrated below through simulation results.
[0410] The method provided in this application embodiment can be implemented on the Audio Video Coding Standard 4 (AVS4) reference software (i.e., Exploration Video Model 0.6 (EVM0.6)). For example, the chroma component filter can be extended, and simulations can be performed under All intra (coding method using only intra-frame coding) and Random Access configurations.
[0411] The simulation results are shown in Tables 1 and 2 below:
[0412] Table 1
[0413] Table 2
[0414] Thus, it can be seen that the method provided in the embodiments of this application has a certain performance improvement in encoding and decoding. For example, in the configuration of encoding method that only uses intra-frame encoding, the performance is -0.70% on average for chroma U component and -1.07% on average for chroma V component.
[0415] Optionally, the encoding method provided in this application embodiment further includes the following step 33.
[0416] Step 33: The encoding end writes the first syntax element into the bitstream.
[0417] In this embodiment of the application, the first syntax element is used to characterize first indication information, which is used to indicate the index of the area lookup table.
[0418] It should be noted that step 33 above can be performed before step 31 above.
[0419] In this embodiment, the encoder can indicate the index of the region lookup table to the decoder through syntax elements, so that the decoder can determine the region index of the current block using the corresponding region lookup table according to the index of the region lookup table indicated by the syntax elements. This allows the decoder to accurately select the appropriate filtering coefficients for filtering, thereby improving encoding and decoding performance.
[0420] Optionally, in this embodiment of the application, referring to FIG6 and FIG9, step 31 above can be specifically implemented by steps 31a to 31c below.
[0421] Step 31a: Based on the first information, the encoding end determines the region corresponding to the filter coefficient group in the filter coefficient set.
[0422] As described in the above embodiments, the regions indicated by the region index of multiple blocks obtained by dividing the image or CTU are the regions after classifying multiple blocks. Some of these regions have similar features. After RD calculation, these regions with similar features can use the same filter. The first information indicates the number of regions corresponding to each filter. By combining the starting region corresponding to each filter, the region corresponding to each filter can be obtained, thereby obtaining the filter (i.e., the filter coefficient group) used by the regions corresponding to the above multiple blocks.
[0423] Step 31b: The encoder determines the first filter coefficient group from the filter coefficient set based on the region corresponding to the filter coefficient group and the region index of the current block.
[0424] For example, assuming the region index of the current block is 2 (represented as region 2), the above set of filter coefficients includes 6 filter coefficient groups, where the regions corresponding to filter coefficient group 1 are region 0, region 1 and region 2. Then it can be determined that the filter coefficients used by the current block are filter coefficient group 1.
[0425] Step 31c: The encoding end performs loop filtering on the reconstructed block of the current block based on the first set of filtering coefficients.
[0426] It should be noted that the filtering process for loop filtering of the reconstructed block of the current block can be found in the description of the relevant technology, and will not be elaborated here.
[0427] Step 32: The encoding end writes the first information into the bit stream.
[0428] In this embodiment of the application, when the reconstruction block of the current block is filtered using ALF, the encoding end can write information such as whether the current block uses ALF and the filtering coefficients used by the current block into the bit stream and transmit it to the decoding end.
[0429] Optionally, in the embodiments of this application, step 32 above can be specifically implemented by step 32a below.
[0430] Step 32a: The encoding end writes the second syntax element into the bitstream.
[0431] In this embodiment of the application, the second syntax element is used to represent the first information.
[0432] For example, the second syntax element mentioned above can be represented as alf_region_distance.
[0433] For example, for the Y component, the second syntax element above can be represented as alf_Y_region_distance.
[0434] For the chromaticity U component, the second syntax element mentioned above can be represented as alf_cb_region_distance.
[0435] For the chromaticity V component, the second syntax element mentioned above can be represented as alf_cr_region_distance.
[0436] Optionally, the encoding method provided in this application embodiment may further include the following step 32b.
[0437] Step 32b: The encoding end writes the third syntax element into the bitstream.
[0438] In this embodiment of the application, the third syntax element is used to characterize the set of filter coefficients.
[0439] For example, the third syntax element mentioned above can be represented as alf_coeff_chroma or alf_coeff_luma.
[0440] For example, for the Y component, the third syntax element mentioned above can be represented as alf_coeff_luma, which is the set of filter coefficients for the Y component.
[0441] For the chroma U component, the third syntax element mentioned above can be represented as alf_coeff_chroma[0], which is the set of filter coefficients for the chroma U component.
[0442] For the chroma V component, the third syntax element mentioned above can be represented as alf_coeff_chroma[1], which is the set of filtering coefficients for the chroma V component.
[0443] Optionally, referring to FIG6 and as shown in FIG10, the encoding method provided in the embodiments of this application further includes the following step 34.
[0444] Step 34: The encoding end writes the fourth syntax element into the bitstream.
[0445] In this embodiment of the application, the fourth syntax element is used to characterize the second indication information, which is used to indicate whether to perform loop filtering on the reconstructed block of the current block.
[0446] The aforementioned reconstruction block includes at least one of the following: a reconstruction block for the luminance component, a reconstruction block for the first chrominance component, and a reconstruction block for the second chrominance component.
[0447] For example, the fourth syntax element mentioned above can be represented as PictureAlfEnableFlag.
[0448] For example, for the Y component, the fourth syntax element mentioned above can be represented as PictureAlfEnableFlag[0].
[0449] For the chromaticity U component, the fourth syntax element mentioned above can be represented as PictureAlfEnableFlag[1].
[0450] For the chromaticity V component, the fourth syntax element mentioned above can be represented as PictureAlfEnableFlag[2].
[0451] It should be noted that step 34 can be performed before step 32.
[0452] Thus, the encoding end of this scheme indicates through syntax elements whether the reconstructed blocks of the luminance component, the first chrominance component, and the second chrominance component should be loop filtered, so that the decoding end can know whether to perform loop filtering on the reconstructed blocks of the luminance component, the first chrominance component, and the second chrominance component. This allows the decoding end to accurately select the appropriate filtering coefficients for filtering, thereby improving encoding and decoding performance.
[0453] Optionally, the encoding method provided in this application embodiment further includes the following step 34.
[0454] Step 35: The encoding end writes the fifth syntax element into the bitstream.
[0455] In this embodiment of the application, the fifth syntax element is used to characterize second information, which is used to characterize the maximum number of filter coefficient sets that can be used in a region of the image, and the maximum number is the number of regions in the image.
[0456] For example, the fifth syntax element mentioned above can be represented as FilterNumChroma or FilterNumLuma. Specifically, for the Y component, the fifth syntax element can be represented as FilterNumChroma; for the chroma U component and the chroma V component, the fifth syntax element can be represented as FilterNumLuma.
[0457] It should be noted that step 35 can be performed before step 32.
[0458] Thus, the encoding end of this scheme indicates the maximum number of filter coefficient groups that can be used in a region of the image through syntax elements, so that the decoding end can accurately select the corresponding filter coefficients for filtering and improve encoding and decoding performance.
[0459] Optionally, the encoding method provided in this application embodiment further includes the following step 36.
[0460] Step 36: The encoding end writes the sixth syntax element into the bitstream.
[0461] In this embodiment of the application, the sixth syntax element is used to characterize the scaling factor corresponding to the set of filter coefficients, which is used to integrate the filter coefficients determined based on the set of filter coefficients.
[0462] For example, the sixth syntax element mentioned above can be represented as alf_chroma_shift_num_minus6 or alf_luma_shift_num_minus6.
[0463] For example, for the Y component, the sixth syntax element mentioned above can be represented as alf_luma_shift_num_minus6.
[0464] For the chroma U component, the sixth syntax element mentioned above can be represented as alf_chroma_shift_num_minus6[0].
[0465] For the chroma V component, the sixth syntax element mentioned above can be represented as alf_chroma_shift_num_minus6[1].
[0466] It should be noted that step 36 can be performed after step 32.
[0467] In this embodiment, the encoder can indicate the scaling factor to the decoder through syntax elements, so that the decoder can integrate the filter coefficients determined based on the filter coefficient set, map the floating-point coefficients to a reasonable integer range, reduce the computational complexity of the filter coefficients, reduce bit overhead, and thus improve encoding and decoding performance.
[0468] The following uses chrominance components (chrominance U component and chrominance V component) as an example to illustrate the above syntax elements through Table 3.
[0469] Table 3
[0470] In Table 3, the fifth syntax element FilterNumChroma represents the maximum number of chroma component filters, which is equal to the number of regions in the image.
[0471] The syntax element PictureAlfEnableFlag[1] indicates whether ALF filtering is used on the reconstructed block of the chroma U component. For example, PictureAlfEnableFlag[1]==1 indicates that ALF filtering is used on the reconstructed block of the chroma U component; PictureAlfEnableFlag[1]==0 indicates that ALF filtering is not used on the reconstructed block of the chroma U component.
[0472] The syntax element alf_filter_cb_num_minus1 indicates: the actual number of filters used for the chroma U component minus 1.
[0473] The second syntax element, `alf_cb_region_distance`, represents the number of regions covered by the chroma U component filter. For example, an image can have a maximum of 16 regions, each with one filter. However, some regions have similar features, and after RD calculation, they can be filtered using a single set of filters. The value of the second syntax element `alf_cb_region_distance` under this filter is the number of regions. For example, if one filter is used for regions 3, 4, 5, and 6, then the value of the second syntax element `alf_cb_region_distance` is 4. After the decoder obtains the value of the second syntax element `alf_cb_region_distance` (4) and the starting region 3, it can know that regions 3, 4, 5, and 6 use the same filter.
[0474] The third syntax element, alf_coeff_chroma[0][i][j], represents the filter coefficients for the chroma U component. 0 represents the chroma U component, i represents the i-th filter, and j represents the j-th filter coefficient.
[0475] The sixth syntax element alf_chroma_shift_num_minus6[0][i] represents the scale factor of the chroma U component filter, where 0 represents the chroma U component and i represents the i-th filter.
[0476] The syntax element PictureAlfEnableFlag[2] indicates whether ALF filtering is used on the reconstructed blocks of the chroma V component. For example, PictureAlfEnableFlag[2]==1 indicates that ALF filtering is used on the reconstructed blocks of the chroma V component; PictureAlfEnableFlag[2]==0 indicates that ALF filtering is not used on the reconstructed blocks of the chroma V component.
[0477] The syntax element alf_filter_cr_num_minus1 indicates that the actual number of filters used for the chroma V component is reduced by one.
[0478] The second syntax element, alf_cb_region_distance, represents the number of regions covered by the chroma V component filter.
[0479] The third syntax element alf_coeff_chroma[1][i][j] represents the filter coefficients of the chroma V component. 1 represents the chroma V component, i represents the i-th filter, and j represents the j-th filter coefficient.
[0480] The sixth syntax element alf_chroma_shift_num_minus6[1][i] represents the scale factor of the chroma V component filter, where 1 represents the chroma V component and i represents the i-th filter.
[0481] This application provides an encoding method in which the encoding end can perform loop filtering on the reconstructed block of the current block based on first information, a set of filter coefficients, and the region index of the current block. The first information is used to determine the region corresponding to the filter coefficient group in the set of filter coefficients, and the region index of the current block is determined based on the size of the current block. Then, the encoding end writes the first information into the bitstream. With this scheme, since the region index of the current block can be determined based on the size of the current block, for each YUV component, the region index of the block can be adaptively determined according to the size of the corresponding block to determine the filter used for the corresponding region. In other words, the size of the block determines the granularity of the filter. Therefore, the granularity of the filter determined by the encoding end based on the first information, the set of filter coefficients, and the region index of the current block is a block-level filter determined by the size of the block. Using a filter with this granularity to filter the reconstructed block of the current block can improve the filtering effect, thereby improving the filter performance and ultimately improving the encoding and decoding performance.
[0482] Figure 11 shows a flowchart of a decoding method provided in an embodiment of this application. The decoding method may include the following steps 41 and 42.
[0483] Step 41: The decoding end parses the bitstream to obtain the first information.
[0484] In this embodiment of the application, the first information is used to determine the region corresponding to the filter coefficient group in the filter coefficient set.
[0485] In this embodiment of the application, the region index of the current block is determined based on the size of the current block.
[0486] Optionally, in the embodiments of this application, the current block can be a block in the CTU; or, the current block can be a block in the image.
[0487] Optionally, in the embodiments of this application, the current block is a block in the CTU, and the reconstructed block may include at least one of the following: a reconstructed block of the luminance component, a reconstructed block of the first chrominance component, and a reconstructed block of the second chrominance component.
[0488] Optionally, in this embodiment of the application, the current block is a block in an image, and the reconstructed block may include at least one of the following: a reconstructed block of the first chromaticity component and a reconstructed block of the second chromaticity component.
[0489] Optionally, in this embodiment of the application, the size of the current block is less than or equal to the size of the CTU.
[0490] Optionally, in this embodiment of the application, the size of the current block being less than or equal to the size of the CTU includes at least one of the following:
[0491] The width of the current block is less than or equal to the width of the CTU;
[0492] The height of the current block is less than or equal to the height of the CTU.
[0493] Optionally, in this embodiment of the application, the region index of the current block is determined based on the first index, or based on the first index and the region lookup table.
[0494] The first index mentioned above is determined based on the position coordinates of the current block and the size of the current block.
[0495] Optionally, in this embodiment of the application, the first index includes a second index and a third index. The second index is determined based on the horizontal coordinate of the current block and the width of the current block, and the third index is determined based on the vertical coordinate of the current block and the height of the current block.
[0496] Optionally, in this embodiment of the application, the second index is determined based on a first ratio of the horizontal coordinate of the current block's position to the width of the current block.
[0497] Optionally, in this embodiment of the application, the second index is the minimum value between the first ratio and the first value, which is related to the maximum number of regions of the CTU or image in the horizontal direction.
[0498] Optionally, in this embodiment of the application, the third index is determined based on a second ratio of the vertical coordinate of the current block's position to the height of the current block.
[0499] Optionally, in this embodiment of the application, the third index is the minimum of the second ratio and the second value, which is related to the number of blocks contained in the CTU or image in the vertical direction.
[0500] Optionally, in this embodiment, the horizontal coordinate of the current block's position is the horizontal coordinate of the upper left corner of the current block relative to the first position, and the vertical coordinate of the current block's position is the vertical coordinate of the upper left corner of the current block relative to the first position. The first position is either the upper left corner of the CTU or the upper left corner of the image.
[0501] Optionally, in this embodiment, the region index of the current block is determined based on a first index. The region index of the current block is the sum of a second index and a third value, where the third value is the product of the third index and a fourth value, where the fourth value represents the number of blocks contained in the horizontal direction.
[0502] Optionally, in this embodiment, the region index of the current block is determined based on the first index and the region lookup table. The region index of the current block is a value determined from the region lookup table based on the second index and the third index.
[0503] Optionally, in this embodiment of the application, the region index of the current block is the value corresponding to the second position in the region lookup table. The second position can be a position where the horizontal coordinate is the second index and the vertical coordinate is the third index.
[0504] Optionally, in this embodiment of the application, the above-mentioned region lookup table is determined based on the location coordinates of the CTU; wherein, the location coordinates of the CTU are the coordinates of the CTU relative to the upper left corner of the image.
[0505] Optionally, the decoding method provided in this application embodiment may further include the following step 43.
[0506] Step 43: The decoding end parses the first syntax element in the bitstream to obtain the first indication information.
[0507] In this embodiment of the application, the first indication information is used to indicate the index of the area lookup table.
[0508] It should be noted that step 43 can be performed after step 41.
[0509] Optionally, in the embodiments of this application, step 41 above can be implemented by step 41a below.
[0510] Step 41a: The decoding end parses the second syntax element in the bitstream to obtain the first information.
[0511] Optionally, the decoding method provided in this application embodiment may further include the following step 41b.
[0512] Step 41b: The decoding end parses the third syntax element in the bitstream to obtain the set of filter coefficients.
[0513] Optionally, in the embodiments of this application, the above-mentioned set of filter coefficients can also be obtained in other ways, such as a set of filter coefficients pre-stored at the decoding end, or a predefined set of filter coefficients, etc. The specific method is not limited in the embodiments of this application.
[0514] Optionally, referring to FIG11 and as shown in FIG12, the decoding method provided in the embodiments of this application may further include the following step 44.
[0515] Step 44: The decoding end parses the fourth syntax element in the bitstream to obtain the second instruction information.
[0516] In this embodiment of the application, the second indication information is used to indicate whether to perform loop filtering on the reconstruction block of the current block. The reconstruction block includes at least one of the following: a reconstruction block of the luminance component, a reconstruction block of the first chrominance component, and a reconstruction block of the second chrominance component.
[0517] It should be noted that step 44 can be performed before step 41.
[0518] Optionally, referring to FIG11 and as shown in FIG13, the decoding method provided in the embodiments of this application may further include the following step 45.
[0519] Step 45: The decoding end parses the fifth syntax element in the bitstream to obtain the second information.
[0520] In this embodiment of the application, the second information is used to characterize the maximum number of filter coefficient sets that can be used in a region of the image, and the maximum number is the number of regions in the image.
[0521] It should be noted that step 45 can be performed before step 41.
[0522] Optionally, the decoding method provided in this application embodiment may further include the following step 46.
[0523] Step 46: The decoder parses the sixth syntax element in the bitstream to obtain the scale factor corresponding to the set of filter coefficients.
[0524] In this embodiment of the application, the above-mentioned scaling factor is used to integrate the filter coefficients determined based on the filter coefficient set.
[0525] It should be noted that step 46 can be performed after step 41.
[0526] Step 42: The decoding end performs loop filtering on the reconstructed block of the current block based on the first information, the set of filtering coefficients and the region index of the current block.
[0527] Optionally, in the embodiments of this application, step 42 above can be specifically implemented by steps 42a to 42c below.
[0528] Step 42a: Based on the first information, the decoding end determines the region corresponding to the filter coefficient group in the filter coefficient set.
[0529] Step 42b: The decoding end determines the first filter coefficient group from the filter coefficient set based on the region corresponding to the filter coefficient group and the region index of the current block.
[0530] Step 42c: The decoding end performs loop filtering on the reconstructed block of the current block based on the first set of filtering coefficients.
[0531] It should be noted that for the relevant content and beneficial effects of the decoding end embodiment, please refer to the description in the above encoding method embodiment, which will not be repeated here.
[0532] The following example, using the chroma component and the CTU internally divided into M×N=8×8 blocks, illustrates the parsing and decoding processes of the above syntax elements. Specifically, for the chroma U and chroma V components, each block is 8x8 in size.
[0533] Implementation Method 1
[0534] (1) Analysis process:
[0535] Parse the fourth syntax element PictureAlfEnableFlag[1]. If the value of this syntax element is 1, it means that the chroma U component of the current image is filtered using ALF. Otherwise, the chroma U component of the current image is not filtered using ALF.
[0536] When PictureAlfEnableFlag[1] is 1, the syntax element alf_filter_cb_num_minus1 is parsed. This syntax element indicates that the number of filters used by the chroma U component is reduced by one. After parsing alf_filter_cb_num_minus1, the second syntax element alf_cb_region_distance is parsed. This second syntax element indicates the number of regions covered by the current filter. The filter index used by each region can be obtained according to the value of this second syntax element. Then, the third syntax element alf_coeff_chroma[0][i][j] is parsed. This third syntax element indicates the filter coefficient of the i-th filter of the chroma U component. Finally, the sixth syntax element alf_chroma_shift_num_minus6[0][i] is parsed. This sixth syntax element is the scale factor of the i-th filter of the chroma U component.
[0537] Parse the fourth syntax element PictureAlfEnableFlag[2]. If the value of the fourth syntax element is 1, it means that the chroma V component of the current image is filtered by ALF. Otherwise, the chroma V component of the current image is not filtered by ALF.
[0538] When PictureAlfEnableFlag[2] is 1, the syntax element alf_filter_cr_num_minus1 is parsed. This syntax element indicates that the number of filters used by the chroma V component is reduced by one. After parsing alf_filter_cr_num_minus1, the second syntax element alf_cr_region_distance is parsed. This second syntax element indicates the number of regions covered by the current filter. The filter index used by each region can be obtained according to the value of this second syntax element. Then, the third syntax element alf_coeff_chroma[1][i][j] is parsed. This third syntax element indicates the filter coefficient of the i-th filter of the chroma V component. Finally, the sixth syntax element alf_chroma_shift_num_minus6[1][i] is parsed. This sixth syntax element is the scale factor of the i-th filter of the chroma V component.
[0539] Parse the syntax element alf_lcu_enable_flag[0][LcuIndex], which indicates whether each CTU chromatic U component is filtered.
[0540] Parse the syntax element alf_lcu_enable_flag[1][LcuIndex], which indicates whether each CTU chromatic V component is filtered.
[0541] (2) Decoding process
[0542] Based on the coordinates (g, i) of the top-left corner of each block within the CTU, where g is the x-coordinate of the first pixel of the current block's top-left corner relative to the first pixel of the CTU's top-left corner, and i is the y-coordinate of the first pixel of the current block's top-left corner relative to the first pixel of the CTU's top-left corner, the following calculations are obtained:
[0543] x_index=Clip_post(7,g / blkSizeX)
[0544] y_index=Clip_post(7,i / blkSizeY)
[0545] Where blkSizeX represents the width of the block, and blkSizeY represents the height of the block. The Clip_post(a,b) function is a clamping function; when b is less than a, the function outputs b, and when b is greater than or equal to a, the function outputs a. x_index is the horizontal index value, and y_index is the vertical index value.
[0546] At this point, the region index of this block is: blk_cIdx = y_index * 8 + x_index
[0547] If the filter flag alf_lcu_enable_flag[0] of the CTU is 1, it means that the chroma U component of the CTU will be filtered by ALF. At this time, the filter index fIdx used by the chroma U component of the current block is determined according to blk_cIdx and alf_cb_region_distance. The corresponding filter coefficient alf_coeff_chroma[0][fIdx] is selected according to the filter index and the chroma U component of the current block is filtered.
[0548] If the filter flag alf_lcu_enable_flag[1] of the CTU is 1, it means that the chroma V component of the CTU will be filtered by ALF. At this time, according to blk_cIdx and alf_cr_region_distance, the filter index fIdx used by the chroma V component of the current block is determined, and the corresponding filter coefficient alf_coeff_chroma[1][fIdx] is selected according to the filter index, and the chroma V component of the current block is filtered.
[0549] In this embodiment, for the chroma U component and chroma V component, the pixel blocks inside the CTU can be divided into several classes according to their physical location, so that the granularity of the ALF evolves from the CTU level or image level to the block level filtering. This allows the filter to classify information based on smaller granularity, thereby improving the filter performance and thus improving the encoding and decoding performance.
[0550] In this embodiment, for the chroma U component and chroma V component, when determining the region index of a block in the CTU, the region index of each block in the CTU can be obtained based on the position coordinates and size of the current block, so as to determine the filter corresponding to each region. Compared with existing CTU-level or image-level filters, this application uses a block-level filter with a smaller granularity for the chroma U component and chroma V component. That is, this application considers the pixel changes within the CTU. Filtering with this block-level filter can achieve better filtering results, thereby improving the filter performance and thus improving the encoding and decoding performance.
[0551] It should be noted that the specific calculation process and corresponding examples for Implementation Method 1 are described in the above-mentioned encoding section and will not be repeated here.
[0552] Implementation Method 2
[0553] (1) The parsing process is the same as the first implementation method described above.
[0554] (2) Decoding process
[0555] The coordinates of the CTU are (x, y), where x is the index of the current CTU relative to the first CTU at the top left corner of the image, and y is the index of the current CTU relative to the first CTU at the top left corner of the image.
[0556] The coordinates of the top-left corner of each block within the CTU are (g, i), where g is the x-coordinate of the first pixel of the current block relative to the first pixel of the top-left corner of the CTU, and i is the y-coordinate of the first pixel of the current block relative to the first pixel of the top-left corner of the CTU. The calculation yields:
[0557] x_index=Clip_post(7,g / blkSizeX)
[0558] y_index=Clip_post(7,i / blkSizeY)
[0559] Where blkSizeX represents the width of the block, and blkSizeY represents the height of the block. The Clip_post(a,b) function is a clamping function; when b is less than a, the function outputs b, and when b is greater than or equal to a, the function outputs a. x_index is the horizontal index value, and y_index is the vertical index value.
[0560] At this point, the region index of this block is:
[0561] blk_cIdx=tb_ctu[tIdx][y_index][x_index]
[0562] Where tIdx = (y%2)*2 + (x%2), and tb_ctu is the lookup table for the four regions in Figure 8.
[0563] If the filter flag alf_lcu_enable_flag[0] of the CTU is 1, it means that the chroma U component of the CTU will be filtered by ALF. At this time, the filter index fIdx used by the chroma U component of the current block is determined according to blk_cIdx and alf_cb_region_distance. The corresponding filter coefficient alf_coeff_chroma[0][fIdx] is selected according to the filter index and the chroma U component of the current block is filtered.
[0564] If the filter flag alf_lcu_enable_flag[1] of the CTU is 1, it means that the chroma V component of the CTU will be filtered by ALF. At this time, according to blk_cIdx and alf_cr_region_distance, the filter index fIdx used by the chroma V component of the current block is determined, and the corresponding filter coefficient alf_coeff_chroma[1][fIdx] is selected according to the filter index, and the chroma V component of the current block is filtered.
[0565] In this embodiment, when determining the region index of a CTU in an image for the chroma U and chroma V components, the corresponding value can be found in a region lookup table based on the current block's position coordinates, the current block's size, and the CTU's position coordinates (x, y). This yields the region index of each CTU in the image, thus determining the filter corresponding to each region. Compared to existing methods where each frame of the chroma U and chroma V components corresponds to a single filter, this application divides the image into CTUs and finds the region index from a region lookup table. This allows the chroma U and chroma V components to use CTU-level filters, enabling CTU-level filters to be classified based on finer-grained information and with greater flexibility, thereby improving filter performance and ultimately enhancing encoding / decoding performance.
[0566] It should be noted that for the specific calculation process and corresponding examples of Implementation Method 2, please refer to the description of the encoding end above, and it will not be repeated here.
[0567] This application provides a decoding method. The decoding end can parse the bitstream to obtain first information, which is used to determine the region corresponding to the filter coefficient group in the filter coefficient set. Then, based on the first information, the filter coefficient set, and the region index of the current block, loop filtering is performed on the reconstructed block of the current block. The region index of the current block is determined based on the size of the current block. With this scheme, since the region index of the current block can be determined based on the size of the current block, for each YUV component, the region index of the block can be adaptively determined according to the size of the corresponding block to determine the filter used for the corresponding region. In other words, the size of the block determines the granularity of the filter. Therefore, the granularity of the filter determined by the decoding end based on the first information, the filter coefficient set, and the region index of the current block is a block-level filter determined by the block size. Using a filter with this granularity to filter the reconstructed block of the current block can improve the filtering effect, thereby improving the filter performance and ultimately improving the encoding and decoding performance.
[0568] Accordingly, this application provides an encoding device, which can be divided into functional modules according to the above method example. For example, each function can be divided into its own functional modules, or two or more functions can be integrated into one processing module. The integrated modules can be implemented in hardware or as software functional modules. It should be noted that the module division in this application embodiment is illustrative and only represents one logical functional division; other division methods may be used in actual implementation.
[0569] With each functional module divided according to its corresponding function, Figure 14 shows a possible structural schematic diagram of the encoding device involved in the above embodiments. As shown in Figure 14, the encoding device 160 includes: a filtering module 161 and an encoding module 162.
[0570] The filtering module 161 is used to perform loop filtering on the reconstructed block of the current block based on the first information, the set of filtering coefficients, and the region index of the current block. The first information is used to determine the region corresponding to the filtering coefficient group in the set of filtering coefficients. The encoding module 162 is used to write the first information into the bit stream; wherein the region index of the current block is determined based on the size of the current block.
[0571] In some implementations, the size of the current block is less than or equal to the size of the CTU.
[0572] In some implementations, the size of the current block being less than or equal to the size of the CTU includes at least one of the following:
[0573] The width of the current block is less than or equal to the width of the CTU;
[0574] The height of the current block is less than or equal to the height of the CTU.
[0575] In some implementations, the region index of the current block is determined based on a first index, or based on the first index and a region lookup table; wherein the first index is determined based on the position coordinates of the current block and the size of the current block.
[0576] In some implementations, the first index mentioned above includes a second index and a third index, wherein the second index is determined based on the horizontal coordinate of the current block and the width of the current block, and the third index is determined based on the vertical coordinate of the current block and the height of the current block.
[0577] In some implementations, the second index is determined based on a first ratio of the horizontal coordinate of the current block's position to the width of the current block; the third index is determined based on a second ratio of the vertical coordinate of the current block's position to the height of the current block.
[0578] In some implementations, the second index is the minimum of the first ratio and the first value, which is related to the maximum number of regions of the CTU or image in the horizontal direction;
[0579] The third index mentioned above is the minimum of the second ratio and the second value, which is related to the maximum number of regions in the vertical direction of the CTU or image.
[0580] In some implementations, the x-coordinate of the current block's position is the x-coordinate of the top-left corner of the current block relative to the first position, and the y-coordinate of the current block's position is the y-coordinate of the top-left corner of the current block relative to the first position.
[0581] The first position mentioned above refers to the upper left corner of the CTU or the upper left corner of the image.
[0582] In some implementations, the region index of the current block is determined based on the first index;
[0583] The region index of the current block is the sum of the second index and the third value, which is the product of the third index and the fourth value, which is the number of blocks contained in the horizontal direction.
[0584] In some implementations, the region index of the current block is determined based on the first index and the region lookup table; the region index of the current block is a value determined from the region lookup table based on the second index and the third index.
[0585] In some implementations, the region index of the current block is the value corresponding to the second position in the region lookup table. This second position is the position where the horizontal coordinate is the second index and the vertical coordinate is the third index.
[0586] In some implementations, the aforementioned region lookup table is determined based on the location coordinates of the CTU; where the location coordinates of the CTU are the coordinates of the CTU relative to the top left corner of the image.
[0587] In some implementations, the encoding module 162 is further configured to write a first syntax element into the code stream, the first syntax element being used to characterize first indication information, the first indication information being used to indicate the index of the region lookup table.
[0588] In some implementations, the aforementioned filtering module 161 is specifically used for:
[0589] Based on the first information, determine the region corresponding to the filter coefficient group in the filter coefficient set;
[0590] The first filter coefficient group is determined from the filter coefficient set based on the region corresponding to the filter coefficient group and the region index of the current block;
[0591] Loop filtering is performed on the reconstructed block of the current block based on the first set of filter coefficients.
[0592] In some implementations, the aforementioned encoding module 162 is specifically used for:
[0593] Write the second syntax element into the code stream; this second syntax element is used to represent the first information.
[0594] In some implementations, the aforementioned encoding module 162 is also used to write a third syntax element into the bitstream, which is used to characterize the set of filter coefficients.
[0595] In some implementations, the above-mentioned encoding module 162 is further used to write a fourth syntax element into the bitstream. The fourth syntax element is used to characterize the second indication information, which is used to indicate whether to perform loop filtering on the reconstruction block of the current block. The reconstruction block includes at least one of the following: a reconstruction block of the luminance component, a reconstruction block of the first chrominance component, and a reconstruction block of the second chrominance component.
[0596] In some implementations, the encoding module 162 is further configured to write a fifth syntax element into the bitstream, the fifth syntax element being used to characterize second information, the second information being used to characterize the maximum number of filter coefficient sets that can be used in a region of the image, the maximum number being the number of regions in the image.
[0597] In some implementations, the encoding module 162 is further used to write a sixth syntax element into the bitstream. This sixth syntax element is used to characterize the scaling factor corresponding to the set of filter coefficients. This scaling factor is used to integrate the filter coefficients determined based on the set of filter coefficients.
[0598] In some implementations, the aforementioned current block is a block in the CTU; or, the aforementioned current block is a block in the image.
[0599] In some implementations, the current block is a block in the CTU, and the reconstructed block includes at least one of the following: a reconstructed block of the luminance component, a reconstructed block of the first chrominance component, and a reconstructed block of the second chrominance component; or, the current block is a block in the image, and the reconstructed block includes at least one of the following: a reconstructed block of the first chrominance component and a reconstructed block of the second chrominance component.
[0600] In the encoding apparatus of this application embodiment, since the region index of the current block can be determined based on the size of the current block, for each YUV component, the region index of the block can be adaptively determined according to the size of the corresponding block to determine the filter used for the region corresponding to the block. In other words, the size of the block determines the granularity of the filter. Thus, the granularity of the filter determined by the encoding apparatus based on the first information, the set of filter coefficients and the region index of the current block is a block-level filter determined by the size of the block. Using a filter with this granularity to filter the reconstructed block of the current block can improve the filtering effect, thereby improving the performance of the filter and thus improving the encoding and decoding performance.
[0601] Each module of the above-mentioned encoding device can also be used to perform other actions in the above-mentioned method embodiments. All relevant content of each step involved in the above-mentioned method embodiments can be referred to the functional description of the corresponding functional module, and will not be repeated here.
[0602] Figure 15 illustrates another possible structural diagram of the encoding device involved in the above embodiments when using integrated units. As shown in Figure 15, the encoding device 1600 provided in this application embodiment may include a processing module 1601 and a communication module 1602. The processing module 1601 can be used to control and manage the operation of the encoding device. For example, the processing module 1601 can be used to support the encoding device in executing the various steps in the above-described encoding method embodiments, and / or other processes used in the technology described herein. The communication module 1602 can be used to support communication between the encoding device and other network entities, such as communication with the encoding device itself. In one example, as shown in Figure 15, the encoding device 1600 may also include a storage module 1603 for storing the program code and data of the encoding device, such as storing encoded images or bitstreams.
[0603] The processing module 1601 can be a processor, such as the encoder 112 in Figure 4 above. The communication module 1602 can be a transceiver, transceiver circuit, or communication interface, such as the communication interface 113 in Figure 4. The storage module 1603 can be a memory.
[0604] For more details on how the modules included in the above encoding device implement the above functions, please refer to the descriptions in the preceding method embodiments, which will not be repeated here.
[0605] Accordingly, this application provides a decoding device. Based on the above method examples, the decoding device can be divided into functional modules. For example, each function can be divided into its own functional modules, or two or more functions can be integrated into one processing module. The integrated modules can be implemented in hardware or as software functional modules. It should be noted that the module division in this application is illustrative and represents only one logical functional division; in actual implementation, other division methods may be used.
[0606] Figure 16 shows a possible structural diagram of the decoding device involved in the above embodiments, where each functional module is divided according to its corresponding function. As shown in Figure 16, the decoding device 180 includes: a parsing module 181 and a filtering module 182.
[0607] The parsing module 181 is used to parse the bitstream to obtain first information, which is used to determine the region corresponding to the filter coefficient group in the filter coefficient set. The filtering module 182 is used to perform loop filtering on the reconstructed block of the current block based on the first information, the filter coefficient set, and the region index of the current block; wherein the region index of the current block is determined based on the size of the current block.
[0608] In some implementations, the size of the current block is less than or equal to the size of the CTU.
[0609] In some implementations, the size of the current block being less than or equal to the size of the CTU includes at least one of the following:
[0610] The width of the current block is less than or equal to the width of the CTU;
[0611] The height of the current block is less than or equal to the height of the CTU.
[0612] In some implementations, the region index of the current block is determined based on a first index, or based on the first index and a region lookup table; wherein the first index is determined based on the position coordinates of the current block and the size of the current block.
[0613] In some implementations, the first index mentioned above includes a second index and a third index, wherein the second index is determined based on the horizontal coordinate of the current block and the width of the current block, and the third index is determined based on the vertical coordinate of the current block and the height of the current block.
[0614] In some implementations, the second index is determined based on a first ratio of the horizontal coordinate of the current block's position to the width of the current block; the third index is determined based on a second ratio of the vertical coordinate of the current block's position to the height of the current block.
[0615] In some implementations, the second index is the minimum of the first ratio and the first value, which is related to the maximum number of regions of the CTU or image in the horizontal direction; the third index is the minimum of the second ratio and the second value, which is related to the maximum number of regions of the CTU or image in the vertical direction.
[0616] In some implementations, the x-coordinate of the current block's position is the x-coordinate of the top-left corner of the current block relative to the first position, and the y-coordinate of the current block's position is the y-coordinate of the top-left corner of the current block relative to the first position.
[0617] The first position mentioned above refers to the upper left corner of the CTU or the upper left corner of the image.
[0618] In some implementations, the region index of the current block is determined based on the first index;
[0619] The region index of the current block is the sum of the second index and the third value, which is the product of the third index and the fourth value, which is the number of blocks contained in the horizontal direction.
[0620] In some implementations, the region index of the current block is determined based on the first index and the region lookup table; the region index of the current block is a value determined from the region lookup table based on the second index and the third index.
[0621] In some implementations, the region index of the current block is the value corresponding to the second position in the region lookup table. This second position is the position where the horizontal coordinate is the second index and the vertical coordinate is the third index.
[0622] In some implementations, the aforementioned area lookup table is determined based on the CTU's location coordinates;
[0623] The position coordinates of the CTU are the coordinates of the CTU relative to the upper left corner of the image.
[0624] In some implementations, the parsing module 181 is also used to parse the first syntax element in the code stream to obtain first indication information, which is used to indicate the index of the region lookup table.
[0625] In some implementations, the aforementioned filtering module 182 is specifically used for:
[0626] Based on the first information, determine the region corresponding to the filter coefficient group in the filter coefficient set;
[0627] The first filter coefficient group is determined from the filter coefficient set based on the region corresponding to the filter coefficient group and the region index of the current block;
[0628] Loop filtering is performed on the reconstructed block of the current block based on the first set of filter coefficients.
[0629] In some implementations, the aforementioned parsing module 181 is specifically used for:
[0630] The second syntax element in the code stream is parsed to obtain the first information.
[0631] In some implementations, the parsing module 181 mentioned above is also used to parse the third syntax element in the bitstream to obtain a set of filter coefficients.
[0632] In some implementations, the parsing module 181 is further used to parse the fourth syntax element in the bitstream to obtain second indication information. The second indication information is used to indicate whether to perform loop filtering on the reconstruction block of the current block. The reconstruction block includes at least one of the following: a reconstruction block of the luminance component, a reconstruction block of the first chrominance component, and a reconstruction block of the second chrominance component.
[0633] In some implementations, the parsing module 181 is further used to parse the fifth syntax element in the bitstream to obtain second information, which is used to characterize the maximum number of filter coefficient sets that can be used in a region of the image, the maximum number being the number of regions in the image.
[0634] In some implementations, the parsing module 181 is also used to parse the sixth syntax element in the bitstream to obtain the scaling factor corresponding to the set of filter coefficients. This scaling factor is used to integrate the filter coefficients determined based on the set of filter coefficients.
[0635] In some implementations, the aforementioned current block is a block in the CTU; or, the aforementioned current block is a block in the image.
[0636] In some implementations, the current block is a block in the CTU, and the reconstructed block includes at least one of the following: a reconstructed block of the luminance component, a reconstructed block of the first chrominance component, and a reconstructed block of the second chrominance component; or, the current block is a block in the image, and the reconstructed block includes at least one of the following: a reconstructed block of the first chrominance component and a reconstructed block of the second chrominance component.
[0637] In the decoding apparatus of this application embodiment, since the region index of the current block can be determined based on the size of the current block, for each YUV component, the region index of the block can be adaptively determined according to the size of the corresponding block to determine the filter used for the region corresponding to the block. In other words, the size of the block determines the granularity of the filter. Thus, the granularity of the filter determined by the decoding apparatus based on the first information, the set of filter coefficients and the region index of the current block is a block-level filter determined by the size of the block. Using a filter with this granularity to filter the reconstructed block of the current block can improve the filtering effect, thereby improving the performance of the filter and thus improving the encoding and decoding performance.
[0638] Each module of the above-mentioned decoding device can also be used to perform other actions in the above-mentioned method embodiments. All relevant content of each step involved in the above-mentioned method embodiments can be referred to the functional description of the corresponding functional module, and will not be repeated here.
[0639] Figure 17 illustrates another possible structural diagram of the decoding device involved in the above embodiments, when using integrated units. As shown in Figure 17, the decoding device 1800 provided in this application embodiment may include a processing module 1801 and a communication module 1802. The processing module 1801 can be used to control and manage the operation of the decoding device. For example, the processing module 1801 can be used to support the decoding device in executing various steps in the above decoding method embodiments, and / or other processes used in the technology described herein. The communication module 1802 can be used to support communication between the decoding device and other network entities, such as communication with an image encoding device. In one example, as shown in Figure 17, the decoding device 1800 may also include a storage module 1803 for storing the program code and data of the decoding device, such as storing the decoded image.
[0640] The processing module 1801 can be a processor, such as the decoder 122 in Figure 4. The communication module 1802 can be a transceiver, transceiver circuit, or communication interface, such as the communication interface 121 in Figure 4. The storage module 1803 can be a memory.
[0641] For more details on how the modules included in the above decoding device implement the above functions, please refer to the descriptions in the previous method embodiments, which will not be repeated here.
[0642] This application also provides an encoding / decoding system, including an encoder and a decoder. The encoder is used to execute the encoding method described in the above embodiments, and the decoder is used to execute the decoding method described in the above embodiments.
[0643] This application also provides a computer-readable storage medium storing a computer program. When executed by at least one processor, the computer program implements the various processes of the above-described encoding or decoding method embodiments and achieves the same technical effects. To avoid repetition, further details are omitted here. The readable storage medium includes computer-readable storage media such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.
[0644] This application also provides a computer storage medium for storing a bitstream generated by the encoding method described in the above embodiments.
[0645] This application also provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement the various processes of the above-described encoding or decoding method embodiments and achieve the same technical effect. To avoid repetition, it will not be described again here.
[0646] This application also provides a computer program product, including computer program instructions. When these computer program instructions are executed, they implement the various processes of the above-described encoding or decoding method embodiments and achieve the same technical effect. To avoid repetition, they will not be described again here.
[0647] This application also provides a computer program that, when run on a computer, causes the computer to execute the encoding method as described in the above embodiments, or to execute the decoding method as described in the above embodiments.
[0648] It should be noted that the scope of the methods and apparatus in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions in a substantially simultaneous manner or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. In addition, features described with reference to certain examples may be combined in other examples.
[0649] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented using software programs, implementation can be, in whole or in part, in the form of a computer program product. This computer program product includes one or more computer instructions. When these computer instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line, DSL) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., SSD), etc.
[0650] Through the above description of the embodiments, those skilled in the art will clearly understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In practical 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. The specific working process of the system, device, and unit described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0651] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, 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 system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, or indirect coupling or communication connection between apparatuses or units, and may be electrical, mechanical, or other forms.
[0652] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0653] 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.
[0654] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as flash memory, portable hard disk, read-only memory, random access memory, magnetic disk, or optical disk.
[0655] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A decoding method, characterized in that, include: The bitstream is parsed to obtain the first information, which is used to determine the region corresponding to the filter coefficient group in the filter coefficient set. Based on the first information, the set of filtering coefficients, and the region index of the current block, loop filtering is performed on the reconstructed block of the current block; The region index of the current block is determined based on the size of the current block.
2. The method according to claim 1, characterized in that, The size of the current block is less than or equal to the size of the coding tree unit (CTU).
3. The method according to claim 2, characterized in that, The size of the current block being less than or equal to the size of the CTU includes at least one of the following: The width of the current block is less than or equal to the width of the CTU; The height of the current block is less than or equal to the height of the CTU.
4. The method according to claim 1, characterized in that, The region index of the current block is determined based on the first index, or based on the first index and the region lookup table; The first index is determined based on the position coordinates of the current block and the size of the current block.
5. The method according to claim 4, characterized in that, The first index includes a second index and a third index. The second index is determined based on the horizontal coordinate of the current block and the width of the current block, and the third index is determined based on the vertical coordinate of the current block and the height of the current block.
6. The method according to claim 5, characterized in that, The second index is determined based on a first ratio between the horizontal coordinate of the current block's position and the width of the current block; The third index is determined based on a second ratio of the ordinate of the current block's position to the height of the current block.
7. The method according to claim 6, characterized in that, The second index is the minimum of the first ratio and the first value, where the first value is related to the maximum number of regions in the horizontal direction of the CTU or image; The third index is the minimum of the second ratio and the second value, which is related to the maximum number of regions in the vertical direction of the CTU or image.
8. The method according to any one of claims 5 to 7, characterized in that, The horizontal coordinate of the current block's position is the horizontal coordinate of the upper left corner of the current block relative to the first position, and the vertical coordinate of the current block's position is the vertical coordinate of the upper left corner of the current block relative to the first position. The first position is either the upper left corner of the CTU or the upper left corner of the image.
9. The method according to any one of claims 5 to 7, characterized in that, The region index of the current block is determined based on the first index; The region index of the current block is the sum of the second index and the third value, the third value is the product of the third index and the fourth value, and the fourth value is the number of blocks contained in the horizontal direction.
10. The method according to any one of claims 5 to 7, characterized in that, The region index of the current block is determined based on the first index and the region lookup table; The region index of the current block is a value determined from the region lookup table based on the second index and the third index.
11. The method according to claim 10, characterized in that, The region index of the current block is the value corresponding to the second position in the region lookup table. The second position is the position where the horizontal coordinate is the second index and the vertical coordinate is the third index.
12. The method according to claim 4, 10 or 11, characterized in that, The area lookup table is determined based on the location coordinates of the CTU. The position coordinates of the CTU are the coordinates of the CTU relative to the upper left corner of the image.
13. The method according to claim 4, 10 or 11, characterized in that, The method further includes: The first syntax element in the code stream is parsed to obtain the first indication information, which is used to indicate the index of the region lookup table.
14. The method according to claim 1, characterized in that, The step of performing loop filtering on the reconstructed block of the current block based on the first information, the set of filtering coefficients, and the region index of the current block includes: Based on the first information, determine the region corresponding to the filter coefficient group in the filter coefficient set; Based on the region corresponding to the filter coefficient group and the region index of the current block, a first filter coefficient group is determined from the filter coefficient set; Loop filtering is performed on the reconstructed block of the current block based on the first set of filtering coefficients.
15. The method according to claim 1, characterized in that, The parsed bitstream yields first information, including: The first information is obtained by parsing the second syntax element in the code stream.
16. The method according to claim 1, characterized in that, The method further includes: The third syntax element in the bitstream is parsed to obtain the set of filter coefficients.
17. The method according to claim 1, characterized in that, The method further includes: Parse the fourth syntax element in the bitstream to obtain second indication information. The second indication information is used to indicate whether to perform loop filtering on the reconstruction block of the current block. The reconstruction block includes at least one of the following: a reconstruction block of the luminance component, a reconstruction block of the first chrominance component, and a reconstruction block of the second chrominance component.
18. The method according to claim 1, characterized in that, The method further includes: Parse the fifth syntax element in the bitstream to obtain second information, which is used to characterize the maximum number of filter coefficient sets that can be used in a region of the image, the maximum number being the number of regions in the image.
19. The method according to claim 1, characterized in that, The method further includes: The sixth syntax element in the bitstream is parsed to obtain the scaling factor corresponding to the set of filter coefficients. The scaling factor is used to integrate the filter coefficients determined based on the set of filter coefficients.
20. The method according to any one of claims 1 to 19, characterized in that, The current block is a block in the CTU; or, the current block is a block in the image.
21. The method according to claim 20, characterized in that, The current block is a block in CTU, and the reconstructed block includes at least one of the following: a reconstructed block of the luminance component, a reconstructed block of the first chrominance component, and a reconstructed block of the second chrominance component; or, The current block is a block in the image, and the reconstructed block includes at least one of the following: a reconstructed block of the first chromaticity component and a reconstructed block of the second chromaticity component.
22. An encoding method, characterized in that, include: Based on the first information, the set of filter coefficients, and the region index of the current block, loop filtering is performed on the reconstructed block of the current block, wherein the first information is used to determine the region corresponding to the filter coefficient group in the set of filter coefficients; Write the first information into the bitstream; The region index of the current block is determined based on the size of the current block.
23. The method according to claim 22, characterized in that, The size of the current block is less than or equal to the size of the coding tree unit (CTU).
24. The method according to claim 23, characterized in that, The size of the current block being less than or equal to the size of the CTU includes at least one of the following: The width of the current block is less than or equal to the width of the CTU; The height of the current block is less than or equal to the height of the CTU.
25. The method according to claim 22, characterized in that, The region index of the current block is determined based on the first index, or based on the first index and the region lookup table; The first index is determined based on the position coordinates of the current block and the size of the current block.
26. The method according to claim 25, characterized in that, The first index includes a second index and a third index. The second index is determined based on the horizontal coordinate of the current block and the width of the current block, and the third index is determined based on the vertical coordinate of the current block and the height of the current block.
27. The method according to claim 26, characterized in that, The second index is determined based on a first ratio between the horizontal coordinate of the current block's position and the width of the current block; The third index is determined based on a second ratio of the ordinate of the current block's position to the height of the current block.
28. The method according to claim 27, characterized in that, The second index is the minimum of the first ratio and the first value, where the first value is related to the maximum number of regions in the horizontal direction of the CTU or image; The third index is the minimum of the second ratio and the second value, which is related to the maximum number of regions in the vertical direction of the CTU or image.
29. The method according to any one of claims 26 to 28, characterized in that, The horizontal coordinate of the current block's position is the horizontal coordinate of the upper left corner of the current block relative to the first position, and the vertical coordinate of the current block's position is the vertical coordinate of the upper left corner of the current block relative to the first position. The first position is either the upper left corner of the CTU or the upper left corner of the image.
30. The method according to any one of claims 26 to 28, characterized in that, The region index of the current block is determined based on the first index; The region index of the current block is the sum of the second index and the third value, the third value is the product of the third index and the fourth value, and the fourth value is the number of blocks contained in the horizontal direction.
31. The method according to any one of claims 26 to 28, characterized in that, The region index of the current block is determined based on the first index and the region lookup table; The region index of the current block is a value determined from the region lookup table based on the second index and the third index.
32. The method according to claim 31, characterized in that, The region index of the current block is the value corresponding to the second position in the region lookup table. The second position is the position where the horizontal coordinate is the second index and the vertical coordinate is the third index.
33. The method according to claim 25, 31 or 32, characterized in that, The area lookup table is determined based on the location coordinates of the CTU. The position coordinates of the CTU are the coordinates of the CTU relative to the upper left corner of the image.
34. The method according to claim 25, 31 or 32, characterized in that, The method further includes: A first syntax element is written into the code stream, the first syntax element being used to characterize first indication information, the first indication information being used to indicate the index of the region lookup table.
35. The method according to claim 22, characterized in that, The step of performing loop filtering on the reconstructed block of the current block based on the first information, the set of filter coefficients, and the region index of the current block includes: Based on the first information, determine the region corresponding to the filter coefficient group in the filter coefficient set; Based on the region corresponding to the filter coefficient group and the region index of the current block, a first filter coefficient group is determined from the filter coefficient set; Loop filtering is performed on the reconstructed block of the current block based on the first set of filtering coefficients.
36. The method according to claim 22, characterized in that, The step of writing the first information into the bitstream includes: A second syntax element is written into the code stream, the second syntax element being used to characterize the first information.
37. The method according to claim 22, characterized in that, The method further includes: A third syntax element is written into the bitstream, the third syntax element being used to characterize the set of filter coefficients.
38. The method according to claim 22, characterized in that, The method further includes: A fourth syntax element is written into the bitstream. The fourth syntax element is used to characterize second indication information. The second indication information is used to indicate whether to perform loop filtering on the reconstructed block of the current block. The reconstructed block includes at least one of the following: a reconstructed block of the luminance component, a reconstructed block of the first chrominance component, and a reconstructed block of the second chrominance component.
39. The method according to claim 22, characterized in that, The method further includes: A fifth syntax element is written into the bitstream. The fifth syntax element is used to characterize second information, which is used to characterize the maximum number of filter coefficient sets that can be used in a region of the image. The maximum number is the number of regions in the image.
40. The method according to claim 22, characterized in that, The method further includes: The sixth syntax element is written into the bitstream. The sixth syntax element is used to characterize the scaling factor corresponding to the set of filter coefficients. The scaling factor is used to integrate the filter coefficients determined based on the set of filter coefficients.
41. The method according to any one of claims 22 to 40, characterized in that, The current block is a block in the CTU; or, the current block is a block in the image.
42. The method according to claim 41, characterized in that, The current block is a block in CTU, and the reconstructed block includes at least one of the following: a reconstructed block of the luminance component, a reconstructed block of the first chrominance component, and a reconstructed block of the second chrominance component; or, The current block is a block in the image, and the reconstructed block includes at least one of the following: a reconstructed block of the first chromaticity component and a reconstructed block of the second chromaticity component.
43. A decoding device, characterized in that, include: Analysis module and filtering module; The parsing module is used to parse the bitstream to obtain first information, which is used to determine the region corresponding to the filter coefficient group in the filter coefficient set. The filtering module is used to perform loop filtering on the reconstructed block of the current block based on the first information, the set of filtering coefficients, and the region index of the current block; The region index of the current block is determined based on the size of the current block.
44. The apparatus according to claim 43, characterized in that, The size of the current block is less than or equal to the size of the coding tree unit (CTU).
45. The apparatus according to claim 44, characterized in that, The size of the current block being less than or equal to the size of the CTU includes at least one of the following: The width of the current block is less than or equal to the width of the CTU; The height of the current block is less than or equal to the height of the CTU.
46. The apparatus according to claim 43, characterized in that, The region index of the current block is determined based on the first index, or based on the first index and the region lookup table; The first index is determined based on the position coordinates of the current block and the size of the current block.
47. The apparatus according to claim 46, characterized in that, The first index includes a second index and a third index. The second index is determined based on the horizontal coordinate of the current block and the width of the current block, and the third index is determined based on the vertical coordinate of the current block and the height of the current block.
48. The apparatus according to claim 47, characterized in that, The second index is determined based on a first ratio between the horizontal coordinate of the current block's position and the width of the current block; The third index is determined based on a second ratio of the ordinate of the current block's position to the height of the current block.
49. The apparatus according to claim 48, characterized in that, The second index is the minimum of the first ratio and the first value, where the first value is related to the maximum number of regions in the horizontal direction of the CTU or image; The third index is the minimum of the second ratio and the second value, which is related to the maximum number of regions in the vertical direction of the CTU or image.
50. The apparatus according to any one of claims 47 to 49, characterized in that, The horizontal coordinate of the current block's position is the horizontal coordinate of the upper left corner of the current block relative to the first position, and the vertical coordinate of the current block's position is the vertical coordinate of the upper left corner of the current block relative to the first position. The first position is either the upper left corner of the CTU or the upper left corner of the image.
51. The apparatus according to any one of claims 47 to 49, characterized in that, The region index of the current block is determined based on the first index; The region index of the current block is the sum of the second index and the third value, the third value is the product of the third index and the fourth value, and the fourth value is the number of blocks contained in the horizontal direction.
52. The apparatus according to any one of claims 47 to 49, characterized in that, The region index of the current block is determined based on the first index and the region lookup table; The region index of the current block is a value determined from the region lookup table based on the second index and the third index.
53. The apparatus according to claim 52, characterized in that, The region index of the current block is the value corresponding to the second position in the region lookup table. The second position is the position where the horizontal coordinate is the second index and the vertical coordinate is the third index.
54. The apparatus according to claim 46, 52 or 53, characterized in that, The area lookup table is determined based on the location coordinates of the CTU. The position coordinates of the CTU are the coordinates of the CTU relative to the upper left corner of the image.
55. The apparatus according to claim 46, 52 or 53, characterized in that, The parsing module is further configured to parse the first syntax element in the code stream to obtain first indication information, the first indication information being used to indicate the index of the region lookup table.
56. The apparatus according to claim 43, characterized in that, The filtering module is specifically used for: Based on the first information, determine the region corresponding to the filter coefficient group in the filter coefficient set; Based on the region corresponding to the filter coefficient group and the region index of the current block, a first filter coefficient group is determined from the filter coefficient set; Loop filtering is performed on the reconstructed block of the current block based on the first set of filtering coefficients.
57. The apparatus according to claim 43, characterized in that, The parsing module is specifically used for: The first information is obtained by parsing the second syntax element in the code stream.
58. The apparatus according to claim 43, characterized in that, The parsing module is also used to parse the third syntax element in the bitstream to obtain the set of filter coefficients.
59. The apparatus according to claim 43, characterized in that, The parsing module is further configured to parse the fourth syntax element in the bitstream to obtain second indication information. The second indication information is used to indicate whether to perform loop filtering on the reconstruction block of the current block. The reconstruction block includes at least one of the following: a reconstruction block of the luminance component, a reconstruction block of the first chrominance component, and a reconstruction block of the second chrominance component.
60. The apparatus according to claim 43, characterized in that, The parsing module is further configured to parse the fifth syntax element in the bitstream to obtain second information, which is used to characterize the maximum number of filter coefficient sets that can be used in a region of the image, the maximum number being the number of regions in the image.
61. The apparatus according to claim 43, characterized in that, The parsing module is further configured to parse the sixth syntax element in the bitstream to obtain the scaling factor corresponding to the set of filter coefficients. The scaling factor is used to integrate the filter coefficients determined based on the set of filter coefficients.
62. The apparatus according to any one of claims 43 to 61, characterized in that, The current block is a block in the CTU; or, the current block is a block in the image.
63. The apparatus according to claim 62, characterized in that, The current block is a block in CTU, and the reconstructed block includes at least one of the following: a reconstructed block of the luminance component, a reconstructed block of the first chrominance component, and a reconstructed block of the second chrominance component; or, The current block is a block in the image, and the reconstructed block includes at least one of the following: a reconstructed block of the first chromaticity component and a reconstructed block of the second chromaticity component.
64. An encoding device, characterized in that, include: Filtering module and encoding module; The filtering module is used to perform loop filtering on the reconstructed block of the current block based on the first information, the set of filtering coefficients and the region index of the current block, wherein the first information is used to determine the region corresponding to the filtering coefficient group in the set of filtering coefficients; The encoding module is used to write the first information into the bitstream; The region index of the current block is determined based on the size of the current block.
65. The apparatus according to claim 64, characterized in that, The size of the current block is less than or equal to the size of the coding tree unit (CTU).
66. The apparatus according to claim 65, characterized in that, The size of the current block being less than or equal to the size of the CTU includes at least one of the following: The width of the current block is less than or equal to the width of the CTU; The height of the current block is less than or equal to the height of the CTU.
67. The apparatus according to claim 64, characterized in that, The region index of the current block is determined based on the first index, or based on the first index and the region lookup table; The first index is determined based on the position coordinates of the current block and the size of the current block.
68. The apparatus according to claim 67, characterized in that, The first index includes a second index and a third index. The second index is determined based on the horizontal coordinate of the current block and the width of the current block, and the third index is determined based on the vertical coordinate of the current block and the height of the current block.
69. The apparatus according to claim 68, characterized in that, The second index is determined based on a first ratio between the horizontal coordinate of the current block's position and the width of the current block; The third index is determined based on a second ratio of the ordinate of the current block's position to the height of the current block.
70. The apparatus according to claim 69, characterized in that, The second index is the minimum of the first ratio and the first value, where the first value is related to the maximum number of regions in the horizontal direction of the CTU or image; The third index is the minimum of the second ratio and the second value, which is related to the maximum number of regions in the vertical direction of the CTU or image.
71. The apparatus according to any one of claims 68 to 70, characterized in that, The horizontal coordinate of the current block's position is the horizontal coordinate of the upper left corner of the current block relative to the first position, and the vertical coordinate of the current block's position is the vertical coordinate of the upper left corner of the current block relative to the first position. The first position is either the upper left corner of the CTU or the upper left corner of the image.
72. The apparatus according to any one of claims 68 to 70, characterized in that, The region index of the current block is determined based on the first index; The region index of the current block is the sum of the second index and the third value, the third value is the product of the third index and the fourth value, and the fourth value is the number of blocks contained in the horizontal direction.
73. The apparatus according to any one of claims 68 to 70, characterized in that, The region index of the current block is determined based on the first index and the region lookup table; The region index of the current block is a value determined from the region lookup table based on the second index and the third index.
74. The apparatus according to claim 73, characterized in that, The region index of the current block is the value corresponding to the second position in the region lookup table. The second position is the position where the horizontal coordinate is the second index and the vertical coordinate is the third index.
75. The apparatus according to claim 67, 73 or 74, characterized in that, The area lookup table is determined based on the location coordinates of the CTU. The position coordinates of the CTU are the coordinates of the CTU relative to the upper left corner of the image.
76. The apparatus according to claim 67, 73 or 74, characterized in that, The encoding module is further configured to write a first syntax element into the code stream, the first syntax element being used to characterize first indication information, the first indication information being used to indicate the index of the region lookup table.
77. The apparatus according to claim 64, characterized in that, The filtering module is specifically used for: Based on the first information, determine the region corresponding to the filter coefficient group in the filter coefficient set; Based on the region corresponding to the filter coefficient group and the region index of the current block, a first filter coefficient group is determined from the filter coefficient set; Loop filtering is performed on the reconstructed block of the current block based on the first set of filtering coefficients.
78. The apparatus according to claim 64, characterized in that, The encoding module is specifically used for: A second syntax element is written into the code stream, the second syntax element being used to characterize the first information.
79. The apparatus according to claim 64, characterized in that, The encoding module is further configured to write a third syntax element into the bitstream, the third syntax element being used to characterize the set of filter coefficients.
80. The apparatus according to claim 64, characterized in that, The encoding module is further configured to write a fourth syntax element into the bitstream. The fourth syntax element is used to characterize second indication information. The second indication information is used to indicate whether to perform loop filtering on the reconstructed block of the current block. The reconstructed block includes at least one of the following: a reconstructed block of the luminance component, a reconstructed block of the first chrominance component, and a reconstructed block of the second chrominance component.
81. The apparatus according to claim 64, characterized in that, The encoding module is further configured to write a fifth syntax element into the bitstream, the fifth syntax element being used to characterize second information, the second information being used to characterize the maximum number of filter coefficient sets that can be used in a region of the image, the maximum number being the number of regions in the image.
82. The apparatus according to claim 64, characterized in that, The encoding module is further configured to write a sixth syntax element into the bitstream, the sixth syntax element being used to characterize the scaling factor corresponding to the set of filter coefficients, the scaling factor being used to integrate the filter coefficients determined based on the set of filter coefficients.
83. The apparatus according to any one of claims 64 to 82, characterized in that, The current block is a block in the CTU; or, the current block is a block in the image.
84. The apparatus according to claim 83, characterized in that, The current block is a block in CTU, and the reconstructed block includes at least one of the following: a reconstructed block of the luminance component, a reconstructed block of the first chrominance component, and a reconstructed block of the second chrominance component; or, The current block is a block in the image, and the reconstructed block includes at least one of the following: a reconstructed block of the first chromaticity component and a reconstructed block of the second chromaticity component.
85. A decoder, characterized in that, include: A memory and a processor, wherein the memory is used to store executable data instructions, and the processor is used to implement the decoding method as described in any one of claims 1 to 21 when executing the executable instructions stored in the memory.
86. An encoder, characterized in that, include: A memory and a processor, wherein the memory is used to store executable data instructions, and the processor is used to implement the encoding method as described in any one of claims 22 to 42 when executing the executable instructions stored in the memory.
87. A computer storage medium, characterized in that, The computer storage medium is used to store the bitstream generated by the encoding method as described in any one of claims 20 to 38.
88. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by at least one processor, implements the decoding method as described in any one of claims 1 to 21, or the encoding method as described in any one of claims 22 to 42.
89. A computer program product, characterized in that, It includes computer program instructions, which, when executed, implement the decoding method as described in any one of claims 1 to 21, or the encoding method as described in any one of claims 22 to 42.